@oslokommune/punkt-react 16.17.2 → 16.17.4

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.
@@ -887,7 +887,7 @@
887
887
  `:j`
888
888
  <span class="pkt-header-service__logo" @click=${this.handleLogoClick}>${e}</span>
889
889
  `}renderServiceName(){return this.serviceName?this.serviceLink&&typeof this.serviceLink==`string`?j`
890
- <span class="pkt-header-service__service-name">
890
+ <span class="pkt-header-service__service-name" translate="no">
891
891
  <pkt-link
892
892
  href=${this.serviceLink}
893
893
  class="pkt-header-service__service-link"
@@ -897,7 +897,7 @@
897
897
  </pkt-link>
898
898
  </span>
899
899
  `:this.hasAttribute(`service-link`)?j`
900
- <span class="pkt-header-service__service-name">
900
+ <span class="pkt-header-service__service-name" translate="no">
901
901
  <button
902
902
  class="pkt-link-button pkt-link pkt-header-service__service-link"
903
903
  @click=${this.handleServiceClick}
@@ -906,7 +906,7 @@
906
906
  </button>
907
907
  </span>
908
908
  `:j`
909
- <span class="pkt-header-service__service-name" @click=${this.handleServiceClick}>
909
+ <span class="pkt-header-service__service-name" translate="no" @click=${this.handleServiceClick}>
910
910
  <span class="pkt-header-service__service-link">${this.serviceName}</span>
911
911
  </span>
912
912
  `:N}renderSlotContainer(){if(!this.hasSlotContent())return N;let e=q({"pkt-header-service__slot-container":!0,"is-open":this.openMenu===`slot`}),t=q({"pkt-header-service__slot-content":!0,"align-right":this.alignSlotRight});return j`
@@ -1006,7 +1006,7 @@
1006
1006
  @click=${()=>this.handleMenuToggle(`user`)}
1007
1007
  >
1008
1008
  <span class="pkt-sr-only">Brukermeny: </span>
1009
- <span>${this.representing?.name||this.user.name}</span>
1009
+ <span translate="no">${this.representing?.name||this.user.name}</span>
1010
1010
  </pkt-button>
1011
1011
  ${this.openMenu===`user`&&this.user?j`
1012
1012
  <div class=${e}>
@@ -1484,7 +1484,7 @@
1484
1484
  </div>
1485
1485
  </pkt-input-wrapper>
1486
1486
  ${this.renderCalendar()}
1487
- `}handleCalendarPosition(){let e=this.multiple&&!!this.maxlength;Ga.handleCalendarPosition(this.popupRef,this.inputRef,e)}async showCalendar(){let e=this.datepickerPopupRef.value;if(this.calendarOpen=!0,e&&typeof e.show==`function`){e.show(),Aa()&&e.focusOnCurrentDate();return}await yi(20),this.handleCalendarPosition(),Aa()&&this.calRef.value?.focusOnCurrentDate()}hideCalendar(){let e=this.datepickerPopupRef.value;if(this.calendarOpen=!1,e&&typeof e.hide==`function`)return e.hide()}async toggleCalendar(e){e.preventDefault();let t=this.datepickerPopupRef.value;if(t&&typeof t.toggle==`function`){let e=!!t.open;t.toggle(),this.calendarOpen=!e;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}))}};K([W({type:String,reflect:!0})],eo.prototype,`value`,null),K([W({type:String,reflect:!0})],eo.prototype,`label`,void 0),K([W({type:String})],eo.prototype,`dateformat`,void 0),K([W({type:Boolean,reflect:!0})],eo.prototype,`multiple`,void 0),K([W({type:Number,reflect:!0})],eo.prototype,`maxlength`,void 0),K([W({type:Boolean,reflect:!0})],eo.prototype,`range`,void 0),K([W({type:Boolean,attribute:`show-range-labels`})],eo.prototype,`showRangeLabels`,void 0),K([W({type:String,reflect:!0})],eo.prototype,`min`,void 0),K([W({type:String,reflect:!0})],eo.prototype,`max`,void 0),K([W({type:Boolean})],eo.prototype,`weeknumbers`,void 0),K([W({type:Boolean,reflect:!0})],eo.prototype,`withcontrols`,void 0),K([W({converter:Br.csvToArray})],eo.prototype,`excludedates`,void 0),K([W({converter:Br.csvToArray})],eo.prototype,`excludeweekdays`,void 0),K([W({type:String})],eo.prototype,`currentmonth`,void 0),K([W({type:String})],eo.prototype,`today`,void 0),K([W({type:Boolean,reflect:!0,attribute:`calendar-open`})],eo.prototype,`calendarOpen`,void 0),K([W({type:String})],eo.prototype,`timezone`,void 0),K([G()],eo.prototype,`inputClasses`,void 0);try{U(`pkt-datepicker`)(eo)}catch{console.warn(`Forsøker å definere <pkt-datepicker>, men den er allerede definert`)}var to=f({default:()=>ho});function no(e,t){var n=`on`+t.type.toLowerCase();return typeof e[n]==`function`&&e[n](t),e.dispatchEvent(t)}function ro(e){for(;e&&e!==document.body;){var t=window.getComputedStyle(e),n=function(e,n){return!(t[e]===void 0||t[e]===n)};if(t.opacity<1||n(`zIndex`,`auto`)||n(`transform`,`none`)||n(`mixBlendMode`,`normal`)||n(`filter`,`none`)||n(`perspective`,`none`)||t.isolation===`isolate`||t.position===`fixed`||t.webkitOverflowScrolling===`touch`)return!0;e=e.parentElement}return!1}function io(e){for(;e;){if(e.localName===`dialog`)return e;e=e.parentElement?e.parentElement:e.parentNode?e.parentNode.host:null}return null}function ao(e){for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;e&&e.blur&&e!==document.body&&e.blur()}function oo(e,t){for(var n=0;n<e.length;++n)if(e[n]===t)return!0;return!1}function so(e){return!e||!e.hasAttribute(`method`)?!1:e.getAttribute(`method`).toLowerCase()===`dialog`}function co(e){var t=[`button`,`input`,`keygen`,`select`,`textarea`].map(function(e){return e+`:not([disabled])`});t.push(`[tabindex]:not([disabled]):not([tabindex=""])`);var n=e.querySelector(t.join(`, `));if(!n&&`attachShadow`in Element.prototype)for(var r=e.querySelectorAll(`*`),i=0;i<r.length&&!(r[i].tagName&&r[i].shadowRoot&&(n=co(r[i].shadowRoot),n));i++);return n}function lo(e){return e.isConnected||document.body.contains(e)}function uo(e){if(e.submitter)return e.submitter;var t=e.target;if(!(t instanceof HTMLFormElement))return null;var n=ho.formSubmitter;if(!n){var r=e.target;n=(`getRootNode`in r&&r.getRootNode()||document).activeElement}return!n||n.form!==t?null:n}function fo(e){if(!e.defaultPrevented){var t=e.target,n=ho.imagemapUseValue,r=uo(e);n===null&&r&&(n=r.value);var i=io(t);i&&(r&&r.getAttribute(`formmethod`)||t.getAttribute(`method`))===`dialog`&&(e.preventDefault(),n==null?i.close():i.close(n))}}function po(e){if(this.dialog_=e,this.replacedStyleTop_=!1,this.openAsModal_=!1,e.hasAttribute(`role`)||e.setAttribute(`role`,`dialog`),e.show=this.show.bind(this),e.showModal=this.showModal.bind(this),e.close=this.close.bind(this),e.addEventListener(`submit`,fo,!1),`returnValue`in e||(e.returnValue=``),`MutationObserver`in window)new MutationObserver(this.maybeHideModal.bind(this)).observe(e,{attributes:!0,attributeFilter:[`open`]});else{var t=!1,n=function(){t?this.downgradeModal():this.maybeHideModal(),t=!1}.bind(this),r,i=function(i){if(i.target===e){var a=`DOMNodeRemoved`;t|=i.type.substr(0,a.length)===a,window.clearTimeout(r),r=window.setTimeout(n,0)}};[`DOMAttrModified`,`DOMNodeRemoved`,`DOMNodeRemovedFromDocument`].forEach(function(t){e.addEventListener(t,i)})}Object.defineProperty(e,`open`,{set:this.setOpen.bind(this),get:e.hasAttribute.bind(e,`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))}var mo,ho,go,_o,vo,yo,bo,xo,So=u((()=>{mo=window.CustomEvent,(!mo||typeof mo==`object`)&&(mo=function(e,t){t||={};var n=document.createEvent(`CustomEvent`);return n.initCustomEvent(e,!!t.bubbles,!!t.cancelable,t.detail||null),n},mo.prototype=window.Event.prototype),po.prototype={get dialog(){return this.dialog_},maybeHideModal:function(){this.dialog_.hasAttribute(`open`)&&lo(this.dialog_)||this.downgradeModal()},downgradeModal:function(){this.openAsModal_&&(this.openAsModal_=!1,this.dialog_.style.zIndex=``,this.replacedStyleTop_&&=(this.dialog_.style.top=``,!1),this.backdrop_.parentNode&&this.backdrop_.parentNode.removeChild(this.backdrop_),ho.dm.removeDialog(this))},setOpen:function(e){e?this.dialog_.hasAttribute(`open`)||this.dialog_.setAttribute(`open`,``):(this.dialog_.removeAttribute(`open`),this.maybeHideModal())},backdropMouseEvent_:function(e){if(this.dialog_.hasAttribute(`tabindex`))this.dialog_.focus();else{var t=document.createElement(`div`);this.dialog_.insertBefore(t,this.dialog_.firstChild),t.tabIndex=-1,t.focus(),this.dialog_.removeChild(t)}var n=document.createEvent(`MouseEvents`);n.initMouseEvent(e.type,e.bubbles,e.cancelable,window,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget),this.dialog_.dispatchEvent(n),e.stopPropagation()},focus_:function(){var e=this.dialog_.querySelector(`[autofocus]:not([disabled])`);!e&&this.dialog_.tabIndex>=0&&(e=this.dialog_),e||=co(this.dialog_),ao(document.activeElement),e&&e.focus()},updateZIndex:function(e,t){if(e<t)throw Error(`dialogZ should never be < backdropZ`);this.dialog_.style.zIndex=e,this.backdrop_.style.zIndex=t},show:function(){this.dialog_.open||(this.setOpen(!0),this.focus_())},showModal:function(){if(this.dialog_.hasAttribute(`open`))throw Error(`Failed to execute 'showModal' on dialog: The element is already open, and therefore cannot be opened modally.`);if(!lo(this.dialog_))throw Error(`Failed to execute 'showModal' on dialog: The element is not in a Document.`);if(!ho.dm.pushDialog(this))throw Error(`Failed to execute 'showModal' on dialog: There are too many open modal dialogs.`);ro(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,ho.needsCentering(this.dialog_)?(ho.reposition(this.dialog_),this.replacedStyleTop_=!0):this.replacedStyleTop_=!1,this.dialog_.parentNode.insertBefore(this.backdrop_,this.dialog_.nextSibling),this.focus_()},close:function(e){if(!this.dialog_.hasAttribute(`open`))throw Error(`Failed to execute 'close' on dialog: The element does not have an 'open' attribute, and therefore cannot be closed.`);this.setOpen(!1),e!==void 0&&(this.dialog_.returnValue=e);var t=new mo(`close`,{bubbles:!1,cancelable:!1});no(this.dialog_,t)}},ho={},ho.reposition=function(e){var t=document.body.scrollTop||document.documentElement.scrollTop,n=t+(window.innerHeight-e.offsetHeight)/2;e.style.top=Math.max(t,n)+`px`},ho.isInlinePositionSetByStylesheet=function(e){for(var t=0;t<document.styleSheets.length;++t){var n=document.styleSheets[t],r=null;try{r=n.cssRules}catch{}if(r)for(var i=0;i<r.length;++i){var a=r[i],o=null;try{o=document.querySelectorAll(a.selectorText)}catch{}if(!(!o||!oo(o,e))){var s=a.style.getPropertyValue(`top`),c=a.style.getPropertyValue(`bottom`);if(s&&s!==`auto`||c&&c!==`auto`)return!0}}}return!1},ho.needsCentering=function(e){return window.getComputedStyle(e).position!==`absolute`||e.style.top!==`auto`&&e.style.top!==``||e.style.bottom!==`auto`&&e.style.bottom!==``?!1:!ho.isInlinePositionSetByStylesheet(e)},ho.forceRegisterDialog=function(e){if((window.HTMLDialogElement||e.showModal)&&console.warn(`This browser already supports <dialog>, the polyfill may not work correctly`,e),e.localName!==`dialog`)throw Error(`Failed to register dialog: The element is not a dialog.`);new po(e)},ho.registerDialog=function(e){e.showModal||ho.forceRegisterDialog(e)},ho.DialogManager=function(){this.pendingDialogStack=[];var e=this.checkDOM_.bind(this);this.overlay=document.createElement(`div`),this.overlay.className=`_dialog_overlay`,this.overlay.addEventListener(`click`,function(t){this.forwardTab_=void 0,t.stopPropagation(),e([])}.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(t){var n=[];t.forEach(function(e){for(var t=0,r;r=e.removedNodes[t];++t){if(r instanceof Element)r.localName===`dialog`&&n.push(r);else continue;n=n.concat(r.querySelectorAll(`dialog`))}}),n.length&&e(n)}))},ho.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})},ho.DialogManager.prototype.unblockDocument=function(){document.documentElement.removeEventListener(`focus`,this.handleFocus_,!0),document.removeEventListener(`keydown`,this.handleKey_),this.mo_&&this.mo_.disconnect()},ho.DialogManager.prototype.updateStacking=function(){for(var e=this.zIndexHigh_,t=0,n;n=this.pendingDialogStack[t];++t)n.updateZIndex(--e,--e),t===0&&(this.overlay.style.zIndex=--e);var r=this.pendingDialogStack[0];r?(r.dialog.parentNode||document.body).appendChild(this.overlay):this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay)},ho.DialogManager.prototype.containedByTopDialog_=function(e){for(;e=io(e);){for(var t=0,n;n=this.pendingDialogStack[t];++t)if(n.dialog===e)return t===0;e=e.parentElement}return!1},ho.DialogManager.prototype.handleFocus_=function(e){var t=e.composedPath?e.composedPath()[0]:e.target;if(!this.containedByTopDialog_(t)&&document.activeElement!==document.documentElement&&(e.preventDefault(),e.stopPropagation(),ao(t),this.forwardTab_!==void 0)){var n=this.pendingDialogStack[0];return n.dialog.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING&&(this.forwardTab_?n.focus_():t!==document.documentElement&&document.documentElement.focus()),!1}},ho.DialogManager.prototype.handleKey_=function(e){if(this.forwardTab_=void 0,e.keyCode===27){e.preventDefault(),e.stopPropagation();var t=new mo(`cancel`,{bubbles:!1,cancelable:!0}),n=this.pendingDialogStack[0];n&&no(n.dialog,t)&&n.dialog.close()}else e.keyCode===9&&(this.forwardTab_=!e.shiftKey)},ho.DialogManager.prototype.checkDOM_=function(e){this.pendingDialogStack.slice().forEach(function(t){e.indexOf(t.dialog)===-1?t.maybeHideModal():t.downgradeModal()})},ho.DialogManager.prototype.pushDialog=function(e){var t=(this.zIndexHigh_-this.zIndexLow_)/2-1;return this.pendingDialogStack.length>=t?!1:(this.pendingDialogStack.unshift(e)===1&&this.blockDocument(),this.updateStacking(),!0)},ho.DialogManager.prototype.removeDialog=function(e){var t=this.pendingDialogStack.indexOf(e);t!==-1&&(this.pendingDialogStack.splice(t,1),this.pendingDialogStack.length===0&&this.unblockDocument(),this.updateStacking())},ho.dm=new ho.DialogManager,ho.formSubmitter=null,ho.imagemapUseValue=null,window.HTMLDialogElement===void 0&&(go=document.createElement(`form`),go.setAttribute(`method`,`dialog`),go.method!==`dialog`&&(_o=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,`method`),_o&&(vo=_o.get,_o.get=function(){return so(this)?`dialog`:vo.call(this)},yo=_o.set,_o.set=function(e){return typeof e==`string`&&e.toLowerCase()===`dialog`?this.setAttribute(`method`,e):yo.call(this,e)},Object.defineProperty(HTMLFormElement.prototype,`method`,_o))),document.addEventListener(`click`,function(e){if(ho.formSubmitter=null,ho.imagemapUseValue=null,!e.defaultPrevented){var t=e.target;if(`composedPath`in e&&(t=e.composedPath().shift()||t),!(!t||!so(t.form))){if(!(t.type===`submit`&&[`button`,`input`].indexOf(t.localName)>-1)){if(!(t.localName===`input`&&t.type===`image`))return;ho.imagemapUseValue=e.offsetX+`,`+e.offsetY}io(t)&&(ho.formSubmitter=t)}}},!1),document.addEventListener(`submit`,function(e){var t=e.target;if(!io(t)){var n=uo(e);(n&&n.getAttribute(`formmethod`)||t.getAttribute(`method`))===`dialog`&&e.preventDefault()}}),bo=HTMLFormElement.prototype.submit,xo=function(){if(!so(this))return bo.call(this);var e=io(this);e&&e.close()},HTMLFormElement.prototype.submit=xo)})),Co={name:`pkt-modal`,react:`PktModal`,"css-class":`pkt-modal`,isElement:!0,isPureReact:!0,events:{"background-click":{description:`Event som trigges når bakgrunnen trykkes på`},close:{description:`Event som trigges når meldingsboksen lukkes`}},props:{open:{name:`Åpen`,description:`Deklarativ styring av modalens åpen/lukket-tilstand. Kan brukes i stedet for showModal()/close()-metodene.`,type:`boolean`,category:`tech`,default:!1},headingText:{name:`Heading text`,description:`Heading tekst på modalen`,type:`string`,category:`contents`},hideCloseButton:{name:`Gjem 'Lukk'-knapp`,description:`Gjemmer lukkeknappen. Dersom denne er satt til true, vil ikke lukkeknappen vises, og dermed er det viktig at man tilbyr en annen måte som f.eks. en knapp for å lukke modalen på.`,type:`boolean`,category:`ui`,default:!1},closeOnBackdropClick:{name:`Lukk modalen når bakgrunnen trykkes på`,description:`Lukk modalen når bakgrunnen trykkes på`,type:`boolean`,category:`tech`,default:!1},closeButtonSkin:{name:`Stil på lukkeknappen`,description:`Stil på lukkeknappen`,type:[`blue`,`yellow-filled`],category:`ui`,default:`blue`},size:{name:`Størrelse`,description:`Størrelsen på modalen`,type:[`small`,`medium`,`large`,`fit-content`],category:`ui`,default:`medium`},variant:{name:`Variant`,description:`Standard dialog eller skuff`,type:[`dialog`,`drawer`],category:`ui`,default:`dialog`},drawerPosition:{name:`Skuffposisjon`,description:`Posisjonen til skuffen`,type:[`left`,`right`],category:`ui`,default:`right`},transparentBackdrop:{name:`Gjennomsiktig bakgrunn`,description:`Bakgrunnen er gjennomsiktig`,type:`boolean`,category:`ui`,default:!1},removePadding:{name:`Fjern padding`,description:`Fjerner paddingen rundt innholdet i modalen`,type:`boolean`,category:`ui`,default:!1}},slots:{default:{description:`Innholdet i meldingen. Her tilbyr vi støtteklasser for å style 1-3 knapper i modalen.`}}},wo=class extends Dt{constructor(){super(),this.open=!1,this.headingText=``,this.removePadding=!1,this.hideCloseButton=Co.props.hideCloseButton.default,this.closeOnBackdropClick=Co.props.closeOnBackdropClick.default,this.closeButtonSkin=`blue`,this.size=Co.props.size.default,this.variant=`dialog`,this.drawerPosition=`right`,this.transparentBackdrop=!1,this.dialogRef=Y(),this._isOpen=!1,this.close=(e,t=!1)=>{if(!this._isOpen)return;this._isOpen=!1,this.open=!1,document.body.classList.remove(`pkt-modal--open`);let n=document.activeElement;n&&!this.isElementInViewport(n)&&n.scrollIntoView({behavior:`smooth`,block:`nearest`}),this.dispatchEvent(new CustomEvent(`close`,{detail:{origin:e},bubbles:!0,composed:!0})),t||this.dialogRef.value?.close(),this.requestUpdate()},this.showModal=(e=null)=>{this._isOpen=!0,this.open=!0,this.dialogRef.value?.showModal(),document.body.classList.add(`pkt-modal--open`),this.dispatchEvent(new CustomEvent(`showModal`,{detail:{origin:e},bubbles:!0,composed:!0})),this.requestUpdate()},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)}updated(e){super.updated(e),e.has(`open`)&&(this.open&&!this._isOpen?this.showModal():!this.open&&this._isOpen&&this.close(new Event(`close`),!1))}async firstUpdated(e){super.firstUpdated(e),this.dialogRef.value&&!window.HTMLDialogElement&&!this.dialogRef.value.showModal&&(`document`in window&&`createElement`in document&&(await Promise.resolve().then(()=>(So(),to)).then(e=>e.default)).registerDialog(this.dialogRef.value),this.dialogRef.value.addEventListener(`close`,()=>{this.close(new Event(`close`),!0)}))}handleKeyDown(e){e.key===`Escape`&&this.close(e)}handleBackdropClick(e){this.closeOnBackdropClick&&e.target===this.dialogRef?.value&&this.close(e)}isElementInViewport(e){let t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}render(){let e={"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`},t={"pkt-modal__headingText":!0,"pkt-txt-24":!0},n={"pkt-modal__content":!0,"pkt-txt-18-light":!0},r=this.closeButtonSkin===`blue`,i={"pkt-modal__closeButton":!0,[`pkt-modal__closeButton--${this.closeButtonSkin}`]:!0};return j`
1487
+ `}handleCalendarPosition(){let e=this.multiple&&!!this.maxlength;Ga.handleCalendarPosition(this.popupRef,this.inputRef,e)}async showCalendar(){let e=this.datepickerPopupRef.value;if(this.calendarOpen=!0,e&&typeof e.show==`function`){e.show(),Aa()&&e.focusOnCurrentDate();return}await yi(20),this.handleCalendarPosition(),Aa()&&this.calRef.value?.focusOnCurrentDate()}hideCalendar(){let e=this.datepickerPopupRef.value;if(this.calendarOpen=!1,e&&typeof e.hide==`function`)return e.hide()}async toggleCalendar(e){e.preventDefault();let t=this.datepickerPopupRef.value;if(t&&typeof t.toggle==`function`){let e=!!t.open;t.toggle(),this.calendarOpen=!e;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}))}};K([W({type:String,reflect:!0})],eo.prototype,`value`,null),K([W({type:String,reflect:!0})],eo.prototype,`label`,void 0),K([W({type:String})],eo.prototype,`dateformat`,void 0),K([W({type:Boolean,reflect:!0})],eo.prototype,`multiple`,void 0),K([W({type:Number,reflect:!0})],eo.prototype,`maxlength`,void 0),K([W({type:Boolean,reflect:!0})],eo.prototype,`range`,void 0),K([W({type:Boolean,attribute:`show-range-labels`})],eo.prototype,`showRangeLabels`,void 0),K([W({type:String,reflect:!0})],eo.prototype,`min`,void 0),K([W({type:String,reflect:!0})],eo.prototype,`max`,void 0),K([W({type:Boolean})],eo.prototype,`weeknumbers`,void 0),K([W({type:Boolean,reflect:!0})],eo.prototype,`withcontrols`,void 0),K([W({converter:Br.csvToArray})],eo.prototype,`excludedates`,void 0),K([W({converter:Br.csvToArray})],eo.prototype,`excludeweekdays`,void 0),K([W({type:String})],eo.prototype,`currentmonth`,void 0),K([W({type:String})],eo.prototype,`today`,void 0),K([W({type:Boolean,reflect:!0,attribute:`calendar-open`})],eo.prototype,`calendarOpen`,void 0),K([W({type:String})],eo.prototype,`timezone`,void 0),K([G()],eo.prototype,`inputClasses`,void 0);try{U(`pkt-datepicker`)(eo)}catch{console.warn(`Forsøker å definere <pkt-datepicker>, men den er allerede definert`)}var to=f({default:()=>ho});function no(e,t){var n=`on`+t.type.toLowerCase();return typeof e[n]==`function`&&e[n](t),e.dispatchEvent(t)}function ro(e){for(;e&&e!==document.body;){var t=window.getComputedStyle(e),n=function(e,n){return!(t[e]===void 0||t[e]===n)};if(t.opacity<1||n(`zIndex`,`auto`)||n(`transform`,`none`)||n(`mixBlendMode`,`normal`)||n(`filter`,`none`)||n(`perspective`,`none`)||t.isolation===`isolate`||t.position===`fixed`||t.webkitOverflowScrolling===`touch`)return!0;e=e.parentElement}return!1}function io(e){for(;e;){if(e.localName===`dialog`)return e;e=e.parentElement?e.parentElement:e.parentNode?e.parentNode.host:null}return null}function ao(e){for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;e&&e.blur&&e!==document.body&&e.blur()}function oo(e,t){for(var n=0;n<e.length;++n)if(e[n]===t)return!0;return!1}function so(e){return!e||!e.hasAttribute(`method`)?!1:e.getAttribute(`method`).toLowerCase()===`dialog`}function co(e){var t=[`button`,`input`,`keygen`,`select`,`textarea`].map(function(e){return e+`:not([disabled])`});t.push(`[tabindex]:not([disabled]):not([tabindex=""])`);var n=e.querySelector(t.join(`, `));if(!n&&`attachShadow`in Element.prototype)for(var r=e.querySelectorAll(`*`),i=0;i<r.length&&!(r[i].tagName&&r[i].shadowRoot&&(n=co(r[i].shadowRoot),n));i++);return n}function lo(e){return e.isConnected||document.body.contains(e)}function uo(e){if(e.submitter)return e.submitter;var t=e.target;if(!(t instanceof HTMLFormElement))return null;var n=ho.formSubmitter;if(!n){var r=e.target;n=(`getRootNode`in r&&r.getRootNode()||document).activeElement}return!n||n.form!==t?null:n}function fo(e){if(!e.defaultPrevented){var t=e.target,n=ho.imagemapUseValue,r=uo(e);n===null&&r&&(n=r.value);var i=io(t);i&&(r&&r.getAttribute(`formmethod`)||t.getAttribute(`method`))===`dialog`&&(e.preventDefault(),n==null?i.close():i.close(n))}}function po(e){if(this.dialog_=e,this.replacedStyleTop_=!1,this.openAsModal_=!1,e.hasAttribute(`role`)||e.setAttribute(`role`,`dialog`),e.show=this.show.bind(this),e.showModal=this.showModal.bind(this),e.close=this.close.bind(this),e.addEventListener(`submit`,fo,!1),`returnValue`in e||(e.returnValue=``),`MutationObserver`in window)new MutationObserver(this.maybeHideModal.bind(this)).observe(e,{attributes:!0,attributeFilter:[`open`]});else{var t=!1,n=function(){t?this.downgradeModal():this.maybeHideModal(),t=!1}.bind(this),r,i=function(i){if(i.target===e){var a=`DOMNodeRemoved`;t|=i.type.substr(0,a.length)===a,window.clearTimeout(r),r=window.setTimeout(n,0)}};[`DOMAttrModified`,`DOMNodeRemoved`,`DOMNodeRemovedFromDocument`].forEach(function(t){e.addEventListener(t,i)})}Object.defineProperty(e,`open`,{set:this.setOpen.bind(this),get:e.hasAttribute.bind(e,`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))}var mo,ho,go,_o,vo,yo,bo,xo,So=u((()=>{mo=window.CustomEvent,(!mo||typeof mo==`object`)&&(mo=function(e,t){t||={};var n=document.createEvent(`CustomEvent`);return n.initCustomEvent(e,!!t.bubbles,!!t.cancelable,t.detail||null),n},mo.prototype=window.Event.prototype),po.prototype={get dialog(){return this.dialog_},maybeHideModal:function(){this.dialog_.hasAttribute(`open`)&&lo(this.dialog_)||this.downgradeModal()},downgradeModal:function(){this.openAsModal_&&(this.openAsModal_=!1,this.dialog_.style.zIndex=``,this.replacedStyleTop_&&=(this.dialog_.style.top=``,!1),this.backdrop_.parentNode&&this.backdrop_.parentNode.removeChild(this.backdrop_),ho.dm.removeDialog(this))},setOpen:function(e){e?this.dialog_.hasAttribute(`open`)||this.dialog_.setAttribute(`open`,``):(this.dialog_.removeAttribute(`open`),this.maybeHideModal())},backdropMouseEvent_:function(e){if(this.dialog_.hasAttribute(`tabindex`))this.dialog_.focus();else{var t=document.createElement(`div`);this.dialog_.insertBefore(t,this.dialog_.firstChild),t.tabIndex=-1,t.focus(),this.dialog_.removeChild(t)}var n=document.createEvent(`MouseEvents`);n.initMouseEvent(e.type,e.bubbles,e.cancelable,window,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget),this.dialog_.dispatchEvent(n),e.stopPropagation()},focus_:function(){var e=this.dialog_.querySelector(`[autofocus]:not([disabled])`);!e&&this.dialog_.tabIndex>=0&&(e=this.dialog_),e||=co(this.dialog_),ao(document.activeElement),e&&e.focus()},updateZIndex:function(e,t){if(e<t)throw Error(`dialogZ should never be < backdropZ`);this.dialog_.style.zIndex=e,this.backdrop_.style.zIndex=t},show:function(){this.dialog_.open||(this.setOpen(!0),this.focus_())},showModal:function(){if(this.dialog_.hasAttribute(`open`))throw Error(`Failed to execute 'showModal' on dialog: The element is already open, and therefore cannot be opened modally.`);if(!lo(this.dialog_))throw Error(`Failed to execute 'showModal' on dialog: The element is not in a Document.`);if(!ho.dm.pushDialog(this))throw Error(`Failed to execute 'showModal' on dialog: There are too many open modal dialogs.`);ro(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,ho.needsCentering(this.dialog_)?(ho.reposition(this.dialog_),this.replacedStyleTop_=!0):this.replacedStyleTop_=!1,this.dialog_.parentNode.insertBefore(this.backdrop_,this.dialog_.nextSibling),this.focus_()},close:function(e){if(!this.dialog_.hasAttribute(`open`))throw Error(`Failed to execute 'close' on dialog: The element does not have an 'open' attribute, and therefore cannot be closed.`);this.setOpen(!1),e!==void 0&&(this.dialog_.returnValue=e);var t=new mo(`close`,{bubbles:!1,cancelable:!1});no(this.dialog_,t)}},ho={},ho.reposition=function(e){var t=document.body.scrollTop||document.documentElement.scrollTop,n=t+(window.innerHeight-e.offsetHeight)/2;e.style.top=Math.max(t,n)+`px`},ho.isInlinePositionSetByStylesheet=function(e){for(var t=0;t<document.styleSheets.length;++t){var n=document.styleSheets[t],r=null;try{r=n.cssRules}catch{}if(r)for(var i=0;i<r.length;++i){var a=r[i],o=null;try{o=document.querySelectorAll(a.selectorText)}catch{}if(!(!o||!oo(o,e))){var s=a.style.getPropertyValue(`top`),c=a.style.getPropertyValue(`bottom`);if(s&&s!==`auto`||c&&c!==`auto`)return!0}}}return!1},ho.needsCentering=function(e){return window.getComputedStyle(e).position!==`absolute`||e.style.top!==`auto`&&e.style.top!==``||e.style.bottom!==`auto`&&e.style.bottom!==``?!1:!ho.isInlinePositionSetByStylesheet(e)},ho.forceRegisterDialog=function(e){if((window.HTMLDialogElement||e.showModal)&&console.warn(`This browser already supports <dialog>, the polyfill may not work correctly`,e),e.localName!==`dialog`)throw Error(`Failed to register dialog: The element is not a dialog.`);new po(e)},ho.registerDialog=function(e){e.showModal||ho.forceRegisterDialog(e)},ho.DialogManager=function(){this.pendingDialogStack=[];var e=this.checkDOM_.bind(this);this.overlay=document.createElement(`div`),this.overlay.className=`_dialog_overlay`,this.overlay.addEventListener(`click`,function(t){this.forwardTab_=void 0,t.stopPropagation(),e([])}.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(t){var n=[];t.forEach(function(e){for(var t=0,r;r=e.removedNodes[t];++t){if(r instanceof Element)r.localName===`dialog`&&n.push(r);else continue;n=n.concat(r.querySelectorAll(`dialog`))}}),n.length&&e(n)}))},ho.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})},ho.DialogManager.prototype.unblockDocument=function(){document.documentElement.removeEventListener(`focus`,this.handleFocus_,!0),document.removeEventListener(`keydown`,this.handleKey_),this.mo_&&this.mo_.disconnect()},ho.DialogManager.prototype.updateStacking=function(){for(var e=this.zIndexHigh_,t=0,n;n=this.pendingDialogStack[t];++t)n.updateZIndex(--e,--e),t===0&&(this.overlay.style.zIndex=--e);var r=this.pendingDialogStack[0];r?(r.dialog.parentNode||document.body).appendChild(this.overlay):this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay)},ho.DialogManager.prototype.containedByTopDialog_=function(e){for(;e=io(e);){for(var t=0,n;n=this.pendingDialogStack[t];++t)if(n.dialog===e)return t===0;e=e.parentElement}return!1},ho.DialogManager.prototype.handleFocus_=function(e){var t=e.composedPath?e.composedPath()[0]:e.target;if(!this.containedByTopDialog_(t)&&document.activeElement!==document.documentElement&&(e.preventDefault(),e.stopPropagation(),ao(t),this.forwardTab_!==void 0)){var n=this.pendingDialogStack[0];return n.dialog.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING&&(this.forwardTab_?n.focus_():t!==document.documentElement&&document.documentElement.focus()),!1}},ho.DialogManager.prototype.handleKey_=function(e){if(this.forwardTab_=void 0,e.keyCode===27){e.preventDefault(),e.stopPropagation();var t=new mo(`cancel`,{bubbles:!1,cancelable:!0}),n=this.pendingDialogStack[0];n&&no(n.dialog,t)&&n.dialog.close()}else e.keyCode===9&&(this.forwardTab_=!e.shiftKey)},ho.DialogManager.prototype.checkDOM_=function(e){this.pendingDialogStack.slice().forEach(function(t){e.indexOf(t.dialog)===-1?t.maybeHideModal():t.downgradeModal()})},ho.DialogManager.prototype.pushDialog=function(e){var t=(this.zIndexHigh_-this.zIndexLow_)/2-1;return this.pendingDialogStack.length>=t?!1:(this.pendingDialogStack.unshift(e)===1&&this.blockDocument(),this.updateStacking(),!0)},ho.DialogManager.prototype.removeDialog=function(e){var t=this.pendingDialogStack.indexOf(e);t!==-1&&(this.pendingDialogStack.splice(t,1),this.pendingDialogStack.length===0&&this.unblockDocument(),this.updateStacking())},ho.dm=new ho.DialogManager,ho.formSubmitter=null,ho.imagemapUseValue=null,window.HTMLDialogElement===void 0&&(go=document.createElement(`form`),go.setAttribute(`method`,`dialog`),go.method!==`dialog`&&(_o=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,`method`),_o&&(vo=_o.get,_o.get=function(){return so(this)?`dialog`:vo.call(this)},yo=_o.set,_o.set=function(e){return typeof e==`string`&&e.toLowerCase()===`dialog`?this.setAttribute(`method`,e):yo.call(this,e)},Object.defineProperty(HTMLFormElement.prototype,`method`,_o))),document.addEventListener(`click`,function(e){if(ho.formSubmitter=null,ho.imagemapUseValue=null,!e.defaultPrevented){var t=e.target;if(`composedPath`in e&&(t=e.composedPath().shift()||t),!(!t||!so(t.form))){if(!(t.type===`submit`&&[`button`,`input`].indexOf(t.localName)>-1)){if(!(t.localName===`input`&&t.type===`image`))return;ho.imagemapUseValue=e.offsetX+`,`+e.offsetY}io(t)&&(ho.formSubmitter=t)}}},!1),document.addEventListener(`submit`,function(e){var t=e.target;if(!io(t)){var n=uo(e);(n&&n.getAttribute(`formmethod`)||t.getAttribute(`method`))===`dialog`&&e.preventDefault()}}),bo=HTMLFormElement.prototype.submit,xo=function(){if(!so(this))return bo.call(this);var e=io(this);e&&e.close()},HTMLFormElement.prototype.submit=xo)})),Co=`pkt-modal--open`,wo=`data-pkt-modal-open-count`,To=()=>{let e=document.body.getAttribute(wo),t=e?parseInt(e,10):0;return Number.isFinite(t)&&t>0?t:0},Eo=e=>{e<=0?(document.body.removeAttribute(wo),document.body.classList.remove(Co)):(document.body.setAttribute(wo,String(e)),document.body.classList.add(Co))},Do=e=>{e.locked||(e.locked=!0,Eo(To()+1))},Oo=e=>{e.locked&&(e.locked=!1,Eo(To()-1))},ko=()=>({locked:!1}),Ao={name:`pkt-modal`,react:`PktModal`,"css-class":`pkt-modal`,isElement:!0,isPureReact:!0,events:{"background-click":{description:`Event som trigges når bakgrunnen trykkes på`},close:{description:`Event som trigges når meldingsboksen lukkes`}},props:{open:{name:`Åpen`,description:`Deklarativ styring av modalens åpen/lukket-tilstand. Kan brukes i stedet for showModal()/close()-metodene.`,type:`boolean`,category:`tech`,default:!1},headingText:{name:`Heading text`,description:`Heading tekst på modalen`,type:`string`,category:`contents`},hideCloseButton:{name:`Gjem 'Lukk'-knapp`,description:`Gjemmer lukkeknappen. Dersom denne er satt til true, vil ikke lukkeknappen vises, og dermed er det viktig at man tilbyr en annen måte som f.eks. en knapp for å lukke modalen på.`,type:`boolean`,category:`ui`,default:!1},closeOnBackdropClick:{name:`Lukk modalen når bakgrunnen trykkes på`,description:`Lukk modalen når bakgrunnen trykkes på`,type:`boolean`,category:`tech`,default:!1},closeButtonSkin:{name:`Stil på lukkeknappen`,description:`Stil på lukkeknappen`,type:[`blue`,`yellow-filled`],category:`ui`,default:`blue`},size:{name:`Størrelse`,description:`Størrelsen på modalen`,type:[`small`,`medium`,`large`,`fit-content`],category:`ui`,default:`medium`},variant:{name:`Variant`,description:`Standard dialog eller skuff`,type:[`dialog`,`drawer`],category:`ui`,default:`dialog`},drawerPosition:{name:`Skuffposisjon`,description:`Posisjonen til skuffen`,type:[`left`,`right`],category:`ui`,default:`right`},transparentBackdrop:{name:`Gjennomsiktig bakgrunn`,description:`Bakgrunnen er gjennomsiktig`,type:`boolean`,category:`ui`,default:!1},removePadding:{name:`Fjern padding`,description:`Fjerner paddingen rundt innholdet i modalen`,type:`boolean`,category:`ui`,default:!1}},slots:{default:{description:`Innholdet i meldingen. Her tilbyr vi støtteklasser for å style 1-3 knapper i modalen.`}}},jo=class extends Dt{constructor(){super(),this.open=!1,this.headingText=``,this.removePadding=!1,this.hideCloseButton=Ao.props.hideCloseButton.default,this.closeOnBackdropClick=Ao.props.closeOnBackdropClick.default,this.closeButtonSkin=`blue`,this.size=Ao.props.size.default,this.variant=`dialog`,this.drawerPosition=`right`,this.transparentBackdrop=!1,this.dialogRef=Y(),this._scrollLockToken=ko(),this._isOpen=!1,this.close=(e,t=!1)=>{if(!this._isOpen)return;this._isOpen=!1,this.open=!1,Oo(this._scrollLockToken);let n=document.activeElement;n&&!this.isElementInViewport(n)&&n.scrollIntoView({behavior:`smooth`,block:`nearest`}),this.dispatchEvent(new CustomEvent(`close`,{detail:{origin:e},bubbles:!0,composed:!0})),t||this.dialogRef.value?.close(),this.requestUpdate()},this.showModal=(e=null)=>{this._isOpen=!0,this.open=!0,this.dialogRef.value?.showModal(),Do(this._scrollLockToken),this.dispatchEvent(new CustomEvent(`showModal`,{detail:{origin:e},bubbles:!0,composed:!0})),this.requestUpdate()},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),Oo(this._scrollLockToken)}updated(e){super.updated(e),e.has(`open`)&&(this.open&&!this._isOpen?this.showModal():!this.open&&this._isOpen&&this.close(new Event(`close`),!1))}async firstUpdated(e){super.firstUpdated(e),this.dialogRef.value&&!window.HTMLDialogElement&&!this.dialogRef.value.showModal&&(`document`in window&&`createElement`in document&&(await Promise.resolve().then(()=>(So(),to)).then(e=>e.default)).registerDialog(this.dialogRef.value),this.dialogRef.value.addEventListener(`close`,()=>{this.close(new Event(`close`),!0)}))}handleKeyDown(e){e.key===`Escape`&&this.close(e)}handleBackdropClick(e){this.closeOnBackdropClick&&e.target===this.dialogRef?.value&&this.close(e)}isElementInViewport(e){let t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}render(){let e={"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`},t={"pkt-modal__headingText":!0,"pkt-txt-24":!0},n={"pkt-modal__content":!0,"pkt-txt-18-light":!0},r=this.closeButtonSkin===`blue`,i={"pkt-modal__closeButton":!0,[`pkt-modal__closeButton--${this.closeButtonSkin}`]:!0};return j`
1488
1488
  <dialog
1489
1489
  class=${q(e)}
1490
1490
  ${X(this.dialogRef)}
@@ -1518,10 +1518,10 @@
1518
1518
  </div>
1519
1519
  </div>
1520
1520
  </dialog>
1521
- `}};K([W({type:Boolean,reflect:!0})],wo.prototype,`open`,void 0),K([W({type:String})],wo.prototype,`headingText`,void 0),K([W({type:Boolean})],wo.prototype,`removePadding`,void 0),K([W({type:Boolean})],wo.prototype,`hideCloseButton`,void 0),K([W({type:Boolean})],wo.prototype,`closeOnBackdropClick`,void 0),K([W({type:String})],wo.prototype,`closeButtonSkin`,void 0),K([W({type:String})],wo.prototype,`size`,void 0),K([W({type:String})],wo.prototype,`variant`,void 0),K([W({type:String})],wo.prototype,`drawerPosition`,void 0),K([W({type:Boolean})],wo.prototype,`transparentBackdrop`,void 0),K([G()],wo.prototype,`_isOpen`,void 0);try{U(`pkt-modal`)(wo)}catch{console.warn(`Forsøker å definere <pkt-modal>, men den er allerede definert`)}var To=`important`,Eo=` !`+To,Do=Ze(class extends Qe{constructor(e){if(super(e),e.type!==Xe.ATTRIBUTE||e.name!==`style`||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce((t,n)=>{let r=e[n];return r==null?t:t+`${n=n.includes(`-`)?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,`-$&`).toLowerCase()}:${r};`},``)}update(e,[t]){let{style:n}=e.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let e of this.ft)t[e]??(this.ft.delete(e),e.includes(`-`)?n.removeProperty(e):n[e]=null);for(let e in t){let r=t[e];if(r!=null){this.ft.add(e);let t=typeof r==`string`&&r.endsWith(Eo);e.includes(`-`)||t?n.setProperty(e,t?r.slice(0,-11):r,t?To:``):n[e]=r}}return M}}),Oo=class extends Ye{constructor(){super(),this.ariaLabel=null,this.ariaLabelledby=null,this.ariaValueText=null,this.ariaLive=`polite`,this.id=bi(),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=Y(),this.progressBarRef=Y()}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||bi(),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(){let e=this.statusType!==`none`,t=this.valueMax-this.valueMin,n=this.valueCurrent/t*100,r=this.statusType===`fraction`?Math.round(n):Math.round((this.valueCurrent-this.valueMin)/(this.valueMax-this.valueMin)*100),i=`${this.valueCurrent} av ${t}`,a=q({"pkt-progressbar__bar":!0,[`pkt-progressbar__bar--${this.skin}`]:!!this.skin}),o=q({"pkt-progressbar__title":!0,"pkt-progressbar__title-center":this.titlePosition===`center`}),s=q({"pkt-progressbar__status":!0,"pkt-progressbar__status--center":this.statusPlacement===`center`}),c=q({"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 j` <div
1521
+ `}};K([W({type:Boolean,reflect:!0})],jo.prototype,`open`,void 0),K([W({type:String})],jo.prototype,`headingText`,void 0),K([W({type:Boolean})],jo.prototype,`removePadding`,void 0),K([W({type:Boolean})],jo.prototype,`hideCloseButton`,void 0),K([W({type:Boolean})],jo.prototype,`closeOnBackdropClick`,void 0),K([W({type:String})],jo.prototype,`closeButtonSkin`,void 0),K([W({type:String})],jo.prototype,`size`,void 0),K([W({type:String})],jo.prototype,`variant`,void 0),K([W({type:String})],jo.prototype,`drawerPosition`,void 0),K([W({type:Boolean})],jo.prototype,`transparentBackdrop`,void 0),K([G()],jo.prototype,`_isOpen`,void 0);try{U(`pkt-modal`)(jo)}catch{console.warn(`Forsøker å definere <pkt-modal>, men den er allerede definert`)}var Mo=`important`,No=` !`+Mo,Po=Ze(class extends Qe{constructor(e){if(super(e),e.type!==Xe.ATTRIBUTE||e.name!==`style`||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce((t,n)=>{let r=e[n];return r==null?t:t+`${n=n.includes(`-`)?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,`-$&`).toLowerCase()}:${r};`},``)}update(e,[t]){let{style:n}=e.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let e of this.ft)t[e]??(this.ft.delete(e),e.includes(`-`)?n.removeProperty(e):n[e]=null);for(let e in t){let r=t[e];if(r!=null){this.ft.add(e);let t=typeof r==`string`&&r.endsWith(No);e.includes(`-`)||t?n.setProperty(e,t?r.slice(0,-11):r,t?Mo:``):n[e]=r}}return M}}),Fo=class extends Ye{constructor(){super(),this.ariaLabel=null,this.ariaLabelledby=null,this.ariaValueText=null,this.ariaLive=`polite`,this.id=bi(),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=Y(),this.progressBarRef=Y()}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||bi(),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(){let e=this.statusType!==`none`,t=this.valueMax-this.valueMin,n=this.valueCurrent/t*100,r=this.statusType===`fraction`?Math.round(n):Math.round((this.valueCurrent-this.valueMin)/(this.valueMax-this.valueMin)*100),i=`${this.valueCurrent} av ${t}`,a=q({"pkt-progressbar__bar":!0,[`pkt-progressbar__bar--${this.skin}`]:!!this.skin}),o=q({"pkt-progressbar__title":!0,"pkt-progressbar__title-center":this.titlePosition===`center`}),s=q({"pkt-progressbar__status":!0,"pkt-progressbar__status--center":this.statusPlacement===`center`}),c=q({"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 j` <div
1522
1522
  class="pkt-progressbar__container"
1523
1523
  .ref=${this.progressBarRef}
1524
- style=${Do({"--pkt-progress-label-width":`${this.labelWidth}px`,"--pkt-progress-width":`${r}%`})}
1524
+ style=${Po({"--pkt-progress-label-width":`${this.labelWidth}px`,"--pkt-progress-width":`${r}%`})}
1525
1525
  >
1526
1526
  ${this.title?j`<p id=${`${this.progressBarId}-title`} class=${o}>${this.title}</p>`:N}
1527
1527
 
@@ -1534,7 +1534,7 @@
1534
1534
  ${this.statusType===`percentage`?`${r}%`:i}
1535
1535
  </span>
1536
1536
  </div>`:N}
1537
- </div>`}setComputedValues(){this.progressbarId=this.id||bi(),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))}};K([W({type:String})],Oo.prototype,`ariaLabel`,void 0),K([W({type:String,reflect:!0})],Oo.prototype,`ariaLabelledby`,void 0),K([W({type:String,reflect:!0})],Oo.prototype,`ariaValueText`,void 0),K([W({type:String})],Oo.prototype,`ariaLive`,void 0),K([W({type:String,reflect:!0})],Oo.prototype,`id`,void 0),K([W({type:String})],Oo.prototype,`role`,void 0),K([W({type:String})],Oo.prototype,`skin`,void 0),K([W({type:String})],Oo.prototype,`statusPlacement`,void 0),K([W({type:String})],Oo.prototype,`statusType`,void 0),K([W({type:String,reflect:!0})],Oo.prototype,`title`,void 0),K([W({type:String})],Oo.prototype,`titlePosition`,void 0),K([W({type:Number,reflect:!0})],Oo.prototype,`valueCurrent`,void 0),K([W({type:Number})],Oo.prototype,`valueMax`,void 0),K([W({type:Number})],Oo.prototype,`valueMin`,void 0),K([G()],Oo.prototype,`labelWidth`,void 0),K([G()],Oo.prototype,`progressbarId`,void 0),K([G()],Oo.prototype,`computedAriaLabelledby`,void 0),K([G()],Oo.prototype,`computedAriaValueText`,void 0);try{U(`pkt-progressbar`)(Oo)}catch{console.warn(`Forsøker å definere <pkt-progressbar>, men den er allerede definert`)}var ko={dropZoneDragMultiple:`Dra filer hit for å laste dem opp eller`,dropZoneDragSingle:`Dra en fil hit for å laste den opp eller`,dropZoneDragMultipleThumbnail:`Dra bilder hit for å laste dem opp eller`,dropZoneDragSingleThumbnail:`Dra et bilde hit for å laste det opp eller`,dropZoneDragActiveMultiple:`Slipp filene her`,dropZoneDragActiveSingle:`Slipp filen her`,dropZoneDragActiveMultipleThumbnail:`Slipp bildene her`,dropZoneDragActiveSingleThumbnail:`Slipp bildet her`,dropZoneOpenFileDialogMultiple:`velg filer`,dropZoneOpenFileDialogSingle:`velg en fil`,dropZoneOpenFileDialogMultipleThumbnail:`velg fra kamerarull`,dropZoneOpenFileDialogSingleThumbnail:`velg fra kamerarull`,supportedFormatsPrefix:`Format:`,invalidFormatDefault:e=>`Ugyldig filtype. Tillatte formater: ${e}`,sizeTooLargeDefault:e=>`Filen er for stor. Maks størrelse er ${e}.`,requiredMissing:`Du må laste opp minst én fil.`,genericValidationRejection:`Filen ble avvist av validering.`,unknownFilename:`Ukjent fil`,fileLabel:e=>e===1?`fil`:`filer`,srFileAdded:e=>`Filen «${e}» er lagt til`,srFilesAdded:e=>`${e} filer er lagt til`,srFilesUploadedOfTotal:(e,t,n)=>`${e} av ${t} ${n} lastet opp`,srFilesFailedOfTotal:(e,t,n)=>`Feil ved opplasting: ${e} av ${t} ${n} feilet`};function Ao(e){if(e==null||e===``)return;if(typeof e==`number`)return Number.isFinite(e)&&e>0?e:void 0;let t=String(e).trim(),n=Number(t);if(!Number.isNaN(n)&&n>0)return n;let r=t.match(/^(\d+(?:\.\d+)?)\s*(B|KB|MB|GB)$/i);if(!r){console.warn(`PktFileUpload: Invalid maxFileSize format "${t}". Use format like "5MB", "500KB", "1GB", or bytes.`);return}let i=parseFloat(r[1]);switch(r[2].toUpperCase()){case`B`:return i;case`KB`:return i*1024;case`MB`:return i*1024*1024;case`GB`:return i*1024*1024*1024;default:return}}function jo(e){return e<1024?`${Math.round(e)} B`:e<1024*1024?`${Math.round(e/1024)} KB`:e<1024*1024*1024?`${Math.round(e/(1024*1024))} MB`:`${Math.round(e/(1024*1024*1024))} GB`}function Mo(e){return Array.isArray(e)?e.map(e=>String(e).trim().toLowerCase()).filter(Boolean):[]}function No(e){return e?e.split(`,`).map(e=>e.trim().toLowerCase()).filter(Boolean):[]}function Po(e,t,n){let r=e.toLowerCase().replace(/^\./,``);if(r.includes(`/`)){if(r.endsWith(`/*`)){let e=r.replace(`/*`,``);return n.startsWith(`${e}/`)}return n===r}return t===r}function Fo(e,t){let n=Mo(t);if(n.length===0)return!0;let r=e.name.split(`.`).pop()?.toLowerCase()??``,i=e.type.toLowerCase();return n.some(e=>Po(e,r,i))}function Io(e,t){let n=(e??``).trim();if(n)return n;let r=Mo(t);return r.length===0?``:r.map(e=>e.includes(`/`)||e.startsWith(`.`)?e:`.${e}`).join(`, `)}function Lo(e){return e.includes(`/`)?e:e.replace(/^\./,``).toUpperCase()}function Ro(e,t){let n=Mo(e);if(n.length>0)return n.map(Lo).join(`, `);let r=No(t);return r.length>0?r.map(Lo).join(`, `):``}function zo(e,t,n){return((e??``).trim()||t).replace(/\{(\w+)\}/g,(e,t)=>n[t]??`{${t}}`)}function Bo(e,t){let n=Mo(t.allowedFormats);if(n.length>0&&!Fo(e,n)){let e=n.join(`, `),r=`Ugyldig filtype. Tillatte formater: ${e}`;return zo(t.formatErrorMessage,r,{formats:e})}let r=Ao(t.maxFileSize);if(r!==void 0&&e.size>r){let e=jo(r),n=`Filen er for stor. Maks størrelse er ${e}.`;return zo(t.sizeErrorMessage,n,{maxSize:e})}if(t.onFileValidation){let n=t.onFileValidation(e);if(n)return n}return null}function Vo(e){let t=e.file;if(t?.type?.startsWith(`image/`))return!0;let n=e.attributes?.targetFilename||t?.name||``;return/\.(jpe?g|png|gif|webp|heic|heif|bmp|svg)$/i.test(n)}function Ho(e){return typeof e==`number`?`in-progress`:e===`error`?`error`:`idle`}function Uo(e,t,n){let r={"in-progress":0,error:1,idle:2};return e.map(e=>{let r=t?.find(t=>t.fileId===e.fileId);return{...e,progress:r?.progress??(n===`form`?`done`:`queued`),errorMessage:r?.errorMessage,showProgress:r?.showProgress,lastProgress:r?.lastProgress}}).sort((e,t)=>r[Ho(e.progress)]-r[Ho(t.progress)])}function Wo(e){if(!e)return[];let t=[`a[href]:not([tabindex="-1"])`,`button:not([disabled]):not([tabindex="-1"])`,`input:not([disabled]):not([type="hidden"]):not([tabindex="-1"])`,`select:not([disabled]):not([tabindex="-1"])`,`textarea:not([disabled]):not([tabindex="-1"])`,`[tabindex]:not([tabindex="-1"])`].join(`, `);return Array.from(e.querySelectorAll(t)).filter(e=>!e.hasAttribute(`inert`))}function Go(e,t){if(e.key!==`Tab`)return!1;let n=Wo(t);if(n.length===0)return e.preventDefault(),!0;let r=n[0],i=n[n.length-1],a=(t?.ownerDocument??document).activeElement,o=!!a&&n.includes(a);return e.shiftKey?!o||a===r?(e.preventDefault(),i.focus(),!0):!1:!o||a===i?(e.preventDefault(),r.focus(),!0):!1}function Ko(e,t){return!t||t<=0||e.length<=t+3?null:{head:e.slice(0,e.length-t),tail:e.slice(-t)}}function qo(e,t,n){return n<=0?0:t===`prev`?e<=0?n-1:e-1:e>=n-1?0:e+1}function Jo(e,t){let n=e.length;if(n===0||!t||t.length===0)return{totalCount:n,uploadedCount:0,failedCount:0};let r=0,i=0;for(let n of e){let e=t.find(e=>e.fileId===n.fileId);e?.progress===`done`?r++:e?.progress===`error`&&i++}return{totalCount:n,uploadedCount:r,failedCount:i}}function Yo(e,t=ko.unknownFilename){return e.attributes?.targetFilename||e.file?.name||t}var Xo=class extends Ye{constructor(...e){super(...e),this.id=`pkt-fileupload-${bi()}`,this.name=`files`,this.label=``,this.helptext=``,this.required=!1,this.multiple=!1,this.disabled=!1,this.fullwidth=!1,this.uploadStrategy=`form`,this.itemRenderer=`filename`,this.accept=``,this.allowedFormats=[],this.formatErrorMessage=``,this.sizeErrorMessage=``,this.transfers=[],this.addCommentsEnabled=!1,this.renameFilesEnabled=!1,this.extraOperations=[],this.enableImagePreview=!1,this.hasError=!1,this.errorMessage=``,this.optionalTag=!1,this.requiredTag=!1,this.truncateTail=4,this.files=[],this.isDragActive=!1,this.validationErrorMessage=null,this.addedAnnouncement=``,this.thumbnailUrls={},this.hasInitializedValue=!1,this.hasWarnedInvalidValueCombo=!1,this.thumbnailFileById=new Map,this.connectedForm=null,this.addedAnnouncementTimer=null,this.requiredSelectionMessage=ko.requiredMissing,this.onNativeFileChange=e=>{let t=e.target;this.addFiles(t.files?Array.from(t.files):[]),this.uploadStrategy===`custom`&&(t.value=``)},this.openFileDialog=e=>{e.preventDefault(),e.stopPropagation(),!this.disabled&&this.querySelector(`#${this.id}-input`)?.click()},this.onDropZoneClick=e=>{this.disabled||e.target.closest(`.pkt-fileupload__drop-zone__placeholder__title__open-file-dialog`)||this.querySelector(`#${this.id}-input`)?.click()},this.onDragOver=e=>{e.preventDefault(),!this.disabled&&(this.isDragActive=!0)},this.onDragLeave=()=>{this.isDragActive=!1},this.onDrop=e=>{if(e.preventDefault(),this.isDragActive=!1,this.disabled)return;let t=e.dataTransfer?.files?Array.from(e.dataTransfer.files):[];this.addFiles(t)},this.onHostFormSubmit=e=>{!this.required||this.uploadStrategy!==`custom`||this.getCurrentFiles().length>0||(this.validationErrorMessage=this.requiredSelectionMessage,e.preventDefault())}}get isControlled(){return this.value!==void 0}get hasEffectiveError(){return!!this.validationErrorMessage||this.hasError||!!this.errorMessage.trim()}get effectiveErrorMessage(){return this.validationErrorMessage??this.errorMessage??``}get hasValidationError(){return!!this.validationErrorMessage}firstUpdated(e){super.firstUpdated?.(e),this.hasInitializedValue||=(this.files=this.value??this.defaultValue??[],this.syncThumbnailUrls(this.files),!0),this.value!==void 0&&this.defaultValue!==void 0&&this.warnInvalidValueCombo()}willUpdate(e){super.willUpdate(e),this.hasInitializedValue&&this.isControlled&&(e.has(`value`)||e.has(`itemRenderer`)||e.has(`enableImagePreview`))&&(this.files=this.value??[],this.syncThumbnailUrls(this.files))}updated(e){super.updated(e),(e.has(`uploadStrategy`)||e.has(`required`)||e.has(`value`))&&this.syncFormSubmitListener(),this.uploadStrategy===`form`&&(e.has(`value`)||e.has(`files`)||e.has(`uploadStrategy`))&&this.syncNativeInputFiles()}syncNativeInputFiles(){let e=this.querySelector(`#${this.id}-input`);if(!(!e||typeof DataTransfer>`u`))try{let t=new DataTransfer;for(let e of this.getCurrentFiles())e.file&&t.items.add(e.file);e.files=t.files}catch{}}warnInvalidValueCombo(){this.hasWarnedInvalidValueCombo||=(console.warn(`PktFileUpload: Både value og defaultValue er angitt. Komponenten kan være enten kontrollert eller ukontrollert, ikke begge. value vil bli prioritert.`),!0)}disconnectedCallback(){this.teardownFormSubmitListener(),this.addedAnnouncementTimer&&=(clearTimeout(this.addedAnnouncementTimer),null),super.disconnectedCallback(),this.revokeAllThumbnailUrls()}setAddedAnnouncement(e){this.addedAnnouncement=e,this.addedAnnouncementTimer&&clearTimeout(this.addedAnnouncementTimer),this.addedAnnouncementTimer=setTimeout(()=>{this.addedAnnouncement=``,this.addedAnnouncementTimer=null},1500)}connectedCallback(){super.connectedCallback(),this.syncFormSubmitListener()}addFiles(e){if(e.length===0)return;let t=this.multiple?e:[e[0]];for(let e of t){let t=this.validateFile(e);if(t){this.validationErrorMessage=t;return}}this.validationErrorMessage=null;let n=t.map(e=>({fileId:bi(),file:e,attributes:{targetFilename:e.name}}));this.setAddedAnnouncement(n.length===1?ko.srFileAdded(n[0].attributes.targetFilename):ko.srFilesAdded(n.length));let r=this.getCurrentFiles(),i=this.multiple?[...r,...n]:[n[0]];this.commitFiles(i,`add`,n.map(e=>e.fileId)),this.uploadStrategy===`custom`&&n.forEach(e=>{this.dispatchEvent(new CustomEvent(`file-upload-requested`,{detail:{fileId:e.fileId,file:e.file,attributes:e.attributes},bubbles:!0,composed:!0}))})}getCurrentFiles(){return this.isControlled?this.value??[]:this.files}cancelTransfer(e){if(this.disabled)return;let t=this.getCurrentFiles().find(t=>t.fileId===e);t&&(this.removeFileItem(e),this.dispatchEvent(new CustomEvent(`transfer-cancelled`,{detail:{fileId:t.fileId,file:t.file,attributes:t.attributes},bubbles:!0,composed:!0})))}removeFileItem(e){if(this.disabled)return;let t=this.getCurrentFiles(),n=t.filter(t=>t.fileId!==e);n.length!==t.length&&this.commitFiles(n,`remove`,[e])}updateFileItem(e,t){let n=this.getCurrentFiles().map(n=>n.fileId===e?{...n,...t}:n);this.commitFiles(n,`update`,[e])}commitFiles(e,t,n){this.isControlled||(this.files=e,this.syncThumbnailUrls(e)),this.validationErrorMessage===this.requiredSelectionMessage&&e.length>0&&(this.validationErrorMessage=null),this.dispatchEvent(new CustomEvent(`files-changed`,{detail:{files:e,reason:t,changedFileIds:n},bubbles:!0,composed:!0}))}getThumbnailUrl(e){return this.thumbnailUrls[e.fileId]}getTransferProgress(e){let t=this.transfers.find(t=>t.fileId===e);return t?t.progress:this.uploadStrategy===`form`?`done`:`queued`}getTransferForFile(e){return this.transfers.find(t=>t.fileId===e)}isImageFile(e){return Vo(e)}formatFileSize(e){return jo(e)}getResolvedAcceptValue(){return Io(this.accept,this.allowedFormats)}getSupportedFormatsText(){return Ro(this.allowedFormats,this.accept)}getSortedFilesAndTransfers(){return Uo(this.getCurrentFiles(),this.transfers,this.uploadStrategy)}validateFile(e){let t=Bo(e,{allowedFormats:this.allowedFormats,maxFileSize:this.maxFileSize,formatErrorMessage:this.formatErrorMessage,sizeErrorMessage:this.sizeErrorMessage,onFileValidation:this.onFileValidation});if(t)return t;let n={file:e,errorMessage:null},r=new CustomEvent(`file-validate`,{detail:n,bubbles:!0,composed:!0,cancelable:!0});return this.dispatchEvent(r),n.errorMessage?n.errorMessage:r.defaultPrevented?ko.genericValidationRejection:null}syncThumbnailUrls(e){if(!(typeof URL<`u`&&typeof URL.createObjectURL==`function`&&typeof URL.revokeObjectURL==`function`)){this.thumbnailUrls={},this.thumbnailFileById.clear();return}let t=new Set(e.map(e=>e.fileId)),n={};for(let[e,n]of Object.entries(this.thumbnailUrls))t.has(e)||(URL.revokeObjectURL(n),this.thumbnailFileById.delete(e));for(let t of e){let e=this.thumbnailUrls[t.fileId],r=this.thumbnailFileById.get(t.fileId);if(!t.file||!this.isImageFile(t)){e&&(URL.revokeObjectURL(e),this.thumbnailFileById.delete(t.fileId));continue}if(e&&r===t.file){n[t.fileId]=e;continue}e&&r!==t.file&&URL.revokeObjectURL(e);let i=URL.createObjectURL(t.file);this.thumbnailFileById.set(t.fileId,t.file),n[t.fileId]=i}this.thumbnailUrls=n}revokeAllThumbnailUrls(){if(typeof URL>`u`||typeof URL.revokeObjectURL!=`function`){this.thumbnailUrls={},this.thumbnailFileById.clear();return}Object.values(this.thumbnailUrls).forEach(e=>URL.revokeObjectURL(e)),this.thumbnailUrls={},this.thumbnailFileById.clear()}getSrUploadedMessage(){if(this.addedAnnouncement)return this.addedAnnouncement;let{totalCount:e,uploadedCount:t}=Jo(this.getCurrentFiles(),this.transfers);return e===0||t===0?``:ko.srFilesUploadedOfTotal(t,e,ko.fileLabel(e))}getSrErrorsMessage(){let{totalCount:e,failedCount:t}=Jo(this.getCurrentFiles(),this.transfers);return e===0||t===0?``:ko.srFilesFailedOfTotal(t,e,ko.fileLabel(e))}syncFormSubmitListener(){let e=this.closest(`form`);this.connectedForm!==e&&(this.teardownFormSubmitListener(),this.connectedForm=e,this.connectedForm&&this.connectedForm.addEventListener(`submit`,this.onHostFormSubmit))}teardownFormSubmitListener(){this.connectedForm&&=(this.connectedForm.removeEventListener(`submit`,this.onHostFormSubmit),null)}};K([W({type:String})],Xo.prototype,`id`,void 0),K([W({type:String})],Xo.prototype,`name`,void 0),K([W({type:String})],Xo.prototype,`label`,void 0),K([W({type:String})],Xo.prototype,`helptext`,void 0),K([W({type:Boolean,reflect:!0})],Xo.prototype,`required`,void 0),K([W({type:Boolean,reflect:!0})],Xo.prototype,`multiple`,void 0),K([W({type:Boolean,reflect:!0})],Xo.prototype,`disabled`,void 0),K([W({type:Boolean,reflect:!0,attribute:`fullwidth`})],Xo.prototype,`fullwidth`,void 0),K([W({type:String,reflect:!0,attribute:`upload-strategy`})],Xo.prototype,`uploadStrategy`,void 0),K([W({type:String,reflect:!0,attribute:`item-renderer`})],Xo.prototype,`itemRenderer`,void 0),K([W({type:String})],Xo.prototype,`accept`,void 0),K([W({converter:Br.csvToArray,attribute:`allowed-formats`})],Xo.prototype,`allowedFormats`,void 0),K([W({type:String,attribute:`format-error-message`})],Xo.prototype,`formatErrorMessage`,void 0),K([W({attribute:`max-file-size`})],Xo.prototype,`maxFileSize`,void 0),K([W({type:String,attribute:`size-error-message`})],Xo.prototype,`sizeErrorMessage`,void 0),K([W({attribute:!1})],Xo.prototype,`onFileValidation`,void 0),K([W({attribute:!1})],Xo.prototype,`transfers`,void 0),K([W({type:Boolean,attribute:`add-comments-enabled`})],Xo.prototype,`addCommentsEnabled`,void 0),K([W({type:Boolean,attribute:`rename-files-enabled`})],Xo.prototype,`renameFilesEnabled`,void 0),K([W({attribute:!1})],Xo.prototype,`extraOperations`,void 0),K([W({type:Boolean,reflect:!0,attribute:`enable-image-preview`})],Xo.prototype,`enableImagePreview`,void 0),K([W({type:Boolean,attribute:`has-error`})],Xo.prototype,`hasError`,void 0),K([W({type:String,attribute:`error-message`})],Xo.prototype,`errorMessage`,void 0),K([W({type:Boolean,attribute:`optional-tag`})],Xo.prototype,`optionalTag`,void 0),K([W({type:Boolean,attribute:`required-tag`})],Xo.prototype,`requiredTag`,void 0),K([W({type:Number,attribute:`truncate-tail`})],Xo.prototype,`truncateTail`,void 0),K([W({attribute:!1})],Xo.prototype,`value`,void 0),K([W({attribute:!1})],Xo.prototype,`defaultValue`,void 0),K([G()],Xo.prototype,`files`,void 0),K([G()],Xo.prototype,`isDragActive`,void 0),K([G()],Xo.prototype,`validationErrorMessage`,void 0),K([G()],Xo.prototype,`addedAnnouncement`,void 0),K([G()],Xo.prototype,`thumbnailUrls`,void 0);var Zo=`comments`,Qo=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?e:`${String(t.getDate()).padStart(2,`0`)}.${String(t.getMonth()+1).padStart(2,`0`)}.${t.getFullYear()} kl. ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`},$o=(e,t,n)=>{e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),t()),e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),n())},es=(e,t,n)=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),n()),(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),t())},ts=e=>({id:`remove`,title:`Slett`,ariaLabel:`Slett fil`,onClick:({file:t})=>e(t.fileId)}),ns=()=>({id:`rename`,title:`Rediger`,ariaLabel:`Rediger filnavn`,renderInlineUI:e=>{let t=e.getAttribute(`targetFilename`)||e.file.attributes?.targetFilename||e.file.file?.name||``,n=`pkt-fileupload-rename-${e.file.fileId}`,r=()=>{let t=document.getElementById(n)?.value?.trim();t&&e.setAttribute(`targetFilename`,t),e.close()};return j`
1537
+ </div>`}setComputedValues(){this.progressbarId=this.id||bi(),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))}};K([W({type:String})],Fo.prototype,`ariaLabel`,void 0),K([W({type:String,reflect:!0})],Fo.prototype,`ariaLabelledby`,void 0),K([W({type:String,reflect:!0})],Fo.prototype,`ariaValueText`,void 0),K([W({type:String})],Fo.prototype,`ariaLive`,void 0),K([W({type:String,reflect:!0})],Fo.prototype,`id`,void 0),K([W({type:String})],Fo.prototype,`role`,void 0),K([W({type:String})],Fo.prototype,`skin`,void 0),K([W({type:String})],Fo.prototype,`statusPlacement`,void 0),K([W({type:String})],Fo.prototype,`statusType`,void 0),K([W({type:String,reflect:!0})],Fo.prototype,`title`,void 0),K([W({type:String})],Fo.prototype,`titlePosition`,void 0),K([W({type:Number,reflect:!0})],Fo.prototype,`valueCurrent`,void 0),K([W({type:Number})],Fo.prototype,`valueMax`,void 0),K([W({type:Number})],Fo.prototype,`valueMin`,void 0),K([G()],Fo.prototype,`labelWidth`,void 0),K([G()],Fo.prototype,`progressbarId`,void 0),K([G()],Fo.prototype,`computedAriaLabelledby`,void 0),K([G()],Fo.prototype,`computedAriaValueText`,void 0);try{U(`pkt-progressbar`)(Fo)}catch{console.warn(`Forsøker å definere <pkt-progressbar>, men den er allerede definert`)}var Io={dropZoneDragMultiple:`Dra filer hit for å laste dem opp eller`,dropZoneDragSingle:`Dra en fil hit for å laste den opp eller`,dropZoneDragMultipleThumbnail:`Dra bilder hit for å laste dem opp eller`,dropZoneDragSingleThumbnail:`Dra et bilde hit for å laste det opp eller`,dropZoneDragActiveMultiple:`Slipp filene her`,dropZoneDragActiveSingle:`Slipp filen her`,dropZoneDragActiveMultipleThumbnail:`Slipp bildene her`,dropZoneDragActiveSingleThumbnail:`Slipp bildet her`,dropZoneOpenFileDialogMultiple:`velg filer`,dropZoneOpenFileDialogSingle:`velg en fil`,dropZoneOpenFileDialogMultipleThumbnail:`velg fra kamerarull`,dropZoneOpenFileDialogSingleThumbnail:`velg fra kamerarull`,supportedFormatsPrefix:`Format:`,invalidFormatDefault:e=>`Ugyldig filtype. Tillatte formater: ${e}`,sizeTooLargeDefault:e=>`Filen er for stor. Maks størrelse er ${e}.`,requiredMissing:`Du må laste opp minst én fil.`,genericValidationRejection:`Filen ble avvist av validering.`,unknownFilename:`Ukjent fil`,fileLabel:e=>e===1?`fil`:`filer`,srFileAdded:e=>`Filen «${e}» er lagt til`,srFilesAdded:e=>`${e} filer er lagt til`,srFilesUploadedOfTotal:(e,t,n)=>`${e} av ${t} ${n} lastet opp`,srFilesFailedOfTotal:(e,t,n)=>`Feil ved opplasting: ${e} av ${t} ${n} feilet`};function Lo(e){if(e==null||e===``)return;if(typeof e==`number`)return Number.isFinite(e)&&e>0?e:void 0;let t=String(e).trim(),n=Number(t);if(!Number.isNaN(n)&&n>0)return n;let r=t.match(/^(\d+(?:\.\d+)?)\s*(B|KB|MB|GB)$/i);if(!r){console.warn(`PktFileUpload: Invalid maxFileSize format "${t}". Use format like "5MB", "500KB", "1GB", or bytes.`);return}let i=parseFloat(r[1]);switch(r[2].toUpperCase()){case`B`:return i;case`KB`:return i*1024;case`MB`:return i*1024*1024;case`GB`:return i*1024*1024*1024;default:return}}function Ro(e){return e<1024?`${Math.round(e)} B`:e<1024*1024?`${Math.round(e/1024)} KB`:e<1024*1024*1024?`${Math.round(e/(1024*1024))} MB`:`${Math.round(e/(1024*1024*1024))} GB`}function zo(e){return Array.isArray(e)?e.map(e=>String(e).trim().toLowerCase()).filter(Boolean):[]}function Bo(e){return e?e.split(`,`).map(e=>e.trim().toLowerCase()).filter(Boolean):[]}function Vo(e,t,n){let r=e.toLowerCase().replace(/^\./,``);if(r.includes(`/`)){if(r.endsWith(`/*`)){let e=r.replace(`/*`,``);return n.startsWith(`${e}/`)}return n===r}return t===r}function Ho(e,t){let n=zo(t);if(n.length===0)return!0;let r=e.name.split(`.`).pop()?.toLowerCase()??``,i=e.type.toLowerCase();return n.some(e=>Vo(e,r,i))}function Uo(e,t){let n=(e??``).trim();if(n)return n;let r=zo(t);return r.length===0?``:r.map(e=>e.includes(`/`)||e.startsWith(`.`)?e:`.${e}`).join(`, `)}function Wo(e){return e.includes(`/`)?e:e.replace(/^\./,``).toUpperCase()}function Go(e,t){let n=zo(e);if(n.length>0)return n.map(Wo).join(`, `);let r=Bo(t);return r.length>0?r.map(Wo).join(`, `):``}function Ko(e,t,n){return((e??``).trim()||t).replace(/\{(\w+)\}/g,(e,t)=>n[t]??`{${t}}`)}function qo(e,t){let n=zo(t.allowedFormats);if(n.length>0&&!Ho(e,n)){let e=n.join(`, `),r=`Ugyldig filtype. Tillatte formater: ${e}`;return Ko(t.formatErrorMessage,r,{formats:e})}let r=Lo(t.maxFileSize);if(r!==void 0&&e.size>r){let e=Ro(r),n=`Filen er for stor. Maks størrelse er ${e}.`;return Ko(t.sizeErrorMessage,n,{maxSize:e})}if(t.onFileValidation){let n=t.onFileValidation(e);if(n)return n}return null}function Jo(e){let t=e.file;if(t?.type?.startsWith(`image/`))return!0;let n=e.attributes?.targetFilename||t?.name||``;return/\.(jpe?g|png|gif|webp|heic|heif|bmp|svg)$/i.test(n)}function Yo(e){return typeof e==`number`?`in-progress`:e===`error`?`error`:`idle`}function Xo(e,t,n){let r={"in-progress":0,error:1,idle:2};return e.map(e=>{let r=t?.find(t=>t.fileId===e.fileId);return{...e,progress:r?.progress??(n===`form`?`done`:`queued`),errorMessage:r?.errorMessage,showProgress:r?.showProgress,lastProgress:r?.lastProgress}}).sort((e,t)=>r[Yo(e.progress)]-r[Yo(t.progress)])}function Zo(e){if(!e)return[];let t=[`a[href]:not([tabindex="-1"])`,`button:not([disabled]):not([tabindex="-1"])`,`input:not([disabled]):not([type="hidden"]):not([tabindex="-1"])`,`select:not([disabled]):not([tabindex="-1"])`,`textarea:not([disabled]):not([tabindex="-1"])`,`[tabindex]:not([tabindex="-1"])`].join(`, `);return Array.from(e.querySelectorAll(t)).filter(e=>!e.hasAttribute(`inert`))}function Qo(e,t){if(e.key!==`Tab`)return!1;let n=Zo(t);if(n.length===0)return e.preventDefault(),!0;let r=n[0],i=n[n.length-1],a=(t?.ownerDocument??document).activeElement,o=!!a&&n.includes(a);return e.shiftKey?!o||a===r?(e.preventDefault(),i.focus(),!0):!1:!o||a===i?(e.preventDefault(),r.focus(),!0):!1}function $o(e,t){return!t||t<=0||e.length<=t+3?null:{head:e.slice(0,e.length-t),tail:e.slice(-t)}}function es(e,t,n){return n<=0?0:t===`prev`?e<=0?n-1:e-1:e>=n-1?0:e+1}function ts(e,t){let n=e.length;if(n===0||!t||t.length===0)return{totalCount:n,uploadedCount:0,failedCount:0};let r=0,i=0;for(let n of e){let e=t.find(e=>e.fileId===n.fileId);e?.progress===`done`?r++:e?.progress===`error`&&i++}return{totalCount:n,uploadedCount:r,failedCount:i}}function ns(e,t=Io.unknownFilename){return e.attributes?.targetFilename||e.file?.name||t}var rs=class extends Ye{constructor(...e){super(...e),this.id=`pkt-fileupload-${bi()}`,this.name=`files`,this.label=``,this.helptext=``,this.required=!1,this.multiple=!1,this.disabled=!1,this.fullwidth=!1,this.uploadStrategy=`form`,this.itemRenderer=`filename`,this.accept=``,this.allowedFormats=[],this.formatErrorMessage=``,this.sizeErrorMessage=``,this.transfers=[],this.addCommentsEnabled=!1,this.renameFilesEnabled=!1,this.extraOperations=[],this.enableImagePreview=!1,this.hasError=!1,this.errorMessage=``,this.optionalTag=!1,this.requiredTag=!1,this.truncateTail=4,this.files=[],this.isDragActive=!1,this.validationErrorMessage=null,this.addedAnnouncement=``,this.thumbnailUrls={},this.hasInitializedValue=!1,this.hasWarnedInvalidValueCombo=!1,this.thumbnailFileById=new Map,this.connectedForm=null,this.addedAnnouncementTimer=null,this.requiredSelectionMessage=Io.requiredMissing,this.onNativeFileChange=e=>{let t=e.target;this.addFiles(t.files?Array.from(t.files):[]),this.uploadStrategy===`custom`&&(t.value=``)},this.openFileDialog=e=>{e.preventDefault(),e.stopPropagation(),!this.disabled&&this.querySelector(`#${this.id}-input`)?.click()},this.onDropZoneClick=e=>{this.disabled||e.target.closest(`.pkt-fileupload__drop-zone__placeholder__title__open-file-dialog`)||this.querySelector(`#${this.id}-input`)?.click()},this.onDragOver=e=>{e.preventDefault(),!this.disabled&&(this.isDragActive=!0)},this.onDragLeave=()=>{this.isDragActive=!1},this.onDrop=e=>{if(e.preventDefault(),this.isDragActive=!1,this.disabled)return;let t=e.dataTransfer?.files?Array.from(e.dataTransfer.files):[];this.addFiles(t)},this.onHostFormSubmit=e=>{!this.required||this.uploadStrategy!==`custom`||this.getCurrentFiles().length>0||(this.validationErrorMessage=this.requiredSelectionMessage,e.preventDefault())}}get isControlled(){return this.value!==void 0}get hasEffectiveError(){return!!this.validationErrorMessage||this.hasError||!!this.errorMessage.trim()}get effectiveErrorMessage(){return this.validationErrorMessage??this.errorMessage??``}get hasValidationError(){return!!this.validationErrorMessage}firstUpdated(e){super.firstUpdated?.(e),this.hasInitializedValue||=(this.files=this.value??this.defaultValue??[],this.syncThumbnailUrls(this.files),!0),this.value!==void 0&&this.defaultValue!==void 0&&this.warnInvalidValueCombo()}willUpdate(e){super.willUpdate(e),this.hasInitializedValue&&this.isControlled&&(e.has(`value`)||e.has(`itemRenderer`)||e.has(`enableImagePreview`))&&(this.files=this.value??[],this.syncThumbnailUrls(this.files))}updated(e){super.updated(e),(e.has(`uploadStrategy`)||e.has(`required`)||e.has(`value`))&&this.syncFormSubmitListener(),this.uploadStrategy===`form`&&(e.has(`value`)||e.has(`files`)||e.has(`uploadStrategy`))&&this.syncNativeInputFiles()}syncNativeInputFiles(){let e=this.querySelector(`#${this.id}-input`);if(!(!e||typeof DataTransfer>`u`))try{let t=new DataTransfer;for(let e of this.getCurrentFiles())e.file&&t.items.add(e.file);e.files=t.files}catch{}}warnInvalidValueCombo(){this.hasWarnedInvalidValueCombo||=(console.warn(`PktFileUpload: Både value og defaultValue er angitt. Komponenten kan være enten kontrollert eller ukontrollert, ikke begge. value vil bli prioritert.`),!0)}disconnectedCallback(){this.teardownFormSubmitListener(),this.addedAnnouncementTimer&&=(clearTimeout(this.addedAnnouncementTimer),null),super.disconnectedCallback(),this.revokeAllThumbnailUrls()}setAddedAnnouncement(e){this.addedAnnouncement=e,this.addedAnnouncementTimer&&clearTimeout(this.addedAnnouncementTimer),this.addedAnnouncementTimer=setTimeout(()=>{this.addedAnnouncement=``,this.addedAnnouncementTimer=null},1500)}connectedCallback(){super.connectedCallback(),this.syncFormSubmitListener()}addFiles(e){if(e.length===0)return;let t=this.multiple?e:[e[0]];for(let e of t){let t=this.validateFile(e);if(t){this.validationErrorMessage=t;return}}this.validationErrorMessage=null;let n=t.map(e=>({fileId:bi(),file:e,attributes:{targetFilename:e.name}}));this.setAddedAnnouncement(n.length===1?Io.srFileAdded(n[0].attributes.targetFilename):Io.srFilesAdded(n.length));let r=this.getCurrentFiles(),i=this.multiple?[...r,...n]:[n[0]];this.commitFiles(i,`add`,n.map(e=>e.fileId)),this.uploadStrategy===`custom`&&n.forEach(e=>{this.dispatchEvent(new CustomEvent(`file-upload-requested`,{detail:{fileId:e.fileId,file:e.file,attributes:e.attributes},bubbles:!0,composed:!0}))})}getCurrentFiles(){return this.isControlled?this.value??[]:this.files}cancelTransfer(e){if(this.disabled)return;let t=this.getCurrentFiles().find(t=>t.fileId===e);t&&(this.removeFileItem(e),this.dispatchEvent(new CustomEvent(`transfer-cancelled`,{detail:{fileId:t.fileId,file:t.file,attributes:t.attributes},bubbles:!0,composed:!0})))}removeFileItem(e){if(this.disabled)return;let t=this.getCurrentFiles(),n=t.filter(t=>t.fileId!==e);n.length!==t.length&&this.commitFiles(n,`remove`,[e])}updateFileItem(e,t){let n=this.getCurrentFiles().map(n=>n.fileId===e?{...n,...t}:n);this.commitFiles(n,`update`,[e])}commitFiles(e,t,n){this.isControlled||(this.files=e,this.syncThumbnailUrls(e)),this.validationErrorMessage===this.requiredSelectionMessage&&e.length>0&&(this.validationErrorMessage=null),this.dispatchEvent(new CustomEvent(`files-changed`,{detail:{files:e,reason:t,changedFileIds:n},bubbles:!0,composed:!0}))}getThumbnailUrl(e){return this.thumbnailUrls[e.fileId]}getTransferProgress(e){let t=this.transfers.find(t=>t.fileId===e);return t?t.progress:this.uploadStrategy===`form`?`done`:`queued`}getTransferForFile(e){return this.transfers.find(t=>t.fileId===e)}isImageFile(e){return Jo(e)}formatFileSize(e){return Ro(e)}getResolvedAcceptValue(){return Uo(this.accept,this.allowedFormats)}getSupportedFormatsText(){return Go(this.allowedFormats,this.accept)}getSortedFilesAndTransfers(){return Xo(this.getCurrentFiles(),this.transfers,this.uploadStrategy)}validateFile(e){let t=qo(e,{allowedFormats:this.allowedFormats,maxFileSize:this.maxFileSize,formatErrorMessage:this.formatErrorMessage,sizeErrorMessage:this.sizeErrorMessage,onFileValidation:this.onFileValidation});if(t)return t;let n={file:e,errorMessage:null},r=new CustomEvent(`file-validate`,{detail:n,bubbles:!0,composed:!0,cancelable:!0});return this.dispatchEvent(r),n.errorMessage?n.errorMessage:r.defaultPrevented?Io.genericValidationRejection:null}syncThumbnailUrls(e){if(!(typeof URL<`u`&&typeof URL.createObjectURL==`function`&&typeof URL.revokeObjectURL==`function`)){this.thumbnailUrls={},this.thumbnailFileById.clear();return}let t=new Set(e.map(e=>e.fileId)),n={};for(let[e,n]of Object.entries(this.thumbnailUrls))t.has(e)||(URL.revokeObjectURL(n),this.thumbnailFileById.delete(e));for(let t of e){let e=this.thumbnailUrls[t.fileId],r=this.thumbnailFileById.get(t.fileId);if(!t.file||!this.isImageFile(t)){e&&(URL.revokeObjectURL(e),this.thumbnailFileById.delete(t.fileId));continue}if(e&&r===t.file){n[t.fileId]=e;continue}e&&r!==t.file&&URL.revokeObjectURL(e);let i=URL.createObjectURL(t.file);this.thumbnailFileById.set(t.fileId,t.file),n[t.fileId]=i}this.thumbnailUrls=n}revokeAllThumbnailUrls(){if(typeof URL>`u`||typeof URL.revokeObjectURL!=`function`){this.thumbnailUrls={},this.thumbnailFileById.clear();return}Object.values(this.thumbnailUrls).forEach(e=>URL.revokeObjectURL(e)),this.thumbnailUrls={},this.thumbnailFileById.clear()}getSrUploadedMessage(){if(this.addedAnnouncement)return this.addedAnnouncement;let{totalCount:e,uploadedCount:t}=ts(this.getCurrentFiles(),this.transfers);return e===0||t===0?``:Io.srFilesUploadedOfTotal(t,e,Io.fileLabel(e))}getSrErrorsMessage(){let{totalCount:e,failedCount:t}=ts(this.getCurrentFiles(),this.transfers);return e===0||t===0?``:Io.srFilesFailedOfTotal(t,e,Io.fileLabel(e))}syncFormSubmitListener(){let e=this.closest(`form`);this.connectedForm!==e&&(this.teardownFormSubmitListener(),this.connectedForm=e,this.connectedForm&&this.connectedForm.addEventListener(`submit`,this.onHostFormSubmit))}teardownFormSubmitListener(){this.connectedForm&&=(this.connectedForm.removeEventListener(`submit`,this.onHostFormSubmit),null)}};K([W({type:String})],rs.prototype,`id`,void 0),K([W({type:String})],rs.prototype,`name`,void 0),K([W({type:String})],rs.prototype,`label`,void 0),K([W({type:String})],rs.prototype,`helptext`,void 0),K([W({type:Boolean,reflect:!0})],rs.prototype,`required`,void 0),K([W({type:Boolean,reflect:!0})],rs.prototype,`multiple`,void 0),K([W({type:Boolean,reflect:!0})],rs.prototype,`disabled`,void 0),K([W({type:Boolean,reflect:!0,attribute:`fullwidth`})],rs.prototype,`fullwidth`,void 0),K([W({type:String,reflect:!0,attribute:`upload-strategy`})],rs.prototype,`uploadStrategy`,void 0),K([W({type:String,reflect:!0,attribute:`item-renderer`})],rs.prototype,`itemRenderer`,void 0),K([W({type:String})],rs.prototype,`accept`,void 0),K([W({converter:Br.csvToArray,attribute:`allowed-formats`})],rs.prototype,`allowedFormats`,void 0),K([W({type:String,attribute:`format-error-message`})],rs.prototype,`formatErrorMessage`,void 0),K([W({attribute:`max-file-size`})],rs.prototype,`maxFileSize`,void 0),K([W({type:String,attribute:`size-error-message`})],rs.prototype,`sizeErrorMessage`,void 0),K([W({attribute:!1})],rs.prototype,`onFileValidation`,void 0),K([W({attribute:!1})],rs.prototype,`transfers`,void 0),K([W({type:Boolean,attribute:`add-comments-enabled`})],rs.prototype,`addCommentsEnabled`,void 0),K([W({type:Boolean,attribute:`rename-files-enabled`})],rs.prototype,`renameFilesEnabled`,void 0),K([W({attribute:!1})],rs.prototype,`extraOperations`,void 0),K([W({type:Boolean,reflect:!0,attribute:`enable-image-preview`})],rs.prototype,`enableImagePreview`,void 0),K([W({type:Boolean,attribute:`has-error`})],rs.prototype,`hasError`,void 0),K([W({type:String,attribute:`error-message`})],rs.prototype,`errorMessage`,void 0),K([W({type:Boolean,attribute:`optional-tag`})],rs.prototype,`optionalTag`,void 0),K([W({type:Boolean,attribute:`required-tag`})],rs.prototype,`requiredTag`,void 0),K([W({type:Number,attribute:`truncate-tail`})],rs.prototype,`truncateTail`,void 0),K([W({attribute:!1})],rs.prototype,`value`,void 0),K([W({attribute:!1})],rs.prototype,`defaultValue`,void 0),K([G()],rs.prototype,`files`,void 0),K([G()],rs.prototype,`isDragActive`,void 0),K([G()],rs.prototype,`validationErrorMessage`,void 0),K([G()],rs.prototype,`addedAnnouncement`,void 0),K([G()],rs.prototype,`thumbnailUrls`,void 0);var is=`comments`,as=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?e:`${String(t.getDate()).padStart(2,`0`)}.${String(t.getMonth()+1).padStart(2,`0`)}.${t.getFullYear()} kl. ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`},os=(e,t,n)=>{e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),t()),e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),n())},ss=(e,t,n)=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),n()),(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),t())},cs=e=>({id:`remove`,title:`Slett`,ariaLabel:`Slett fil`,onClick:({file:t})=>e(t.fileId)}),ls=()=>({id:`rename`,title:`Rediger`,ariaLabel:`Rediger filnavn`,renderInlineUI:e=>{let t=e.getAttribute(`targetFilename`)||e.file.attributes?.targetFilename||e.file.file?.name||``,n=`pkt-fileupload-rename-${e.file.fileId}`,r=()=>{let t=document.getElementById(n)?.value?.trim();t&&e.setAttribute(`targetFilename`,t),e.close()};return j`
1538
1538
  <label for=${n} class="pkt-sr-only">Endre filnavn</label>
1539
1539
  <input
1540
1540
  id=${n}
@@ -1542,7 +1542,7 @@
1542
1542
  class="pkt-fileupload__queue-display__item__rename-input"
1543
1543
  ?disabled=${e.disabled}
1544
1544
  .value=${t}
1545
- @keydown=${t=>$o(t,r,e.close)}
1545
+ @keydown=${t=>os(t,r,e.close)}
1546
1546
  />
1547
1547
  <button
1548
1548
  type="button"
@@ -1564,7 +1564,7 @@
1564
1564
  type="hidden"
1565
1565
  name=${`${e.inputName}-targetFilename`}
1566
1566
  value=${t}
1567
- />`}}),rs=()=>({id:`comment`,title:e=>(e.attributes?.[Zo]??[]).length>0?``:`Legg til kommentar`,ariaLabel:`Legg til kommentar`,renderExtendedUI:e=>{let t=(e.getAttribute(Zo)??[])[0],n=`pkt-fileupload-comment-${e.file.fileId}`,r=()=>{let t=document.getElementById(n)?.value?.trim();t&&e.setAttribute(Zo,[{text:t,timestamp:new Date().toISOString()}]),e.close()};return j`
1567
+ />`}}),us=()=>({id:`comment`,title:e=>(e.attributes?.[is]??[]).length>0?``:`Legg til kommentar`,ariaLabel:`Legg til kommentar`,renderExtendedUI:e=>{let t=(e.getAttribute(is)??[])[0],n=`pkt-fileupload-comment-${e.file.fileId}`,r=()=>{let t=document.getElementById(n)?.value?.trim();t&&e.setAttribute(is,[{text:t,timestamp:new Date().toISOString()}]),e.close()};return j`
1568
1568
  <label for=${n} class="pkt-fileupload__queue-display__item__comment-label">
1569
1569
  ${t?`Rediger kommentar`:`Legg til kommentar`}
1570
1570
  </label>
@@ -1575,7 +1575,7 @@
1575
1575
  .value=${t?.text??``}
1576
1576
  rows="2"
1577
1577
  placeholder="Skriv inn kommentar"
1578
- @keydown=${t=>es(t,r,e.close)}
1578
+ @keydown=${t=>ss(t,r,e.close)}
1579
1579
  ></textarea>
1580
1580
  <button
1581
1581
  type="button"
@@ -1593,7 +1593,7 @@
1593
1593
  >
1594
1594
  Avbryt
1595
1595
  </button>
1596
- `},renderContent:e=>{if(e.isActive)return null;let t=e.getAttribute(Zo)??[];if(t.length===0)return null;let n=t[0];return j`
1596
+ `},renderContent:e=>{if(e.isActive)return null;let t=e.getAttribute(is)??[];if(t.length===0)return null;let n=t[0];return j`
1597
1597
  <div class="pkt-fileupload__queue-display__item__comments">
1598
1598
  <div class="pkt-fileupload__queue-display__item__comment">
1599
1599
  <div class="pkt-fileupload__queue-display__item__comment__content">
@@ -1601,7 +1601,7 @@
1601
1601
  ${n.text}
1602
1602
  </span>
1603
1603
  <time class="pkt-fileupload__queue-display__item__comment__time">
1604
- ${Qo(n.timestamp)}
1604
+ ${as(n.timestamp)}
1605
1605
  </time>
1606
1606
  </div>
1607
1607
  <div class="pkt-fileupload__queue-display__item__comment__actions">
@@ -1619,18 +1619,18 @@
1619
1619
  class="pkt-fileupload__queue-display__item__comment__action"
1620
1620
  aria-label="Slett kommentar"
1621
1621
  ?disabled=${e.disabled}
1622
- @click=${()=>e.setAttribute(Zo,void 0)}
1622
+ @click=${()=>e.setAttribute(is,void 0)}
1623
1623
  >
1624
1624
  <pkt-icon name="trash-can"></pkt-icon>
1625
1625
  </button>
1626
1626
  </div>
1627
1627
  </div>
1628
1628
  </div>
1629
- `},renderHidden:e=>{let t=e.getAttribute(Zo);return j`<input
1629
+ `},renderHidden:e=>{let t=e.getAttribute(is);return j`<input
1630
1630
  type="hidden"
1631
1631
  name=${`${e.inputName}-comments`}
1632
1632
  value=${t?JSON.stringify(t):``}
1633
- />`}}),is=(e,t)=>{let n=Ko(e,t);return n?j`<span
1633
+ />`}}),ds=(e,t)=>{let n=$o(e,t);return n?j`<span
1634
1634
  class="pkt-fileupload__queue-display__item__title__head"
1635
1635
  data-pkt-truncate-part="first"
1636
1636
  >${n.head}</span
@@ -1638,19 +1638,19 @@
1638
1638
  class="pkt-fileupload__queue-display__item__title__tail"
1639
1639
  data-pkt-truncate-part="tail"
1640
1640
  >${n.tail}</span
1641
- >`:j`<span data-pkt-truncate-part="first">${e}</span>`},as=(e,t,n)=>j`
1641
+ >`:j`<span data-pkt-truncate-part="first">${e}</span>`},fs=(e,t,n)=>j`
1642
1642
  <p class="pkt-fileupload__queue-display__item__title">
1643
- ${is(e,n)}${t?j`<span class="pkt-fileupload__queue-display__item__filesize"> (${t})</span>`:null}
1643
+ ${ds(e,n)}${t?j`<span class="pkt-fileupload__queue-display__item__filesize"> (${t})</span>`:null}
1644
1644
  </p>
1645
- `,os=e=>typeof e==`number`?`in-progress`:e===`error`?`error`:`idle`,ss=e=>j`<span class="pkt-fileupload__queue-display__item__loading-text" aria-label="Laster opp fil"
1645
+ `,ps=e=>typeof e==`number`?`in-progress`:e===`error`?`error`:`idle`,ms=e=>j`<span class="pkt-fileupload__queue-display__item__loading-text" aria-label="Laster opp fil"
1646
1646
  >${e??`Laster opp...`}</span
1647
- >`,cs=({operationId:e,file:t,inputName:n,disabled:r,isActive:i,onActivateOperation:a,onCloseOperation:o,getFileAttribute:s,setFileAttribute:c})=>({file:t,inputName:n,disabled:r,isActive:i,activate:()=>a(t.fileId,e),close:()=>o(t.fileId),getAttribute:e=>s(t.fileId,e),setAttribute:(e,n)=>c(t.fileId,e,n)}),ls=({file:e,fileSize:t,disabled:n,transferProgress:r,transferShowProgress:i,loadingText:a,truncateTail:o,onCancel:s,iconName:c=`document-text`})=>{let l=Yo(e),u=i??r!==0;return j`
1647
+ >`,hs=({operationId:e,file:t,inputName:n,disabled:r,isActive:i,onActivateOperation:a,onCloseOperation:o,getFileAttribute:s,setFileAttribute:c})=>({file:t,inputName:n,disabled:r,isActive:i,activate:()=>a(t.fileId,e),close:()=>o(t.fileId),getAttribute:e=>s(t.fileId,e),setAttribute:(e,n)=>c(t.fileId,e,n)}),gs=({file:e,fileSize:t,disabled:n,transferProgress:r,transferShowProgress:i,loadingText:a,truncateTail:o,onCancel:s,iconName:c=`document-text`})=>{let l=ns(e),u=i??r!==0;return j`
1648
1648
  <pkt-icon
1649
1649
  name=${c}
1650
1650
  class="pkt-fileupload__queue-display__item__icon pkt-icon--medium"
1651
1651
  aria-hidden="true"
1652
1652
  ></pkt-icon>
1653
- ${as(l,t,o)}
1653
+ ${fs(l,t,o)}
1654
1654
  <button
1655
1655
  type="button"
1656
1656
  class="pkt-fileupload__queue-display__item__cancel-button"
@@ -1671,14 +1671,14 @@
1671
1671
  <span class="pkt-fileupload__queue-display__item__percentage" aria-hidden="true"
1672
1672
  >${Math.round(r*100)}%</span
1673
1673
  >
1674
- `:ss(a)}
1675
- `},us=({file:e,fileSize:t,disabled:n,transferShowProgress:r,transferLastProgress:i,transferErrorMessage:a,truncateTail:o,onCancel:s})=>{let c=Yo(e),l=!!r,u=Math.round((i??1)*100);return j`
1674
+ `:ms(a)}
1675
+ `},_s=({file:e,fileSize:t,disabled:n,transferShowProgress:r,transferLastProgress:i,transferErrorMessage:a,truncateTail:o,onCancel:s})=>{let c=ns(e),l=!!r,u=Math.round((i??1)*100);return j`
1676
1676
  <pkt-icon
1677
1677
  name="alert-error"
1678
1678
  class="pkt-fileupload__queue-display__item__icon pkt-icon--medium"
1679
1679
  aria-hidden="true"
1680
1680
  ></pkt-icon>
1681
- ${as(c,t,o)}
1681
+ ${fs(c,t,o)}
1682
1682
  <button
1683
1683
  type="button"
1684
1684
  class="pkt-fileupload__queue-display__item__cancel-button"
@@ -1700,7 +1700,7 @@
1700
1700
  ${a?j`<span class="pkt-fileupload__queue-display__item__error-message"
1701
1701
  >${a}</span
1702
1702
  >`:null}
1703
- `},ds=({file:e,disabled:t,inputName:n,operations:r,activeOperationId:i,onActivateOperation:a,onCloseOperation:o,getFileAttribute:s,setFileAttribute:c})=>{let l=r.find(e=>e.id===i);if(l?.renderInlineUI||l?.renderExtendedUI)return null;let u=r.map(r=>{let l=cs({operationId:r.id,file:e,inputName:n,disabled:t,isActive:r.id===i,onActivateOperation:a,onCloseOperation:o,getFileAttribute:s,setFileAttribute:c}),u=typeof r.title==`function`?r.title(e):r.title;return u?j`<button
1703
+ `},vs=({file:e,disabled:t,inputName:n,operations:r,activeOperationId:i,onActivateOperation:a,onCloseOperation:o,getFileAttribute:s,setFileAttribute:c})=>{let l=r.find(e=>e.id===i);if(l?.renderInlineUI||l?.renderExtendedUI)return null;let u=r.map(r=>{let l=hs({operationId:r.id,file:e,inputName:n,disabled:t,isActive:r.id===i,onActivateOperation:a,onCloseOperation:o,getFileAttribute:s,setFileAttribute:c}),u=typeof r.title==`function`?r.title(e):r.title;return u?j`<button
1704
1704
  type="button"
1705
1705
  class="pkt-fileupload__queue-display__item__operation"
1706
1706
  aria-label=${J(typeof r.ariaLabel==`function`?r.ariaLabel(e):r.ariaLabel)}
@@ -1708,18 +1708,18 @@
1708
1708
  @click=${()=>{(r.renderInlineUI||r.renderExtendedUI)&&l.activate(),r.onClick?.(l)}}
1709
1709
  >
1710
1710
  ${u}
1711
- </button>`:null}).filter(Boolean);return u.length===0?null:j`<div class="pkt-fileupload__queue-display__item__actions">${u}</div>`},fs=({file:e,disabled:t,inputName:n,operations:r,activeOperationId:i,onActivateOperation:a,onCloseOperation:o,getFileAttribute:s,setFileAttribute:c})=>r.map(r=>{if(!r.renderContent)return null;let l=cs({operationId:r.id,file:e,inputName:n,disabled:t,isActive:r.id===i,onActivateOperation:a,onCloseOperation:o,getFileAttribute:s,setFileAttribute:c}),u=r.renderContent(l);return u==null?null:j`<div class="pkt-fileupload__queue-display__item__operation-content">
1711
+ </button>`:null}).filter(Boolean);return u.length===0?null:j`<div class="pkt-fileupload__queue-display__item__actions">${u}</div>`},ys=({file:e,disabled:t,inputName:n,operations:r,activeOperationId:i,onActivateOperation:a,onCloseOperation:o,getFileAttribute:s,setFileAttribute:c})=>r.map(r=>{if(!r.renderContent)return null;let l=hs({operationId:r.id,file:e,inputName:n,disabled:t,isActive:r.id===i,onActivateOperation:a,onCloseOperation:o,getFileAttribute:s,setFileAttribute:c}),u=r.renderContent(l);return u==null?null:j`<div class="pkt-fileupload__queue-display__item__operation-content">
1712
1712
  ${u}
1713
- </div>`}),ps=({file:e,disabled:t,inputName:n,operations:r,activeOperationId:i,onActivateOperation:a,onCloseOperation:o,getFileAttribute:s,setFileAttribute:c})=>{if(!i)return null;let l=r.find(e=>e.id===i);if(!l?.renderExtendedUI)return null;let u=cs({operationId:l.id,file:e,inputName:n,disabled:t,isActive:!0,onActivateOperation:a,onCloseOperation:o,getFileAttribute:s,setFileAttribute:c});return j`<div class="pkt-fileupload__queue-display__item__expanded-operation-ui">
1713
+ </div>`}),bs=({file:e,disabled:t,inputName:n,operations:r,activeOperationId:i,onActivateOperation:a,onCloseOperation:o,getFileAttribute:s,setFileAttribute:c})=>{if(!i)return null;let l=r.find(e=>e.id===i);if(!l?.renderExtendedUI)return null;let u=hs({operationId:l.id,file:e,inputName:n,disabled:t,isActive:!0,onActivateOperation:a,onCloseOperation:o,getFileAttribute:s,setFileAttribute:c});return j`<div class="pkt-fileupload__queue-display__item__expanded-operation-ui">
1714
1714
  ${l.renderExtendedUI(u)}
1715
- </div>`},ms=({file:e,disabled:t,inputName:n,operations:r,activeOperationId:i,onActivateOperation:a,onCloseOperation:o,getFileAttribute:s,setFileAttribute:c})=>r.map(r=>{if(!r.renderHidden)return null;let l=cs({operationId:r.id,file:e,inputName:n,disabled:t,isActive:r.id===i,onActivateOperation:a,onCloseOperation:o,getFileAttribute:s,setFileAttribute:c});return r.renderHidden(l)}),hs=(e,t,n)=>j`
1715
+ </div>`},xs=({file:e,disabled:t,inputName:n,operations:r,activeOperationId:i,onActivateOperation:a,onCloseOperation:o,getFileAttribute:s,setFileAttribute:c})=>r.map(r=>{if(!r.renderHidden)return null;let l=hs({operationId:r.id,file:e,inputName:n,disabled:t,isActive:r.id===i,onActivateOperation:a,onCloseOperation:o,getFileAttribute:s,setFileAttribute:c});return r.renderHidden(l)}),Ss=(e,t,n)=>j`
1716
1716
  <pkt-icon
1717
1717
  name="document-text"
1718
1718
  class="pkt-fileupload__queue-display__item__icon pkt-icon--medium"
1719
1719
  aria-hidden="true"
1720
1720
  ></pkt-icon>
1721
- ${as(Yo(e),t,n)}
1722
- `,gs=({file:e,thumbnailUrl:t,previewEnabled:n,canOpenPreview:r,truncateTail:i,onOpenPreview:a,onThumbnailImageError:o})=>{let s=Yo(e),c=!!t,l=!!n&&!!r,u=l&&!!a;return j`
1721
+ ${fs(ns(e),t,n)}
1722
+ `,Cs=({file:e,thumbnailUrl:t,previewEnabled:n,canOpenPreview:r,truncateTail:i,onOpenPreview:a,onThumbnailImageError:o})=>{let s=ns(e),c=!!t,l=!!n&&!!r,u=l&&!!a;return j`
1723
1723
  <div
1724
1724
  class=${q({"pkt-fileupload__queue-display__item__thumbnail":!0,"pkt-fileupload__queue-display__item__thumbnail--fallback":!c})}
1725
1725
  >
@@ -1748,15 +1748,15 @@
1748
1748
  </span>
1749
1749
  </button>
1750
1750
  <span class="pkt-fileupload__queue-display__item__thumbnail__title"
1751
- >${is(s,i)}</span
1751
+ >${ds(s,i)}</span
1752
1752
  >
1753
1753
  </div>
1754
- `},_s=({file:e,inputName:t,disabled:n,fileSize:r,operations:i,activeOperationId:a,onActivateOperation:o,onCloseOperation:s,getFileAttribute:c,setFileAttribute:l,transferProgress:u,transferErrorMessage:d,transferShowProgress:f,transferLastProgress:p,loadingText:m,truncateTail:h,onCancel:g})=>{let _=os(u),v=i.find(e=>e.id===a),y=v?.renderInlineUI?v.renderInlineUI(cs({operationId:v.id,file:e,inputName:t,disabled:n,isActive:!0,onActivateOperation:o,onCloseOperation:s,getFileAttribute:c,setFileAttribute:l})):null;return j`
1754
+ `},ws=({file:e,inputName:t,disabled:n,fileSize:r,operations:i,activeOperationId:a,onActivateOperation:o,onCloseOperation:s,getFileAttribute:c,setFileAttribute:l,transferProgress:u,transferErrorMessage:d,transferShowProgress:f,transferLastProgress:p,loadingText:m,truncateTail:h,onCancel:g})=>{let _=ps(u),v=i.find(e=>e.id===a),y=v?.renderInlineUI?v.renderInlineUI(hs({operationId:v.id,file:e,inputName:t,disabled:n,isActive:!0,onActivateOperation:o,onCloseOperation:s,getFileAttribute:c,setFileAttribute:l})):null;return j`
1755
1755
  <li
1756
1756
  class=${q({"pkt-fileupload__queue-display__item":!0,"pkt-fileupload__queue-display__item--in-progress":_===`in-progress`,"pkt-fileupload__queue-display__item--error":_===`error`,[`pkt-fileupload__queue-display__item--${u}`]:typeof u==`string`})}
1757
1757
  >
1758
- ${ms({file:e,disabled:n,inputName:t,operations:i,activeOperationId:a,onActivateOperation:o,onCloseOperation:s,getFileAttribute:c,setFileAttribute:l})}
1759
- ${_===`in-progress`?ls({file:e,fileSize:r,disabled:n,transferProgress:u,transferShowProgress:f,loadingText:m,truncateTail:h,onCancel:g}):_===`error`?us({file:e,fileSize:r,disabled:n,transferShowProgress:f,transferLastProgress:p,transferErrorMessage:d,truncateTail:h,onCancel:g}):y?j`
1758
+ ${xs({file:e,disabled:n,inputName:t,operations:i,activeOperationId:a,onActivateOperation:o,onCloseOperation:s,getFileAttribute:c,setFileAttribute:l})}
1759
+ ${_===`in-progress`?gs({file:e,fileSize:r,disabled:n,transferProgress:u,transferShowProgress:f,loadingText:m,truncateTail:h,onCancel:g}):_===`error`?_s({file:e,fileSize:r,disabled:n,transferShowProgress:f,transferLastProgress:p,transferErrorMessage:d,truncateTail:h,onCancel:g}):y?j`
1760
1760
  <pkt-icon
1761
1761
  name="document-text"
1762
1762
  class="pkt-fileupload__queue-display__item__icon pkt-icon--medium"
@@ -1765,17 +1765,17 @@
1765
1765
  <div class="pkt-fileupload__queue-display__item__inline-ui">
1766
1766
  ${y}
1767
1767
  </div>
1768
- `:hs(e,r,h)}
1769
- ${_===`idle`?ds({file:e,disabled:n,inputName:t,operations:i,activeOperationId:a,onActivateOperation:o,onCloseOperation:s,getFileAttribute:c,setFileAttribute:l}):null}
1770
- ${_===`idle`?fs({file:e,disabled:n,inputName:t,operations:i,activeOperationId:a,onActivateOperation:o,onCloseOperation:s,getFileAttribute:c,setFileAttribute:l}):null}
1771
- ${_===`idle`?ps({file:e,disabled:n,inputName:t,operations:i,activeOperationId:a,onActivateOperation:o,onCloseOperation:s,getFileAttribute:c,setFileAttribute:l}):null}
1768
+ `:Ss(e,r,h)}
1769
+ ${_===`idle`?vs({file:e,disabled:n,inputName:t,operations:i,activeOperationId:a,onActivateOperation:o,onCloseOperation:s,getFileAttribute:c,setFileAttribute:l}):null}
1770
+ ${_===`idle`?ys({file:e,disabled:n,inputName:t,operations:i,activeOperationId:a,onActivateOperation:o,onCloseOperation:s,getFileAttribute:c,setFileAttribute:l}):null}
1771
+ ${_===`idle`?bs({file:e,disabled:n,inputName:t,operations:i,activeOperationId:a,onActivateOperation:o,onCloseOperation:s,getFileAttribute:c,setFileAttribute:l}):null}
1772
1772
  </li>
1773
- `},vs=({file:e,inputName:t,disabled:n,fileSize:r,thumbnailUrl:i,previewEnabled:a,canOpenPreview:o,operations:s,activeOperationId:c,onActivateOperation:l,onCloseOperation:u,getFileAttribute:d,setFileAttribute:f,transferProgress:p,transferErrorMessage:m,transferShowProgress:h,transferLastProgress:g,loadingText:_,truncateTail:v,onCancel:y,onOpenPreview:b,onThumbnailImageError:x})=>{let S=os(p),C=s.find(e=>e.id===c),w=C?.renderInlineUI?C.renderInlineUI(cs({operationId:C.id,file:e,inputName:t,disabled:n,isActive:!0,onActivateOperation:l,onCloseOperation:u,getFileAttribute:d,setFileAttribute:f})):null;return j`
1773
+ `},Ts=({file:e,inputName:t,disabled:n,fileSize:r,thumbnailUrl:i,previewEnabled:a,canOpenPreview:o,operations:s,activeOperationId:c,onActivateOperation:l,onCloseOperation:u,getFileAttribute:d,setFileAttribute:f,transferProgress:p,transferErrorMessage:m,transferShowProgress:h,transferLastProgress:g,loadingText:_,truncateTail:v,onCancel:y,onOpenPreview:b,onThumbnailImageError:x})=>{let S=ps(p),C=s.find(e=>e.id===c),w=C?.renderInlineUI?C.renderInlineUI(hs({operationId:C.id,file:e,inputName:t,disabled:n,isActive:!0,onActivateOperation:l,onCloseOperation:u,getFileAttribute:d,setFileAttribute:f})):null;return j`
1774
1774
  <li
1775
1775
  class=${q({"pkt-fileupload__queue-display__item":!0,"pkt-fileupload__queue-display__item--in-progress":S===`in-progress`,"pkt-fileupload__queue-display__item--error":S===`error`,[`pkt-fileupload__queue-display__item--${p}`]:typeof p==`string`})}
1776
1776
  >
1777
- ${ms({file:e,disabled:n,inputName:t,operations:s,activeOperationId:c,onActivateOperation:l,onCloseOperation:u,getFileAttribute:d,setFileAttribute:f})}
1778
- ${S===`in-progress`?ls({file:e,fileSize:r,disabled:n,transferProgress:p,transferShowProgress:h,loadingText:_,truncateTail:v,onCancel:y,iconName:`picture`}):S===`error`?us({file:e,fileSize:r,disabled:n,transferShowProgress:h,transferLastProgress:g,transferErrorMessage:m,truncateTail:v,onCancel:y}):w?j`
1777
+ ${xs({file:e,disabled:n,inputName:t,operations:s,activeOperationId:c,onActivateOperation:l,onCloseOperation:u,getFileAttribute:d,setFileAttribute:f})}
1778
+ ${S===`in-progress`?gs({file:e,fileSize:r,disabled:n,transferProgress:p,transferShowProgress:h,loadingText:_,truncateTail:v,onCancel:y,iconName:`picture`}):S===`error`?_s({file:e,fileSize:r,disabled:n,transferShowProgress:h,transferLastProgress:g,transferErrorMessage:m,truncateTail:v,onCancel:y}):w?j`
1779
1779
  <pkt-icon
1780
1780
  name="picture"
1781
1781
  class="pkt-fileupload__queue-display__item__icon pkt-icon--medium"
@@ -1784,12 +1784,12 @@
1784
1784
  <div class="pkt-fileupload__queue-display__item__inline-ui">
1785
1785
  ${w}
1786
1786
  </div>
1787
- `:gs({file:e,thumbnailUrl:i,previewEnabled:a,canOpenPreview:o,truncateTail:v,onOpenPreview:b,onThumbnailImageError:x})}
1788
- ${S===`idle`?ds({file:e,disabled:n,inputName:t,operations:s,activeOperationId:c,onActivateOperation:l,onCloseOperation:u,getFileAttribute:d,setFileAttribute:f}):null}
1789
- ${S===`idle`?fs({file:e,disabled:n,inputName:t,operations:s,activeOperationId:c,onActivateOperation:l,onCloseOperation:u,getFileAttribute:d,setFileAttribute:f}):null}
1790
- ${S===`idle`?ps({file:e,disabled:n,inputName:t,operations:s,activeOperationId:c,onActivateOperation:l,onCloseOperation:u,getFileAttribute:d,setFileAttribute:f}):null}
1787
+ `:Cs({file:e,thumbnailUrl:i,previewEnabled:a,canOpenPreview:o,truncateTail:v,onOpenPreview:b,onThumbnailImageError:x})}
1788
+ ${S===`idle`?vs({file:e,disabled:n,inputName:t,operations:s,activeOperationId:c,onActivateOperation:l,onCloseOperation:u,getFileAttribute:d,setFileAttribute:f}):null}
1789
+ ${S===`idle`?ys({file:e,disabled:n,inputName:t,operations:s,activeOperationId:c,onActivateOperation:l,onCloseOperation:u,getFileAttribute:d,setFileAttribute:f}):null}
1790
+ ${S===`idle`?bs({file:e,disabled:n,inputName:t,operations:s,activeOperationId:c,onActivateOperation:l,onCloseOperation:u,getFileAttribute:d,setFileAttribute:f}):null}
1791
1791
  </li>
1792
- `},ys=class extends Xo{constructor(...e){super(...e),this.activeOperationByFileId={},this.isPreviewModalOpen=!1,this.previewCurrentIndex=0,this.failedImageFileIds={},this.closePreview=()=>{this.isPreviewModalOpen=!1},this.onPreviewKeyDown=(e,t)=>{if(this.isPreviewModalOpen){if(e.key===`Tab`){Go(e,e.currentTarget);return}switch(e.key){case`ArrowLeft`:e.preventDefault(),this.navigatePreview(`prev`,t);break;case`ArrowRight`:e.preventDefault(),this.navigatePreview(`next`,t);break;case`Escape`:e.preventDefault(),this.closePreview();break;default:break}}}}render(){let e=this.renderContent();return this.label?j`
1792
+ `},Es=class extends rs{constructor(...e){super(...e),this.activeOperationByFileId={},this.isPreviewModalOpen=!1,this.previewCurrentIndex=0,this.failedImageFileIds={},this.closePreview=()=>{this.isPreviewModalOpen=!1},this.onPreviewKeyDown=(e,t)=>{if(this.isPreviewModalOpen){if(e.key===`Tab`){Qo(e,e.currentTarget);return}switch(e.key){case`ArrowLeft`:e.preventDefault(),this.navigatePreview(`prev`,t);break;case`ArrowRight`:e.preventDefault(),this.navigatePreview(`next`,t);break;case`Escape`:e.preventDefault(),this.closePreview();break;default:break}}}}render(){let e=this.renderContent();return this.label?j`
1793
1793
  <pkt-input-wrapper
1794
1794
  .forId=${`${this.id}-input`}
1795
1795
  .label=${this.label}
@@ -1802,7 +1802,7 @@
1802
1802
  >
1803
1803
  ${e}
1804
1804
  </pkt-input-wrapper>
1805
- `:e}renderContent(){let e=this.getSortedFilesAndTransfers(),t=this.getPreviewableImages(e),n=this.getSupportedFormatsText(),r=[!this.label&&this.helptext?`${this.id}-helptext`:void 0,this.hasEffectiveError?`${this.id}-error`:void 0].filter(Boolean).join(` `)||void 0,i=this.itemRenderer===`thumbnail`?this.multiple?{dragInactive:ko.dropZoneDragMultipleThumbnail,dragActive:ko.dropZoneDragActiveMultipleThumbnail,openFileDialog:ko.dropZoneOpenFileDialogMultipleThumbnail}:{dragInactive:ko.dropZoneDragSingleThumbnail,dragActive:ko.dropZoneDragActiveSingleThumbnail,openFileDialog:ko.dropZoneOpenFileDialogSingleThumbnail}:this.multiple?{dragInactive:ko.dropZoneDragMultiple,dragActive:ko.dropZoneDragActiveMultiple,openFileDialog:ko.dropZoneOpenFileDialogMultiple}:{dragInactive:ko.dropZoneDragSingle,dragActive:ko.dropZoneDragActiveSingle,openFileDialog:ko.dropZoneOpenFileDialogSingle};return j`
1805
+ `:e}renderContent(){let e=this.getSortedFilesAndTransfers(),t=this.getPreviewableImages(e),n=this.getSupportedFormatsText(),r=[!this.label&&this.helptext?`${this.id}-helptext`:void 0,this.hasEffectiveError?`${this.id}-error`:void 0].filter(Boolean).join(` `)||void 0,i=this.itemRenderer===`thumbnail`?this.multiple?{dragInactive:Io.dropZoneDragMultipleThumbnail,dragActive:Io.dropZoneDragActiveMultipleThumbnail,openFileDialog:Io.dropZoneOpenFileDialogMultipleThumbnail}:{dragInactive:Io.dropZoneDragSingleThumbnail,dragActive:Io.dropZoneDragActiveSingleThumbnail,openFileDialog:Io.dropZoneOpenFileDialogSingleThumbnail}:this.multiple?{dragInactive:Io.dropZoneDragMultiple,dragActive:Io.dropZoneDragActiveMultiple,openFileDialog:Io.dropZoneOpenFileDialogMultiple}:{dragInactive:Io.dropZoneDragSingle,dragActive:Io.dropZoneDragActiveSingle,openFileDialog:Io.dropZoneOpenFileDialogSingle};return j`
1806
1806
  <div
1807
1807
  class=${q({"pkt-fileupload":!0,"pkt-fileupload--full-width":this.fullwidth,"pkt-fileupload--error":this.hasEffectiveError,"pkt-fileupload--disabled":this.disabled})}
1808
1808
  aria-disabled=${String(this.disabled)}
@@ -1853,7 +1853,7 @@
1853
1853
  </button>`}
1854
1854
  </p>
1855
1855
  ${n?j`<p class="pkt-fileupload__drop-zone__placeholder__formats">
1856
- ${ko.supportedFormatsPrefix} ${n}
1856
+ ${Io.supportedFormatsPrefix} ${n}
1857
1857
  </p>`:null}
1858
1858
  </div>
1859
1859
  </div>
@@ -1874,7 +1874,7 @@
1874
1874
  </ul>`:null}
1875
1875
  ${this.renderPreviewModal(t)}
1876
1876
  </div>
1877
- `}renderQueueItem(e,t){let n=typeof e.file?.size==`number`?this.formatFileSize(e.file.size):``,r=this.getQueueItemOperations();if(this.itemRenderer===`thumbnail`){let i=this.canOpenPreview(e),a=this.failedImageFileIds[e.fileId]?.thumbnail?void 0:this.getThumbnailUrl(e);return vs({file:e,inputName:this.name,disabled:this.disabled,fileSize:n,operations:r,activeOperationId:this.activeOperationByFileId[e.fileId],onActivateOperation:(e,t)=>this.activateOperation(e,t),onCloseOperation:e=>this.closeOperation(e),getFileAttribute:(e,t)=>this.getFileAttribute(e,t),setFileAttribute:(e,t,n)=>this.setFileAttribute(e,t,n),thumbnailUrl:a,previewEnabled:this.enableImagePreview,canOpenPreview:i,transferProgress:e.progress,transferErrorMessage:e.errorMessage,transferShowProgress:e.showProgress,transferLastProgress:e.lastProgress,loadingText:`Laster opp`,truncateTail:this.truncateTail,onCancel:e=>this.cancelTransfer(e),onOpenPreview:e=>this.openPreview(e,t),onThumbnailImageError:e=>this.markImageFailed(e,`thumbnail`)})}return _s({file:e,inputName:this.name,disabled:this.disabled,fileSize:n,operations:r,activeOperationId:this.activeOperationByFileId[e.fileId],onActivateOperation:(e,t)=>this.activateOperation(e,t),onCloseOperation:e=>this.closeOperation(e),getFileAttribute:(e,t)=>this.getFileAttribute(e,t),setFileAttribute:(e,t,n)=>this.setFileAttribute(e,t,n),transferProgress:e.progress,transferErrorMessage:e.errorMessage,transferShowProgress:e.showProgress,transferLastProgress:e.lastProgress,loadingText:`Laster opp`,truncateTail:this.truncateTail,onCancel:e=>this.cancelTransfer(e)})}markImageFailed(e,t){this.failedImageFileIds={...this.failedImageFileIds,[e]:{...this.failedImageFileIds[e],[t]:!0}}}getPreviewableImages(e){return this.enableImagePreview?e.filter(e=>e.progress===`done`&&this.isImageFile(e)):[]}canOpenPreview(e){return this.enableImagePreview&&e.progress===`done`&&this.isImageFile(e)}openPreview(e,t){let n=t.findIndex(t=>t.fileId===e);n<0||(this.previewCurrentIndex=n,this.isPreviewModalOpen=!0,this.failedImageFileIds={...this.failedImageFileIds,[e]:{...this.failedImageFileIds[e],preview:!1}})}navigatePreview(e,t){t.length!==0&&(this.previewCurrentIndex=qo(this.previewCurrentIndex,e,t.length))}renderPreviewModal(e){if(!this.enableImagePreview||e.length===0)return null;let t=e[this.previewCurrentIndex];if(!t)return null;let n=e.length>1,r=this.getThumbnailUrl(t),i=!!r&&!this.failedImageFileIds[t.fileId]?.preview,a=t.attributes?.targetFilename||t.file?.name||`Forhåndsvisning`;return j`
1877
+ `}renderQueueItem(e,t){let n=typeof e.file?.size==`number`?this.formatFileSize(e.file.size):``,r=this.getQueueItemOperations();if(this.itemRenderer===`thumbnail`){let i=this.canOpenPreview(e),a=this.failedImageFileIds[e.fileId]?.thumbnail?void 0:this.getThumbnailUrl(e);return Ts({file:e,inputName:this.name,disabled:this.disabled,fileSize:n,operations:r,activeOperationId:this.activeOperationByFileId[e.fileId],onActivateOperation:(e,t)=>this.activateOperation(e,t),onCloseOperation:e=>this.closeOperation(e),getFileAttribute:(e,t)=>this.getFileAttribute(e,t),setFileAttribute:(e,t,n)=>this.setFileAttribute(e,t,n),thumbnailUrl:a,previewEnabled:this.enableImagePreview,canOpenPreview:i,transferProgress:e.progress,transferErrorMessage:e.errorMessage,transferShowProgress:e.showProgress,transferLastProgress:e.lastProgress,loadingText:`Laster opp`,truncateTail:this.truncateTail,onCancel:e=>this.cancelTransfer(e),onOpenPreview:e=>this.openPreview(e,t),onThumbnailImageError:e=>this.markImageFailed(e,`thumbnail`)})}return ws({file:e,inputName:this.name,disabled:this.disabled,fileSize:n,operations:r,activeOperationId:this.activeOperationByFileId[e.fileId],onActivateOperation:(e,t)=>this.activateOperation(e,t),onCloseOperation:e=>this.closeOperation(e),getFileAttribute:(e,t)=>this.getFileAttribute(e,t),setFileAttribute:(e,t,n)=>this.setFileAttribute(e,t,n),transferProgress:e.progress,transferErrorMessage:e.errorMessage,transferShowProgress:e.showProgress,transferLastProgress:e.lastProgress,loadingText:`Laster opp`,truncateTail:this.truncateTail,onCancel:e=>this.cancelTransfer(e)})}markImageFailed(e,t){this.failedImageFileIds={...this.failedImageFileIds,[e]:{...this.failedImageFileIds[e],[t]:!0}}}getPreviewableImages(e){return this.enableImagePreview?e.filter(e=>e.progress===`done`&&this.isImageFile(e)):[]}canOpenPreview(e){return this.enableImagePreview&&e.progress===`done`&&this.isImageFile(e)}openPreview(e,t){let n=t.findIndex(t=>t.fileId===e);n<0||(this.previewCurrentIndex=n,this.isPreviewModalOpen=!0,this.failedImageFileIds={...this.failedImageFileIds,[e]:{...this.failedImageFileIds[e],preview:!1}})}navigatePreview(e,t){t.length!==0&&(this.previewCurrentIndex=es(this.previewCurrentIndex,e,t.length))}renderPreviewModal(e){if(!this.enableImagePreview||e.length===0)return null;let t=e[this.previewCurrentIndex];if(!t)return null;let n=e.length>1,r=this.getThumbnailUrl(t),i=!!r&&!this.failedImageFileIds[t.fileId]?.preview,a=t.attributes?.targetFilename||t.file?.name||`Forhåndsvisning`;return j`
1878
1878
  <pkt-modal
1879
1879
  .open=${this.isPreviewModalOpen}
1880
1880
  .headingText=${a}
@@ -1929,7 +1929,7 @@
1929
1929
  </button>`:null}
1930
1930
  </div>
1931
1931
  </pkt-modal>
1932
- `}getQueueItemOperations(){let e=[];return this.renameFilesEnabled&&this.itemRenderer!==`thumbnail`&&e.push(ns()),this.addCommentsEnabled&&this.itemRenderer!==`thumbnail`&&e.push(rs()),e.push(...this.extraOperations),e.push(ts(e=>this.removeFileItem(e))),e}activateOperation(e,t){this.activeOperationByFileId={...this.activeOperationByFileId,[e]:t}}closeOperation(e){this.activeOperationByFileId={...this.activeOperationByFileId,[e]:void 0}}getFileAttribute(e,t){let n=this.getCurrentFiles().find(t=>t.fileId===e);if(n)return n.attributes?.[t]??void 0}setFileAttribute(e,t,n){let r=this.getCurrentFiles().find(t=>t.fileId===e);if(!r)return;let i={...r.attributes,[t]:n};n===void 0&&delete i[t],this.updateFileItem(e,{attributes:i})}};K([G()],ys.prototype,`activeOperationByFileId`,void 0),K([G()],ys.prototype,`isPreviewModalOpen`,void 0),K([G()],ys.prototype,`previewCurrentIndex`,void 0),K([G()],ys.prototype,`failedImageFileIds`,void 0),ys=K([U(`pkt-fileupload`)],ys);var bs={i18n:{nb:{contentPresentation:{title:`Oslo kommune bruker informasjonskapsler`,description:[`For at nettstedet skal fungere og være trygt, bruker Oslo kommune informasjonskapsler. Noen er teknisk nødvendige, mens andre sikrer ulik funksjonalitet.`,`Godtar du alle informasjonskapsler, tillater du også at vi samler inn data om statistikk og brukeradferd. Da hjelper du oss med å lage et bedre nettsted uten at du trenger å dele noe personlig informasjon med oss.`],buttons:{accept:`Godta alle`,reject:`Kun nødvendige`,settings:`Innstillinger for informasjonskapsler`}},contentSettings:{title:`Innstillinger for informasjonskapsler`,description:[`Her kan du velge hvilke typer informasjonskapsler du vil tillate. Tillatelsen gjelder i 90 dager. Husk at nødvendige informasjonskapsler ikke kan velges bort.`,`Du kan når som helst endre innstillingene og finne mer informasjon nederst på nettstedet under «Innstillinger for informasjonskapsler» og «Personvern og informasjonskapsler».`],buttons:{back:`Tilbake`,save:`Lagre innstillinger`}}},en:{contentPresentation:{title:`Before you visit Oslo kommune ...`,description:[`This website uses cookies to make improvements. In this context, we need your consent to measure the traffic on the website in relation to statistics and feedback.`,`To read more about what we use cookies for, go to our privacy declaration which you will find at the bottom of our websites.`],buttons:{accept:`Yes, I accept`,reject:`Only necessary`,settings:`Go to settings`}},contentSettings:{title:`Her kan du aktivt velge mellom ulike informasjonskapsler`,description:[`For å lese mer om hva vi bruker informasjonskapsler til gå til vår personvernserklering som du finner på våre nettsider`],buttons:{back:`Back`,save:`Save settings`}}}},cookies:[{name:`statistics`,defaultValue:null,i18n:{nb:{title:`Statistikk og analyse`,description:`Jeg godtar at Oslo kommune bruker informasjonskapsler til å innhente data om statistikk og brukeradferd.`,buttons:{yes:`Ja`,no:`Nei`}},en:{title:`Statistics and analytics`,description:`Select your preference for statistics and analytics`,buttons:{yes:`Yes`,no:`No`}}}},{name:`survey`,defaultValue:null,i18n:{nb:{title:`Skriftlige tilbakemeldinger`,description:`Jeg godtar at Oslo kommune bruker informasjonskapsler til å vise responsfelt og registrere tilbakemeldinger.`,buttons:{yes:`Ja`,no:`Nei`}},en:{title:`Survey`,description:`Select your preference for survey`,buttons:{yes:`Yes`,no:`No`}}}},{name:`functional`,defaultValue:!0,i18n:{nb:{title:`Funksjonelle informasjonskapsler`,description:`Jeg godtar at Oslo kommune bruker informasjonskapsler for å gjøre ulike funksjoner på nettstedet mulige (for eksempel skjemaer og barnehagevelger).`,buttons:{yes:`Ja`,no:`Nei`}},en:{title:`Functional cookies`,description:`For the website to function optimally, we recommend that you accept these cookies`,buttons:{yes:`Yes`,no:`No`}}}}]},xs=null;function Ss(){return xs||(xs=new Promise((e,t)=>{if(document.querySelector(`#oslo-consent-script`)){e();return}let n=document.createElement(`script`);n.src=`https://cdn.web.oslo.kommune.no/cb/cb-v1.1.0.js`,n.id=`oslo-consent-script`,n.onload=()=>e(),n.onerror=t,document.head.appendChild(n);let r=document.createElement(`link`);r.href=`https://cdn.web.oslo.kommune.no/cb/cb-v1.1.0.css`,r.type=`text/css`,r.rel=`stylesheet`,r.id=`oslo-consent-styles`,document.head.appendChild(r)}),xs)}var Cs=class extends Ye{constructor(){super(),this.devMode=!1,this.hotjarId=null,this.googleAnalyticsId=null,this.cookieDomain=null,this.cookieSecure=null,this.cookieExpiryDays=null,this.triggerType=`button`,this.triggerText=null,this.i18nLanguage=`nb`}connectedCallback(){super.connectedCallback(),this.triggerText=this.triggerText||bs.i18n[this.i18nLanguage].contentPresentation.buttons.settings}disconnectedCallback(){super.disconnectedCallback(),this._cookieEventHandler&&window.__cookieEvents?.off(`CookieManager.setCookie`,this._cookieEventHandler)}returnJsonOrObject(e){let t;try{t=JSON.parse(e)}catch{t=e}return t}emitCookieConsents(e){let t=this.returnJsonOrObject(e.value).items.reduce((e,t)=>(e[t.name]=t.consent,e),{});this.dispatchEvent(new CustomEvent(`toggle-consent`,{detail:t,bubbles:!0,cancelable:!1}))}async firstUpdated(e){window.cookieBanner_googleAnalyticsId=this.googleAnalyticsId,window.cookieBanner_hotjarId=this.hotjarId,this.cookieDomain&&(window.cookieBanner_cookieDomain=this.cookieDomain),this.cookieSecure&&(window.cookieBanner_cookieSecure=this.cookieSecure),this.cookieExpiryDays&&(window.cookieBanner_cookieExpiryDays=this.cookieExpiryDays),this.devMode&&(window.cookieBanner_devMode=this.devMode),await Ss(),this.triggerInit()}triggerInit(){window.document.dispatchEvent(new Event(`CookieBannerReady`,{bubbles:!0,cancelable:!0})),window.cookieBanner.cookieConsent.validateConsentCookie().then(e=>{if(e){let e={value:window.cookieBanner.cookieConsent.getConsentCookie()};window.setTimeout(()=>this.emitCookieConsents(e),0),this._cookieEventHandler&&window.__cookieEvents.off(`CookieManager.setCookie`,this._cookieEventHandler),this._cookieEventHandler=e=>{this.emitCookieConsents(e)},window.__cookieEvents.on(`CookieManager.setCookie`,this._cookieEventHandler)}})}openModal(e){e.preventDefault(),window.cookieBanner?.cookieConsent||this.triggerInit(),setTimeout(()=>window.cookieBanner.openCookieModal())}render(){return this.triggerType===`link`?j`<a href="#" class="pkt-link" @click=${this.openModal}>${this.triggerText}</a>`:this.triggerType===`footerlink`?j`<a href="#" class="pkt-footer__link" @click=${this.openModal}>
1932
+ `}getQueueItemOperations(){let e=[];return this.renameFilesEnabled&&this.itemRenderer!==`thumbnail`&&e.push(ls()),this.addCommentsEnabled&&this.itemRenderer!==`thumbnail`&&e.push(us()),e.push(...this.extraOperations),e.push(cs(e=>this.removeFileItem(e))),e}activateOperation(e,t){this.activeOperationByFileId={...this.activeOperationByFileId,[e]:t}}closeOperation(e){this.activeOperationByFileId={...this.activeOperationByFileId,[e]:void 0}}getFileAttribute(e,t){let n=this.getCurrentFiles().find(t=>t.fileId===e);if(n)return n.attributes?.[t]??void 0}setFileAttribute(e,t,n){let r=this.getCurrentFiles().find(t=>t.fileId===e);if(!r)return;let i={...r.attributes,[t]:n};n===void 0&&delete i[t],this.updateFileItem(e,{attributes:i})}};K([G()],Es.prototype,`activeOperationByFileId`,void 0),K([G()],Es.prototype,`isPreviewModalOpen`,void 0),K([G()],Es.prototype,`previewCurrentIndex`,void 0),K([G()],Es.prototype,`failedImageFileIds`,void 0),Es=K([U(`pkt-fileupload`)],Es);var Ds={i18n:{nb:{contentPresentation:{title:`Oslo kommune bruker informasjonskapsler`,description:[`For at nettstedet skal fungere og være trygt, bruker Oslo kommune informasjonskapsler. Noen er teknisk nødvendige, mens andre sikrer ulik funksjonalitet.`,`Godtar du alle informasjonskapsler, tillater du også at vi samler inn data om statistikk og brukeradferd. Da hjelper du oss med å lage et bedre nettsted uten at du trenger å dele noe personlig informasjon med oss.`],buttons:{accept:`Godta alle`,reject:`Kun nødvendige`,settings:`Innstillinger for informasjonskapsler`}},contentSettings:{title:`Innstillinger for informasjonskapsler`,description:[`Her kan du velge hvilke typer informasjonskapsler du vil tillate. Tillatelsen gjelder i 90 dager. Husk at nødvendige informasjonskapsler ikke kan velges bort.`,`Du kan når som helst endre innstillingene og finne mer informasjon nederst på nettstedet under «Innstillinger for informasjonskapsler» og «Personvern og informasjonskapsler».`],buttons:{back:`Tilbake`,save:`Lagre innstillinger`}}},en:{contentPresentation:{title:`Before you visit Oslo kommune ...`,description:[`This website uses cookies to make improvements. In this context, we need your consent to measure the traffic on the website in relation to statistics and feedback.`,`To read more about what we use cookies for, go to our privacy declaration which you will find at the bottom of our websites.`],buttons:{accept:`Yes, I accept`,reject:`Only necessary`,settings:`Go to settings`}},contentSettings:{title:`Her kan du aktivt velge mellom ulike informasjonskapsler`,description:[`For å lese mer om hva vi bruker informasjonskapsler til gå til vår personvernserklering som du finner på våre nettsider`],buttons:{back:`Back`,save:`Save settings`}}}},cookies:[{name:`statistics`,defaultValue:null,i18n:{nb:{title:`Statistikk og analyse`,description:`Jeg godtar at Oslo kommune bruker informasjonskapsler til å innhente data om statistikk og brukeradferd.`,buttons:{yes:`Ja`,no:`Nei`}},en:{title:`Statistics and analytics`,description:`Select your preference for statistics and analytics`,buttons:{yes:`Yes`,no:`No`}}}},{name:`survey`,defaultValue:null,i18n:{nb:{title:`Skriftlige tilbakemeldinger`,description:`Jeg godtar at Oslo kommune bruker informasjonskapsler til å vise responsfelt og registrere tilbakemeldinger.`,buttons:{yes:`Ja`,no:`Nei`}},en:{title:`Survey`,description:`Select your preference for survey`,buttons:{yes:`Yes`,no:`No`}}}},{name:`functional`,defaultValue:!0,i18n:{nb:{title:`Funksjonelle informasjonskapsler`,description:`Jeg godtar at Oslo kommune bruker informasjonskapsler for å gjøre ulike funksjoner på nettstedet mulige (for eksempel skjemaer og barnehagevelger).`,buttons:{yes:`Ja`,no:`Nei`}},en:{title:`Functional cookies`,description:`For the website to function optimally, we recommend that you accept these cookies`,buttons:{yes:`Yes`,no:`No`}}}}]},Os=null;function ks(){return Os||(Os=new Promise((e,t)=>{if(document.querySelector(`#oslo-consent-script`)){e();return}let n=document.createElement(`script`);n.src=`https://cdn.web.oslo.kommune.no/cb/cb-v1.1.0.js`,n.id=`oslo-consent-script`,n.onload=()=>e(),n.onerror=t,document.head.appendChild(n);let r=document.createElement(`link`);r.href=`https://cdn.web.oslo.kommune.no/cb/cb-v1.1.0.css`,r.type=`text/css`,r.rel=`stylesheet`,r.id=`oslo-consent-styles`,document.head.appendChild(r)}),Os)}var As=class extends Ye{constructor(){super(),this.devMode=!1,this.hotjarId=null,this.googleAnalyticsId=null,this.cookieDomain=null,this.cookieSecure=null,this.cookieExpiryDays=null,this.triggerType=`button`,this.triggerText=null,this.i18nLanguage=`nb`}connectedCallback(){super.connectedCallback(),this.triggerText=this.triggerText||Ds.i18n[this.i18nLanguage].contentPresentation.buttons.settings}disconnectedCallback(){super.disconnectedCallback(),this._cookieEventHandler&&window.__cookieEvents?.off(`CookieManager.setCookie`,this._cookieEventHandler)}returnJsonOrObject(e){let t;try{t=JSON.parse(e)}catch{t=e}return t}emitCookieConsents(e){let t=this.returnJsonOrObject(e.value).items.reduce((e,t)=>(e[t.name]=t.consent,e),{});this.dispatchEvent(new CustomEvent(`toggle-consent`,{detail:t,bubbles:!0,cancelable:!1}))}async firstUpdated(e){window.cookieBanner_googleAnalyticsId=this.googleAnalyticsId,window.cookieBanner_hotjarId=this.hotjarId,this.cookieDomain&&(window.cookieBanner_cookieDomain=this.cookieDomain),this.cookieSecure&&(window.cookieBanner_cookieSecure=this.cookieSecure),this.cookieExpiryDays&&(window.cookieBanner_cookieExpiryDays=this.cookieExpiryDays),this.devMode&&(window.cookieBanner_devMode=this.devMode),await ks(),this.triggerInit()}triggerInit(){window.document.dispatchEvent(new Event(`CookieBannerReady`,{bubbles:!0,cancelable:!0})),window.cookieBanner.cookieConsent.validateConsentCookie().then(e=>{if(e){let e={value:window.cookieBanner.cookieConsent.getConsentCookie()};window.setTimeout(()=>this.emitCookieConsents(e),0),this._cookieEventHandler&&window.__cookieEvents.off(`CookieManager.setCookie`,this._cookieEventHandler),this._cookieEventHandler=e=>{this.emitCookieConsents(e)},window.__cookieEvents.on(`CookieManager.setCookie`,this._cookieEventHandler)}})}openModal(e){e.preventDefault(),window.cookieBanner?.cookieConsent||this.triggerInit(),setTimeout(()=>window.cookieBanner.openCookieModal())}render(){return this.triggerType===`link`?j`<a href="#" class="pkt-link" @click=${this.openModal}>${this.triggerText}</a>`:this.triggerType===`footerlink`?j`<a href="#" class="pkt-footer__link" @click=${this.openModal}>
1933
1933
  <pkt-icon name="chevron-right" class="pkt-footer__link-icon"></pkt-icon>
1934
1934
  ${this.triggerText}
1935
1935
  </a>`:this.triggerType===`icon`?j`<pkt-button
@@ -1939,7 +1939,7 @@
1939
1939
  @click=${this.openModal}
1940
1940
  >
1941
1941
  >${this.triggerText}</pkt-button
1942
- >`:j`<pkt-button @click=${this.openModal}>${this.triggerText}</pkt-button>`}};K([W({type:Boolean})],Cs.prototype,`devMode`,void 0),K([W({type:String})],Cs.prototype,`hotjarId`,void 0),K([W({type:String})],Cs.prototype,`googleAnalyticsId`,void 0),K([W({type:String})],Cs.prototype,`cookieDomain`,void 0),K([W({type:String})],Cs.prototype,`cookieSecure`,void 0),K([W({type:String})],Cs.prototype,`cookieExpiryDays`,void 0),K([W({type:String})],Cs.prototype,`triggerType`,void 0),K([W({type:String})],Cs.prototype,`triggerText`,void 0),K([W({type:String})],Cs.prototype,`i18nLanguage`,void 0);try{U(`pkt-consent`)(Cs)}catch{console.warn(`Forsøker å definere <pkt-consent>, men den er allerede definert`)}var ws=class extends Z{constructor(...e){super(...e),this.inputRef=Y(),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(){let e=q({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),t=q({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError}),n=q({"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}),r=`pkt-tag pkt-tag--small pkt-tag--thin-text`,i=()=>j`
1942
+ >`:j`<pkt-button @click=${this.openModal}>${this.triggerText}</pkt-button>`}};K([W({type:Boolean})],As.prototype,`devMode`,void 0),K([W({type:String})],As.prototype,`hotjarId`,void 0),K([W({type:String})],As.prototype,`googleAnalyticsId`,void 0),K([W({type:String})],As.prototype,`cookieDomain`,void 0),K([W({type:String})],As.prototype,`cookieSecure`,void 0),K([W({type:String})],As.prototype,`cookieExpiryDays`,void 0),K([W({type:String})],As.prototype,`triggerType`,void 0),K([W({type:String})],As.prototype,`triggerText`,void 0),K([W({type:String})],As.prototype,`i18nLanguage`,void 0);try{U(`pkt-consent`)(As)}catch{console.warn(`Forsøker å definere <pkt-consent>, men den er allerede definert`)}var js=class extends Z{constructor(...e){super(...e),this.inputRef=Y(),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(){let e=q({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),t=q({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError}),n=q({"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}),r=`pkt-tag pkt-tag--small pkt-tag--thin-text`,i=()=>j`
1943
1943
  ${this.tagText?j`<span class=${r+` pkt-tag--gray`}>${this.tagText}</span>`:N}
1944
1944
  ${this.optionalTag?j`<span class=${r+` pkt-tag--blue-light`}>${this.optionalText}</span>`:N}
1945
1945
  ${this.requiredTag?j`<span class=${r+` pkt-tag--beige`}>${this.requiredText}</span>`:N}
@@ -1969,7 +1969,7 @@
1969
1969
  ${this.labelPosition===`right`?a():N}
1970
1970
  </div>
1971
1971
  </div>
1972
- `}handleClick(e){if(this.disabled)return e.preventDefault(),e.stopImmediatePropagation(),!1}handleChange(e){if(this.disabled)return e.preventDefault(),e.stopImmediatePropagation(),!1;this.toggleChecked(e)}toggleChecked(e){if(this.disabled){e.preventDefault(),e.stopImmediatePropagation();return}let t=e.target;if(t&&t.disabled){e.preventDefault(),e.stopImmediatePropagation();return}e.stopImmediatePropagation(),this.touched=!0,this.inputRef.value&&(this.checked=this.inputRef.value.matches(`:checked`),this.valueChecked(this.checked))}};K([W({type:String,reflect:!0})],ws.prototype,`value`,void 0),K([W({type:String})],ws.prototype,`checkHelptext`,void 0),K([W({type:Boolean})],ws.prototype,`defaultChecked`,void 0),K([W({type:Boolean})],ws.prototype,`hasTile`,void 0),K([W({type:Boolean})],ws.prototype,`isSwitch`,void 0),K([W({type:String})],ws.prototype,`labelPosition`,void 0),K([W({type:Boolean})],ws.prototype,`hideLabel`,void 0),K([W({type:Boolean,reflect:!0})],ws.prototype,`checked`,void 0),K([W({type:Boolean,reflect:!0})],ws.prototype,`indeterminate`,void 0),K([W({type:String,reflect:!0})],ws.prototype,`type`,void 0),K([W({type:String})],ws.prototype,`tagText`,void 0),K([W({type:Boolean})],ws.prototype,`optionalTag`,void 0),K([W({type:String})],ws.prototype,`optionalText`,void 0),K([W({type:Boolean})],ws.prototype,`requiredTag`,void 0),K([W({type:String})],ws.prototype,`requiredText`,void 0);try{U(`pkt-checkbox`)(ws)}catch{console.warn(`Forsøker å definere <pkt-checkbox>, men den er allerede definert`)}var Ts=class extends Dt{constructor(...e){super(...e),this.title=``,this.href=`#`,this.iconName=``,this.external=!1,this.openInNewTab=!1,this.skin=`normal`}render(){let 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 j`
1972
+ `}handleClick(e){if(this.disabled)return e.preventDefault(),e.stopImmediatePropagation(),!1}handleChange(e){if(this.disabled)return e.preventDefault(),e.stopImmediatePropagation(),!1;this.toggleChecked(e)}toggleChecked(e){if(this.disabled){e.preventDefault(),e.stopImmediatePropagation();return}let t=e.target;if(t&&t.disabled){e.preventDefault(),e.stopImmediatePropagation();return}e.stopImmediatePropagation(),this.touched=!0,this.inputRef.value&&(this.checked=this.inputRef.value.matches(`:checked`),this.valueChecked(this.checked))}};K([W({type:String,reflect:!0})],js.prototype,`value`,void 0),K([W({type:String})],js.prototype,`checkHelptext`,void 0),K([W({type:Boolean})],js.prototype,`defaultChecked`,void 0),K([W({type:Boolean})],js.prototype,`hasTile`,void 0),K([W({type:Boolean})],js.prototype,`isSwitch`,void 0),K([W({type:String})],js.prototype,`labelPosition`,void 0),K([W({type:Boolean})],js.prototype,`hideLabel`,void 0),K([W({type:Boolean,reflect:!0})],js.prototype,`checked`,void 0),K([W({type:Boolean,reflect:!0})],js.prototype,`indeterminate`,void 0),K([W({type:String,reflect:!0})],js.prototype,`type`,void 0),K([W({type:String})],js.prototype,`tagText`,void 0),K([W({type:Boolean})],js.prototype,`optionalTag`,void 0),K([W({type:String})],js.prototype,`optionalText`,void 0),K([W({type:Boolean})],js.prototype,`requiredTag`,void 0),K([W({type:String})],js.prototype,`requiredText`,void 0);try{U(`pkt-checkbox`)(js)}catch{console.warn(`Forsøker å definere <pkt-checkbox>, men den er allerede definert`)}var Ms=class extends Dt{constructor(...e){super(...e),this.title=``,this.href=`#`,this.iconName=``,this.external=!1,this.openInNewTab=!1,this.skin=`normal`}render(){let 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 j`
1973
1973
  <a
1974
1974
  href=${this.href}
1975
1975
  class=${e}
@@ -1981,7 +1981,7 @@
1981
1981
 
1982
1982
  <div class="pkt-linkcard__text">${Et(this)}</div>
1983
1983
  </a>
1984
- `}};K([W({type:String,reflect:!0})],Ts.prototype,`title`,void 0),K([W({type:String,reflect:!0})],Ts.prototype,`href`,void 0),K([W({type:String,reflect:!0})],Ts.prototype,`iconName`,void 0),K([W({type:Boolean,reflect:!0})],Ts.prototype,`external`,void 0),K([W({type:Boolean,reflect:!0})],Ts.prototype,`openInNewTab`,void 0),K([W({type:String,reflect:!0})],Ts.prototype,`skin`,void 0);try{U(`pkt-linkcard`)(Ts)}catch{console.warn(`Forsøker å definere <pkt-linkcard>, men den er allerede definert`)}window.pktAnimationPath=window.pktAnimationPath||`https://punkt-cdn.oslo.kommune.no/16.17/animations/`;var Es=class extends Dt{constructor(...e){super(...e),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}connectedCallback(){super.connectedCallback(),this._shouldDisplayLoader=this.delay===0,this.delay>0&&this.setupLoader()}updated(e){e.has(`delay`)&&this.setupLoader()}render(){let e=q({"pkt-loader":!0,[`pkt-loader--${this.inline?`inline`:`box`}`]:!0,[`pkt-loader--${this.size}`]:!0}),t=q({"pkt-contents":!0,"pkt-hide":this.isLoading});return j`<div
1984
+ `}};K([W({type:String,reflect:!0})],Ms.prototype,`title`,void 0),K([W({type:String,reflect:!0})],Ms.prototype,`href`,void 0),K([W({type:String,reflect:!0})],Ms.prototype,`iconName`,void 0),K([W({type:Boolean,reflect:!0})],Ms.prototype,`external`,void 0),K([W({type:Boolean,reflect:!0})],Ms.prototype,`openInNewTab`,void 0),K([W({type:String,reflect:!0})],Ms.prototype,`skin`,void 0);try{U(`pkt-linkcard`)(Ms)}catch{console.warn(`Forsøker å definere <pkt-linkcard>, men den er allerede definert`)}window.pktAnimationPath=window.pktAnimationPath||`https://punkt-cdn.oslo.kommune.no/16.17/animations/`;var Ns=class extends Dt{constructor(...e){super(...e),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}connectedCallback(){super.connectedCallback(),this._shouldDisplayLoader=this.delay===0,this.delay>0&&this.setupLoader()}updated(e){e.has(`delay`)&&this.setupLoader()}render(){let e=q({"pkt-loader":!0,[`pkt-loader--${this.inline?`inline`:`box`}`]:!0,[`pkt-loader--${this.size}`]:!0}),t=q({"pkt-contents":!0,"pkt-hide":this.isLoading});return j`<div
1985
1985
  role="status"
1986
1986
  aria-live="polite"
1987
1987
  aria-busy=${this.isLoading?`true`:`false`}
@@ -1996,7 +1996,7 @@
1996
1996
  ${this.message&&j`<p>${this.message}</p>`}
1997
1997
  </div>`:N}
1998
1998
  <div class=${t}>${Et(this)}</div>
1999
- </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))}};K([W({type:Number})],Es.prototype,`delay`,void 0),K([W({type:Boolean})],Es.prototype,`inline`,void 0),K([W({type:Boolean})],Es.prototype,`isLoading`,void 0),K([W({type:String})],Es.prototype,`message`,void 0),K([W({type:String})],Es.prototype,`size`,void 0),K([W({type:String})],Es.prototype,`variant`,void 0),K([W({type:String})],Es.prototype,`loadingAnimationPath`,void 0),K([G()],Es.prototype,`_shouldDisplayLoader`,void 0);try{U(`pkt-loader`)(Es)}catch{console.warn(`Forsøker å definere <pkt-loader>, men den er allerede definert`)}var Ds={name:`pkt-messagebox`,react:`PktMessagebox`,"css-class":`pkt-messagebox`,isElement:!0,isPureReact:!0,events:{onClose:{description:`React: Event som trigges når meldingsboksen lukkes`},"on-close":{description:`Vue: Event som trigges når meldingsboksen lukkes`}},props:{title:{name:`Tittel`,description:`Tittelen på meldingsboksen`,type:`string`,category:`contents`},skin:{name:`Utseende`,description:`Velg farge på meldingsboksen`,type:[`beige`,`blue`,`red`,`green`],category:`ui`,default:`beige`},compact:{name:`Kompakt`,description:`Gjør meldingsboksen mindre`,type:`boolean`,category:`ui`,default:!1},closable:{name:`Kan lukkes`,description:`Viser lukkeknapp`,type:`boolean`,category:`ui`,default:!1}},slots:{default:{description:`Innholdet i meldingsboksen`}}},Os=class extends Dt{constructor(){super(),this.closable=Ds.props.closable.default,this.compact=Ds.props.compact.default,this.title=``,this.skin=Ds.props.skin.default,this._isClosed=!1,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent(`close`,{detail:{origin:e},bubbles:!0})),this.dispatchEvent(new CustomEvent(`on-close`,{detail:{origin:e},bubbles:!0}))},this._isClosed=!1}updated(e){super.updated(e),e.has(`_isClosed`)&&Ot(this,`pkt-hide`,this._isClosed)}render(){return j`<div class=${q({"pkt-messagebox":!0,"pkt-messagebox--compact":this.compact,[`pkt-messagebox--${this.skin}`]:this.skin,"pkt-messagebox--closable":this.closable,"pkt-hide":this._isClosed})}>
1999
+ </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))}};K([W({type:Number})],Ns.prototype,`delay`,void 0),K([W({type:Boolean})],Ns.prototype,`inline`,void 0),K([W({type:Boolean})],Ns.prototype,`isLoading`,void 0),K([W({type:String})],Ns.prototype,`message`,void 0),K([W({type:String})],Ns.prototype,`size`,void 0),K([W({type:String})],Ns.prototype,`variant`,void 0),K([W({type:String})],Ns.prototype,`loadingAnimationPath`,void 0),K([G()],Ns.prototype,`_shouldDisplayLoader`,void 0);try{U(`pkt-loader`)(Ns)}catch{console.warn(`Forsøker å definere <pkt-loader>, men den er allerede definert`)}var Ps={name:`pkt-messagebox`,react:`PktMessagebox`,"css-class":`pkt-messagebox`,isElement:!0,isPureReact:!0,events:{onClose:{description:`React: Event som trigges når meldingsboksen lukkes`},"on-close":{description:`Vue: Event som trigges når meldingsboksen lukkes`}},props:{title:{name:`Tittel`,description:`Tittelen på meldingsboksen`,type:`string`,category:`contents`},skin:{name:`Utseende`,description:`Velg farge på meldingsboksen`,type:[`beige`,`blue`,`red`,`green`],category:`ui`,default:`beige`},compact:{name:`Kompakt`,description:`Gjør meldingsboksen mindre`,type:`boolean`,category:`ui`,default:!1},closable:{name:`Kan lukkes`,description:`Viser lukkeknapp`,type:`boolean`,category:`ui`,default:!1}},slots:{default:{description:`Innholdet i meldingsboksen`}}},Fs=class extends Dt{constructor(){super(),this.closable=Ps.props.closable.default,this.compact=Ps.props.compact.default,this.title=``,this.skin=Ps.props.skin.default,this._isClosed=!1,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent(`close`,{detail:{origin:e},bubbles:!0})),this.dispatchEvent(new CustomEvent(`on-close`,{detail:{origin:e},bubbles:!0}))},this._isClosed=!1}updated(e){super.updated(e),e.has(`_isClosed`)&&Ot(this,`pkt-hide`,this._isClosed)}render(){return j`<div class=${q({"pkt-messagebox":!0,"pkt-messagebox--compact":this.compact,[`pkt-messagebox--${this.skin}`]:this.skin,"pkt-messagebox--closable":this.closable,"pkt-hide":this._isClosed})}>
2000
2000
  ${this.closable?j`<div class="pkt-messagebox__close">
2001
2001
  <button
2002
2002
  @click=${this.close}
@@ -2008,7 +2008,7 @@
2008
2008
  </div>`:N}
2009
2009
  ${this.title?j`<div class="pkt-messagebox__title">${this.title}</div>`:N}
2010
2010
  <div class="pkt-messagebox__text">${Et(this)}</div>
2011
- </div>`}};K([W({type:Boolean,reflect:!0})],Os.prototype,`closable`,void 0),K([W({type:Boolean,reflect:!0})],Os.prototype,`compact`,void 0),K([W({type:String,reflect:!0})],Os.prototype,`title`,void 0),K([W({type:String,reflect:!0})],Os.prototype,`skin`,void 0),K([G()],Os.prototype,`_isClosed`,void 0);try{U(`pkt-messagebox`)(Os)}catch{console.warn(`Forsøker å definere <pkt-messagebox>, men den er allerede definert`)}var ks=class extends Z{constructor(...e){super(...e),this.inputRef=Y(),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(e,t,n){e===`defaultChecked`&&(this._checked=this.defaultChecked),e===`checked`&&(this._checked=this.checked===``||this.checked===`true`||this.checked===!0),super.attributeChangedCallback(e,t,n)}render(){let e=q({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),t=q({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError}),n=q({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--disabled":this.disabled,"pkt-sr-only":this.hideLabel}),r=`pkt-tag pkt-tag--small pkt-tag--thin-text`;return j`
2011
+ </div>`}};K([W({type:Boolean,reflect:!0})],Fs.prototype,`closable`,void 0),K([W({type:Boolean,reflect:!0})],Fs.prototype,`compact`,void 0),K([W({type:String,reflect:!0})],Fs.prototype,`title`,void 0),K([W({type:String,reflect:!0})],Fs.prototype,`skin`,void 0),K([G()],Fs.prototype,`_isClosed`,void 0);try{U(`pkt-messagebox`)(Fs)}catch{console.warn(`Forsøker å definere <pkt-messagebox>, men den er allerede definert`)}var Is=class extends Z{constructor(...e){super(...e),this.inputRef=Y(),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(e,t,n){e===`defaultChecked`&&(this._checked=this.defaultChecked),e===`checked`&&(this._checked=this.checked===``||this.checked===`true`||this.checked===!0),super.attributeChangedCallback(e,t,n)}render(){let e=q({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),t=q({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError}),n=q({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--disabled":this.disabled,"pkt-sr-only":this.hideLabel}),r=`pkt-tag pkt-tag--small pkt-tag--thin-text`;return j`
2012
2012
  <div class="pkt-input-check">
2013
2013
  <div class=${e}>
2014
2014
  <input
@@ -2038,11 +2038,11 @@
2038
2038
  `}
2039
2039
  </div>
2040
2040
  </div>
2041
- `}toggleChecked(e=null){e&&e.preventDefault(),e&&e.stopImmediatePropagation(),this.touched=!0,this.inputRef.value&&(this._checked=this.inputRef.value.matches(`:checked`),this.valueChecked(this._checked))}};K([W({type:String,reflect:!0})],ks.prototype,`value`,void 0),K([W({type:String})],ks.prototype,`checkHelptext`,void 0),K([W({type:Boolean})],ks.prototype,`defaultChecked`,void 0),K([W({type:Boolean})],ks.prototype,`hasTile`,void 0),K([W({type:Boolean,reflect:!0})],ks.prototype,`checked`,void 0),K([W({type:String,reflect:!0})],ks.prototype,`type`,void 0),K([W({type:String})],ks.prototype,`tagText`,void 0),K([W({type:Boolean})],ks.prototype,`optionalTag`,void 0),K([W({type:String})],ks.prototype,`optionalText`,void 0),K([W({type:Boolean})],ks.prototype,`requiredTag`,void 0),K([W({type:String})],ks.prototype,`requiredText`,void 0),K([G()],ks.prototype,`_checked`,void 0);try{U(`pkt-radiobutton`)(ks)}catch{console.warn(`Forsøker å definere <pkt-radiobutton>, men den er allerede definert`)}var As=class extends Event{constructor(e,t,n,r){super(`context-request`,{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t,this.callback=n,this.subscribe=r??!1}};function js(e){return e}var Ms=class{constructor(e,t,n,r){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(e,t)=>{this.unsubscribe&&(this.unsubscribe!==t&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=e,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(e,t)),this.unsubscribe=t},this.host=e,t.context!==void 0){let e=t;this.context=e.context,this.callback=e.callback,this.subscribe=e.subscribe??!1}else this.context=t,this.callback=n,this.subscribe=r??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&=(this.unsubscribe(),void 0)}dispatchRequest(){this.host.dispatchEvent(new As(this.context,this.host,this.t,this.subscribe))}},Ns=class{get value(){return this.o}set value(e){this.setValue(e)}setValue(e,t=!1){let n=t||!Object.is(e,this.o);this.o=e,n&&this.updateObservers()}constructor(e){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:t}]of this.subscriptions)e(this.o,t)},e!==void 0&&(this.value=e)}addCallback(e,t,n){if(!n)return void e(this.value);this.subscriptions.has(e)||this.subscriptions.set(e,{disposer:()=>{this.subscriptions.delete(e)},consumerHost:t});let{disposer:r}=this.subscriptions.get(e);e(this.value,r)}clearCallbacks(){this.subscriptions.clear()}},Ps=class extends Event{constructor(e,t){super(`context-provider`,{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t}},Fs=class extends Ns{constructor(e,t,n){super(t.context===void 0?n:t.initialValue),this.onContextRequest=e=>{if(e.context!==this.context)return;let t=e.contextTarget??e.composedPath()[0];t!==this.host&&(e.stopPropagation(),this.addCallback(e.callback,t,e.subscribe))},this.onProviderRequest=e=>{if(e.context!==this.context||(e.contextTarget??e.composedPath()[0])===this.host)return;let t=new Set;for(let[e,{consumerHost:n}]of this.subscriptions)t.has(e)||(t.add(e),n.dispatchEvent(new As(this.context,n,e,!0)));e.stopPropagation()},this.host=e,t.context===void 0?this.context=t:this.context=t.context,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener(`context-request`,this.onContextRequest),this.host.addEventListener(`context-provider`,this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Ps(this.context,this.host))}};function Is({context:e}){return(t,n)=>{let r=new WeakMap;if(typeof n==`object`)return{get(){return t.get.call(this)},set(e){return r.get(this).setValue(e),t.set.call(this,e)},init(t){return r.set(this,new Fs(this,{context:e,initialValue:t})),t}};{t.constructor.addInitializer((t=>{r.set(t,new Fs(t,{context:e}))}));let i=Object.getOwnPropertyDescriptor(t,n),a;if(i===void 0){let e=new WeakMap;a={get(){return e.get(this)},set(t){r.get(this).setValue(t),e.set(this,t)},configurable:!0,enumerable:!0}}else{let e=i.set;a={...i,set(t){r.get(this).setValue(t),e?.call(this,t)}}}Object.defineProperty(t,n,a);return}}}function Ls({context:e,subscribe:t}){return(n,r)=>{typeof r==`object`?r.addInitializer((function(){new Ms(this,{context:e,callback:e=>{n.set.call(this,e)},subscribe:t})})):n.constructor.addInitializer((n=>{new Ms(n,{context:e,callback:e=>{n[r]=e},subscribe:t})}))}}var Rs=js(Symbol(`pkt-tabs-context`)),zs=class extends Dt{constructor(...e){super(...e),this.arrowNav=!0,this.disableArrowNav=!1,this.separatorIconName=``,this.separatorIconPath=``,this.tabRefs=[],this.disabledMap={},this.tabCount=0,this.context={useArrowNav:this.useArrowNav,registerTab:this.registerTab.bind(this),handleClick:this.handleClick.bind(this),handleKeyUp:this.handleKeyUp.bind(this)}}get useArrowNav(){return this.arrowNav&&!this.disableArrowNav}updated(e){(e.has(`arrowNav`)||e.has(`disableArrowNav`))&&(this.context={...this.context,useArrowNav:this.useArrowNav}),this.updateComplete.then(()=>this.syncSeparators())}syncSeparators(){let e=this.querySelector(`.pkt-tabs__list`);if(!e||(e.querySelectorAll(`.pkt-tabs__separator`).forEach(e=>e.remove()),!(this.separatorIconName||this.separatorIconPath)))return;let t=Array.from(e.children).filter(e=>!e.classList.contains(`pkt-tabs__separator`));for(let e=0;e<t.length-1;e++){let n=document.createElement(`span`);if(n.className=`pkt-tabs__separator`,n.setAttribute(`aria-hidden`,`true`),n.setAttribute(`role`,`presentation`),this.separatorIconPath){let e=document.createElement(`img`);e.setAttribute(`src`,this.separatorIconPath),e.setAttribute(`alt`,``),e.setAttribute(`aria-hidden`,`true`),n.appendChild(e)}else if(this.separatorIconName){let e=document.createElement(`pkt-icon`);e.setAttribute(`name`,this.separatorIconName),e.classList.add(`pkt-tabs__separator-icon`),n.appendChild(e)}t[e].after(n)}}registerTab(e,t,n=!1){this.tabRefs[t]=e,this.disabledMap[t]=n,this.tabCount=Math.max(this.tabCount,t+1)}isTabDisabled(e){return!!this.disabledMap[e]}findEnabledIndex(e,t){let n=e+t;for(;n>=0&&n<this.tabCount;){if(!this.isTabDisabled(n))return n;n+=t}return null}handleClick(e){this.isTabDisabled(e)||this.dispatchEvent(new CustomEvent(`tab-selected`,{detail:{index:e},bubbles:!0,composed:!0}))}handleKeyUp(e,t){if(this.useArrowNav){if(e.key===`ArrowLeft`){e.preventDefault();let n=this.findEnabledIndex(t,-1);n!==null&&this.tabRefs[n]?.focus()}if(e.key===`ArrowRight`){e.preventDefault();let n=this.findEnabledIndex(t,1);n!==null&&this.tabRefs[n]?.focus()}(e.key===`Enter`||e.key===` `||e.key===`Spacebar`||e.key===`ArrowDown`)&&(e.preventDefault(),this.handleClick(t))}}render(){let e=this.useArrowNav?`tablist`:`navigation`;return j`
2041
+ `}toggleChecked(e=null){e&&e.preventDefault(),e&&e.stopImmediatePropagation(),this.touched=!0,this.inputRef.value&&(this._checked=this.inputRef.value.matches(`:checked`),this.valueChecked(this._checked))}};K([W({type:String,reflect:!0})],Is.prototype,`value`,void 0),K([W({type:String})],Is.prototype,`checkHelptext`,void 0),K([W({type:Boolean})],Is.prototype,`defaultChecked`,void 0),K([W({type:Boolean})],Is.prototype,`hasTile`,void 0),K([W({type:Boolean,reflect:!0})],Is.prototype,`checked`,void 0),K([W({type:String,reflect:!0})],Is.prototype,`type`,void 0),K([W({type:String})],Is.prototype,`tagText`,void 0),K([W({type:Boolean})],Is.prototype,`optionalTag`,void 0),K([W({type:String})],Is.prototype,`optionalText`,void 0),K([W({type:Boolean})],Is.prototype,`requiredTag`,void 0),K([W({type:String})],Is.prototype,`requiredText`,void 0),K([G()],Is.prototype,`_checked`,void 0);try{U(`pkt-radiobutton`)(Is)}catch{console.warn(`Forsøker å definere <pkt-radiobutton>, men den er allerede definert`)}var Ls=class extends Event{constructor(e,t,n,r){super(`context-request`,{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t,this.callback=n,this.subscribe=r??!1}};function Rs(e){return e}var zs=class{constructor(e,t,n,r){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(e,t)=>{this.unsubscribe&&(this.unsubscribe!==t&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=e,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(e,t)),this.unsubscribe=t},this.host=e,t.context!==void 0){let e=t;this.context=e.context,this.callback=e.callback,this.subscribe=e.subscribe??!1}else this.context=t,this.callback=n,this.subscribe=r??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&=(this.unsubscribe(),void 0)}dispatchRequest(){this.host.dispatchEvent(new Ls(this.context,this.host,this.t,this.subscribe))}},Bs=class{get value(){return this.o}set value(e){this.setValue(e)}setValue(e,t=!1){let n=t||!Object.is(e,this.o);this.o=e,n&&this.updateObservers()}constructor(e){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:t}]of this.subscriptions)e(this.o,t)},e!==void 0&&(this.value=e)}addCallback(e,t,n){if(!n)return void e(this.value);this.subscriptions.has(e)||this.subscriptions.set(e,{disposer:()=>{this.subscriptions.delete(e)},consumerHost:t});let{disposer:r}=this.subscriptions.get(e);e(this.value,r)}clearCallbacks(){this.subscriptions.clear()}},Vs=class extends Event{constructor(e,t){super(`context-provider`,{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t}},Hs=class extends Bs{constructor(e,t,n){super(t.context===void 0?n:t.initialValue),this.onContextRequest=e=>{if(e.context!==this.context)return;let t=e.contextTarget??e.composedPath()[0];t!==this.host&&(e.stopPropagation(),this.addCallback(e.callback,t,e.subscribe))},this.onProviderRequest=e=>{if(e.context!==this.context||(e.contextTarget??e.composedPath()[0])===this.host)return;let t=new Set;for(let[e,{consumerHost:n}]of this.subscriptions)t.has(e)||(t.add(e),n.dispatchEvent(new Ls(this.context,n,e,!0)));e.stopPropagation()},this.host=e,t.context===void 0?this.context=t:this.context=t.context,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener(`context-request`,this.onContextRequest),this.host.addEventListener(`context-provider`,this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Vs(this.context,this.host))}};function Us({context:e}){return(t,n)=>{let r=new WeakMap;if(typeof n==`object`)return{get(){return t.get.call(this)},set(e){return r.get(this).setValue(e),t.set.call(this,e)},init(t){return r.set(this,new Hs(this,{context:e,initialValue:t})),t}};{t.constructor.addInitializer((t=>{r.set(t,new Hs(t,{context:e}))}));let i=Object.getOwnPropertyDescriptor(t,n),a;if(i===void 0){let e=new WeakMap;a={get(){return e.get(this)},set(t){r.get(this).setValue(t),e.set(this,t)},configurable:!0,enumerable:!0}}else{let e=i.set;a={...i,set(t){r.get(this).setValue(t),e?.call(this,t)}}}Object.defineProperty(t,n,a);return}}}function Ws({context:e,subscribe:t}){return(n,r)=>{typeof r==`object`?r.addInitializer((function(){new zs(this,{context:e,callback:e=>{n.set.call(this,e)},subscribe:t})})):n.constructor.addInitializer((n=>{new zs(n,{context:e,callback:e=>{n[r]=e},subscribe:t})}))}}var Gs=Rs(Symbol(`pkt-tabs-context`)),Ks=class extends Dt{constructor(...e){super(...e),this.arrowNav=!0,this.disableArrowNav=!1,this.separatorIconName=``,this.separatorIconPath=``,this.tabRefs=[],this.disabledMap={},this.tabCount=0,this.context={useArrowNav:this.useArrowNav,registerTab:this.registerTab.bind(this),handleClick:this.handleClick.bind(this),handleKeyUp:this.handleKeyUp.bind(this)}}get useArrowNav(){return this.arrowNav&&!this.disableArrowNav}updated(e){(e.has(`arrowNav`)||e.has(`disableArrowNav`))&&(this.context={...this.context,useArrowNav:this.useArrowNav}),this.updateComplete.then(()=>this.syncSeparators())}syncSeparators(){let e=this.querySelector(`.pkt-tabs__list`);if(!e||(e.querySelectorAll(`.pkt-tabs__separator`).forEach(e=>e.remove()),!(this.separatorIconName||this.separatorIconPath)))return;let t=Array.from(e.children).filter(e=>!e.classList.contains(`pkt-tabs__separator`));for(let e=0;e<t.length-1;e++){let n=document.createElement(`span`);if(n.className=`pkt-tabs__separator`,n.setAttribute(`aria-hidden`,`true`),n.setAttribute(`role`,`presentation`),this.separatorIconPath){let e=document.createElement(`img`);e.setAttribute(`src`,this.separatorIconPath),e.setAttribute(`alt`,``),e.setAttribute(`aria-hidden`,`true`),n.appendChild(e)}else if(this.separatorIconName){let e=document.createElement(`pkt-icon`);e.setAttribute(`name`,this.separatorIconName),e.classList.add(`pkt-tabs__separator-icon`),n.appendChild(e)}t[e].after(n)}}registerTab(e,t,n=!1){this.tabRefs[t]=e,this.disabledMap[t]=n,this.tabCount=Math.max(this.tabCount,t+1)}isTabDisabled(e){return!!this.disabledMap[e]}findEnabledIndex(e,t){let n=e+t;for(;n>=0&&n<this.tabCount;){if(!this.isTabDisabled(n))return n;n+=t}return null}handleClick(e){this.isTabDisabled(e)||this.dispatchEvent(new CustomEvent(`tab-selected`,{detail:{index:e},bubbles:!0,composed:!0}))}handleKeyUp(e,t){if(this.useArrowNav){if(e.key===`ArrowLeft`){e.preventDefault();let n=this.findEnabledIndex(t,-1);n!==null&&this.tabRefs[n]?.focus()}if(e.key===`ArrowRight`){e.preventDefault();let n=this.findEnabledIndex(t,1);n!==null&&this.tabRefs[n]?.focus()}(e.key===`Enter`||e.key===` `||e.key===`Spacebar`||e.key===`ArrowDown`)&&(e.preventDefault(),this.handleClick(t))}}render(){let e=this.useArrowNav?`tablist`:`navigation`;return j`
2042
2042
  <div class=${this.separatorIconName||this.separatorIconPath?`pkt-tabs pkt-tabs--with-separator`:`pkt-tabs`}>
2043
2043
  <div class="pkt-tabs__list" role=${e}>${Et(this)}</div>
2044
2044
  </div>
2045
- `}};K([W({type:Boolean,reflect:!0,attribute:`arrow-nav`})],zs.prototype,`arrowNav`,void 0),K([W({type:Boolean,reflect:!0,attribute:`disable-arrow-nav`})],zs.prototype,`disableArrowNav`,void 0),K([W({type:String,reflect:!0,attribute:`separator-icon-name`})],zs.prototype,`separatorIconName`,void 0),K([W({type:String,reflect:!0,attribute:`separator-icon-path`})],zs.prototype,`separatorIconPath`,void 0),K([G()],zs.prototype,`tabRefs`,void 0),K([G()],zs.prototype,`disabledMap`,void 0),K([G()],zs.prototype,`tabCount`,void 0),K([Is({context:Rs}),G()],zs.prototype,`context`,void 0);try{U(`pkt-tabs`)(zs)}catch{console.warn(`Forsøker å definere <pkt-tabs>, men den er allerede definert`)}var Bs=class extends Dt{constructor(){super(),this.active=!1,this.disabled=!1,this.href=``,this.icon=``,this.controls=``,this.tag=``,this.tagSkin=`blue`,this.index=0,this.elementRef=Y()}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.elementRef.value&&this.context&&this.context.registerTab(this.elementRef.value,this.index,this.disabled)})}updated(){this.elementRef.value&&this.context&&this.context.registerTab(this.elementRef.value,this.index,this.disabled)}handleClick(e){if(this.disabled){e.preventDefault(),e.stopPropagation();return}this.context&&this.context.handleClick(this.index)}handleKeyDown(e){if(this.disabled&&(e.key===`Enter`||e.key===` `||e.key===`Spacebar`)){e.preventDefault(),e.stopPropagation();return}this.context&&this.context.handleKeyUp(e,this.index)}render(){let e=this.context?.useArrowNav??!0,t=this.active&&!this.disabled,n=[t?`active`:``,this.disabled?`pkt-tabs__item--disabled`:``].filter(Boolean).join(` `),r=e?`tab`:void 0,i=e?t:void 0,a=this.disabled?-1:t||!e?void 0:-1,o=`pkt-icon--small ${this.icon===`check`?`pkt-tabs__status-icon`:``}`,s=j`
2045
+ `}};K([W({type:Boolean,reflect:!0,attribute:`arrow-nav`})],Ks.prototype,`arrowNav`,void 0),K([W({type:Boolean,reflect:!0,attribute:`disable-arrow-nav`})],Ks.prototype,`disableArrowNav`,void 0),K([W({type:String,reflect:!0,attribute:`separator-icon-name`})],Ks.prototype,`separatorIconName`,void 0),K([W({type:String,reflect:!0,attribute:`separator-icon-path`})],Ks.prototype,`separatorIconPath`,void 0),K([G()],Ks.prototype,`tabRefs`,void 0),K([G()],Ks.prototype,`disabledMap`,void 0),K([G()],Ks.prototype,`tabCount`,void 0),K([Us({context:Gs}),G()],Ks.prototype,`context`,void 0);try{U(`pkt-tabs`)(Ks)}catch{console.warn(`Forsøker å definere <pkt-tabs>, men den er allerede definert`)}var qs=class extends Dt{constructor(){super(),this.active=!1,this.disabled=!1,this.href=``,this.icon=``,this.controls=``,this.tag=``,this.tagSkin=`blue`,this.index=0,this.elementRef=Y()}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.elementRef.value&&this.context&&this.context.registerTab(this.elementRef.value,this.index,this.disabled)})}updated(){this.elementRef.value&&this.context&&this.context.registerTab(this.elementRef.value,this.index,this.disabled)}handleClick(e){if(this.disabled){e.preventDefault(),e.stopPropagation();return}this.context&&this.context.handleClick(this.index)}handleKeyDown(e){if(this.disabled&&(e.key===`Enter`||e.key===` `||e.key===`Spacebar`)){e.preventDefault(),e.stopPropagation();return}this.context&&this.context.handleKeyUp(e,this.index)}render(){let e=this.context?.useArrowNav??!0,t=this.active&&!this.disabled,n=[t?`active`:``,this.disabled?`pkt-tabs__item--disabled`:``].filter(Boolean).join(` `),r=e?`tab`:void 0,i=e?t:void 0,a=this.disabled?-1:t||!e?void 0:-1,o=`pkt-icon--small ${this.icon===`check`?`pkt-tabs__status-icon`:``}`,s=j`
2046
2046
  ${this.icon?j`<pkt-icon name=${this.icon} class=${o}></pkt-icon>`:``}
2047
2047
  <span>${Et(this)}</span>
2048
2048
  ${this.tag?j`<pkt-tag skin=${this.tagSkin} size="small">${this.tag}</pkt-tag>`:``}
@@ -2077,7 +2077,7 @@
2077
2077
  >
2078
2078
  ${s}
2079
2079
  </button>
2080
- `}};K([W({type:Boolean,reflect:!0})],Bs.prototype,`active`,void 0),K([W({type:Boolean,reflect:!0})],Bs.prototype,`disabled`,void 0),K([W({type:String,reflect:!0})],Bs.prototype,`href`,void 0),K([W({type:String,reflect:!0})],Bs.prototype,`icon`,void 0),K([W({type:String,reflect:!0})],Bs.prototype,`controls`,void 0),K([W({type:String,reflect:!0})],Bs.prototype,`tag`,void 0),K([W({type:String,reflect:!0,attribute:`tag-skin`})],Bs.prototype,`tagSkin`,void 0),K([W({type:Number,reflect:!0})],Bs.prototype,`index`,void 0),K([Ls({context:Rs,subscribe:!0}),W({attribute:!1})],Bs.prototype,`context`,void 0);try{U(`pkt-tab-item`)(Bs)}catch{console.warn(`Forsøker å definere <pkt-tab-item>, men den er allerede definert`)}var Vs=Ze(class extends Qe{constructor(e){if(super(e),e.type!==Xe.PROPERTY&&e.type!==Xe.ATTRIBUTE&&e.type!==Xe.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!tt(e))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(e,[t]){if(t===M||t===N)return t;let n=e.element,r=e.name;if(e.type===Xe.PROPERTY){if(t===n[r])return M}else if(e.type===Xe.BOOLEAN_ATTRIBUTE){if(!!t===n.hasAttribute(r))return M}else if(e.type===Xe.ATTRIBUTE&&n.getAttribute(r)===t+``)return M;return ot(e),t}}),Hs=class extends Z{constructor(...e){super(...e),this.inputRef=Y(),this.value=``,this.autocomplete=`off`,this.rows=null,this.counterCurrent=0}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){super.updated(e),e.has(`value`)&&(this.counterCurrent=this.value?.length||0,this.valueChanged(this.value,e.get(`value`))),e.has(`id`)&&!this.name&&this.id&&(this.name=this.id)}render(){let e=q({"pkt-input":!0,"pkt-input--fullwidth":this.fullwidth,"pkt-input--counter-error":this.counter&&this.counterMaxLength&&this.value.length&&this.value.length>this.counterMaxLength}),t=this.ariaLabelledby||`${this.id}-input-label`;return j`<pkt-input-wrapper
2080
+ `}};K([W({type:Boolean,reflect:!0})],qs.prototype,`active`,void 0),K([W({type:Boolean,reflect:!0})],qs.prototype,`disabled`,void 0),K([W({type:String,reflect:!0})],qs.prototype,`href`,void 0),K([W({type:String,reflect:!0})],qs.prototype,`icon`,void 0),K([W({type:String,reflect:!0})],qs.prototype,`controls`,void 0),K([W({type:String,reflect:!0})],qs.prototype,`tag`,void 0),K([W({type:String,reflect:!0,attribute:`tag-skin`})],qs.prototype,`tagSkin`,void 0),K([W({type:Number,reflect:!0})],qs.prototype,`index`,void 0),K([Ws({context:Gs,subscribe:!0}),W({attribute:!1})],qs.prototype,`context`,void 0);try{U(`pkt-tab-item`)(qs)}catch{console.warn(`Forsøker å definere <pkt-tab-item>, men den er allerede definert`)}var Js=Ze(class extends Qe{constructor(e){if(super(e),e.type!==Xe.PROPERTY&&e.type!==Xe.ATTRIBUTE&&e.type!==Xe.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!tt(e))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(e,[t]){if(t===M||t===N)return t;let n=e.element,r=e.name;if(e.type===Xe.PROPERTY){if(t===n[r])return M}else if(e.type===Xe.BOOLEAN_ATTRIBUTE){if(!!t===n.hasAttribute(r))return M}else if(e.type===Xe.ATTRIBUTE&&n.getAttribute(r)===t+``)return M;return ot(e),t}}),Ys=class extends Z{constructor(...e){super(...e),this.inputRef=Y(),this.value=``,this.autocomplete=`off`,this.rows=null,this.counterCurrent=0}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){super.updated(e),e.has(`value`)&&(this.counterCurrent=this.value?.length||0,this.valueChanged(this.value,e.get(`value`))),e.has(`id`)&&!this.name&&this.id&&(this.name=this.id)}render(){let e=q({"pkt-input":!0,"pkt-input--fullwidth":this.fullwidth,"pkt-input--counter-error":this.counter&&this.counterMaxLength&&this.value.length&&this.value.length>this.counterMaxLength}),t=this.ariaLabelledby||`${this.id}-input-label`;return j`<pkt-input-wrapper
2081
2081
  label=${this.label}
2082
2082
  ?counter=${this.counter}
2083
2083
  ?disabled=${this.disabled}
@@ -2107,7 +2107,7 @@
2107
2107
  id=${this.id+`-input`}
2108
2108
  name=${(this.name||this.id)+`-input`}
2109
2109
  placeholder=${J(this.placeholder)}
2110
- .value=${Vs(this.value)}
2110
+ .value=${Js(this.value)}
2111
2111
  minlength=${J(this.minlength)}
2112
2112
  maxlength=${J(this.maxlength)}
2113
2113
  ?readonly=${this.readonly}
@@ -2122,7 +2122,7 @@
2122
2122
  @focus=${e=>{this.onFocus(),e.stopImmediatePropagation()}}
2123
2123
  @blur=${e=>{this.value=e.target.value,this.onBlur(),e.stopImmediatePropagation()}}
2124
2124
  ></textarea>
2125
- </pkt-input-wrapper>`}};K([W({type:String,reflect:!0})],Hs.prototype,`value`,void 0),K([W({type:String})],Hs.prototype,`autocomplete`,void 0),K([W({type:Number})],Hs.prototype,`rows`,void 0),K([G()],Hs.prototype,`counterCurrent`,void 0);try{U(`pkt-textarea`)(Hs)}catch{console.warn(`Forsøker å definere <pkt-textarea>, men den er allerede definert`)}var Us=class extends Z{constructor(...e){super(...e),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(){let e=this._optionsProp.length>0,t=this.optionsController?.nodes?.length&&this.optionsController.nodes.length>0;e?this._options=this._optionsProp:t&&(this._options=this.optionsController.options)}willUpdate(e){super.willUpdate(e),this.parseOptions()}};K([W({type:Array,attribute:`options`})],Us.prototype,`_optionsProp`,void 0),K([G()],Us.prototype,`_options`,void 0);var Ws=class extends Us{constructor(){super(),this.inputRef=Y(),this.value=``,this.selectedIndex=-1,this.selectedOptions=void 0,this.optionsController=new Wi(this)}connectedCallback(){super.connectedCallback(),this.parseOptions(),this._options.forEach(e=>{e.selected&&!this.value&&(this.value=e.value)})}add(e,t){let n={value:e.value||e.text,label:e.text||e.value,selected:e.selected,disabled:e.disabled};if(t===void 0)this._options.push(n);else if(typeof t==`number`)this._options.splice(t,0,n);else{let e=t.value||t.text,r=this._options.findIndex(t=>t.value===e);r>=0?this._options.splice(r,0,n):this._options.push(n)}e.selected&&(this.value=e.value||e.text,this.selectedIndex=this._options.findIndex(e=>e.value===this.value)),this.requestUpdate()}remove(e){typeof e==`number`&&(this.selectedIndex===e&&(this.value=this._options[0]?.value||``),this._options.splice(e,1),this.requestUpdate())}item(e){return this.inputRef.value?.item(e)}namedItem(e){return this.inputRef.value?.namedItem(e)}showPicker(){this.inputRef.value&&`showPicker`in this.inputRef.value&&this.inputRef.value.showPicker()}attributeChangedCallback(e,t,n){e===`options`&&(this._options=n?JSON.parse(n):[]),e===`value`&&this.value!==t&&(this.selectedIndex=this.touched?this.returnNumberOrNull(this.inputRef.value?.selectedIndex):this._options.findIndex(e=>e.value===n),this.selectedOptions=this.inputRef.value?.selectedOptions,this.valueChanged(n,t)),super.attributeChangedCallback(e,t,n)}update(e){super.update(e),e.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)),e.has(`value`)&&this.value!==e.get(`value`)&&(this.selectedIndex=this.touched?this.returnNumberOrNull(this.inputRef.value?.selectedIndex):this._options.findIndex(e=>e.value===this.value),this.selectedOptions=this.inputRef.value?.selectedOptions,this.valueChanged(this.value,e.get(`value`))),e.has(`id`)&&!this.name&&this.id&&(this.name=this.id)}firstUpdated(e){super.firstUpdated(e),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(e=>e.value===this.value),this.selectedOptions=this.inputRef.value?.selectedOptions}render(){let e=`pkt-input ${this.fullwidth?`pkt-input--fullwidth`:``}`;return j`
2125
+ </pkt-input-wrapper>`}};K([W({type:String,reflect:!0})],Ys.prototype,`value`,void 0),K([W({type:String})],Ys.prototype,`autocomplete`,void 0),K([W({type:Number})],Ys.prototype,`rows`,void 0),K([G()],Ys.prototype,`counterCurrent`,void 0);try{U(`pkt-textarea`)(Ys)}catch{console.warn(`Forsøker å definere <pkt-textarea>, men den er allerede definert`)}var Xs=class extends Z{constructor(...e){super(...e),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(){let e=this._optionsProp.length>0,t=this.optionsController?.nodes?.length&&this.optionsController.nodes.length>0;e?this._options=this._optionsProp:t&&(this._options=this.optionsController.options)}willUpdate(e){super.willUpdate(e),this.parseOptions()}};K([W({type:Array,attribute:`options`})],Xs.prototype,`_optionsProp`,void 0),K([G()],Xs.prototype,`_options`,void 0);var Zs=class extends Xs{constructor(){super(),this.inputRef=Y(),this.value=``,this.selectedIndex=-1,this.selectedOptions=void 0,this.optionsController=new Wi(this)}connectedCallback(){super.connectedCallback(),this.parseOptions(),this._options.forEach(e=>{e.selected&&!this.value&&(this.value=e.value)})}add(e,t){let n={value:e.value||e.text,label:e.text||e.value,selected:e.selected,disabled:e.disabled};if(t===void 0)this._options.push(n);else if(typeof t==`number`)this._options.splice(t,0,n);else{let e=t.value||t.text,r=this._options.findIndex(t=>t.value===e);r>=0?this._options.splice(r,0,n):this._options.push(n)}e.selected&&(this.value=e.value||e.text,this.selectedIndex=this._options.findIndex(e=>e.value===this.value)),this.requestUpdate()}remove(e){typeof e==`number`&&(this.selectedIndex===e&&(this.value=this._options[0]?.value||``),this._options.splice(e,1),this.requestUpdate())}item(e){return this.inputRef.value?.item(e)}namedItem(e){return this.inputRef.value?.namedItem(e)}showPicker(){this.inputRef.value&&`showPicker`in this.inputRef.value&&this.inputRef.value.showPicker()}attributeChangedCallback(e,t,n){e===`options`&&(this._options=n?JSON.parse(n):[]),e===`value`&&this.value!==t&&(this.selectedIndex=this.touched?this.returnNumberOrNull(this.inputRef.value?.selectedIndex):this._options.findIndex(e=>e.value===n),this.selectedOptions=this.inputRef.value?.selectedOptions,this.valueChanged(n,t)),super.attributeChangedCallback(e,t,n)}update(e){super.update(e),e.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)),e.has(`value`)&&this.value!==e.get(`value`)&&(this.selectedIndex=this.touched?this.returnNumberOrNull(this.inputRef.value?.selectedIndex):this._options.findIndex(e=>e.value===this.value),this.selectedOptions=this.inputRef.value?.selectedOptions,this.valueChanged(this.value,e.get(`value`))),e.has(`id`)&&!this.name&&this.id&&(this.name=this.id)}firstUpdated(e){super.firstUpdated(e),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(e=>e.value===this.value),this.selectedOptions=this.inputRef.value?.selectedOptions}render(){let e=`pkt-input ${this.fullwidth?`pkt-input--fullwidth`:``}`;return j`
2126
2126
  <pkt-input-wrapper
2127
2127
  ?counter=${this.counter}
2128
2128
  ?disabled=${this.disabled}
@@ -2170,7 +2170,7 @@
2170
2170
  </select>
2171
2171
  <div class="pkt-contents" slot="helptext">${Et(this,`helptext`)}</div>
2172
2172
  </pkt-input-wrapper>
2173
- `}returnNumberOrNull(e){return e==null||isNaN(e)?null:e}};K([W({type:String})],Ws.prototype,`value`,void 0);try{U(`pkt-select`)(Ws)}catch{console.warn(`Forsøker å definere <pkt-select>, men den er allerede definert`)}var Gs=class extends Ye{constructor(...e){super(...e),this.appearance=`local`,this.disabled=!1,this.fullwidth=!1,this.id=``,this.placeholder=`Søk…`,this.value=``,this.focusModality=new Ki(this,`.pkt-searchinput`)}get suggestionsId(){return`${this.id}-suggestions`}dispatchSearch(){this.dispatchEvent(new CustomEvent(`pkt-search`,{detail:{value:this.value},bubbles:!0,composed:!0}))}onInput(e){this.value=e.target.value}onInputKeydown(e){e.key===`Enter`&&(e.preventDefault(),this.dispatchSearch())}onSearchClick(e){e.preventDefault(),this.dispatchSearch()}onSuggestionClick(e,t,n){let r=new CustomEvent(`pkt-suggestion-click`,{detail:{index:n,suggestion:t},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(r)||e.preventDefault()}renderSuggestion(e,t){let n=j`
2173
+ `}returnNumberOrNull(e){return e==null||isNaN(e)?null:e}};K([W({type:String})],Zs.prototype,`value`,void 0);try{U(`pkt-select`)(Zs)}catch{console.warn(`Forsøker å definere <pkt-select>, men den er allerede definert`)}var Qs=class extends Ye{constructor(...e){super(...e),this.appearance=`local`,this.disabled=!1,this.fullwidth=!1,this.id=``,this.placeholder=`Søk…`,this.value=``,this.focusModality=new Ki(this,`.pkt-searchinput`)}get suggestionsId(){return`${this.id}-suggestions`}dispatchSearch(){this.dispatchEvent(new CustomEvent(`pkt-search`,{detail:{value:this.value},bubbles:!0,composed:!0}))}onInput(e){this.value=e.target.value}onInputKeydown(e){e.key===`Enter`&&(e.preventDefault(),this.dispatchSearch())}onSearchClick(e){e.preventDefault(),this.dispatchSearch()}onSuggestionClick(e,t,n){let r=new CustomEvent(`pkt-suggestion-click`,{detail:{index:n,suggestion:t},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(r)||e.preventDefault()}renderSuggestion(e,t){let n=j`
2174
2174
  ${e.title?j`<h3 class="pkt-searchinput__suggestion-title">${e.title}</h3>`:N}
2175
2175
  ${e.text?j`<p class="pkt-searchinput__suggestion-text">${e.text}</p>`:N}
2176
2176
  `;return e.href?j`<a
@@ -2229,7 +2229,7 @@
2229
2229
  @submit=${e=>{e.preventDefault()}}
2230
2230
  >
2231
2231
  ${i}
2232
- </form>`:j`<div role="search" class=${e}>${i}</div>`}};K([W({type:String})],Gs.prototype,`appearance`,void 0),K([W({type:Boolean,reflect:!0})],Gs.prototype,`disabled`,void 0),K([W({type:Boolean,reflect:!0})],Gs.prototype,`fullwidth`,void 0),K([W({type:String,reflect:!0})],Gs.prototype,`id`,void 0),K([W({type:String})],Gs.prototype,`label`,void 0),K([W({type:String})],Gs.prototype,`name`,void 0),K([W({type:String})],Gs.prototype,`placeholder`,void 0),K([W({type:String})],Gs.prototype,`value`,void 0),K([W({type:Array})],Gs.prototype,`suggestions`,void 0),K([W({type:String})],Gs.prototype,`action`,void 0),K([W({type:String})],Gs.prototype,`method`,void 0);try{U(`pkt-searchinput`)(Gs)}catch{console.warn(`Forsøker å definere <pkt-searchinput>, men den er allerede definert`)}var Ks=e=>/^\d{2}:\d{2}$/.test(e)&&parseInt(e.slice(0,2),10)<=23&&parseInt(e.slice(3),10)<=59,qs=e=>{let[t,n]=e.split(`:`).map(Number);return t*60+n},Js=e=>e?Math.max(1,Math.round(e/60)):1,Ys=(e,t)=>{let n=e?parseInt(String(e).split(`:`)[0],10):0,r=t?parseInt(String(t).split(`:`)[0],10):23;return Array.from({length:r-n+1},(e,t)=>t+n)},Xs=e=>{let t=Js(e);return Array.from({length:Math.floor(60/t)},(e,n)=>n*t)},Zs=(e,t,n,r)=>{let i=e===``?n===1?0:23:parseInt(e,10),a=t===``?n===1?0:Math.floor(59/r)*r:parseInt(t,10);return a+=n*r,a>59?(a=0,i=(i+1)%24):a<0&&(a=Math.floor(59/r)*r,i=(i-1+24)%24),{hours:String(i).padStart(2,`0`),minutes:String(a).padStart(2,`0`)}},Qs=class extends Z{constructor(...e){super(...e),this.hiddenInputRef=Y(),this.hoursInputRef=Y(),this.minutesInputRef=Y(),this.buttonRef=Y(),this.value=``,this.hidePicker=!1,this.stepArrows=!1,this._hours=``,this._minutes=``,this._isOpen=!1,this._hoursDigitCount=0,this._hoursFirstDigit=-1,this._minutesDigitCount=0,this._minutesFirstDigit=-1,this._hasFocus=!1,this._outsideClickHandler=e=>{this.contains(e.target)||this._closePopup()},this._handleComponentFocusIn=()=>{this._hasFocus||(this._hasFocus=!0,this.onFocus())},this._handleComponentFocusOut=e=>{this.contains(e.relatedTarget)||(this._hasFocus=!1,this.onBlur())},this._handleHoursKeydown=e=>{let t=e.target;switch(e.key){case`ArrowUp`:{e.preventDefault();let t=this._hours===``?0:parseInt(this._hours,10);this._hours=String((t+1)%24).padStart(2,`0`),this._syncValueFromDisplay(),this.onInput();break}case`ArrowDown`:{e.preventDefault();let t=this._hours===``?0:parseInt(this._hours,10);this._hours=String((t-1+24)%24).padStart(2,`0`),this._syncValueFromDisplay(),this.onInput();break}case`ArrowRight`:e.preventDefault(),this.minutesInputRef.value?.focus();break;case`Backspace`:case`Delete`:this._hoursDigitCount=0,this._hoursFirstDigit=-1;break;case`Tab`:break;case`Enter`:{e.preventDefault();let n=this.internals.form;n?n.requestSubmit():t.blur();break}default:if(/^\d$/.test(e.key)){e.preventDefault();let t=parseInt(e.key,10);if(this._hoursDigitCount===0)this._hoursFirstDigit=t,this._hours=String(t).padStart(2,`0`),this._hoursDigitCount=1,this.onInput(),t>=3&&(this._hoursFirstDigit=-1,this._hoursDigitCount=0,this._syncValueFromDisplay(),this.minutesInputRef.value?.focus());else{let e=this._hoursFirstDigit*10+t;this._hours=e<=23?String(e).padStart(2,`0`):String(t).padStart(2,`0`),this._hoursFirstDigit=-1,this._hoursDigitCount=0,this._syncValueFromDisplay(),this.onInput(),this.minutesInputRef.value?.focus()}}else e.preventDefault()}},this._handleHoursBlur=()=>{this._hours!==``&&(this._hours=String(parseInt(this._hours,10)).padStart(2,`0`)),this._hoursDigitCount=0,this._hoursFirstDigit=-1,this._syncValueFromDisplay()},this._handleMinutesKeydown=e=>{let t=e.target;switch(e.key){case`ArrowUp`:{e.preventDefault();let t=this._minutes===``?0:parseInt(this._minutes,10);this._minutes=String((t+this._minuteStep)%60).padStart(2,`0`),this._syncValueFromDisplay(),this.onInput();break}case`ArrowDown`:{e.preventDefault();let t=this._minutes===``?0:parseInt(this._minutes,10);this._minutes=String((t-this._minuteStep+60)%60).padStart(2,`0`),this._syncValueFromDisplay(),this.onInput();break}case`ArrowLeft`:e.preventDefault(),this.hoursInputRef.value?.focus();break;case`Backspace`:case`Delete`:this._minutesDigitCount=0,this._minutesFirstDigit=-1;break;case`Tab`:break;case`Enter`:{e.preventDefault();let n=this.internals.form;n?n.requestSubmit():t.blur();break}default:if(/^\d$/.test(e.key)){e.preventDefault();let t=parseInt(e.key,10);if(this._minutesDigitCount===0)this._minutesFirstDigit=t,this._minutes=String(t).padStart(2,`0`),this._minutesDigitCount=1,this.onInput(),t>=6&&(this._minutesFirstDigit=-1,this._minutesDigitCount=0,this._syncValueFromDisplay());else{let e=this._minutesFirstDigit*10+t;this._minutes=e<=59?String(e).padStart(2,`0`):String(t).padStart(2,`0`),this._minutesFirstDigit=-1,this._minutesDigitCount=0,this._syncValueFromDisplay(),this.onInput()}}else e.preventDefault()}},this._handleMinutesBlur=()=>{this._minutes!==``&&(this._minutes=String(parseInt(this._minutes,10)).padStart(2,`0`)),this._minutesDigitCount=0,this._minutesFirstDigit=-1,this._syncValueFromDisplay()},this._handlePopupKeydown=e=>{let t=document.activeElement,n=t.closest(`.pkt-timepicker-popup__col`);if(!n)return;let r=Array.from(n.querySelectorAll(`.pkt-timepicker-popup__option`)),i=r.indexOf(t),a=t.dataset.type??``;switch(e.key){case`ArrowDown`:e.preventDefault(),this._focusOptionAndSync(r[Math.min(i+1,r.length-1)],a);break;case`ArrowUp`:e.preventDefault(),this._focusOptionAndSync(r[Math.max(i-1,0)],a);break;case`Home`:e.preventDefault(),this._focusOptionAndSync(r[0],a);break;case`End`:e.preventDefault(),this._focusOptionAndSync(r[r.length-1],a);break;case`ArrowRight`:e.preventDefault(),a===`hour`&&(this._focusOptionAndSync(t,a),this.updateComplete.then(()=>{this._scrollToSelected(),this._focusSelectedOrFirst(`minute`)}));break;case`ArrowLeft`:e.preventDefault(),a===`minute`&&(this._focusOptionAndSync(t,a),this.updateComplete.then(()=>{this._scrollToSelected(),this._focusSelectedOrFirst(`hour`)}));break;case`Enter`:case` `:e.preventDefault(),t.click();break;case`Escape`:e.preventDefault(),this._closePopup(),this.buttonRef.value?.focus();break}}}get inputRef(){return this.hiddenInputRef}manageValidity(e){let t=this.hoursInputRef.value;if(!t)return;if(this.required&&!this.value){this.internals.setValidity({valueMissing:!0},qe.forms.messages.required,t),this._setAriaInvalid(!0);return}if(!this.value){this.internals.setValidity({}),this._setAriaInvalid(!1);return}let n=qs(this.value),r=Js(this.step);if(this.min&&n<qs(String(this.min))){this.internals.setValidity({rangeUnderflow:!0},qe.forms.messages.rangeUnderflowMin.replace(`{min}`,String(this.min)),t),this._setAriaInvalid(!0);return}if(this.max&&n>qs(String(this.max))){this.internals.setValidity({rangeOverflow:!0},qe.forms.messages.rangeOverflowMax.replace(`{max}`,String(this.max)),t),this._setAriaInvalid(!0);return}if(this.step&&n%r!==0){let e=r===60?qe.forms.messages.timeStepMismatchHour:r===30?qe.forms.messages.timeStepMismatchHalfHour:qe.forms.messages.timeStepMismatch.replace(`{step}`,`${r}, ${r*2}, ${r*3}`);this.internals.setValidity({stepMismatch:!0},e,t),this._setAriaInvalid(!0);return}this.internals.setValidity({}),this._setAriaInvalid(!1)}_setAriaInvalid(e){if(!this.touched&&e)return;let t=this.hoursInputRef.value,n=this.minutesInputRef.value;e?(t?.setAttribute(`aria-invalid`,`true`),n?.setAttribute(`aria-invalid`,`true`)):(t?.removeAttribute(`aria-invalid`),n?.removeAttribute(`aria-invalid`))}connectedCallback(){super.connectedCallback(),this.addEventListener(`focusin`,this._handleComponentFocusIn),this.addEventListener(`focusout`,this._handleComponentFocusOut),document.addEventListener(`click`,this._outsideClickHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`focusin`,this._handleComponentFocusIn),this.removeEventListener(`focusout`,this._handleComponentFocusOut),document.removeEventListener(`click`,this._outsideClickHandler)}willUpdate(e){super.willUpdate(e),e.has(`value`)&&this._syncDisplayFromValue()}updated(e){super.updated(e),this.classList.toggle(`pkt-timepicker--stepper`,this.stepArrows),this.classList.toggle(`pkt-timepicker--fullwidth`,this.fullwidth),e.has(`step`)&&this.step!==null&&!this._isValidStep(this.step)&&console.warn(`pkt-timepicker: step="${this.step}" er ikke en gyldig verdi. Step må være et multiplum av 60 (hele minutter) eller nøyaktig 3600 (hel time).`)}formResetCallback(){super.formResetCallback(),this._hours=``,this._minutes=``,this._isOpen=!1}_isValidStep(e){return e===3600||e<3600&&3600%e==0&&e%60==0}_syncDisplayFromValue(){let e=Ks(this.value)?this.value.split(`:`):null;e?(this._hours=e[0],this._minutes=e[1]):(this._hours=``,this._minutes=``)}_syncValueFromDisplay(){if(this._hours!==``&&this._minutes!==``){let e=`${this._hours}:${this._minutes}`;e!==this.value&&(this.value=e,this.onChange(e))}else this.value!==``&&(this.value=``,this.onChange(``))}get _minuteStep(){return Js(this.step)}get _hourOptions(){return Ys(this.min,this.max)}get _minuteOptions(){return Xs(this.step)}_openPopup(){this._isOpen=!0,this.updateComplete.then(()=>{this._scrollToSelected(),this._focusSelectedOrFirst(`hour`)})}_closePopup(){this._isOpen=!1,this._syncValueFromDisplay()}_togglePopup(){this._isOpen?this._closePopup():this._openPopup()}_scrollToSelected(){let e=this.querySelector(`.pkt-timepicker-popup`);e&&e.querySelectorAll(`.pkt-timepicker-popup__col`).forEach(e=>{let t=e.querySelector(`.pkt-timepicker-popup__option--selected`);t&&t.scrollIntoView({block:`center`})})}_focusSelectedOrFirst(e){let t=this.querySelector(`.pkt-timepicker-popup`);if(!t)return;let n=t.querySelectorAll(`.pkt-timepicker-popup__col`),r=e===`hour`?n[0]:n[1];if(!r)return;let i=r.querySelector(`.pkt-timepicker-popup__option--selected`),a=r.querySelector(`.pkt-timepicker-popup__option`);(i||a)?.focus()}_handleOptionClick(e,t){let n=String(e).padStart(2,`0`);t===`hour`?(this._hours=n,this.updateComplete.then(()=>this._focusSelectedOrFirst(`minute`))):(this._minutes=n,this._closePopup(),this.buttonRef.value?.focus())}_focusOptionAndSync(e,t){if(!e)return;let n=parseInt(e.dataset.value??`0`,10);t===`hour`?this._hours=String(n).padStart(2,`0`):this._minutes=String(n).padStart(2,`0`),e.focus()}_stepTime(e){let t=Zs(this._hours,this._minutes,e,this._minuteStep);this._hours=t.hours,this._minutes=t.minutes,this._syncValueFromDisplay()}_renderOption(e,t){let n=String(e).padStart(2,`0`),r=e===(t===`hour`?this._hours===``?NaN:parseInt(this._hours,10):this._minutes===``?NaN:parseInt(this._minutes,10));return j`
2232
+ </form>`:j`<div role="search" class=${e}>${i}</div>`}};K([W({type:String})],Qs.prototype,`appearance`,void 0),K([W({type:Boolean,reflect:!0})],Qs.prototype,`disabled`,void 0),K([W({type:Boolean,reflect:!0})],Qs.prototype,`fullwidth`,void 0),K([W({type:String,reflect:!0})],Qs.prototype,`id`,void 0),K([W({type:String})],Qs.prototype,`label`,void 0),K([W({type:String})],Qs.prototype,`name`,void 0),K([W({type:String})],Qs.prototype,`placeholder`,void 0),K([W({type:String})],Qs.prototype,`value`,void 0),K([W({type:Array})],Qs.prototype,`suggestions`,void 0),K([W({type:String})],Qs.prototype,`action`,void 0),K([W({type:String})],Qs.prototype,`method`,void 0);try{U(`pkt-searchinput`)(Qs)}catch{console.warn(`Forsøker å definere <pkt-searchinput>, men den er allerede definert`)}var $s=e=>/^\d{2}:\d{2}$/.test(e)&&parseInt(e.slice(0,2),10)<=23&&parseInt(e.slice(3),10)<=59,ec=e=>{let[t,n]=e.split(`:`).map(Number);return t*60+n},tc=e=>e?Math.max(1,Math.round(e/60)):1,nc=(e,t)=>{let n=e?parseInt(String(e).split(`:`)[0],10):0,r=t?parseInt(String(t).split(`:`)[0],10):23;return Array.from({length:r-n+1},(e,t)=>t+n)},rc=e=>{let t=tc(e);return Array.from({length:Math.floor(60/t)},(e,n)=>n*t)},ic=(e,t,n,r)=>{let i=e===``?n===1?0:23:parseInt(e,10),a=t===``?n===1?0:Math.floor(59/r)*r:parseInt(t,10);return a+=n*r,a>59?(a=0,i=(i+1)%24):a<0&&(a=Math.floor(59/r)*r,i=(i-1+24)%24),{hours:String(i).padStart(2,`0`),minutes:String(a).padStart(2,`0`)}},ac=class extends Z{constructor(...e){super(...e),this.hiddenInputRef=Y(),this.hoursInputRef=Y(),this.minutesInputRef=Y(),this.buttonRef=Y(),this.value=``,this.hidePicker=!1,this.stepArrows=!1,this._hours=``,this._minutes=``,this._isOpen=!1,this._hoursDigitCount=0,this._hoursFirstDigit=-1,this._minutesDigitCount=0,this._minutesFirstDigit=-1,this._hasFocus=!1,this._outsideClickHandler=e=>{this.contains(e.target)||this._closePopup()},this._handleComponentFocusIn=()=>{this._hasFocus||(this._hasFocus=!0,this.onFocus())},this._handleComponentFocusOut=e=>{this.contains(e.relatedTarget)||(this._hasFocus=!1,this.onBlur())},this._handleHoursKeydown=e=>{let t=e.target;switch(e.key){case`ArrowUp`:{e.preventDefault();let t=this._hours===``?0:parseInt(this._hours,10);this._hours=String((t+1)%24).padStart(2,`0`),this._syncValueFromDisplay(),this.onInput();break}case`ArrowDown`:{e.preventDefault();let t=this._hours===``?0:parseInt(this._hours,10);this._hours=String((t-1+24)%24).padStart(2,`0`),this._syncValueFromDisplay(),this.onInput();break}case`ArrowRight`:e.preventDefault(),this.minutesInputRef.value?.focus();break;case`Backspace`:case`Delete`:this._hoursDigitCount=0,this._hoursFirstDigit=-1;break;case`Tab`:break;case`Enter`:{e.preventDefault();let n=this.internals.form;n?n.requestSubmit():t.blur();break}default:if(/^\d$/.test(e.key)){e.preventDefault();let t=parseInt(e.key,10);if(this._hoursDigitCount===0)this._hoursFirstDigit=t,this._hours=String(t).padStart(2,`0`),this._hoursDigitCount=1,this.onInput(),t>=3&&(this._hoursFirstDigit=-1,this._hoursDigitCount=0,this._syncValueFromDisplay(),this.minutesInputRef.value?.focus());else{let e=this._hoursFirstDigit*10+t;this._hours=e<=23?String(e).padStart(2,`0`):String(t).padStart(2,`0`),this._hoursFirstDigit=-1,this._hoursDigitCount=0,this._syncValueFromDisplay(),this.onInput(),this.minutesInputRef.value?.focus()}}else e.preventDefault()}},this._handleHoursBlur=()=>{this._hours!==``&&(this._hours=String(parseInt(this._hours,10)).padStart(2,`0`)),this._hoursDigitCount=0,this._hoursFirstDigit=-1,this._syncValueFromDisplay()},this._handleMinutesKeydown=e=>{let t=e.target;switch(e.key){case`ArrowUp`:{e.preventDefault();let t=this._minutes===``?0:parseInt(this._minutes,10);this._minutes=String((t+this._minuteStep)%60).padStart(2,`0`),this._syncValueFromDisplay(),this.onInput();break}case`ArrowDown`:{e.preventDefault();let t=this._minutes===``?0:parseInt(this._minutes,10);this._minutes=String((t-this._minuteStep+60)%60).padStart(2,`0`),this._syncValueFromDisplay(),this.onInput();break}case`ArrowLeft`:e.preventDefault(),this.hoursInputRef.value?.focus();break;case`Backspace`:case`Delete`:this._minutesDigitCount=0,this._minutesFirstDigit=-1;break;case`Tab`:break;case`Enter`:{e.preventDefault();let n=this.internals.form;n?n.requestSubmit():t.blur();break}default:if(/^\d$/.test(e.key)){e.preventDefault();let t=parseInt(e.key,10);if(this._minutesDigitCount===0)this._minutesFirstDigit=t,this._minutes=String(t).padStart(2,`0`),this._minutesDigitCount=1,this.onInput(),t>=6&&(this._minutesFirstDigit=-1,this._minutesDigitCount=0,this._syncValueFromDisplay());else{let e=this._minutesFirstDigit*10+t;this._minutes=e<=59?String(e).padStart(2,`0`):String(t).padStart(2,`0`),this._minutesFirstDigit=-1,this._minutesDigitCount=0,this._syncValueFromDisplay(),this.onInput()}}else e.preventDefault()}},this._handleMinutesBlur=()=>{this._minutes!==``&&(this._minutes=String(parseInt(this._minutes,10)).padStart(2,`0`)),this._minutesDigitCount=0,this._minutesFirstDigit=-1,this._syncValueFromDisplay()},this._handlePopupKeydown=e=>{let t=document.activeElement,n=t.closest(`.pkt-timepicker-popup__col`);if(!n)return;let r=Array.from(n.querySelectorAll(`.pkt-timepicker-popup__option`)),i=r.indexOf(t),a=t.dataset.type??``;switch(e.key){case`ArrowDown`:e.preventDefault(),this._focusOptionAndSync(r[Math.min(i+1,r.length-1)],a);break;case`ArrowUp`:e.preventDefault(),this._focusOptionAndSync(r[Math.max(i-1,0)],a);break;case`Home`:e.preventDefault(),this._focusOptionAndSync(r[0],a);break;case`End`:e.preventDefault(),this._focusOptionAndSync(r[r.length-1],a);break;case`ArrowRight`:e.preventDefault(),a===`hour`&&(this._focusOptionAndSync(t,a),this.updateComplete.then(()=>{this._scrollToSelected(),this._focusSelectedOrFirst(`minute`)}));break;case`ArrowLeft`:e.preventDefault(),a===`minute`&&(this._focusOptionAndSync(t,a),this.updateComplete.then(()=>{this._scrollToSelected(),this._focusSelectedOrFirst(`hour`)}));break;case`Enter`:case` `:e.preventDefault(),t.click();break;case`Escape`:e.preventDefault(),this._closePopup(),this.buttonRef.value?.focus();break}}}get inputRef(){return this.hiddenInputRef}manageValidity(e){let t=this.hoursInputRef.value;if(!t)return;if(this.required&&!this.value){this.internals.setValidity({valueMissing:!0},qe.forms.messages.required,t),this._setAriaInvalid(!0);return}if(!this.value){this.internals.setValidity({}),this._setAriaInvalid(!1);return}let n=ec(this.value),r=tc(this.step);if(this.min&&n<ec(String(this.min))){this.internals.setValidity({rangeUnderflow:!0},qe.forms.messages.rangeUnderflowMin.replace(`{min}`,String(this.min)),t),this._setAriaInvalid(!0);return}if(this.max&&n>ec(String(this.max))){this.internals.setValidity({rangeOverflow:!0},qe.forms.messages.rangeOverflowMax.replace(`{max}`,String(this.max)),t),this._setAriaInvalid(!0);return}if(this.step&&n%r!==0){let e=r===60?qe.forms.messages.timeStepMismatchHour:r===30?qe.forms.messages.timeStepMismatchHalfHour:qe.forms.messages.timeStepMismatch.replace(`{step}`,`${r}, ${r*2}, ${r*3}`);this.internals.setValidity({stepMismatch:!0},e,t),this._setAriaInvalid(!0);return}this.internals.setValidity({}),this._setAriaInvalid(!1)}_setAriaInvalid(e){if(!this.touched&&e)return;let t=this.hoursInputRef.value,n=this.minutesInputRef.value;e?(t?.setAttribute(`aria-invalid`,`true`),n?.setAttribute(`aria-invalid`,`true`)):(t?.removeAttribute(`aria-invalid`),n?.removeAttribute(`aria-invalid`))}connectedCallback(){super.connectedCallback(),this.addEventListener(`focusin`,this._handleComponentFocusIn),this.addEventListener(`focusout`,this._handleComponentFocusOut),document.addEventListener(`click`,this._outsideClickHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`focusin`,this._handleComponentFocusIn),this.removeEventListener(`focusout`,this._handleComponentFocusOut),document.removeEventListener(`click`,this._outsideClickHandler)}willUpdate(e){super.willUpdate(e),e.has(`value`)&&this._syncDisplayFromValue()}updated(e){super.updated(e),this.classList.toggle(`pkt-timepicker--stepper`,this.stepArrows),this.classList.toggle(`pkt-timepicker--fullwidth`,this.fullwidth),e.has(`step`)&&this.step!==null&&!this._isValidStep(this.step)&&console.warn(`pkt-timepicker: step="${this.step}" er ikke en gyldig verdi. Step må være et multiplum av 60 (hele minutter) eller nøyaktig 3600 (hel time).`)}formResetCallback(){super.formResetCallback(),this._hours=``,this._minutes=``,this._isOpen=!1}_isValidStep(e){return e===3600||e<3600&&3600%e==0&&e%60==0}_syncDisplayFromValue(){let e=$s(this.value)?this.value.split(`:`):null;e?(this._hours=e[0],this._minutes=e[1]):(this._hours=``,this._minutes=``)}_syncValueFromDisplay(){if(this._hours!==``&&this._minutes!==``){let e=`${this._hours}:${this._minutes}`;e!==this.value&&(this.value=e,this.onChange(e))}else this.value!==``&&(this.value=``,this.onChange(``))}get _minuteStep(){return tc(this.step)}get _hourOptions(){return nc(this.min,this.max)}get _minuteOptions(){return rc(this.step)}_openPopup(){this._isOpen=!0,this.updateComplete.then(()=>{this._scrollToSelected(),this._focusSelectedOrFirst(`hour`)})}_closePopup(){this._isOpen=!1,this._syncValueFromDisplay()}_togglePopup(){this._isOpen?this._closePopup():this._openPopup()}_scrollToSelected(){let e=this.querySelector(`.pkt-timepicker-popup`);e&&e.querySelectorAll(`.pkt-timepicker-popup__col`).forEach(e=>{let t=e.querySelector(`.pkt-timepicker-popup__option--selected`);t&&t.scrollIntoView({block:`center`})})}_focusSelectedOrFirst(e){let t=this.querySelector(`.pkt-timepicker-popup`);if(!t)return;let n=t.querySelectorAll(`.pkt-timepicker-popup__col`),r=e===`hour`?n[0]:n[1];if(!r)return;let i=r.querySelector(`.pkt-timepicker-popup__option--selected`),a=r.querySelector(`.pkt-timepicker-popup__option`);(i||a)?.focus()}_handleOptionClick(e,t){let n=String(e).padStart(2,`0`);t===`hour`?(this._hours=n,this.updateComplete.then(()=>this._focusSelectedOrFirst(`minute`))):(this._minutes=n,this._closePopup(),this.buttonRef.value?.focus())}_focusOptionAndSync(e,t){if(!e)return;let n=parseInt(e.dataset.value??`0`,10);t===`hour`?this._hours=String(n).padStart(2,`0`):this._minutes=String(n).padStart(2,`0`),e.focus()}_stepTime(e){let t=ic(this._hours,this._minutes,e,this._minuteStep);this._hours=t.hours,this._minutes=t.minutes,this._syncValueFromDisplay()}_renderOption(e,t){let n=String(e).padStart(2,`0`),r=e===(t===`hour`?this._hours===``?NaN:parseInt(this._hours,10):this._minutes===``?NaN:parseInt(this._minutes,10));return j`
2233
2233
  <button
2234
2234
  class=${q({"pkt-btn":!0,"pkt-btn--tertiary":!0,"pkt-btn--small":!0,"pkt-btn--label-only":!0,"pkt-timepicker-popup__option":!0,"pkt-timepicker-popup__option--selected":r})}
2235
2235
  type="button"
@@ -2419,4 +2419,4 @@
2419
2419
  </div>
2420
2420
  `:this._renderContainer()}
2421
2421
  </pkt-input-wrapper>
2422
- `}};K([W({type:String,reflect:!0})],Qs.prototype,`value`,void 0),K([W({type:Boolean,reflect:!0,attribute:`hide-picker`})],Qs.prototype,`hidePicker`,void 0),K([W({type:Boolean,reflect:!0,attribute:`step-arrows`})],Qs.prototype,`stepArrows`,void 0),K([G()],Qs.prototype,`_hours`,void 0),K([G()],Qs.prototype,`_minutes`,void 0),K([G()],Qs.prototype,`_isOpen`,void 0);try{U(`pkt-timepicker`)(Qs)}catch{console.warn(`Forsøker å definere <pkt-timepicker>, men den er allerede definert`)}var Q=x({tagName:`pkt-icon`,elementClass:Ht,react:t.default,displayName:`PktIcon`,events:{}}),$s=(0,t.forwardRef)(({defaultOpen:e=!1,id:r,title:i,skin:a,compact:o=!1,isOpen:s,children:c,name:l,className:u,onClick:d,onToggle:f},p)=>{let[m,h]=(0,t.useState)(e),{name:_}=g(),v=l||_,y=s===void 0?m:s;return(0,t.useEffect)(()=>{s===void 0&&h(e)},[e,s]),(0,n.jsxs)(`details`,{ref:p,className:[`pkt-accordion-item`,o&&`pkt-accordion-item--compact`,a&&`pkt-accordion-item--${a}`,u].filter(Boolean).join(` `),id:r,open:y,onClick:e=>{setTimeout(()=>{d?.(e)},0)},name:v,onToggle:e=>{let t=e.currentTarget.open;t!==y&&(s===void 0&&h(t),f?.(e))},children:[(0,n.jsxs)(`summary`,{className:`pkt-accordion-item__title`,id:`pkt-accordion-item-summary-${r}`,children:[i,a===`plus-minus`?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Q,{name:`plus-sign`,className:`pkt-accordion-item__icon pkt-accordion-item__icon--plus`,"aria-hidden":`true`}),(0,n.jsx)(Q,{name:`minus-sign`,className:`pkt-accordion-item__icon pkt-accordion-item__icon--minus`,"aria-hidden":`true`})]}):(0,n.jsx)(Q,{name:`chevron-thin-down`,className:`pkt-accordion-item__icon`,"aria-hidden":`true`})]}),(0,n.jsx)(`div`,{className:`pkt-accordion-item__content`,id:`pkt-accordion-item__content-${r}`,role:`region`,children:(0,n.jsx)(`div`,{className:`pkt-accordion-item__content-inner`,children:c})})]})});$s.displayName=`PktAccordionItem`;var $=m(d(((e,t)=>{(function(){"use strict";var e={}.hasOwnProperty;function n(){for(var e=``,t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=i(e,r(n)))}return e}function r(t){if(typeof t==`string`||typeof t==`number`)return t;if(typeof t!=`object`)return``;if(Array.isArray(t))return n.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes(`[native code]`))return t.toString();var r=``;for(var a in t)e.call(t,a)&&t[a]&&(r=i(r,a));return r}function i(e,t){return t?e?e+` `+t:e+t:e}t!==void 0&&t.exports?(n.default=n,t.exports=n):typeof define==`function`&&typeof define.amd==`object`&&define.amd?define(`classnames`,[],function(){return n}):window.classNames=n})()}))(),1),ec=({children:e,closeAlert:r,compact:i,title:a,date:o,ariaLive:s,"aria-live":c=`polite`,role:l=`status`,skin:u=`info`,className:d,...f})=>{let[p,m]=(0,t.useState)(!1),h={"pkt-alert":!0,"pkt-alert--compact":i,[`pkt-alert--${u}`]:u,"pkt-hide":p},g={"pkt-alert__grid":!0,"pkt-alert__noTitle":!a,"pkt-alert__noDate":!o},_=(0,t.useCallback)(()=>{m(!0),f.onClose&&f.onClose(new CustomEvent(`close`,{detail:{origin:event},bubbles:!0,composed:!0}))},[f.onClose,m]),v=s||c;return(0,n.jsx)(`div`,{...f,"aria-live":v,role:l,className:(0,$.default)(h,d),children:(0,n.jsxs)(`div`,{className:(0,$.default)(g),children:[(0,n.jsx)(Q,{className:`pkt-alert__icon`,"aria-hidden":`true`,name:u===`info`?`alert-information`:`alert-${u}`}),r&&(0,n.jsx)(`div`,{className:`pkt-alert__close`,children:(0,n.jsx)(rc,{tabIndex:0,"aria-label":`close`,size:i?`small`:`medium`,type:`button`,skin:`tertiary`,iconName:`close`,variant:`icon-only`,onClick:_,children:(0,n.jsx)(`span`,{className:`sr-only`,children:`Lukk`})})}),a&&(0,n.jsx)(`div`,{className:`pkt-alert__title`,children:a}),(0,n.jsx)(`div`,{className:`pkt-alert__text`,children:e}),o&&(0,n.jsxs)(`div`,{className:`pkt-alert__date`,children:[`Sist oppdatert: `,o]})]})})};ec.displayName=`PktAlert`;var tc=(0,t.forwardRef)(({href:e=`/`,text:t=`Forsiden`,ariaLabel:r,renderLink:i,className:a,...o},s)=>{let c=(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Q,{className:`pkt-back-link__icon pkt-icon pkt-link__icon`,name:`chevron-thin-left`,"aria-hidden":`true`}),(0,n.jsx)(`span`,{className:`pkt-back-link__text`,children:t})]}),l=i||(({href:e,className:t,children:r,props:i})=>(0,n.jsx)(`a`,{href:e,className:t,...i,children:r}));return(0,n.jsx)(`nav`,{className:[`pkt-back-link`,a].filter(Boolean).join(` `),"aria-label":r||`Gå tilbake til forrige side`,ref:s,children:l({href:e,className:`pkt-link pkt-link--icon-left`,children:c,props:o})})});tc.displayName=`PktBackLink`;var nc=(0,t.forwardRef)(({breadcrumbs:e,navigationType:t,renderLink:i,className:a,...o},s)=>{let c=e,l=c[c.length-2],u=[a,`pkt-breadcrumbs`].filter(Boolean).join(` `),d=i||(t===`router`?({href:e,className:t,children:i,props:a})=>(0,n.jsx)(r.Link,{to:e,className:t,...a,children:i}):({href:e,className:t,children:r,props:i})=>(0,n.jsx)(`a`,{href:e,className:t,...i,children:r}));return(0,n.jsxs)(`nav`,{ref:s,"aria-label":`brødsmulemeny`,className:u,children:[(0,n.jsx)(`ol`,{className:`pkt-breadcrumbs__list pkt-breadcrumbs--desktop`,children:c.map((e,t)=>(0,n.jsx)(`li`,{className:`pkt-breadcrumbs__item`,children:t===c.length-1?(0,n.jsx)(`span`,{className:`pkt-breadcrumbs__label`,"aria-current":`true`,children:(0,n.jsx)(`span`,{className:`pkt-breadcrumbs__text`,children:e.text})}):d({href:e.href,className:`pkt-link pkt-link--icon-right pkt-breadcrumbs__label pkt-breadcrumbs__link`,children:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Q,{className:`pkt-icon pkt-breadcrumbs__icon pkt-link__icon`,name:`chevron-thin-right`}),(0,n.jsx)(`span`,{className:`pkt-breadcrumbs__text`,children:e.text})]}),props:o})},`breadcrumb-${t}`))}),d({href:l.href,className:`pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile`,children:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Q,{className:`pkt-back-link__icon pkt-icon pkt-link__icon`,name:`chevron-thin-left`}),(0,n.jsx)(`span`,{className:`pkt-breadcrumbs__text`,children:l.text})]}),props:o})]})});nc.displayName=`PktBreadcrumbs`,window.pktAnimationPath=window.pktAnimationPath||`https://punkt-cdn.oslo.kommune.no/16.17/animations/`;var rc=(0,t.forwardRef)(({children:e,className:t,iconName:r=`user`,secondIconName:i=`user`,iconPath:a,secondIconPath:o,size:s=`medium`,fullWidth:c=!1,fullWidthOnMobile:l=!1,skin:u=`primary`,type:d=`button`,variant:f=`label-only`,state:p,color:m,isLoading:h=void 0,disabled:g=void 0,loadingAnimationPath:_=window.pktAnimationPath,...v},y)=>{let b=[t,`pkt-btn`,s&&`pkt-btn--${s}`,c&&`pkt-btn--full`,l&&`pkt-btn--full-small`,u&&`pkt-btn--${u}`,f&&`pkt-btn--${f}`,m&&`pkt-btn--${m}`,p&&`pkt-btn--${p}`,h&&`pkt-btn--isLoading`].filter(Boolean).join(` `);return(0,n.jsxs)(`button`,{...v,"aria-busy":h||void 0,"aria-disabled":g||void 0,disabled:g,className:b,type:d,ref:y,children:[h&&(0,n.jsx)(Q,{className:`pkt-btn__icon pkt-btn__spinner`,name:`spinner-blue`,path:_}),f!==`label-only`&&(0,n.jsx)(Q,{className:`pkt-btn__icon`,name:r,...a&&{path:a}}),(0,n.jsx)(`span`,{className:`pkt-btn__text`,children:e}),f===`icons-right-and-left`&&(0,n.jsx)(Q,{className:`pkt-btn__icon`,name:i,...o&&{path:o}})]})});rc.displayName=`PktButton`;var ic=365.2425,ac=6048e5,oc=864e5,sc=3600*24;sc*7,sc*ic/12*3;var cc=Symbol.for(`constructDateFrom`);function lc(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&cc in e?e[cc](t):e instanceof Date?new e.constructor(t):new Date(t)}function uc(e,t){return lc(t||e,e)}function dc(e,t,n){let r=uc(e,n?.in);return isNaN(t)?lc(n?.in||e,NaN):(t&&r.setDate(r.getDate()+t),r)}var fc={};function pc(){return fc}function mc(e,t){let n=pc(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=uc(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function hc(e,t){return mc(e,{...t,weekStartsOn:1})}function gc(e,t){let n=uc(e,t?.in),r=n.getFullYear(),i=lc(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=hc(i),o=lc(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=hc(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function _c(e){let t=uc(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function vc(e,...t){let n=lc.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function yc(e,t){let n=uc(e,t?.in);return n.setHours(0,0,0,0),n}function bc(e,t,n){let[r,i]=vc(n?.in,e,t),a=yc(r),o=yc(i),s=+a-_c(a),c=+o-_c(o);return Math.round((s-c)/oc)}function xc(e,t){let n=gc(e,t),r=lc(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),hc(r)}function Sc(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function Cc(e){return!(!Sc(e)&&typeof e!=`number`||isNaN(+uc(e)))}function wc(e,t){let n=uc(e,t?.in);return n.setHours(23,59,59,999),n}function Tc(e,t){let[n,r]=vc(e,t.start,t.end);return{start:n,end:r}}function Ec(e,t){let{start:n,end:r}=Tc(t?.in,e),i=+n>+r,a=i?+n:+r,o=i?r:n;o.setHours(0,0,0,0);let s=t?.step??1;if(!s)return[];s<0&&(s=-s,i=!i);let c=[];for(;+o<=a;)c.push(lc(n,o)),o.setDate(o.getDate()+s),o.setHours(0,0,0,0);return i?c.reverse():c}function Dc(e,t){let n=uc(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}var Oc={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`}},kc=(e,t,n)=>{let r,i=Oc[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function Ac(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var jc={date:Ac({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:Ac({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:Ac({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},Mc={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},Nc=(e,t,n,r)=>Mc[e];function Pc(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var Fc={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:Pc({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:Pc({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:Pc({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:Pc({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:Pc({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function Ic(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?Rc(s,e=>e.test(o)):Lc(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function Lc(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function Rc(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function zc(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var Bc={code:`en-US`,formatDistance:kc,formatLong:jc,formatRelative:Nc,localize:Fc,match:{ordinalNumber:zc({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:Ic({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:Ic({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:Ic({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:Ic({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:Ic({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function Vc(e,t){let n=uc(e,t?.in);return bc(n,Dc(n))+1}function Hc(e,t){let n=uc(e,t?.in),r=hc(n)-+xc(n);return Math.round(r/ac)+1}function Uc(e,t){let n=uc(e,t?.in),r=n.getFullYear(),i=pc(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=lc(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=mc(o,t),c=lc(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=mc(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function Wc(e,t){let n=pc(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=Uc(e,t),a=lc(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),mc(a,t)}function Gc(e,t){let n=uc(e,t?.in),r=mc(n,t)-+Wc(n,t);return Math.round(r/ac)+1}function Kc(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var qc={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return Kc(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):Kc(n+1,2)},d(e,t){return Kc(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return Kc(e.getHours()%12||12,t.length)},H(e,t){return Kc(e.getHours(),t.length)},m(e,t){return Kc(e.getMinutes(),t.length)},s(e,t){return Kc(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return Kc(Math.trunc(r*10**(n-3)),t.length)}},Jc={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},Yc={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return qc.y(e,t)},Y:function(e,t,n,r){let i=Uc(e,r),a=i>0?i:1-i;return t===`YY`?Kc(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):Kc(a,t.length)},R:function(e,t){return Kc(gc(e),t.length)},u:function(e,t){return Kc(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return Kc(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return Kc(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return qc.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return Kc(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=Gc(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):Kc(i,t.length)},I:function(e,t,n){let r=Hc(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):Kc(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):qc.d(e,t)},D:function(e,t,n){let r=Vc(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):Kc(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return Kc(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return Kc(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return Kc(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?Jc.noon:r===0?Jc.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?Jc.evening:r>=12?Jc.afternoon:r>=4?Jc.morning:Jc.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return qc.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):qc.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):Kc(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):Kc(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):qc.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):qc.s(e,t)},S:function(e,t){return qc.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return Zc(r);case`XXXX`:case`XX`:return Qc(r);default:return Qc(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return Zc(r);case`xxxx`:case`xx`:return Qc(r);default:return Qc(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+Xc(r,`:`);default:return`GMT`+Qc(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+Xc(r,`:`);default:return`GMT`+Qc(r,`:`)}},t:function(e,t,n){return Kc(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return Kc(+e,t.length)}};function Xc(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+Kc(a,2)}function Zc(e,t){return e%60==0?(e>0?`-`:`+`)+Kc(Math.abs(e)/60,2):Qc(e,t)}function Qc(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Kc(Math.trunc(r/60),2),a=Kc(r%60,2);return n+i+t+a}var $c=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},el=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},tl={p:el,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return $c(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,$c(r,t)).replace(`{{time}}`,el(i,t))}},nl=/^D+$/,rl=/^Y+$/,il=[`D`,`DD`,`YY`,`YYYY`];function al(e){return nl.test(e)}function ol(e){return rl.test(e)}function sl(e,t,n){let r=cl(e,t,n);if(console.warn(r),il.includes(e))throw RangeError(r)}function cl(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var ll=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,ul=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,dl=/^'([^]*?)'?$/,fl=/''/g,pl=/[a-zA-Z]/;function ml(e,t,n){let r=pc(),i=n?.locale??r.locale??Bc,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=uc(e,n?.in);if(!Cc(s))throw RangeError(`Invalid time value`);let c=t.match(ul).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=tl[t];return n(e,i.formatLong)}return e}).join(``).match(ll).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:hl(e)};if(Yc[t])return{isToken:!0,value:e};if(t.match(pl))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&ol(a)||!n?.useAdditionalDayOfYearTokens&&al(a))&&sl(a,t,String(e));let o=Yc[a[0]];return o(s,a,i.localize,l)}).join(``)}function hl(e){let t=e.match(dl);return t?t[1].replace(fl,`'`):e}function gl(e,t){let n=uc(e,t?.in).getDay();return n===0?7:n}function _l(e,t,n=`long`){return new Intl.DateTimeFormat(`en-US`,{hour:`numeric`,timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(` `)}var vl={},yl={};function bl(e,t){try{let n=(vl[e]||=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`longOffset`}).format)(t).split(`GMT`)[1];return n in yl?yl[n]:Sl(n,n.split(`:`))}catch{if(e in yl)return yl[e];let t=e?.match(xl);return t?Sl(e,t.slice(1)):NaN}}var xl=/([+-]\d\d):?(\d\d)?/;function Sl(e,t){let n=+(t[0]||0),r=+(t[1]||0),i=(t[2]||0)/60;return yl[e]=n*60+r>0?n*60+r+i:n*60-r-i}var Cl=class e extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]==`string`&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(bl(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)),Dl(this,NaN),Tl(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}withTimeZone(t){return new e(+this,t)}getTimezoneOffset(){let e=-bl(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),Tl(this),+this}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},wl=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!wl.test(e))return;let t=e.replace(wl,`$1UTC`);Cl.prototype[t]&&(e.startsWith(`get`)?Cl.prototype[e]=function(){return this.internal[t]()}:(Cl.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),El(this),+this},Cl.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),Tl(this),+this}))});function Tl(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-bl(e.timeZone,e)*60))}function El(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),Dl(e)}function Dl(e){let t=bl(e.timeZone,e),n=t>0?Math.floor(t):Math.ceil(t),r=new Date(+e);r.setUTCHours(r.getUTCHours()-1);let i=-new Date(+e).getTimezoneOffset(),a=i- -new Date(+r).getTimezoneOffset(),o=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();a&&o&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+a);let s=i-n;s&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+s);let c=new Date(+e);c.setUTCSeconds(0);let l=i>0?c.getSeconds():(c.getSeconds()-60)%60,u=Math.round(-(bl(e.timeZone,e)*60))%60;(u||l)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+u),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+u+l));let d=bl(e.timeZone,e),f=d>0?Math.floor(d):Math.ceil(d),p=-new Date(+e).getTimezoneOffset()-f,m=f!==n,h=p-s;if(m&&h){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+h);let t=bl(e.timeZone,e),n=f-(t>0?Math.floor(t):Math.ceil(t));n&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+n),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+n))}}var Ol=class e extends Cl{static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}toISOString(){let[e,t,n]=this.tzComponents(),r=`${e}${t}:${n}`;return this.internal.toISOString().slice(0,-1)+r}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){let[e,t,n,r]=this.internal.toUTCString().split(` `);return`${e?.slice(0,-1)} ${n} ${t} ${r}`}toTimeString(){let e=this.internal.toUTCString().split(` `)[4],[t,n,r]=this.tzComponents();return`${e} GMT${t}${n}${r} (${_l(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}tzComponents(){let e=this.getTimezoneOffset();return[e>0?`-`:`+`,String(Math.floor(Math.abs(e)/60)).padStart(2,`0`),String(Math.abs(e)%60).padStart(2,`0`)]}withTimeZone(t){return new e(+this,t)}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}};window.pktTz=window.pktTz===void 0?`Europe/Oslo`:window.pktTz;var kl=(e=window.pktTz)=>{let t=new Ol(new Date().toISOString(),e);return t.setHours(0,0,0,0),isNaN(t.getTime())?new Date:new Date(t.getFullYear(),t.getMonth(),t.getDate())};function Al(e){if(!e||e===``)return new Date;if(/^\d{4}-\d{2}-\d{2}$/.test(e)){let[t,n,r]=e.split(`-`).map(Number);return new Date(t,n-1,r)}if(/^\d{4}-\d{2}$/.test(e)){let[t,n]=e.split(`-`).map(Number);return new Date(t,n-1,1)}return/^\d{4}$/.test(e)?new Date(Number(e),0,1):new Date(e)}var jl=e=>!e||isNaN(e.getTime())?``:`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`,Ml=e=>{if(!e)return null;let t=Al(e);return isNaN(t.getTime())?null:t},Nl=(e,t)=>{let n=Pl(e);return isNaN(n.getTime())?``:ml(n,t)},Pl=(e=``,t)=>{let n=typeof e==`string`?Al(e):e;return!n||isNaN(n.getTime())?new Date:t?t===`end`?wc(n):yc(n):n},Fl=(e,t,n=1)=>{if(typeof e!=`number`||typeof t!=`number`||typeof n!=`number`||isNaN(e)||isNaN(t)||isNaN(n))return new Date;let r=new Date(e,t,n);return isNaN(r.getTime())?new Date:r},Il=e=>{let t;return t=new Ol(e,window.pktTz),t.setHours(12,0,0,0),t},Ll=null,Rl=void 0,zl=e=>{if(!e||isNaN(e.getTime()))return``;let t=typeof window<`u`?window.pktTz:void 0;return(!Ll||Rl!==t)&&(Ll=new Intl.DateTimeFormat(`no`,{dateStyle:`full`,timeZone:t}),Rl=t),Ll.format(e)},Bl=(e,t,n)=>{if(!e||isNaN(e.getTime()))return!1;let r=t?Pl(t):null,i=n?Pl(n):null;return!(r&&e<r||i&&e>i)},Vl=(e,t)=>{if(!e||isNaN(e.getTime())||!Array.isArray(t))return!1;let n=jl(e);return t.includes(n)},Hl=(e,t)=>{if(!e||isNaN(e.getTime())||!Array.isArray(t))return!1;let n=e.getDay().toString();return t.includes(n)},Ul=(e,t,n,r,i)=>!(!e||isNaN(e.getTime())||!Bl(e,t,n)||r&&Vl(e,r)||i&&Hl(e,i)),Wl=(e,t,n,r,i)=>e.filter(e=>{let a=Ml(e);return a&&Ul(a,t,n,r,i)}),Gl=e=>e.slice().sort((e,t)=>{let n=Ml(e),r=Ml(t);return!n||!r?0:n.getTime()-r.getTime()}),Kl=(e,t)=>{let n=Ml(e),r=Ml(t);return!n||!r?!1:n<=r};function ql(e,t){let n=(t.excludedates??[]).map(e=>typeof e==`string`?e:jl(e));return!Ul(e,t.earliest,t.latest,n,t.excludeweekdays??[])}function Jl(e,t,n,r){return!!(ql(e,n)||!t&&r.multiple&&r.maxMultiple>0&&r.selectedCount>=r.maxMultiple)}function Yl(e,t,n){let r=Fl(e,t,0);return!(n&&Pl(n)>r)}function Xl(e,t,n){let r=Fl(t===11?e+1:e,t===11?0:t+1,1);return!(n&&Pl(n)<r)}function Zl(e){return typeof e==`string`&&(e=e.split(`,`)),e.length===1&&e[0]===``?[]:e.map(e=>Al(e))}function Ql(e,t){let n=Ec({start:e,end:t}),r={};if(Array.isArray(n)&&n.length)for(let i=0;i<n.length;i++){let a=n[i],o=a>e&&a<t;r[jl(a)]=o}return r}function $l(e,t,n,r){if(t.length!==1)return!0;let i=Ec({start:t[0],end:e});if(!Array.isArray(i)||!i.length)return!0;for(let a=0;a<i.length;a++){for(let r of n??[])if(r>t[0]&&r<e)return!1;if((r??[]).includes(gl(i[a]).toString()))return!1}return!0}function eu(e,t){let n=jl(e);return t.includes(n)?t:[...t,n]}function tu(e,t){let n=jl(e),r=t.indexOf(n);if(r===-1)return t;if(t.length===1)return[];let i=[...t];return i.splice(r,1),i}function nu(e,t,n){let r=jl(e);return t.includes(r)?tu(e,t):n>0&&t.length>=n?t:eu(e,t)}function ru(e,t,n){let r=jl(e),i=Zl(t);return t.includes(r)?t.indexOf(r)===0?[]:tu(e,t):t.length>1||t.length===1&&(!$l(e,i,n.excludedates,n.excludeweekdays)||i[0]>e)?[r]:eu(e,t)}function iu(e,t){let n=Fl(e,t,1),r=Fl(e,t+1,0),i=(n.getDay()+6)%7,a=r.getDate();return{firstDayOfMonth:n,lastDayOfMonth:r,startingDay:i,numDays:a,numRows:Math.ceil((a+i)/7),numDaysPrevMonth:Fl(e,t,0).getDate(),initialWeek:Gc(n)}}function au(e,t,n,r){let{startingDay:i,numDays:a}=r;return e===0&&t<i?`prev-month`:n>a?`next-month`:`current-month`}function ou(e,t,n,r){let{startingDay:i,numDaysPrevMonth:a,numDays:o}=r;return e===`prev-month`?a-(i-t-1):e===`next-month`?n-o:n}var su={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7};function cu(e){let t=e.nodeName;return t===`INPUT`||t===`SELECT`||t===`BUTTON`&&!e.dataset?.date}function lu(e,t,n){let r=dc(e,t);if(!r)return null;let i=n(`button[data-date="${jl(r)}"]`);for(;i instanceof HTMLButtonElement&&i.dataset.disabled;)if(r=dc(r,t),i=n(`button[data-date="${jl(r)}"]`),!i)return null;return r}function uu(e){return su[e]??null}var du={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 fu(e){let{selected:n,multiple:r=!1,maxMultiple:i=0,range:a=!1,earliest:o=null,latest:s=null,excludedates:c,excludeweekdays:l=[],weeknumbers:u=!1,withcontrols:d=!1,currentmonth:f,today:p,strings:m,onDateSelected:h,onClose:g,id:_,className:v}=e,y=(0,t.useId)(),b=_??y,x=(0,t.useMemo)(()=>({...du,...m}),[m]),S=(0,t.useMemo)(()=>p?Al(p):kl(),[p]),C=(0,t.useMemo)(()=>c?c.map(e=>typeof e==`string`?Al(e):e):[],[c]),w=n!==void 0,[ee,T]=(0,t.useState)([]),E=w?n:ee,te=(0,t.useMemo)(()=>Zl(E),[E]),[ne,re]=(0,t.useState)(0),[D,ie]=(0,t.useState)(0),[ae,oe]=(0,t.useState)({}),[se,ce]=(0,t.useState)(null),[O,le]=(0,t.useState)(null),k=(0,t.useRef)(null),A=(0,t.useRef)([]),ue=(0,t.useRef)(0),de=(0,t.useRef)(!1),j=(0,t.useRef)(!1),M=(0,t.useMemo)(()=>({earliest:o,latest:s,excludedates:C,excludeweekdays:l}),[o,s,C,l]);(0,t.useEffect)(()=>{let e=null;if(f!=null&&(f instanceof Date?e=Il(f):typeof f==`string`&&(e=Al(f))),!e||isNaN(e.getTime()))if(E.length>0&&E[0]!==``){let t=Al(E[E.length-1]);e=isNaN(t.getTime())?Il(S):t}else e=Il(S);if((!e||isNaN(e.getTime()))&&(e=Il(S)),s){let t=typeof s==`string`?Al(s):s;!isNaN(t.getTime())&&e>t&&(e=t)}if(o){let t=typeof o==`string`?Al(o):o;!isNaN(t.getTime())&&e<t&&(e=t)}re(e.getFullYear()),ie(e.getMonth()),j.current=!0},[]),(0,t.useEffect)(()=>{if(j.current&&!de.current&&E.length>0&&E[0]!==``){let e=Al(E[E.length-1]);isNaN(e.getTime())||(re(e.getFullYear()),ie(e.getMonth()))}},[E]),(0,t.useEffect)(()=>{a&&te.length===2?oe(Ql(te[0],te[1])):(!a||te.length<2)&&oe({})},[a,te]);let N=(0,t.useCallback)(e=>{w||T(e),h?.(e)},[w,h]),P=(0,t.useCallback)(()=>{g?.()},[g]),F=(0,t.useCallback)((e,t)=>{re(typeof e==`string`?parseInt(e):e),ie(typeof t==`string`?parseInt(t):t),ue.current=0,le(null),A.current=[],de.current=!0},[]),I=(0,t.useCallback)(()=>{let e=D===0?11:D-1;F(D===0?ne-1:ne,e)},[ne,D,F]),fe=(0,t.useCallback)(()=>{let e=D===11?0:D+1;F(D===11?ne+1:ne,e)},[ne,D,F]),pe=(0,t.useCallback)(e=>ql(e,M),[M]),L=(0,t.useCallback)((e,t)=>Jl(e,t,M,{multiple:r,maxMultiple:i,selectedCount:E.length}),[M,r,i,E.length]),R=(0,t.useCallback)(()=>typeof E==`string`?E.split(`,`):E,[E]),me=(0,t.useCallback)(e=>{if(!a||te.length!==1||!$l(e,te,C,l)||te[0]>=e){ce(null);return}ce(e),oe(Ql(te[0],e))},[a,te,C,l]),he=(0,t.useCallback)(e=>{if(!e)return;let t;if(a)t=ru(e,R(),{excludedates:C,excludeweekdays:l}),w||T(t),t.length===2?(h?.(t),P()):(t.length===1&&oe({}),h?.(t));else if(r)t=nu(e,R(),i),N(t);else{let n=jl(e);t=E.includes(n)?[]:[n],N(t),P()}},[a,r,i,R,E,C,l,w,N,P,h]),z=(0,t.useCallback)(e=>{let t=eu(e,R());w||T(t),a&&t.length===2&&(h?.(t),P())},[R,w,a,h,P]),B=(0,t.useCallback)(e=>{let t=tu(e,R());w||T(t)},[R,w]),V=(0,t.useCallback)(e=>{let t=nu(e,R(),i);w||T(t)},[R,i,w]),ge=(0,t.useCallback)(()=>{let e=jl(Il(S)),t=k.current?.querySelector(`button[data-date="${e}"]`);if(t instanceof HTMLButtonElement){le(e),t.focus();return}let n=A.current.find(e=>!e.isDisabled);if(n){let e=k.current?.querySelector(`button[data-date="${n.currentDateISO}"]`);e instanceof HTMLButtonElement&&(le(n.currentDateISO),e.focus())}},[]),H=(0,t.useCallback)((e,t)=>{let n=e.target;if(cu(n))return;if(e.preventDefault(),!O){ge();return}let r=lu(Pl(O),t,k.current.querySelector.bind(k.current));if(r){let e=k.current.querySelector(`button[data-date="${jl(r)}"]`);e instanceof HTMLButtonElement&&!e.dataset.disabled&&(le(jl(r)),e.focus())}},[O,ge]);return{componentId:b,strings:x,todayDate:S,year:ne,month:D,activeSelected:E,_selected:te,inRange:ae,rangeHovered:se,focusedDate:O,range:a,multiple:r,weeknumbers:u,withcontrols:d,earliest:o,latest:s,excludedates:C,excludeweekdays:l,className:v,dateConstraints:M,calendarRef:k,selectableDatesRef:A,tabIndexSetRef:ue,prevMonth:I,nextMonth:fe,changeMonth:F,handleDateSelect:he,addToSelected:z,removeFromSelected:B,toggleSelectedDate:V,handleRangeHover:me,isExcluded:pe,isDayDisabled:L,focusOnCurrentDate:ge,handleKeydown:(0,t.useCallback)(e=>{if(e.key===`Escape`){e.preventDefault(),P();return}let t=uu(e.key);t!==null&&H(e.nativeEvent,t)},[P,H]),handleFocusOut:(0,t.useCallback)(e=>{k.current&&!k.current.contains(e.relatedTarget)&&!e.target.classList.contains(`pkt-hide`)&&P()},[P]),close:P,setFocusedDate:le}}var pu=({componentId:e,strings:t,year:r,month:i,earliest:a,latest:o,withcontrols:s,prevMonth:c,nextMonth:l,changeMonth:u})=>{let d=e=>{let s=e===`prev`,u=s?Yl(r,i,a):Xl(r,i,o),d=s?t.prevMonth:t.nextMonth,f=s?`chevron-thin-left`:`chevron-thin-right`,p=s?`pkt-calendar__prev-month`:`pkt-calendar__next-month`,m=s?c:l;return(0,n.jsx)(`div`,{children:(0,n.jsxs)(`button`,{type:`button`,"aria-label":d,onClick:()=>u&&m(),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),u&&m())},className:[`pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only`,p,!u&&`pkt-invisible`].filter(Boolean).join(` `),"data-disabled":u?void 0:`disabled`,"aria-disabled":!u||void 0,tabIndex:u?0:-1,children:[(0,n.jsx)(Q,{className:`pkt-btn__icon`,name:f}),(0,n.jsx)(`span`,{className:`pkt-btn__text`,children:d})]})})};return(0,n.jsxs)(`nav`,{className:`pkt-cal-month-nav`,children:[d(`prev`),s?(0,n.jsxs)(`div`,{className:`pkt-cal-month-picker`,children:[(0,n.jsx)(`label`,{htmlFor:`${e}-monthnav`,className:`pkt-hide`,children:t.month}),(0,n.jsx)(`select`,{"aria-label":t.month,className:`pkt-input pkt-input-compact`,id:`${e}-monthnav`,value:i,onChange:e=>{e.stopPropagation(),u(r,parseInt(e.target.value))},children:t.months.map((e,t)=>(0,n.jsx)(`option`,{value:t,children:e},t))}),(0,n.jsx)(`label`,{htmlFor:`${e}-yearnav`,className:`pkt-hide`,children:t.year}),(0,n.jsx)(`input`,{"aria-label":t.year,className:`pkt-input pkt-cal-input-year pkt-input-compact`,id:`${e}-yearnav`,type:`number`,size:4,placeholder:`0000`,value:r,onChange:e=>{e.stopPropagation(),u(parseInt(e.target.value),i)}})]}):(0,n.jsxs)(`div`,{className:`pkt-txt-16-medium pkt-calendar__month-title`,"aria-live":`polite`,children:[t.months[i],` `,r]}),d(`next`)]})};function mu(e,t,n){let r=Fl(n.year,n.month,e),i=jl(r),a=i===jl(t),o=n.activeSelected.includes(i),s=n.isDayDisabled(r,o),c;return n.focusedDate?c=n.focusedDate===i&&!s?`0`:`-1`:!s&&n.tabIndexSetRef.current===0?(n.tabIndexSetRef.current=e,c=`0`):c=n.tabIndexSetRef.current===e?`0`:`-1`,{currentDate:r,currentDateISO:i,isToday:a,isSelected:o,isDisabled:s,ariaLabel:zl(r),tabindex:c}}function hu(e,t){let{currentDateISO:n,isToday:r,isSelected:i}=e,a=t.range&&(t.activeSelected.length===2||t.rangeHovered!==null)&&n===t.activeSelected[0],o=t.range&&t.activeSelected.length===2&&n===t.activeSelected[1];return(0,$.default)({"pkt-cal-today":r,"pkt-cal-selected":i,"pkt-cal-in-range":t.inRange[n],"pkt-cal-excluded":t.isExcluded(e.currentDate),"pkt-cal-in-range-first":a,"pkt-cal-in-range-last":o,"pkt-cal-range-hover":t.rangeHovered!==null&&n===jl(t.rangeHovered)})}function gu(e,t){let{currentDateISO:n,isToday:r,isSelected:i,isDisabled:a}=e,o=t.range&&(t.activeSelected.length===2||t.rangeHovered!==null)&&n===t.activeSelected[0],s=t.range&&t.activeSelected.length===2&&n===t.activeSelected[1];return(0,$.default)({"pkt-calendar__date":!0,"pkt-calendar__date--today":r,"pkt-calendar__date--selected":i,"pkt-calendar__date--disabled":a,"pkt-calendar__date--in-range":t.inRange[n],"pkt-calendar__date--in-range-hover":t.rangeHovered!==null&&n===jl(t.rangeHovered),"pkt-calendar__date--range-start":o,"pkt-calendar__date--range-end":s})}var _u=({state:e})=>{let{strings:t,year:r,month:i,activeSelected:a,focusedDate:o,inRange:s,rangeHovered:c,range:l,multiple:u,weeknumbers:d,selectableDatesRef:f,tabIndexSetRef:p,handleDateSelect:m,handleRangeHover:h,isExcluded:g,isDayDisabled:_,setFocusedDate:v,todayDate:y}=e,b={year:r,month:i,activeSelected:a,focusedDate:o,tabIndexSetRef:p,isDayDisabled:_},x={range:l,activeSelected:a,rangeHovered:c,inRange:s,isExcluded:g},S=()=>{let e=[];d&&e.push((0,n.jsx)(`th`,{children:(0,n.jsx)(`div`,{className:`pkt-calendar__week-number`,children:t.week})},`week-header`));for(let r=0;r<t.daysShort.length;r++)e.push((0,n.jsx)(`th`,{children:(0,n.jsx)(`div`,{className:`pkt-calendar__day-name`,"aria-label":t.days[r],children:t.daysShort[r]})},`day-${r}`));return(0,n.jsx)(`tr`,{className:`pkt-cal-week-row`,children:e})},C=(e,t)=>{let r=mu(e,t,b),{currentDate:i,currentDateISO:a,isSelected:o,isDisabled:s,ariaLabel:c,tabindex:u}=r;f.current.push({currentDateISO:a,isDisabled:s,tabindex:u});let d=hu(r,x),p=gu(r,x);return(0,n.jsx)(`td`,{className:d,children:(0,n.jsx)(`button`,{type:`button`,"aria-pressed":o?`true`:`false`,disabled:s,className:`pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only ${p}`,onMouseOver:()=>l&&!g(i)&&h(i),onFocus:()=>{l&&!g(i)&&h(i),v(a)},"aria-label":c,tabIndex:parseInt(u),"data-disabled":s?`disabled`:void 0,"data-date":a,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),m(i))},onClick:e=>{s||(e.preventDefault(),m(i))},children:(0,n.jsx)(`span`,{className:`pkt-btn__text pkt-txt-14-light`,children:e})})},a)},w=(e,t)=>(0,n.jsx)(`td`,{className:`pkt-cal-other`,children:(0,n.jsx)(`div`,{className:`pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only`,"data-disabled":`disabled`,children:(0,n.jsx)(`span`,{className:`pkt-btn__text pkt-txt-14-light`,children:e})})},t);return(0,n.jsxs)(`table`,{className:`pkt-cal-days pkt-txt-12-medium pkt-calendar__body`,role:`grid`,"aria-multiselectable":l||u||void 0,children:[(0,n.jsx)(`thead`,{children:S()}),(0,n.jsx)(`tbody`,{children:(()=>{let e=y,t=iu(r,i);f.current=[],p.current=0;let a=1,o=t.initialWeek,s=[];for(let r=0;r<t.numRows;r++){let i=[];d&&i.push((0,n.jsx)(`td`,{className:`pkt-cal-week`,children:o},`week-${o}`)),o++;for(let n=0;n<7;n++){let o=au(r,n,a,t);if(o===`current-month`)i.push(C(a,e)),a++;else{let e=ou(o,n,a,t);i.push(w(e,`${o}-${r}-${n}`)),o===`next-month`&&a++}}s.push((0,n.jsx)(`tr`,{className:`pkt-cal-week-row`,role:`row`,children:i},`row-${r}`))}return s})()})]})},vu=(0,t.forwardRef)((e,r)=>{let i=fu(e);return(0,t.useImperativeHandle)(r,()=>({handleDateSelect:i.handleDateSelect,addToSelected:i.addToSelected,removeFromSelected:i.removeFromSelected,toggleSelected:i.toggleSelectedDate,focusOnCurrentDate:i.focusOnCurrentDate,close:i.close}),[i.handleDateSelect,i.addToSelected,i.removeFromSelected,i.toggleSelectedDate,i.focusOnCurrentDate,i.close]),(0,n.jsxs)(`div`,{ref:i.calendarRef,className:[`pkt-calendar`,i.weeknumbers&&`pkt-cal-weeknumbers`,i.className].filter(Boolean).join(` `),onBlur:i.handleFocusOut,onKeyDown:i.handleKeydown,children:[(0,n.jsx)(pu,{componentId:i.componentId,strings:i.strings,year:i.year,month:i.month,earliest:i.earliest,latest:i.latest,withcontrols:i.withcontrols,prevMonth:i.prevMonth,nextMonth:i.nextMonth,changeMonth:i.changeMonth}),(0,n.jsx)(_u,{state:i})]})});vu.displayName=`PktCalendar`;var yu=(0,t.forwardRef)(({children:e,skin:r,textStyle:i,size:a,closeTag:o,className:s,iconName:c,ariaLabel:l,onClose:u,type:d,"aria-description":f,...p},m)=>{let[h,g]=(0,t.useState)(!1),_=(0,t.useCallback)(()=>{g(!0),u&&u()},[u]),v=(0,t.useRef)(null),[y,b]=(0,t.useState)(``);(0,t.useEffect)(()=>{b(v.current?.textContent?.trim()??``)},[e]);let x=(0,t.useMemo)(()=>{if(o&&!l)return y&&`Klikk for å fjerne ${y}`||f},[o,l,y,f]),S={"pkt-tag":!0,[`pkt-tag--${a}`]:!!a,[`pkt-tag--${r}`]:!!r,[`pkt-tag--${i}`]:!!i},C={"pkt-tag":!0,"pkt-btn":!0,"pkt-btn--tertiary":!0,[`pkt-tag--${i}`]:!!i,[`pkt-tag--${a}`]:!!a,[`pkt-tag--${r}`]:!!r,"pkt-btn--icons-right-and-left":o&&!!c,"pkt-hide":h};return o?(0,n.jsxs)(`button`,{...p,className:(0,$.default)(C,s),type:d,onClick:_,"aria-label":l,"aria-description":x,ref:m,children:[c&&(0,n.jsx)(Q,{className:`pkt-tag__icon`,name:c}),(0,n.jsx)(`span`,{ref:v,children:e}),(0,n.jsx)(Q,{className:`pkt-tag__close-btn`,name:`close`})]}):(0,n.jsxs)(`span`,{...p,className:(0,$.default)(S,s),ref:m,children:[c&&(0,n.jsx)(Q,{className:`pkt-tag__icon`,name:c,"aria-hidden":`true`}),(0,n.jsx)(`span`,{ref:v,children:e})]})});yu.displayName=`PktTag`;var bu=(0,t.forwardRef)(({children:e,className:t,ariaLabel:r,metaLead:i,borderOnHover:a=!0,metaTrail:o,layout:s=`vertical`,heading:c=``,headingLevel:l=3,image:u,imageShape:d=`square`,clickCardLink:f,padding:p=`default`,openLinkInNewTab:m=!1,skin:h=`outlined`,subheading:g=``,tagPosition:_=`top`,tags:v=[],...y},b)=>{let x=(0,$.default)({"pkt-card":!0,[`pkt-card--${h}`]:h,[`pkt-card--${s}`]:s,[`pkt-card--padding-${p}`]:p,"pkt-card--border-on-hover":a}),S=r?.trim()||(c?`${c} lenkekort`:`lenkekort`),C=r?.trim()||c||`kort`,w=`h${l}`,ee=()=>u?.src?(0,n.jsx)(`div`,{className:(0,$.default)(`pkt-card__image`,`pkt-card__image-${d}`),children:(0,n.jsx)(`img`,{src:u.src,alt:u.alt||``})}):null,T=()=>v.length===0?null:(0,n.jsx)(`div`,{className:(0,$.default)(`pkt-card__tags`,`pkt-card__tags-${_}`),role:`list`,"aria-label":v.length>1?`merkelapper`:`merkelapp`,children:v.map((e,t)=>(0,n.jsx)(yu,{role:`listitem`,textStyle:`normal-text`,size:`medium`,skin:e.skin,iconName:e.iconName,children:(0,n.jsx)(`span`,{children:e.text})},t))}),E=()=>!c||f?null:(0,n.jsx)(w,{className:`pkt-heading pkt-heading--medium pkt-heading--fw-regular pkt-card__heading`,children:c}),te=()=>f?(0,n.jsx)(w,{className:`pkt-heading pkt-heading--medium pkt-heading--fw-regular pkt-card__link-heading pkt-card__heading`,children:(0,n.jsx)(`a`,{className:`pkt-card__link`,href:f,target:m?`_blank`:`_self`,rel:m?`noopener noreferrer`:void 0,children:c})}):null,ne=()=>g?(0,n.jsx)(`p`,{className:`pkt-card__subheading`,children:g}):null,re=()=>!c&&!g?null:(0,n.jsxs)(`header`,{className:`pkt-card__header`,children:[E(),te(),ne()]}),D=()=>!i&&!o?null:(0,n.jsxs)(`footer`,{className:`pkt-card__metadata`,children:[i&&(0,n.jsx)(`span`,{className:`pkt-card__metadata-lead`,children:i}),o&&(0,n.jsx)(`span`,{className:`pkt-card__metadata-trail`,children:o})]});return(0,n.jsx)(`div`,{ref:b,className:(0,$.default)(`pkt-card-root`,t),style:{display:`block`,width:`100%`},children:(0,n.jsxs)(`article`,{...y,className:x,"aria-label":f?S:C,children:[ee(),(0,n.jsxs)(`div`,{className:`pkt-card__wrapper`,children:[_===`top`&&T(),re(),(0,n.jsx)(`section`,{className:`pkt-card__content`,children:e}),_===`bottom`&&T(),D()]})]})})});bu.displayName=`PktCard`;var xu=(0,t.forwardRef)(({id:e,hasTile:r=!1,disabled:i=!1,label:a,checkHelptext:o,hasError:s=!1,className:c,isSwitch:l=!1,hideLabel:u=!1,labelPosition:d=`right`,defaultChecked:f,checked:p,indeterminate:m,optionalTag:h,optionalText:g=`Valgfritt`,requiredTag:_,requiredText:v=`Må fylles ut`,tagText:y,...b},x)=>{let S=(0,t.useRef)(null);(0,t.useEffect)(()=>{S.current&&m!==void 0&&(S.current.indeterminate=m)},[m]),(0,t.useEffect)(()=>{typeof x==`function`?x(S.current):x&&(x.current=S.current)},[x]);let C=[c,`pkt-input-check`].filter(Boolean).join(` `),w=[`pkt-input-check__input-label`,i?`pkt-input-check__input-label--disabled`:``,`pkt-input-check__input-label--${d}`,u?`pkt-sr-only`:``].filter(Boolean).join(` `),ee=[`pkt-input-check__input`,r?`pkt-input-check__input--tile`:``,i&&r?`pkt-input-check__input--tile-disabled`:``].filter(Boolean).join(` `),T=[`pkt-tag`,`pkt-tag--small`,`pkt-tag--thin-text`].join(` `),E=()=>(0,n.jsxs)(n.Fragment,{children:[y&&(0,n.jsx)(`span`,{className:T+` pkt-tag--gray`,children:y}),h&&(0,n.jsx)(`span`,{className:T+` pkt-tag--blue-light`,children:g}),_&&(0,n.jsx)(`span`,{className:T+` pkt-tag--beige`,children:v})]});return(0,n.jsx)(`div`,{className:C,children:(0,n.jsxs)(`div`,{className:ee,children:[d===`left`&&(0,n.jsxs)(`label`,{className:w,htmlFor:e,children:[a,` `,E(),o&&(0,n.jsx)(`div`,{className:`pkt-input-check__input-helptext`,children:o})]}),(0,n.jsx)(`input`,{role:l?`switch`:`checkbox`,ref:S,className:`pkt-input-check__input-checkbox ${s?`pkt-input-check__input-checkbox--error`:``}`,type:`checkbox`,id:e,disabled:i,...p===void 0?{defaultChecked:f}:{checked:p},...b}),d===`right`&&(0,n.jsxs)(`label`,{className:w,htmlFor:e,children:[a,` `,E(),o&&(0,n.jsx)(`div`,{className:`pkt-input-check__input-helptext`,children:o})]})]})})});xu.displayName=`PktCheckbox`;function Su(e){let n=(0,t.useRef)(null),r=(0,t.useRef)(!1),i=(0,t.useRef)(void 0),a=e=>{let t=n.current;t&&(e===void 0?delete t.dataset.navtype:t.dataset.navtype=e)};return(0,t.useEffect)(()=>()=>{i.current!==void 0&&clearTimeout(i.current)},[]),{ref:t=>{n.current=t,typeof e==`function`?e(t):e&&(e.current=t)},onPointerDown:()=>{r.current=!0,i.current!==void 0&&clearTimeout(i.current),i.current=window.setTimeout(()=>{r.current=!1,i.current=void 0},0)},onFocus:()=>{a(r.current?`pointer`:void 0)},onBlur:e=>{n.current?.contains(e.relatedTarget)||a(void 0)}}}var Cu=(0,t.forwardRef)(({forId:e,label:r,helptext:i,helptextDropdown:a,helptextDropdownButton:o,counter:s,counterCurrent:c=0,counterMaxLength:l,optionalTag:u=!1,optionalText:d=`Valgfritt`,requiredTag:f=!1,requiredText:p=`Må fylles ut`,tagText:m=null,hasError:h=!1,errorMessage:g,disabled:_=!1,inline:v=!1,ariaDescribedby:y,useWrapper:b=!0,children:x,className:S=``,hasFieldset:C=!1,role:w=`group`,counterPosition:ee=`bottom`},T)=>{let[E,te]=(0,t.useState)(!1),ne=Su(T),re=y||(i?`${e}-helptext`:void 0),D=!!s,ie=D&&ee===`top`,ae=D&&ee===`bottom`,oe=()=>te(e=>!e),se=[`pkt-inputwrapper`,S,h?`pkt-inputwrapper--error`:``,_?`pkt-inputwrapper--disabled`:``,v?`pkt-inputwrapper--inline`:``].filter(Boolean).join(` `),ce=[`pkt-tag`,`pkt-tag--small`,`pkt-tag--thin-text`].join(` `),O=()=>D?(0,n.jsxs)(`div`,{className:`pkt-input__counter`,"aria-live":`polite`,"aria-atomic":`true`,children:[c,l?`/${l}`:``]}):null,le=()=>(0,n.jsxs)(n.Fragment,{children:[m&&(0,n.jsx)(`span`,{className:ce+` pkt-tag--gray`,children:m}),u&&(0,n.jsx)(`span`,{className:ce+` pkt-tag--blue-light`,children:d}),f&&(0,n.jsx)(`span`,{className:ce+` pkt-tag--beige`,children:p})]}),k=(0,n.jsxs)(n.Fragment,{children:[(()=>{let t=(0,n.jsxs)(n.Fragment,{children:[r,` `,le()]});return b?C?(0,n.jsx)(`legend`,{className:`pkt-inputwrapper__legend`,id:`${e}-label`,children:t}):(0,n.jsx)(`label`,{className:`pkt-inputwrapper__label`,htmlFor:e,"aria-describedby":re,id:`${e}-label`,children:t}):(0,n.jsx)(`label`,{htmlFor:e,className:`pkt-sr-only`,"aria-describedby":re,id:`${e}-label`,children:r})})(),!i&&!a?null:(0,n.jsxs)(n.Fragment,{children:[i&&b&&(0,n.jsx)(`div`,{className:`pkt-inputwrapper__helptext`,id:`${e}-helptext`,children:i}),a&&(0,n.jsxs)(`div`,{className:`pkt-inputwrapper__helptext-expandable`,children:[(0,n.jsx)(rc,{skin:`tertiary`,size:`small`,variant:`icon-right`,iconName:E?`chevron-thin-up`:`chevron-thin-down`,className:`pkt-link pkt-link--icon-right`,onClick:oe,children:(0,n.jsx)(`span`,{dangerouslySetInnerHTML:{__html:o??`Les mer <span class="pkt-sr-only">om inputfeltet</span>`}})}),(0,n.jsx)(`div`,{className:`pkt-inputwrapper__helptext ${E?`pkt-inputwrapper__helptext-expandable-open`:`pkt-inputwrapper__helptext-expandable-closed`}`,children:a})]})]}),ie&&(0,n.jsx)(O,{}),x,ae&&(0,n.jsx)(O,{}),h&&g&&(0,n.jsx)(`div`,{className:`pkt-inputwrapper__alert-wrapper`,children:(0,n.jsx)(ec,{skin:`error`,"aria-live":`assertive`,role:`alert`,id:`${e}-error`,compact:!0,children:g})})]});return(0,n.jsx)(`div`,{className:se,role:w,...ne,children:C?(0,n.jsx)(`fieldset`,{className:`pkt-inputwrapper__fieldset`,"aria-describedby":re,children:k}):(0,n.jsx)(`div`,{className:`pkt-inputwrapper__fieldset`,children:k})})});Cu.displayName=`PktInputWrapper`;var wu=(e,t)=>t&&(e.find(e=>e.value===t)||e.find(e=>e.label===t))||null,Tu=(e,t)=>{if(!t)return-1;let n=e.findIndex(e=>e.value===t);return n>=0?n:e.findIndex(e=>e.label===t)},Eu=(e,t)=>{if(!t)return[...e];let n=t.toLowerCase();return e.filter(e=>(e.fulltext||e.value+(e.label||``)+(e.prefix||``)).toLowerCase().includes(n))},Du=e=>e.value+(e.label||``)+(e.prefix||``),Ou=(e,t)=>t!==null&&e>=t,ku=(e,t)=>{if(!e)return``;switch(t){case`prefixAndValue`:return`${e.prefix||``} ${e.value}`.trim();case`value`:return e.value;default:return e.label||e.value}},Au=(e,t)=>e?Array.isArray(e)?t?e:e.length>0?[e[0]]:[]:t?e.split(`,`).filter(Boolean):[e]:[],ju=(e,t)=>{if(!t)return{filtered:[...e],suggestion:null};let n=t.toLowerCase(),r=e.filter(e=>e.fulltext?.toLowerCase().includes(n));return{filtered:r,suggestion:r.find(e=>!e.selected&&e.label?.toLowerCase().startsWith(n))||null}},Mu=(e,t,n,r)=>{if(!e.trim())return{addValueText:null,userInfoMessage:``};let i=e.trim().toLowerCase(),a=t.find(e=>e.toLowerCase()===i),o=n.filter(e=>e.label?.toLowerCase().includes(i)||e.value.toLowerCase().includes(i)),s=o.find(e=>e.label?.toLowerCase()===i||e.value.toLowerCase()===i);return(o.length===0||!s)&&r?{addValueText:e,userInfoMessage:``}:o.length===0&&!r?{addValueText:null,userInfoMessage:`Ingen treff i søket`}:a?{addValueText:null,userInfoMessage:`Verdien er allerede valgt`}:{addValueText:null,userInfoMessage:``}},Nu=(e,t,n)=>{switch(e){case`,`:return n?`addValue`:null;case`Enter`:return`addValue`;case`Tab`:case`ArrowDown`:return t?null:`focusListbox`;case`Escape`:return`closeOptions`;default:return null}},Pu=(e,t,n,r,i)=>{if(!e)return{action:`none`,value:null};let a=wu(n,e);return!t.includes(e)&&!a?r?{action:`addUserValue`,value:e}:i?{action:`none`,value:null}:{action:`removeValue`,value:t[0]}:a&&!t.includes(a.value)?{action:`selectOption`,value:a.value}:{action:`none`,value:null}},Fu=(e,t,n)=>{let r=wu(t,e);return n===`label`&&r?.label?r.label:e},Iu=e=>{e.scrollIntoView({block:`nearest`}),window.setTimeout(()=>e.focus(),0)},Lu=e=>Array.from(e.querySelectorAll(`[role="option"]:not([data-disabled])`)||[]),Ru=e=>{let t=e.nextElementSibling;t&&Iu(t)},zu=(e,t,n)=>{let r=e.previousElementSibling;if(e.dataset.index===`0`&&n){let e=t.querySelector(`[role="searchbox"]`);e&&Iu(e)}else r&&Iu(r)},Bu=e=>{let t=Lu(e);t[0]&&Iu(t[0])},Vu=(e,t)=>{if(t.disabled)return;let n=Lu(e);if(t.allowUserInput&&t.customUserInput){let t=e.querySelector(`[data-type="new-option"]`);if(t){Iu(t);return}}let r=n.find(e=>e.dataset.selected===`true`);if(r){Iu(r);return}if(t.includeSearch&&!(document.activeElement instanceof HTMLInputElement)){let t=e.querySelector(`[role="searchbox"]`);if(t){window.setTimeout(()=>t.focus(),0);return}}n[0]&&Iu(n[0])},Hu=({state:e,outside:r=!1})=>{let{values:i,options:a,disabled:o,displayValueAs:s,handleTagRemove:c,handleTagKeydown:l,focusedTagIndex:u}=e,d=(0,t.useRef)([]);if((0,t.useEffect)(()=>{!r&&u>=0&&u<i.length&&d.current[u]?.focus()},[r,u,i.length]),i.length===0)return null;let f=i.map((e,t)=>{let i=wu(a,e),f=i?.tagSkinColor,p=i?ku(i,s):e;return o?(0,n.jsx)(`li`,{role:`listitem`,children:(0,n.jsx)(yu,{skin:f||`blue-dark`,children:(0,n.jsx)(`span`,{className:`pkt-combobox__value`,children:p})})},e):r?(0,n.jsx)(`li`,{role:`listitem`,children:(0,n.jsx)(yu,{skin:f||`blue-dark`,closeTag:!0,onClose:()=>c(e),children:(0,n.jsx)(`span`,{className:`pkt-combobox__value`,children:p})})},e):(0,n.jsx)(`li`,{role:`listitem`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.preventDefault(),children:(0,n.jsx)(yu,{ref:e=>{d.current[t]=e},skin:f||`blue-dark`,closeTag:!0,tabIndex:u===t?0:-1,onClose:()=>c(e),onKeyDown:e=>l(e,t),children:(0,n.jsx)(`span`,{className:`pkt-combobox__value`,children:p})})},e)});return r?(0,n.jsx)(`div`,{className:`pkt-combobox__tags-outside`,children:(0,n.jsx)(`ul`,{role:`list`,className:`pkt-combobox__tag-list`,children:f})}):(0,n.jsx)(`ul`,{role:`list`,className:`pkt-combobox__tag-list`,children:f})},Uu=({state:e})=>{let{values:t,options:r,editingSingleValue:i,displayValueAs:a}=e;if(i||t.length===0)return null;let o=wu(r,t[0]);return o?(0,n.jsx)(`span`,{className:`pkt-combobox__value`,children:ku(o,a)}):null},Wu=({state:e})=>{let{id:t,inputId:r,listboxId:i,values:a,options:o,isOpen:s,multiple:c,typeahead:l,allowUserInput:u,tagPlacement:d,placeholder:f,disabled:p,fullwidth:m,hasError:h,label:g,inputFocus:_,inputRef:v,triggerRef:y,handleInputChange:b,handleInputKeydown:x,handleInputFocus:S,handleInputBlur:C,handleInputClick:w,handlePlaceholderClick:ee,handleSelectOnlyKeydown:T,name:E}=e,te=[`pkt-combobox__input`,m&&`pkt-combobox__input--fullwidth`,s&&`pkt-combobox__input--open`,h&&`pkt-combobox__input--error`,p&&`pkt-combobox__input--disabled`].filter(Boolean).join(` `),ne=[`pkt-combobox__arrow-icon`,s&&`pkt-combobox__arrow-icon--open`].filter(Boolean).join(` `),re=l||u,D=!re&&f&&(!a.length||c&&d===`outside`)&&!_,ie=d!==`outside`,ae=a[0]&&wu(o,a[0])?`${i}-${Tu(o,a[0])}`:void 0,oe=c&&a.length>0?`${a.length} valgt`:void 0;return(0,n.jsxs)(`div`,{ref:y,className:te,onClick:w,...re?{tabIndex:-1}:{id:`${t}-combobox`,role:`combobox`,"aria-expanded":s?`true`:`false`,"aria-controls":i,"aria-haspopup":`listbox`,"aria-labelledby":`${t}-combobox-label`,"aria-activedescendant":ae,"aria-description":oe,tabIndex:p?-1:0,onKeyDown:T},children:[D?(0,n.jsx)(`span`,{className:`pkt-combobox__placeholder`,onClick:ee,children:f}):ie?c?(0,n.jsx)(Hu,{state:e}):re?null:(0,n.jsx)(Uu,{state:e}):null,re?(0,n.jsx)(`div`,{className:`pkt-combobox__input-div combobox__input`,children:(0,n.jsx)(`input`,{ref:v,type:`text`,id:r,name:`${E||t}-input`,onChange:b,onKeyDown:x,onFocus:S,onBlur:C,placeholder:!a.length||c&&d===`outside`?f:void 0,autoComplete:`off`,role:`combobox`,"aria-expanded":s?`true`:`false`,"aria-label":g,"aria-autocomplete":l?`both`:u?`list`:`none`,"aria-controls":i,"aria-activedescendant":ae,"aria-description":oe,disabled:p})}):(0,n.jsx)(`input`,{ref:v,type:`hidden`,id:r,name:`${E||t}-input`,value:a.join(`,`),readOnly:!0}),(0,n.jsx)(Q,{className:ne,name:`chevron-thin-down`,"aria-hidden":`true`})]})},Gu=({state:e})=>{let{listboxId:t,label:r,isOpen:i,options:a,filteredOptions:o,multiple:s,disabled:c,maxIsReached:l,maxlength:u,includeSearch:d,allowUserInput:f,addValueText:p,userInfoMessage:m,searchPlaceholder:h,searchValue:g,handleOptionClick:_,handleOptionKeydown:v,handleSearchInput:y,handleSearchKeydown:b,handleNewOptionClick:x,handleNewOptionKeydown:S,listboxRef:C}=e,w=o.filter(e=>e.selected).length,ee=s&&w>0&&u!=null&&u>0,T=f&&p&&!l,E=!!m;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(`div`,{ref:C,id:t,className:[`pkt-listbox`,i&&`pkt-listbox__open`,`pkt-txt-16-light`].filter(Boolean).join(` `),role:o.length>0?`listbox`:void 0,"aria-label":o.length>0?`Liste: ${r||``}`:void 0,"aria-multiselectable":o.length>0&&s?`true`:void 0,children:[(0,n.jsxs)(`div`,{className:`pkt-listbox__banners`,children:[d&&(0,n.jsxs)(`div`,{className:`pkt-listbox__search`,children:[(0,n.jsx)(`span`,{className:`pkt-listbox__search-icon`,children:(0,n.jsx)(Q,{name:`magnifying-glass-small`})}),(0,n.jsx)(`input`,{className:`pkt-txt-16-light`,type:`text`,"aria-label":`Søk i listen`,form:``,placeholder:h||`Søk...`,onChange:y,onKeyDown:b,value:g,"data-type":`searchbox`,disabled:c,readOnly:c,role:`searchbox`})]}),ee&&(0,n.jsxs)(`div`,{className:`pkt-listbox__banner pkt-listbox__banner--maximum-reached`,children:[w,` av maks `,u,` mulige er valgt.`]}),E&&(0,n.jsxs)(`div`,{className:`pkt-listbox__banner pkt-listbox__banner--user-message`,children:[(0,n.jsx)(Q,{className:`pkt-listbox__banner-icon`,name:`exclamation-mark-circle`}),m]}),T&&(0,n.jsxs)(`div`,{className:`pkt-listbox__banner pkt-listbox__banner--new-option pkt-listbox__option`,"data-type":`new-option`,"data-value":p,"data-selected":`false`,tabIndex:0,onClick:()=>x(p),onKeyDown:S,children:[(0,n.jsx)(Q,{className:`pkt-listbox__banner-icon`,name:`plus-sign`}),`Legg til "`,p,`"`]}),a.length===0&&o.length===0&&!E&&(0,n.jsxs)(`div`,{className:`pkt-listbox__banner pkt-listbox__banner--empty`,children:[(0,n.jsx)(Q,{className:`pkt-listbox__banner-icon`,name:`exclamation-mark-circle`}),`Tom liste`]})]}),(0,n.jsx)(`ul`,{className:`pkt-listbox__options`,role:`presentation`,children:o.map((e,r)=>{let i=[`pkt-listbox__option`,!s&&e.selected&&`pkt-listbox__option--selected`,s&&`pkt-listbox__option--checkBox`].filter(Boolean).join(` `),a=c||e.disabled||l&&!e.selected;return(0,n.jsxs)(`li`,{className:i,onClick:()=>_(e.value),onKeyDown:t=>v(t,e.value),"aria-selected":e.selected?`true`:`false`,tabIndex:a?-1:0,"data-index":r,"data-value":e.value,"data-selected":e.selected?`true`:`false`,"data-disabled":a||void 0,"aria-disabled":a?`true`:`false`,role:`option`,id:`${t}-${r}`,children:[s?(0,n.jsx)(`input`,{className:`pkt-input-check__input-checkbox`,type:`checkbox`,tabIndex:-1,value:e.value,checked:e.selected||!1,readOnly:!0,"aria-hidden":`true`,disabled:a}):e.selected?(0,n.jsx)(Q,{name:`check-big`}):null,(0,n.jsxs)(`span`,{className:`pkt-listbox__option-label`,id:`${t}-option-label-${r}`,children:[e.prefix&&(0,n.jsx)(`span`,{className:`pkt-listbox__option-prefix`,children:e.prefix}),e.label||e.value]}),e.description&&(0,n.jsx)(`span`,{className:`pkt-listbox__option-description pkt-txt-14-light`,children:e.description})]},`${e.value}-${r}`)})})]}),(0,n.jsx)(`div`,{"aria-live":`polite`,className:`pkt-visually-hidden`,children:m})]})};function Ku(e,t){return e.map(e=>({...e,label:e.label||e.value,fulltext:Du(e),selected:t.includes(e.value)}))}function qu(e,n){let{id:r=``,label:i,value:a,defaultValue:o,options:s,defaultOptions:c,multiple:l=!1,maxlength:u,typeahead:d=!1,includeSearch:f=!1,allowUserInput:p=!1,displayValueAs:m=`label`,tagPlacement:h,searchPlaceholder:g,placeholder:_,disabled:v=!1,required:y=!1,fullwidth:b=!1,hasError:x=!1,errorMessage:S,helptext:C,helptextDropdown:w,helptextDropdownButton:ee,optionalTag:T=!1,optionalText:E,requiredTag:te=!1,requiredText:ne,tagText:re,useWrapper:D=!0,name:ie,className:ae,onChange:oe,onValueChange:se,children:ce}=e,O=`${r}-input`,le=`${r}-listbox`,k=d||p,A=(0,t.useRef)(null),ue=(0,t.useRef)(null),de=(0,t.useRef)(null),j=(0,t.useRef)(null),M=(0,t.useRef)(null),N=(0,t.useCallback)(()=>{k?A.current?.focus():de.current?.focus()},[k]),P=(0,t.useMemo)(()=>{let e=[];return t.Children.forEach(ce,n=>{if((0,t.isValidElement)(n)&&n.type===`option`){let t=n.props;e.push({value:t.value??t.children??``,label:t.children??t.value??``,selected:t.selected,disabled:t.disabled})}}),e},[ce]),F=(0,t.useMemo)(()=>c&&c.length>0?c.map(e=>({...e,fulltext:Du(e)})):s&&s.length>0?s.map(e=>({...e,fulltext:Du(e)})):P.length>0?P.map(e=>({...e,fulltext:Du(e)})):[],[c,s,P]),I=a!==void 0,[fe,pe]=(0,t.useState)(()=>Au(a??o,l)),L=(0,t.useRef)(fe);(0,t.useEffect)(()=>{I&&pe(Au(a,l))},[a,I,l]);let R=I?Au(a,l):fe,[me,he]=(0,t.useState)([]),z=(0,t.useMemo)(()=>Ku([...me.filter(e=>!F.some(t=>t.value===e.value)),...F],R),[F,me,R]),[B,V]=(0,t.useState)(!1),[ge,H]=(0,t.useState)(``),[_e,ve]=(0,t.useState)(``),[U,ye]=(0,t.useState)(``),[be,xe]=(0,t.useState)(null),[Se,Ce]=(0,t.useState)(!1),[we,Te]=(0,t.useState)(!1),[Ee,De]=(0,t.useState)(-1),Oe=(0,t.useRef)(!1),ke=Ou(R.length,u??null),Ae=l&&u!=null,je=(0,t.useMemo)(()=>ge?d?ju(z,ge).filtered:Eu(z,ge):z,[z,ge,d]),Me=(0,t.useMemo)(()=>Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,`value`)?.set,[]),Ne=(0,t.useCallback)(e=>{let t=ue.current;if(!t||!Me)return;let n=l?e.join(`,`):e[0]||``;Me.call(t,n),t.dispatchEvent(new Event(`input`,{bubbles:!0}))},[Me,l]),Pe=l?R.join(`,`):R[0]||``;(0,t.useEffect)(()=>{ue.current&&(ue.current.value=Pe)},[Pe]),(0,t.useEffect)(()=>{if(B||l||!A.current)return;let e=R[0]?Fu(R[0],z,m):``;A.current.value!==e&&(A.current.value=e)},[R,z,m,l,B]);let Fe=(0,t.useCallback)((e,t=!0)=>{I||pe(e),t&&(se?.(e),Ne(e))},[I,se,Ne]),Ie=(0,t.useCallback)(e=>{if(e&&!R.includes(e)){if(l&&Ou(R.length,u??null)){ye(`Maks antall valg nådd`);return}Fe(l?[...R,e]:[e])}},[R,l,u,Fe]),Le=(0,t.useCallback)(e=>{if(!e)return;let t=R.filter(t=>t!==e);wu(z,e)?.userAdded&&he(t=>t.filter(t=>t.value!==e)),Fe(t)},[R,z,Fe]),Re=(0,t.useCallback)(()=>{he([]),Fe([])},[Fe]),ze=(0,t.useCallback)(e=>{if(!e||e.trim()===``)return;let t;if(!l)t=[e];else{if(wu(z,e)||Ou(R.length,u??null))return;t=[...R,e]}let n={value:e,label:e,userAdded:!0,selected:!0};he(t=>[n,...t.filter(t=>t.value!==e)]),Fe(t)},[l,z,R,u,Fe]),Be=(0,t.useCallback)((e=!0,t)=>{if(xe(null),e&&A.current&&A.current.type!==`hidden`){H(``),ve(``);let e=t===void 0?R[0]:t;!l&&e?A.current.value=Fu(e,z,m):A.current.value=``,l||(Te(!1),ye(``))}},[l,R,z,m]),Ve=(0,t.useCallback)(e=>{if(v)return;ye(``),xe(null);let t=wu(z,e)?.value||null,n=R.includes(e||t||``),r=!!t,i=z.find(t=>t.value===e)?.disabled||!1,a=!e?.trim(),o=!l,s=l,c=Ou(R.length,u??null),d=!1,f=!0,m=``,h=``,g;i||(!r&&p&&!a?(ze(e),m=`Ny verdi lagt til`,d=s,o&&(g=e||``)):!r&&!p?(o&&R[0]&&Le(R[0]),f=!1,d=!0,m=`Ingen treff i søket`):n?(Le(t),d=!0,g=``,o&&k&&A.current&&A.current.type!==`hidden`&&(A.current.value=``)):a&&o?(Re(),d=!0,g=``):o?(R[0]&&Le(R[0]),Ie(t),d=!1,g=t||``):s&&!c?(Ie(t),d=!0):s&&c?(m=`Maks antall valg nådd`,f=!1,h=e||``):(o&&Re(),m=`Ingen gyldig verdi valgt`,f=!1,d=!0,h=e||``,g=``),V(d),ye(m),H(h),Be(f,g),d||(o&&k&&(Oe.current=!0),window.setTimeout(()=>{N()},0)))},[v,z,R,l,u,p,ze,Le,Re,Ie,Be,N]),He=(0,t.useCallback)(()=>{if(Ce(!1),xe(null),ye(``),H(``),A.current&&A.current.type!==`hidden`){let e=A.current.value,t=R[0];if(!l)if(!e)R[0]&&Le(R[0]),t=void 0;else{let n=wu(z,e);n&&n.value!==R[0]?(R[0]&&Le(R[0]),Ie(n.value),t=n.value):!n&&p&&(R[0]&&Le(R[0]),ze(e),t=e)}else if(e!==``){let{action:t,value:n}=Pu(e,R,z,p,l);switch(t){case`addUserValue`:ze(n);break;case`selectOption`:Ie(n);break;case`removeValue`:Le(n);break}}!l&&t?A.current.value=Fu(t,z,m):A.current.value=``}V(!1),Te(!1)},[R,z,p,l,m,ze,Ie,Le]),Ue=(0,t.useCallback)(e=>{if(!e.trim().toLowerCase()){xe(null),ye(``),!l&&R[0]&&Le(R[0]);return}let t=Mu(e,R,z,p);xe(t.addValueText),ye(t.userInfoMessage)},[R,z,p,l,Le]),W=(0,t.useCallback)(e=>{if(v)return;let t=e.target.value;if(ve(t),H(t),Ue(t),d&&t){let{suggestion:n}=ju(z,t);n?.label&&A.current&&!e.nativeEvent.inputType?.includes(`deleteContent`)&&(A.current.value=n.label,window.setTimeout(()=>A.current?.setSelectionRange(t.length,n.label.length),0))}},[v,d,z,Ue]),G=(0,t.useCallback)(e=>{if(e.key===`Backspace`){let t=!A.current?.value;if(!ge&&t&&l&&R.length>0){e.preventDefault();let t=R[R.length-1];Le(t)}return}if(e.key===`ArrowLeft`&&l&&R.length>0&&(A.current?.selectionStart??0)===0&&!A.current?.value){e.preventDefault(),De(R.length-1);return}let t=Nu(e.key,e.shiftKey,l);if(t&&!(e.key===`Tab`&&!B)){if(t===`focusListbox`&&e.key===`Tab`&&!j.current?.querySelector(`[role="option"]:not([data-disabled]), [data-type="new-option"]`)){He();return}switch(e.preventDefault(),t){case`addValue`:{let e=A.current?.value.trim()||``;if(H(e),e&&R.includes(e)){Be(!0),ye(`Verdien er allerede valgt`);break}Ve(e);break}case`focusListbox`:j.current&&(B||V(!0),Vu(j.current,{disabled:v,allowUserInput:p,customUserInput:be,includeSearch:f}));break;case`closeOptions`:V(!1);break}}},[ge,R,l,v,p,be,f,B,Le,Ve,N]),We=(0,t.useCallback)(()=>{if(!v){if(Oe.current){Oe.current=!1,Ce(!0);return}!l&&R[0]&&A.current&&A.current.type!==`hidden`&&(Te(!0),A.current.value=Fu(R[0],z,m)),Ce(!0),H(``),V(!0)}},[v,l,R,z,m]),Ge=(0,t.useCallback)(()=>{Ce(!1),Te(!1)},[]),Ke=(0,t.useCallback)(e=>{if(v||!B)return;let t=e.relatedTarget,n=M.current;n&&t&&n.contains(t)||He()},[v,B,He]),qe=(0,t.useCallback)(e=>{if(v){e.preventDefault(),e.stopPropagation();return}if(k)A.current?.focus();else{e.stopPropagation(),e.preventDefault();let t=!B;V(t),t&&j.current&&Vu(j.current,{disabled:v,allowUserInput:p,customUserInput:be,includeSearch:f})}},[v,k,B,p,be,f]),K=(0,t.useCallback)(e=>{v||(e.stopPropagation(),k&&A.current?(A.current.focus(),Ce(!0)):V(e=>!e))},[v,k]),Je=(0,t.useCallback)(e=>{if(!v)switch(e.key){case`Enter`:case` `:case`ArrowDown`:case`ArrowUp`:e.preventDefault(),B?V(!1):(V(!0),j.current&&window.setTimeout(()=>{j.current&&Vu(j.current,{disabled:v,allowUserInput:p&&!ke,customUserInput:be,includeSearch:f})},0));break;case`Escape`:B&&(e.preventDefault(),V(!1));break;case`Home`:case`End`:e.preventDefault(),B||V(!0),j.current&&window.setTimeout(()=>{j.current&&Vu(j.current,{disabled:v,allowUserInput:p&&!ke,customUserInput:be,includeSearch:f})},0);break;case`ArrowLeft`:l&&R.length>0&&(e.preventDefault(),De(R.length-1));break;case`Backspace`:case`Delete`:if(l&&R.length>0){e.preventDefault();let t=R[R.length-1];Le(t)}break}},[v,B,p,ke,be,f,l,R,Le]),Ye=(0,t.useCallback)(e=>{Ve(e)},[Ve]),Xe=(0,t.useCallback)((e,t)=>{switch(e.key){case`Enter`:case` `:e.preventDefault(),Ve(t);break;case`ArrowDown`:e.preventDefault(),Ru(e.currentTarget);break;case`ArrowUp`:e.preventDefault(),j.current&&zu(e.currentTarget,j.current,f);break;case`Escape`:e.preventDefault(),V(!1),N();break;case`Tab`:He();break}},[Ve,f,N,He]),Ze=(0,t.useCallback)(e=>{Le(e),De(-1),k&&A.current&&(Ce(!0),A.current.focus())},[Le,k]),Qe=(0,t.useCallback)((e,t)=>{switch(e.stopPropagation(),e.key){case`ArrowLeft`:e.preventDefault(),t>0&&De(t-1);break;case`ArrowRight`:e.preventDefault(),t<R.length-1?De(t+1):(De(-1),k&&A.current?A.current.focus():de.current?.focus());break;case`Backspace`:case`Delete`:e.preventDefault();{let e=R[t],n=t>=R.length-1?t-1:t;Le(e),n>=0?De(n):(De(-1),k&&A.current?A.current.focus():de.current?.focus())}break;case`Tab`:De(-1);break;case`Escape`:e.preventDefault(),De(-1),k&&A.current?A.current.focus():de.current?.focus();break}},[R,k,Le]),q=(0,t.useCallback)(e=>{H(e.target.value),Ue(e.target.value)},[Ue]),$e=(0,t.useCallback)(e=>{switch(e.key){case`ArrowDown`:e.preventDefault(),j.current&&j.current.querySelector(`[role="option"]:not([data-disabled]), [data-type="new-option"]`)?.focus();break;case`Tab`:He();break;case`Escape`:e.preventDefault(),V(!1),N();break}},[N,He]),et=(0,t.useCallback)(e=>{Ve(e)},[Ve]),tt=(0,t.useCallback)(e=>{switch(e.key){case`Enter`:case` `:e.preventDefault(),Ve(e.currentTarget.dataset.value||``);break;case`ArrowDown`:e.preventDefault(),j.current&&Bu(j.current);break;case`ArrowUp`:e.preventDefault(),j.current&&zu(e.currentTarget,j.current,f);break;case`Escape`:e.preventDefault(),V(!1),N();break}},[Ve,f,N]);return(0,t.useEffect)(()=>{if(!B)return;let e=e=>{let t=e.target;M.current&&!M.current.contains(t)&&He()};return document.addEventListener(`click`,e,!0),()=>{document.removeEventListener(`click`,e,!0)}},[B,He]),(0,t.useEffect)(()=>{let e=M.current?.closest(`form`);if(!e)return;let t=()=>{window.setTimeout(()=>{if(pe(L.current),he([]),ve(``),H(``),xe(null),ye(``),ue.current){let e=l?L.current.join(`,`):L.current[0]||``;ue.current.value=e}},0)};return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)},[l]),(0,t.useImperativeHandle)(n,()=>({get value(){return ue.current?.value??``},set value(e){let t=Array.isArray(e)?e:e?String(e).split(`,`).filter(Boolean):[];I||pe(t),ue.current&&(ue.current.value=t.join(`,`))},focus(){k?A.current?.focus():de.current?.focus()},blur(){k?A.current?.blur():de.current?.blur()}}),[I]),{id:r,inputId:O,listboxId:le,values:R,inputValue:_e,searchValue:ge,options:z,filteredOptions:je,isOpen:B,userInfoMessage:U,addValueText:be,maxIsReached:ke,editingSingleValue:we,inputFocus:Se,focusedTagIndex:Ee,label:i,multiple:l,maxlength:u,typeahead:d,includeSearch:f,allowUserInput:p,displayValueAs:m,tagPlacement:h,searchPlaceholder:g,placeholder:_,disabled:v,required:y,fullwidth:b,hasError:x,errorMessage:S,helptext:C,helptextDropdown:w,helptextDropdownButton:ee,optionalTag:T,optionalText:E,requiredTag:te,requiredText:ne,tagText:re,useWrapper:D,name:ie,className:ae,hasCounter:Ae,inputRef:A,changeInputRef:ue,triggerRef:de,listboxRef:j,wrapperRef:M,handleInputChange:W,handleInputKeydown:G,handleInputFocus:We,handleInputBlur:Ge,handleFocusOut:Ke,handleInputClick:qe,handlePlaceholderClick:K,handleSelectOnlyKeydown:Je,handleOptionClick:Ye,handleOptionKeydown:Xe,handleTagRemove:Ze,handleTagKeydown:Qe,handleSearchInput:q,handleSearchKeydown:$e,handleNewOptionClick:et,handleNewOptionKeydown:tt,onChange:oe}}var Ju=(0,t.forwardRef)((e,t)=>{let r=qu(e,t),i=[`pkt-combobox-component`,r.fullwidth&&`pkt-combobox-component--fullwidth`,r.className].filter(Boolean).join(` `),a=r.allowUserInput||r.typeahead,o=a?r.inputId:`${r.id}-combobox`;return(0,n.jsxs)(`div`,{className:i,ref:r.wrapperRef,id:r.id||void 0,children:[(0,n.jsxs)(Cu,{forId:o,hasFieldset:!a,label:r.label||``,helptext:r.helptext,helptextDropdown:r.helptextDropdown,helptextDropdownButton:r.helptextDropdownButton,hasError:r.hasError,errorMessage:r.errorMessage,disabled:r.disabled,optionalTag:r.optionalTag,optionalText:r.optionalText,requiredTag:r.requiredTag,requiredText:r.requiredText,tagText:r.tagText,useWrapper:r.useWrapper,counter:r.hasCounter,counterCurrent:r.values.length,counterMaxLength:r.maxlength,className:`pkt-combobox__wrapper`,children:[(0,n.jsxs)(`div`,{className:`pkt-combobox`,onBlur:r.handleFocusOut,children:[(0,n.jsx)(Wu,{state:r}),(0,n.jsx)(Gu,{state:r})]}),r.tagPlacement===`outside`&&r.multiple&&(0,n.jsx)(Hu,{state:r,outside:!0})]}),(0,n.jsx)(`input`,{ref:r.changeInputRef,type:`text`,name:r.name||r.id,onChange:r.onChange,tabIndex:-1,"aria-hidden":`true`,className:`pkt-visually-hidden`})]})});Ju.displayName=`PktCombobox`;var Yu=x({tagName:`pkt-consent`,elementClass:Cs,react:t.default,displayName:`PktConsent`,events:{onToggleConsent:`toggle-consent`}});Yu.displayName=`PktConsent`;var Xu=()=>{let e=navigator.userAgent;return!!(/iP(hone|od|ad)/.test(e)||/Macintosh/.test(e)&&`ontouchend`in document)},Zu=()=>Xu()?`text`:`date`,Qu=e=>!e||e.length!==2?!0:Kl(e[0],e[1]),$u=(e,t,n,r,i,a)=>({"pkt-input":!0,"pkt-datepicker__input":!0,"pkt-input--fullwidth":e,"pkt-datepicker--hasrangelabels":t,"pkt-datepicker--multiple":n,"pkt-datepicker--range":r,"ios-readonly-hack":i===!1&&a===`text`}),ed=()=>({"pkt-input-icon":!0,"pkt-btn":!0,"pkt-btn--icon-only":!0,"pkt-btn--tertiary":!0,"pkt-datepicker__calendar-button":!0}),td=e=>({"pkt-input-prefix":e,"pkt-hide":!e}),nd=(e,t,n)=>!t&&!n?Array.isArray(e)?e[0]||``:e:Array.isArray(e)?e.join(`,`):e,rd=(e,t,n=!1)=>{if(!e||!t)return;let r=t.parentElement?.getBoundingClientRect()||t.getBoundingClientRect(),i=n?r.height+30:r.height,a=e.getBoundingClientRect().height,o=n?`calc(100% - 30px)`:`100%`;r&&r.top+a>window.innerHeight&&r.top-a>0&&(o=`calc(100% - ${i}px - ${a}px)`),e.style.top=o},id=(e,t,n,r,i,a)=>{let{key:o}=e;o===`,`&&(e.preventDefault(),a?a(e):i&&i()),(o===`Space`||o===` `)&&(e.preventDefault(),t(e)),o===`Enter`&&(e.preventDefault(),n?n():r?r():i&&i())},ad=({open:e,multiple:r=!1,range:i=!1,weeknumbers:a=!1,withcontrols:o=!1,selected:s=[],earliest:c,latest:l,excludedates:u,excludeweekdays:d,maxMultiple:f,currentmonth:p,today:m,inputRef:h,hasCounter:g=!1,onDateSelected:_,onClose:v})=>{let y=(0,t.useRef)(null),b=(0,t.useRef)(!1);e&&(b.current=!0),(0,t.useEffect)(()=>{e&&rd(y.current,h?.current??null,g)},[e,h,g]);let x=[`pkt-calendar-popup`,e?`show`:`hide`].join(` `),S=e||b.current;return(0,n.jsx)(`div`,{ref:y,className:x,hidden:!e,"aria-hidden":!e,children:S&&(0,n.jsx)(vu,{multiple:r,range:i,weeknumbers:a,withcontrols:o,selected:s,earliest:c,latest:l,excludedates:u,excludeweekdays:d,maxMultiple:f,currentmonth:p,today:m,onDateSelected:_,onClose:v})})},od=({dates:e,dateformat:t,idBase:r,strings:i,onDateRemoved:a})=>{let o=Gl(e),s=i?.calendar?.buttonAltText??`Slett dato`;return(0,n.jsx)(`div`,{className:`pkt-date-tags pkt-datepicker__tags`,"aria-live":`polite`,children:o.map(e=>{let i=Nl(e,t);return(0,n.jsx)(yu,{id:`${r}${e}-tag`,closeTag:!0,ariaLabel:`${s} ${i}`,onClose:()=>a(e),children:(0,n.jsx)(`time`,{dateTime:e,children:i})},e)})})},sd=({state:e})=>{let{id:t,inputId:r,values:i,dateformat:a,multiple:o,range:s,showRangeLabels:c,disabled:l,readOnly:u,required:d,label:f,name:p,placeholder:m,hasError:h,helptext:g,minStr:_,maxStr:v,inputType:y,isIOSDevice:b,strings:x,inputClasses:S,buttonClasses:C,rangeLabelClasses:w,datepickerInputsClasses:ee,isInputDisabled:T,inputRef:E,inputRefTo:te,btnRef:ne,toggleCalendar:re,handleFocus:D,handleSingleInputChange:ie,handleRangeFromChange:ae,handleRangeToChange:oe,handleRangeBlur:se,handleMultipleBlur:ce,handleTagRemoved:O,handleSingleKeydown:le,handleRangeFromKeydown:k,handleRangeToKeydown:A,handleMultipleKeydown:ue,restProps:de}=e,j=e=>{e.preventDefault(),re()},M=()=>(0,n.jsxs)(`button`,{ref:ne,className:C,type:`button`,onClick:re,disabled:l,"aria-label":x.calendar?.buttonAltText??`Åpne kalender`,children:[(0,n.jsx)(Q,{name:`calendar`}),(0,n.jsx)(`span`,{className:`pkt-btn__text`,children:x.calendar?.buttonAltText??`Åpne kalender`})]});return o?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(od,{dates:i,dateformat:a,idBase:t,strings:x,onDateRemoved:O}),(0,n.jsx)(`div`,{className:`pkt-datepicker__inputs`,children:(0,n.jsxs)(`div`,{className:`pkt-input__container`,children:[(0,n.jsx)(`input`,{...de,ref:E,className:S,type:y,id:r,name:p??t,placeholder:m,readOnly:u||b&&!u,disabled:T,"aria-describedby":g?`${t}-helptext`:void 0,"aria-invalid":h,"aria-errormessage":h?`${t}-error`:void 0,onClick:j,onKeyDown:ue,onFocus:D,onBlur:ce}),M()]})})]}):s?(0,n.jsx)(`div`,{className:ee,children:(0,n.jsxs)(`div`,{className:`pkt-input__container`,children:[c&&(0,n.jsx)(`div`,{className:`pkt-input-prefix`,children:x.generic?.from??`Fra`}),(0,n.jsx)(`input`,{...de,ref:E,className:S,type:y,id:r,name:p?`${p}-from`:`${t}-from`,value:i[0]??``,min:_,max:v,placeholder:m,readOnly:u||b&&!u,disabled:l,required:d,"aria-label":`${f} ${x.generic?.from??`Fra`}`,"aria-describedby":g?`${t}-helptext`:void 0,"aria-invalid":h,"aria-errormessage":h?`${t}-error`:void 0,onClick:j,onKeyDown:k,onFocus:D,onBlur:se,onChange:ae}),(0,n.jsx)(`div`,{className:w,id:`${t}-to-label`,children:x.generic?.to??`Til`}),!c&&(0,n.jsx)(`div`,{className:`pkt-input-separator`,children:`–`}),(0,n.jsx)(`input`,{ref:te,className:S,type:y,id:`${t}-to`,name:p?`${p}-to`:`${t}-to`,value:i[1]??``,min:_,max:v,readOnly:u||b&&!u,disabled:l,"aria-label":`${f} ${x.generic?.to??`Til`}`,"aria-invalid":h,onClick:j,onKeyDown:A,onFocus:D,onBlur:se,onChange:oe}),M()]})}):(0,n.jsx)(`div`,{className:`pkt-datepicker__inputs`,children:(0,n.jsxs)(`div`,{className:`pkt-input__container`,children:[(0,n.jsx)(`input`,{...de,ref:E,className:S,type:y,id:r,name:p??t,value:i[0]??``,min:_,max:v,placeholder:m,readOnly:u||b&&!u,disabled:l,required:d,"aria-describedby":g?`${t}-helptext`:void 0,"aria-invalid":h,"aria-errormessage":h?`${t}-error`:void 0,onClick:j,onKeyDown:le,onFocus:D,onBlur:void 0,onChange:ie}),M()]})})},cd={calendar:{buttonAltText:`Åpne kalender`}},ld={calendar:{buttonAltText:`Åpne kalender`},generic:{from:`Fra`,to:`Til`}},ud=e=>{if(!e)return[];if(Array.isArray(e))return e.filter(Boolean);if(typeof e==`string`&&e.trimStart().startsWith(`[`))try{let t=JSON.parse(e);if(Array.isArray(t))return t.filter(Boolean)}catch{}return String(e).split(`,`).map(e=>e.trim()).filter(Boolean)};function dd(e,n){let{id:r,label:i,value:a,defaultValue:o,dateformat:s=`dd.MM.yyyy`,multiple:c=!1,maxlength:l,range:u=!1,showRangeLabels:d=!1,weeknumbers:f=!1,withcontrols:p=!1,excludedates:m,excludeweekdays:h,currentmonth:g,today:_,calendarOpen:v,timezone:y,fullwidth:b=!1,hasFieldset:x=!1,inline:S=!1,helptext:C,helptextDropdown:w,helptextDropdownButton:ee,hasError:T=!1,errorMessage:E,optionalTag:te=!1,optionalText:ne,requiredTag:re=!1,requiredText:D,tagText:ie,useWrapper:ae=!0,strings:oe,disabled:se=!1,readOnly:ce=!1,required:O=!1,name:le,min:k,max:A,placeholder:ue,onChange:de,onValueChange:j,className:M,...N}=e,P=(0,t.useCallback)(e=>e===void 0?[]:ud(e),[]),F=a!==void 0,I=typeof o==`number`?void 0:o,[fe,pe]=(0,t.useState)(()=>P(a??I)),L=F?P(a):fe,R=(0,t.useRef)(fe);(0,t.useEffect)(()=>{F&&pe(P(a))},[a,F,P]);let[me,he]=(0,t.useState)(v??!1);(0,t.useEffect)(()=>{v!==void 0&&he(v)},[v]);let z=(0,t.useRef)(null),B=(0,t.useRef)(null),V=(0,t.useRef)(null),ge=(0,t.useRef)(null),H=(0,t.useRef)(null),_e=(0,t.useMemo)(()=>Zu(),[]),ve=(0,t.useMemo)(()=>Xu(),[]),U=(0,t.useMemo)(()=>oe??(u?ld:cd),[oe,u]),ye=typeof k==`string`?k:k===void 0?void 0:String(k),be=typeof A==`string`?A:A===void 0?void 0:String(A),xe=(0,t.useMemo)(()=>{let e=$u(b,d,c,u,ce,_e);return Object.entries(e).filter(([,e])=>e).map(([e])=>e).join(` `)},[b,d,c,u,ce,_e]),Se=(0,t.useMemo)(()=>{let e=ed();return Object.entries(e).filter(([,e])=>e).map(([e])=>e).join(` `)},[]),Ce=(0,t.useMemo)(()=>{let e=td(d);return Object.entries(e).filter(([,e])=>e).map(([e])=>e).join(` `)},[d]),we=(0,t.useMemo)(()=>[`pkt-datepicker__inputs`,u&&`pkt-input__range-inputs`].filter(Boolean).join(` `),[u,d]),Te=(0,t.useMemo)(()=>{if(g)return g;if(be)return be.slice(0,7)},[g,be]),Ee=se||c&&l!=null&&L.length>=l,De=c&&l!=null,Oe=`${r}-input`,ke=L.join(`,`);(0,t.useEffect)(()=>{V.current&&(V.current.value=ke)},[ke]),(0,t.useEffect)(()=>{y&&typeof window<`u`&&y!==window.pktTz&&(window.pktTz=y)},[y]);let Ae=(0,t.useCallback)((e,t=!0)=>{F||pe(e),t&&j?.(e)},[F,j]),je=(0,t.useMemo)(()=>Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,`value`)?.set,[]),Me=(0,t.useCallback)(e=>{let t=V.current;!t||!je||(je.call(t,e.join(`,`)),t.dispatchEvent(new Event(`input`,{bubbles:!0})))},[je]),Ne=(0,t.useCallback)(()=>{se||he(e=>!e)},[se]),Pe=(0,t.useCallback)(()=>{he(!1)},[]);(0,t.useEffect)(()=>{if(!me)return;let e=e=>{let t=e.target;H.current&&!H.current.contains(t)&&!t.closest?.(`.pkt-calendar-popup`)&&Pe()},t=e=>{e.key===`Escape`&&(Pe(),z.current?.focus())};return document.addEventListener(`click`,e,!0),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`click`,e,!0),document.removeEventListener(`keydown`,t)}},[me,Pe]);let Fe=(0,t.useCallback)(()=>{ve&&!me&&he(!0)},[ve,me]),Ie=(0,t.useCallback)(e=>{let t=ud(nd(e,c,u));Ae(t),Me(t),!c&&!u&&(Pe(),z.current?.focus())},[c,u,Ae,Me,Pe]),Le=(0,t.useCallback)(()=>{Pe(),z.current?.focus()},[Pe]),Re=(0,t.useCallback)(e=>{let t=e.target.value,n=t?[t]:[];Ae(n),Me(n)},[Ae,Me]),ze=(0,t.useCallback)(e=>{let t=[e.target.value,L[1]??``].filter(Boolean);Ae(t),Me(t)},[L,Ae,Me]),Be=(0,t.useCallback)(e=>{let t=[L[0]??``,e.target.value].filter(Boolean);Ae(t),Me(t)},[L,Ae,Me]),Ve=(0,t.useCallback)(()=>{L.length===2&&!Qu(L)&&(Ae([L[0]]),Me([L[0]]))},[L,Ae,Me]),He=(0,t.useCallback)(e=>{let t=Pl(e),n=ye?Pl(ye):null,r=be?Pl(be):null;if(t&&!isNaN(t.getTime())&&(!n||t>=n)&&(!r||t<=r)){let t=Wl([...L,e],ye,be,m,h),n=[...new Set(t)];Ae(n),Me(n)}},[L,ye,be,m,h,Ae,Me]),Ue=(0,t.useCallback)(e=>{let t=e.target;t.value&&=(He(t.value.split(`,`)[0]),``)},[He]),W=(0,t.useCallback)(e=>{let t=e.target;t.value&&=(He(t.value.split(`,`)[0]),``)},[He]),G=(0,t.useCallback)(e=>{let t=L.filter(t=>t!==e);Ae(t),Me(t)},[L,Ae,Me]),We=(0,t.useCallback)(e=>{let t=e?.closest(`form`);t?t.requestSubmit():e?.blur()},[]),Ge=(0,t.useCallback)(e=>{id(e.nativeEvent,()=>Ne(),()=>We(z.current),void 0,()=>z.current?.blur())},[Ne,We]),Ke=(0,t.useCallback)(e=>{id(e.nativeEvent,()=>Ne(),()=>We(z.current),()=>B.current?.focus(),()=>z.current?.blur())},[Ne,We]),qe=(0,t.useCallback)(e=>{id(e.nativeEvent,()=>Ne(),()=>We(B.current),void 0,()=>B.current?.blur())},[Ne,We]),K=(0,t.useCallback)(e=>{id(e.nativeEvent,()=>Ne(),()=>We(z.current),void 0,()=>z.current?.blur(),W)},[Ne,We,W]);return(0,t.useEffect)(()=>{let e=H.current?.closest(`form`);if(!e)return;let t=()=>{window.setTimeout(()=>{pe(R.current),he(!1),V.current&&(V.current.value=R.current.join(`,`))},0)};return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)},[]),(0,t.useImperativeHandle)(n,()=>({get value(){return V.current?.value??``},set value(e){pe(e?e.split(`,`).filter(Boolean):[]),V.current&&(V.current.value=e??``)},focus(){z.current?.focus()},blur(){z.current?.blur()}}),[]),{id:r,inputId:Oe,label:i,values:L,calendarOpen:me,dateformat:s,multiple:c,maxlength:l,range:u,showRangeLabels:d,weeknumbers:f,withcontrols:p,excludedates:m,excludeweekdays:h,disabled:se,readOnly:ce,required:O,name:le,placeholder:ue,fullwidth:b,hasFieldset:x,inline:S,helptext:C,helptextDropdown:w,helptextDropdownButton:ee,hasError:T,errorMessage:E,optionalTag:te,optionalText:ne,requiredTag:re,requiredText:D,tagText:ie,useWrapper:ae,className:M,minStr:ye,maxStr:be,effectiveCurrentMonth:Te,today:_,inputType:_e,isIOSDevice:ve,strings:U,inputClasses:xe,buttonClasses:Se,rangeLabelClasses:Ce,datepickerInputsClasses:we,isInputDisabled:Ee,hasCounter:De,inputRef:z,inputRefTo:B,changeInputRef:V,btnRef:ge,wrapperRef:H,onChange:de,toggleCalendar:Ne,hideCalendar:Pe,handleDateSelected:Ie,handleCalendarClose:Le,handleFocus:Fe,handleSingleInputChange:Re,handleRangeFromChange:ze,handleRangeToChange:Be,handleRangeBlur:Ve,handleMultipleBlur:Ue,handleTagRemoved:G,handleSingleKeydown:Ge,handleRangeFromKeydown:Ke,handleRangeToKeydown:qe,handleMultipleKeydown:K,restProps:N}}var fd=(0,t.forwardRef)((e,t)=>{let r=dd(e,t);return(0,n.jsxs)(`div`,{className:[`pkt-datepicker`,r.className].filter(Boolean).join(` `),id:r.id||void 0,children:[(0,n.jsx)(Cu,{ref:r.wrapperRef,forId:r.inputId,label:r.label,hasFieldset:r.hasFieldset,inline:r.inline,helptext:r.helptext,helptextDropdown:r.helptextDropdown,helptextDropdownButton:r.helptextDropdownButton,hasError:r.hasError,errorMessage:r.errorMessage,disabled:r.disabled,optionalTag:r.optionalTag,optionalText:r.optionalText,requiredTag:r.requiredTag,requiredText:r.requiredText,tagText:r.tagText,useWrapper:r.useWrapper,counter:r.hasCounter,counterCurrent:r.values.length,counterMaxLength:r.maxlength,children:(0,n.jsx)(sd,{state:r})}),(0,n.jsx)(ad,{open:r.calendarOpen,multiple:r.multiple,range:r.range,weeknumbers:r.weeknumbers,withcontrols:r.withcontrols,selected:r.values,earliest:r.minStr,latest:r.maxStr,excludedates:r.excludedates,excludeweekdays:r.excludeweekdays,maxMultiple:r.maxlength,currentmonth:r.effectiveCurrentMonth,today:r.today,inputRef:r.inputRef,hasCounter:r.hasCounter,onDateSelected:r.handleDateSelected,onClose:r.handleCalendarClose}),(0,n.jsx)(`input`,{ref:r.changeInputRef,type:`text`,name:r.name,onChange:r.onChange,tabIndex:-1,"aria-hidden":`true`,className:`pkt-visually-hidden`})]})});fd.displayName=`PktDatepicker`;var pd=`https://cdn.web.oslo.kommune.no/header-footer/header-footer.json`,md={hours:`Timer`,minutes:`Minutter`,openPicker:`Åpne tidspunkt-velger`,prevTime:`Forrige tidspunkt`,nextTime:`Neste tidspunkt`,selectTime:`Velg tidspunkt`},hd={dropZoneDragMultiple:`Dra filer hit for å laste dem opp eller`,dropZoneDragSingle:`Dra en fil hit for å laste den opp eller`,dropZoneDragMultipleThumbnail:`Dra bilder hit for å laste dem opp eller`,dropZoneDragSingleThumbnail:`Dra et bilde hit for å laste det opp eller`,dropZoneDragActiveMultiple:`Slipp filene her`,dropZoneDragActiveSingle:`Slipp filen her`,dropZoneDragActiveMultipleThumbnail:`Slipp bildene her`,dropZoneDragActiveSingleThumbnail:`Slipp bildet her`,dropZoneOpenFileDialogMultiple:`velg filer`,dropZoneOpenFileDialogSingle:`velg en fil`,dropZoneOpenFileDialogMultipleThumbnail:`velg fra kamerarull`,dropZoneOpenFileDialogSingleThumbnail:`velg fra kamerarull`,supportedFormatsPrefix:`Format:`,invalidFormatDefault:e=>`Ugyldig filtype. Tillatte formater: ${e}`,sizeTooLargeDefault:e=>`Filen er for stor. Maks størrelse er ${e}.`,requiredMissing:`Du må laste opp minst én fil.`,genericValidationRejection:`Filen ble avvist av validering.`,unknownFilename:`Ukjent fil`,fileLabel:e=>e===1?`fil`:`filer`,srFileAdded:e=>`Filen «${e}» er lagt til`,srFilesAdded:e=>`${e} filer er lagt til`,srFilesUploadedOfTotal:(e,t,n)=>`${e} av ${t} ${n} lastet opp`,srFilesFailedOfTotal:(e,t,n)=>`Feil ved opplasting: ${e} av ${t} ${n} feilet`};function gd(e){if(e==null||e===``)return;if(typeof e==`number`)return Number.isFinite(e)&&e>0?e:void 0;let t=String(e).trim(),n=Number(t);if(!Number.isNaN(n)&&n>0)return n;let r=t.match(/^(\d+(?:\.\d+)?)\s*(B|KB|MB|GB)$/i);if(!r){console.warn(`PktFileUpload: Invalid maxFileSize format "${t}". Use format like "5MB", "500KB", "1GB", or bytes.`);return}let i=parseFloat(r[1]);switch(r[2].toUpperCase()){case`B`:return i;case`KB`:return i*1024;case`MB`:return i*1024*1024;case`GB`:return i*1024*1024*1024;default:return}}function _d(e){return e<1024?`${Math.round(e)} B`:e<1024*1024?`${Math.round(e/1024)} KB`:e<1024*1024*1024?`${Math.round(e/(1024*1024))} MB`:`${Math.round(e/(1024*1024*1024))} GB`}function vd(e){return Array.isArray(e)?e.map(e=>String(e).trim().toLowerCase()).filter(Boolean):[]}function yd(e,t,n){let r=e.toLowerCase().replace(/^\./,``);if(r.includes(`/`)){if(r.endsWith(`/*`)){let e=r.replace(`/*`,``);return n.startsWith(`${e}/`)}return n===r}return t===r}function bd(e,t){let n=vd(t);if(n.length===0)return!0;let r=e.name.split(`.`).pop()?.toLowerCase()??``,i=e.type.toLowerCase();return n.some(e=>yd(e,r,i))}function xd(e,t){let n=(e??``).trim();if(n)return n;let r=vd(t);return r.length===0?``:r.map(e=>e.includes(`/`)||e.startsWith(`.`)?e:`.${e}`).join(`, `)}function Sd(e,t,n){return((e??``).trim()||t).replace(/\{(\w+)\}/g,(e,t)=>n[t]??`{${t}}`)}function Cd(e,t){let n=vd(t.allowedFormats);if(n.length>0&&!bd(e,n)){let e=n.join(`, `),r=`Ugyldig filtype. Tillatte formater: ${e}`;return Sd(t.formatErrorMessage,r,{formats:e})}let r=gd(t.maxFileSize);if(r!==void 0&&e.size>r){let e=_d(r),n=`Filen er for stor. Maks størrelse er ${e}.`;return Sd(t.sizeErrorMessage,n,{maxSize:e})}if(t.onFileValidation){let n=t.onFileValidation(e);if(n)return n}return null}function wd(e){let t=e.file;if(t?.type?.startsWith(`image/`))return!0;let n=e.attributes?.targetFilename||t?.name||``;return/\.(jpe?g|png|gif|webp|heic|heif|bmp|svg)$/i.test(n)}function Td(e){return typeof e==`number`?`in-progress`:e===`error`?`error`:`idle`}function Ed(e,t,n){let r={"in-progress":0,error:1,idle:2};return e.map(e=>{let r=t?.find(t=>t.fileId===e.fileId);return{...e,progress:r?.progress??(n===`form`?`done`:`queued`),errorMessage:r?.errorMessage,showProgress:r?.showProgress,lastProgress:r?.lastProgress}}).sort((e,t)=>r[Td(e.progress)]-r[Td(t.progress)])}function Dd(e){if(!e)return[];let t=[`a[href]:not([tabindex="-1"])`,`button:not([disabled]):not([tabindex="-1"])`,`input:not([disabled]):not([type="hidden"]):not([tabindex="-1"])`,`select:not([disabled]):not([tabindex="-1"])`,`textarea:not([disabled]):not([tabindex="-1"])`,`[tabindex]:not([tabindex="-1"])`].join(`, `);return Array.from(e.querySelectorAll(t)).filter(e=>!e.hasAttribute(`inert`))}function Od(e,t){if(e.key!==`Tab`)return!1;let n=Dd(t);if(n.length===0)return e.preventDefault(),!0;let r=n[0],i=n[n.length-1],a=(t?.ownerDocument??document).activeElement,o=!!a&&n.includes(a);return e.shiftKey?!o||a===r?(e.preventDefault(),i.focus(),!0):!1:!o||a===i?(e.preventDefault(),r.focus(),!0):!1}function kd(e,t){return!t||t<=0||e.length<=t+3?null:{head:e.slice(0,e.length-t),tail:e.slice(-t)}}function Ad(e,t,n){return n<=0?0:t===`prev`?e<=0?n-1:e-1:e>=n-1?0:e+1}function jd(e,t){let n=e.length;if(n===0||!t||t.length===0)return{totalCount:n,uploadedCount:0,failedCount:0};let r=0,i=0;for(let n of e){let e=t.find(e=>e.fileId===n.fileId);e?.progress===`done`?r++:e?.progress===`error`&&i++}return{totalCount:n,uploadedCount:r,failedCount:i}}var Md=`.jpeg, .jpg, .png, .gif, .webp, .heic`;function Nd(e,t=hd.unknownFilename){return e.attributes?.targetFilename||e.file?.name||t}var Pd=()=>(`00000000000000000`+(Math.random()*0x10000000000000000).toString(16)).slice(-16),Fd=()=>{let e=Pd(),t=Pd();return e.slice(0,8)+`-`+e.slice(8,12)+`-4`+e.slice(13)+`-a`+t.slice(1,4)+`-`+t.slice(4)},Id=class{fileId;file;attributes;constructor(e,t){this.fileId=t||Fd(),this.file=e,this.attributes={targetFilename:e.name}}},Ld=(0,t.createContext)({}),Rd=(0,t.forwardRef)(({id:e,multiple:r,value:i,onFilesAdded:a=()=>{},name:o,uploadStrategy:s,accept:c,isThumbnailView:l=!1,disabled:u=!1,hasVisibleLabel:d=!1,...f},p)=>{let m=(0,t.useRef)(null),h=typeof c==`string`&&c.trim().length>0?c:void 0,g=(0,t.useMemo)(()=>h?h.split(/\s*,\s*/).map(e=>e.trim()).filter(Boolean).join(`, `).toUpperCase():``,[h]);(0,t.useImperativeHandle)(p,()=>m.current);let[_,v]=(0,t.useState)(!1),y=(0,t.useMemo)(()=>l?r?{dragInactive:hd.dropZoneDragMultipleThumbnail,dragActive:hd.dropZoneDragActiveMultipleThumbnail,openFileDialog:hd.dropZoneOpenFileDialogMultipleThumbnail}:{dragInactive:hd.dropZoneDragSingleThumbnail,dragActive:hd.dropZoneDragActiveSingleThumbnail,openFileDialog:hd.dropZoneOpenFileDialogSingleThumbnail}:r?{dragInactive:hd.dropZoneDragMultiple,dragActive:hd.dropZoneDragActiveMultiple,openFileDialog:hd.dropZoneOpenFileDialogMultiple}:{dragInactive:hd.dropZoneDragSingle,dragActive:hd.dropZoneDragActiveSingle,openFileDialog:hd.dropZoneOpenFileDialogSingle},[r,l]),b=(0,t.useCallback)(e=>{if(m.current)try{m.current.files=zd(e)}catch{}},[m.current,i]);(0,t.useEffect)(()=>{b(i)},[m,i]);let x=(0,t.useCallback)(e=>{a(e.map(e=>new Id(e))),m.current&&(m.current.value=``)},[a]),S=e=>{let t=e.target.files;if(t.length===0){b(i);return}x(Array.from(t))},C=e=>{x(e)};return(0,n.jsxs)(`div`,{onDrop:e=>{if(e.preventDefault(),v(!1),u)return;let t=e.dataTransfer.files;C(Array.from(t))},onDragOver:e=>{e.preventDefault(),!u&&v(!0)},onDragLeave:()=>{v(!1)},onClick:(0,t.useCallback)(e=>{u||e.target.closest(`.pkt-fileupload__drop-zone__placeholder__title__open-file-dialog`)||m.current?.click()},[u]),className:(0,$.default)(`pkt-fileupload__drop-zone`,{"pkt-fileupload__drop-zone--drag-active":_,"pkt-fileupload__drop-zone--disabled":u}),children:[(0,n.jsx)(`input`,{...f,id:e,type:`file`,ref:m,multiple:r,onChange:S,accept:h,disabled:u,name:s===`form`&&o||void 0,"aria-label":d?void 0:r?`Velg filer`:`Velg fil`}),s===`custom`&&(0,n.jsx)(n.Fragment,{children:i?.map(e=>(0,n.jsx)(`input`,{type:`hidden`,name:o,value:e.fileId},e.fileId))}),(0,n.jsxs)(`div`,{className:`pkt-fileupload__drop-zone__placeholder`,children:[(0,n.jsx)(Q,{name:`attachment`,className:`pkt-fileupload__drop-zone__placeholder__icon`,"aria-hidden":`true`}),(0,n.jsx)(`p`,{className:`pkt-fileupload__drop-zone__placeholder__title`,children:_?`${y.dragActive} ...`:(0,n.jsxs)(n.Fragment,{children:[y.dragInactive,` `,(0,n.jsx)(`button`,{className:`pkt-fileupload__drop-zone__placeholder__title__open-file-dialog`,onClick:e=>{e.preventDefault(),e.stopPropagation(),m.current?.click()},type:`button`,children:y.openFileDialog})]})}),g?(0,n.jsxs)(`p`,{className:`pkt-fileupload__drop-zone__placeholder__formats`,children:[hd.supportedFormatsPrefix,` `,g]}):null]})]})}),zd=e=>{let t=new DataTransfer;for(let n of e)t.items.add(n.file);return t.files},Bd=(0,t.forwardRef)(({id:e,ariaDescribedby:r,ariaLabelledby:i,counter:a,counterMaxLength:o,className:s,disabled:c,errorMessage:l,hasError:u,helptext:d,helptextDropdown:f,helptextDropdownButton:p,inline:m,fullwidth:h=!1,label:g,name:_,optionalTag:v=!1,optionalText:y,requiredTag:b=!1,requiredText:x,tagText:S=null,placeholder:C,rows:w,useWrapper:ee=!0,onChange:T,value:E,autoComplete:te=`off`,minLength:ne,maxLength:re,readOnly:D,skipForwardTestid:ie=!1,...ae},oe)=>{let se=[s,`pkt-textinput`,`pkt-textarea`].join(` `),ce=`${e}-input`,O=`${ce}-label`,le=i||O,[k,A]=(0,t.useState)(0),ue=e=>{a&&A(e.currentTarget?.value?.length||0),T&&T(e)};return(0,t.useEffect)(()=>{E!==void 0&&A(E?.length||0)},[E]),(0,n.jsx)(Cu,{ariaDescribedby:r,className:se,disabled:c,errorMessage:l,forId:ce,hasError:u,helptext:d,helptextDropdown:f,helptextDropdownButton:p,inline:m,label:g,optionalTag:v,optionalText:y,requiredTag:b,requiredText:x,tagText:S,useWrapper:ee,counter:a,counterCurrent:k,counterMaxLength:o,children:(0,n.jsx)(`textarea`,{ref:e=>{A(e?.value?.length||0),typeof oe==`function`&&oe(e)},className:`pkt-input ${h?`pkt-input--fullwidth`:``} ${o&&k>o?`pkt-input--counter-error`:``}`,name:`${_||e}`,id:ce,placeholder:C,disabled:c,rows:w,"aria-labelledby":le,"aria-invalid":u,"aria-errormessage":`${e}-error`,...ae,onChange:ue,value:E,autoComplete:te,minLength:ne,maxLength:re,readOnly:D,"data-skip-forward-testid":ie?`true`:void 0})})});Bd.displayName=`PktTextarea`;var Vd=`comments`,Hd=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?e:`${String(t.getDate()).padStart(2,`0`)}.${String(t.getMonth()+1).padStart(2,`0`)}.${t.getFullYear()} kl. ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`},Ud=({fileItem:e,disabled:r,closeOperationUi:i,onAddComment:a,existingComment:o})=>{let s=(0,t.useRef)(null),c=!!o;return(0,t.useLayoutEffect)(()=>{let e=setTimeout(()=>s.current?.focus({preventScroll:!0}),0);return()=>clearTimeout(e)},[e.fileId]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Bd,{autoFocus:!0,label:c?`Rediger kommentar`:`Legg til kommentar`,name:`comment-${e.fileId}`,className:`pkt-fileupload__queue-display__item__comment-input`,placeholder:`Skriv inn kommentar`,rows:2,id:`comment-${e.fileId}`,ref:s,disabled:r,defaultValue:o?.text}),(0,n.jsx)(rc,{skin:`secondary`,size:`small`,disabled:r,onClick:()=>{let e=s.current?.value?.trim();e&&a({text:e,timestamp:new Date().toISOString()}),i()},children:c?`Lagre kommentar`:`Legg til kommentar`}),(0,n.jsx)(rc,{skin:`tertiary`,size:`small`,disabled:r,onClick:i,children:`Avbryt`})]})},Wd=({comment:e,disabled:t,onDeleteComment:r,onEditComment:i})=>(0,n.jsx)(`div`,{className:`pkt-fileupload__queue-display__item__comments`,children:(0,n.jsxs)(`div`,{className:`pkt-fileupload__queue-display__item__comment`,children:[(0,n.jsxs)(`div`,{className:`pkt-fileupload__queue-display__item__comment__content`,children:[(0,n.jsx)(`span`,{className:`pkt-fileupload__queue-display__item__comment__text`,"aria-label":`Kommentar tekst`,children:e.text}),(0,n.jsx)(`time`,{className:`pkt-fileupload__queue-display__item__comment__time`,children:Hd(e.timestamp)})]}),(0,n.jsxs)(`div`,{className:`pkt-fileupload__queue-display__item__comment__actions`,children:[(0,n.jsx)(`button`,{type:`button`,className:`pkt-fileupload__queue-display__item__comment__action`,onClick:i,disabled:t,"aria-label":`Rediger kommentar`,children:(0,n.jsx)(Q,{name:`edit`})}),(0,n.jsx)(`button`,{type:`button`,className:`pkt-fileupload__queue-display__item__comment__action`,onClick:r,disabled:t,"aria-label":`Slett kommentar`,children:(0,n.jsx)(Q,{name:`trash-can`})})]})]})}),Gd=({comments:e})=>(0,n.jsx)(`input`,{type:`hidden`,name:`${(0,t.useContext)(Ld).name}-comments`,value:e?JSON.stringify(e):``}),Kd=e=>e.getAttribute(Vd)??[],qd={id:`comment`,title:e=>(e.attributes?.[Vd]??[]).length>0?``:`Legg til kommentar`,ariaLabel:`Legg til kommentar`,renderExtendedUI:e=>{let t=Kd(e)[0];return(0,n.jsx)(Ud,{fileItem:e.file,disabled:e.disabled,closeOperationUi:e.close,onAddComment:t=>{e.setAttribute(Vd,[t])},existingComment:t})},renderContent:e=>{if(e.isActive)return null;let t=Kd(e)[0];return t?(0,n.jsx)(Wd,{comment:t,disabled:e.disabled,onEditComment:e.activate,onDeleteComment:()=>e.setAttribute(Vd,void 0)}):null},renderHidden:e=>(0,n.jsx)(Gd,{comments:e.getAttribute(Vd)},`comments${e.file.fileId}`)},Jd=e=>({id:`remove`,title:`Slett`,ariaLabel:`Slett fil`,onClick:({file:t})=>e(t.fileId)}),Yd=({initialValue:e,disabled:r,onSave:i,onCancel:a})=>{let o=(0,t.useRef)(null),s=(0,t.useId)(),c=()=>i(o.current?.value??``);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`label`,{htmlFor:s,className:`pkt-sr-only`,children:`Endre filnavn`}),(0,n.jsx)(`input`,{id:s,ref:o,type:`text`,autoFocus:!0,disabled:r,defaultValue:e,className:`pkt-fileupload__queue-display__item__rename-input`,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),c()),e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),a())}}),(0,n.jsx)(rc,{skin:`secondary`,size:`small`,disabled:r,onClick:c,children:`Lagre`}),(0,n.jsx)(rc,{skin:`tertiary`,size:`small`,disabled:r,onClick:a,children:`Avbryt`})]})},Xd=({targetFilename:e})=>(0,n.jsx)(`input`,{type:`hidden`,name:`${(0,t.useContext)(Ld).name}-targetFilename`,value:e}),Zd=e=>e.getAttribute(`targetFilename`)||Nd(e.file,``),Qd={id:`rename`,title:`Rediger`,ariaLabel:`Rediger filnavn`,renderInlineUI:e=>(0,n.jsx)(Yd,{initialValue:Zd(e),disabled:e.disabled,onSave:t=>{let n=t.trim();n&&e.setAttribute(`targetFilename`,n),e.close()},onCancel:e.close}),renderHidden:e=>(0,n.jsx)(Xd,{targetFilename:Zd(e)},`rename${e.file.fileId}`)},$d=(e,n)=>{let r=(0,t.useCallback)((t,n)=>e.find(e=>e.fileId===t)?.attributes?.[n],[e]),i=(0,t.useCallback)((t,r,i)=>{let a=e.find(e=>e.fileId===t);if(!a)return;let o={...a.attributes,[r]:i};i===void 0&&delete o[r],n(t,{attributes:o})},[n,e]);return{fileAttributes:(0,t.useMemo)(()=>e=>({get:t=>r(t,e),set:(t,n)=>i(t,e,n)}),[r,i]),buildAttributeAccessors:(0,t.useCallback)(e=>({getAttribute:t=>r(e,t),setAttribute:(t,n)=>i(e,t,n)}),[r,i])}},ef=e=>{let[n,r]=(0,t.useState)(!1),[i,a]=(0,t.useState)(0),o=(0,t.useRef)(null);return{isOpen:n,currentIndex:i,modalRef:o,open:(0,t.useCallback)(t=>{let n=e.findIndex(e=>e.fileId===t);n>=0&&(a(n),r(!0),o.current?.showModal())},[e]),close:(0,t.useCallback)(()=>{r(!1),o.current?.close()},[]),navigate:(0,t.useCallback)(t=>{e.length!==0&&a(n=>Ad(n,t,e.length))},[e.length])}},tf=e=>{let[n,r]=(0,t.useState)({});return(0,t.useEffect)(()=>{r(t=>{let n=new Set(e.map(e=>e.id)),r=!1,i={};for(let[e,a]of Object.entries(t))n.has(a)?i[e]=a:r=!0;return r?i:t})},[e]),{getActivated:(0,t.useCallback)(t=>{let r=n[t];if(r)return e.find(e=>e.id===r)},[n,e]),activate:(0,t.useCallback)((e,t)=>{r(n=>({...n,[e]:t.id}))},[]),close:(0,t.useCallback)(e=>{r(t=>{if(!(e in t))return t;let n={...t};return delete n[e],n})},[])}},nf=(e,{uploadStrategy:n,required:r,currentFileCount:i,onMissingFiles:a})=>{(0,t.useEffect)(()=>{if(n!==`custom`||!r)return;let t=e.current?.form;if(!t)return;let o=e=>{i>0||(e.preventDefault(),a())};return t.addEventListener(`submit`,o),()=>{t.removeEventListener(`submit`,o)}},[e,n,r,i,a])},rf=(0,t.forwardRef)(({children:e,className:r,open:i=!1,headingText:a=``,hideCloseButton:o=!1,closeOnBackdropClick:s=!1,size:c=`medium`,removePadding:l=!1,closeButtonSkin:u=`blue`,variant:d=`dialog`,drawerPosition:f=`right`,transparentBackdrop:p=!1,onClose:m,...h},g)=>{let _=(0,t.useRef)(null),v=(0,t.useCallback)(e=>{_.current=e,typeof g==`function`?g(e):g&&(g.current=e)},[g]),y=(0,t.useCallback)(()=>{_.current?.open&&(_.current.close(),m?.())},[m]);(0,t.useEffect)(()=>{let e=_.current;if(!e)return;let t=new MutationObserver(()=>{e.open?document.body.classList.add(`pkt-modal--open`):document.body.classList.remove(`pkt-modal--open`)});return t.observe(e,{attributes:!0,attributeFilter:[`open`]}),()=>t.disconnect()},[]),(0,t.useEffect)(()=>{i?_.current?.open||_.current?.showModal():_.current?.open&&_.current.close()},[i]);let b=(0,t.useCallback)(e=>{s&&e.target===_.current&&y()},[s,y]),x=(0,t.useCallback)(()=>{m?.()},[m]),S=u===`blue`,C=(0,$.default)({"pkt-modal":!0,"pkt-modal--removePadding":l,"pkt-modal--noHeadingText":!a,"pkt-modal--noShadow":u===`yellow-filled`,"pkt-modal--transparentBackdrop":p,[`pkt-modal--${c}`]:c,[`pkt-modal__${d}`]:d,[`pkt-modal__drawer--${f}`]:d===`drawer`},r);return(0,n.jsx)(`dialog`,{...h,className:C,ref:v,"aria-labelledby":a?`pkt-modal__headingText`:void 0,"aria-describedby":`pkt-modal__content`,onClick:b,onClose:x,children:(0,n.jsxs)(`div`,{className:`pkt-modal__wrapper`,children:[(a||!o)&&(0,n.jsxs)(`div`,{className:`pkt-modal__header`,children:[(0,n.jsx)(`div`,{className:`pkt-modal__header-background`}),a?(0,n.jsx)(`h1`,{id:`pkt-modal__headingText`,className:`pkt-modal__headingText pkt-txt-24`,children:a}):(0,n.jsx)(`div`,{className:`pkt-modal__headingText`}),o?(0,n.jsx)(`div`,{className:`pkt-modal__noCloseButton`}):(0,n.jsx)(`div`,{className:(0,$.default)(`pkt-modal__closeButton`,{[`pkt-modal__closeButton--${u}`]:!0}),children:(0,n.jsx)(rc,{onClick:y,"aria-label":`close`,iconName:`close`,variant:`icon-only`,size:`medium`,skin:S?`tertiary`:`primary`,children:`Lukk`})})]}),(0,n.jsx)(`div`,{className:`pkt-modal__container`,children:(0,n.jsx)(`div`,{id:`pkt-modal__content`,className:`pkt-modal__content pkt-txt-18-light`,children:e})})]})})});rf.displayName=`PktModal`;var af=(0,t.createContext)({tail:5}),of=({children:e,tail:r})=>{let i=(0,t.useContext)(af),a=kd(e,r===void 0?i.tail:r);return a?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`span`,{className:`pkt-fileupload__queue-display__item__title__head`,"data-pkt-truncate-part":`first`,children:a.head}),(0,n.jsx)(`span`,{className:`pkt-fileupload__queue-display__item__title__tail`,"data-pkt-truncate-part":`tail`,children:a.tail})]}):(0,n.jsx)(`span`,{"data-pkt-truncate-part":`first`,children:e})},sf=e=>(0,n.jsx)(`button`,{type:`button`,onClick:e.onClick,disabled:e.disabled,className:`pkt-fileupload__queue-display__item__cancel-button`,"aria-label":e.ariaLabel||`Avbryt opplasting`,children:e.label||`Avbryt`}),cf=()=>(0,n.jsx)(`span`,{className:`pkt-fileupload__queue-display__item__loading-text`,"aria-label":`Laster opp fil`,children:`Laster opp`}),lf=({cancelTransfer:e,transferItem:t,disabled:r=!1})=>{let i=t.showProgress??t.progress!==0;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Q,{name:`document-text`,className:`pkt-fileupload__queue-display__item__icon pkt-icon--medium`,"aria-hidden":`true`}),(0,n.jsxs)(`p`,{className:`pkt-fileupload__queue-display__item__title`,"aria-label":`Filnavn`,children:[(0,n.jsx)(of,{children:Nd(t)}),(0,n.jsxs)(`span`,{className:`pkt-fileupload__queue-display__item__filesize`,children:[` `,`(`,_d(t.file.size),`)`]})]}),(0,n.jsx)(sf,{onClick:e,disabled:r}),i?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(hp,{valueCurrent:t.progress*100,statusType:`none`,valueMax:100,statusPlacement:`following`,className:`pkt-fileupload__queue-display__item__progress`}),(0,n.jsx)(`span`,{className:`pkt-fileupload__queue-display__item__percentage`,"aria-hidden":`true`,children:`${Math.round(t.progress*100)}%`})]}):(0,n.jsx)(cf,{})]})},uf=({transferItem:e})=>(0,n.jsxs)(`p`,{className:`pkt-fileupload__queue-display__item__title`,children:[(0,n.jsx)(of,{children:Nd(e)}),e.file&&(0,n.jsxs)(`span`,{className:`pkt-fileupload__queue-display__item__filesize`,children:[` `,`(`,_d(e.file.size),`)`]})]}),df=({transferItem:e,onRemove:t,disabled:r})=>{let i=(e.lastProgress??1)*100;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Q,{className:`pkt-fileupload__queue-display__item__icon pkt-icon--medium`,name:`alert-error`,"aria-hidden":`true`}),(0,n.jsx)(uf,{transferItem:e}),(0,n.jsx)(sf,{onClick:t,label:`Fjern`,ariaLabel:`Fjern fil som feilet under opplasting`,disabled:r}),(0,n.jsx)(hp,{valueCurrent:i,statusType:`none`,valueMax:100,statusPlacement:`following`,className:`pkt-fileupload__queue-display__item__progress pkt-fileupload__queue-display__item__progress--error`}),e.errorMessage&&(0,n.jsx)(`span`,{className:`pkt-fileupload__queue-display__item__error-message`,children:e.errorMessage})]})},ff=({transferItem:e,onRemove:t,disabled:r})=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Q,{className:`pkt-fileupload__queue-display__item__icon pkt-icon--medium`,name:`alert-error`,"aria-hidden":`true`}),(0,n.jsx)(uf,{transferItem:e}),(0,n.jsx)(sf,{onClick:t,label:`Fjern`,ariaLabel:`Fjern fil som feilet under opplasting`,disabled:r}),e.errorMessage&&(0,n.jsx)(`span`,{className:`pkt-fileupload__queue-display__item__error-message`,children:e.errorMessage})]}),pf=({transferItem:e,onRemove:t,disabled:r})=>e.showProgress?(0,n.jsx)(df,{transferItem:e,onRemove:t,disabled:r}):(0,n.jsx)(ff,{transferItem:e,onRemove:t,disabled:r}),mf=({operation:e,context:t})=>{let r=typeof e.title==`function`?e.title(t.file):e.title;return r?(0,n.jsx)(`button`,{type:`button`,className:`pkt-fileupload__queue-display__item__operation`,onClick:()=>{(e.renderInlineUI||e.renderExtendedUI)&&t.activate(),e.onClick?.(t)},disabled:t.disabled,"aria-label":typeof e.ariaLabel==`function`?e.ariaLabel(t.file):e.ariaLabel,children:r}):null},hf=({transferItem:e})=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Q,{name:`document-text`,className:`pkt-fileupload__queue-display__item__icon pkt-icon--medium`,"aria-hidden":`true`}),(0,n.jsx)(uf,{transferItem:e})]}),gf=({transferItem:e,onPreviewClick:r})=>{let[i,a]=(0,t.useState)(null),[o,s]=(0,t.useState)(!1),c=e.file;(0,t.useEffect)(()=>{if(s(!1),c.type.startsWith(`image/`)){let e=URL.createObjectURL(c);return a(e),()=>{URL.revokeObjectURL(e)}}a(null)},[c]);let l=i&&!o&&(0,n.jsx)(`img`,{src:i,alt:e.attributes.targetFilename,onError:()=>s(!0)})||(0,n.jsx)(Q,{name:`document-text`,className:`pkt-fileupload__queue-display__item__icon pkt-icon--medium`}),u=!!r;return(0,n.jsxs)(`div`,{className:`pkt-fileupload__queue-display__item__thumbnail${i&&!o?``:` pkt-fileupload__queue-display__item__thumbnail--fallback`}`,children:[(0,n.jsxs)(rc,{className:`pkt-fileupload__queue-display__item__thumbnail__image-wrapper`,"aria-label":`Forhåndsvis bilde ${e.attributes.targetFilename}`,type:`button`,skin:`secondary`,onClick:r,children:[u&&(0,n.jsx)(Q,{name:`expand`,className:`pkt-fileupload__queue-display__item__thumbnail__expand-icon`,"aria-hidden":`true`}),l]}),(0,n.jsx)(`span`,{className:`pkt-fileupload__queue-display__item__thumbnail__title`,children:(0,n.jsx)(of,{children:e.attributes.targetFilename})})]})},_f=({isOpen:e,images:r,currentIndex:i,onClose:a,onNavigate:o,modalRef:s})=>{let[c,l]=(0,t.useState)(null),[u,d]=(0,t.useState)(!1),f=r[i],p=r.length>1;return(0,t.useEffect)(()=>{if(d(!1),f&&f.file.type.startsWith(`image/`)){let e=URL.createObjectURL(f.file);return l(e),()=>URL.revokeObjectURL(e)}l(null)},[f]),(0,t.useEffect)(()=>{if(!e)return;let t=e=>{if(e.key===`Tab`){Od(e,s.current);return}switch(e.key){case`ArrowLeft`:e.preventDefault(),o(`prev`);break;case`ArrowRight`:e.preventDefault(),o(`next`);break;case`Escape`:e.preventDefault(),a();break}};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,o,a,s]),f?(0,n.jsx)(rf,{ref:s,headingText:f.attributes.targetFilename,closeOnBackdropClick:!0,className:`pkt-fileupload__image-preview-modal`,onClose:a,children:(0,n.jsxs)(`div`,{className:`pkt-fileupload__image-preview`,children:[p&&(0,n.jsx)(rc,{variant:`icon-only`,iconName:`chevron-thin-left`,skin:`secondary`,size:`medium`,className:`pkt-fileupload__image-preview__nav pkt-fileupload__image-preview__nav--prev`,onClick:()=>o(`prev`),"aria-label":`Forrige bilde ${i} / ${r.length}`}),(0,n.jsx)(`div`,{className:`pkt-fileupload__image-preview__content`,children:c&&!u?(0,n.jsx)(`img`,{src:c,alt:`${f.attributes.targetFilename} - ${i+1} av ${r.length}`,className:`pkt-fileupload__image-preview__image`,onError:()=>d(!0)}):(0,n.jsx)(Q,{name:`picture`,className:`pkt-fileupload__queue-display__item__icon pkt-icon--medium`})}),p&&(0,n.jsxs)(`span`,{className:`pkt-fileupload__image-preview__counter`,children:[i+1,` / `,r.length]}),p&&(0,n.jsx)(rc,{variant:`icon-only`,iconName:`chevron-thin-right`,skin:`secondary`,size:`medium`,className:`pkt-fileupload__image-preview__nav pkt-fileupload__image-preview__nav--next`,onClick:()=>o(`next`),"aria-label":`Neste bilde ${i+2} / ${r.length}`})]})}):null},vf=({operation:e,transferItem:t,inputName:n,disabled:r,activatedOperation:i,onActivate:a,onClose:o,buildAttributeAccessors:s})=>{let c=s(t.fileId);return{file:t,inputName:n,disabled:r,isActive:i?.id===e.id,activate:()=>a(t.fileId,e),close:()=>o(t.fileId),getAttribute:c.getAttribute,setAttribute:c.setAttribute}},yf=(e,t)=>e.map(e=>({operation:e,context:vf({operation:e,...t})})),bf=e=>(0,n.jsx)(`div`,{className:`pkt-fileupload__queue-display__item__actions`,children:yf(e.operations,e).filter(({operation:t})=>t.id!==e.activatedOperation?.id).map(({operation:e,context:t})=>(0,n.jsx)(mf,{operation:e,context:t},e.id))}),xf=e=>(0,n.jsx)(n.Fragment,{children:yf(e.operations,e).filter(({operation:e})=>e.renderContent).map(({operation:e,context:t})=>(0,n.jsx)(`div`,{className:`pkt-fileupload__queue-display__item__operation-content`,children:e.renderContent(t)},e.id))}),Sf=e=>{let{transferItem:t,activatedOperation:r,operations:i,ItemRenderer:a,onPreviewClick:o}=e,s=r?vf({operation:r,...e}):void 0,c=r?.renderInlineUI||r?.renderExtendedUI?[]:i;return(0,n.jsxs)(n.Fragment,{children:[r?.renderInlineUI&&s?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Q,{name:`document-text`,className:`pkt-fileupload__queue-display__item__icon`}),(0,n.jsx)(`div`,{className:`pkt-fileupload__queue-display__item__inline-ui`,children:r.renderInlineUI(s)})]}):(0,n.jsx)(a,{transferItem:t,queueItemOperations:i,onPreviewClick:o}),c.length>0&&(0,n.jsx)(bf,{...e,operations:c}),(0,n.jsx)(xf,{...e}),r?.renderExtendedUI&&s&&(0,n.jsx)(`div`,{className:`pkt-fileupload__queue-display__item__expanded-operation-ui`,children:r.renderExtendedUI(s)})]})},Cf=e=>{let{transferItem:t,enableImagePreview:r,onCancelTransfer:i,onOpenPreview:a,disabled:o}=e,s=Td(t.progress),c=r&&t.progress===`done`&&wd(t);switch(s){case`in-progress`:return(0,n.jsx)(lf,{transferItem:t,cancelTransfer:()=>i(t.fileId),disabled:o});case`error`:return(0,n.jsx)(pf,{transferItem:t,onRemove:()=>i(t.fileId),disabled:o});case`idle`:return(0,n.jsx)(Sf,{...e,onPreviewClick:c?()=>a(t.fileId):void 0})}},wf=(e,n,r)=>(0,t.useMemo)(()=>Ed(e,n,r),[e,n,r]),Tf=(e,n)=>(0,t.useMemo)(()=>n?e.filter(e=>e.progress===`done`&&wd(e)):[],[e,n]),Ef=({files:e,cancelTransfer:t,transfers:r=[],queueItemOperations:i=[],ItemRenderer:a=hf,truncateTail:o,enableImagePreview:s=!1,uploadStrategy:c=`form`,disabled:l=!1,inputName:u,buildAttributeAccessors:d})=>{let f=wf(e,r,c),p=Tf(f,s),m=tf(i),h=ef(p);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`ul`,{className:`pkt-fileupload__queue-display`,children:(0,n.jsx)(af.Provider,{value:{tail:o},children:f.map(e=>{let r={transferItem:e,operations:i,activatedOperation:m.getActivated(e.fileId),inputName:u,disabled:l,onActivate:m.activate,onClose:m.close,buildAttributeAccessors:d};return(0,n.jsxs)(`li`,{className:(0,$.default)(`pkt-fileupload__queue-display__item`,{"pkt-fileupload__queue-display__item--in-progress":typeof e.progress==`number`,[`pkt-fileupload__queue-display__item--${e.progress}`]:typeof e.progress==`string`}),children:[i.filter(e=>e.renderHidden).map(t=>(0,n.jsx)(`span`,{children:t.renderHidden(vf({operation:t,...r}))},`${t.id}-${e.fileId}`)),(0,n.jsx)(Cf,{...r,ItemRenderer:a,enableImagePreview:s,onCancelTransfer:t,onOpenPreview:h.open})]},e.fileId)})})}),s&&p.length>0&&(0,n.jsx)(_f,{modalRef:h.modalRef,isOpen:h.isOpen,images:p,currentIndex:h.currentIndex,onClose:h.close,onNavigate:h.navigate})]})},Df={filename:hf,thumbnail:gf},Of=(0,t.forwardRef)(({value:e,defaultValue:r,id:i,multiple:a=!1,uploadStrategy:o=`form`,addCommentsEnabled:s=!1,renameFilesEnabled:c=!1,truncateTail:l=4,onFilesChanged:u,onFileUploadRequested:d,extraOperations:f=[],itemRenderer:p=Df.filename,fullwidth:m=!1,allowedFormats:h,formatErrorMessage:g,maxFileSize:_,sizeErrorMessage:v,onFileValidation:y,onFileValidate:b,errorMessage:x,hasError:S=!1,disabled:C=!1,label:w,helptext:ee,optionalTag:T,requiredTag:E,required:te=!1,enableImagePreview:ne=!1,"aria-describedby":re,"aria-invalid":D,...ie},ae)=>{let oe=(0,t.useId)(),se=i??`pkt-fileupload-${oe}`,ce=(0,t.useRef)(null);(0,t.useImperativeHandle)(ae,()=>ce.current,[]);let O=`transfers`in ie?ie.transfers:void 0,[le,k]=(0,t.useState)(null),[A,ue]=(0,t.useState)(``);(0,t.useEffect)(()=>{if(!A)return;let e=setTimeout(()=>ue(``),1500);return()=>clearTimeout(e)},[A]);let de=le??x??null,j=S||!!le||!!(x&&x.trim()),M=de?`${se}-error`:void 0,N=[re,ee?`${se}-helptext`:void 0,M].filter(Boolean).join(` `)||void 0,P=j||D===!0||D===`true`,F=(0,t.useCallback)(e=>{let t=Cd(e,{allowedFormats:h,maxFileSize:_,formatErrorMessage:g,sizeErrorMessage:v,onFileValidation:y});if(t)return t;if(b){let t={file:e,errorMessage:null};if(b(t),t.errorMessage)return t.errorMessage}return null},[h,g,_,v,y,b]);e!==void 0&&r!==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`),e!==void 0&&u===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`);let I=e!==void 0,[fe,pe]=(0,t.useState)(()=>r??[]),L=I?e:fe;nf(ce,{uploadStrategy:o,required:te,currentFileCount:L.length,onMissingFiles:(0,t.useCallback)(()=>k(hd.requiredMissing),[])});let R=typeof p==`string`?Df[p]:p,me=p===`thumbnail`,he=typeof ie.accept==`string`?ie.accept.trim():void 0,z=(0,t.useMemo)(()=>xd(he,h)||void 0,[he,h]),B=c&&!me,V=s&&!me,ge=(0,t.useCallback)(e=>{for(let t of e){let e=F(t.file);if(e){k(e);return}}k(null);let t=a?[...L,...e]:[e[0]],n=a?e:[e[0]];ue(n.length===1?hd.srFileAdded(n[0].attributes.targetFilename):hd.srFilesAdded(n.length)),I||pe(t),u?.(t),o===`custom`&&d&&e.forEach(e=>{d?.(e)})},[u,L,a,o,d,F,I]),H=(0,t.useCallback)((e,t)=>{let n=L.map(n=>n.fileId===e?{...n,...t}:n);I||pe(n),u?.(n)},[u,L,I]),_e=(0,t.useCallback)(e=>{let t=L.filter(t=>t.fileId!==e);I||pe(t),u?.(t),`onTransferCancelled`in ie&&ie.onTransferCancelled&&ie.onTransferCancelled?.(e)},[u,L,ie,I]),{buildAttributeAccessors:ve}=$d(L,H),U=(0,t.useMemo)(()=>{let e=[];return B&&e.push(Qd),V&&e.push(qd),e.push(...f),e.push(Jd(_e)),e},[B,V,f,_e]),{totalCount:ye,uploadedCount:be,failedCount:xe}=(0,t.useMemo)(()=>jd(L,O),[L,O]),Se=hd.fileLabel(ye),Ce=(0,n.jsx)(`div`,{className:(0,$.default)(`pkt-fileupload`,{"pkt-fileupload--full-width":m,"pkt-fileupload--error":j,"pkt-fileupload--disabled":C}),"aria-disabled":C,...C?{inert:``}:{},children:(0,n.jsxs)(Ld.Provider,{value:{name:ie.name||``,multiple:!!a,id:se},children:[(0,n.jsx)(`div`,{className:`pkt-sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:A||(ye>0&&be>0?hd.srFilesUploadedOfTotal(be,ye,Se):``)}),(0,n.jsx)(`div`,{className:`pkt-sr-only`,"aria-live":`assertive`,"aria-atomic":`true`,children:ye>0&&xe>0&&hd.srFilesFailedOfTotal(xe,ye,Se)}),(0,n.jsx)(Rd,{id:se,name:ie.name||``,value:L,onFilesAdded:ge,multiple:a,uploadStrategy:o,ref:ce,accept:me?Md:z,isThumbnailView:me,disabled:C,required:te&&o===`form`,"aria-required":te?`true`:void 0,"aria-invalid":P?`true`:void 0,"aria-describedby":N,hasVisibleLabel:!!w}),j&&de&&(0,n.jsx)(ec,{skin:`error`,"aria-live":`assertive`,role:`alert`,compact:!0,id:M,className:`pkt-fileupload__error-alert`,children:de}),L.length>0&&(0,n.jsx)(Ef,{files:L,cancelTransfer:_e,truncateTail:l,transfers:O,uploadStrategy:o,ItemRenderer:R,enableImagePreview:me&&ne,disabled:C,inputName:ie.name||``,buildAttributeAccessors:ve,queueItemOperations:U})]})});return w?(0,n.jsx)(Cu,{forId:se,label:w,helptext:ee,disabled:C,hasError:j,optionalTag:T,requiredTag:E,className:(0,$.default)(`pkt-fileupload-wrapper`,{"pkt-fileupload-wrapper--full-width":m}),children:Ce}):Ce});Of.displayName=`PktFileUpload`;var kf=({columnOne:e,columnTwo:r,socialLinks:i,className:a,openLinksInNewTab:o=!1,personvernOgInfoLink:s=`https://www.oslo.kommune.no/personvern-og-informasjonskapsler/`,tilgjengelighetLink:c=`https://www.oslo.kommune.no/tilgjengelighet/`,includeConsent:l=!1,hotjarId:u=null,googleAnalyticsId:d=null,devMode:f=!1,cookieDomain:p=null,cookieSecure:m=null,cookieExpiryDays:h=null,onToggleConsent:g=e=>{console.log(e.detail)}})=>(0,n.jsx)(`footer`,{className:[a,`pkt-footer`].filter(Boolean).join(` `),"data-mode":`dark`,children:(0,n.jsxs)(`div`,{className:`pkt-footer__container`,children:[(0,n.jsxs)(`div`,{className:`pkt-grid pkt-grid--rowgap-size-32 pkt-grid--gap-size-16`,children:[(0,n.jsxs)(`div`,{className:`pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up`,children:[(0,n.jsx)(`h2`,{className:`pkt-footer__title`,children:e.title}),(0,n.jsxs)(`ul`,{className:`pkt-footer__list`,children:[e.text&&(0,n.jsx)(`li`,{className:`pkt-footer__text`,children:e.text}),e.links?.map((e,t)=>(0,n.jsx)(`li`,{className:`pkt-footer__list-item`,children:(0,n.jsxs)(`a`,{className:`pkt-footer__link ${e.external?`pkt-link--external`:``}`,href:e.href,target:e.openInNewTab||o?`_blank`:`_self`,rel:e.openInNewTab||o?`noopener noreferrer`:void 0,children:[(0,n.jsx)(Q,{className:`pkt-footer__link-icon`,name:`chevron-right`}),e.text]})},`links-${t}`))]})]}),(0,n.jsxs)(`div`,{className:`pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up`,children:[(0,n.jsx)(`h2`,{className:`pkt-footer__title`,children:r.title}),(0,n.jsxs)(`ul`,{className:`pkt-footer__list`,children:[r.text&&(0,n.jsx)(`li`,{className:`pkt-footer__text`,children:r.text}),r.links?.map((e,t)=>(0,n.jsx)(`li`,{className:`pkt-footer__list-item`,children:(0,n.jsxs)(`a`,{className:`pkt-footer__link ${e.external?`pkt-link--external`:``}`,href:e.href,target:e.openInNewTab||o?`_blank`:`_self`,rel:e.openInNewTab||o?`noopener noreferrer`:void 0,children:[(0,n.jsx)(Q,{className:`pkt-footer__link-icon`,name:`chevron-right`}),e.text]})},`links-${t}`))]})]}),(0,n.jsxs)(`div`,{className:`pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up`,children:[(0,n.jsx)(`h2`,{className:`pkt-footer__title`,children:`Om nettstedet`}),(0,n.jsxs)(`ul`,{className:`pkt-footer__list`,children:[(0,n.jsx)(`li`,{className:`pkt-footer__list-item`,children:(0,n.jsxs)(`a`,{className:`pkt-footer__link`,href:s,target:o?`_blank`:`_self`,rel:o?`noopener noreferrer`:void 0,children:[(0,n.jsx)(Q,{className:`pkt-footer__link-icon`,name:`chevron-right`}),`Personvern og informasjonskapsler`]})}),(0,n.jsx)(`li`,{className:`pkt-footer__list-item`,children:(0,n.jsxs)(`a`,{className:`pkt-footer__link`,href:c,target:o?`_blank`:`_self`,rel:o?`noopener noreferrer`:void 0,children:[(0,n.jsx)(Q,{className:`pkt-footer__link-icon`,name:`chevron-right`}),`Tilgjengelighet`]})}),l&&(0,n.jsx)(`li`,{className:`pkt-footer__list-item`,children:(0,n.jsx)(Yu,{triggerType:`footerlink`,hotjarId:u,googleAnalyticsId:d,devMode:f,cookieDomain:p,cookieSecure:m,cookieExpiryDays:h,onToggleConsent:g})})]})]})]}),i&&(0,n.jsxs)(`div`,{className:`pkt-footer__social`,"aria-label":`standard lenker`,children:[(0,n.jsx)(`div`,{className:`pkt-footer__social-languages`,children:i.filter(e=>e.language).map((e,t)=>(0,n.jsx)(`div`,{className:`pkt-footer__social-language`,children:(0,n.jsx)(`a`,{href:e.href,"aria-label":`til ${e.language} versjon av nettsiden`,target:e.openInNewTab||o?`_blank`:`_self`,rel:e.openInNewTab||o?`noopener noreferrer`:void 0,children:e.language})},`sociallinks-language-${t}`))}),(0,n.jsx)(`div`,{className:`pkt-footer__social-icons`,children:i.filter(e=>e.iconName).map((e,r)=>(0,n.jsx)(t.Fragment,{children:(0,n.jsx)(`a`,{href:e.href,"aria-label":`til ${e.iconName}`,className:`pkt-footer__social-icon-link`,target:e.openInNewTab||o?`_blank`:`_self`,rel:e.openInNewTab||o?`noopener noreferrer`:void 0,children:(0,n.jsx)(Q,{className:`pkt-footer__social-icon`,name:e.iconName})})},`sociallinks-${r}`))})]})]})}),Af=({links:e=[],openLinksInNewTab:t=!1,personvernOgInfoLink:r=`https://www.oslo.kommune.no/personvern-og-informasjonskapsler/`,tilgjengelighetLink:i=`https://www.oslo.kommune.no/tilgjengelighet/`,includeConsent:a=!1,hotjarId:o=null,googleAnalyticsId:s=null,devMode:c=!1,cookieDomain:l=null,cookieSecure:u=null,cookieExpiryDays:d=null,onToggleConsent:f=e=>{console.log(e.detail)},className:p})=>(0,n.jsx)(`footer`,{className:[p,`pkt-footer-simple`].filter(Boolean).join(` `),"data-mode":`dark`,children:(0,n.jsx)(`div`,{className:`pkt-footer-simple__container`,children:(0,n.jsxs)(`ul`,{className:`pkt-footer-simple__list`,children:[e.map((e,r)=>(0,n.jsx)(`li`,{className:`pkt-footer-simple__list-item`,children:(0,n.jsxs)(`a`,{className:`pkt-footer-simple__link ${e.external?` pkt-link--external`:``}`,href:e.href,target:e.openInNewTab||t?`_blank`:`_self`,rel:e.openInNewTab||t?`noopener noreferrer`:void 0,children:[(0,n.jsx)(Q,{className:`pkt-footer-simple__link-icon`,name:`chevron-right`}),e.text]})},r)),(0,n.jsx)(`li`,{className:`pkt-footer-simple__list-item`,children:(0,n.jsxs)(`a`,{className:`pkt-footer-simple__link`,href:r,target:t?`_blank`:`_self`,rel:t?`noopener noreferrer`:void 0,children:[(0,n.jsx)(Q,{className:`pkt-footer-simple__link-icon`,name:`chevron-right`}),`Personvern og informasjonskapsler`]})}),(0,n.jsx)(`li`,{className:`pkt-footer-simple__list-item`,children:(0,n.jsxs)(`a`,{className:`pkt-footer-simple__link`,href:i,target:t?`_blank`:`_self`,rel:t?`noopener noreferrer`:void 0,children:[(0,n.jsx)(Q,{className:`pkt-footer-simple__link-icon`,name:`chevron-right`}),`Tilgjengelighet`]})}),a&&(0,n.jsx)(`li`,{className:`pkt-footer-simple__list-item`,children:(0,n.jsx)(Yu,{triggerType:`footerlink`,hotjarId:o,googleAnalyticsId:s,devMode:c,cookieDomain:l,cookieSecure:u,cookieExpiryDays:d,onToggleConsent:f})})]})})}),jf=(e,n)=>{let[r,i]=(0,t.useState)(()=>typeof window>`u`?n??0:n??window.innerWidth);return(0,t.useEffect)(()=>{let t=e.current;if(!t)return;if(i(t.offsetWidth),typeof ResizeObserver>`u`){let e=()=>{t&&i(t.offsetWidth)};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)}let n=new ResizeObserver(e=>{for(let t of e)t.borderBoxSize&&t.borderBoxSize.length>0?i(t.borderBoxSize[0].inlineSize):i(t.contentRect.width)});return n.observe(t),()=>{n.disconnect()}},[e]),r};function Mf(e){let n=(0,t.useRef)(0);(0,t.useEffect)(()=>{let t=document.body,r=document.documentElement;if(e){n.current=window.scrollY||window.pageYOffset;let e=window.innerWidth-r.clientWidth;e>0&&(t.style.paddingRight=`${e}px`),t.style.position=`fixed`,t.style.top=`-${n.current}px`,t.style.left=`0`,t.style.right=`0`,t.style.width=`100%`,t.style.overflow=`hidden`,r.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:n.current});return()=>{e&&(t.style.cssText=``,document.documentElement.classList.remove(`is-scroll-locked`),window.scrollTo({top:n.current}))}},[e])}var Nf=({href:e,iconName:t,className:r,iconPosition:i,external:a,target:o,children:s,...c})=>{let l={"pkt-link":!0,"pkt-link--icon-left":!!t&&i===`left`||!!(t&&!i),"pkt-link--icon-right":!!t&&i===`right`,"pkt-link--external":a};return(0,n.jsxs)(`a`,{...c,className:(0,$.default)(l,r),href:e,target:o,rel:a?`noopener noreferrer`:void 0,children:[t&&(0,n.jsx)(Q,{name:t,className:`pkt-link__icon`}),s]})};Nf.displayName=`PktLink`;var Pf=e=>typeof e.target==`string`?{title:e.title,iconName:e.iconName,href:e.target}:{title:e.title,iconName:e.iconName,onClick:e.target},Ff=({item:e,className:t})=>`href`in e?(0,n.jsx)(Nf,{iconName:e.iconName,href:e.href,"aria-hidden":`true`,className:(0,$.default)(`pkt-user-menu__link`,t),children:e.title}):(0,n.jsxs)(`button`,{className:(0,$.default)(`pkt-user-menu__link pkt-link-button pkt-link pkt-link--icon-left`,t),type:`button`,onClick:()=>{`onClick`in e&&typeof e.onClick==`function`?e.onClick():console.error(`UserMenuButton item is missing onClick handler or onClick is not a function:`,e)},children:[e.iconName&&(0,n.jsx)(Q,{name:e.iconName,className:`pkt-link__icon`,"aria-hidden":`true`}),e.title]}),If=({links:e})=>(0,n.jsx)(`ul`,{className:`pkt-user-menu__sublist`,children:e.map((e,t)=>(0,n.jsx)(`li`,{className:`pkt-user-menu__subitem`,children:(0,n.jsx)(Ff,{item:e})},t))}),Lf=(0,t.forwardRef)(({user:e,formattedLastLoggedIn:t,representing:r,userMenu:i,canChangeRepresentation:a,changeRepresentation:o,logoutOnClick:s},c)=>{let l=i?.map(Pf);return(0,n.jsx)(`nav`,{className:`pkt-user-menu`,ref:c,"aria-label":`Meny for innlogget bruker`,children:(0,n.jsxs)(`ul`,{className:`pkt-user-menu__list`,children:[e&&(0,n.jsxs)(`li`,{className:`pkt-user-menu__item`,children:[(0,n.jsx)(`div`,{className:`pkt-user-menu__label`,children:`Pålogget som`}),(0,n.jsx)(`div`,{className:`pkt-user-menu__name`,translate:`no`,children:e.name}),t&&(0,n.jsxs)(`div`,{className:`pkt-user-menu__last-logged-in`,children:[`Sist pålogget: `,(0,n.jsx)(`time`,{children:t})]})]}),l&&l.length>0&&(0,n.jsx)(`li`,{className:`pkt-user-menu__item`,children:(0,n.jsx)(If,{links:l})}),r&&(0,n.jsxs)(`li`,{className:`pkt-user-menu__item`,children:[(0,n.jsx)(`div`,{className:`pkt-user-menu__label`,children:`Representerer`}),(0,n.jsx)(`div`,{className:`pkt-user-menu__name`,translate:`no`,children:r.name}),r.orgNumber&&(0,n.jsxs)(`div`,{className:`pkt-user-menu__org-number`,children:[`Org.nr. `,r.orgNumber]}),a&&o&&(0,n.jsx)(`ul`,{className:`pkt-user-menu__sublist mt-size-16`,children:(0,n.jsx)(`li`,{className:`pkt-user-menu__subitem`,children:(0,n.jsx)(Ff,{item:{title:`Endre organisasjon`,iconName:`cogwheel`,onClick:o}})})})]}),!r&&a&&o&&(0,n.jsx)(`li`,{className:`pkt-user-menu__item`,children:(0,n.jsx)(`ul`,{className:`pkt-user-menu__sublist`,children:(0,n.jsx)(`li`,{className:`pkt-user-menu__subitem`,children:(0,n.jsx)(Ff,{item:{title:`Endre organisasjon`,iconName:`cogwheel`,onClick:o}})})})}),s&&(0,n.jsx)(`li`,{className:`pkt-user-menu__item`,children:(0,n.jsx)(Ff,{item:{title:`Logg ut`,iconName:`exit`,onClick:s}})})]})})});Lf.displayName=`PktHeaderUserMenu`;var Rf=(0,t.forwardRef)(({id:e,ariaDescribedby:r,ariaLabelledby:i,autocomplete:a=`off`,counter:o,counterMaxLength:s,className:c,disabled:l=!1,errorMessage:u,hasError:d=!1,helptext:f,helptextDropdown:p,helptextDropdownButton:m,iconNameRight:h,inline:g=!1,fullwidth:_=!1,label:v,name:y,optionalTag:b=!1,optionalText:x,requiredTag:S=!1,requiredText:C,tagText:w=null,placeholder:ee,prefix:T,suffix:E,type:te=`text`,useWrapper:ne=!0,omitSearchIcon:re=!1,value:D,minLength:ie,maxLength:ae,min:oe,max:se,step:ce,size:O,readonly:le,required:k,dataTestid:A,onChange:ue,skipForwardTestid:de=!1,...j},M)=>{let N=[c,`pkt-textinput`].join(` `),P=te===`search`&&!h&&!re,F=te===`date`&&D?D.slice(0,10):D,[I,fe]=(0,t.useState)(D?.length||0),pe=`${e}`,L=`${pe}-label`,R=i||L,me=e=>{o&&fe(e.currentTarget?.value?.length||0),ue&&ue(e)};return(0,t.useEffect)(()=>{D!==void 0&&fe(D?.length||0)},[D]),(0,n.jsx)(Cu,{ariaDescribedby:r,className:N,disabled:l,errorMessage:u,forId:pe,hasError:d,helptext:f,helptextDropdown:p,helptextDropdownButton:m,inline:g,label:v,optionalTag:b,optionalText:x,requiredTag:S,requiredText:C,tagText:w,useWrapper:ne,counter:o,counterCurrent:I,counterMaxLength:s,children:(0,n.jsxs)(`div`,{className:`pkt-input__container`,"data-testid":A,"data-skip-forward-testid":de?`true`:void 0,children:[T&&(0,n.jsx)(`div`,{className:`pkt-input-prefix`,children:T}),(0,n.jsx)(`input`,{...j,ref:M,className:`pkt-input ${_?`pkt-input--fullwidth`:``} ${s&&I>s?`pkt-input--counter-error`:``}`,type:te,name:`${y||e}`,value:F,id:pe,placeholder:ee,autoComplete:a,disabled:l,"aria-invalid":d,"aria-errormessage":`${e}-error`,"aria-labelledby":R,min:oe,max:se,onChange:me,step:ce,minLength:ie,maxLength:ae,size:O,readOnly:le,required:k}),E&&(0,n.jsxs)(`p`,{className:`pkt-input-suffix`,children:[E,h&&(0,n.jsx)(Q,{className:`pkt-input-suffix-icon`,name:h}),P&&(0,n.jsx)(Q,{className:`pkt-input-suffix-icon`,name:`magnifying-glass-big`})]}),!E&&h&&(0,n.jsx)(Q,{className:`pkt-input-icon`,name:h}),!E&&P&&(0,n.jsx)(Q,{className:`pkt-input-icon`,name:`magnifying-glass-big`})]})})});Rf.displayName=`PktTextinput`;var zf=(0,t.forwardRef)(({mobileBreakpoint:e=768,tabletBreakpoint:r=1280,children:i,className:a,compact:o=!1,"data-mode":s,logOutButtonPlacement:c=`none`,logOut:l,openedMenu:u,showSearch:d=!1,onSearch:f,onSearchChange:p,searchValue:m,searchPlaceholder:h=`Søk`,representing:g,serviceLink:_,serviceClick:v,serviceName:y,user:b,userMenu:x,userMenuFooter:S,userOptions:C,canChangeRepresentation:w=!1,changeRepresentation:ee,hideLogo:T=!1,logoLink:E,logoClick:te,position:ne=`fixed`,scrollBehavior:re=`hide`,slotMenuVariant:D=`icon-only`,slotMenuText:ie=`Meny`},ae)=>{let oe=ne===`fixed`,se=re===`hide`;(0,t.useEffect)(()=>{S&&console.warn(`PktHeaderService: The "userMenuFooter" prop is deprecated and will be removed in a future version. Please use "userMenu" instead.`)},[S]),(0,t.useEffect)(()=>{C&&console.warn(`PktHeaderService: The "userOptions" prop is no longer available. Please use "userMenu" instead.`)},[C]),(0,t.useEffect)(()=>{b?.shortname&&console.warn(`PktHeaderService: The "shortname" property on the user object is deprecated and will be removed in a future version.`),g?.shortname&&console.warn(`PktHeaderService: The "shortname" property on the representing object is deprecated and will be removed in a future version.`)},[b?.shortname,g?.shortname]);let ce=(0,t.useMemo)(()=>{if(b?.lastLoggedIn)return typeof b.lastLoggedIn==`string`?b.lastLoggedIn:new Date(b.lastLoggedIn).toLocaleString(`nb-NO`,{year:`numeric`,month:`long`,day:`numeric`})},[b?.lastLoggedIn]),[O,le]=(0,t.useState)(u||`none`);(0,t.useEffect)(()=>{u!==void 0&&le(u)},[u]);let[k,A]=(0,t.useState)(!1),[ue,de]=(0,t.useState)(0),[j,M]=(0,t.useState)(!1),[N,P]=(0,t.useState)(!1),F=(0,t.useRef)(null),I=(0,t.useRef)(null),fe=(0,t.useRef)(null),pe=(0,t.useRef)(null),L=(0,t.useRef)(null),R=(0,t.useRef)(null),me=(0,t.useRef)(null),he=(0,t.useRef)(!1),z=jf(F),B=z<e,V=z<r,ge=(0,t.useCallback)(e=>{F.current=e,typeof ae==`function`?ae(e):ae&&(ae.current=e)},[ae]);Mf(oe&&B&&O!==`none`);let H=(0,t.useCallback)((e,t)=>{let n=e.relatedTarget,r;switch(t){case`user`:r=I;break;case`slot`:r=fe;break;case`search`:r=pe;break;default:return}let i=r.current;i&&(!n||!i.contains(n))&&le(`none`)},[]),_e=(0,t.useCallback)(()=>{he.current&&me.current&&document.contains(me.current)&&me.current.focus(),me.current=null,he.current=!1},[]);(0,t.useEffect)(()=>{let e=e=>{b&&O===`user`&&!e.target.closest(`.pkt-header-service__user-container`)&&le(`none`),O===`slot`&&!e.target.closest(`.pkt-header-service__slot-container`)&&le(`none`),O===`search`&&!e.target.closest(`.pkt-header-service__search-container`)&&!e.target.closest(`.pkt-header-service__search-input`)&&le(`none`)},t=e=>{e.key===`Escape`&&O!==`none`&&(e.preventDefault(),he.current=!0,le(`none`))};if(O!==`none`)return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)};_e()},[O,b,_e]),(0,t.useEffect)(()=>{let e=()=>{if(se){let e=window.pageYOffset||document.documentElement.scrollTop;if(e<0||Math.abs(e-ue)<60)return;A(e>ue),de(e)}};return document&&window.addEventListener(`scroll`,e),()=>{document&&window.removeEventListener(`scroll`,e)}},[se,ue]);let ve=(0,t.useCallback)(e=>{let t=e===`slot`?fe:pe,n=e===`slot`?L:R;if(!t.current||!n.current||!V||B)return;let r=t.current.getBoundingClientRect(),i=n.current.offsetWidth,a=r.left+i>window.innerWidth;e===`slot`?M(a):P(a)},[V,B]),U=(0,t.useCallback)(e=>{O===`none`?(me.current=document.activeElement,le(e)):le(`none`)},[O]);(0,t.useEffect)(()=>{(O===`slot`||O===`search`)&&requestAnimationFrame(()=>{ve(O)})},[O,ve]);let ye=(0,n.jsxs)(`header`,{className:(0,$.default)(`pkt-header-service`,o&&`pkt-header-service--compact`,B&&`pkt-header-service--mobile`,V&&`pkt-header-service--tablet`,oe&&`pkt-header-service--fixed`,se&&`pkt-header-service--scroll-to-hide`,k&&`pkt-header-service--hidden`,a),"data-mode":s,ref:ge,children:[(0,n.jsxs)(`div`,{className:(0,$.default)(`pkt-header-service__logo-area`,(!y||y===``)&&`pkt-header-service__logo-area--without-service`),children:[!T&&(0,n.jsx)(`span`,{className:`pkt-header-service__logo`,children:E?(0,n.jsx)(`a`,{href:E,"aria-label":`Tilbake til forside`,children:(0,n.jsx)(Q,{name:`oslologo`,"aria-hidden":`true`,path:`https://punkt-cdn.oslo.kommune.no/16.17/logos/`})}):te?(0,n.jsx)(`button`,{"aria-label":`Tilbake til forside`,className:`pkt-link-button pkt-link pkt-header-service__logo-link`,onClick:te,children:(0,n.jsx)(Q,{name:`oslologo`,"aria-hidden":`true`,path:`https://punkt-cdn.oslo.kommune.no/16.17/logos/`})}):(0,n.jsx)(Q,{name:`oslologo`,"aria-hidden":`true`,path:`https://punkt-cdn.oslo.kommune.no/16.17/logos/`})}),y&&(0,n.jsx)(`span`,{className:`pkt-header-service__service-name`,children:_?(0,n.jsx)(Nf,{href:_,className:`pkt-header-service__service-link `,children:y}):v?(0,n.jsx)(`button`,{className:`pkt-link-button pkt-link pkt-header-service__service-link`,onClick:v,children:y}):(0,n.jsx)(`span`,{className:`pkt-header-service__service-link`,children:y})})]}),i||d||V&&l&&(c===`header`||c===`both`)?(0,n.jsxs)(`div`,{className:`pkt-header-service__content`,children:[(0,n.jsxs)(`div`,{className:(0,$.default)(`pkt-header-service__slot-container`,O===`slot`&&`is-open`),onBlur:e=>H(e,`slot`),ref:fe,children:[V&&i&&(0,n.jsx)(rc,{skin:`secondary`,variant:D,iconName:`menu`,size:B?`small`:`medium`,state:O===`slot`?`active`:`normal`,onClick:()=>U(`slot`),"aria-expanded":O===`slot`,"aria-controls":`mobile-slot-menu`,"aria-label":`Åpne meny`,children:ie}),(0,n.jsx)(`div`,{className:(0,$.default)(`pkt-header-service__slot-content`,j&&`align-right`),id:`mobile-slot-menu`,role:V?`menu`:void 0,"aria-label":V?`Meny`:void 0,ref:L,children:(0,n.jsx)(`div`,{className:`pkt-contents`,children:i})})]}),d&&(0,n.jsx)(n.Fragment,{children:V?(0,n.jsxs)(`div`,{className:(0,$.default)(`pkt-header-service__search-container`,O===`search`&&`is-open`),onBlur:e=>H(e,`search`),ref:pe,children:[(0,n.jsx)(rc,{skin:`secondary`,variant:`icon-only`,iconName:`magnifying-glass-big`,size:B?`small`:`medium`,onClick:()=>U(`search`),state:O===`search`?`active`:`normal`,"aria-expanded":O===`search`,"aria-controls":`mobile-search-menu`,"aria-label":`Åpne søkefelt`,children:`Søk`}),(0,n.jsx)(`div`,{className:(0,$.default)(`pkt-header-service__mobile-menu`,O===`search`&&`is-open`,N&&`align-right`),ref:R,children:O===`search`&&(0,n.jsx)(Rf,{id:`mobile-search-menu`,className:`pkt-header-service__search-input`,type:`search`,label:`Søk`,useWrapper:!1,placeholder:h,value:m,autoFocus:!0,fullwidth:!0,onChange:e=>p?.(e.target.value),onKeyDown:e=>{e.key===`Enter`&&f?.(e.target.value)}})})]}):(0,n.jsx)(Rf,{id:`header-service-search`,className:`pkt-header-service__search-input`,type:`search`,label:`Søk`,useWrapper:!1,placeholder:h,value:m,onChange:e=>p?.(e.target.value),onKeyDown:e=>{e.key===`Enter`&&f?.(e.target.value)}})}),B&&l&&(c===`header`||c===`both`)&&(0,n.jsx)(rc,{skin:`secondary`,size:B?`small`:`medium`,variant:`icon-only`,iconName:`exit`,onClick:l,children:`Logg ut`})]}):null,(b||!B&&l&&(c===`header`||c===`both`))&&(0,n.jsxs)(`div`,{className:`pkt-header-service__user`,children:[b&&(0,n.jsxs)(`div`,{className:`pkt-header-service__user-container`,onBlur:e=>H(e,`user`),ref:I,children:[(0,n.jsxs)(rc,{className:(0,$.default)(`pkt-header-service__user-button`,B&&`pkt-header-service__user-button--mobile`),skin:`secondary`,size:B?`small`:`medium`,state:O===`user`?`active`:`normal`,variant:`icons-right-and-left`,iconName:`user`,secondIconName:O===`user`?`chevron-thin-up`:`chevron-thin-down`,onClick:()=>U(`user`),children:[(0,n.jsx)(`span`,{className:`pkt-sr-only`,children:`Brukermeny: `}),g?.name||b.name]}),O===`user`&&b&&(0,n.jsx)(`div`,{className:(0,$.default)(B?`pkt-header-service__mobile-menu`:`pkt-header-service__user-menu`,`is-open`),children:(0,n.jsx)(Lf,{user:b,formattedLastLoggedIn:ce,representing:g,userMenu:x,canChangeRepresentation:w,changeRepresentation:ee,logoutOnClick:c===`userMenu`||c===`both`?l:void 0})})]}),!B&&l&&(c===`header`||c===`both`)&&(0,n.jsx)(rc,{skin:`tertiary`,size:`medium`,variant:`icon-right`,iconName:`exit`,onClick:l,children:`Logg ut`})]})]});return oe?(0,n.jsxs)(`div`,{className:`pkt-header-service-wrapper`,children:[ye,(0,n.jsx)(`div`,{className:(0,$.default)(`pkt-header-service-spacer`,o&&`pkt-header-service-spacer--compact`,b&&`pkt-header-service-spacer--has-user`,B&&`pkt-header-service-spacer--mobile`,V&&`pkt-header-service-spacer--tablet`)})]}):ye});zf.displayName=`PktHeaderService`;var Bf=(0,t.forwardRef)((e,t)=>(0,n.jsx)(zf,{...e,ref:t}));Bf.displayName=`PktHeader`;var Vf={automat:`parking-meter`,bike:`bicycle`,corona:`virus`,directions:`arrow-directions`,document:`document-plain`,"download-document":`document-download`,elcar:`electric-car`,"error-hexa":`alert-error`,"fire-emblem":`shield-fire`,"link-arrow":`arrow-link`,"linked-in":`linkedin`,"map-layer":`map-layers`,mobile:`mobile-phone`,neutral:`smiley-neutral`,placeholder:`placeholder-icon`,sad:`smiley-sad`,signing:`signature`,sky:`cloud`,smile:`smiley-smile`,"success-square":`alert-success`,trash:`trash-can`,treatment:`processing`,"warning-triangle":`alert-warning`};function Hf(e){return e&&(Vf[e]??e)}var Uf={"facebook.com":`facebook`,"fb.com":`facebook`,"instagram.com":`instagram`,"linkedin.com":`linkedin`,"x.com":`x`,"github.com":`github`};function Wf(e){return e.toLowerCase().replace(/^(?:www|m)\./,``)}function Gf(e,t){if(e)try{let t=Uf[Wf(new URL(e).hostname)];if(t)return t}catch{}if(t){let e=t.trim().toLowerCase().replace(/\s+/g,`-`);if(e){let t=Hf(e);if(t)return t}}}var Kf=`nb-NO`;function qf(e,t=Kf){if(e)return e[t]??e[Kf]}async function Jf(e=pd,t){let n=await fetch(e,{signal:t});if(!n.ok)throw Error(`pkt-header-menu: failed to fetch ${e} (HTTP ${n.status})`);let r=await n.json();if(!r||typeof r!=`object`)throw Error(`pkt-header-menu: ${e} returned a non-object payload`);return r}var Yf=({dataUrl:e=pd,data:r,locale:i=`nb-NO`,open:a=!1,mobileBreakpoint:o=768,ariaLabelledBy:s,className:c,onDataLoaded:l,onDataError:u,ref:d,...f})=>{let[p,m]=(0,t.useState)(r?`ready`:`idle`),[h,g]=(0,t.useState)(void 0),[_,v]=(0,t.useState)(!1),y=(0,t.useRef)(l),b=(0,t.useRef)(u);(0,t.useEffect)(()=>{y.current=l},[l]),(0,t.useEffect)(()=>{b.current=u},[u]),(0,t.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(max-width: ${o-1}px)`);v(e.matches);let t=e=>v(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[o]),(0,t.useEffect)(()=>{r&&(m(`ready`),y.current?.(r))},[r]),(0,t.useEffect)(()=>{if(r)return;let t=new AbortController;return m(`loading`),Jf(e,t.signal).then(e=>{t.signal.aborted||(g(e),m(`ready`),y.current?.(e))}).catch(e=>{e.name!==`AbortError`&&(m(`error`),b.current?.(e))}),()=>t.abort()},[r,e]);let x=r??h,S=(0,t.useMemo)(()=>qf(x,i),[x,i]),C=[`pkt-header-menu`,a&&`pkt-header-menu--open`,c].filter(Boolean).join(` `);if(p===`loading`)return(0,n.jsx)(`section`,{...f,ref:d,className:C,children:(0,n.jsx)(`nav`,{"aria-busy":`true`,children:(0,n.jsx)(`p`,{className:`pkt-header-menu__loading`,children:`Laster meny…`})})});if(p===`error`||!S)return(0,n.jsx)(`section`,{...f,ref:d,className:C,children:(0,n.jsx)(`nav`,{"aria-hidden":!a,children:(0,n.jsx)(`p`,{className:`pkt-header-menu__error`,children:`Kunne ikke laste meny.`})})});let{megamenu:w,i18n:ee}=S,T=ee?.navAriaLabel||`Hovedmeny`;return(0,n.jsx)(`section`,{...f,ref:d,className:C,"aria-labelledby":s||void 0,children:(0,n.jsxs)(`nav`,{"aria-label":T,children:[_?(0,n.jsx)(Zf,{services:w.services,sections:w.sections}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Qf,{services:w.services}),(0,n.jsx)($f,{buttons:w.buttons,mobile:!1}),(0,n.jsx)(ep,{sections:w.sections})]}),(0,n.jsx)($f,{buttons:w.buttons,mobile:!0}),(0,n.jsx)(np,{links:w.links,some:w.some})]})})},Xf=({services:e})=>(0,n.jsx)(`ul`,{className:`pkt-header-menu__services-list`,children:e.links.map((e,t)=>(0,n.jsx)(`li`,{className:`pkt-header-menu__service`,children:(0,n.jsxs)(`a`,{className:`pkt-header-menu__service-link`,href:e.url,children:[(0,n.jsx)(Q,{className:`pkt-header-menu__service-icon`,name:Hf(e.icon),"aria-hidden":`true`}),(0,n.jsx)(`span`,{className:`pkt-header-menu__service-text`,children:e.text})]})},`service-${t}`))}),Zf=({services:e,sections:t})=>(0,n.jsx)(`div`,{className:`pkt-header-menu__sections`,children:(0,n.jsxs)(_,{className:`pkt-header-menu__sections-inner`,skin:`plus-minus`,name:`header-menu-accordion`,children:[(0,n.jsx)($s,{className:`pkt-header-menu__section`,skin:`plus-minus`,id:`pkt-header-menu-services`,title:e.title,children:(0,n.jsx)(Xf,{services:e})}),t.map((e,t)=>(0,n.jsx)($s,{className:`pkt-header-menu__section`,skin:`plus-minus`,id:`pkt-header-menu-section-${t}`,title:e.title,children:(0,n.jsx)(tp,{links:e.links})},`section-${t}`))]})}),Qf=({services:e})=>(0,n.jsxs)(`div`,{className:`pkt-header-menu__services`,children:[(0,n.jsx)(`h2`,{className:`pkt-header-menu__services-title`,children:e.title}),(0,n.jsx)(Xf,{services:e})]}),$f=({buttons:e,mobile:t})=>!e||e.length===0?null:(0,n.jsx)(`div`,{className:[`pkt-header-menu__buttons`,t&&`pkt-header-menu__buttons--mobile`].filter(Boolean).join(` `),children:e.map((e,t)=>(0,n.jsxs)(`a`,{className:`pkt-btn pkt-btn--secondary pkt-btn--icon-right pkt-btn--small`,href:e.url,children:[(0,n.jsx)(Q,{className:`pkt-btn__icon`,name:e.iconName?Hf(e.iconName):`user`,"aria-hidden":`true`}),(0,n.jsx)(`span`,{className:`pkt-btn__text`,children:e.text})]},`button-${t}`))}),ep=({sections:e})=>!e||e.length===0?null:(0,n.jsx)(`div`,{className:`pkt-header-menu__sections`,children:(0,n.jsx)(`div`,{className:`pkt-header-menu__sections-inner`,children:e.map((e,t)=>(0,n.jsxs)(`div`,{className:`pkt-header-menu__section`,children:[(0,n.jsx)(`h2`,{className:`pkt-header-menu__section-title`,children:e.title}),(0,n.jsx)(tp,{links:e.links})]},`section-${t}`))})}),tp=({links:e})=>(0,n.jsx)(`ul`,{className:`pkt-header-menu__section-list`,children:e.map((e,t)=>(0,n.jsx)(`li`,{children:(0,n.jsx)(`a`,{className:`pkt-header-menu__section-link`,href:e.url,children:e.text})},`section-link-${t}`))}),np=({links:e,some:t})=>{let r=e&&e.length>0,i=t&&t.length>0;return!r&&!i?null:(0,n.jsxs)(`div`,{className:`pkt-header-menu__footer`,children:[r&&(0,n.jsx)(`ul`,{className:`pkt-header-menu__footer-list`,children:e.map((e,t)=>(0,n.jsx)(`li`,{children:(0,n.jsx)(`a`,{className:`pkt-header-menu__footer-link`,href:e.url,children:e.text})},`footer-link-${t}`))}),i&&(0,n.jsx)(`ul`,{className:`pkt-header-menu__footer-list pkt-header-menu__footer-list--social`,children:t.map((e,t)=>(0,n.jsx)(rp,{entry:e},`some-${t}`))})]})},rp=({entry:e})=>{let t=Gf(e.url,e.text);return(0,n.jsx)(`li`,{children:(0,n.jsx)(`a`,{className:`pkt-header-menu__social-link`,href:e.url,"aria-label":e.text,children:t?(0,n.jsx)(Q,{name:t,"aria-hidden":`true`}):(0,n.jsx)(`span`,{children:e.text})})})},ip=x({tagName:`pkt-heading`,elementClass:pi,react:t.default,displayName:`PktHeading`}),ap=(0,t.forwardRef)(({children:e,...t},r)=>(0,n.jsx)(ip,{"data-testid":`pkt-heading`,...t,ref:r,children:e}));ap.displayName=`PktHeading`;var op=x({tagName:`pkt-helptext`,elementClass:Gi,react:t.default,displayName:`PktHelptext`,events:{onToggleHelpText:`toggleHelpText`}}),sp=(0,t.forwardRef)(({children:e,...t},r)=>(0,n.jsx)(op,{...t,ref:r,children:(0,n.jsx)(`div`,{className:`pkt-contents`,children:e})}));sp.displayName=`PktHelptext`;var cp=(0,t.forwardRef)(({label:e,id:t,children:r,...i},a)=>(0,n.jsxs)(`div`,{className:`pkt-form-group`,children:[(0,n.jsx)(`label`,{htmlFor:t,className:`pkt-form-label`,children:e}),(0,n.jsx)(`input`,{className:`pkt-form-input`,id:t,...i,ref:a}),r]}));cp.displayName=`PktInput`;var lp=({children:e,skin:t,title:r,href:i,iconName:a,openInNewTab:o,external:s,className:c,...l})=>{let u=[`pkt-linkcard`,t&&`pkt-linkcard--${t}`].filter(Boolean).join(` `),d=[`pkt-linkcard__title`,s&&`pkt-link pkt-link--external`].filter(Boolean).join(` `);return(0,n.jsxs)(`a`,{...l,href:i,className:(0,$.default)(u,c),target:o?`_blank`:`_self`,rel:o?`noopener noreferrer`:void 0,children:[a&&(0,n.jsx)(Q,{className:`pkt-link__icon`,name:a}),r&&(0,n.jsx)(`div`,{className:(0,$.default)(d),children:r}),(0,n.jsx)(`div`,{className:`pkt-linkcard__text`,children:e})]})};lp.displayName=`PktLinkCard`;var up=x({tagName:`pkt-loader`,elementClass:Es,react:t.default,displayName:`PktLoader`,events:{}}),dp=(0,t.forwardRef)(({children:e,...t},r)=>(0,n.jsx)(up,{...t,ref:r,children:(0,n.jsx)(`div`,{className:`pkt-contents`,children:e})}));dp.displayName=`PktLoader`;var fp=({children:e,className:r,skin:i,title:a,compact:o,closable:s,onClose:c,...l})=>{let[u,d]=(0,t.useState)(!1),f={"pkt-messagebox":!0,"pkt-messagebox--compact":o,[`pkt-messagebox--${i}`]:i,"pkt-messagebox--closable":s,"pkt-hide":u},p=(0,t.createRef)(),m=(0,t.useCallback)(()=>{d(!0),c&&c()},[d,c]);return(0,n.jsxs)(`div`,{...l,className:(0,$.default)(f,r),ref:p,children:[s&&(0,n.jsx)(`div`,{className:`pkt-messagebox__close`,children:(0,n.jsx)(`button`,{onClick:m,className:`pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only`,"aria-label":`Lukk`,children:(0,n.jsx)(Q,{name:`close`,className:`pkt-link__icon`})})}),a&&(0,n.jsx)(`div`,{className:`pkt-messagebox__title`,children:a}),(0,n.jsx)(`div`,{className:`pkt-messagebox__text`,children:e})]})};fp.displayName=`PktMessagebox`;var pp=()=>(`00000000000000000`+(Math.random()*0x10000000000000000).toString(16)).slice(-16),mp=()=>{let e=pp(),t=pp();return e.slice(0,8)+`-`+e.slice(8,12)+`-4`+e.slice(13)+`-a`+t.slice(1,4)+`-`+t.slice(4)},hp=(0,t.forwardRef)(({ariaLabel:e,ariaLabelledby:r,ariaLive:i=`polite`,ariaValueText:a,id:o,role:s=`progressbar`,skin:c=`dark-blue`,statusPlacement:l=`following`,statusType:u=`none`,title:d,titlePosition:f=`left`,valueCurrent:p=0,valueMax:m=100,valueMin:h=0,className:g,..._},v)=>{let y=(0,t.useMemo)(()=>mp(),[]),b=o||y,x=(0,t.useRef)(null),[S,C]=(0,t.useState)(0);(0,t.useEffect)(()=>{x.current&&C(x.current.getBoundingClientRect().width||0)},[p]);let w=m-h,ee=Math.round(u===`fraction`?p/w*100:(p-h)/w*100),T=`${p} av ${w}`,E=u===`fraction`&&!a?`${p} av ${m-h}`:a||void 0,te=e?void 0:r||`${b}-title`;return(0,n.jsx)(`div`,{ref:v,id:b,role:s,"aria-live":i,"aria-atomic":`true`,"aria-valuenow":p,"aria-valuemin":h,"aria-valuemax":m,"aria-valuetext":E,"aria-label":e||void 0,"aria-labelledby":te,className:(0,$.default)(`pkt-progressbar`,g),..._,children:(0,n.jsxs)(`div`,{className:`pkt-progressbar__container`,style:{"--pkt-progress-label-width":`${S}px`,"--pkt-progress-width":`${ee}%`},children:[d&&(0,n.jsx)(`p`,{id:`${b}-title`,className:(0,$.default)(`pkt-progressbar__title`,{"pkt-progressbar__title-center":f===`center`}),children:d}),(0,n.jsx)(`div`,{className:`pkt-progressbar__bar-wrapper`,children:(0,n.jsx)(`div`,{className:(0,$.default)(`pkt-progressbar__bar`,`pkt-progressbar__bar--${c}`)})}),u!==`none`&&(0,n.jsx)(`div`,{className:(0,$.default)(`pkt-progressbar__status`,{"pkt-progressbar__status--center":l===`center`}),children:(0,n.jsx)(`span`,{ref:x,className:(0,$.default)({"pkt-progressbar__status-placement--following":l===`following`,"pkt-progressbar__status-placement--center":l===`center`,"pkt-progressbar__status-placement--left":l===`left`}),children:u===`percentage`?`${ee}%`:T})})]})})});hp.displayName=`PktProgressbar`;var gp=(0,t.forwardRef)(({id:e,name:t,label:r,className:i,hasTile:a=!1,disabled:o=!1,checkHelptext:s,hasError:c=!1,defaultChecked:l,checked:u,optionalTag:d,optionalText:f,requiredTag:p,requiredText:m,tagText:h,...g},_)=>{let v=[i,`pkt-input-check`].filter(Boolean).join(` `),y=[`pkt-input-check__input`,a?`pkt-input-check__input--tile`:``,o&&a?`pkt-input-check__input--tile-disabled`:``].filter(Boolean).join(` `),b=[`pkt-input-check__input-checkbox`,c?`pkt-input-check__input-checkbox--error`:``].filter(Boolean).join(` `),x=[`pkt-input-check__input-label`,o?`pkt-input-check__input-label--disabled`:``].filter(Boolean).join(` `),S=[`pkt-tag`,`pkt-tag--small`,`pkt-tag--thin-text`].join(` `),C=()=>(0,n.jsxs)(n.Fragment,{children:[h&&(0,n.jsx)(`span`,{className:S+` pkt-tag--gray`,children:h}),d&&(0,n.jsx)(`span`,{className:S+` pkt-tag--blue-light`,children:f}),p&&(0,n.jsx)(`span`,{className:S+` pkt-tag--beige`,children:m})]});return(0,n.jsx)(`div`,{className:v,children:(0,n.jsxs)(`div`,{className:y,children:[(0,n.jsx)(`input`,{ref:_,id:e,type:`radio`,name:t,disabled:o,className:b,...u===void 0?{defaultChecked:l}:{checked:u},...g}),(0,n.jsxs)(`label`,{className:x,htmlFor:e,children:[r,` `,C(),s&&(0,n.jsx)(`div`,{className:`pkt-input-check__input-helptext`,children:s})]})]})})});gp.displayName=`PktRadioButton`;var _p=(0,t.forwardRef)(({appearance:e=`local`,disabled:t=!1,fullwidth:r=!1,id:i,label:a,name:o,placeholder:s=`Søk…`,suggestions:c,value:l=``,action:u,method:d,onChange:f,onSearch:p,onSuggestionClick:m,...h},g)=>{let _=(e,t)=>{e?e():m&&m(t)},v=e=>{l=e.target.value},y={role:`search`,className:`pkt-searchinput pkt-searchinput--${e} ${r?`pkt-searchinput--fullwidth`:``}`,...Su()},b=e=>u?(0,n.jsx)(`form`,{...y,action:u,method:d,children:e}):(0,n.jsx)(`div`,{...y,children:e}),x=e=>(0,n.jsxs)(n.Fragment,{children:[e.title&&(0,n.jsx)(`h3`,{className:`pkt-searchinput__suggestion-title`,children:e.title}),e.text&&(0,n.jsx)(`p`,{className:`pkt-searchinput__suggestion-text`,children:e.text})]}),S=e=>[`pkt-searchinput__suggestion`,e.onClick?`pkt-link-button`:``].filter(Boolean).join(` `);return b((0,n.jsxs)(n.Fragment,{children:[a&&(0,n.jsx)(`label`,{htmlFor:a?i:void 0,className:a?`pkt-inputwrapper__label`:``,children:a}),(0,n.jsxs)(`div`,{className:e===`local`?`pkt-input__container`:`pkt-searchinput__field`,children:[(0,n.jsx)(`input`,{className:`pkt-input ${r?`pkt-input--fullwidth`:``}`,type:`search`,name:o||i,id:i,placeholder:s,defaultValue:l,disabled:t,autoComplete:`off`,"aria-autocomplete":`list`,ref:g,"aria-controls":`${i}-suggestions`,onChange:f||v,onKeyUp:p&&(e=>{e.key===`Enter`&&(e.preventDefault(),p(l))}),...h}),(0,n.jsx)(rc,{className:`pkt-searchinput__button ${e===`local`?`pkt-input-icon`:``}`,variant:`icon-only`,iconName:`magnifying-glass-big`,skin:e===`local`?`tertiary`:`primary`,color:e===`global`?`yellow`:void 0,type:`submit`,disabled:t,onClick:p&&(e=>{e.preventDefault(),p(l)}),children:a||s})]}),c&&(0,n.jsx)(`ul`,{id:`${i}-suggestions`,className:`pkt-searchinput__suggestions`,"aria-live":`assertive`,children:c.map((e,t)=>e.href?(0,n.jsx)(`li`,{children:(0,n.jsx)(`a`,{href:e.href,className:S(e),onClick:()=>_(e.onClick,t),children:x(e)})},`search-suggestion-${t}`):e.nonInteractive?(0,n.jsx)(`li`,{children:(0,n.jsx)(`div`,{className:`pkt-searchinput__suggestion`,children:x(e)})},`search-suggestion-${t}`):(0,n.jsx)(`li`,{children:(0,n.jsx)(`button`,{type:`button`,className:S(e),onClick:()=>_(e.onClick,t),children:x(e)})},`search-suggestion-${t}`))})]}))});_p.displayName=`PktSearchInput`;var vp=(0,t.forwardRef)(({ariaDescribedby:e,ariaLabelledby:t,children:r,className:i,disabled:a=!1,errorMessage:o,hasError:s,helptext:c,helptextDropdown:l,helptextDropdownButton:u,id:d,inline:f=!1,fullwidth:p=!1,label:m,name:h,optionalTag:g=!1,optionalText:_,requiredTag:v=!1,requiredText:y,tagText:b,...x},S)=>(0,n.jsx)(Cu,{className:[i,`pkt-select`].join(` `),forId:`${d}-input`,label:m,helptext:c,helptextDropdown:l,helptextDropdownButton:u,optionalTag:g,optionalText:_,requiredTag:v,requiredText:y,tagText:b,hasError:s,errorMessage:o,disabled:a,inline:f,ariaDescribedby:e,children:(0,n.jsx)(`select`,{ref:S,className:`pkt-input ${p?`pkt-input--fullwidth`:``}`,"aria-invalid":s,"aria-errormessage":`${d}-error`,"aria-labelledby":t||void 0,disabled:a,id:`${d}-input`,name:h||d,...x,children:r})}));vp.displayName=`PktSelect`;var yp=(0,n.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,fill:`none`,children:(0,n.jsx)(`circle`,{cx:`12`,cy:`12`,r:`7`,style:{fill:`var(--pkt-color-grays-grey-200, #CCC)`}})}),bp=(0,n.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,fill:`none`,children:[(0,n.jsx)(`circle`,{opacity:`.15`,cx:`12`,cy:`12`,r:`12`,fill:`#2A2859`}),(0,n.jsx)(`circle`,{cx:`12`,cy:`12`,r:`6`,fill:`#2A2859`})]}),xp=(0,n.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,fill:`none`,children:[(0,n.jsx)(`path`,{fill:`#2A2859`,d:`M3 3h18v18H3z`}),(0,n.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`})]}),Sp=({children:e,className:t,status:r=`incomplete`,title:i})=>(0,n.jsxs)(`li`,{className:(0,$.default)(`pkt-step`,t,`pkt-step--${r}`),"data-testid":`pkt-step`,children:[(0,n.jsx)(`span`,{className:`pkt-step__line pkt-step__line--1`,"aria-hidden":!0}),(0,n.jsx)(`span`,{className:`pkt-step__line pkt-step__line--2`,"aria-hidden":!0}),(0,n.jsx)(`span`,{className:(0,$.default)(`pkt-step__indicator`),children:r===`current`?bp:r===`completed`?xp:yp}),(0,n.jsx)(`span`,{className:`pkt-step__line pkt-step__line--3`,"aria-hidden":!0}),(0,n.jsxs)(`div`,{className:`pkt-step__wrapper`,children:[(0,n.jsx)(`div`,{className:`pkt-step__title`,children:i}),(0,n.jsx)(`div`,{className:`pkt-step__content`,children:e})]})]}),Cp=(0,t.forwardRef)(({activeStep:e,className:r,children:i,hideNonActiveSteps:a=!1,hideNonActiveStepsContent:o=!0,orientation:s=`vertical`,...c},l)=>{let u=(0,$.default)(r,`pkt-stepper`,s===`horizontal`?`pkt-stepper--horizontal`:`pkt-stepper--vertical`),d=t.Children.map(i,(n,r)=>(0,t.isValidElement)(n)?(0,t.cloneElement)(n,{className:(0,$.default)(n.props.className,{"pkt-step--hideStep":a&&r!==e,"pkt-step--hideContent":o&&r!==e})}):n);return(0,n.jsx)(`ol`,{"data-testid":`pkt-stepper`,className:u,ref:l,...c,children:d})});Cp.displayName=`PktStepper`;var wp=({className:e,compact:t=!1,skin:r=`basic`,responsiveView:i=!0,children:a,...o})=>(0,n.jsx)(`table`,{"data-testid":`pkt-table`,className:(0,$.default)(e,`pkt-table`,{"pkt-table--responsive":i,"pkt-table--compact":t,"pkt-table--basic":r===`basic`,"pkt-table--zebra-blue":r===`zebra-blue`}),role:`table`,...o,children:a}),Tp=({id:e,children:t,className:r,...i})=>(0,n.jsx)(`tbody`,{id:e,className:(0,$.default)(r,`pkt-table__body`,{}),...i,role:`rowgroup`,children:t}),Ep=({children:e,className:t,dataLabel:r,...i})=>(0,n.jsx)(`td`,{className:(0,$.default)(t,`pkt-table__data-cell`,{}),"data-label":r,role:`cell`,"data-testid":`pkt-table__data-cell`,...i,children:e}),Dp=({className:e,children:t,...r})=>(0,n.jsx)(`thead`,{className:(0,$.default)(e,`pkt-table__header`,{}),role:`rowgroup`,...r,children:t}),Op=({className:e,children:t,...r})=>(0,n.jsx)(`th`,{className:(0,$.default)(e,`pkt-table__header-cell`,{}),role:`columnheader`,...r,children:t}),kp=({className:e,children:t,...r})=>(0,n.jsx)(`tr`,{className:(0,$.default)(e,`pkt-table__row`,{}),role:`row`,...r,children:t}),Ap=(0,t.forwardRef)(({children:e,active:t,disabled:r=!1,href:i,onClick:a,icon:o,controls:s,tag:c,tagSkin:l,index:u=0},d)=>{let{arrowNav:f,registerTabRef:p,handleKeyPress:m,selectTab:h}=Mp(),g=!!t&&!r,_={"aria-selected":f?g:void 0,"aria-controls":s,role:f?`tab`:void 0,onKeyDown:e=>{if(r&&(e.key===`Enter`||e.key===` `||e.key===`Spacebar`)){e.preventDefault(),e.stopPropagation();return}m(u,e)},onClick:e=>{if(r){e.preventDefault(),e.stopPropagation();return}h(u),a?.(e)},tabIndex:r?-1:g||!f?void 0:-1,ref:e=>{p(u,e,r),typeof d==`function`?d(e):d&&(d.current=e)}},v=(0,n.jsxs)(n.Fragment,{children:[o&&(0,n.jsx)(Q,{name:o,className:`pkt-icon--small ${o===`check`?`pkt-tabs__status-icon`:``}`}),e,c&&(0,n.jsx)(yu,{skin:l,size:`small`,children:c})]});return i?(0,n.jsx)(`a`,{..._,href:r?void 0:i,"aria-disabled":r||void 0,className:`pkt-tabs__link ${g?`active`:``} ${r?`pkt-tabs__item--disabled`:``}`,children:v}):(0,n.jsx)(`button`,{..._,type:`button`,disabled:r,"aria-disabled":r||void 0,className:`pkt-tabs__button pkt-link-button ${g?`active`:``} ${r?`pkt-tabs__item--disabled`:``}`,children:v})});Ap.displayName=`PktTabItem`;var jp=(0,t.createContext)(null),Mp=()=>{let e=(0,t.useContext)(jp);if(!e)throw Error(`TabItem must be used within a Tabs component`);return e},Np=(0,t.forwardRef)(({arrowNav:e=!0,disableArrowNav:r=!1,separatorIconName:i,separatorIconPath:a,tabs:o,onTabSelected:s,children:c},l)=>{let u=(0,t.useRef)([]),d=(0,t.useRef)({}),f=e&&!r,p=t.Children.toArray(c),m=p.length>0,h=m?p.length:o?.length||0,g=!!(i||a);(0,t.useEffect)(()=>{u.current=u.current.slice(0,h),Object.keys(d.current).forEach(e=>{let t=Number(e);t>=h&&delete d.current[t]})},[h]);let _=e=>o?!!o[e]?.disabled:!!d.current[e],v=e=>{if(_(e))return;let t=o?.[e];t?.action&&t.action(e),s&&s(e)},y=(e,t)=>{let n=e+t;for(;n>=0&&n<h;){if(!_(n))return n;n+=t}return null},b=(e,t)=>{if(f){if(t.key===`ArrowLeft`){t.preventDefault();let n=y(e,-1);n!==null&&u.current[n]?.focus()}if(t.key===`ArrowRight`){t.preventDefault();let n=y(e,1);n!==null&&u.current[n]?.focus()}(t.key===`Enter`||t.key===` `||t.key===`Spacebar`||t.key===`ArrowDown`)&&(t.preventDefault(),_(e)||v(e))}},x=(e,t,n=!1)=>{u.current[e]=t,d.current[e]=n},S=e=>(0,n.jsx)(`span`,{className:`pkt-tabs__separator`,"aria-hidden":`true`,role:`presentation`,children:a?(0,n.jsx)(`img`,{src:a,alt:``,"aria-hidden":`true`}):i?(0,n.jsx)(Q,{name:i,className:`pkt-tabs__separator-icon`}):null},e),C=e=>!g||e.length<=1?e:e.flatMap((t,n)=>n<e.length-1?[t,S(`separator-${n}`)]:[t]),w=o?.map((e,t)=>(0,n.jsx)(Ap,{active:e.disabled?!1:e.active,disabled:e.disabled,href:e.href,icon:e.icon,controls:e.controls,tag:e.tag?.text,tagSkin:e.tag?.skin,index:t,children:e.text},t)),ee=[`pkt-tabs`,g&&`pkt-tabs--with-separator`].filter(Boolean).join(` `),T=C(m?p:w||[]);return(0,n.jsx)(jp.Provider,{value:{arrowNav:f,registerTabRef:x,handleKeyPress:b,selectTab:v},children:(0,n.jsx)(`div`,{className:ee,ref:l,children:(0,n.jsx)(`div`,{className:`pkt-tabs__list`,role:f?`tablist`:`navigation`,children:T})})})});Np.displayName=`PktTabs`;var Pp=e=>e?Math.max(1,Math.round(e/60)):1,Fp=(e,t)=>{let n=e?parseInt(String(e).split(`:`)[0],10):0,r=t?parseInt(String(t).split(`:`)[0],10):23;return Array.from({length:r-n+1},(e,t)=>t+n)},Ip=e=>{let t=Pp(e);return Array.from({length:Math.floor(60/t)},(e,n)=>n*t)},Lp=(e,t,n,r)=>{let i=e===``?n===1?0:23:parseInt(e,10),a=t===``?n===1?0:Math.floor(59/r)*r:parseInt(t,10);return a+=n*r,a>59?(a=0,i=(i+1)%24):a<0&&(a=Math.floor(59/r)*r,i=(i-1+24)%24),{hours:String(i).padStart(2,`0`),minutes:String(a).padStart(2,`0`)}},Rp=e=>/^\d{2}:\d{2}$/.test(e)&&parseInt(e.slice(0,2),10)<=23&&parseInt(e.slice(3),10)<=59,zp=e=>{let[t,n]=e.split(`:`).map(Number);return t*60+n},Bp={required:`Dette feltet er påkrevd`,invalid:`Ugyldig verdi`,timeStepMismatch:`Må treffe på et steg, for eksempel 0, {step} minutter`,timeStepMismatchHour:`Må treffe på hver hele time`,timeStepMismatchHalfHour:`Må treffe på hver hele eller halve time`,rangeUnderflowMin:`Verdien må være større enn eller lik {min}.`,rangeOverflowMax:`Verdien må være mindre enn eller lik {max}.`};function Vp(e){if(e&&Rp(e)){let[t,n]=e.split(`:`);return[t,n]}return[``,``]}function Hp(e,t){return`${String(parseInt(e,10)).padStart(2,`0`)}:${String(parseInt(t,10)).padStart(2,`0`)}`}function Up(e,t){let{required:n,min:r,max:i,step:a}=t;if(n&&!e)return{valid:!1,message:Bp.required};if(!e)return{valid:!0};if(!Rp(e))return{valid:!1,message:Bp.invalid};let o=zp(e),s=Pp(a);return r&&o<zp(String(r))?{valid:!1,message:Bp.rangeUnderflowMin.replace(`{min}`,String(r))}:i&&o>zp(String(i))?{valid:!1,message:Bp.rangeOverflowMax.replace(`{max}`,String(i))}:a&&o%s!==0?{valid:!1,message:s===60?Bp.timeStepMismatchHour:s===30?Bp.timeStepMismatchHalfHour:Bp.timeStepMismatch.replace(`{step}`,`${s}, ${s*2}, ${s*3}`)}:{valid:!0}}function Wp(e){return e===3600||e<3600&&3600%e==0&&e%60==0}function Gp(e,n){let{id:r,label:i,value:a,defaultValue:o,min:s,max:c,step:l=60,hidePicker:u=!1,stepArrows:d=!1,fullwidth:f=!1,name:p,disabled:m=!1,required:h=!1,helptext:g,helptextDropdown:_,helptextDropdownButton:v,hasError:y=!1,errorMessage:b,optionalTag:x=!1,optionalText:S,requiredTag:C=!1,requiredText:w,tagText:ee,inline:T=!1,useWrapper:E=!0,ariaDescribedby:te,strings:ne,className:re,onValueChange:D,onFocus:ie,onBlur:ae}=e,oe=(0,t.useMemo)(()=>ne??md,[ne]),se=a!==void 0,ce=a===void 0?o??``:a??``,O=(0,t.useRef)(ce),[le,k]=(0,t.useState)(()=>ce),A=se?a??``:le,[ue,de]=(0,t.useState)(()=>Vp(a===void 0?o:a)[0]),[j,M]=(0,t.useState)(()=>Vp(a===void 0?o:a)[1]),N=(0,t.useRef)(ue),P=(0,t.useRef)(j),F=(0,t.useCallback)(e=>{N.current=e,de(e)},[]),I=(0,t.useCallback)(e=>{P.current=e,M(e)},[]),[fe,pe]=(0,t.useState)(!1),[L,R]=(0,t.useState)(!1),me=(0,t.useRef)(a);(0,t.useEffect)(()=>{if(!se||a===me.current)return;me.current=a;let[e,t]=Vp(a);F(e),I(t)},[a,se,F,I]),(0,t.useEffect)(()=>{l!=null&&!Wp(l)&&console.warn(`PktTimepicker: step="${l}" er ikke en gyldig verdi. Step må være et multiplum av 60 (hele minutter) eller nøyaktig 3600 (hel time).`)},[l]);let he=(0,t.useRef)(null),z=(0,t.useRef)(null),B=(0,t.useRef)(null),V=(0,t.useRef)(null),ge=(0,t.useRef)(null),H=(0,t.useRef)(null),_e=(0,t.useRef)(0),ve=(0,t.useRef)(-1),U=(0,t.useRef)(0),ye=(0,t.useRef)(-1),[be,xe]=(0,t.useState)(!1),Se=(0,t.useMemo)(()=>Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,`value`)?.set,[]),Ce=(0,t.useMemo)(()=>Pp(l),[l]),we=(0,t.useMemo)(()=>Fp(s,c),[s,c]),Te=(0,t.useMemo)(()=>Ip(l),[l]),Ee=`${r}-hours`,De=`${r}-minutes`,Oe=`${r}-popup`,ke=`${r}-input`;(0,t.useEffect)(()=>{let e=he.current;if(!e)return;let t=Up(A,{required:h,min:s,max:c,step:l});e.setCustomValidity(t.valid?``:t.message??``),R(be&&!t.valid)},[A,h,s,c,l,be]);let Ae=(0,t.useCallback)(e=>{se||k(e);let t=H.current;!t||!Se||(Se.call(t,e),t.dispatchEvent(new Event(`input`,{bubbles:!0})),D?.(e))},[se,Se,D]),je=(0,t.useCallback)(()=>{let e=N.current,t=P.current;if(e!==``&&t!==``){let n=Hp(e,t);n!==A&&Ae(n)}else A!==``&&Ae(``)},[A,Ae]),Me=(0,t.useCallback)(()=>{let e=N.current,t=P.current;if(e!==``&&t!==``){let n=Hp(e,t);n===A?H.current?.dispatchEvent(new Event(`input`,{bubbles:!0})):Ae(n)}else A===``?H.current?.dispatchEvent(new Event(`input`,{bubbles:!0})):Ae(``)},[A,Ae]),Ne=(0,t.useCallback)(()=>{xe(!0),je();let e=he.current,t=H.current;if(!e)return;let n=Up(t?.value??``,{required:h,min:s,max:c,step:l});e.setCustomValidity(n.valid?``:n.message??``)},[je,h,s,c,l]);(0,t.useEffect)(()=>{let e=ge.current?.closest(`form`);if(!e)return;let t=t=>{let n=t;if(!n||!e.contains(n))return!1;let r=n.closest(`button, input[type="submit"], input[type="image"]`);return!r||!e.contains(r)?!1:r instanceof HTMLButtonElement?r.type!==`button`&&r.type!==`reset`:r instanceof HTMLInputElement},n=e=>{t(e.target)&&Ne()};return e.addEventListener(`pointerdown`,n,!0),()=>e.removeEventListener(`pointerdown`,n,!0)},[Ne]),(0,t.useEffect)(()=>{H.current&&(H.current.value=A)},[A]);let Pe=(0,t.useCallback)(()=>{pe(!1),je()},[je]);(0,t.useLayoutEffect)(()=>{if(!fe)return;let e=V.current;if(!e)return;e.querySelectorAll(`.pkt-timepicker-popup__col`).forEach(e=>{let t=e.querySelector(`.pkt-timepicker-popup__option--selected`);t&&t.scrollIntoView({block:`center`})});let t=e.querySelectorAll(`.pkt-timepicker-popup__col`)[0];if(!t)return;let n=t.querySelector(`.pkt-timepicker-popup__option--selected`),r=t.querySelector(`.pkt-timepicker-popup__option`);(n||r)?.focus()},[fe]),(0,t.useEffect)(()=>{if(!fe)return;let e=e=>{let t=e.target;ge.current&&!ge.current.contains(t)&&Pe()};return document.addEventListener(`click`,e,!0),()=>document.removeEventListener(`click`,e,!0)},[fe,Pe]);let Fe=(0,t.useCallback)(e=>{let t=V.current;if(!t)return;let n=t.querySelectorAll(`.pkt-timepicker-popup__col`),r=e===`hour`?n[0]:n[1];if(!r)return;let i=r.querySelector(`.pkt-timepicker-popup__option--selected`),a=r.querySelector(`.pkt-timepicker-popup__option`);(i||a)?.focus()},[]),Ie=(0,t.useCallback)((e,t)=>{let n=String(e).padStart(2,`0`);if(t===`hour`)F(n),requestAnimationFrame(()=>Fe(`minute`));else{I(n),pe(!1);let e=N.current;e!==``&&Ae(`${e}:${n}`),requestAnimationFrame(()=>B.current?.focus())}},[Ae,Fe,F,I]),Le=(0,t.useCallback)(e=>{let t=Lp(N.current,P.current,e,Ce);F(t.hours),I(t.minutes),`${t.hours}:${t.minutes}`!==A&&Ae(`${t.hours}:${t.minutes}`)},[Ce,A,Ae,F,I]),Re=(0,t.useCallback)(e=>{he.current?.setCustomValidity(``);let t=e.currentTarget,n=P.current;switch(e.key){case`ArrowUp`:{e.preventDefault();let t=N.current===``?0:parseInt(N.current,10),r=String((t+1)%24).padStart(2,`0`);if(F(r),n!==``){let e=`${r}:${n}`;e===A?H.current?.dispatchEvent(new Event(`input`,{bubbles:!0})):Ae(e)}break}case`ArrowDown`:{e.preventDefault();let t=N.current===``?0:parseInt(N.current,10),r=String((t-1+24)%24).padStart(2,`0`);if(F(r),n!==``){let e=`${r}:${n}`;e===A?H.current?.dispatchEvent(new Event(`input`,{bubbles:!0})):Ae(e)}break}case`ArrowRight`:e.preventDefault(),z.current?.focus();break;case`Backspace`:case`Delete`:{e.preventDefault(),_e.current=0,ve.current=-1;let t=N.current;t.length>0&&F(t.slice(0,-1)),Me();break}case`Tab`:break;case`Enter`:{e.preventDefault(),Ne();let n=t.form;n?n.requestSubmit():t.blur();break}default:if(/^\d$/.test(e.key)){e.preventDefault();let t=parseInt(e.key,10);if(_e.current===0)ve.current=t,F(String(t).padStart(2,`0`)),_e.current=1,H.current?.dispatchEvent(new Event(`input`,{bubbles:!0})),t>=3&&(ve.current=-1,_e.current=0,Me(),z.current?.focus());else{let e=ve.current*10+t;F(e<=23?String(e).padStart(2,`0`):String(t).padStart(2,`0`)),ve.current=-1,_e.current=0,Me(),z.current?.focus()}}else e.preventDefault()}},[A,Ae,F,Me,Ne]),ze=(0,t.useCallback)(()=>{xe(!0),N.current!==``&&F(String(parseInt(N.current,10)).padStart(2,`0`)),_e.current=0,ve.current=-1,je()},[F,je]),Be=(0,t.useCallback)(e=>{he.current?.setCustomValidity(``);let t=e.currentTarget,n=N.current;switch(e.key){case`ArrowUp`:{e.preventDefault();let t=P.current===``?0:parseInt(P.current,10),r=String((t+Ce)%60).padStart(2,`0`);if(I(r),n!==``){let e=`${n}:${r}`;e===A?H.current?.dispatchEvent(new Event(`input`,{bubbles:!0})):Ae(e)}break}case`ArrowDown`:{e.preventDefault();let t=P.current===``?0:parseInt(P.current,10),r=String((t-Ce+60)%60).padStart(2,`0`);if(I(r),n!==``){let e=`${n}:${r}`;e===A?H.current?.dispatchEvent(new Event(`input`,{bubbles:!0})):Ae(e)}break}case`ArrowLeft`:e.preventDefault(),he.current?.focus();break;case`Backspace`:case`Delete`:{e.preventDefault(),U.current=0,ye.current=-1;let t=P.current;t.length>0&&I(t.slice(0,-1)),Me();break}case`Tab`:break;case`Enter`:{e.preventDefault(),Ne();let n=t.form;n?n.requestSubmit():t.blur();break}default:if(/^\d$/.test(e.key)){e.preventDefault();let t=parseInt(e.key,10);if(U.current===0)ye.current=t,I(String(t).padStart(2,`0`)),U.current=1,H.current?.dispatchEvent(new Event(`input`,{bubbles:!0})),t>=6&&(ye.current=-1,U.current=0,Me());else{let e=ye.current*10+t;I(e<=59?String(e).padStart(2,`0`):String(t).padStart(2,`0`)),ye.current=-1,U.current=0,Me()}}else e.preventDefault()}},[Ce,A,Ae,I,Me,Ne]),Ve=(0,t.useCallback)(()=>{xe(!0),P.current!==``&&I(String(parseInt(P.current,10)).padStart(2,`0`)),U.current=0,ye.current=-1,je()},[I,je]),He=(0,t.useCallback)(e=>{let t=document.activeElement,n=t.closest(`.pkt-timepicker-popup__col`);if(!n)return;let r=Array.from(n.querySelectorAll(`.pkt-timepicker-popup__option`)),i=r.indexOf(t),a=e=>{if(!e)return;let n=parseInt(e.dataset.value??`0`,10),r=String(n).padStart(2,`0`);t.dataset.type===`hour`?F(r):I(r),e.focus()};switch(e.key){case`ArrowDown`:e.preventDefault(),a(r[Math.min(i+1,r.length-1)]);break;case`ArrowUp`:e.preventDefault(),a(r[Math.max(i-1,0)]);break;case`Home`:e.preventDefault(),a(r[0]);break;case`End`:e.preventDefault(),a(r[r.length-1]);break;case`ArrowRight`:if(e.preventDefault(),t.dataset.type===`hour`){let e=parseInt(t.dataset.value??`0`,10);F(String(e).padStart(2,`0`)),requestAnimationFrame(()=>{V.current?.querySelectorAll(`.pkt-timepicker-popup__col`).forEach(e=>{e.querySelector(`.pkt-timepicker-popup__option--selected`)?.scrollIntoView({block:`center`})}),Fe(`minute`)})}break;case`ArrowLeft`:if(e.preventDefault(),t.dataset.type===`minute`){let e=parseInt(t.dataset.value??`0`,10);I(String(e).padStart(2,`0`)),requestAnimationFrame(()=>{V.current?.querySelectorAll(`.pkt-timepicker-popup__col`).forEach(e=>{e.querySelector(`.pkt-timepicker-popup__option--selected`)?.scrollIntoView({block:`center`})}),Fe(`hour`)})}break;case`Enter`:case` `:e.preventDefault(),t.click();break;case`Escape`:e.preventDefault(),Pe(),B.current?.focus();break;default:break}},[Pe,Fe,F,I]),Ue=(0,t.useCallback)(e=>{let t=V.current;if(!t)return;let n=e.relatedTarget;(!n||!t.contains(n))&&Pe()},[Pe]),W=(0,t.useCallback)(e=>{let t=ge.current;if(!t)return;let n=e.relatedTarget;n&&t.contains(n)||ie?.(e)},[ie]),G=(0,t.useCallback)(e=>{let t=ge.current;if(!t)return;let n=e.relatedTarget;n&&t.contains(n)||ae?.(e)},[ae]),We=(0,t.useCallback)(()=>{m||(fe?Pe():pe(!0))},[m,fe,Pe]);return(0,t.useImperativeHandle)(n,()=>({get value(){return H.current?.value??``},set value(e){let t=e??``;se||k(t);let[n,r]=Vp(t);F(n),I(r),H.current&&(H.current.value=t)},focus(){he.current?.focus()},blur(){he.current?.blur()}}),[se,F,I]),(0,t.useEffect)(()=>{let e=ge.current?.closest(`form`);if(!e)return;let t=()=>{window.setTimeout(()=>{let e=O.current,[t,n]=Vp(e);F(t),I(n),se||k(e),H.current&&(H.current.value=e),pe(!1),xe(!1)},0)};return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)},[se,F,I]),{id:r,containerRef:ge,outerClasses:[`pkt-timepicker`,f?`pkt-timepicker--fullwidth`:``,d?`pkt-timepicker--stepper`:``,re??``].filter(Boolean).join(` `),strings:oe,label:i,disabled:m,required:h,helptext:g,helptextDropdown:_,helptextDropdownButton:v,hasError:y,isInvalid:L,errorMessage:b,optionalTag:x,optionalText:S,requiredTag:C,requiredText:w,tagText:ee,inline:T,useWrapper:E,ariaDescribedby:te,hidePicker:u,stepArrows:d,min:s,max:c,step:l,hours:ue,minutes:j,hoursId:Ee,minutesId:De,popupId:Oe,hiddenInputId:ke,name:p??r,isOpen:fe,hourOptions:we,minuteOptions:Te,hoursInputRef:he,minutesInputRef:z,buttonRef:B,popupRef:V,changeInputRef:H,handleHoursKeydown:Re,handleHoursBlur:ze,handleMinutesKeydown:Be,handleMinutesBlur:Ve,handlePopupKeydown:He,handlePopupFocusOut:Ue,handleFocusIn:W,handleFocusOut:G,handleOptionClick:Ie,handleClockButtonClick:We,closePopup:Pe,stepTimeDelta:Le,effectiveValue:A}}var Kp=(0,t.forwardRef)((e,t)=>{let{onChange:r,onInput:i}=e,a=Gp(e,t),o=a.strings.hours,s=a.strings.minutes,c=a.label?`${o}, ${a.label}`:o,l=a.label?`${s}, ${a.label}`:s,u=(e,t)=>{let r=String(e).padStart(2,`0`),i=e===(t===`hour`?a.hours===``?NaN:parseInt(a.hours,10):a.minutes===``?NaN:parseInt(a.minutes,10));return(0,n.jsx)(`button`,{type:`button`,className:[`pkt-btn`,`pkt-btn--tertiary`,`pkt-btn--small`,`pkt-btn--label-only`,`pkt-timepicker-popup__option`,i?`pkt-timepicker-popup__option--selected`:``].filter(Boolean).join(` `),role:`option`,"aria-selected":i?`true`:`false`,tabIndex:i?0:-1,"data-type":t,"data-value":e,onClick:n=>{n.stopPropagation(),a.handleOptionClick(e,t)},children:(0,n.jsx)(`span`,{className:`pkt-btn__text pkt-txt-14-light`,children:r})},`${t}-${e}`)},d=()=>(0,n.jsxs)(`div`,{ref:a.popupRef,className:`pkt-timepicker-popup`,id:a.popupId,hidden:!a.isOpen,role:`group`,"aria-label":a.strings.selectTime,onKeyDown:a.handlePopupKeydown,onBlur:a.handlePopupFocusOut,children:[(0,n.jsx)(`div`,{className:`pkt-timepicker-popup__col`,role:`listbox`,"aria-label":o,"aria-orientation":`vertical`,children:a.hourOptions.map(e=>u(e,`hour`))}),(0,n.jsx)(`div`,{className:`pkt-timepicker-popup__col`,role:`listbox`,"aria-label":s,"aria-orientation":`vertical`,children:a.minuteOptions.map(e=>u(e,`minute`))})]}),f=()=>(0,n.jsxs)(`div`,{className:`pkt-input__container`,onClick:e=>{e.target.closest(`button, input`)||a.hoursInputRef.current?.focus()},children:[a.stepArrows&&(0,n.jsxs)(`button`,{type:`button`,className:`pkt-input-icon pkt-btn pkt-btn--icon-only pkt-btn--tertiary pkt-timepicker__button pkt-timepicker__button--prev`,"aria-label":a.strings.prevTime,disabled:a.disabled,onClick:()=>a.stepTimeDelta(-1),children:[(0,n.jsx)(Q,{name:`chevron-thin-left`}),(0,n.jsx)(`span`,{className:`pkt-btn__text`,children:a.strings.prevTime})]}),(0,n.jsx)(`input`,{ref:a.hoursInputRef,type:`text`,inputMode:`numeric`,maxLength:2,size:2,className:`pkt-input pkt-timepicker__input`,id:a.hoursId,"data-min":`0`,"data-max":`23`,value:a.hours,placeholder:`––`,"aria-label":c,role:`spinbutton`,"aria-invalid":a.hasError||a.isInvalid||void 0,"aria-valuemin":0,"aria-valuemax":23,"aria-valuenow":a.hours===``?void 0:parseInt(a.hours,10),"aria-valuetext":a.hours===``?void 0:`${a.hours} ${o.toLowerCase()}`,autoComplete:`off`,disabled:a.disabled,onKeyDown:a.handleHoursKeydown,onBlur:a.handleHoursBlur,onFocus:e=>{e.currentTarget.select()},onChange:()=>{},onPaste:e=>e.preventDefault()}),(0,n.jsx)(`span`,{className:`pkt-timepicker__separator`,children:`:`}),(0,n.jsx)(`input`,{ref:a.minutesInputRef,type:`text`,inputMode:`numeric`,maxLength:2,size:2,className:`pkt-input pkt-timepicker__input`,id:a.minutesId,"data-min":`0`,"data-max":`59`,value:a.minutes,placeholder:`––`,"aria-label":l,role:`spinbutton`,"aria-invalid":a.hasError||a.isInvalid||void 0,"aria-valuemin":0,"aria-valuemax":59,"aria-valuenow":a.minutes===``?void 0:parseInt(a.minutes,10),"aria-valuetext":a.minutes===``?void 0:`${a.minutes} ${s.toLowerCase()}`,autoComplete:`off`,disabled:a.disabled,onKeyDown:a.handleMinutesKeydown,onBlur:a.handleMinutesBlur,onFocus:e=>{e.currentTarget.select()},onChange:()=>{},onPaste:e=>e.preventDefault()}),a.hidePicker&&!a.stepArrows&&(0,n.jsx)(Q,{className:`pkt-input-icon pkt-timepicker__icon`,name:`clock`,"aria-hidden":!0}),!a.hidePicker&&!a.stepArrows&&(0,n.jsxs)(`button`,{ref:a.buttonRef,type:`button`,className:`pkt-input-icon pkt-btn pkt-btn--icon-only pkt-btn--tertiary pkt-timepicker__button`,"aria-label":a.strings.openPicker,"aria-haspopup":`listbox`,"aria-expanded":a.isOpen,"aria-controls":a.popupId,disabled:a.disabled,onClick:a.handleClockButtonClick,children:[(0,n.jsx)(Q,{name:`clock`}),(0,n.jsx)(`span`,{className:`pkt-btn__text`,children:a.strings.openPicker})]}),a.stepArrows&&(0,n.jsxs)(`button`,{type:`button`,className:`pkt-input-icon pkt-btn pkt-btn--icon-only pkt-btn--tertiary pkt-timepicker__button pkt-timepicker__button--next`,"aria-label":a.strings.nextTime,disabled:a.disabled,onClick:()=>a.stepTimeDelta(1),children:[(0,n.jsx)(Q,{name:`chevron-thin-right`}),(0,n.jsx)(`span`,{className:`pkt-btn__text`,children:a.strings.nextTime})]}),(0,n.jsx)(`input`,{ref:a.changeInputRef,type:`time`,hidden:!0,name:a.name,id:a.hiddenInputId,disabled:a.disabled,tabIndex:-1,"aria-hidden":!0,onChange:r,onInput:i})]});return(0,n.jsx)(`div`,{ref:a.containerRef,className:a.outerClasses,id:a.id||void 0,onFocus:a.handleFocusIn,onBlur:a.handleFocusOut,children:(0,n.jsx)(Cu,{forId:a.hoursId,label:a.label,disabled:a.disabled,hasError:a.hasError,inline:a.inline,optionalTag:a.optionalTag,optionalText:a.optionalText,requiredTag:a.requiredTag,requiredText:a.requiredText,useWrapper:a.useWrapper,ariaDescribedby:a.ariaDescribedby,errorMessage:a.errorMessage,helptext:a.helptext,helptextDropdown:a.helptextDropdown,helptextDropdownButton:a.helptextDropdownButton,tagText:a.tagText,children:!a.hidePicker&&!a.stepArrows?(0,n.jsxs)(`div`,{className:`pkt-timepicker__anchor`,children:[f(),d()]}):f()})})});Kp.displayName=`PktTimepicker`,e.FileItem=Id,e.ItemRenderers=Df,e.PktAccordion=_,e.PktAccordionItem=$s,e.PktAlert=ec,e.PktBackLink=tc,e.PktBreadcrumbs=nc,e.PktButton=rc,e.PktCalendar=vu,e.PktCard=bu,e.PktCheckbox=xu,e.PktCombobox=Ju,e.PktConsent=Yu,e.PktDatepicker=fd,e.PktFileUpload=Of,e.PktFooter=kf,e.PktFooterSimple=Af,e.PktHeader=Bf,e.PktHeaderMenu=Yf,e.PktHeaderService=zf,e.PktHeading=ap,e.PktHelptext=sp,e.PktIcon=Q,e.PktInput=cp,e.PktInputWrapper=Cu,e.PktLink=Nf,e.PktLinkCard=lp,e.PktLoader=dp,e.PktMessagebox=fp,e.PktModal=rf,e.PktProgressbar=hp,e.PktRadioButton=gp,e.PktSearchInput=_p,e.PktSelect=vp,e.PktStep=Sp,e.PktStepper=Cp,e.PktTabItem=Ap,e.PktTable=wp,e.PktTableBody=Tp,e.PktTableDataCell=Ep,e.PktTableHeader=Dp,e.PktTableHeaderCell=Op,e.PktTableRow=kp,e.PktTabs=Np,e.PktTag=yu,e.PktTextarea=Bd,e.PktTextinput=Rf,e.PktTimepicker=Kp});
2422
+ `}};K([W({type:String,reflect:!0})],ac.prototype,`value`,void 0),K([W({type:Boolean,reflect:!0,attribute:`hide-picker`})],ac.prototype,`hidePicker`,void 0),K([W({type:Boolean,reflect:!0,attribute:`step-arrows`})],ac.prototype,`stepArrows`,void 0),K([G()],ac.prototype,`_hours`,void 0),K([G()],ac.prototype,`_minutes`,void 0),K([G()],ac.prototype,`_isOpen`,void 0);try{U(`pkt-timepicker`)(ac)}catch{console.warn(`Forsøker å definere <pkt-timepicker>, men den er allerede definert`)}var Q=x({tagName:`pkt-icon`,elementClass:Ht,react:t.default,displayName:`PktIcon`,events:{}}),oc=(0,t.forwardRef)(({defaultOpen:e=!1,id:r,title:i,skin:a,compact:o=!1,isOpen:s,children:c,name:l,className:u,onClick:d,onToggle:f},p)=>{let[m,h]=(0,t.useState)(e),{name:_}=g(),v=l||_,y=s===void 0?m:s;return(0,t.useEffect)(()=>{s===void 0&&h(e)},[e,s]),(0,n.jsxs)(`details`,{ref:p,className:[`pkt-accordion-item`,o&&`pkt-accordion-item--compact`,a&&`pkt-accordion-item--${a}`,u].filter(Boolean).join(` `),id:r,open:y,onClick:e=>{setTimeout(()=>{d?.(e)},0)},name:v,onToggle:e=>{let t=e.currentTarget.open;t!==y&&(s===void 0&&h(t),f?.(e))},children:[(0,n.jsxs)(`summary`,{className:`pkt-accordion-item__title`,id:`pkt-accordion-item-summary-${r}`,children:[i,a===`plus-minus`?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Q,{name:`plus-sign`,className:`pkt-accordion-item__icon pkt-accordion-item__icon--plus`,"aria-hidden":`true`}),(0,n.jsx)(Q,{name:`minus-sign`,className:`pkt-accordion-item__icon pkt-accordion-item__icon--minus`,"aria-hidden":`true`})]}):(0,n.jsx)(Q,{name:`chevron-thin-down`,className:`pkt-accordion-item__icon`,"aria-hidden":`true`})]}),(0,n.jsx)(`div`,{className:`pkt-accordion-item__content`,id:`pkt-accordion-item__content-${r}`,role:`region`,children:(0,n.jsx)(`div`,{className:`pkt-accordion-item__content-inner`,children:c})})]})});oc.displayName=`PktAccordionItem`;var $=m(d(((e,t)=>{(function(){"use strict";var e={}.hasOwnProperty;function n(){for(var e=``,t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=i(e,r(n)))}return e}function r(t){if(typeof t==`string`||typeof t==`number`)return t;if(typeof t!=`object`)return``;if(Array.isArray(t))return n.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes(`[native code]`))return t.toString();var r=``;for(var a in t)e.call(t,a)&&t[a]&&(r=i(r,a));return r}function i(e,t){return t?e?e+` `+t:e+t:e}t!==void 0&&t.exports?(n.default=n,t.exports=n):typeof define==`function`&&typeof define.amd==`object`&&define.amd?define(`classnames`,[],function(){return n}):window.classNames=n})()}))(),1),sc=({children:e,closeAlert:r,compact:i,title:a,date:o,ariaLive:s,"aria-live":c=`polite`,role:l=`status`,skin:u=`info`,className:d,...f})=>{let[p,m]=(0,t.useState)(!1),h={"pkt-alert":!0,"pkt-alert--compact":i,[`pkt-alert--${u}`]:u,"pkt-hide":p},g={"pkt-alert__grid":!0,"pkt-alert__noTitle":!a,"pkt-alert__noDate":!o},_=(0,t.useCallback)(()=>{m(!0),f.onClose&&f.onClose(new CustomEvent(`close`,{detail:{origin:event},bubbles:!0,composed:!0}))},[f.onClose,m]),v=s||c;return(0,n.jsx)(`div`,{...f,"aria-live":v,role:l,className:(0,$.default)(h,d),children:(0,n.jsxs)(`div`,{className:(0,$.default)(g),children:[(0,n.jsx)(Q,{className:`pkt-alert__icon`,"aria-hidden":`true`,name:u===`info`?`alert-information`:`alert-${u}`}),r&&(0,n.jsx)(`div`,{className:`pkt-alert__close`,children:(0,n.jsx)(uc,{tabIndex:0,"aria-label":`close`,size:i?`small`:`medium`,type:`button`,skin:`tertiary`,iconName:`close`,variant:`icon-only`,onClick:_,children:(0,n.jsx)(`span`,{className:`sr-only`,children:`Lukk`})})}),a&&(0,n.jsx)(`div`,{className:`pkt-alert__title`,children:a}),(0,n.jsx)(`div`,{className:`pkt-alert__text`,children:e}),o&&(0,n.jsxs)(`div`,{className:`pkt-alert__date`,children:[`Sist oppdatert: `,o]})]})})};sc.displayName=`PktAlert`;var cc=(0,t.forwardRef)(({href:e=`/`,text:t=`Forsiden`,ariaLabel:r,renderLink:i,className:a,...o},s)=>{let c=(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Q,{className:`pkt-back-link__icon pkt-icon pkt-link__icon`,name:`chevron-thin-left`,"aria-hidden":`true`}),(0,n.jsx)(`span`,{className:`pkt-back-link__text`,children:t})]}),l=i||(({href:e,className:t,children:r,props:i})=>(0,n.jsx)(`a`,{href:e,className:t,...i,children:r}));return(0,n.jsx)(`nav`,{className:[`pkt-back-link`,a].filter(Boolean).join(` `),"aria-label":r||`Gå tilbake til forrige side`,ref:s,children:l({href:e,className:`pkt-link pkt-link--icon-left`,children:c,props:o})})});cc.displayName=`PktBackLink`;var lc=(0,t.forwardRef)(({breadcrumbs:e,navigationType:t,renderLink:i,className:a,...o},s)=>{let c=e,l=c[c.length-2],u=[a,`pkt-breadcrumbs`].filter(Boolean).join(` `),d=i||(t===`router`?({href:e,className:t,children:i,props:a})=>(0,n.jsx)(r.Link,{to:e,className:t,...a,children:i}):({href:e,className:t,children:r,props:i})=>(0,n.jsx)(`a`,{href:e,className:t,...i,children:r}));return(0,n.jsxs)(`nav`,{ref:s,"aria-label":`brødsmulemeny`,className:u,children:[(0,n.jsx)(`ol`,{className:`pkt-breadcrumbs__list pkt-breadcrumbs--desktop`,children:c.map((e,t)=>(0,n.jsx)(`li`,{className:`pkt-breadcrumbs__item`,children:t===c.length-1?(0,n.jsx)(`span`,{className:`pkt-breadcrumbs__label`,"aria-current":`true`,children:(0,n.jsx)(`span`,{className:`pkt-breadcrumbs__text`,children:e.text})}):d({href:e.href,className:`pkt-link pkt-link--icon-right pkt-breadcrumbs__label pkt-breadcrumbs__link`,children:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Q,{className:`pkt-icon pkt-breadcrumbs__icon pkt-link__icon`,name:`chevron-thin-right`}),(0,n.jsx)(`span`,{className:`pkt-breadcrumbs__text`,children:e.text})]}),props:o})},`breadcrumb-${t}`))}),d({href:l.href,className:`pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile`,children:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Q,{className:`pkt-back-link__icon pkt-icon pkt-link__icon`,name:`chevron-thin-left`}),(0,n.jsx)(`span`,{className:`pkt-breadcrumbs__text`,children:l.text})]}),props:o})]})});lc.displayName=`PktBreadcrumbs`,window.pktAnimationPath=window.pktAnimationPath||`https://punkt-cdn.oslo.kommune.no/16.17/animations/`;var uc=(0,t.forwardRef)(({children:e,className:t,iconName:r=`user`,secondIconName:i=`user`,iconPath:a,secondIconPath:o,size:s=`medium`,fullWidth:c=!1,fullWidthOnMobile:l=!1,skin:u=`primary`,type:d=`button`,variant:f=`label-only`,state:p,color:m,isLoading:h=void 0,disabled:g=void 0,loadingAnimationPath:_=window.pktAnimationPath,...v},y)=>{let b=[t,`pkt-btn`,s&&`pkt-btn--${s}`,c&&`pkt-btn--full`,l&&`pkt-btn--full-small`,u&&`pkt-btn--${u}`,f&&`pkt-btn--${f}`,m&&`pkt-btn--${m}`,p&&`pkt-btn--${p}`,h&&`pkt-btn--isLoading`].filter(Boolean).join(` `);return(0,n.jsxs)(`button`,{...v,"aria-busy":h||void 0,"aria-disabled":g||void 0,disabled:g,className:b,type:d,ref:y,children:[h&&(0,n.jsx)(Q,{className:`pkt-btn__icon pkt-btn__spinner`,name:`spinner-blue`,path:_}),f!==`label-only`&&(0,n.jsx)(Q,{className:`pkt-btn__icon`,name:r,...a&&{path:a}}),(0,n.jsx)(`span`,{className:`pkt-btn__text`,children:e}),f===`icons-right-and-left`&&(0,n.jsx)(Q,{className:`pkt-btn__icon`,name:i,...o&&{path:o}})]})});uc.displayName=`PktButton`;var dc=365.2425,fc=6048e5,pc=864e5,mc=3600*24;mc*7,mc*dc/12*3;var hc=Symbol.for(`constructDateFrom`);function gc(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&hc in e?e[hc](t):e instanceof Date?new e.constructor(t):new Date(t)}function _c(e,t){return gc(t||e,e)}function vc(e,t,n){let r=_c(e,n?.in);return isNaN(t)?gc(n?.in||e,NaN):(t&&r.setDate(r.getDate()+t),r)}var yc={};function bc(){return yc}function xc(e,t){let n=bc(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=_c(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function Sc(e,t){return xc(e,{...t,weekStartsOn:1})}function Cc(e,t){let n=_c(e,t?.in),r=n.getFullYear(),i=gc(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=Sc(i),o=gc(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=Sc(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function wc(e){let t=_c(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function Tc(e,...t){let n=gc.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function Ec(e,t){let n=_c(e,t?.in);return n.setHours(0,0,0,0),n}function Dc(e,t,n){let[r,i]=Tc(n?.in,e,t),a=Ec(r),o=Ec(i),s=+a-wc(a),c=+o-wc(o);return Math.round((s-c)/pc)}function Oc(e,t){let n=Cc(e,t),r=gc(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Sc(r)}function kc(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function Ac(e){return!(!kc(e)&&typeof e!=`number`||isNaN(+_c(e)))}function jc(e,t){let n=_c(e,t?.in);return n.setHours(23,59,59,999),n}function Mc(e,t){let[n,r]=Tc(e,t.start,t.end);return{start:n,end:r}}function Nc(e,t){let{start:n,end:r}=Mc(t?.in,e),i=+n>+r,a=i?+n:+r,o=i?r:n;o.setHours(0,0,0,0);let s=t?.step??1;if(!s)return[];s<0&&(s=-s,i=!i);let c=[];for(;+o<=a;)c.push(gc(n,o)),o.setDate(o.getDate()+s),o.setHours(0,0,0,0);return i?c.reverse():c}function Pc(e,t){let n=_c(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}var Fc={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`}},Ic=(e,t,n)=>{let r,i=Fc[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function Lc(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var Rc={date:Lc({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:Lc({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:Lc({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},zc={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},Bc=(e,t,n,r)=>zc[e];function Vc(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var Hc={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:Vc({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:Vc({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:Vc({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:Vc({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:Vc({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function Uc(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?Gc(s,e=>e.test(o)):Wc(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function Wc(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function Gc(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function Kc(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var qc={code:`en-US`,formatDistance:Ic,formatLong:Rc,formatRelative:Bc,localize:Hc,match:{ordinalNumber:Kc({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:Uc({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:Uc({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:Uc({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:Uc({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:Uc({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function Jc(e,t){let n=_c(e,t?.in);return Dc(n,Pc(n))+1}function Yc(e,t){let n=_c(e,t?.in),r=Sc(n)-+Oc(n);return Math.round(r/fc)+1}function Xc(e,t){let n=_c(e,t?.in),r=n.getFullYear(),i=bc(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=gc(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=xc(o,t),c=gc(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=xc(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function Zc(e,t){let n=bc(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=Xc(e,t),a=gc(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),xc(a,t)}function Qc(e,t){let n=_c(e,t?.in),r=xc(n,t)-+Zc(n,t);return Math.round(r/fc)+1}function $c(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var el={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return $c(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):$c(n+1,2)},d(e,t){return $c(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return $c(e.getHours()%12||12,t.length)},H(e,t){return $c(e.getHours(),t.length)},m(e,t){return $c(e.getMinutes(),t.length)},s(e,t){return $c(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return $c(Math.trunc(r*10**(n-3)),t.length)}},tl={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},nl={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return el.y(e,t)},Y:function(e,t,n,r){let i=Xc(e,r),a=i>0?i:1-i;return t===`YY`?$c(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):$c(a,t.length)},R:function(e,t){return $c(Cc(e),t.length)},u:function(e,t){return $c(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return $c(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return $c(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return el.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return $c(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=Qc(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):$c(i,t.length)},I:function(e,t,n){let r=Yc(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):$c(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):el.d(e,t)},D:function(e,t,n){let r=Jc(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):$c(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return $c(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return $c(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return $c(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?tl.noon:r===0?tl.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?tl.evening:r>=12?tl.afternoon:r>=4?tl.morning:tl.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return el.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):el.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):$c(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):$c(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):el.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):el.s(e,t)},S:function(e,t){return el.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return il(r);case`XXXX`:case`XX`:return al(r);default:return al(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return il(r);case`xxxx`:case`xx`:return al(r);default:return al(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+rl(r,`:`);default:return`GMT`+al(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+rl(r,`:`);default:return`GMT`+al(r,`:`)}},t:function(e,t,n){return $c(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return $c(+e,t.length)}};function rl(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+$c(a,2)}function il(e,t){return e%60==0?(e>0?`-`:`+`)+$c(Math.abs(e)/60,2):al(e,t)}function al(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=$c(Math.trunc(r/60),2),a=$c(r%60,2);return n+i+t+a}var ol=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},sl=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},cl={p:sl,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return ol(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,ol(r,t)).replace(`{{time}}`,sl(i,t))}},ll=/^D+$/,ul=/^Y+$/,dl=[`D`,`DD`,`YY`,`YYYY`];function fl(e){return ll.test(e)}function pl(e){return ul.test(e)}function ml(e,t,n){let r=hl(e,t,n);if(console.warn(r),dl.includes(e))throw RangeError(r)}function hl(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var gl=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,_l=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,vl=/^'([^]*?)'?$/,yl=/''/g,bl=/[a-zA-Z]/;function xl(e,t,n){let r=bc(),i=n?.locale??r.locale??qc,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=_c(e,n?.in);if(!Ac(s))throw RangeError(`Invalid time value`);let c=t.match(_l).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=cl[t];return n(e,i.formatLong)}return e}).join(``).match(gl).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:Sl(e)};if(nl[t])return{isToken:!0,value:e};if(t.match(bl))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&pl(a)||!n?.useAdditionalDayOfYearTokens&&fl(a))&&ml(a,t,String(e));let o=nl[a[0]];return o(s,a,i.localize,l)}).join(``)}function Sl(e){let t=e.match(vl);return t?t[1].replace(yl,`'`):e}function Cl(e,t){let n=_c(e,t?.in).getDay();return n===0?7:n}function wl(e,t,n=`long`){return new Intl.DateTimeFormat(`en-US`,{hour:`numeric`,timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(` `)}var Tl={},El={};function Dl(e,t){try{let n=(Tl[e]||=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`longOffset`}).format)(t).split(`GMT`)[1];return n in El?El[n]:kl(n,n.split(`:`))}catch{if(e in El)return El[e];let t=e?.match(Ol);return t?kl(e,t.slice(1)):NaN}}var Ol=/([+-]\d\d):?(\d\d)?/;function kl(e,t){let n=+(t[0]||0),r=+(t[1]||0),i=(t[2]||0)/60;return El[e]=n*60+r>0?n*60+r+i:n*60-r-i}var Al=class e extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]==`string`&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(Dl(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)),Pl(this,NaN),Ml(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}withTimeZone(t){return new e(+this,t)}getTimezoneOffset(){let e=-Dl(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),Ml(this),+this}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},jl=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!jl.test(e))return;let t=e.replace(jl,`$1UTC`);Al.prototype[t]&&(e.startsWith(`get`)?Al.prototype[e]=function(){return this.internal[t]()}:(Al.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),Nl(this),+this},Al.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),Ml(this),+this}))});function Ml(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-Dl(e.timeZone,e)*60))}function Nl(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),Pl(e)}function Pl(e){let t=Dl(e.timeZone,e),n=t>0?Math.floor(t):Math.ceil(t),r=new Date(+e);r.setUTCHours(r.getUTCHours()-1);let i=-new Date(+e).getTimezoneOffset(),a=i- -new Date(+r).getTimezoneOffset(),o=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();a&&o&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+a);let s=i-n;s&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+s);let c=new Date(+e);c.setUTCSeconds(0);let l=i>0?c.getSeconds():(c.getSeconds()-60)%60,u=Math.round(-(Dl(e.timeZone,e)*60))%60;(u||l)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+u),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+u+l));let d=Dl(e.timeZone,e),f=d>0?Math.floor(d):Math.ceil(d),p=-new Date(+e).getTimezoneOffset()-f,m=f!==n,h=p-s;if(m&&h){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+h);let t=Dl(e.timeZone,e),n=f-(t>0?Math.floor(t):Math.ceil(t));n&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+n),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+n))}}var Fl=class e extends Al{static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}toISOString(){let[e,t,n]=this.tzComponents(),r=`${e}${t}:${n}`;return this.internal.toISOString().slice(0,-1)+r}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){let[e,t,n,r]=this.internal.toUTCString().split(` `);return`${e?.slice(0,-1)} ${n} ${t} ${r}`}toTimeString(){let e=this.internal.toUTCString().split(` `)[4],[t,n,r]=this.tzComponents();return`${e} GMT${t}${n}${r} (${wl(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}tzComponents(){let e=this.getTimezoneOffset();return[e>0?`-`:`+`,String(Math.floor(Math.abs(e)/60)).padStart(2,`0`),String(Math.abs(e)%60).padStart(2,`0`)]}withTimeZone(t){return new e(+this,t)}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}};window.pktTz=window.pktTz===void 0?`Europe/Oslo`:window.pktTz;var Il=(e=window.pktTz)=>{let t=new Fl(new Date().toISOString(),e);return t.setHours(0,0,0,0),isNaN(t.getTime())?new Date:new Date(t.getFullYear(),t.getMonth(),t.getDate())};function Ll(e){if(!e||e===``)return new Date;if(/^\d{4}-\d{2}-\d{2}$/.test(e)){let[t,n,r]=e.split(`-`).map(Number);return new Date(t,n-1,r)}if(/^\d{4}-\d{2}$/.test(e)){let[t,n]=e.split(`-`).map(Number);return new Date(t,n-1,1)}return/^\d{4}$/.test(e)?new Date(Number(e),0,1):new Date(e)}var Rl=e=>!e||isNaN(e.getTime())?``:`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`,zl=e=>{if(!e)return null;let t=Ll(e);return isNaN(t.getTime())?null:t},Bl=(e,t)=>{let n=Vl(e);return isNaN(n.getTime())?``:xl(n,t)},Vl=(e=``,t)=>{let n=typeof e==`string`?Ll(e):e;return!n||isNaN(n.getTime())?new Date:t?t===`end`?jc(n):Ec(n):n},Hl=(e,t,n=1)=>{if(typeof e!=`number`||typeof t!=`number`||typeof n!=`number`||isNaN(e)||isNaN(t)||isNaN(n))return new Date;let r=new Date(e,t,n);return isNaN(r.getTime())?new Date:r},Ul=e=>{let t;return t=new Fl(e,window.pktTz),t.setHours(12,0,0,0),t},Wl=null,Gl=void 0,Kl=e=>{if(!e||isNaN(e.getTime()))return``;let t=typeof window<`u`?window.pktTz:void 0;return(!Wl||Gl!==t)&&(Wl=new Intl.DateTimeFormat(`no`,{dateStyle:`full`,timeZone:t}),Gl=t),Wl.format(e)},ql=(e,t,n)=>{if(!e||isNaN(e.getTime()))return!1;let r=t?Vl(t):null,i=n?Vl(n):null;return!(r&&e<r||i&&e>i)},Jl=(e,t)=>{if(!e||isNaN(e.getTime())||!Array.isArray(t))return!1;let n=Rl(e);return t.includes(n)},Yl=(e,t)=>{if(!e||isNaN(e.getTime())||!Array.isArray(t))return!1;let n=e.getDay().toString();return t.includes(n)},Xl=(e,t,n,r,i)=>!(!e||isNaN(e.getTime())||!ql(e,t,n)||r&&Jl(e,r)||i&&Yl(e,i)),Zl=(e,t,n,r,i)=>e.filter(e=>{let a=zl(e);return a&&Xl(a,t,n,r,i)}),Ql=e=>e.slice().sort((e,t)=>{let n=zl(e),r=zl(t);return!n||!r?0:n.getTime()-r.getTime()}),$l=(e,t)=>{let n=zl(e),r=zl(t);return!n||!r?!1:n<=r};function eu(e,t){let n=(t.excludedates??[]).map(e=>typeof e==`string`?e:Rl(e));return!Xl(e,t.earliest,t.latest,n,t.excludeweekdays??[])}function tu(e,t,n,r){return!!(eu(e,n)||!t&&r.multiple&&r.maxMultiple>0&&r.selectedCount>=r.maxMultiple)}function nu(e,t,n){let r=Hl(e,t,0);return!(n&&Vl(n)>r)}function ru(e,t,n){let r=Hl(t===11?e+1:e,t===11?0:t+1,1);return!(n&&Vl(n)<r)}function iu(e){return typeof e==`string`&&(e=e.split(`,`)),e.length===1&&e[0]===``?[]:e.map(e=>Ll(e))}function au(e,t){let n=Nc({start:e,end:t}),r={};if(Array.isArray(n)&&n.length)for(let i=0;i<n.length;i++){let a=n[i],o=a>e&&a<t;r[Rl(a)]=o}return r}function ou(e,t,n,r){if(t.length!==1)return!0;let i=Nc({start:t[0],end:e});if(!Array.isArray(i)||!i.length)return!0;for(let a=0;a<i.length;a++){for(let r of n??[])if(r>t[0]&&r<e)return!1;if((r??[]).includes(Cl(i[a]).toString()))return!1}return!0}function su(e,t){let n=Rl(e);return t.includes(n)?t:[...t,n]}function cu(e,t){let n=Rl(e),r=t.indexOf(n);if(r===-1)return t;if(t.length===1)return[];let i=[...t];return i.splice(r,1),i}function lu(e,t,n){let r=Rl(e);return t.includes(r)?cu(e,t):n>0&&t.length>=n?t:su(e,t)}function uu(e,t,n){let r=Rl(e),i=iu(t);return t.includes(r)?t.indexOf(r)===0?[]:cu(e,t):t.length>1||t.length===1&&(!ou(e,i,n.excludedates,n.excludeweekdays)||i[0]>e)?[r]:su(e,t)}function du(e,t){let n=Hl(e,t,1),r=Hl(e,t+1,0),i=(n.getDay()+6)%7,a=r.getDate();return{firstDayOfMonth:n,lastDayOfMonth:r,startingDay:i,numDays:a,numRows:Math.ceil((a+i)/7),numDaysPrevMonth:Hl(e,t,0).getDate(),initialWeek:Qc(n)}}function fu(e,t,n,r){let{startingDay:i,numDays:a}=r;return e===0&&t<i?`prev-month`:n>a?`next-month`:`current-month`}function pu(e,t,n,r){let{startingDay:i,numDaysPrevMonth:a,numDays:o}=r;return e===`prev-month`?a-(i-t-1):e===`next-month`?n-o:n}var mu={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7};function hu(e){let t=e.nodeName;return t===`INPUT`||t===`SELECT`||t===`BUTTON`&&!e.dataset?.date}function gu(e,t,n){let r=vc(e,t);if(!r)return null;let i=n(`button[data-date="${Rl(r)}"]`);for(;i instanceof HTMLButtonElement&&i.dataset.disabled;)if(r=vc(r,t),i=n(`button[data-date="${Rl(r)}"]`),!i)return null;return r}function _u(e){return mu[e]??null}var vu={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 yu(e){let{selected:n,multiple:r=!1,maxMultiple:i=0,range:a=!1,earliest:o=null,latest:s=null,excludedates:c,excludeweekdays:l=[],weeknumbers:u=!1,withcontrols:d=!1,currentmonth:f,today:p,strings:m,onDateSelected:h,onClose:g,id:_,className:v}=e,y=(0,t.useId)(),b=_??y,x=(0,t.useMemo)(()=>({...vu,...m}),[m]),S=(0,t.useMemo)(()=>p?Ll(p):Il(),[p]),C=(0,t.useMemo)(()=>c?c.map(e=>typeof e==`string`?Ll(e):e):[],[c]),w=n!==void 0,[ee,T]=(0,t.useState)([]),E=w?n:ee,te=(0,t.useMemo)(()=>iu(E),[E]),[ne,re]=(0,t.useState)(0),[D,ie]=(0,t.useState)(0),[ae,oe]=(0,t.useState)({}),[se,ce]=(0,t.useState)(null),[O,le]=(0,t.useState)(null),k=(0,t.useRef)(null),A=(0,t.useRef)([]),ue=(0,t.useRef)(0),de=(0,t.useRef)(!1),j=(0,t.useRef)(!1),M=(0,t.useMemo)(()=>({earliest:o,latest:s,excludedates:C,excludeweekdays:l}),[o,s,C,l]);(0,t.useEffect)(()=>{let e=null;if(f!=null&&(f instanceof Date?e=Ul(f):typeof f==`string`&&(e=Ll(f))),!e||isNaN(e.getTime()))if(E.length>0&&E[0]!==``){let t=Ll(E[E.length-1]);e=isNaN(t.getTime())?Ul(S):t}else e=Ul(S);if((!e||isNaN(e.getTime()))&&(e=Ul(S)),s){let t=typeof s==`string`?Ll(s):s;!isNaN(t.getTime())&&e>t&&(e=t)}if(o){let t=typeof o==`string`?Ll(o):o;!isNaN(t.getTime())&&e<t&&(e=t)}re(e.getFullYear()),ie(e.getMonth()),j.current=!0},[]),(0,t.useEffect)(()=>{if(j.current&&!de.current&&E.length>0&&E[0]!==``){let e=Ll(E[E.length-1]);isNaN(e.getTime())||(re(e.getFullYear()),ie(e.getMonth()))}},[E]),(0,t.useEffect)(()=>{a&&te.length===2?oe(au(te[0],te[1])):(!a||te.length<2)&&oe({})},[a,te]);let N=(0,t.useCallback)(e=>{w||T(e),h?.(e)},[w,h]),P=(0,t.useCallback)(()=>{g?.()},[g]),F=(0,t.useCallback)((e,t)=>{re(typeof e==`string`?parseInt(e):e),ie(typeof t==`string`?parseInt(t):t),ue.current=0,le(null),A.current=[],de.current=!0},[]),I=(0,t.useCallback)(()=>{let e=D===0?11:D-1;F(D===0?ne-1:ne,e)},[ne,D,F]),fe=(0,t.useCallback)(()=>{let e=D===11?0:D+1;F(D===11?ne+1:ne,e)},[ne,D,F]),pe=(0,t.useCallback)(e=>eu(e,M),[M]),L=(0,t.useCallback)((e,t)=>tu(e,t,M,{multiple:r,maxMultiple:i,selectedCount:E.length}),[M,r,i,E.length]),R=(0,t.useCallback)(()=>typeof E==`string`?E.split(`,`):E,[E]),me=(0,t.useCallback)(e=>{if(!a||te.length!==1||!ou(e,te,C,l)||te[0]>=e){ce(null);return}ce(e),oe(au(te[0],e))},[a,te,C,l]),he=(0,t.useCallback)(e=>{if(!e)return;let t;if(a)t=uu(e,R(),{excludedates:C,excludeweekdays:l}),w||T(t),t.length===2?(h?.(t),P()):(t.length===1&&oe({}),h?.(t));else if(r)t=lu(e,R(),i),N(t);else{let n=Rl(e);t=E.includes(n)?[]:[n],N(t),P()}},[a,r,i,R,E,C,l,w,N,P,h]),z=(0,t.useCallback)(e=>{let t=su(e,R());w||T(t),a&&t.length===2&&(h?.(t),P())},[R,w,a,h,P]),B=(0,t.useCallback)(e=>{let t=cu(e,R());w||T(t)},[R,w]),V=(0,t.useCallback)(e=>{let t=lu(e,R(),i);w||T(t)},[R,i,w]),ge=(0,t.useCallback)(()=>{let e=Rl(Ul(S)),t=k.current?.querySelector(`button[data-date="${e}"]`);if(t instanceof HTMLButtonElement){le(e),t.focus();return}let n=A.current.find(e=>!e.isDisabled);if(n){let e=k.current?.querySelector(`button[data-date="${n.currentDateISO}"]`);e instanceof HTMLButtonElement&&(le(n.currentDateISO),e.focus())}},[]),H=(0,t.useCallback)((e,t)=>{let n=e.target;if(hu(n))return;if(e.preventDefault(),!O){ge();return}let r=gu(Vl(O),t,k.current.querySelector.bind(k.current));if(r){let e=k.current.querySelector(`button[data-date="${Rl(r)}"]`);e instanceof HTMLButtonElement&&!e.dataset.disabled&&(le(Rl(r)),e.focus())}},[O,ge]);return{componentId:b,strings:x,todayDate:S,year:ne,month:D,activeSelected:E,_selected:te,inRange:ae,rangeHovered:se,focusedDate:O,range:a,multiple:r,weeknumbers:u,withcontrols:d,earliest:o,latest:s,excludedates:C,excludeweekdays:l,className:v,dateConstraints:M,calendarRef:k,selectableDatesRef:A,tabIndexSetRef:ue,prevMonth:I,nextMonth:fe,changeMonth:F,handleDateSelect:he,addToSelected:z,removeFromSelected:B,toggleSelectedDate:V,handleRangeHover:me,isExcluded:pe,isDayDisabled:L,focusOnCurrentDate:ge,handleKeydown:(0,t.useCallback)(e=>{if(e.key===`Escape`){e.preventDefault(),P();return}let t=_u(e.key);t!==null&&H(e.nativeEvent,t)},[P,H]),handleFocusOut:(0,t.useCallback)(e=>{k.current&&!k.current.contains(e.relatedTarget)&&!e.target.classList.contains(`pkt-hide`)&&P()},[P]),close:P,setFocusedDate:le}}var bu=({componentId:e,strings:t,year:r,month:i,earliest:a,latest:o,withcontrols:s,prevMonth:c,nextMonth:l,changeMonth:u})=>{let d=e=>{let s=e===`prev`,u=s?nu(r,i,a):ru(r,i,o),d=s?t.prevMonth:t.nextMonth,f=s?`chevron-thin-left`:`chevron-thin-right`,p=s?`pkt-calendar__prev-month`:`pkt-calendar__next-month`,m=s?c:l;return(0,n.jsx)(`div`,{children:(0,n.jsxs)(`button`,{type:`button`,"aria-label":d,onClick:()=>u&&m(),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),u&&m())},className:[`pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only`,p,!u&&`pkt-invisible`].filter(Boolean).join(` `),"data-disabled":u?void 0:`disabled`,"aria-disabled":!u||void 0,tabIndex:u?0:-1,children:[(0,n.jsx)(Q,{className:`pkt-btn__icon`,name:f}),(0,n.jsx)(`span`,{className:`pkt-btn__text`,children:d})]})})};return(0,n.jsxs)(`nav`,{className:`pkt-cal-month-nav`,children:[d(`prev`),s?(0,n.jsxs)(`div`,{className:`pkt-cal-month-picker`,children:[(0,n.jsx)(`label`,{htmlFor:`${e}-monthnav`,className:`pkt-hide`,children:t.month}),(0,n.jsx)(`select`,{"aria-label":t.month,className:`pkt-input pkt-input-compact`,id:`${e}-monthnav`,value:i,onChange:e=>{e.stopPropagation(),u(r,parseInt(e.target.value))},children:t.months.map((e,t)=>(0,n.jsx)(`option`,{value:t,children:e},t))}),(0,n.jsx)(`label`,{htmlFor:`${e}-yearnav`,className:`pkt-hide`,children:t.year}),(0,n.jsx)(`input`,{"aria-label":t.year,className:`pkt-input pkt-cal-input-year pkt-input-compact`,id:`${e}-yearnav`,type:`number`,size:4,placeholder:`0000`,value:r,onChange:e=>{e.stopPropagation(),u(parseInt(e.target.value),i)}})]}):(0,n.jsxs)(`div`,{className:`pkt-txt-16-medium pkt-calendar__month-title`,"aria-live":`polite`,children:[t.months[i],` `,r]}),d(`next`)]})};function xu(e,t,n){let r=Hl(n.year,n.month,e),i=Rl(r),a=i===Rl(t),o=n.activeSelected.includes(i),s=n.isDayDisabled(r,o),c;return n.focusedDate?c=n.focusedDate===i&&!s?`0`:`-1`:!s&&n.tabIndexSetRef.current===0?(n.tabIndexSetRef.current=e,c=`0`):c=n.tabIndexSetRef.current===e?`0`:`-1`,{currentDate:r,currentDateISO:i,isToday:a,isSelected:o,isDisabled:s,ariaLabel:Kl(r),tabindex:c}}function Su(e,t){let{currentDateISO:n,isToday:r,isSelected:i}=e,a=t.range&&(t.activeSelected.length===2||t.rangeHovered!==null)&&n===t.activeSelected[0],o=t.range&&t.activeSelected.length===2&&n===t.activeSelected[1];return(0,$.default)({"pkt-cal-today":r,"pkt-cal-selected":i,"pkt-cal-in-range":t.inRange[n],"pkt-cal-excluded":t.isExcluded(e.currentDate),"pkt-cal-in-range-first":a,"pkt-cal-in-range-last":o,"pkt-cal-range-hover":t.rangeHovered!==null&&n===Rl(t.rangeHovered)})}function Cu(e,t){let{currentDateISO:n,isToday:r,isSelected:i,isDisabled:a}=e,o=t.range&&(t.activeSelected.length===2||t.rangeHovered!==null)&&n===t.activeSelected[0],s=t.range&&t.activeSelected.length===2&&n===t.activeSelected[1];return(0,$.default)({"pkt-calendar__date":!0,"pkt-calendar__date--today":r,"pkt-calendar__date--selected":i,"pkt-calendar__date--disabled":a,"pkt-calendar__date--in-range":t.inRange[n],"pkt-calendar__date--in-range-hover":t.rangeHovered!==null&&n===Rl(t.rangeHovered),"pkt-calendar__date--range-start":o,"pkt-calendar__date--range-end":s})}var wu=({state:e})=>{let{strings:t,year:r,month:i,activeSelected:a,focusedDate:o,inRange:s,rangeHovered:c,range:l,multiple:u,weeknumbers:d,selectableDatesRef:f,tabIndexSetRef:p,handleDateSelect:m,handleRangeHover:h,isExcluded:g,isDayDisabled:_,setFocusedDate:v,todayDate:y}=e,b={year:r,month:i,activeSelected:a,focusedDate:o,tabIndexSetRef:p,isDayDisabled:_},x={range:l,activeSelected:a,rangeHovered:c,inRange:s,isExcluded:g},S=()=>{let e=[];d&&e.push((0,n.jsx)(`th`,{children:(0,n.jsx)(`div`,{className:`pkt-calendar__week-number`,children:t.week})},`week-header`));for(let r=0;r<t.daysShort.length;r++)e.push((0,n.jsx)(`th`,{children:(0,n.jsx)(`div`,{className:`pkt-calendar__day-name`,"aria-label":t.days[r],children:t.daysShort[r]})},`day-${r}`));return(0,n.jsx)(`tr`,{className:`pkt-cal-week-row`,children:e})},C=(e,t)=>{let r=xu(e,t,b),{currentDate:i,currentDateISO:a,isSelected:o,isDisabled:s,ariaLabel:c,tabindex:u}=r;f.current.push({currentDateISO:a,isDisabled:s,tabindex:u});let d=Su(r,x),p=Cu(r,x);return(0,n.jsx)(`td`,{className:d,children:(0,n.jsx)(`button`,{type:`button`,"aria-pressed":o?`true`:`false`,disabled:s,className:`pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only ${p}`,onMouseOver:()=>l&&!g(i)&&h(i),onFocus:()=>{l&&!g(i)&&h(i),v(a)},"aria-label":c,tabIndex:parseInt(u),"data-disabled":s?`disabled`:void 0,"data-date":a,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),m(i))},onClick:e=>{s||(e.preventDefault(),m(i))},children:(0,n.jsx)(`span`,{className:`pkt-btn__text pkt-txt-14-light`,children:e})})},a)},w=(e,t)=>(0,n.jsx)(`td`,{className:`pkt-cal-other`,children:(0,n.jsx)(`div`,{className:`pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only`,"data-disabled":`disabled`,children:(0,n.jsx)(`span`,{className:`pkt-btn__text pkt-txt-14-light`,children:e})})},t);return(0,n.jsxs)(`table`,{className:`pkt-cal-days pkt-txt-12-medium pkt-calendar__body`,role:`grid`,"aria-multiselectable":l||u||void 0,children:[(0,n.jsx)(`thead`,{children:S()}),(0,n.jsx)(`tbody`,{children:(()=>{let e=y,t=du(r,i);f.current=[],p.current=0;let a=1,o=t.initialWeek,s=[];for(let r=0;r<t.numRows;r++){let i=[];d&&i.push((0,n.jsx)(`td`,{className:`pkt-cal-week`,children:o},`week-${o}`)),o++;for(let n=0;n<7;n++){let o=fu(r,n,a,t);if(o===`current-month`)i.push(C(a,e)),a++;else{let e=pu(o,n,a,t);i.push(w(e,`${o}-${r}-${n}`)),o===`next-month`&&a++}}s.push((0,n.jsx)(`tr`,{className:`pkt-cal-week-row`,role:`row`,children:i},`row-${r}`))}return s})()})]})},Tu=(0,t.forwardRef)((e,r)=>{let i=yu(e);return(0,t.useImperativeHandle)(r,()=>({handleDateSelect:i.handleDateSelect,addToSelected:i.addToSelected,removeFromSelected:i.removeFromSelected,toggleSelected:i.toggleSelectedDate,focusOnCurrentDate:i.focusOnCurrentDate,close:i.close}),[i.handleDateSelect,i.addToSelected,i.removeFromSelected,i.toggleSelectedDate,i.focusOnCurrentDate,i.close]),(0,n.jsxs)(`div`,{ref:i.calendarRef,className:[`pkt-calendar`,i.weeknumbers&&`pkt-cal-weeknumbers`,i.className].filter(Boolean).join(` `),onBlur:i.handleFocusOut,onKeyDown:i.handleKeydown,children:[(0,n.jsx)(bu,{componentId:i.componentId,strings:i.strings,year:i.year,month:i.month,earliest:i.earliest,latest:i.latest,withcontrols:i.withcontrols,prevMonth:i.prevMonth,nextMonth:i.nextMonth,changeMonth:i.changeMonth}),(0,n.jsx)(wu,{state:i})]})});Tu.displayName=`PktCalendar`;var Eu=(0,t.forwardRef)(({children:e,skin:r,textStyle:i,size:a,closeTag:o,className:s,iconName:c,ariaLabel:l,onClose:u,type:d,"aria-description":f,...p},m)=>{let[h,g]=(0,t.useState)(!1),_=(0,t.useCallback)(()=>{g(!0),u&&u()},[u]),v=(0,t.useRef)(null),[y,b]=(0,t.useState)(``);(0,t.useEffect)(()=>{b(v.current?.textContent?.trim()??``)},[e]);let x=(0,t.useMemo)(()=>{if(o&&!l)return y&&`Klikk for å fjerne ${y}`||f},[o,l,y,f]),S={"pkt-tag":!0,[`pkt-tag--${a}`]:!!a,[`pkt-tag--${r}`]:!!r,[`pkt-tag--${i}`]:!!i},C={"pkt-tag":!0,"pkt-btn":!0,"pkt-btn--tertiary":!0,[`pkt-tag--${i}`]:!!i,[`pkt-tag--${a}`]:!!a,[`pkt-tag--${r}`]:!!r,"pkt-btn--icons-right-and-left":o&&!!c,"pkt-hide":h};return o?(0,n.jsxs)(`button`,{...p,className:(0,$.default)(C,s),type:d,onClick:_,"aria-label":l,"aria-description":x,ref:m,children:[c&&(0,n.jsx)(Q,{className:`pkt-tag__icon`,name:c}),(0,n.jsx)(`span`,{ref:v,children:e}),(0,n.jsx)(Q,{className:`pkt-tag__close-btn`,name:`close`})]}):(0,n.jsxs)(`span`,{...p,className:(0,$.default)(S,s),ref:m,children:[c&&(0,n.jsx)(Q,{className:`pkt-tag__icon`,name:c,"aria-hidden":`true`}),(0,n.jsx)(`span`,{ref:v,children:e})]})});Eu.displayName=`PktTag`;var Du=(0,t.forwardRef)(({children:e,className:t,ariaLabel:r,metaLead:i,borderOnHover:a=!0,metaTrail:o,layout:s=`vertical`,heading:c=``,headingLevel:l=3,image:u,imageShape:d=`square`,clickCardLink:f,padding:p=`default`,openLinkInNewTab:m=!1,skin:h=`outlined`,subheading:g=``,tagPosition:_=`top`,tags:v=[],...y},b)=>{let x=(0,$.default)({"pkt-card":!0,[`pkt-card--${h}`]:h,[`pkt-card--${s}`]:s,[`pkt-card--padding-${p}`]:p,"pkt-card--border-on-hover":a}),S=r?.trim()||(c?`${c} lenkekort`:`lenkekort`),C=r?.trim()||c||`kort`,w=`h${l}`,ee=()=>u?.src?(0,n.jsx)(`div`,{className:(0,$.default)(`pkt-card__image`,`pkt-card__image-${d}`),children:(0,n.jsx)(`img`,{src:u.src,alt:u.alt||``})}):null,T=()=>v.length===0?null:(0,n.jsx)(`div`,{className:(0,$.default)(`pkt-card__tags`,`pkt-card__tags-${_}`),role:`list`,"aria-label":v.length>1?`merkelapper`:`merkelapp`,children:v.map((e,t)=>(0,n.jsx)(Eu,{role:`listitem`,textStyle:`normal-text`,size:`medium`,skin:e.skin,iconName:e.iconName,children:(0,n.jsx)(`span`,{children:e.text})},t))}),E=()=>!c||f?null:(0,n.jsx)(w,{className:`pkt-heading pkt-heading--medium pkt-heading--fw-regular pkt-card__heading`,children:c}),te=()=>f?(0,n.jsx)(w,{className:`pkt-heading pkt-heading--medium pkt-heading--fw-regular pkt-card__link-heading pkt-card__heading`,children:(0,n.jsx)(`a`,{className:`pkt-card__link`,href:f,target:m?`_blank`:`_self`,rel:m?`noopener noreferrer`:void 0,children:c})}):null,ne=()=>g?(0,n.jsx)(`p`,{className:`pkt-card__subheading`,children:g}):null,re=()=>!c&&!g?null:(0,n.jsxs)(`header`,{className:`pkt-card__header`,children:[E(),te(),ne()]}),D=()=>!i&&!o?null:(0,n.jsxs)(`footer`,{className:`pkt-card__metadata`,children:[i&&(0,n.jsx)(`span`,{className:`pkt-card__metadata-lead`,children:i}),o&&(0,n.jsx)(`span`,{className:`pkt-card__metadata-trail`,children:o})]});return(0,n.jsx)(`div`,{ref:b,className:(0,$.default)(`pkt-card-root`,t),style:{display:`block`,width:`100%`},children:(0,n.jsxs)(`article`,{...y,className:x,"aria-label":f?S:C,children:[ee(),(0,n.jsxs)(`div`,{className:`pkt-card__wrapper`,children:[_===`top`&&T(),re(),(0,n.jsx)(`section`,{className:`pkt-card__content`,children:e}),_===`bottom`&&T(),D()]})]})})});Du.displayName=`PktCard`;var Ou=(0,t.forwardRef)(({id:e,hasTile:r=!1,disabled:i=!1,label:a,checkHelptext:o,hasError:s=!1,className:c,isSwitch:l=!1,hideLabel:u=!1,labelPosition:d=`right`,defaultChecked:f,checked:p,indeterminate:m,optionalTag:h,optionalText:g=`Valgfritt`,requiredTag:_,requiredText:v=`Må fylles ut`,tagText:y,...b},x)=>{let S=(0,t.useRef)(null);(0,t.useEffect)(()=>{S.current&&m!==void 0&&(S.current.indeterminate=m)},[m]),(0,t.useEffect)(()=>{typeof x==`function`?x(S.current):x&&(x.current=S.current)},[x]);let C=[c,`pkt-input-check`].filter(Boolean).join(` `),w=[`pkt-input-check__input-label`,i?`pkt-input-check__input-label--disabled`:``,`pkt-input-check__input-label--${d}`,u?`pkt-sr-only`:``].filter(Boolean).join(` `),ee=[`pkt-input-check__input`,r?`pkt-input-check__input--tile`:``,i&&r?`pkt-input-check__input--tile-disabled`:``].filter(Boolean).join(` `),T=[`pkt-tag`,`pkt-tag--small`,`pkt-tag--thin-text`].join(` `),E=()=>(0,n.jsxs)(n.Fragment,{children:[y&&(0,n.jsx)(`span`,{className:T+` pkt-tag--gray`,children:y}),h&&(0,n.jsx)(`span`,{className:T+` pkt-tag--blue-light`,children:g}),_&&(0,n.jsx)(`span`,{className:T+` pkt-tag--beige`,children:v})]});return(0,n.jsx)(`div`,{className:C,children:(0,n.jsxs)(`div`,{className:ee,children:[d===`left`&&(0,n.jsxs)(`label`,{className:w,htmlFor:e,children:[a,` `,E(),o&&(0,n.jsx)(`div`,{className:`pkt-input-check__input-helptext`,children:o})]}),(0,n.jsx)(`input`,{role:l?`switch`:`checkbox`,ref:S,className:`pkt-input-check__input-checkbox ${s?`pkt-input-check__input-checkbox--error`:``}`,type:`checkbox`,id:e,disabled:i,...p===void 0?{defaultChecked:f}:{checked:p},...b}),d===`right`&&(0,n.jsxs)(`label`,{className:w,htmlFor:e,children:[a,` `,E(),o&&(0,n.jsx)(`div`,{className:`pkt-input-check__input-helptext`,children:o})]})]})})});Ou.displayName=`PktCheckbox`;function ku(e){let n=(0,t.useRef)(null),r=(0,t.useRef)(!1),i=(0,t.useRef)(void 0),a=e=>{let t=n.current;t&&(e===void 0?delete t.dataset.navtype:t.dataset.navtype=e)};return(0,t.useEffect)(()=>()=>{i.current!==void 0&&clearTimeout(i.current)},[]),{ref:t=>{n.current=t,typeof e==`function`?e(t):e&&(e.current=t)},onPointerDown:()=>{r.current=!0,i.current!==void 0&&clearTimeout(i.current),i.current=window.setTimeout(()=>{r.current=!1,i.current=void 0},0)},onFocus:()=>{a(r.current?`pointer`:void 0)},onBlur:e=>{n.current?.contains(e.relatedTarget)||a(void 0)}}}var Au=(0,t.forwardRef)(({forId:e,label:r,helptext:i,helptextDropdown:a,helptextDropdownButton:o,counter:s,counterCurrent:c=0,counterMaxLength:l,optionalTag:u=!1,optionalText:d=`Valgfritt`,requiredTag:f=!1,requiredText:p=`Må fylles ut`,tagText:m=null,hasError:h=!1,errorMessage:g,disabled:_=!1,inline:v=!1,ariaDescribedby:y,useWrapper:b=!0,children:x,className:S=``,hasFieldset:C=!1,role:w=`group`,counterPosition:ee=`bottom`},T)=>{let[E,te]=(0,t.useState)(!1),ne=ku(T),re=y||(i?`${e}-helptext`:void 0),D=!!s,ie=D&&ee===`top`,ae=D&&ee===`bottom`,oe=()=>te(e=>!e),se=[`pkt-inputwrapper`,S,h?`pkt-inputwrapper--error`:``,_?`pkt-inputwrapper--disabled`:``,v?`pkt-inputwrapper--inline`:``].filter(Boolean).join(` `),ce=[`pkt-tag`,`pkt-tag--small`,`pkt-tag--thin-text`].join(` `),O=()=>D?(0,n.jsxs)(`div`,{className:`pkt-input__counter`,"aria-live":`polite`,"aria-atomic":`true`,children:[c,l?`/${l}`:``]}):null,le=()=>(0,n.jsxs)(n.Fragment,{children:[m&&(0,n.jsx)(`span`,{className:ce+` pkt-tag--gray`,children:m}),u&&(0,n.jsx)(`span`,{className:ce+` pkt-tag--blue-light`,children:d}),f&&(0,n.jsx)(`span`,{className:ce+` pkt-tag--beige`,children:p})]}),k=(0,n.jsxs)(n.Fragment,{children:[(()=>{let t=(0,n.jsxs)(n.Fragment,{children:[r,` `,le()]});return b?C?(0,n.jsx)(`legend`,{className:`pkt-inputwrapper__legend`,id:`${e}-label`,children:t}):(0,n.jsx)(`label`,{className:`pkt-inputwrapper__label`,htmlFor:e,"aria-describedby":re,id:`${e}-label`,children:t}):(0,n.jsx)(`label`,{htmlFor:e,className:`pkt-sr-only`,"aria-describedby":re,id:`${e}-label`,children:r})})(),!i&&!a?null:(0,n.jsxs)(n.Fragment,{children:[i&&b&&(0,n.jsx)(`div`,{className:`pkt-inputwrapper__helptext`,id:`${e}-helptext`,children:i}),a&&(0,n.jsxs)(`div`,{className:`pkt-inputwrapper__helptext-expandable`,children:[(0,n.jsx)(uc,{skin:`tertiary`,size:`small`,variant:`icon-right`,iconName:E?`chevron-thin-up`:`chevron-thin-down`,className:`pkt-link pkt-link--icon-right`,onClick:oe,children:(0,n.jsx)(`span`,{dangerouslySetInnerHTML:{__html:o??`Les mer <span class="pkt-sr-only">om inputfeltet</span>`}})}),(0,n.jsx)(`div`,{className:`pkt-inputwrapper__helptext ${E?`pkt-inputwrapper__helptext-expandable-open`:`pkt-inputwrapper__helptext-expandable-closed`}`,children:a})]})]}),ie&&(0,n.jsx)(O,{}),x,ae&&(0,n.jsx)(O,{}),h&&g&&(0,n.jsx)(`div`,{className:`pkt-inputwrapper__alert-wrapper`,children:(0,n.jsx)(sc,{skin:`error`,"aria-live":`assertive`,role:`alert`,id:`${e}-error`,compact:!0,children:g})})]});return(0,n.jsx)(`div`,{className:se,role:w,...ne,children:C?(0,n.jsx)(`fieldset`,{className:`pkt-inputwrapper__fieldset`,"aria-describedby":re,children:k}):(0,n.jsx)(`div`,{className:`pkt-inputwrapper__fieldset`,children:k})})});Au.displayName=`PktInputWrapper`;var ju=(e,t)=>t&&(e.find(e=>e.value===t)||e.find(e=>e.label===t))||null,Mu=(e,t)=>{if(!t)return-1;let n=e.findIndex(e=>e.value===t);return n>=0?n:e.findIndex(e=>e.label===t)},Nu=(e,t)=>{if(!t)return[...e];let n=t.toLowerCase();return e.filter(e=>(e.fulltext||e.value+(e.label||``)+(e.prefix||``)).toLowerCase().includes(n))},Pu=e=>e.value+(e.label||``)+(e.prefix||``),Fu=(e,t)=>t!==null&&e>=t,Iu=(e,t)=>{if(!e)return``;switch(t){case`prefixAndValue`:return`${e.prefix||``} ${e.value}`.trim();case`value`:return e.value;default:return e.label||e.value}},Lu=(e,t)=>e?Array.isArray(e)?t?e:e.length>0?[e[0]]:[]:t?e.split(`,`).filter(Boolean):[e]:[],Ru=(e,t)=>{if(!t)return{filtered:[...e],suggestion:null};let n=t.toLowerCase(),r=e.filter(e=>e.fulltext?.toLowerCase().includes(n));return{filtered:r,suggestion:r.find(e=>!e.selected&&e.label?.toLowerCase().startsWith(n))||null}},zu=(e,t,n,r)=>{if(!e.trim())return{addValueText:null,userInfoMessage:``};let i=e.trim().toLowerCase(),a=t.find(e=>e.toLowerCase()===i),o=n.filter(e=>e.label?.toLowerCase().includes(i)||e.value.toLowerCase().includes(i)),s=o.find(e=>e.label?.toLowerCase()===i||e.value.toLowerCase()===i);return(o.length===0||!s)&&r?{addValueText:e,userInfoMessage:``}:o.length===0&&!r?{addValueText:null,userInfoMessage:`Ingen treff i søket`}:a?{addValueText:null,userInfoMessage:`Verdien er allerede valgt`}:{addValueText:null,userInfoMessage:``}},Bu=(e,t,n)=>{switch(e){case`,`:return n?`addValue`:null;case`Enter`:return`addValue`;case`Tab`:case`ArrowDown`:return t?null:`focusListbox`;case`Escape`:return`closeOptions`;default:return null}},Vu=(e,t,n,r,i)=>{if(!e)return{action:`none`,value:null};let a=ju(n,e);return!t.includes(e)&&!a?r?{action:`addUserValue`,value:e}:i?{action:`none`,value:null}:{action:`removeValue`,value:t[0]}:a&&!t.includes(a.value)?{action:`selectOption`,value:a.value}:{action:`none`,value:null}},Hu=(e,t,n)=>{let r=ju(t,e);return n===`label`&&r?.label?r.label:e},Uu=e=>{e.scrollIntoView({block:`nearest`}),window.setTimeout(()=>e.focus(),0)},Wu=e=>Array.from(e.querySelectorAll(`[role="option"]:not([data-disabled])`)||[]),Gu=e=>{let t=e.nextElementSibling;t&&Uu(t)},Ku=(e,t,n)=>{let r=e.previousElementSibling;if(e.dataset.index===`0`&&n){let e=t.querySelector(`[role="searchbox"]`);e&&Uu(e)}else r&&Uu(r)},qu=e=>{let t=Wu(e);t[0]&&Uu(t[0])},Ju=(e,t)=>{if(t.disabled)return;let n=Wu(e);if(t.allowUserInput&&t.customUserInput){let t=e.querySelector(`[data-type="new-option"]`);if(t){Uu(t);return}}let r=n.find(e=>e.dataset.selected===`true`);if(r){Uu(r);return}if(t.includeSearch&&!(document.activeElement instanceof HTMLInputElement)){let t=e.querySelector(`[role="searchbox"]`);if(t){window.setTimeout(()=>t.focus(),0);return}}n[0]&&Uu(n[0])},Yu=({state:e,outside:r=!1})=>{let{values:i,options:a,disabled:o,displayValueAs:s,handleTagRemove:c,handleTagKeydown:l,focusedTagIndex:u}=e,d=(0,t.useRef)([]);if((0,t.useEffect)(()=>{!r&&u>=0&&u<i.length&&d.current[u]?.focus()},[r,u,i.length]),i.length===0)return null;let f=i.map((e,t)=>{let i=ju(a,e),f=i?.tagSkinColor,p=i?Iu(i,s):e;return o?(0,n.jsx)(`li`,{role:`listitem`,children:(0,n.jsx)(Eu,{skin:f||`blue-dark`,children:(0,n.jsx)(`span`,{className:`pkt-combobox__value`,children:p})})},e):r?(0,n.jsx)(`li`,{role:`listitem`,children:(0,n.jsx)(Eu,{skin:f||`blue-dark`,closeTag:!0,onClose:()=>c(e),children:(0,n.jsx)(`span`,{className:`pkt-combobox__value`,children:p})})},e):(0,n.jsx)(`li`,{role:`listitem`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.preventDefault(),children:(0,n.jsx)(Eu,{ref:e=>{d.current[t]=e},skin:f||`blue-dark`,closeTag:!0,tabIndex:u===t?0:-1,onClose:()=>c(e),onKeyDown:e=>l(e,t),children:(0,n.jsx)(`span`,{className:`pkt-combobox__value`,children:p})})},e)});return r?(0,n.jsx)(`div`,{className:`pkt-combobox__tags-outside`,children:(0,n.jsx)(`ul`,{role:`list`,className:`pkt-combobox__tag-list`,children:f})}):(0,n.jsx)(`ul`,{role:`list`,className:`pkt-combobox__tag-list`,children:f})},Xu=({state:e})=>{let{values:t,options:r,editingSingleValue:i,displayValueAs:a}=e;if(i||t.length===0)return null;let o=ju(r,t[0]);return o?(0,n.jsx)(`span`,{className:`pkt-combobox__value`,children:Iu(o,a)}):null},Zu=({state:e})=>{let{id:t,inputId:r,listboxId:i,values:a,options:o,isOpen:s,multiple:c,typeahead:l,allowUserInput:u,tagPlacement:d,placeholder:f,disabled:p,fullwidth:m,hasError:h,label:g,inputFocus:_,inputRef:v,triggerRef:y,handleInputChange:b,handleInputKeydown:x,handleInputFocus:S,handleInputBlur:C,handleInputClick:w,handlePlaceholderClick:ee,handleSelectOnlyKeydown:T,name:E}=e,te=[`pkt-combobox__input`,m&&`pkt-combobox__input--fullwidth`,s&&`pkt-combobox__input--open`,h&&`pkt-combobox__input--error`,p&&`pkt-combobox__input--disabled`].filter(Boolean).join(` `),ne=[`pkt-combobox__arrow-icon`,s&&`pkt-combobox__arrow-icon--open`].filter(Boolean).join(` `),re=l||u,D=!re&&f&&(!a.length||c&&d===`outside`)&&!_,ie=d!==`outside`,ae=a[0]&&ju(o,a[0])?`${i}-${Mu(o,a[0])}`:void 0,oe=c&&a.length>0?`${a.length} valgt`:void 0;return(0,n.jsxs)(`div`,{ref:y,className:te,onClick:w,...re?{tabIndex:-1}:{id:`${t}-combobox`,role:`combobox`,"aria-expanded":s?`true`:`false`,"aria-controls":i,"aria-haspopup":`listbox`,"aria-labelledby":`${t}-combobox-label`,"aria-activedescendant":ae,"aria-description":oe,tabIndex:p?-1:0,onKeyDown:T},children:[D?(0,n.jsx)(`span`,{className:`pkt-combobox__placeholder`,onClick:ee,children:f}):ie?c?(0,n.jsx)(Yu,{state:e}):re?null:(0,n.jsx)(Xu,{state:e}):null,re?(0,n.jsx)(`div`,{className:`pkt-combobox__input-div combobox__input`,children:(0,n.jsx)(`input`,{ref:v,type:`text`,id:r,name:`${E||t}-input`,onChange:b,onKeyDown:x,onFocus:S,onBlur:C,placeholder:!a.length||c&&d===`outside`?f:void 0,autoComplete:`off`,role:`combobox`,"aria-expanded":s?`true`:`false`,"aria-label":g,"aria-autocomplete":l?`both`:u?`list`:`none`,"aria-controls":i,"aria-activedescendant":ae,"aria-description":oe,disabled:p})}):(0,n.jsx)(`input`,{ref:v,type:`hidden`,id:r,name:`${E||t}-input`,value:a.join(`,`),readOnly:!0}),(0,n.jsx)(Q,{className:ne,name:`chevron-thin-down`,"aria-hidden":`true`})]})},Qu=({state:e})=>{let{listboxId:t,label:r,isOpen:i,options:a,filteredOptions:o,multiple:s,disabled:c,maxIsReached:l,maxlength:u,includeSearch:d,allowUserInput:f,addValueText:p,userInfoMessage:m,searchPlaceholder:h,searchValue:g,handleOptionClick:_,handleOptionKeydown:v,handleSearchInput:y,handleSearchKeydown:b,handleNewOptionClick:x,handleNewOptionKeydown:S,listboxRef:C}=e,w=o.filter(e=>e.selected).length,ee=s&&w>0&&u!=null&&u>0,T=f&&p&&!l,E=!!m;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(`div`,{ref:C,id:t,className:[`pkt-listbox`,i&&`pkt-listbox__open`,`pkt-txt-16-light`].filter(Boolean).join(` `),role:o.length>0?`listbox`:void 0,"aria-label":o.length>0?`Liste: ${r||``}`:void 0,"aria-multiselectable":o.length>0&&s?`true`:void 0,children:[(0,n.jsxs)(`div`,{className:`pkt-listbox__banners`,children:[d&&(0,n.jsxs)(`div`,{className:`pkt-listbox__search`,children:[(0,n.jsx)(`span`,{className:`pkt-listbox__search-icon`,children:(0,n.jsx)(Q,{name:`magnifying-glass-small`})}),(0,n.jsx)(`input`,{className:`pkt-txt-16-light`,type:`text`,"aria-label":`Søk i listen`,form:``,placeholder:h||`Søk...`,onChange:y,onKeyDown:b,value:g,"data-type":`searchbox`,disabled:c,readOnly:c,role:`searchbox`})]}),ee&&(0,n.jsxs)(`div`,{className:`pkt-listbox__banner pkt-listbox__banner--maximum-reached`,children:[w,` av maks `,u,` mulige er valgt.`]}),E&&(0,n.jsxs)(`div`,{className:`pkt-listbox__banner pkt-listbox__banner--user-message`,children:[(0,n.jsx)(Q,{className:`pkt-listbox__banner-icon`,name:`exclamation-mark-circle`}),m]}),T&&(0,n.jsxs)(`div`,{className:`pkt-listbox__banner pkt-listbox__banner--new-option pkt-listbox__option`,"data-type":`new-option`,"data-value":p,"data-selected":`false`,tabIndex:0,onClick:()=>x(p),onKeyDown:S,children:[(0,n.jsx)(Q,{className:`pkt-listbox__banner-icon`,name:`plus-sign`}),`Legg til "`,p,`"`]}),a.length===0&&o.length===0&&!E&&(0,n.jsxs)(`div`,{className:`pkt-listbox__banner pkt-listbox__banner--empty`,children:[(0,n.jsx)(Q,{className:`pkt-listbox__banner-icon`,name:`exclamation-mark-circle`}),`Tom liste`]})]}),(0,n.jsx)(`ul`,{className:`pkt-listbox__options`,role:`presentation`,children:o.map((e,r)=>{let i=[`pkt-listbox__option`,!s&&e.selected&&`pkt-listbox__option--selected`,s&&`pkt-listbox__option--checkBox`].filter(Boolean).join(` `),a=c||e.disabled||l&&!e.selected;return(0,n.jsxs)(`li`,{className:i,onClick:()=>_(e.value),onKeyDown:t=>v(t,e.value),"aria-selected":e.selected?`true`:`false`,tabIndex:a?-1:0,"data-index":r,"data-value":e.value,"data-selected":e.selected?`true`:`false`,"data-disabled":a||void 0,"aria-disabled":a?`true`:`false`,role:`option`,id:`${t}-${r}`,children:[s?(0,n.jsx)(`input`,{className:`pkt-input-check__input-checkbox`,type:`checkbox`,tabIndex:-1,value:e.value,checked:e.selected||!1,readOnly:!0,"aria-hidden":`true`,disabled:a}):e.selected?(0,n.jsx)(Q,{name:`check-big`}):null,(0,n.jsxs)(`span`,{className:`pkt-listbox__option-label`,id:`${t}-option-label-${r}`,children:[e.prefix&&(0,n.jsx)(`span`,{className:`pkt-listbox__option-prefix`,children:e.prefix}),e.label||e.value]}),e.description&&(0,n.jsx)(`span`,{className:`pkt-listbox__option-description pkt-txt-14-light`,children:e.description})]},`${e.value}-${r}`)})})]}),(0,n.jsx)(`div`,{"aria-live":`polite`,className:`pkt-visually-hidden`,children:m})]})};function $u(e,t){return e.map(e=>({...e,label:e.label||e.value,fulltext:Pu(e),selected:t.includes(e.value)}))}function ed(e,n){let{id:r=``,label:i,value:a,defaultValue:o,options:s,defaultOptions:c,multiple:l=!1,maxlength:u,typeahead:d=!1,includeSearch:f=!1,allowUserInput:p=!1,displayValueAs:m=`label`,tagPlacement:h,searchPlaceholder:g,placeholder:_,disabled:v=!1,required:y=!1,fullwidth:b=!1,hasError:x=!1,errorMessage:S,helptext:C,helptextDropdown:w,helptextDropdownButton:ee,optionalTag:T=!1,optionalText:E,requiredTag:te=!1,requiredText:ne,tagText:re,useWrapper:D=!0,name:ie,className:ae,onChange:oe,onValueChange:se,children:ce}=e,O=`${r}-input`,le=`${r}-listbox`,k=d||p,A=(0,t.useRef)(null),ue=(0,t.useRef)(null),de=(0,t.useRef)(null),j=(0,t.useRef)(null),M=(0,t.useRef)(null),N=(0,t.useCallback)(()=>{k?A.current?.focus():de.current?.focus()},[k]),P=(0,t.useMemo)(()=>{let e=[];return t.Children.forEach(ce,n=>{if((0,t.isValidElement)(n)&&n.type===`option`){let t=n.props;e.push({value:t.value??t.children??``,label:t.children??t.value??``,selected:t.selected,disabled:t.disabled})}}),e},[ce]),F=(0,t.useMemo)(()=>c&&c.length>0?c.map(e=>({...e,fulltext:Pu(e)})):s&&s.length>0?s.map(e=>({...e,fulltext:Pu(e)})):P.length>0?P.map(e=>({...e,fulltext:Pu(e)})):[],[c,s,P]),I=a!==void 0,[fe,pe]=(0,t.useState)(()=>Lu(a??o,l)),L=(0,t.useRef)(fe);(0,t.useEffect)(()=>{I&&pe(Lu(a,l))},[a,I,l]);let R=I?Lu(a,l):fe,[me,he]=(0,t.useState)([]),z=(0,t.useMemo)(()=>$u([...me.filter(e=>!F.some(t=>t.value===e.value)),...F],R),[F,me,R]),[B,V]=(0,t.useState)(!1),[ge,H]=(0,t.useState)(``),[_e,ve]=(0,t.useState)(``),[U,ye]=(0,t.useState)(``),[be,xe]=(0,t.useState)(null),[Se,Ce]=(0,t.useState)(!1),[we,Te]=(0,t.useState)(!1),[Ee,De]=(0,t.useState)(-1),Oe=(0,t.useRef)(!1),ke=Fu(R.length,u??null),Ae=l&&u!=null,je=(0,t.useMemo)(()=>ge?d?Ru(z,ge).filtered:Nu(z,ge):z,[z,ge,d]),Me=(0,t.useMemo)(()=>Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,`value`)?.set,[]),Ne=(0,t.useCallback)(e=>{let t=ue.current;if(!t||!Me)return;let n=l?e.join(`,`):e[0]||``;Me.call(t,n),t.dispatchEvent(new Event(`input`,{bubbles:!0}))},[Me,l]),Pe=l?R.join(`,`):R[0]||``;(0,t.useEffect)(()=>{ue.current&&(ue.current.value=Pe)},[Pe]),(0,t.useEffect)(()=>{if(B||l||!A.current)return;let e=R[0]?Hu(R[0],z,m):``;A.current.value!==e&&(A.current.value=e)},[R,z,m,l,B]);let Fe=(0,t.useCallback)((e,t=!0)=>{I||pe(e),t&&(se?.(e),Ne(e))},[I,se,Ne]),Ie=(0,t.useCallback)(e=>{if(e&&!R.includes(e)){if(l&&Fu(R.length,u??null)){ye(`Maks antall valg nådd`);return}Fe(l?[...R,e]:[e])}},[R,l,u,Fe]),Le=(0,t.useCallback)(e=>{if(!e)return;let t=R.filter(t=>t!==e);ju(z,e)?.userAdded&&he(t=>t.filter(t=>t.value!==e)),Fe(t)},[R,z,Fe]),Re=(0,t.useCallback)(()=>{he([]),Fe([])},[Fe]),ze=(0,t.useCallback)(e=>{if(!e||e.trim()===``)return;let t;if(!l)t=[e];else{if(ju(z,e)||Fu(R.length,u??null))return;t=[...R,e]}let n={value:e,label:e,userAdded:!0,selected:!0};he(t=>[n,...t.filter(t=>t.value!==e)]),Fe(t)},[l,z,R,u,Fe]),Be=(0,t.useCallback)((e=!0,t)=>{if(xe(null),e&&A.current&&A.current.type!==`hidden`){H(``),ve(``);let e=t===void 0?R[0]:t;!l&&e?A.current.value=Hu(e,z,m):A.current.value=``,l||(Te(!1),ye(``))}},[l,R,z,m]),Ve=(0,t.useCallback)(e=>{if(v)return;ye(``),xe(null);let t=ju(z,e)?.value||null,n=R.includes(e||t||``),r=!!t,i=z.find(t=>t.value===e)?.disabled||!1,a=!e?.trim(),o=!l,s=l,c=Fu(R.length,u??null),d=!1,f=!0,m=``,h=``,g;i||(!r&&p&&!a?(ze(e),m=`Ny verdi lagt til`,d=s,o&&(g=e||``)):!r&&!p?(o&&R[0]&&Le(R[0]),f=!1,d=!0,m=`Ingen treff i søket`):n?(Le(t),d=!0,g=``,o&&k&&A.current&&A.current.type!==`hidden`&&(A.current.value=``)):a&&o?(Re(),d=!0,g=``):o?(R[0]&&Le(R[0]),Ie(t),d=!1,g=t||``):s&&!c?(Ie(t),d=!0):s&&c?(m=`Maks antall valg nådd`,f=!1,h=e||``):(o&&Re(),m=`Ingen gyldig verdi valgt`,f=!1,d=!0,h=e||``,g=``),V(d),ye(m),H(h),Be(f,g),d||(o&&k&&(Oe.current=!0),window.setTimeout(()=>{N()},0)))},[v,z,R,l,u,p,ze,Le,Re,Ie,Be,N]),He=(0,t.useCallback)(()=>{if(Ce(!1),xe(null),ye(``),H(``),A.current&&A.current.type!==`hidden`){let e=A.current.value,t=R[0];if(!l)if(!e)R[0]&&Le(R[0]),t=void 0;else{let n=ju(z,e);n&&n.value!==R[0]?(R[0]&&Le(R[0]),Ie(n.value),t=n.value):!n&&p&&(R[0]&&Le(R[0]),ze(e),t=e)}else if(e!==``){let{action:t,value:n}=Vu(e,R,z,p,l);switch(t){case`addUserValue`:ze(n);break;case`selectOption`:Ie(n);break;case`removeValue`:Le(n);break}}!l&&t?A.current.value=Hu(t,z,m):A.current.value=``}V(!1),Te(!1)},[R,z,p,l,m,ze,Ie,Le]),Ue=(0,t.useCallback)(e=>{if(!e.trim().toLowerCase()){xe(null),ye(``),!l&&R[0]&&Le(R[0]);return}let t=zu(e,R,z,p);xe(t.addValueText),ye(t.userInfoMessage)},[R,z,p,l,Le]),W=(0,t.useCallback)(e=>{if(v)return;let t=e.target.value;if(ve(t),H(t),Ue(t),d&&t){let{suggestion:n}=Ru(z,t);n?.label&&A.current&&!e.nativeEvent.inputType?.includes(`deleteContent`)&&(A.current.value=n.label,window.setTimeout(()=>A.current?.setSelectionRange(t.length,n.label.length),0))}},[v,d,z,Ue]),G=(0,t.useCallback)(e=>{if(e.key===`Backspace`){let t=!A.current?.value;if(!ge&&t&&l&&R.length>0){e.preventDefault();let t=R[R.length-1];Le(t)}return}if(e.key===`ArrowLeft`&&l&&R.length>0&&(A.current?.selectionStart??0)===0&&!A.current?.value){e.preventDefault(),De(R.length-1);return}let t=Bu(e.key,e.shiftKey,l);if(t&&!(e.key===`Tab`&&!B)){if(t===`focusListbox`&&e.key===`Tab`&&!j.current?.querySelector(`[role="option"]:not([data-disabled]), [data-type="new-option"]`)){He();return}switch(e.preventDefault(),t){case`addValue`:{let e=A.current?.value.trim()||``;if(H(e),e&&R.includes(e)){Be(!0),ye(`Verdien er allerede valgt`);break}Ve(e);break}case`focusListbox`:j.current&&(B||V(!0),Ju(j.current,{disabled:v,allowUserInput:p,customUserInput:be,includeSearch:f}));break;case`closeOptions`:V(!1);break}}},[ge,R,l,v,p,be,f,B,Le,Ve,N]),We=(0,t.useCallback)(()=>{if(!v){if(Oe.current){Oe.current=!1,Ce(!0);return}!l&&R[0]&&A.current&&A.current.type!==`hidden`&&(Te(!0),A.current.value=Hu(R[0],z,m)),Ce(!0),H(``),V(!0)}},[v,l,R,z,m]),Ge=(0,t.useCallback)(()=>{Ce(!1),Te(!1)},[]),Ke=(0,t.useCallback)(e=>{if(v||!B)return;let t=e.relatedTarget,n=M.current;n&&t&&n.contains(t)||He()},[v,B,He]),qe=(0,t.useCallback)(e=>{if(v){e.preventDefault(),e.stopPropagation();return}if(k)A.current?.focus();else{e.stopPropagation(),e.preventDefault();let t=!B;V(t),t&&j.current&&Ju(j.current,{disabled:v,allowUserInput:p,customUserInput:be,includeSearch:f})}},[v,k,B,p,be,f]),K=(0,t.useCallback)(e=>{v||(e.stopPropagation(),k&&A.current?(A.current.focus(),Ce(!0)):V(e=>!e))},[v,k]),Je=(0,t.useCallback)(e=>{if(!v)switch(e.key){case`Enter`:case` `:case`ArrowDown`:case`ArrowUp`:e.preventDefault(),B?V(!1):(V(!0),j.current&&window.setTimeout(()=>{j.current&&Ju(j.current,{disabled:v,allowUserInput:p&&!ke,customUserInput:be,includeSearch:f})},0));break;case`Escape`:B&&(e.preventDefault(),V(!1));break;case`Home`:case`End`:e.preventDefault(),B||V(!0),j.current&&window.setTimeout(()=>{j.current&&Ju(j.current,{disabled:v,allowUserInput:p&&!ke,customUserInput:be,includeSearch:f})},0);break;case`ArrowLeft`:l&&R.length>0&&(e.preventDefault(),De(R.length-1));break;case`Backspace`:case`Delete`:if(l&&R.length>0){e.preventDefault();let t=R[R.length-1];Le(t)}break}},[v,B,p,ke,be,f,l,R,Le]),Ye=(0,t.useCallback)(e=>{Ve(e)},[Ve]),Xe=(0,t.useCallback)((e,t)=>{switch(e.key){case`Enter`:case` `:e.preventDefault(),Ve(t);break;case`ArrowDown`:e.preventDefault(),Gu(e.currentTarget);break;case`ArrowUp`:e.preventDefault(),j.current&&Ku(e.currentTarget,j.current,f);break;case`Escape`:e.preventDefault(),V(!1),N();break;case`Tab`:He();break}},[Ve,f,N,He]),Ze=(0,t.useCallback)(e=>{Le(e),De(-1),k&&A.current&&(Ce(!0),A.current.focus())},[Le,k]),Qe=(0,t.useCallback)((e,t)=>{switch(e.stopPropagation(),e.key){case`ArrowLeft`:e.preventDefault(),t>0&&De(t-1);break;case`ArrowRight`:e.preventDefault(),t<R.length-1?De(t+1):(De(-1),k&&A.current?A.current.focus():de.current?.focus());break;case`Backspace`:case`Delete`:e.preventDefault();{let e=R[t],n=t>=R.length-1?t-1:t;Le(e),n>=0?De(n):(De(-1),k&&A.current?A.current.focus():de.current?.focus())}break;case`Tab`:De(-1);break;case`Escape`:e.preventDefault(),De(-1),k&&A.current?A.current.focus():de.current?.focus();break}},[R,k,Le]),q=(0,t.useCallback)(e=>{H(e.target.value),Ue(e.target.value)},[Ue]),$e=(0,t.useCallback)(e=>{switch(e.key){case`ArrowDown`:e.preventDefault(),j.current&&j.current.querySelector(`[role="option"]:not([data-disabled]), [data-type="new-option"]`)?.focus();break;case`Tab`:He();break;case`Escape`:e.preventDefault(),V(!1),N();break}},[N,He]),et=(0,t.useCallback)(e=>{Ve(e)},[Ve]),tt=(0,t.useCallback)(e=>{switch(e.key){case`Enter`:case` `:e.preventDefault(),Ve(e.currentTarget.dataset.value||``);break;case`ArrowDown`:e.preventDefault(),j.current&&qu(j.current);break;case`ArrowUp`:e.preventDefault(),j.current&&Ku(e.currentTarget,j.current,f);break;case`Escape`:e.preventDefault(),V(!1),N();break}},[Ve,f,N]);return(0,t.useEffect)(()=>{if(!B)return;let e=e=>{let t=e.target;M.current&&!M.current.contains(t)&&He()};return document.addEventListener(`click`,e,!0),()=>{document.removeEventListener(`click`,e,!0)}},[B,He]),(0,t.useEffect)(()=>{let e=M.current?.closest(`form`);if(!e)return;let t=()=>{window.setTimeout(()=>{if(pe(L.current),he([]),ve(``),H(``),xe(null),ye(``),ue.current){let e=l?L.current.join(`,`):L.current[0]||``;ue.current.value=e}},0)};return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)},[l]),(0,t.useImperativeHandle)(n,()=>({get value(){return ue.current?.value??``},set value(e){let t=Array.isArray(e)?e:e?String(e).split(`,`).filter(Boolean):[];I||pe(t),ue.current&&(ue.current.value=t.join(`,`))},focus(){k?A.current?.focus():de.current?.focus()},blur(){k?A.current?.blur():de.current?.blur()}}),[I]),{id:r,inputId:O,listboxId:le,values:R,inputValue:_e,searchValue:ge,options:z,filteredOptions:je,isOpen:B,userInfoMessage:U,addValueText:be,maxIsReached:ke,editingSingleValue:we,inputFocus:Se,focusedTagIndex:Ee,label:i,multiple:l,maxlength:u,typeahead:d,includeSearch:f,allowUserInput:p,displayValueAs:m,tagPlacement:h,searchPlaceholder:g,placeholder:_,disabled:v,required:y,fullwidth:b,hasError:x,errorMessage:S,helptext:C,helptextDropdown:w,helptextDropdownButton:ee,optionalTag:T,optionalText:E,requiredTag:te,requiredText:ne,tagText:re,useWrapper:D,name:ie,className:ae,hasCounter:Ae,inputRef:A,changeInputRef:ue,triggerRef:de,listboxRef:j,wrapperRef:M,handleInputChange:W,handleInputKeydown:G,handleInputFocus:We,handleInputBlur:Ge,handleFocusOut:Ke,handleInputClick:qe,handlePlaceholderClick:K,handleSelectOnlyKeydown:Je,handleOptionClick:Ye,handleOptionKeydown:Xe,handleTagRemove:Ze,handleTagKeydown:Qe,handleSearchInput:q,handleSearchKeydown:$e,handleNewOptionClick:et,handleNewOptionKeydown:tt,onChange:oe}}var td=(0,t.forwardRef)((e,t)=>{let r=ed(e,t),i=[`pkt-combobox-component`,r.fullwidth&&`pkt-combobox-component--fullwidth`,r.className].filter(Boolean).join(` `),a=r.allowUserInput||r.typeahead,o=a?r.inputId:`${r.id}-combobox`;return(0,n.jsxs)(`div`,{className:i,ref:r.wrapperRef,id:r.id||void 0,children:[(0,n.jsxs)(Au,{forId:o,hasFieldset:!a,label:r.label||``,helptext:r.helptext,helptextDropdown:r.helptextDropdown,helptextDropdownButton:r.helptextDropdownButton,hasError:r.hasError,errorMessage:r.errorMessage,disabled:r.disabled,optionalTag:r.optionalTag,optionalText:r.optionalText,requiredTag:r.requiredTag,requiredText:r.requiredText,tagText:r.tagText,useWrapper:r.useWrapper,counter:r.hasCounter,counterCurrent:r.values.length,counterMaxLength:r.maxlength,className:`pkt-combobox__wrapper`,children:[(0,n.jsxs)(`div`,{className:`pkt-combobox`,onBlur:r.handleFocusOut,children:[(0,n.jsx)(Zu,{state:r}),(0,n.jsx)(Qu,{state:r})]}),r.tagPlacement===`outside`&&r.multiple&&(0,n.jsx)(Yu,{state:r,outside:!0})]}),(0,n.jsx)(`input`,{ref:r.changeInputRef,type:`text`,name:r.name||r.id,onChange:r.onChange,tabIndex:-1,"aria-hidden":`true`,className:`pkt-visually-hidden`})]})});td.displayName=`PktCombobox`;var nd=x({tagName:`pkt-consent`,elementClass:As,react:t.default,displayName:`PktConsent`,events:{onToggleConsent:`toggle-consent`}});nd.displayName=`PktConsent`;var rd=()=>{let e=navigator.userAgent;return!!(/iP(hone|od|ad)/.test(e)||/Macintosh/.test(e)&&`ontouchend`in document)},id=()=>rd()?`text`:`date`,ad=e=>!e||e.length!==2?!0:$l(e[0],e[1]),od=(e,t,n,r,i,a)=>({"pkt-input":!0,"pkt-datepicker__input":!0,"pkt-input--fullwidth":e,"pkt-datepicker--hasrangelabels":t,"pkt-datepicker--multiple":n,"pkt-datepicker--range":r,"ios-readonly-hack":i===!1&&a===`text`}),sd=()=>({"pkt-input-icon":!0,"pkt-btn":!0,"pkt-btn--icon-only":!0,"pkt-btn--tertiary":!0,"pkt-datepicker__calendar-button":!0}),cd=e=>({"pkt-input-prefix":e,"pkt-hide":!e}),ld=(e,t,n)=>!t&&!n?Array.isArray(e)?e[0]||``:e:Array.isArray(e)?e.join(`,`):e,ud=(e,t,n=!1)=>{if(!e||!t)return;let r=t.parentElement?.getBoundingClientRect()||t.getBoundingClientRect(),i=n?r.height+30:r.height,a=e.getBoundingClientRect().height,o=n?`calc(100% - 30px)`:`100%`;r&&r.top+a>window.innerHeight&&r.top-a>0&&(o=`calc(100% - ${i}px - ${a}px)`),e.style.top=o},dd=(e,t,n,r,i,a)=>{let{key:o}=e;o===`,`&&(e.preventDefault(),a?a(e):i&&i()),(o===`Space`||o===` `)&&(e.preventDefault(),t(e)),o===`Enter`&&(e.preventDefault(),n?n():r?r():i&&i())},fd=({open:e,multiple:r=!1,range:i=!1,weeknumbers:a=!1,withcontrols:o=!1,selected:s=[],earliest:c,latest:l,excludedates:u,excludeweekdays:d,maxMultiple:f,currentmonth:p,today:m,inputRef:h,hasCounter:g=!1,onDateSelected:_,onClose:v})=>{let y=(0,t.useRef)(null),b=(0,t.useRef)(!1);e&&(b.current=!0),(0,t.useEffect)(()=>{e&&ud(y.current,h?.current??null,g)},[e,h,g]);let x=[`pkt-calendar-popup`,e?`show`:`hide`].join(` `),S=e||b.current;return(0,n.jsx)(`div`,{ref:y,className:x,hidden:!e,"aria-hidden":!e,children:S&&(0,n.jsx)(Tu,{multiple:r,range:i,weeknumbers:a,withcontrols:o,selected:s,earliest:c,latest:l,excludedates:u,excludeweekdays:d,maxMultiple:f,currentmonth:p,today:m,onDateSelected:_,onClose:v})})},pd=({dates:e,dateformat:t,idBase:r,strings:i,onDateRemoved:a})=>{let o=Ql(e),s=i?.calendar?.buttonAltText??`Slett dato`;return(0,n.jsx)(`div`,{className:`pkt-date-tags pkt-datepicker__tags`,"aria-live":`polite`,children:o.map(e=>{let i=Bl(e,t);return(0,n.jsx)(Eu,{id:`${r}${e}-tag`,closeTag:!0,ariaLabel:`${s} ${i}`,onClose:()=>a(e),children:(0,n.jsx)(`time`,{dateTime:e,children:i})},e)})})},md=({state:e})=>{let{id:t,inputId:r,values:i,dateformat:a,multiple:o,range:s,showRangeLabels:c,disabled:l,readOnly:u,required:d,label:f,name:p,placeholder:m,hasError:h,helptext:g,minStr:_,maxStr:v,inputType:y,isIOSDevice:b,strings:x,inputClasses:S,buttonClasses:C,rangeLabelClasses:w,datepickerInputsClasses:ee,isInputDisabled:T,inputRef:E,inputRefTo:te,btnRef:ne,toggleCalendar:re,handleFocus:D,handleSingleInputChange:ie,handleRangeFromChange:ae,handleRangeToChange:oe,handleRangeBlur:se,handleMultipleBlur:ce,handleTagRemoved:O,handleSingleKeydown:le,handleRangeFromKeydown:k,handleRangeToKeydown:A,handleMultipleKeydown:ue,restProps:de}=e,j=e=>{e.preventDefault(),re()},M=()=>(0,n.jsxs)(`button`,{ref:ne,className:C,type:`button`,onClick:re,disabled:l,"aria-label":x.calendar?.buttonAltText??`Åpne kalender`,children:[(0,n.jsx)(Q,{name:`calendar`}),(0,n.jsx)(`span`,{className:`pkt-btn__text`,children:x.calendar?.buttonAltText??`Åpne kalender`})]});return o?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(pd,{dates:i,dateformat:a,idBase:t,strings:x,onDateRemoved:O}),(0,n.jsx)(`div`,{className:`pkt-datepicker__inputs`,children:(0,n.jsxs)(`div`,{className:`pkt-input__container`,children:[(0,n.jsx)(`input`,{...de,ref:E,className:S,type:y,id:r,name:p??t,placeholder:m,readOnly:u||b&&!u,disabled:T,"aria-describedby":g?`${t}-helptext`:void 0,"aria-invalid":h,"aria-errormessage":h?`${t}-error`:void 0,onClick:j,onKeyDown:ue,onFocus:D,onBlur:ce}),M()]})})]}):s?(0,n.jsx)(`div`,{className:ee,children:(0,n.jsxs)(`div`,{className:`pkt-input__container`,children:[c&&(0,n.jsx)(`div`,{className:`pkt-input-prefix`,children:x.generic?.from??`Fra`}),(0,n.jsx)(`input`,{...de,ref:E,className:S,type:y,id:r,name:p?`${p}-from`:`${t}-from`,value:i[0]??``,min:_,max:v,placeholder:m,readOnly:u||b&&!u,disabled:l,required:d,"aria-label":`${f} ${x.generic?.from??`Fra`}`,"aria-describedby":g?`${t}-helptext`:void 0,"aria-invalid":h,"aria-errormessage":h?`${t}-error`:void 0,onClick:j,onKeyDown:k,onFocus:D,onBlur:se,onChange:ae}),(0,n.jsx)(`div`,{className:w,id:`${t}-to-label`,children:x.generic?.to??`Til`}),!c&&(0,n.jsx)(`div`,{className:`pkt-input-separator`,children:`–`}),(0,n.jsx)(`input`,{ref:te,className:S,type:y,id:`${t}-to`,name:p?`${p}-to`:`${t}-to`,value:i[1]??``,min:_,max:v,readOnly:u||b&&!u,disabled:l,"aria-label":`${f} ${x.generic?.to??`Til`}`,"aria-invalid":h,onClick:j,onKeyDown:A,onFocus:D,onBlur:se,onChange:oe}),M()]})}):(0,n.jsx)(`div`,{className:`pkt-datepicker__inputs`,children:(0,n.jsxs)(`div`,{className:`pkt-input__container`,children:[(0,n.jsx)(`input`,{...de,ref:E,className:S,type:y,id:r,name:p??t,value:i[0]??``,min:_,max:v,placeholder:m,readOnly:u||b&&!u,disabled:l,required:d,"aria-describedby":g?`${t}-helptext`:void 0,"aria-invalid":h,"aria-errormessage":h?`${t}-error`:void 0,onClick:j,onKeyDown:le,onFocus:D,onBlur:void 0,onChange:ie}),M()]})})},hd={calendar:{buttonAltText:`Åpne kalender`}},gd={calendar:{buttonAltText:`Åpne kalender`},generic:{from:`Fra`,to:`Til`}},_d=e=>{if(!e)return[];if(Array.isArray(e))return e.filter(Boolean);if(typeof e==`string`&&e.trimStart().startsWith(`[`))try{let t=JSON.parse(e);if(Array.isArray(t))return t.filter(Boolean)}catch{}return String(e).split(`,`).map(e=>e.trim()).filter(Boolean)};function vd(e,n){let{id:r,label:i,value:a,defaultValue:o,dateformat:s=`dd.MM.yyyy`,multiple:c=!1,maxlength:l,range:u=!1,showRangeLabels:d=!1,weeknumbers:f=!1,withcontrols:p=!1,excludedates:m,excludeweekdays:h,currentmonth:g,today:_,calendarOpen:v,timezone:y,fullwidth:b=!1,hasFieldset:x=!1,inline:S=!1,helptext:C,helptextDropdown:w,helptextDropdownButton:ee,hasError:T=!1,errorMessage:E,optionalTag:te=!1,optionalText:ne,requiredTag:re=!1,requiredText:D,tagText:ie,useWrapper:ae=!0,strings:oe,disabled:se=!1,readOnly:ce=!1,required:O=!1,name:le,min:k,max:A,placeholder:ue,onChange:de,onValueChange:j,className:M,...N}=e,P=(0,t.useCallback)(e=>e===void 0?[]:_d(e),[]),F=a!==void 0,I=typeof o==`number`?void 0:o,[fe,pe]=(0,t.useState)(()=>P(a??I)),L=F?P(a):fe,R=(0,t.useRef)(fe);(0,t.useEffect)(()=>{F&&pe(P(a))},[a,F,P]);let[me,he]=(0,t.useState)(v??!1);(0,t.useEffect)(()=>{v!==void 0&&he(v)},[v]);let z=(0,t.useRef)(null),B=(0,t.useRef)(null),V=(0,t.useRef)(null),ge=(0,t.useRef)(null),H=(0,t.useRef)(null),_e=(0,t.useMemo)(()=>id(),[]),ve=(0,t.useMemo)(()=>rd(),[]),U=(0,t.useMemo)(()=>oe??(u?gd:hd),[oe,u]),ye=typeof k==`string`?k:k===void 0?void 0:String(k),be=typeof A==`string`?A:A===void 0?void 0:String(A),xe=(0,t.useMemo)(()=>{let e=od(b,d,c,u,ce,_e);return Object.entries(e).filter(([,e])=>e).map(([e])=>e).join(` `)},[b,d,c,u,ce,_e]),Se=(0,t.useMemo)(()=>{let e=sd();return Object.entries(e).filter(([,e])=>e).map(([e])=>e).join(` `)},[]),Ce=(0,t.useMemo)(()=>{let e=cd(d);return Object.entries(e).filter(([,e])=>e).map(([e])=>e).join(` `)},[d]),we=(0,t.useMemo)(()=>[`pkt-datepicker__inputs`,u&&`pkt-input__range-inputs`].filter(Boolean).join(` `),[u,d]),Te=(0,t.useMemo)(()=>{if(g)return g;if(be)return be.slice(0,7)},[g,be]),Ee=se||c&&l!=null&&L.length>=l,De=c&&l!=null,Oe=`${r}-input`,ke=L.join(`,`);(0,t.useEffect)(()=>{V.current&&(V.current.value=ke)},[ke]),(0,t.useEffect)(()=>{y&&typeof window<`u`&&y!==window.pktTz&&(window.pktTz=y)},[y]);let Ae=(0,t.useCallback)((e,t=!0)=>{F||pe(e),t&&j?.(e)},[F,j]),je=(0,t.useMemo)(()=>Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,`value`)?.set,[]),Me=(0,t.useCallback)(e=>{let t=V.current;!t||!je||(je.call(t,e.join(`,`)),t.dispatchEvent(new Event(`input`,{bubbles:!0})))},[je]),Ne=(0,t.useCallback)(()=>{se||he(e=>!e)},[se]),Pe=(0,t.useCallback)(()=>{he(!1)},[]);(0,t.useEffect)(()=>{if(!me)return;let e=e=>{let t=e.target;H.current&&!H.current.contains(t)&&!t.closest?.(`.pkt-calendar-popup`)&&Pe()},t=e=>{e.key===`Escape`&&(Pe(),z.current?.focus())};return document.addEventListener(`click`,e,!0),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`click`,e,!0),document.removeEventListener(`keydown`,t)}},[me,Pe]);let Fe=(0,t.useCallback)(()=>{ve&&!me&&he(!0)},[ve,me]),Ie=(0,t.useCallback)(e=>{let t=_d(ld(e,c,u));Ae(t),Me(t),!c&&!u&&(Pe(),z.current?.focus())},[c,u,Ae,Me,Pe]),Le=(0,t.useCallback)(()=>{Pe(),z.current?.focus()},[Pe]),Re=(0,t.useCallback)(e=>{let t=e.target.value,n=t?[t]:[];Ae(n),Me(n)},[Ae,Me]),ze=(0,t.useCallback)(e=>{let t=[e.target.value,L[1]??``].filter(Boolean);Ae(t),Me(t)},[L,Ae,Me]),Be=(0,t.useCallback)(e=>{let t=[L[0]??``,e.target.value].filter(Boolean);Ae(t),Me(t)},[L,Ae,Me]),Ve=(0,t.useCallback)(()=>{L.length===2&&!ad(L)&&(Ae([L[0]]),Me([L[0]]))},[L,Ae,Me]),He=(0,t.useCallback)(e=>{let t=Vl(e),n=ye?Vl(ye):null,r=be?Vl(be):null;if(t&&!isNaN(t.getTime())&&(!n||t>=n)&&(!r||t<=r)){let t=Zl([...L,e],ye,be,m,h),n=[...new Set(t)];Ae(n),Me(n)}},[L,ye,be,m,h,Ae,Me]),Ue=(0,t.useCallback)(e=>{let t=e.target;t.value&&=(He(t.value.split(`,`)[0]),``)},[He]),W=(0,t.useCallback)(e=>{let t=e.target;t.value&&=(He(t.value.split(`,`)[0]),``)},[He]),G=(0,t.useCallback)(e=>{let t=L.filter(t=>t!==e);Ae(t),Me(t)},[L,Ae,Me]),We=(0,t.useCallback)(e=>{let t=e?.closest(`form`);t?t.requestSubmit():e?.blur()},[]),Ge=(0,t.useCallback)(e=>{dd(e.nativeEvent,()=>Ne(),()=>We(z.current),void 0,()=>z.current?.blur())},[Ne,We]),Ke=(0,t.useCallback)(e=>{dd(e.nativeEvent,()=>Ne(),()=>We(z.current),()=>B.current?.focus(),()=>z.current?.blur())},[Ne,We]),qe=(0,t.useCallback)(e=>{dd(e.nativeEvent,()=>Ne(),()=>We(B.current),void 0,()=>B.current?.blur())},[Ne,We]),K=(0,t.useCallback)(e=>{dd(e.nativeEvent,()=>Ne(),()=>We(z.current),void 0,()=>z.current?.blur(),W)},[Ne,We,W]);return(0,t.useEffect)(()=>{let e=H.current?.closest(`form`);if(!e)return;let t=()=>{window.setTimeout(()=>{pe(R.current),he(!1),V.current&&(V.current.value=R.current.join(`,`))},0)};return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)},[]),(0,t.useImperativeHandle)(n,()=>({get value(){return V.current?.value??``},set value(e){pe(e?e.split(`,`).filter(Boolean):[]),V.current&&(V.current.value=e??``)},focus(){z.current?.focus()},blur(){z.current?.blur()}}),[]),{id:r,inputId:Oe,label:i,values:L,calendarOpen:me,dateformat:s,multiple:c,maxlength:l,range:u,showRangeLabels:d,weeknumbers:f,withcontrols:p,excludedates:m,excludeweekdays:h,disabled:se,readOnly:ce,required:O,name:le,placeholder:ue,fullwidth:b,hasFieldset:x,inline:S,helptext:C,helptextDropdown:w,helptextDropdownButton:ee,hasError:T,errorMessage:E,optionalTag:te,optionalText:ne,requiredTag:re,requiredText:D,tagText:ie,useWrapper:ae,className:M,minStr:ye,maxStr:be,effectiveCurrentMonth:Te,today:_,inputType:_e,isIOSDevice:ve,strings:U,inputClasses:xe,buttonClasses:Se,rangeLabelClasses:Ce,datepickerInputsClasses:we,isInputDisabled:Ee,hasCounter:De,inputRef:z,inputRefTo:B,changeInputRef:V,btnRef:ge,wrapperRef:H,onChange:de,toggleCalendar:Ne,hideCalendar:Pe,handleDateSelected:Ie,handleCalendarClose:Le,handleFocus:Fe,handleSingleInputChange:Re,handleRangeFromChange:ze,handleRangeToChange:Be,handleRangeBlur:Ve,handleMultipleBlur:Ue,handleTagRemoved:G,handleSingleKeydown:Ge,handleRangeFromKeydown:Ke,handleRangeToKeydown:qe,handleMultipleKeydown:K,restProps:N}}var yd=(0,t.forwardRef)((e,t)=>{let r=vd(e,t);return(0,n.jsxs)(`div`,{className:[`pkt-datepicker`,r.className].filter(Boolean).join(` `),id:r.id||void 0,children:[(0,n.jsx)(Au,{ref:r.wrapperRef,forId:r.inputId,label:r.label,hasFieldset:r.hasFieldset,inline:r.inline,helptext:r.helptext,helptextDropdown:r.helptextDropdown,helptextDropdownButton:r.helptextDropdownButton,hasError:r.hasError,errorMessage:r.errorMessage,disabled:r.disabled,optionalTag:r.optionalTag,optionalText:r.optionalText,requiredTag:r.requiredTag,requiredText:r.requiredText,tagText:r.tagText,useWrapper:r.useWrapper,counter:r.hasCounter,counterCurrent:r.values.length,counterMaxLength:r.maxlength,children:(0,n.jsx)(md,{state:r})}),(0,n.jsx)(fd,{open:r.calendarOpen,multiple:r.multiple,range:r.range,weeknumbers:r.weeknumbers,withcontrols:r.withcontrols,selected:r.values,earliest:r.minStr,latest:r.maxStr,excludedates:r.excludedates,excludeweekdays:r.excludeweekdays,maxMultiple:r.maxlength,currentmonth:r.effectiveCurrentMonth,today:r.today,inputRef:r.inputRef,hasCounter:r.hasCounter,onDateSelected:r.handleDateSelected,onClose:r.handleCalendarClose}),(0,n.jsx)(`input`,{ref:r.changeInputRef,type:`text`,name:r.name,onChange:r.onChange,tabIndex:-1,"aria-hidden":`true`,className:`pkt-visually-hidden`})]})});yd.displayName=`PktDatepicker`;var bd=`https://cdn.web.oslo.kommune.no/header-footer/header-footer.json`,xd={hours:`Timer`,minutes:`Minutter`,openPicker:`Åpne tidspunkt-velger`,prevTime:`Forrige tidspunkt`,nextTime:`Neste tidspunkt`,selectTime:`Velg tidspunkt`},Sd={dropZoneDragMultiple:`Dra filer hit for å laste dem opp eller`,dropZoneDragSingle:`Dra en fil hit for å laste den opp eller`,dropZoneDragMultipleThumbnail:`Dra bilder hit for å laste dem opp eller`,dropZoneDragSingleThumbnail:`Dra et bilde hit for å laste det opp eller`,dropZoneDragActiveMultiple:`Slipp filene her`,dropZoneDragActiveSingle:`Slipp filen her`,dropZoneDragActiveMultipleThumbnail:`Slipp bildene her`,dropZoneDragActiveSingleThumbnail:`Slipp bildet her`,dropZoneOpenFileDialogMultiple:`velg filer`,dropZoneOpenFileDialogSingle:`velg en fil`,dropZoneOpenFileDialogMultipleThumbnail:`velg fra kamerarull`,dropZoneOpenFileDialogSingleThumbnail:`velg fra kamerarull`,supportedFormatsPrefix:`Format:`,invalidFormatDefault:e=>`Ugyldig filtype. Tillatte formater: ${e}`,sizeTooLargeDefault:e=>`Filen er for stor. Maks størrelse er ${e}.`,requiredMissing:`Du må laste opp minst én fil.`,genericValidationRejection:`Filen ble avvist av validering.`,unknownFilename:`Ukjent fil`,fileLabel:e=>e===1?`fil`:`filer`,srFileAdded:e=>`Filen «${e}» er lagt til`,srFilesAdded:e=>`${e} filer er lagt til`,srFilesUploadedOfTotal:(e,t,n)=>`${e} av ${t} ${n} lastet opp`,srFilesFailedOfTotal:(e,t,n)=>`Feil ved opplasting: ${e} av ${t} ${n} feilet`};function Cd(e){if(e==null||e===``)return;if(typeof e==`number`)return Number.isFinite(e)&&e>0?e:void 0;let t=String(e).trim(),n=Number(t);if(!Number.isNaN(n)&&n>0)return n;let r=t.match(/^(\d+(?:\.\d+)?)\s*(B|KB|MB|GB)$/i);if(!r){console.warn(`PktFileUpload: Invalid maxFileSize format "${t}". Use format like "5MB", "500KB", "1GB", or bytes.`);return}let i=parseFloat(r[1]);switch(r[2].toUpperCase()){case`B`:return i;case`KB`:return i*1024;case`MB`:return i*1024*1024;case`GB`:return i*1024*1024*1024;default:return}}function wd(e){return e<1024?`${Math.round(e)} B`:e<1024*1024?`${Math.round(e/1024)} KB`:e<1024*1024*1024?`${Math.round(e/(1024*1024))} MB`:`${Math.round(e/(1024*1024*1024))} GB`}function Td(e){return Array.isArray(e)?e.map(e=>String(e).trim().toLowerCase()).filter(Boolean):[]}function Ed(e,t,n){let r=e.toLowerCase().replace(/^\./,``);if(r.includes(`/`)){if(r.endsWith(`/*`)){let e=r.replace(`/*`,``);return n.startsWith(`${e}/`)}return n===r}return t===r}function Dd(e,t){let n=Td(t);if(n.length===0)return!0;let r=e.name.split(`.`).pop()?.toLowerCase()??``,i=e.type.toLowerCase();return n.some(e=>Ed(e,r,i))}function Od(e,t){let n=(e??``).trim();if(n)return n;let r=Td(t);return r.length===0?``:r.map(e=>e.includes(`/`)||e.startsWith(`.`)?e:`.${e}`).join(`, `)}function kd(e,t,n){return((e??``).trim()||t).replace(/\{(\w+)\}/g,(e,t)=>n[t]??`{${t}}`)}function Ad(e,t){let n=Td(t.allowedFormats);if(n.length>0&&!Dd(e,n)){let e=n.join(`, `),r=`Ugyldig filtype. Tillatte formater: ${e}`;return kd(t.formatErrorMessage,r,{formats:e})}let r=Cd(t.maxFileSize);if(r!==void 0&&e.size>r){let e=wd(r),n=`Filen er for stor. Maks størrelse er ${e}.`;return kd(t.sizeErrorMessage,n,{maxSize:e})}if(t.onFileValidation){let n=t.onFileValidation(e);if(n)return n}return null}function jd(e){let t=e.file;if(t?.type?.startsWith(`image/`))return!0;let n=e.attributes?.targetFilename||t?.name||``;return/\.(jpe?g|png|gif|webp|heic|heif|bmp|svg)$/i.test(n)}function Md(e){return typeof e==`number`?`in-progress`:e===`error`?`error`:`idle`}function Nd(e,t,n){let r={"in-progress":0,error:1,idle:2};return e.map(e=>{let r=t?.find(t=>t.fileId===e.fileId);return{...e,progress:r?.progress??(n===`form`?`done`:`queued`),errorMessage:r?.errorMessage,showProgress:r?.showProgress,lastProgress:r?.lastProgress}}).sort((e,t)=>r[Md(e.progress)]-r[Md(t.progress)])}function Pd(e){if(!e)return[];let t=[`a[href]:not([tabindex="-1"])`,`button:not([disabled]):not([tabindex="-1"])`,`input:not([disabled]):not([type="hidden"]):not([tabindex="-1"])`,`select:not([disabled]):not([tabindex="-1"])`,`textarea:not([disabled]):not([tabindex="-1"])`,`[tabindex]:not([tabindex="-1"])`].join(`, `);return Array.from(e.querySelectorAll(t)).filter(e=>!e.hasAttribute(`inert`))}function Fd(e,t){if(e.key!==`Tab`)return!1;let n=Pd(t);if(n.length===0)return e.preventDefault(),!0;let r=n[0],i=n[n.length-1],a=(t?.ownerDocument??document).activeElement,o=!!a&&n.includes(a);return e.shiftKey?!o||a===r?(e.preventDefault(),i.focus(),!0):!1:!o||a===i?(e.preventDefault(),r.focus(),!0):!1}function Id(e,t){return!t||t<=0||e.length<=t+3?null:{head:e.slice(0,e.length-t),tail:e.slice(-t)}}function Ld(e,t,n){return n<=0?0:t===`prev`?e<=0?n-1:e-1:e>=n-1?0:e+1}function Rd(e,t){let n=e.length;if(n===0||!t||t.length===0)return{totalCount:n,uploadedCount:0,failedCount:0};let r=0,i=0;for(let n of e){let e=t.find(e=>e.fileId===n.fileId);e?.progress===`done`?r++:e?.progress===`error`&&i++}return{totalCount:n,uploadedCount:r,failedCount:i}}var zd=`.jpeg, .jpg, .png, .gif, .webp, .heic`;function Bd(e,t=Sd.unknownFilename){return e.attributes?.targetFilename||e.file?.name||t}var Vd=()=>(`00000000000000000`+(Math.random()*0x10000000000000000).toString(16)).slice(-16),Hd=()=>{let e=Vd(),t=Vd();return e.slice(0,8)+`-`+e.slice(8,12)+`-4`+e.slice(13)+`-a`+t.slice(1,4)+`-`+t.slice(4)},Ud=class{fileId;file;attributes;constructor(e,t){this.fileId=t||Hd(),this.file=e,this.attributes={targetFilename:e.name}}},Wd=(0,t.createContext)({}),Gd=(0,t.forwardRef)(({id:e,multiple:r,value:i,onFilesAdded:a=()=>{},name:o,uploadStrategy:s,accept:c,isThumbnailView:l=!1,disabled:u=!1,hasVisibleLabel:d=!1,...f},p)=>{let m=(0,t.useRef)(null),h=typeof c==`string`&&c.trim().length>0?c:void 0,g=(0,t.useMemo)(()=>h?h.split(/\s*,\s*/).map(e=>e.trim()).filter(Boolean).join(`, `).toUpperCase():``,[h]);(0,t.useImperativeHandle)(p,()=>m.current);let[_,v]=(0,t.useState)(!1),y=(0,t.useMemo)(()=>l?r?{dragInactive:Sd.dropZoneDragMultipleThumbnail,dragActive:Sd.dropZoneDragActiveMultipleThumbnail,openFileDialog:Sd.dropZoneOpenFileDialogMultipleThumbnail}:{dragInactive:Sd.dropZoneDragSingleThumbnail,dragActive:Sd.dropZoneDragActiveSingleThumbnail,openFileDialog:Sd.dropZoneOpenFileDialogSingleThumbnail}:r?{dragInactive:Sd.dropZoneDragMultiple,dragActive:Sd.dropZoneDragActiveMultiple,openFileDialog:Sd.dropZoneOpenFileDialogMultiple}:{dragInactive:Sd.dropZoneDragSingle,dragActive:Sd.dropZoneDragActiveSingle,openFileDialog:Sd.dropZoneOpenFileDialogSingle},[r,l]),b=(0,t.useCallback)(e=>{if(m.current)try{m.current.files=Kd(e)}catch{}},[m.current,i]);(0,t.useEffect)(()=>{b(i)},[m,i]);let x=(0,t.useCallback)(e=>{a(e.map(e=>new Ud(e))),m.current&&(m.current.value=``)},[a]),S=e=>{let t=e.target.files;if(t.length===0){b(i);return}x(Array.from(t))},C=e=>{x(e)};return(0,n.jsxs)(`div`,{onDrop:e=>{if(e.preventDefault(),v(!1),u)return;let t=e.dataTransfer.files;C(Array.from(t))},onDragOver:e=>{e.preventDefault(),!u&&v(!0)},onDragLeave:()=>{v(!1)},onClick:(0,t.useCallback)(e=>{u||e.target.closest(`.pkt-fileupload__drop-zone__placeholder__title__open-file-dialog`)||m.current?.click()},[u]),className:(0,$.default)(`pkt-fileupload__drop-zone`,{"pkt-fileupload__drop-zone--drag-active":_,"pkt-fileupload__drop-zone--disabled":u}),children:[(0,n.jsx)(`input`,{...f,id:e,type:`file`,ref:m,multiple:r,onChange:S,accept:h,disabled:u,name:s===`form`&&o||void 0,"aria-label":d?void 0:r?`Velg filer`:`Velg fil`}),s===`custom`&&(0,n.jsx)(n.Fragment,{children:i?.map(e=>(0,n.jsx)(`input`,{type:`hidden`,name:o,value:e.fileId},e.fileId))}),(0,n.jsxs)(`div`,{className:`pkt-fileupload__drop-zone__placeholder`,children:[(0,n.jsx)(Q,{name:`attachment`,className:`pkt-fileupload__drop-zone__placeholder__icon`,"aria-hidden":`true`}),(0,n.jsx)(`p`,{className:`pkt-fileupload__drop-zone__placeholder__title`,children:_?`${y.dragActive} ...`:(0,n.jsxs)(n.Fragment,{children:[y.dragInactive,` `,(0,n.jsx)(`button`,{className:`pkt-fileupload__drop-zone__placeholder__title__open-file-dialog`,onClick:e=>{e.preventDefault(),e.stopPropagation(),m.current?.click()},type:`button`,children:y.openFileDialog})]})}),g?(0,n.jsxs)(`p`,{className:`pkt-fileupload__drop-zone__placeholder__formats`,children:[Sd.supportedFormatsPrefix,` `,g]}):null]})]})}),Kd=e=>{let t=new DataTransfer;for(let n of e)t.items.add(n.file);return t.files},qd=(0,t.forwardRef)(({id:e,ariaDescribedby:r,ariaLabelledby:i,counter:a,counterMaxLength:o,className:s,disabled:c,errorMessage:l,hasError:u,helptext:d,helptextDropdown:f,helptextDropdownButton:p,inline:m,fullwidth:h=!1,label:g,name:_,optionalTag:v=!1,optionalText:y,requiredTag:b=!1,requiredText:x,tagText:S=null,placeholder:C,rows:w,useWrapper:ee=!0,onChange:T,value:E,autoComplete:te=`off`,minLength:ne,maxLength:re,readOnly:D,skipForwardTestid:ie=!1,...ae},oe)=>{let se=[s,`pkt-textinput`,`pkt-textarea`].join(` `),ce=`${e}-input`,O=`${ce}-label`,le=i||O,[k,A]=(0,t.useState)(0),ue=e=>{a&&A(e.currentTarget?.value?.length||0),T&&T(e)};return(0,t.useEffect)(()=>{E!==void 0&&A(E?.length||0)},[E]),(0,n.jsx)(Au,{ariaDescribedby:r,className:se,disabled:c,errorMessage:l,forId:ce,hasError:u,helptext:d,helptextDropdown:f,helptextDropdownButton:p,inline:m,label:g,optionalTag:v,optionalText:y,requiredTag:b,requiredText:x,tagText:S,useWrapper:ee,counter:a,counterCurrent:k,counterMaxLength:o,children:(0,n.jsx)(`textarea`,{ref:e=>{A(e?.value?.length||0),typeof oe==`function`&&oe(e)},className:`pkt-input ${h?`pkt-input--fullwidth`:``} ${o&&k>o?`pkt-input--counter-error`:``}`,name:`${_||e}`,id:ce,placeholder:C,disabled:c,rows:w,"aria-labelledby":le,"aria-invalid":u,"aria-errormessage":`${e}-error`,...ae,onChange:ue,value:E,autoComplete:te,minLength:ne,maxLength:re,readOnly:D,"data-skip-forward-testid":ie?`true`:void 0})})});qd.displayName=`PktTextarea`;var Jd=`comments`,Yd=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?e:`${String(t.getDate()).padStart(2,`0`)}.${String(t.getMonth()+1).padStart(2,`0`)}.${t.getFullYear()} kl. ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`},Xd=({fileItem:e,disabled:r,closeOperationUi:i,onAddComment:a,existingComment:o})=>{let s=(0,t.useRef)(null),c=!!o;return(0,t.useLayoutEffect)(()=>{let e=setTimeout(()=>s.current?.focus({preventScroll:!0}),0);return()=>clearTimeout(e)},[e.fileId]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(qd,{autoFocus:!0,label:c?`Rediger kommentar`:`Legg til kommentar`,name:`comment-${e.fileId}`,className:`pkt-fileupload__queue-display__item__comment-input`,placeholder:`Skriv inn kommentar`,rows:2,id:`comment-${e.fileId}`,ref:s,disabled:r,defaultValue:o?.text}),(0,n.jsx)(uc,{skin:`secondary`,size:`small`,disabled:r,onClick:()=>{let e=s.current?.value?.trim();e&&a({text:e,timestamp:new Date().toISOString()}),i()},children:c?`Lagre kommentar`:`Legg til kommentar`}),(0,n.jsx)(uc,{skin:`tertiary`,size:`small`,disabled:r,onClick:i,children:`Avbryt`})]})},Zd=({comment:e,disabled:t,onDeleteComment:r,onEditComment:i})=>(0,n.jsx)(`div`,{className:`pkt-fileupload__queue-display__item__comments`,children:(0,n.jsxs)(`div`,{className:`pkt-fileupload__queue-display__item__comment`,children:[(0,n.jsxs)(`div`,{className:`pkt-fileupload__queue-display__item__comment__content`,children:[(0,n.jsx)(`span`,{className:`pkt-fileupload__queue-display__item__comment__text`,"aria-label":`Kommentar tekst`,children:e.text}),(0,n.jsx)(`time`,{className:`pkt-fileupload__queue-display__item__comment__time`,children:Yd(e.timestamp)})]}),(0,n.jsxs)(`div`,{className:`pkt-fileupload__queue-display__item__comment__actions`,children:[(0,n.jsx)(`button`,{type:`button`,className:`pkt-fileupload__queue-display__item__comment__action`,onClick:i,disabled:t,"aria-label":`Rediger kommentar`,children:(0,n.jsx)(Q,{name:`edit`})}),(0,n.jsx)(`button`,{type:`button`,className:`pkt-fileupload__queue-display__item__comment__action`,onClick:r,disabled:t,"aria-label":`Slett kommentar`,children:(0,n.jsx)(Q,{name:`trash-can`})})]})]})}),Qd=({comments:e})=>(0,n.jsx)(`input`,{type:`hidden`,name:`${(0,t.useContext)(Wd).name}-comments`,value:e?JSON.stringify(e):``}),$d=e=>e.getAttribute(Jd)??[],ef={id:`comment`,title:e=>(e.attributes?.[Jd]??[]).length>0?``:`Legg til kommentar`,ariaLabel:`Legg til kommentar`,renderExtendedUI:e=>{let t=$d(e)[0];return(0,n.jsx)(Xd,{fileItem:e.file,disabled:e.disabled,closeOperationUi:e.close,onAddComment:t=>{e.setAttribute(Jd,[t])},existingComment:t})},renderContent:e=>{if(e.isActive)return null;let t=$d(e)[0];return t?(0,n.jsx)(Zd,{comment:t,disabled:e.disabled,onEditComment:e.activate,onDeleteComment:()=>e.setAttribute(Jd,void 0)}):null},renderHidden:e=>(0,n.jsx)(Qd,{comments:e.getAttribute(Jd)},`comments${e.file.fileId}`)},tf=e=>({id:`remove`,title:`Slett`,ariaLabel:`Slett fil`,onClick:({file:t})=>e(t.fileId)}),nf=({initialValue:e,disabled:r,onSave:i,onCancel:a})=>{let o=(0,t.useRef)(null),s=(0,t.useId)(),c=()=>i(o.current?.value??``);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`label`,{htmlFor:s,className:`pkt-sr-only`,children:`Endre filnavn`}),(0,n.jsx)(`input`,{id:s,ref:o,type:`text`,autoFocus:!0,disabled:r,defaultValue:e,className:`pkt-fileupload__queue-display__item__rename-input`,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),c()),e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),a())}}),(0,n.jsx)(uc,{skin:`secondary`,size:`small`,disabled:r,onClick:c,children:`Lagre`}),(0,n.jsx)(uc,{skin:`tertiary`,size:`small`,disabled:r,onClick:a,children:`Avbryt`})]})},rf=({targetFilename:e})=>(0,n.jsx)(`input`,{type:`hidden`,name:`${(0,t.useContext)(Wd).name}-targetFilename`,value:e}),af=e=>e.getAttribute(`targetFilename`)||Bd(e.file,``),of={id:`rename`,title:`Rediger`,ariaLabel:`Rediger filnavn`,renderInlineUI:e=>(0,n.jsx)(nf,{initialValue:af(e),disabled:e.disabled,onSave:t=>{let n=t.trim();n&&e.setAttribute(`targetFilename`,n),e.close()},onCancel:e.close}),renderHidden:e=>(0,n.jsx)(rf,{targetFilename:af(e)},`rename${e.file.fileId}`)},sf=(e,n)=>{let r=(0,t.useCallback)((t,n)=>e.find(e=>e.fileId===t)?.attributes?.[n],[e]),i=(0,t.useCallback)((t,r,i)=>{let a=e.find(e=>e.fileId===t);if(!a)return;let o={...a.attributes,[r]:i};i===void 0&&delete o[r],n(t,{attributes:o})},[n,e]);return{fileAttributes:(0,t.useMemo)(()=>e=>({get:t=>r(t,e),set:(t,n)=>i(t,e,n)}),[r,i]),buildAttributeAccessors:(0,t.useCallback)(e=>({getAttribute:t=>r(e,t),setAttribute:(t,n)=>i(e,t,n)}),[r,i])}},cf=e=>{let[n,r]=(0,t.useState)(!1),[i,a]=(0,t.useState)(0),o=(0,t.useRef)(null);return{isOpen:n,currentIndex:i,modalRef:o,open:(0,t.useCallback)(t=>{let n=e.findIndex(e=>e.fileId===t);n>=0&&(a(n),r(!0),o.current?.showModal())},[e]),close:(0,t.useCallback)(()=>{r(!1),o.current?.close()},[]),navigate:(0,t.useCallback)(t=>{e.length!==0&&a(n=>Ld(n,t,e.length))},[e.length])}},lf=e=>{let[n,r]=(0,t.useState)({});return(0,t.useEffect)(()=>{r(t=>{let n=new Set(e.map(e=>e.id)),r=!1,i={};for(let[e,a]of Object.entries(t))n.has(a)?i[e]=a:r=!0;return r?i:t})},[e]),{getActivated:(0,t.useCallback)(t=>{let r=n[t];if(r)return e.find(e=>e.id===r)},[n,e]),activate:(0,t.useCallback)((e,t)=>{r(n=>({...n,[e]:t.id}))},[]),close:(0,t.useCallback)(e=>{r(t=>{if(!(e in t))return t;let n={...t};return delete n[e],n})},[])}},uf=(e,{uploadStrategy:n,required:r,currentFileCount:i,onMissingFiles:a})=>{(0,t.useEffect)(()=>{if(n!==`custom`||!r)return;let t=e.current?.form;if(!t)return;let o=e=>{i>0||(e.preventDefault(),a())};return t.addEventListener(`submit`,o),()=>{t.removeEventListener(`submit`,o)}},[e,n,r,i,a])},df=`pkt-modal--open`,ff=`data-pkt-modal-open-count`,pf=()=>{let e=document.body.getAttribute(ff),t=e?parseInt(e,10):0;return Number.isFinite(t)&&t>0?t:0},mf=e=>{e<=0?(document.body.removeAttribute(ff),document.body.classList.remove(df)):(document.body.setAttribute(ff,String(e)),document.body.classList.add(df))},hf=e=>{e.locked||(e.locked=!0,mf(pf()+1))},gf=e=>{e.locked&&(e.locked=!1,mf(pf()-1))},_f=()=>({locked:!1}),vf=(0,t.forwardRef)(({children:e,className:r,open:i=!1,headingText:a=``,hideCloseButton:o=!1,closeOnBackdropClick:s=!1,size:c=`medium`,removePadding:l=!1,closeButtonSkin:u=`blue`,variant:d=`dialog`,drawerPosition:f=`right`,transparentBackdrop:p=!1,onClose:m,...h},g)=>{let _=(0,t.useRef)(null),v=(0,t.useRef)(_f()),y=(0,t.useCallback)(e=>{_.current=e,typeof g==`function`?g(e):g&&(g.current=e)},[g]),b=(0,t.useCallback)(()=>{_.current?.open&&(_.current.close(),gf(v.current),m?.())},[m]);(0,t.useEffect)(()=>{i?(_.current?.open||_.current?.showModal(),hf(v.current)):(_.current?.open&&_.current.close(),gf(v.current))},[i]),(0,t.useEffect)(()=>{let e=v.current;return()=>{gf(e)}},[]);let x=(0,t.useCallback)(e=>{s&&e.target===_.current&&b()},[s,b]),S=(0,t.useCallback)(()=>{gf(v.current),m?.()},[m]),C=u===`blue`,w=(0,$.default)({"pkt-modal":!0,"pkt-modal--removePadding":l,"pkt-modal--noHeadingText":!a,"pkt-modal--noShadow":u===`yellow-filled`,"pkt-modal--transparentBackdrop":p,[`pkt-modal--${c}`]:c,[`pkt-modal__${d}`]:d,[`pkt-modal__drawer--${f}`]:d===`drawer`},r);return(0,n.jsx)(`dialog`,{...h,className:w,ref:y,"aria-labelledby":a?`pkt-modal__headingText`:void 0,"aria-describedby":`pkt-modal__content`,onClick:x,onClose:S,children:(0,n.jsxs)(`div`,{className:`pkt-modal__wrapper`,children:[(a||!o)&&(0,n.jsxs)(`div`,{className:`pkt-modal__header`,children:[(0,n.jsx)(`div`,{className:`pkt-modal__header-background`}),a?(0,n.jsx)(`h1`,{id:`pkt-modal__headingText`,className:`pkt-modal__headingText pkt-txt-24`,children:a}):(0,n.jsx)(`div`,{className:`pkt-modal__headingText`}),o?(0,n.jsx)(`div`,{className:`pkt-modal__noCloseButton`}):(0,n.jsx)(`div`,{className:(0,$.default)(`pkt-modal__closeButton`,{[`pkt-modal__closeButton--${u}`]:!0}),children:(0,n.jsx)(uc,{onClick:b,"aria-label":`close`,iconName:`close`,variant:`icon-only`,size:`medium`,skin:C?`tertiary`:`primary`,children:`Lukk`})})]}),(0,n.jsx)(`div`,{className:`pkt-modal__container`,children:(0,n.jsx)(`div`,{id:`pkt-modal__content`,className:`pkt-modal__content pkt-txt-18-light`,children:e})})]})})});vf.displayName=`PktModal`;var yf=(0,t.createContext)({tail:5}),bf=({children:e,tail:r})=>{let i=(0,t.useContext)(yf),a=Id(e,r===void 0?i.tail:r);return a?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`span`,{className:`pkt-fileupload__queue-display__item__title__head`,"data-pkt-truncate-part":`first`,children:a.head}),(0,n.jsx)(`span`,{className:`pkt-fileupload__queue-display__item__title__tail`,"data-pkt-truncate-part":`tail`,children:a.tail})]}):(0,n.jsx)(`span`,{"data-pkt-truncate-part":`first`,children:e})},xf=e=>(0,n.jsx)(`button`,{type:`button`,onClick:e.onClick,disabled:e.disabled,className:`pkt-fileupload__queue-display__item__cancel-button`,"aria-label":e.ariaLabel||`Avbryt opplasting`,children:e.label||`Avbryt`}),Sf=()=>(0,n.jsx)(`span`,{className:`pkt-fileupload__queue-display__item__loading-text`,"aria-label":`Laster opp fil`,children:`Laster opp`}),Cf=({cancelTransfer:e,transferItem:t,disabled:r=!1})=>{let i=t.showProgress??t.progress!==0;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Q,{name:`document-text`,className:`pkt-fileupload__queue-display__item__icon pkt-icon--medium`,"aria-hidden":`true`}),(0,n.jsxs)(`p`,{className:`pkt-fileupload__queue-display__item__title`,"aria-label":`Filnavn`,children:[(0,n.jsx)(bf,{children:Bd(t)}),(0,n.jsxs)(`span`,{className:`pkt-fileupload__queue-display__item__filesize`,children:[` `,`(`,wd(t.file.size),`)`]})]}),(0,n.jsx)(xf,{onClick:e,disabled:r}),i?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(kp,{valueCurrent:t.progress*100,statusType:`none`,valueMax:100,statusPlacement:`following`,className:`pkt-fileupload__queue-display__item__progress`}),(0,n.jsx)(`span`,{className:`pkt-fileupload__queue-display__item__percentage`,"aria-hidden":`true`,children:`${Math.round(t.progress*100)}%`})]}):(0,n.jsx)(Sf,{})]})},wf=({transferItem:e})=>(0,n.jsxs)(`p`,{className:`pkt-fileupload__queue-display__item__title`,children:[(0,n.jsx)(bf,{children:Bd(e)}),e.file&&(0,n.jsxs)(`span`,{className:`pkt-fileupload__queue-display__item__filesize`,children:[` `,`(`,wd(e.file.size),`)`]})]}),Tf=({transferItem:e,onRemove:t,disabled:r})=>{let i=(e.lastProgress??1)*100;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Q,{className:`pkt-fileupload__queue-display__item__icon pkt-icon--medium`,name:`alert-error`,"aria-hidden":`true`}),(0,n.jsx)(wf,{transferItem:e}),(0,n.jsx)(xf,{onClick:t,label:`Fjern`,ariaLabel:`Fjern fil som feilet under opplasting`,disabled:r}),(0,n.jsx)(kp,{valueCurrent:i,statusType:`none`,valueMax:100,statusPlacement:`following`,className:`pkt-fileupload__queue-display__item__progress pkt-fileupload__queue-display__item__progress--error`}),e.errorMessage&&(0,n.jsx)(`span`,{className:`pkt-fileupload__queue-display__item__error-message`,children:e.errorMessage})]})},Ef=({transferItem:e,onRemove:t,disabled:r})=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Q,{className:`pkt-fileupload__queue-display__item__icon pkt-icon--medium`,name:`alert-error`,"aria-hidden":`true`}),(0,n.jsx)(wf,{transferItem:e}),(0,n.jsx)(xf,{onClick:t,label:`Fjern`,ariaLabel:`Fjern fil som feilet under opplasting`,disabled:r}),e.errorMessage&&(0,n.jsx)(`span`,{className:`pkt-fileupload__queue-display__item__error-message`,children:e.errorMessage})]}),Df=({transferItem:e,onRemove:t,disabled:r})=>e.showProgress?(0,n.jsx)(Tf,{transferItem:e,onRemove:t,disabled:r}):(0,n.jsx)(Ef,{transferItem:e,onRemove:t,disabled:r}),Of=({operation:e,context:t})=>{let r=typeof e.title==`function`?e.title(t.file):e.title;return r?(0,n.jsx)(`button`,{type:`button`,className:`pkt-fileupload__queue-display__item__operation`,onClick:()=>{(e.renderInlineUI||e.renderExtendedUI)&&t.activate(),e.onClick?.(t)},disabled:t.disabled,"aria-label":typeof e.ariaLabel==`function`?e.ariaLabel(t.file):e.ariaLabel,children:r}):null},kf=({transferItem:e})=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Q,{name:`document-text`,className:`pkt-fileupload__queue-display__item__icon pkt-icon--medium`,"aria-hidden":`true`}),(0,n.jsx)(wf,{transferItem:e})]}),Af=({transferItem:e,onPreviewClick:r})=>{let[i,a]=(0,t.useState)(null),[o,s]=(0,t.useState)(!1),c=e.file;(0,t.useEffect)(()=>{if(s(!1),c.type.startsWith(`image/`)){let e=URL.createObjectURL(c);return a(e),()=>{URL.revokeObjectURL(e)}}a(null)},[c]);let l=i&&!o&&(0,n.jsx)(`img`,{src:i,alt:e.attributes.targetFilename,onError:()=>s(!0)})||(0,n.jsx)(Q,{name:`document-text`,className:`pkt-fileupload__queue-display__item__icon pkt-icon--medium`}),u=!!r;return(0,n.jsxs)(`div`,{className:`pkt-fileupload__queue-display__item__thumbnail${i&&!o?``:` pkt-fileupload__queue-display__item__thumbnail--fallback`}`,children:[(0,n.jsxs)(uc,{className:`pkt-fileupload__queue-display__item__thumbnail__image-wrapper`,"aria-label":`Forhåndsvis bilde ${e.attributes.targetFilename}`,type:`button`,skin:`secondary`,onClick:r,children:[u&&(0,n.jsx)(Q,{name:`expand`,className:`pkt-fileupload__queue-display__item__thumbnail__expand-icon`,"aria-hidden":`true`}),l]}),(0,n.jsx)(`span`,{className:`pkt-fileupload__queue-display__item__thumbnail__title`,children:(0,n.jsx)(bf,{children:e.attributes.targetFilename})})]})},jf=({isOpen:e,images:r,currentIndex:i,onClose:a,onNavigate:o,modalRef:s})=>{let[c,l]=(0,t.useState)(null),[u,d]=(0,t.useState)(!1),f=r[i],p=r.length>1;return(0,t.useEffect)(()=>{if(d(!1),f&&f.file.type.startsWith(`image/`)){let e=URL.createObjectURL(f.file);return l(e),()=>URL.revokeObjectURL(e)}l(null)},[f]),(0,t.useEffect)(()=>{if(!e)return;let t=e=>{if(e.key===`Tab`){Fd(e,s.current);return}switch(e.key){case`ArrowLeft`:e.preventDefault(),o(`prev`);break;case`ArrowRight`:e.preventDefault(),o(`next`);break;case`Escape`:e.preventDefault(),a();break}};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,o,a,s]),f?(0,n.jsx)(vf,{ref:s,headingText:f.attributes.targetFilename,closeOnBackdropClick:!0,className:`pkt-fileupload__image-preview-modal`,onClose:a,children:(0,n.jsxs)(`div`,{className:`pkt-fileupload__image-preview`,children:[p&&(0,n.jsx)(uc,{variant:`icon-only`,iconName:`chevron-thin-left`,skin:`secondary`,size:`medium`,className:`pkt-fileupload__image-preview__nav pkt-fileupload__image-preview__nav--prev`,onClick:()=>o(`prev`),"aria-label":`Forrige bilde ${i} / ${r.length}`}),(0,n.jsx)(`div`,{className:`pkt-fileupload__image-preview__content`,children:c&&!u?(0,n.jsx)(`img`,{src:c,alt:`${f.attributes.targetFilename} - ${i+1} av ${r.length}`,className:`pkt-fileupload__image-preview__image`,onError:()=>d(!0)}):(0,n.jsx)(Q,{name:`picture`,className:`pkt-fileupload__queue-display__item__icon pkt-icon--medium`})}),p&&(0,n.jsxs)(`span`,{className:`pkt-fileupload__image-preview__counter`,children:[i+1,` / `,r.length]}),p&&(0,n.jsx)(uc,{variant:`icon-only`,iconName:`chevron-thin-right`,skin:`secondary`,size:`medium`,className:`pkt-fileupload__image-preview__nav pkt-fileupload__image-preview__nav--next`,onClick:()=>o(`next`),"aria-label":`Neste bilde ${i+2} / ${r.length}`})]})}):null},Mf=({operation:e,transferItem:t,inputName:n,disabled:r,activatedOperation:i,onActivate:a,onClose:o,buildAttributeAccessors:s})=>{let c=s(t.fileId);return{file:t,inputName:n,disabled:r,isActive:i?.id===e.id,activate:()=>a(t.fileId,e),close:()=>o(t.fileId),getAttribute:c.getAttribute,setAttribute:c.setAttribute}},Nf=(e,t)=>e.map(e=>({operation:e,context:Mf({operation:e,...t})})),Pf=e=>(0,n.jsx)(`div`,{className:`pkt-fileupload__queue-display__item__actions`,children:Nf(e.operations,e).filter(({operation:t})=>t.id!==e.activatedOperation?.id).map(({operation:e,context:t})=>(0,n.jsx)(Of,{operation:e,context:t},e.id))}),Ff=e=>(0,n.jsx)(n.Fragment,{children:Nf(e.operations,e).filter(({operation:e})=>e.renderContent).map(({operation:e,context:t})=>(0,n.jsx)(`div`,{className:`pkt-fileupload__queue-display__item__operation-content`,children:e.renderContent(t)},e.id))}),If=e=>{let{transferItem:t,activatedOperation:r,operations:i,ItemRenderer:a,onPreviewClick:o}=e,s=r?Mf({operation:r,...e}):void 0,c=r?.renderInlineUI||r?.renderExtendedUI?[]:i;return(0,n.jsxs)(n.Fragment,{children:[r?.renderInlineUI&&s?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Q,{name:`document-text`,className:`pkt-fileupload__queue-display__item__icon`}),(0,n.jsx)(`div`,{className:`pkt-fileupload__queue-display__item__inline-ui`,children:r.renderInlineUI(s)})]}):(0,n.jsx)(a,{transferItem:t,queueItemOperations:i,onPreviewClick:o}),c.length>0&&(0,n.jsx)(Pf,{...e,operations:c}),(0,n.jsx)(Ff,{...e}),r?.renderExtendedUI&&s&&(0,n.jsx)(`div`,{className:`pkt-fileupload__queue-display__item__expanded-operation-ui`,children:r.renderExtendedUI(s)})]})},Lf=e=>{let{transferItem:t,enableImagePreview:r,onCancelTransfer:i,onOpenPreview:a,disabled:o}=e,s=Md(t.progress),c=r&&t.progress===`done`&&jd(t);switch(s){case`in-progress`:return(0,n.jsx)(Cf,{transferItem:t,cancelTransfer:()=>i(t.fileId),disabled:o});case`error`:return(0,n.jsx)(Df,{transferItem:t,onRemove:()=>i(t.fileId),disabled:o});case`idle`:return(0,n.jsx)(If,{...e,onPreviewClick:c?()=>a(t.fileId):void 0})}},Rf=(e,n,r)=>(0,t.useMemo)(()=>Nd(e,n,r),[e,n,r]),zf=(e,n)=>(0,t.useMemo)(()=>n?e.filter(e=>e.progress===`done`&&jd(e)):[],[e,n]),Bf=({files:e,cancelTransfer:t,transfers:r=[],queueItemOperations:i=[],ItemRenderer:a=kf,truncateTail:o,enableImagePreview:s=!1,uploadStrategy:c=`form`,disabled:l=!1,inputName:u,buildAttributeAccessors:d})=>{let f=Rf(e,r,c),p=zf(f,s),m=lf(i),h=cf(p);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`ul`,{className:`pkt-fileupload__queue-display`,children:(0,n.jsx)(yf.Provider,{value:{tail:o},children:f.map(e=>{let r={transferItem:e,operations:i,activatedOperation:m.getActivated(e.fileId),inputName:u,disabled:l,onActivate:m.activate,onClose:m.close,buildAttributeAccessors:d};return(0,n.jsxs)(`li`,{className:(0,$.default)(`pkt-fileupload__queue-display__item`,{"pkt-fileupload__queue-display__item--in-progress":typeof e.progress==`number`,[`pkt-fileupload__queue-display__item--${e.progress}`]:typeof e.progress==`string`}),children:[i.filter(e=>e.renderHidden).map(t=>(0,n.jsx)(`span`,{children:t.renderHidden(Mf({operation:t,...r}))},`${t.id}-${e.fileId}`)),(0,n.jsx)(Lf,{...r,ItemRenderer:a,enableImagePreview:s,onCancelTransfer:t,onOpenPreview:h.open})]},e.fileId)})})}),s&&p.length>0&&(0,n.jsx)(jf,{modalRef:h.modalRef,isOpen:h.isOpen,images:p,currentIndex:h.currentIndex,onClose:h.close,onNavigate:h.navigate})]})},Vf={filename:kf,thumbnail:Af},Hf=(0,t.forwardRef)(({value:e,defaultValue:r,id:i,multiple:a=!1,uploadStrategy:o=`form`,addCommentsEnabled:s=!1,renameFilesEnabled:c=!1,truncateTail:l=4,onFilesChanged:u,onFileUploadRequested:d,extraOperations:f=[],itemRenderer:p=Vf.filename,fullwidth:m=!1,allowedFormats:h,formatErrorMessage:g,maxFileSize:_,sizeErrorMessage:v,onFileValidation:y,onFileValidate:b,errorMessage:x,hasError:S=!1,disabled:C=!1,label:w,helptext:ee,optionalTag:T,requiredTag:E,required:te=!1,enableImagePreview:ne=!1,"aria-describedby":re,"aria-invalid":D,...ie},ae)=>{let oe=(0,t.useId)(),se=i??`pkt-fileupload-${oe}`,ce=(0,t.useRef)(null);(0,t.useImperativeHandle)(ae,()=>ce.current,[]);let O=`transfers`in ie?ie.transfers:void 0,[le,k]=(0,t.useState)(null),[A,ue]=(0,t.useState)(``);(0,t.useEffect)(()=>{if(!A)return;let e=setTimeout(()=>ue(``),1500);return()=>clearTimeout(e)},[A]);let de=le??x??null,j=S||!!le||!!(x&&x.trim()),M=de?`${se}-error`:void 0,N=[re,ee?`${se}-helptext`:void 0,M].filter(Boolean).join(` `)||void 0,P=j||D===!0||D===`true`,F=(0,t.useCallback)(e=>{let t=Ad(e,{allowedFormats:h,maxFileSize:_,formatErrorMessage:g,sizeErrorMessage:v,onFileValidation:y});if(t)return t;if(b){let t={file:e,errorMessage:null};if(b(t),t.errorMessage)return t.errorMessage}return null},[h,g,_,v,y,b]);e!==void 0&&r!==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`),e!==void 0&&u===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`);let I=e!==void 0,[fe,pe]=(0,t.useState)(()=>r??[]),L=I?e:fe;uf(ce,{uploadStrategy:o,required:te,currentFileCount:L.length,onMissingFiles:(0,t.useCallback)(()=>k(Sd.requiredMissing),[])});let R=typeof p==`string`?Vf[p]:p,me=p===`thumbnail`,he=typeof ie.accept==`string`?ie.accept.trim():void 0,z=(0,t.useMemo)(()=>Od(he,h)||void 0,[he,h]),B=c&&!me,V=s&&!me,ge=(0,t.useCallback)(e=>{for(let t of e){let e=F(t.file);if(e){k(e);return}}k(null);let t=a?[...L,...e]:[e[0]],n=a?e:[e[0]];ue(n.length===1?Sd.srFileAdded(n[0].attributes.targetFilename):Sd.srFilesAdded(n.length)),I||pe(t),u?.(t),o===`custom`&&d&&e.forEach(e=>{d?.(e)})},[u,L,a,o,d,F,I]),H=(0,t.useCallback)((e,t)=>{let n=L.map(n=>n.fileId===e?{...n,...t}:n);I||pe(n),u?.(n)},[u,L,I]),_e=(0,t.useCallback)(e=>{let t=L.filter(t=>t.fileId!==e);I||pe(t),u?.(t),`onTransferCancelled`in ie&&ie.onTransferCancelled&&ie.onTransferCancelled?.(e)},[u,L,ie,I]),{buildAttributeAccessors:ve}=sf(L,H),U=(0,t.useMemo)(()=>{let e=[];return B&&e.push(of),V&&e.push(ef),e.push(...f),e.push(tf(_e)),e},[B,V,f,_e]),{totalCount:ye,uploadedCount:be,failedCount:xe}=(0,t.useMemo)(()=>Rd(L,O),[L,O]),Se=Sd.fileLabel(ye),Ce=(0,n.jsx)(`div`,{className:(0,$.default)(`pkt-fileupload`,{"pkt-fileupload--full-width":m,"pkt-fileupload--error":j,"pkt-fileupload--disabled":C}),"aria-disabled":C,...C?{inert:``}:{},children:(0,n.jsxs)(Wd.Provider,{value:{name:ie.name||``,multiple:!!a,id:se},children:[(0,n.jsx)(`div`,{className:`pkt-sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:A||(ye>0&&be>0?Sd.srFilesUploadedOfTotal(be,ye,Se):``)}),(0,n.jsx)(`div`,{className:`pkt-sr-only`,"aria-live":`assertive`,"aria-atomic":`true`,children:ye>0&&xe>0&&Sd.srFilesFailedOfTotal(xe,ye,Se)}),(0,n.jsx)(Gd,{id:se,name:ie.name||``,value:L,onFilesAdded:ge,multiple:a,uploadStrategy:o,ref:ce,accept:me?zd:z,isThumbnailView:me,disabled:C,required:te&&o===`form`,"aria-required":te?`true`:void 0,"aria-invalid":P?`true`:void 0,"aria-describedby":N,hasVisibleLabel:!!w}),j&&de&&(0,n.jsx)(sc,{skin:`error`,"aria-live":`assertive`,role:`alert`,compact:!0,id:M,className:`pkt-fileupload__error-alert`,children:de}),L.length>0&&(0,n.jsx)(Bf,{files:L,cancelTransfer:_e,truncateTail:l,transfers:O,uploadStrategy:o,ItemRenderer:R,enableImagePreview:me&&ne,disabled:C,inputName:ie.name||``,buildAttributeAccessors:ve,queueItemOperations:U})]})});return w?(0,n.jsx)(Au,{forId:se,label:w,helptext:ee,disabled:C,hasError:j,optionalTag:T,requiredTag:E,className:(0,$.default)(`pkt-fileupload-wrapper`,{"pkt-fileupload-wrapper--full-width":m}),children:Ce}):Ce});Hf.displayName=`PktFileUpload`;var Uf=({columnOne:e,columnTwo:r,socialLinks:i,className:a,openLinksInNewTab:o=!1,personvernOgInfoLink:s=`https://www.oslo.kommune.no/personvern-og-informasjonskapsler/`,tilgjengelighetLink:c=`https://www.oslo.kommune.no/tilgjengelighet/`,includeConsent:l=!1,hotjarId:u=null,googleAnalyticsId:d=null,devMode:f=!1,cookieDomain:p=null,cookieSecure:m=null,cookieExpiryDays:h=null,onToggleConsent:g=e=>{console.log(e.detail)}})=>(0,n.jsx)(`footer`,{className:[a,`pkt-footer`].filter(Boolean).join(` `),"data-mode":`dark`,children:(0,n.jsxs)(`div`,{className:`pkt-footer__container`,children:[(0,n.jsxs)(`div`,{className:`pkt-grid pkt-grid--rowgap-size-32 pkt-grid--gap-size-16`,children:[(0,n.jsxs)(`div`,{className:`pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up`,children:[(0,n.jsx)(`h2`,{className:`pkt-footer__title`,children:e.title}),(0,n.jsxs)(`ul`,{className:`pkt-footer__list`,children:[e.text&&(0,n.jsx)(`li`,{className:`pkt-footer__text`,children:e.text}),e.links?.map((e,t)=>(0,n.jsx)(`li`,{className:`pkt-footer__list-item`,children:(0,n.jsxs)(`a`,{className:`pkt-footer__link ${e.external?`pkt-link--external`:``}`,href:e.href,target:e.openInNewTab||o?`_blank`:`_self`,rel:e.openInNewTab||o?`noopener noreferrer`:void 0,children:[(0,n.jsx)(Q,{className:`pkt-footer__link-icon`,name:`chevron-right`}),e.text]})},`links-${t}`))]})]}),(0,n.jsxs)(`div`,{className:`pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up`,children:[(0,n.jsx)(`h2`,{className:`pkt-footer__title`,children:r.title}),(0,n.jsxs)(`ul`,{className:`pkt-footer__list`,children:[r.text&&(0,n.jsx)(`li`,{className:`pkt-footer__text`,children:r.text}),r.links?.map((e,t)=>(0,n.jsx)(`li`,{className:`pkt-footer__list-item`,children:(0,n.jsxs)(`a`,{className:`pkt-footer__link ${e.external?`pkt-link--external`:``}`,href:e.href,target:e.openInNewTab||o?`_blank`:`_self`,rel:e.openInNewTab||o?`noopener noreferrer`:void 0,children:[(0,n.jsx)(Q,{className:`pkt-footer__link-icon`,name:`chevron-right`}),e.text]})},`links-${t}`))]})]}),(0,n.jsxs)(`div`,{className:`pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up`,children:[(0,n.jsx)(`h2`,{className:`pkt-footer__title`,children:`Om nettstedet`}),(0,n.jsxs)(`ul`,{className:`pkt-footer__list`,children:[(0,n.jsx)(`li`,{className:`pkt-footer__list-item`,children:(0,n.jsxs)(`a`,{className:`pkt-footer__link`,href:s,target:o?`_blank`:`_self`,rel:o?`noopener noreferrer`:void 0,children:[(0,n.jsx)(Q,{className:`pkt-footer__link-icon`,name:`chevron-right`}),`Personvern og informasjonskapsler`]})}),(0,n.jsx)(`li`,{className:`pkt-footer__list-item`,children:(0,n.jsxs)(`a`,{className:`pkt-footer__link`,href:c,target:o?`_blank`:`_self`,rel:o?`noopener noreferrer`:void 0,children:[(0,n.jsx)(Q,{className:`pkt-footer__link-icon`,name:`chevron-right`}),`Tilgjengelighet`]})}),l&&(0,n.jsx)(`li`,{className:`pkt-footer__list-item`,children:(0,n.jsx)(nd,{triggerType:`footerlink`,hotjarId:u,googleAnalyticsId:d,devMode:f,cookieDomain:p,cookieSecure:m,cookieExpiryDays:h,onToggleConsent:g})})]})]})]}),i&&(0,n.jsxs)(`div`,{className:`pkt-footer__social`,"aria-label":`standard lenker`,children:[(0,n.jsx)(`div`,{className:`pkt-footer__social-languages`,children:i.filter(e=>e.language).map((e,t)=>(0,n.jsx)(`div`,{className:`pkt-footer__social-language`,children:(0,n.jsx)(`a`,{href:e.href,"aria-label":`til ${e.language} versjon av nettsiden`,target:e.openInNewTab||o?`_blank`:`_self`,rel:e.openInNewTab||o?`noopener noreferrer`:void 0,children:e.language})},`sociallinks-language-${t}`))}),(0,n.jsx)(`div`,{className:`pkt-footer__social-icons`,children:i.filter(e=>e.iconName).map((e,r)=>(0,n.jsx)(t.Fragment,{children:(0,n.jsx)(`a`,{href:e.href,"aria-label":`til ${e.iconName}`,className:`pkt-footer__social-icon-link`,target:e.openInNewTab||o?`_blank`:`_self`,rel:e.openInNewTab||o?`noopener noreferrer`:void 0,children:(0,n.jsx)(Q,{className:`pkt-footer__social-icon`,name:e.iconName})})},`sociallinks-${r}`))})]})]})}),Wf=({links:e=[],openLinksInNewTab:t=!1,personvernOgInfoLink:r=`https://www.oslo.kommune.no/personvern-og-informasjonskapsler/`,tilgjengelighetLink:i=`https://www.oslo.kommune.no/tilgjengelighet/`,includeConsent:a=!1,hotjarId:o=null,googleAnalyticsId:s=null,devMode:c=!1,cookieDomain:l=null,cookieSecure:u=null,cookieExpiryDays:d=null,onToggleConsent:f=e=>{console.log(e.detail)},className:p})=>(0,n.jsx)(`footer`,{className:[p,`pkt-footer-simple`].filter(Boolean).join(` `),"data-mode":`dark`,children:(0,n.jsx)(`div`,{className:`pkt-footer-simple__container`,children:(0,n.jsxs)(`ul`,{className:`pkt-footer-simple__list`,children:[e.map((e,r)=>(0,n.jsx)(`li`,{className:`pkt-footer-simple__list-item`,children:(0,n.jsxs)(`a`,{className:`pkt-footer-simple__link ${e.external?` pkt-link--external`:``}`,href:e.href,target:e.openInNewTab||t?`_blank`:`_self`,rel:e.openInNewTab||t?`noopener noreferrer`:void 0,children:[(0,n.jsx)(Q,{className:`pkt-footer-simple__link-icon`,name:`chevron-right`}),e.text]})},r)),(0,n.jsx)(`li`,{className:`pkt-footer-simple__list-item`,children:(0,n.jsxs)(`a`,{className:`pkt-footer-simple__link`,href:r,target:t?`_blank`:`_self`,rel:t?`noopener noreferrer`:void 0,children:[(0,n.jsx)(Q,{className:`pkt-footer-simple__link-icon`,name:`chevron-right`}),`Personvern og informasjonskapsler`]})}),(0,n.jsx)(`li`,{className:`pkt-footer-simple__list-item`,children:(0,n.jsxs)(`a`,{className:`pkt-footer-simple__link`,href:i,target:t?`_blank`:`_self`,rel:t?`noopener noreferrer`:void 0,children:[(0,n.jsx)(Q,{className:`pkt-footer-simple__link-icon`,name:`chevron-right`}),`Tilgjengelighet`]})}),a&&(0,n.jsx)(`li`,{className:`pkt-footer-simple__list-item`,children:(0,n.jsx)(nd,{triggerType:`footerlink`,hotjarId:o,googleAnalyticsId:s,devMode:c,cookieDomain:l,cookieSecure:u,cookieExpiryDays:d,onToggleConsent:f})})]})})}),Gf=(e,n)=>{let[r,i]=(0,t.useState)(()=>typeof window>`u`?n??0:n??window.innerWidth);return(0,t.useEffect)(()=>{let t=e.current;if(!t)return;if(i(t.offsetWidth),typeof ResizeObserver>`u`){let e=()=>{t&&i(t.offsetWidth)};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)}let n=new ResizeObserver(e=>{for(let t of e)t.borderBoxSize&&t.borderBoxSize.length>0?i(t.borderBoxSize[0].inlineSize):i(t.contentRect.width)});return n.observe(t),()=>{n.disconnect()}},[e]),r};function Kf(e){let n=(0,t.useRef)(0);(0,t.useEffect)(()=>{let t=document.body,r=document.documentElement;if(e){n.current=window.scrollY||window.pageYOffset;let e=window.innerWidth-r.clientWidth;e>0&&(t.style.paddingRight=`${e}px`),t.style.position=`fixed`,t.style.top=`-${n.current}px`,t.style.left=`0`,t.style.right=`0`,t.style.width=`100%`,t.style.overflow=`hidden`,r.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:n.current});return()=>{e&&(t.style.cssText=``,document.documentElement.classList.remove(`is-scroll-locked`),window.scrollTo({top:n.current}))}},[e])}var qf=({href:e,iconName:t,className:r,iconPosition:i,external:a,target:o,children:s,...c})=>{let l={"pkt-link":!0,"pkt-link--icon-left":!!t&&i===`left`||!!(t&&!i),"pkt-link--icon-right":!!t&&i===`right`,"pkt-link--external":a};return(0,n.jsxs)(`a`,{...c,className:(0,$.default)(l,r),href:e,target:o,rel:a?`noopener noreferrer`:void 0,children:[t&&(0,n.jsx)(Q,{name:t,className:`pkt-link__icon`}),s]})};qf.displayName=`PktLink`;var Jf=e=>typeof e.target==`string`?{title:e.title,iconName:e.iconName,href:e.target}:{title:e.title,iconName:e.iconName,onClick:e.target},Yf=({item:e,className:t})=>`href`in e?(0,n.jsx)(qf,{iconName:e.iconName,href:e.href,"aria-hidden":`true`,className:(0,$.default)(`pkt-user-menu__link`,t),children:e.title}):(0,n.jsxs)(`button`,{className:(0,$.default)(`pkt-user-menu__link pkt-link-button pkt-link pkt-link--icon-left`,t),type:`button`,onClick:()=>{`onClick`in e&&typeof e.onClick==`function`?e.onClick():console.error(`UserMenuButton item is missing onClick handler or onClick is not a function:`,e)},children:[e.iconName&&(0,n.jsx)(Q,{name:e.iconName,className:`pkt-link__icon`,"aria-hidden":`true`}),e.title]}),Xf=({links:e})=>(0,n.jsx)(`ul`,{className:`pkt-user-menu__sublist`,children:e.map((e,t)=>(0,n.jsx)(`li`,{className:`pkt-user-menu__subitem`,children:(0,n.jsx)(Yf,{item:e})},t))}),Zf=(0,t.forwardRef)(({user:e,formattedLastLoggedIn:t,representing:r,userMenu:i,canChangeRepresentation:a,changeRepresentation:o,logoutOnClick:s},c)=>{let l=i?.map(Jf);return(0,n.jsx)(`nav`,{className:`pkt-user-menu`,ref:c,"aria-label":`Meny for innlogget bruker`,children:(0,n.jsxs)(`ul`,{className:`pkt-user-menu__list`,children:[e&&(0,n.jsxs)(`li`,{className:`pkt-user-menu__item`,children:[(0,n.jsx)(`div`,{className:`pkt-user-menu__label`,children:`Pålogget som`}),(0,n.jsx)(`div`,{className:`pkt-user-menu__name`,translate:`no`,children:e.name}),t&&(0,n.jsxs)(`div`,{className:`pkt-user-menu__last-logged-in`,children:[`Sist pålogget: `,(0,n.jsx)(`time`,{children:t})]})]}),l&&l.length>0&&(0,n.jsx)(`li`,{className:`pkt-user-menu__item`,children:(0,n.jsx)(Xf,{links:l})}),r&&(0,n.jsxs)(`li`,{className:`pkt-user-menu__item`,children:[(0,n.jsx)(`div`,{className:`pkt-user-menu__label`,children:`Representerer`}),(0,n.jsx)(`div`,{className:`pkt-user-menu__name`,translate:`no`,children:r.name}),r.orgNumber&&(0,n.jsxs)(`div`,{className:`pkt-user-menu__org-number`,children:[`Org.nr. `,r.orgNumber]}),a&&o&&(0,n.jsx)(`ul`,{className:`pkt-user-menu__sublist mt-size-16`,children:(0,n.jsx)(`li`,{className:`pkt-user-menu__subitem`,children:(0,n.jsx)(Yf,{item:{title:`Endre organisasjon`,iconName:`cogwheel`,onClick:o}})})})]}),!r&&a&&o&&(0,n.jsx)(`li`,{className:`pkt-user-menu__item`,children:(0,n.jsx)(`ul`,{className:`pkt-user-menu__sublist`,children:(0,n.jsx)(`li`,{className:`pkt-user-menu__subitem`,children:(0,n.jsx)(Yf,{item:{title:`Endre organisasjon`,iconName:`cogwheel`,onClick:o}})})})}),s&&(0,n.jsx)(`li`,{className:`pkt-user-menu__item`,children:(0,n.jsx)(Yf,{item:{title:`Logg ut`,iconName:`exit`,onClick:s}})})]})})});Zf.displayName=`PktHeaderUserMenu`;var Qf=(0,t.forwardRef)(({id:e,ariaDescribedby:r,ariaLabelledby:i,autocomplete:a=`off`,counter:o,counterMaxLength:s,className:c,disabled:l=!1,errorMessage:u,hasError:d=!1,helptext:f,helptextDropdown:p,helptextDropdownButton:m,iconNameRight:h,inline:g=!1,fullwidth:_=!1,label:v,name:y,optionalTag:b=!1,optionalText:x,requiredTag:S=!1,requiredText:C,tagText:w=null,placeholder:ee,prefix:T,suffix:E,type:te=`text`,useWrapper:ne=!0,omitSearchIcon:re=!1,value:D,minLength:ie,maxLength:ae,min:oe,max:se,step:ce,size:O,readonly:le,required:k,dataTestid:A,onChange:ue,skipForwardTestid:de=!1,...j},M)=>{let N=[c,`pkt-textinput`].join(` `),P=te===`search`&&!h&&!re,F=te===`date`&&D?D.slice(0,10):D,[I,fe]=(0,t.useState)(D?.length||0),pe=`${e}`,L=`${pe}-label`,R=i||L,me=e=>{o&&fe(e.currentTarget?.value?.length||0),ue&&ue(e)};return(0,t.useEffect)(()=>{D!==void 0&&fe(D?.length||0)},[D]),(0,n.jsx)(Au,{ariaDescribedby:r,className:N,disabled:l,errorMessage:u,forId:pe,hasError:d,helptext:f,helptextDropdown:p,helptextDropdownButton:m,inline:g,label:v,optionalTag:b,optionalText:x,requiredTag:S,requiredText:C,tagText:w,useWrapper:ne,counter:o,counterCurrent:I,counterMaxLength:s,children:(0,n.jsxs)(`div`,{className:`pkt-input__container`,"data-testid":A,"data-skip-forward-testid":de?`true`:void 0,children:[T&&(0,n.jsx)(`div`,{className:`pkt-input-prefix`,children:T}),(0,n.jsx)(`input`,{...j,ref:M,className:`pkt-input ${_?`pkt-input--fullwidth`:``} ${s&&I>s?`pkt-input--counter-error`:``}`,type:te,name:`${y||e}`,value:F,id:pe,placeholder:ee,autoComplete:a,disabled:l,"aria-invalid":d,"aria-errormessage":`${e}-error`,"aria-labelledby":R,min:oe,max:se,onChange:me,step:ce,minLength:ie,maxLength:ae,size:O,readOnly:le,required:k}),E&&(0,n.jsxs)(`p`,{className:`pkt-input-suffix`,children:[E,h&&(0,n.jsx)(Q,{className:`pkt-input-suffix-icon`,name:h}),P&&(0,n.jsx)(Q,{className:`pkt-input-suffix-icon`,name:`magnifying-glass-big`})]}),!E&&h&&(0,n.jsx)(Q,{className:`pkt-input-icon`,name:h}),!E&&P&&(0,n.jsx)(Q,{className:`pkt-input-icon`,name:`magnifying-glass-big`})]})})});Qf.displayName=`PktTextinput`;var $f=(0,t.forwardRef)(({mobileBreakpoint:e=768,tabletBreakpoint:r=1280,children:i,className:a,compact:o=!1,"data-mode":s,logOutButtonPlacement:c=`none`,logOut:l,openedMenu:u,showSearch:d=!1,onSearch:f,onSearchChange:p,searchValue:m,searchPlaceholder:h=`Søk`,representing:g,serviceLink:_,serviceClick:v,serviceName:y,user:b,userMenu:x,userMenuFooter:S,userOptions:C,canChangeRepresentation:w=!1,changeRepresentation:ee,hideLogo:T=!1,logoLink:E,logoClick:te,position:ne=`fixed`,scrollBehavior:re=`hide`,slotMenuVariant:D=`icon-only`,slotMenuText:ie=`Meny`},ae)=>{let oe=ne===`fixed`,se=re===`hide`;(0,t.useEffect)(()=>{S&&console.warn(`PktHeaderService: The "userMenuFooter" prop is deprecated and will be removed in a future version. Please use "userMenu" instead.`)},[S]),(0,t.useEffect)(()=>{C&&console.warn(`PktHeaderService: The "userOptions" prop is no longer available. Please use "userMenu" instead.`)},[C]),(0,t.useEffect)(()=>{b?.shortname&&console.warn(`PktHeaderService: The "shortname" property on the user object is deprecated and will be removed in a future version.`),g?.shortname&&console.warn(`PktHeaderService: The "shortname" property on the representing object is deprecated and will be removed in a future version.`)},[b?.shortname,g?.shortname]);let ce=(0,t.useMemo)(()=>{if(b?.lastLoggedIn)return typeof b.lastLoggedIn==`string`?b.lastLoggedIn:new Date(b.lastLoggedIn).toLocaleString(`nb-NO`,{year:`numeric`,month:`long`,day:`numeric`})},[b?.lastLoggedIn]),[O,le]=(0,t.useState)(u||`none`);(0,t.useEffect)(()=>{u!==void 0&&le(u)},[u]);let[k,A]=(0,t.useState)(!1),[ue,de]=(0,t.useState)(0),[j,M]=(0,t.useState)(!1),[N,P]=(0,t.useState)(!1),F=(0,t.useRef)(null),I=(0,t.useRef)(null),fe=(0,t.useRef)(null),pe=(0,t.useRef)(null),L=(0,t.useRef)(null),R=(0,t.useRef)(null),me=(0,t.useRef)(null),he=(0,t.useRef)(!1),z=Gf(F),B=z<e,V=z<r,ge=(0,t.useCallback)(e=>{F.current=e,typeof ae==`function`?ae(e):ae&&(ae.current=e)},[ae]);Kf(oe&&B&&O!==`none`);let H=(0,t.useCallback)((e,t)=>{let n=e.relatedTarget,r;switch(t){case`user`:r=I;break;case`slot`:r=fe;break;case`search`:r=pe;break;default:return}let i=r.current;i&&(!n||!i.contains(n))&&le(`none`)},[]),_e=(0,t.useCallback)(()=>{he.current&&me.current&&document.contains(me.current)&&me.current.focus(),me.current=null,he.current=!1},[]);(0,t.useEffect)(()=>{let e=e=>{b&&O===`user`&&!e.target.closest(`.pkt-header-service__user-container`)&&le(`none`),O===`slot`&&!e.target.closest(`.pkt-header-service__slot-container`)&&le(`none`),O===`search`&&!e.target.closest(`.pkt-header-service__search-container`)&&!e.target.closest(`.pkt-header-service__search-input`)&&le(`none`)},t=e=>{e.key===`Escape`&&O!==`none`&&(e.preventDefault(),he.current=!0,le(`none`))};if(O!==`none`)return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)};_e()},[O,b,_e]),(0,t.useEffect)(()=>{let e=()=>{if(se){let e=window.pageYOffset||document.documentElement.scrollTop;if(e<0||Math.abs(e-ue)<60)return;A(e>ue),de(e)}};return document&&window.addEventListener(`scroll`,e),()=>{document&&window.removeEventListener(`scroll`,e)}},[se,ue]);let ve=(0,t.useCallback)(e=>{let t=e===`slot`?fe:pe,n=e===`slot`?L:R;if(!t.current||!n.current||!V||B)return;let r=t.current.getBoundingClientRect(),i=n.current.offsetWidth,a=r.left+i>window.innerWidth;e===`slot`?M(a):P(a)},[V,B]),U=(0,t.useCallback)(e=>{O===`none`?(me.current=document.activeElement,le(e)):le(`none`)},[O]);(0,t.useEffect)(()=>{(O===`slot`||O===`search`)&&requestAnimationFrame(()=>{ve(O)})},[O,ve]);let ye=(0,n.jsxs)(`header`,{className:(0,$.default)(`pkt-header-service`,o&&`pkt-header-service--compact`,B&&`pkt-header-service--mobile`,V&&`pkt-header-service--tablet`,oe&&`pkt-header-service--fixed`,se&&`pkt-header-service--scroll-to-hide`,k&&`pkt-header-service--hidden`,a),"data-mode":s,ref:ge,children:[(0,n.jsxs)(`div`,{className:(0,$.default)(`pkt-header-service__logo-area`,(!y||y===``)&&`pkt-header-service__logo-area--without-service`),children:[!T&&(0,n.jsx)(`span`,{className:`pkt-header-service__logo`,children:E?(0,n.jsx)(`a`,{href:E,"aria-label":`Tilbake til forside`,children:(0,n.jsx)(Q,{name:`oslologo`,"aria-hidden":`true`,path:`https://punkt-cdn.oslo.kommune.no/16.17/logos/`})}):te?(0,n.jsx)(`button`,{"aria-label":`Tilbake til forside`,className:`pkt-link-button pkt-link pkt-header-service__logo-link`,onClick:te,children:(0,n.jsx)(Q,{name:`oslologo`,"aria-hidden":`true`,path:`https://punkt-cdn.oslo.kommune.no/16.17/logos/`})}):(0,n.jsx)(Q,{name:`oslologo`,"aria-hidden":`true`,path:`https://punkt-cdn.oslo.kommune.no/16.17/logos/`})}),y&&(0,n.jsx)(`span`,{className:`pkt-header-service__service-name`,translate:`no`,children:_?(0,n.jsx)(qf,{href:_,className:`pkt-header-service__service-link `,children:y}):v?(0,n.jsx)(`button`,{className:`pkt-link-button pkt-link pkt-header-service__service-link`,onClick:v,children:y}):(0,n.jsx)(`span`,{className:`pkt-header-service__service-link`,children:y})})]}),i||d||V&&l&&(c===`header`||c===`both`)?(0,n.jsxs)(`div`,{className:`pkt-header-service__content`,children:[(0,n.jsxs)(`div`,{className:(0,$.default)(`pkt-header-service__slot-container`,O===`slot`&&`is-open`),onBlur:e=>H(e,`slot`),ref:fe,children:[V&&i&&(0,n.jsx)(uc,{skin:`secondary`,variant:D,iconName:`menu`,size:B?`small`:`medium`,state:O===`slot`?`active`:`normal`,onClick:()=>U(`slot`),"aria-expanded":O===`slot`,"aria-controls":`mobile-slot-menu`,"aria-label":`Åpne meny`,children:ie}),(0,n.jsx)(`div`,{className:(0,$.default)(`pkt-header-service__slot-content`,j&&`align-right`),id:`mobile-slot-menu`,role:V?`menu`:void 0,"aria-label":V?`Meny`:void 0,ref:L,children:(0,n.jsx)(`div`,{className:`pkt-contents`,children:i})})]}),d&&(0,n.jsx)(n.Fragment,{children:V?(0,n.jsxs)(`div`,{className:(0,$.default)(`pkt-header-service__search-container`,O===`search`&&`is-open`),onBlur:e=>H(e,`search`),ref:pe,children:[(0,n.jsx)(uc,{skin:`secondary`,variant:`icon-only`,iconName:`magnifying-glass-big`,size:B?`small`:`medium`,onClick:()=>U(`search`),state:O===`search`?`active`:`normal`,"aria-expanded":O===`search`,"aria-controls":`mobile-search-menu`,"aria-label":`Åpne søkefelt`,children:`Søk`}),(0,n.jsx)(`div`,{className:(0,$.default)(`pkt-header-service__mobile-menu`,O===`search`&&`is-open`,N&&`align-right`),ref:R,children:O===`search`&&(0,n.jsx)(Qf,{id:`mobile-search-menu`,className:`pkt-header-service__search-input`,type:`search`,label:`Søk`,useWrapper:!1,placeholder:h,value:m,autoFocus:!0,fullwidth:!0,onChange:e=>p?.(e.target.value),onKeyDown:e=>{e.key===`Enter`&&f?.(e.target.value)}})})]}):(0,n.jsx)(Qf,{id:`header-service-search`,className:`pkt-header-service__search-input`,type:`search`,label:`Søk`,useWrapper:!1,placeholder:h,value:m,onChange:e=>p?.(e.target.value),onKeyDown:e=>{e.key===`Enter`&&f?.(e.target.value)}})}),B&&l&&(c===`header`||c===`both`)&&(0,n.jsx)(uc,{skin:`secondary`,size:B?`small`:`medium`,variant:`icon-only`,iconName:`exit`,onClick:l,children:`Logg ut`})]}):null,(b||!B&&l&&(c===`header`||c===`both`))&&(0,n.jsxs)(`div`,{className:`pkt-header-service__user`,children:[b&&(0,n.jsxs)(`div`,{className:`pkt-header-service__user-container`,onBlur:e=>H(e,`user`),ref:I,children:[(0,n.jsxs)(uc,{className:(0,$.default)(`pkt-header-service__user-button`,B&&`pkt-header-service__user-button--mobile`),skin:`secondary`,size:B?`small`:`medium`,state:O===`user`?`active`:`normal`,variant:`icons-right-and-left`,iconName:`user`,secondIconName:O===`user`?`chevron-thin-up`:`chevron-thin-down`,onClick:()=>U(`user`),children:[(0,n.jsx)(`span`,{className:`pkt-sr-only`,children:`Brukermeny: `}),(0,n.jsx)(`span`,{translate:`no`,children:g?.name||b.name})]}),O===`user`&&b&&(0,n.jsx)(`div`,{className:(0,$.default)(B?`pkt-header-service__mobile-menu`:`pkt-header-service__user-menu`,`is-open`),children:(0,n.jsx)(Zf,{user:b,formattedLastLoggedIn:ce,representing:g,userMenu:x,canChangeRepresentation:w,changeRepresentation:ee,logoutOnClick:c===`userMenu`||c===`both`?l:void 0})})]}),!B&&l&&(c===`header`||c===`both`)&&(0,n.jsx)(uc,{skin:`tertiary`,size:`medium`,variant:`icon-right`,iconName:`exit`,onClick:l,children:`Logg ut`})]})]});return oe?(0,n.jsxs)(`div`,{className:`pkt-header-service-wrapper`,children:[ye,(0,n.jsx)(`div`,{className:(0,$.default)(`pkt-header-service-spacer`,o&&`pkt-header-service-spacer--compact`,b&&`pkt-header-service-spacer--has-user`,B&&`pkt-header-service-spacer--mobile`,V&&`pkt-header-service-spacer--tablet`)})]}):ye});$f.displayName=`PktHeaderService`;var ep=(0,t.forwardRef)((e,t)=>(0,n.jsx)($f,{...e,ref:t}));ep.displayName=`PktHeader`;var tp={automat:`parking-meter`,bike:`bicycle`,corona:`virus`,directions:`arrow-directions`,document:`document-plain`,"download-document":`document-download`,elcar:`electric-car`,"error-hexa":`alert-error`,"fire-emblem":`shield-fire`,"link-arrow":`arrow-link`,"linked-in":`linkedin`,"map-layer":`map-layers`,mobile:`mobile-phone`,neutral:`smiley-neutral`,placeholder:`placeholder-icon`,sad:`smiley-sad`,signing:`signature`,sky:`cloud`,smile:`smiley-smile`,"success-square":`alert-success`,trash:`trash-can`,treatment:`processing`,"warning-triangle":`alert-warning`};function np(e){return e&&(tp[e]??e)}var rp={"facebook.com":`facebook`,"fb.com":`facebook`,"instagram.com":`instagram`,"linkedin.com":`linkedin`,"x.com":`x`,"github.com":`github`};function ip(e){return e.toLowerCase().replace(/^(?:www|m)\./,``)}function ap(e,t){if(e)try{let t=rp[ip(new URL(e).hostname)];if(t)return t}catch{}if(t){let e=t.trim().toLowerCase().replace(/\s+/g,`-`);if(e){let t=np(e);if(t)return t}}}var op=`nb-NO`;function sp(e,t=op){if(e)return e[t]??e[op]}async function cp(e=bd,t){let n=await fetch(e,{signal:t});if(!n.ok)throw Error(`pkt-header-menu: failed to fetch ${e} (HTTP ${n.status})`);let r=await n.json();if(!r||typeof r!=`object`)throw Error(`pkt-header-menu: ${e} returned a non-object payload`);return r}var lp=({dataUrl:e=bd,data:r,locale:i=`nb-NO`,open:a=!1,mobileBreakpoint:o=768,ariaLabelledBy:s,className:c,onDataLoaded:l,onDataError:u,ref:d,...f})=>{let[p,m]=(0,t.useState)(r?`ready`:`idle`),[h,g]=(0,t.useState)(void 0),[_,v]=(0,t.useState)(!1),y=(0,t.useRef)(l),b=(0,t.useRef)(u);(0,t.useEffect)(()=>{y.current=l},[l]),(0,t.useEffect)(()=>{b.current=u},[u]),(0,t.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(max-width: ${o-1}px)`);v(e.matches);let t=e=>v(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[o]),(0,t.useEffect)(()=>{r&&(m(`ready`),y.current?.(r))},[r]),(0,t.useEffect)(()=>{if(r)return;let t=new AbortController;return m(`loading`),cp(e,t.signal).then(e=>{t.signal.aborted||(g(e),m(`ready`),y.current?.(e))}).catch(e=>{e.name!==`AbortError`&&(m(`error`),b.current?.(e))}),()=>t.abort()},[r,e]);let x=r??h,S=(0,t.useMemo)(()=>sp(x,i),[x,i]),C=[`pkt-header-menu`,a&&`pkt-header-menu--open`,c].filter(Boolean).join(` `);if(p===`loading`)return(0,n.jsx)(`section`,{...f,ref:d,className:C,children:(0,n.jsx)(`nav`,{"aria-busy":`true`,children:(0,n.jsx)(`p`,{className:`pkt-header-menu__loading`,children:`Laster meny…`})})});if(p===`error`||!S)return(0,n.jsx)(`section`,{...f,ref:d,className:C,children:(0,n.jsx)(`nav`,{"aria-hidden":!a,children:(0,n.jsx)(`p`,{className:`pkt-header-menu__error`,children:`Kunne ikke laste meny.`})})});let{megamenu:w,i18n:ee}=S,T=ee?.navAriaLabel||`Hovedmeny`;return(0,n.jsx)(`section`,{...f,ref:d,className:C,"aria-labelledby":s||void 0,children:(0,n.jsxs)(`nav`,{"aria-label":T,children:[_?(0,n.jsx)(dp,{services:w.services,sections:w.sections}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(fp,{services:w.services}),(0,n.jsx)(pp,{buttons:w.buttons,mobile:!1}),(0,n.jsx)(mp,{sections:w.sections})]}),(0,n.jsx)(pp,{buttons:w.buttons,mobile:!0}),(0,n.jsx)(gp,{links:w.links,some:w.some})]})})},up=({services:e})=>(0,n.jsx)(`ul`,{className:`pkt-header-menu__services-list`,children:e.links.map((e,t)=>(0,n.jsx)(`li`,{className:`pkt-header-menu__service`,children:(0,n.jsxs)(`a`,{className:`pkt-header-menu__service-link`,href:e.url,children:[(0,n.jsx)(Q,{className:`pkt-header-menu__service-icon`,name:np(e.icon),"aria-hidden":`true`}),(0,n.jsx)(`span`,{className:`pkt-header-menu__service-text`,children:e.text})]})},`service-${t}`))}),dp=({services:e,sections:t})=>(0,n.jsx)(`div`,{className:`pkt-header-menu__sections`,children:(0,n.jsxs)(_,{className:`pkt-header-menu__sections-inner`,skin:`plus-minus`,name:`header-menu-accordion`,children:[(0,n.jsx)(oc,{className:`pkt-header-menu__section`,skin:`plus-minus`,id:`pkt-header-menu-services`,title:e.title,children:(0,n.jsx)(up,{services:e})}),t.map((e,t)=>(0,n.jsx)(oc,{className:`pkt-header-menu__section`,skin:`plus-minus`,id:`pkt-header-menu-section-${t}`,title:e.title,children:(0,n.jsx)(hp,{links:e.links})},`section-${t}`))]})}),fp=({services:e})=>(0,n.jsxs)(`div`,{className:`pkt-header-menu__services`,children:[(0,n.jsx)(`h2`,{className:`pkt-header-menu__services-title`,children:e.title}),(0,n.jsx)(up,{services:e})]}),pp=({buttons:e,mobile:t})=>!e||e.length===0?null:(0,n.jsx)(`div`,{className:[`pkt-header-menu__buttons`,t&&`pkt-header-menu__buttons--mobile`].filter(Boolean).join(` `),children:e.map((e,t)=>(0,n.jsxs)(`a`,{className:`pkt-btn pkt-btn--secondary pkt-btn--icon-right pkt-btn--small`,href:e.url,children:[(0,n.jsx)(Q,{className:`pkt-btn__icon`,name:e.iconName?np(e.iconName):`user`,"aria-hidden":`true`}),(0,n.jsx)(`span`,{className:`pkt-btn__text`,children:e.text})]},`button-${t}`))}),mp=({sections:e})=>!e||e.length===0?null:(0,n.jsx)(`div`,{className:`pkt-header-menu__sections`,children:(0,n.jsx)(`div`,{className:`pkt-header-menu__sections-inner`,children:e.map((e,t)=>(0,n.jsxs)(`div`,{className:`pkt-header-menu__section`,children:[(0,n.jsx)(`h2`,{className:`pkt-header-menu__section-title`,children:e.title}),(0,n.jsx)(hp,{links:e.links})]},`section-${t}`))})}),hp=({links:e})=>(0,n.jsx)(`ul`,{className:`pkt-header-menu__section-list`,children:e.map((e,t)=>(0,n.jsx)(`li`,{children:(0,n.jsx)(`a`,{className:`pkt-header-menu__section-link`,href:e.url,children:e.text})},`section-link-${t}`))}),gp=({links:e,some:t})=>{let r=e&&e.length>0,i=t&&t.length>0;return!r&&!i?null:(0,n.jsxs)(`div`,{className:`pkt-header-menu__footer`,children:[r&&(0,n.jsx)(`ul`,{className:`pkt-header-menu__footer-list`,children:e.map((e,t)=>(0,n.jsx)(`li`,{children:(0,n.jsx)(`a`,{className:`pkt-header-menu__footer-link`,href:e.url,children:e.text})},`footer-link-${t}`))}),i&&(0,n.jsx)(`ul`,{className:`pkt-header-menu__footer-list pkt-header-menu__footer-list--social`,children:t.map((e,t)=>(0,n.jsx)(_p,{entry:e},`some-${t}`))})]})},_p=({entry:e})=>{let t=ap(e.url,e.text);return(0,n.jsx)(`li`,{children:(0,n.jsx)(`a`,{className:`pkt-header-menu__social-link`,href:e.url,"aria-label":e.text,children:t?(0,n.jsx)(Q,{name:t,"aria-hidden":`true`}):(0,n.jsx)(`span`,{children:e.text})})})},vp=x({tagName:`pkt-heading`,elementClass:pi,react:t.default,displayName:`PktHeading`}),yp=(0,t.forwardRef)(({children:e,...t},r)=>(0,n.jsx)(vp,{"data-testid":`pkt-heading`,...t,ref:r,children:e}));yp.displayName=`PktHeading`;var bp=x({tagName:`pkt-helptext`,elementClass:Gi,react:t.default,displayName:`PktHelptext`,events:{onToggleHelpText:`toggleHelpText`}}),xp=(0,t.forwardRef)(({children:e,...t},r)=>(0,n.jsx)(bp,{...t,ref:r,children:(0,n.jsx)(`div`,{className:`pkt-contents`,children:e})}));xp.displayName=`PktHelptext`;var Sp=(0,t.forwardRef)(({label:e,id:t,children:r,...i},a)=>(0,n.jsxs)(`div`,{className:`pkt-form-group`,children:[(0,n.jsx)(`label`,{htmlFor:t,className:`pkt-form-label`,children:e}),(0,n.jsx)(`input`,{className:`pkt-form-input`,id:t,...i,ref:a}),r]}));Sp.displayName=`PktInput`;var Cp=({children:e,skin:t,title:r,href:i,iconName:a,openInNewTab:o,external:s,className:c,...l})=>{let u=[`pkt-linkcard`,t&&`pkt-linkcard--${t}`].filter(Boolean).join(` `),d=[`pkt-linkcard__title`,s&&`pkt-link pkt-link--external`].filter(Boolean).join(` `);return(0,n.jsxs)(`a`,{...l,href:i,className:(0,$.default)(u,c),target:o?`_blank`:`_self`,rel:o?`noopener noreferrer`:void 0,children:[a&&(0,n.jsx)(Q,{className:`pkt-link__icon`,name:a}),r&&(0,n.jsx)(`div`,{className:(0,$.default)(d),children:r}),(0,n.jsx)(`div`,{className:`pkt-linkcard__text`,children:e})]})};Cp.displayName=`PktLinkCard`;var wp=x({tagName:`pkt-loader`,elementClass:Ns,react:t.default,displayName:`PktLoader`,events:{}}),Tp=(0,t.forwardRef)(({children:e,...t},r)=>(0,n.jsx)(wp,{...t,ref:r,children:(0,n.jsx)(`div`,{className:`pkt-contents`,children:e})}));Tp.displayName=`PktLoader`;var Ep=({children:e,className:r,skin:i,title:a,compact:o,closable:s,onClose:c,...l})=>{let[u,d]=(0,t.useState)(!1),f={"pkt-messagebox":!0,"pkt-messagebox--compact":o,[`pkt-messagebox--${i}`]:i,"pkt-messagebox--closable":s,"pkt-hide":u},p=(0,t.createRef)(),m=(0,t.useCallback)(()=>{d(!0),c&&c()},[d,c]);return(0,n.jsxs)(`div`,{...l,className:(0,$.default)(f,r),ref:p,children:[s&&(0,n.jsx)(`div`,{className:`pkt-messagebox__close`,children:(0,n.jsx)(`button`,{onClick:m,className:`pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only`,"aria-label":`Lukk`,children:(0,n.jsx)(Q,{name:`close`,className:`pkt-link__icon`})})}),a&&(0,n.jsx)(`div`,{className:`pkt-messagebox__title`,children:a}),(0,n.jsx)(`div`,{className:`pkt-messagebox__text`,children:e})]})};Ep.displayName=`PktMessagebox`;var Dp=()=>(`00000000000000000`+(Math.random()*0x10000000000000000).toString(16)).slice(-16),Op=()=>{let e=Dp(),t=Dp();return e.slice(0,8)+`-`+e.slice(8,12)+`-4`+e.slice(13)+`-a`+t.slice(1,4)+`-`+t.slice(4)},kp=(0,t.forwardRef)(({ariaLabel:e,ariaLabelledby:r,ariaLive:i=`polite`,ariaValueText:a,id:o,role:s=`progressbar`,skin:c=`dark-blue`,statusPlacement:l=`following`,statusType:u=`none`,title:d,titlePosition:f=`left`,valueCurrent:p=0,valueMax:m=100,valueMin:h=0,className:g,..._},v)=>{let y=(0,t.useMemo)(()=>Op(),[]),b=o||y,x=(0,t.useRef)(null),[S,C]=(0,t.useState)(0);(0,t.useEffect)(()=>{x.current&&C(x.current.getBoundingClientRect().width||0)},[p]);let w=m-h,ee=Math.round(u===`fraction`?p/w*100:(p-h)/w*100),T=`${p} av ${w}`,E=u===`fraction`&&!a?`${p} av ${m-h}`:a||void 0,te=e?void 0:r||`${b}-title`;return(0,n.jsx)(`div`,{ref:v,id:b,role:s,"aria-live":i,"aria-atomic":`true`,"aria-valuenow":p,"aria-valuemin":h,"aria-valuemax":m,"aria-valuetext":E,"aria-label":e||void 0,"aria-labelledby":te,className:(0,$.default)(`pkt-progressbar`,g),..._,children:(0,n.jsxs)(`div`,{className:`pkt-progressbar__container`,style:{"--pkt-progress-label-width":`${S}px`,"--pkt-progress-width":`${ee}%`},children:[d&&(0,n.jsx)(`p`,{id:`${b}-title`,className:(0,$.default)(`pkt-progressbar__title`,{"pkt-progressbar__title-center":f===`center`}),children:d}),(0,n.jsx)(`div`,{className:`pkt-progressbar__bar-wrapper`,children:(0,n.jsx)(`div`,{className:(0,$.default)(`pkt-progressbar__bar`,`pkt-progressbar__bar--${c}`)})}),u!==`none`&&(0,n.jsx)(`div`,{className:(0,$.default)(`pkt-progressbar__status`,{"pkt-progressbar__status--center":l===`center`}),children:(0,n.jsx)(`span`,{ref:x,className:(0,$.default)({"pkt-progressbar__status-placement--following":l===`following`,"pkt-progressbar__status-placement--center":l===`center`,"pkt-progressbar__status-placement--left":l===`left`}),children:u===`percentage`?`${ee}%`:T})})]})})});kp.displayName=`PktProgressbar`;var Ap=(0,t.forwardRef)(({id:e,name:t,label:r,className:i,hasTile:a=!1,disabled:o=!1,checkHelptext:s,hasError:c=!1,defaultChecked:l,checked:u,optionalTag:d,optionalText:f,requiredTag:p,requiredText:m,tagText:h,...g},_)=>{let v=[i,`pkt-input-check`].filter(Boolean).join(` `),y=[`pkt-input-check__input`,a?`pkt-input-check__input--tile`:``,o&&a?`pkt-input-check__input--tile-disabled`:``].filter(Boolean).join(` `),b=[`pkt-input-check__input-checkbox`,c?`pkt-input-check__input-checkbox--error`:``].filter(Boolean).join(` `),x=[`pkt-input-check__input-label`,o?`pkt-input-check__input-label--disabled`:``].filter(Boolean).join(` `),S=[`pkt-tag`,`pkt-tag--small`,`pkt-tag--thin-text`].join(` `),C=()=>(0,n.jsxs)(n.Fragment,{children:[h&&(0,n.jsx)(`span`,{className:S+` pkt-tag--gray`,children:h}),d&&(0,n.jsx)(`span`,{className:S+` pkt-tag--blue-light`,children:f}),p&&(0,n.jsx)(`span`,{className:S+` pkt-tag--beige`,children:m})]});return(0,n.jsx)(`div`,{className:v,children:(0,n.jsxs)(`div`,{className:y,children:[(0,n.jsx)(`input`,{ref:_,id:e,type:`radio`,name:t,disabled:o,className:b,...u===void 0?{defaultChecked:l}:{checked:u},...g}),(0,n.jsxs)(`label`,{className:x,htmlFor:e,children:[r,` `,C(),s&&(0,n.jsx)(`div`,{className:`pkt-input-check__input-helptext`,children:s})]})]})})});Ap.displayName=`PktRadioButton`;var jp=(0,t.forwardRef)(({appearance:e=`local`,disabled:t=!1,fullwidth:r=!1,id:i,label:a,name:o,placeholder:s=`Søk…`,suggestions:c,value:l=``,action:u,method:d,onChange:f,onSearch:p,onSuggestionClick:m,...h},g)=>{let _=(e,t)=>{e?e():m&&m(t)},v=e=>{l=e.target.value},y={role:`search`,className:`pkt-searchinput pkt-searchinput--${e} ${r?`pkt-searchinput--fullwidth`:``}`,...ku()},b=e=>u?(0,n.jsx)(`form`,{...y,action:u,method:d,children:e}):(0,n.jsx)(`div`,{...y,children:e}),x=e=>(0,n.jsxs)(n.Fragment,{children:[e.title&&(0,n.jsx)(`h3`,{className:`pkt-searchinput__suggestion-title`,children:e.title}),e.text&&(0,n.jsx)(`p`,{className:`pkt-searchinput__suggestion-text`,children:e.text})]}),S=e=>[`pkt-searchinput__suggestion`,e.onClick?`pkt-link-button`:``].filter(Boolean).join(` `);return b((0,n.jsxs)(n.Fragment,{children:[a&&(0,n.jsx)(`label`,{htmlFor:a?i:void 0,className:a?`pkt-inputwrapper__label`:``,children:a}),(0,n.jsxs)(`div`,{className:e===`local`?`pkt-input__container`:`pkt-searchinput__field`,children:[(0,n.jsx)(`input`,{className:`pkt-input ${r?`pkt-input--fullwidth`:``}`,type:`search`,name:o||i,id:i,placeholder:s,defaultValue:l,disabled:t,autoComplete:`off`,"aria-autocomplete":`list`,ref:g,"aria-controls":`${i}-suggestions`,onChange:f||v,onKeyUp:p&&(e=>{e.key===`Enter`&&(e.preventDefault(),p(l))}),...h}),(0,n.jsx)(uc,{className:`pkt-searchinput__button ${e===`local`?`pkt-input-icon`:``}`,variant:`icon-only`,iconName:`magnifying-glass-big`,skin:e===`local`?`tertiary`:`primary`,color:e===`global`?`yellow`:void 0,type:`submit`,disabled:t,onClick:p&&(e=>{e.preventDefault(),p(l)}),children:a||s})]}),c&&(0,n.jsx)(`ul`,{id:`${i}-suggestions`,className:`pkt-searchinput__suggestions`,"aria-live":`assertive`,children:c.map((e,t)=>e.href?(0,n.jsx)(`li`,{children:(0,n.jsx)(`a`,{href:e.href,className:S(e),onClick:()=>_(e.onClick,t),children:x(e)})},`search-suggestion-${t}`):e.nonInteractive?(0,n.jsx)(`li`,{children:(0,n.jsx)(`div`,{className:`pkt-searchinput__suggestion`,children:x(e)})},`search-suggestion-${t}`):(0,n.jsx)(`li`,{children:(0,n.jsx)(`button`,{type:`button`,className:S(e),onClick:()=>_(e.onClick,t),children:x(e)})},`search-suggestion-${t}`))})]}))});jp.displayName=`PktSearchInput`;var Mp=(0,t.forwardRef)(({ariaDescribedby:e,ariaLabelledby:t,children:r,className:i,disabled:a=!1,errorMessage:o,hasError:s,helptext:c,helptextDropdown:l,helptextDropdownButton:u,id:d,inline:f=!1,fullwidth:p=!1,label:m,name:h,optionalTag:g=!1,optionalText:_,requiredTag:v=!1,requiredText:y,tagText:b,...x},S)=>(0,n.jsx)(Au,{className:[i,`pkt-select`].join(` `),forId:`${d}-input`,label:m,helptext:c,helptextDropdown:l,helptextDropdownButton:u,optionalTag:g,optionalText:_,requiredTag:v,requiredText:y,tagText:b,hasError:s,errorMessage:o,disabled:a,inline:f,ariaDescribedby:e,children:(0,n.jsx)(`select`,{ref:S,className:`pkt-input ${p?`pkt-input--fullwidth`:``}`,"aria-invalid":s,"aria-errormessage":`${d}-error`,"aria-labelledby":t||void 0,disabled:a,id:`${d}-input`,name:h||d,...x,children:r})}));Mp.displayName=`PktSelect`;var Np=(0,n.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,fill:`none`,children:(0,n.jsx)(`circle`,{cx:`12`,cy:`12`,r:`7`,style:{fill:`var(--pkt-color-grays-grey-200, #CCC)`}})}),Pp=(0,n.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,fill:`none`,children:[(0,n.jsx)(`circle`,{opacity:`.15`,cx:`12`,cy:`12`,r:`12`,fill:`#2A2859`}),(0,n.jsx)(`circle`,{cx:`12`,cy:`12`,r:`6`,fill:`#2A2859`})]}),Fp=(0,n.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,fill:`none`,children:[(0,n.jsx)(`path`,{fill:`#2A2859`,d:`M3 3h18v18H3z`}),(0,n.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`})]}),Ip=({children:e,className:t,status:r=`incomplete`,title:i})=>(0,n.jsxs)(`li`,{className:(0,$.default)(`pkt-step`,t,`pkt-step--${r}`),"data-testid":`pkt-step`,children:[(0,n.jsx)(`span`,{className:`pkt-step__line pkt-step__line--1`,"aria-hidden":!0}),(0,n.jsx)(`span`,{className:`pkt-step__line pkt-step__line--2`,"aria-hidden":!0}),(0,n.jsx)(`span`,{className:(0,$.default)(`pkt-step__indicator`),children:r===`current`?Pp:r===`completed`?Fp:Np}),(0,n.jsx)(`span`,{className:`pkt-step__line pkt-step__line--3`,"aria-hidden":!0}),(0,n.jsxs)(`div`,{className:`pkt-step__wrapper`,children:[(0,n.jsx)(`div`,{className:`pkt-step__title`,children:i}),(0,n.jsx)(`div`,{className:`pkt-step__content`,children:e})]})]}),Lp=(0,t.forwardRef)(({activeStep:e,className:r,children:i,hideNonActiveSteps:a=!1,hideNonActiveStepsContent:o=!0,orientation:s=`vertical`,...c},l)=>{let u=(0,$.default)(r,`pkt-stepper`,s===`horizontal`?`pkt-stepper--horizontal`:`pkt-stepper--vertical`),d=t.Children.map(i,(n,r)=>(0,t.isValidElement)(n)?(0,t.cloneElement)(n,{className:(0,$.default)(n.props.className,{"pkt-step--hideStep":a&&r!==e,"pkt-step--hideContent":o&&r!==e})}):n);return(0,n.jsx)(`ol`,{"data-testid":`pkt-stepper`,className:u,ref:l,...c,children:d})});Lp.displayName=`PktStepper`;var Rp=({className:e,compact:t=!1,skin:r=`basic`,responsiveView:i=!0,children:a,...o})=>(0,n.jsx)(`table`,{"data-testid":`pkt-table`,className:(0,$.default)(e,`pkt-table`,{"pkt-table--responsive":i,"pkt-table--compact":t,"pkt-table--basic":r===`basic`,"pkt-table--zebra-blue":r===`zebra-blue`}),role:`table`,...o,children:a}),zp=({id:e,children:t,className:r,...i})=>(0,n.jsx)(`tbody`,{id:e,className:(0,$.default)(r,`pkt-table__body`,{}),...i,role:`rowgroup`,children:t}),Bp=({children:e,className:t,dataLabel:r,...i})=>(0,n.jsx)(`td`,{className:(0,$.default)(t,`pkt-table__data-cell`,{}),"data-label":r,role:`cell`,"data-testid":`pkt-table__data-cell`,...i,children:e}),Vp=({className:e,children:t,...r})=>(0,n.jsx)(`thead`,{className:(0,$.default)(e,`pkt-table__header`,{}),role:`rowgroup`,...r,children:t}),Hp=({className:e,children:t,...r})=>(0,n.jsx)(`th`,{className:(0,$.default)(e,`pkt-table__header-cell`,{}),role:`columnheader`,...r,children:t}),Up=({className:e,children:t,...r})=>(0,n.jsx)(`tr`,{className:(0,$.default)(e,`pkt-table__row`,{}),role:`row`,...r,children:t}),Wp=(0,t.forwardRef)(({children:e,active:t,disabled:r=!1,href:i,onClick:a,icon:o,controls:s,tag:c,tagSkin:l,index:u=0},d)=>{let{arrowNav:f,registerTabRef:p,handleKeyPress:m,selectTab:h}=Kp(),g=!!t&&!r,_={"aria-selected":f?g:void 0,"aria-controls":s,role:f?`tab`:void 0,onKeyDown:e=>{if(r&&(e.key===`Enter`||e.key===` `||e.key===`Spacebar`)){e.preventDefault(),e.stopPropagation();return}m(u,e)},onClick:e=>{if(r){e.preventDefault(),e.stopPropagation();return}h(u),a?.(e)},tabIndex:r?-1:g||!f?void 0:-1,ref:e=>{p(u,e,r),typeof d==`function`?d(e):d&&(d.current=e)}},v=(0,n.jsxs)(n.Fragment,{children:[o&&(0,n.jsx)(Q,{name:o,className:`pkt-icon--small ${o===`check`?`pkt-tabs__status-icon`:``}`}),e,c&&(0,n.jsx)(Eu,{skin:l,size:`small`,children:c})]});return i?(0,n.jsx)(`a`,{..._,href:r?void 0:i,"aria-disabled":r||void 0,className:`pkt-tabs__link ${g?`active`:``} ${r?`pkt-tabs__item--disabled`:``}`,children:v}):(0,n.jsx)(`button`,{..._,type:`button`,disabled:r,"aria-disabled":r||void 0,className:`pkt-tabs__button pkt-link-button ${g?`active`:``} ${r?`pkt-tabs__item--disabled`:``}`,children:v})});Wp.displayName=`PktTabItem`;var Gp=(0,t.createContext)(null),Kp=()=>{let e=(0,t.useContext)(Gp);if(!e)throw Error(`TabItem must be used within a Tabs component`);return e},qp=(0,t.forwardRef)(({arrowNav:e=!0,disableArrowNav:r=!1,separatorIconName:i,separatorIconPath:a,tabs:o,onTabSelected:s,children:c},l)=>{let u=(0,t.useRef)([]),d=(0,t.useRef)({}),f=e&&!r,p=t.Children.toArray(c),m=p.length>0,h=m?p.length:o?.length||0,g=!!(i||a);(0,t.useEffect)(()=>{u.current=u.current.slice(0,h),Object.keys(d.current).forEach(e=>{let t=Number(e);t>=h&&delete d.current[t]})},[h]);let _=e=>o?!!o[e]?.disabled:!!d.current[e],v=e=>{if(_(e))return;let t=o?.[e];t?.action&&t.action(e),s&&s(e)},y=(e,t)=>{let n=e+t;for(;n>=0&&n<h;){if(!_(n))return n;n+=t}return null},b=(e,t)=>{if(f){if(t.key===`ArrowLeft`){t.preventDefault();let n=y(e,-1);n!==null&&u.current[n]?.focus()}if(t.key===`ArrowRight`){t.preventDefault();let n=y(e,1);n!==null&&u.current[n]?.focus()}(t.key===`Enter`||t.key===` `||t.key===`Spacebar`||t.key===`ArrowDown`)&&(t.preventDefault(),_(e)||v(e))}},x=(e,t,n=!1)=>{u.current[e]=t,d.current[e]=n},S=e=>(0,n.jsx)(`span`,{className:`pkt-tabs__separator`,"aria-hidden":`true`,role:`presentation`,children:a?(0,n.jsx)(`img`,{src:a,alt:``,"aria-hidden":`true`}):i?(0,n.jsx)(Q,{name:i,className:`pkt-tabs__separator-icon`}):null},e),C=e=>!g||e.length<=1?e:e.flatMap((t,n)=>n<e.length-1?[t,S(`separator-${n}`)]:[t]),w=o?.map((e,t)=>(0,n.jsx)(Wp,{active:e.disabled?!1:e.active,disabled:e.disabled,href:e.href,icon:e.icon,controls:e.controls,tag:e.tag?.text,tagSkin:e.tag?.skin,index:t,children:e.text},t)),ee=[`pkt-tabs`,g&&`pkt-tabs--with-separator`].filter(Boolean).join(` `),T=C(m?p:w||[]);return(0,n.jsx)(Gp.Provider,{value:{arrowNav:f,registerTabRef:x,handleKeyPress:b,selectTab:v},children:(0,n.jsx)(`div`,{className:ee,ref:l,children:(0,n.jsx)(`div`,{className:`pkt-tabs__list`,role:f?`tablist`:`navigation`,children:T})})})});qp.displayName=`PktTabs`;var Jp=e=>e?Math.max(1,Math.round(e/60)):1,Yp=(e,t)=>{let n=e?parseInt(String(e).split(`:`)[0],10):0,r=t?parseInt(String(t).split(`:`)[0],10):23;return Array.from({length:r-n+1},(e,t)=>t+n)},Xp=e=>{let t=Jp(e);return Array.from({length:Math.floor(60/t)},(e,n)=>n*t)},Zp=(e,t,n,r)=>{let i=e===``?n===1?0:23:parseInt(e,10),a=t===``?n===1?0:Math.floor(59/r)*r:parseInt(t,10);return a+=n*r,a>59?(a=0,i=(i+1)%24):a<0&&(a=Math.floor(59/r)*r,i=(i-1+24)%24),{hours:String(i).padStart(2,`0`),minutes:String(a).padStart(2,`0`)}},Qp=e=>/^\d{2}:\d{2}$/.test(e)&&parseInt(e.slice(0,2),10)<=23&&parseInt(e.slice(3),10)<=59,$p=e=>{let[t,n]=e.split(`:`).map(Number);return t*60+n},em={required:`Dette feltet er påkrevd`,invalid:`Ugyldig verdi`,timeStepMismatch:`Må treffe på et steg, for eksempel 0, {step} minutter`,timeStepMismatchHour:`Må treffe på hver hele time`,timeStepMismatchHalfHour:`Må treffe på hver hele eller halve time`,rangeUnderflowMin:`Verdien må være større enn eller lik {min}.`,rangeOverflowMax:`Verdien må være mindre enn eller lik {max}.`};function tm(e){if(e&&Qp(e)){let[t,n]=e.split(`:`);return[t,n]}return[``,``]}function nm(e,t){return`${String(parseInt(e,10)).padStart(2,`0`)}:${String(parseInt(t,10)).padStart(2,`0`)}`}function rm(e,t){let{required:n,min:r,max:i,step:a}=t;if(n&&!e)return{valid:!1,message:em.required};if(!e)return{valid:!0};if(!Qp(e))return{valid:!1,message:em.invalid};let o=$p(e),s=Jp(a);return r&&o<$p(String(r))?{valid:!1,message:em.rangeUnderflowMin.replace(`{min}`,String(r))}:i&&o>$p(String(i))?{valid:!1,message:em.rangeOverflowMax.replace(`{max}`,String(i))}:a&&o%s!==0?{valid:!1,message:s===60?em.timeStepMismatchHour:s===30?em.timeStepMismatchHalfHour:em.timeStepMismatch.replace(`{step}`,`${s}, ${s*2}, ${s*3}`)}:{valid:!0}}function im(e){return e===3600||e<3600&&3600%e==0&&e%60==0}function am(e,n){let{id:r,label:i,value:a,defaultValue:o,min:s,max:c,step:l=60,hidePicker:u=!1,stepArrows:d=!1,fullwidth:f=!1,name:p,disabled:m=!1,required:h=!1,helptext:g,helptextDropdown:_,helptextDropdownButton:v,hasError:y=!1,errorMessage:b,optionalTag:x=!1,optionalText:S,requiredTag:C=!1,requiredText:w,tagText:ee,inline:T=!1,useWrapper:E=!0,ariaDescribedby:te,strings:ne,className:re,onValueChange:D,onFocus:ie,onBlur:ae}=e,oe=(0,t.useMemo)(()=>ne??xd,[ne]),se=a!==void 0,ce=a===void 0?o??``:a??``,O=(0,t.useRef)(ce),[le,k]=(0,t.useState)(()=>ce),A=se?a??``:le,[ue,de]=(0,t.useState)(()=>tm(a===void 0?o:a)[0]),[j,M]=(0,t.useState)(()=>tm(a===void 0?o:a)[1]),N=(0,t.useRef)(ue),P=(0,t.useRef)(j),F=(0,t.useCallback)(e=>{N.current=e,de(e)},[]),I=(0,t.useCallback)(e=>{P.current=e,M(e)},[]),[fe,pe]=(0,t.useState)(!1),[L,R]=(0,t.useState)(!1),me=(0,t.useRef)(a);(0,t.useEffect)(()=>{if(!se||a===me.current)return;me.current=a;let[e,t]=tm(a);F(e),I(t)},[a,se,F,I]),(0,t.useEffect)(()=>{l!=null&&!im(l)&&console.warn(`PktTimepicker: step="${l}" er ikke en gyldig verdi. Step må være et multiplum av 60 (hele minutter) eller nøyaktig 3600 (hel time).`)},[l]);let he=(0,t.useRef)(null),z=(0,t.useRef)(null),B=(0,t.useRef)(null),V=(0,t.useRef)(null),ge=(0,t.useRef)(null),H=(0,t.useRef)(null),_e=(0,t.useRef)(0),ve=(0,t.useRef)(-1),U=(0,t.useRef)(0),ye=(0,t.useRef)(-1),[be,xe]=(0,t.useState)(!1),Se=(0,t.useMemo)(()=>Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,`value`)?.set,[]),Ce=(0,t.useMemo)(()=>Jp(l),[l]),we=(0,t.useMemo)(()=>Yp(s,c),[s,c]),Te=(0,t.useMemo)(()=>Xp(l),[l]),Ee=`${r}-hours`,De=`${r}-minutes`,Oe=`${r}-popup`,ke=`${r}-input`;(0,t.useEffect)(()=>{let e=he.current;if(!e)return;let t=rm(A,{required:h,min:s,max:c,step:l});e.setCustomValidity(t.valid?``:t.message??``),R(be&&!t.valid)},[A,h,s,c,l,be]);let Ae=(0,t.useCallback)(e=>{se||k(e);let t=H.current;!t||!Se||(Se.call(t,e),t.dispatchEvent(new Event(`input`,{bubbles:!0})),D?.(e))},[se,Se,D]),je=(0,t.useCallback)(()=>{let e=N.current,t=P.current;if(e!==``&&t!==``){let n=nm(e,t);n!==A&&Ae(n)}else A!==``&&Ae(``)},[A,Ae]),Me=(0,t.useCallback)(()=>{let e=N.current,t=P.current;if(e!==``&&t!==``){let n=nm(e,t);n===A?H.current?.dispatchEvent(new Event(`input`,{bubbles:!0})):Ae(n)}else A===``?H.current?.dispatchEvent(new Event(`input`,{bubbles:!0})):Ae(``)},[A,Ae]),Ne=(0,t.useCallback)(()=>{xe(!0),je();let e=he.current,t=H.current;if(!e)return;let n=rm(t?.value??``,{required:h,min:s,max:c,step:l});e.setCustomValidity(n.valid?``:n.message??``)},[je,h,s,c,l]);(0,t.useEffect)(()=>{let e=ge.current?.closest(`form`);if(!e)return;let t=t=>{let n=t;if(!n||!e.contains(n))return!1;let r=n.closest(`button, input[type="submit"], input[type="image"]`);return!r||!e.contains(r)?!1:r instanceof HTMLButtonElement?r.type!==`button`&&r.type!==`reset`:r instanceof HTMLInputElement},n=e=>{t(e.target)&&Ne()};return e.addEventListener(`pointerdown`,n,!0),()=>e.removeEventListener(`pointerdown`,n,!0)},[Ne]),(0,t.useEffect)(()=>{H.current&&(H.current.value=A)},[A]);let Pe=(0,t.useCallback)(()=>{pe(!1),je()},[je]);(0,t.useLayoutEffect)(()=>{if(!fe)return;let e=V.current;if(!e)return;e.querySelectorAll(`.pkt-timepicker-popup__col`).forEach(e=>{let t=e.querySelector(`.pkt-timepicker-popup__option--selected`);t&&t.scrollIntoView({block:`center`})});let t=e.querySelectorAll(`.pkt-timepicker-popup__col`)[0];if(!t)return;let n=t.querySelector(`.pkt-timepicker-popup__option--selected`),r=t.querySelector(`.pkt-timepicker-popup__option`);(n||r)?.focus()},[fe]),(0,t.useEffect)(()=>{if(!fe)return;let e=e=>{let t=e.target;ge.current&&!ge.current.contains(t)&&Pe()};return document.addEventListener(`click`,e,!0),()=>document.removeEventListener(`click`,e,!0)},[fe,Pe]);let Fe=(0,t.useCallback)(e=>{let t=V.current;if(!t)return;let n=t.querySelectorAll(`.pkt-timepicker-popup__col`),r=e===`hour`?n[0]:n[1];if(!r)return;let i=r.querySelector(`.pkt-timepicker-popup__option--selected`),a=r.querySelector(`.pkt-timepicker-popup__option`);(i||a)?.focus()},[]),Ie=(0,t.useCallback)((e,t)=>{let n=String(e).padStart(2,`0`);if(t===`hour`)F(n),requestAnimationFrame(()=>Fe(`minute`));else{I(n),pe(!1);let e=N.current;e!==``&&Ae(`${e}:${n}`),requestAnimationFrame(()=>B.current?.focus())}},[Ae,Fe,F,I]),Le=(0,t.useCallback)(e=>{let t=Zp(N.current,P.current,e,Ce);F(t.hours),I(t.minutes),`${t.hours}:${t.minutes}`!==A&&Ae(`${t.hours}:${t.minutes}`)},[Ce,A,Ae,F,I]),Re=(0,t.useCallback)(e=>{he.current?.setCustomValidity(``);let t=e.currentTarget,n=P.current;switch(e.key){case`ArrowUp`:{e.preventDefault();let t=N.current===``?0:parseInt(N.current,10),r=String((t+1)%24).padStart(2,`0`);if(F(r),n!==``){let e=`${r}:${n}`;e===A?H.current?.dispatchEvent(new Event(`input`,{bubbles:!0})):Ae(e)}break}case`ArrowDown`:{e.preventDefault();let t=N.current===``?0:parseInt(N.current,10),r=String((t-1+24)%24).padStart(2,`0`);if(F(r),n!==``){let e=`${r}:${n}`;e===A?H.current?.dispatchEvent(new Event(`input`,{bubbles:!0})):Ae(e)}break}case`ArrowRight`:e.preventDefault(),z.current?.focus();break;case`Backspace`:case`Delete`:{e.preventDefault(),_e.current=0,ve.current=-1;let t=N.current;t.length>0&&F(t.slice(0,-1)),Me();break}case`Tab`:break;case`Enter`:{e.preventDefault(),Ne();let n=t.form;n?n.requestSubmit():t.blur();break}default:if(/^\d$/.test(e.key)){e.preventDefault();let t=parseInt(e.key,10);if(_e.current===0)ve.current=t,F(String(t).padStart(2,`0`)),_e.current=1,H.current?.dispatchEvent(new Event(`input`,{bubbles:!0})),t>=3&&(ve.current=-1,_e.current=0,Me(),z.current?.focus());else{let e=ve.current*10+t;F(e<=23?String(e).padStart(2,`0`):String(t).padStart(2,`0`)),ve.current=-1,_e.current=0,Me(),z.current?.focus()}}else e.preventDefault()}},[A,Ae,F,Me,Ne]),ze=(0,t.useCallback)(()=>{xe(!0),N.current!==``&&F(String(parseInt(N.current,10)).padStart(2,`0`)),_e.current=0,ve.current=-1,je()},[F,je]),Be=(0,t.useCallback)(e=>{he.current?.setCustomValidity(``);let t=e.currentTarget,n=N.current;switch(e.key){case`ArrowUp`:{e.preventDefault();let t=P.current===``?0:parseInt(P.current,10),r=String((t+Ce)%60).padStart(2,`0`);if(I(r),n!==``){let e=`${n}:${r}`;e===A?H.current?.dispatchEvent(new Event(`input`,{bubbles:!0})):Ae(e)}break}case`ArrowDown`:{e.preventDefault();let t=P.current===``?0:parseInt(P.current,10),r=String((t-Ce+60)%60).padStart(2,`0`);if(I(r),n!==``){let e=`${n}:${r}`;e===A?H.current?.dispatchEvent(new Event(`input`,{bubbles:!0})):Ae(e)}break}case`ArrowLeft`:e.preventDefault(),he.current?.focus();break;case`Backspace`:case`Delete`:{e.preventDefault(),U.current=0,ye.current=-1;let t=P.current;t.length>0&&I(t.slice(0,-1)),Me();break}case`Tab`:break;case`Enter`:{e.preventDefault(),Ne();let n=t.form;n?n.requestSubmit():t.blur();break}default:if(/^\d$/.test(e.key)){e.preventDefault();let t=parseInt(e.key,10);if(U.current===0)ye.current=t,I(String(t).padStart(2,`0`)),U.current=1,H.current?.dispatchEvent(new Event(`input`,{bubbles:!0})),t>=6&&(ye.current=-1,U.current=0,Me());else{let e=ye.current*10+t;I(e<=59?String(e).padStart(2,`0`):String(t).padStart(2,`0`)),ye.current=-1,U.current=0,Me()}}else e.preventDefault()}},[Ce,A,Ae,I,Me,Ne]),Ve=(0,t.useCallback)(()=>{xe(!0),P.current!==``&&I(String(parseInt(P.current,10)).padStart(2,`0`)),U.current=0,ye.current=-1,je()},[I,je]),He=(0,t.useCallback)(e=>{let t=document.activeElement,n=t.closest(`.pkt-timepicker-popup__col`);if(!n)return;let r=Array.from(n.querySelectorAll(`.pkt-timepicker-popup__option`)),i=r.indexOf(t),a=e=>{if(!e)return;let n=parseInt(e.dataset.value??`0`,10),r=String(n).padStart(2,`0`);t.dataset.type===`hour`?F(r):I(r),e.focus()};switch(e.key){case`ArrowDown`:e.preventDefault(),a(r[Math.min(i+1,r.length-1)]);break;case`ArrowUp`:e.preventDefault(),a(r[Math.max(i-1,0)]);break;case`Home`:e.preventDefault(),a(r[0]);break;case`End`:e.preventDefault(),a(r[r.length-1]);break;case`ArrowRight`:if(e.preventDefault(),t.dataset.type===`hour`){let e=parseInt(t.dataset.value??`0`,10);F(String(e).padStart(2,`0`)),requestAnimationFrame(()=>{V.current?.querySelectorAll(`.pkt-timepicker-popup__col`).forEach(e=>{e.querySelector(`.pkt-timepicker-popup__option--selected`)?.scrollIntoView({block:`center`})}),Fe(`minute`)})}break;case`ArrowLeft`:if(e.preventDefault(),t.dataset.type===`minute`){let e=parseInt(t.dataset.value??`0`,10);I(String(e).padStart(2,`0`)),requestAnimationFrame(()=>{V.current?.querySelectorAll(`.pkt-timepicker-popup__col`).forEach(e=>{e.querySelector(`.pkt-timepicker-popup__option--selected`)?.scrollIntoView({block:`center`})}),Fe(`hour`)})}break;case`Enter`:case` `:e.preventDefault(),t.click();break;case`Escape`:e.preventDefault(),Pe(),B.current?.focus();break;default:break}},[Pe,Fe,F,I]),Ue=(0,t.useCallback)(e=>{let t=V.current;if(!t)return;let n=e.relatedTarget;(!n||!t.contains(n))&&Pe()},[Pe]),W=(0,t.useCallback)(e=>{let t=ge.current;if(!t)return;let n=e.relatedTarget;n&&t.contains(n)||ie?.(e)},[ie]),G=(0,t.useCallback)(e=>{let t=ge.current;if(!t)return;let n=e.relatedTarget;n&&t.contains(n)||ae?.(e)},[ae]),We=(0,t.useCallback)(()=>{m||(fe?Pe():pe(!0))},[m,fe,Pe]);return(0,t.useImperativeHandle)(n,()=>({get value(){return H.current?.value??``},set value(e){let t=e??``;se||k(t);let[n,r]=tm(t);F(n),I(r),H.current&&(H.current.value=t)},focus(){he.current?.focus()},blur(){he.current?.blur()}}),[se,F,I]),(0,t.useEffect)(()=>{let e=ge.current?.closest(`form`);if(!e)return;let t=()=>{window.setTimeout(()=>{let e=O.current,[t,n]=tm(e);F(t),I(n),se||k(e),H.current&&(H.current.value=e),pe(!1),xe(!1)},0)};return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)},[se,F,I]),{id:r,containerRef:ge,outerClasses:[`pkt-timepicker`,f?`pkt-timepicker--fullwidth`:``,d?`pkt-timepicker--stepper`:``,re??``].filter(Boolean).join(` `),strings:oe,label:i,disabled:m,required:h,helptext:g,helptextDropdown:_,helptextDropdownButton:v,hasError:y,isInvalid:L,errorMessage:b,optionalTag:x,optionalText:S,requiredTag:C,requiredText:w,tagText:ee,inline:T,useWrapper:E,ariaDescribedby:te,hidePicker:u,stepArrows:d,min:s,max:c,step:l,hours:ue,minutes:j,hoursId:Ee,minutesId:De,popupId:Oe,hiddenInputId:ke,name:p??r,isOpen:fe,hourOptions:we,minuteOptions:Te,hoursInputRef:he,minutesInputRef:z,buttonRef:B,popupRef:V,changeInputRef:H,handleHoursKeydown:Re,handleHoursBlur:ze,handleMinutesKeydown:Be,handleMinutesBlur:Ve,handlePopupKeydown:He,handlePopupFocusOut:Ue,handleFocusIn:W,handleFocusOut:G,handleOptionClick:Ie,handleClockButtonClick:We,closePopup:Pe,stepTimeDelta:Le,effectiveValue:A}}var om=(0,t.forwardRef)((e,t)=>{let{onChange:r,onInput:i}=e,a=am(e,t),o=a.strings.hours,s=a.strings.minutes,c=a.label?`${o}, ${a.label}`:o,l=a.label?`${s}, ${a.label}`:s,u=(e,t)=>{let r=String(e).padStart(2,`0`),i=e===(t===`hour`?a.hours===``?NaN:parseInt(a.hours,10):a.minutes===``?NaN:parseInt(a.minutes,10));return(0,n.jsx)(`button`,{type:`button`,className:[`pkt-btn`,`pkt-btn--tertiary`,`pkt-btn--small`,`pkt-btn--label-only`,`pkt-timepicker-popup__option`,i?`pkt-timepicker-popup__option--selected`:``].filter(Boolean).join(` `),role:`option`,"aria-selected":i?`true`:`false`,tabIndex:i?0:-1,"data-type":t,"data-value":e,onClick:n=>{n.stopPropagation(),a.handleOptionClick(e,t)},children:(0,n.jsx)(`span`,{className:`pkt-btn__text pkt-txt-14-light`,children:r})},`${t}-${e}`)},d=()=>(0,n.jsxs)(`div`,{ref:a.popupRef,className:`pkt-timepicker-popup`,id:a.popupId,hidden:!a.isOpen,role:`group`,"aria-label":a.strings.selectTime,onKeyDown:a.handlePopupKeydown,onBlur:a.handlePopupFocusOut,children:[(0,n.jsx)(`div`,{className:`pkt-timepicker-popup__col`,role:`listbox`,"aria-label":o,"aria-orientation":`vertical`,children:a.hourOptions.map(e=>u(e,`hour`))}),(0,n.jsx)(`div`,{className:`pkt-timepicker-popup__col`,role:`listbox`,"aria-label":s,"aria-orientation":`vertical`,children:a.minuteOptions.map(e=>u(e,`minute`))})]}),f=()=>(0,n.jsxs)(`div`,{className:`pkt-input__container`,onClick:e=>{e.target.closest(`button, input`)||a.hoursInputRef.current?.focus()},children:[a.stepArrows&&(0,n.jsxs)(`button`,{type:`button`,className:`pkt-input-icon pkt-btn pkt-btn--icon-only pkt-btn--tertiary pkt-timepicker__button pkt-timepicker__button--prev`,"aria-label":a.strings.prevTime,disabled:a.disabled,onClick:()=>a.stepTimeDelta(-1),children:[(0,n.jsx)(Q,{name:`chevron-thin-left`}),(0,n.jsx)(`span`,{className:`pkt-btn__text`,children:a.strings.prevTime})]}),(0,n.jsx)(`input`,{ref:a.hoursInputRef,type:`text`,inputMode:`numeric`,maxLength:2,size:2,className:`pkt-input pkt-timepicker__input`,id:a.hoursId,"data-min":`0`,"data-max":`23`,value:a.hours,placeholder:`––`,"aria-label":c,role:`spinbutton`,"aria-invalid":a.hasError||a.isInvalid||void 0,"aria-valuemin":0,"aria-valuemax":23,"aria-valuenow":a.hours===``?void 0:parseInt(a.hours,10),"aria-valuetext":a.hours===``?void 0:`${a.hours} ${o.toLowerCase()}`,autoComplete:`off`,disabled:a.disabled,onKeyDown:a.handleHoursKeydown,onBlur:a.handleHoursBlur,onFocus:e=>{e.currentTarget.select()},onChange:()=>{},onPaste:e=>e.preventDefault()}),(0,n.jsx)(`span`,{className:`pkt-timepicker__separator`,children:`:`}),(0,n.jsx)(`input`,{ref:a.minutesInputRef,type:`text`,inputMode:`numeric`,maxLength:2,size:2,className:`pkt-input pkt-timepicker__input`,id:a.minutesId,"data-min":`0`,"data-max":`59`,value:a.minutes,placeholder:`––`,"aria-label":l,role:`spinbutton`,"aria-invalid":a.hasError||a.isInvalid||void 0,"aria-valuemin":0,"aria-valuemax":59,"aria-valuenow":a.minutes===``?void 0:parseInt(a.minutes,10),"aria-valuetext":a.minutes===``?void 0:`${a.minutes} ${s.toLowerCase()}`,autoComplete:`off`,disabled:a.disabled,onKeyDown:a.handleMinutesKeydown,onBlur:a.handleMinutesBlur,onFocus:e=>{e.currentTarget.select()},onChange:()=>{},onPaste:e=>e.preventDefault()}),a.hidePicker&&!a.stepArrows&&(0,n.jsx)(Q,{className:`pkt-input-icon pkt-timepicker__icon`,name:`clock`,"aria-hidden":!0}),!a.hidePicker&&!a.stepArrows&&(0,n.jsxs)(`button`,{ref:a.buttonRef,type:`button`,className:`pkt-input-icon pkt-btn pkt-btn--icon-only pkt-btn--tertiary pkt-timepicker__button`,"aria-label":a.strings.openPicker,"aria-haspopup":`listbox`,"aria-expanded":a.isOpen,"aria-controls":a.popupId,disabled:a.disabled,onClick:a.handleClockButtonClick,children:[(0,n.jsx)(Q,{name:`clock`}),(0,n.jsx)(`span`,{className:`pkt-btn__text`,children:a.strings.openPicker})]}),a.stepArrows&&(0,n.jsxs)(`button`,{type:`button`,className:`pkt-input-icon pkt-btn pkt-btn--icon-only pkt-btn--tertiary pkt-timepicker__button pkt-timepicker__button--next`,"aria-label":a.strings.nextTime,disabled:a.disabled,onClick:()=>a.stepTimeDelta(1),children:[(0,n.jsx)(Q,{name:`chevron-thin-right`}),(0,n.jsx)(`span`,{className:`pkt-btn__text`,children:a.strings.nextTime})]}),(0,n.jsx)(`input`,{ref:a.changeInputRef,type:`time`,hidden:!0,name:a.name,id:a.hiddenInputId,disabled:a.disabled,tabIndex:-1,"aria-hidden":!0,onChange:r,onInput:i})]});return(0,n.jsx)(`div`,{ref:a.containerRef,className:a.outerClasses,id:a.id||void 0,onFocus:a.handleFocusIn,onBlur:a.handleFocusOut,children:(0,n.jsx)(Au,{forId:a.hoursId,label:a.label,disabled:a.disabled,hasError:a.hasError,inline:a.inline,optionalTag:a.optionalTag,optionalText:a.optionalText,requiredTag:a.requiredTag,requiredText:a.requiredText,useWrapper:a.useWrapper,ariaDescribedby:a.ariaDescribedby,errorMessage:a.errorMessage,helptext:a.helptext,helptextDropdown:a.helptextDropdown,helptextDropdownButton:a.helptextDropdownButton,tagText:a.tagText,children:!a.hidePicker&&!a.stepArrows?(0,n.jsxs)(`div`,{className:`pkt-timepicker__anchor`,children:[f(),d()]}):f()})})});om.displayName=`PktTimepicker`,e.FileItem=Ud,e.ItemRenderers=Vf,e.PktAccordion=_,e.PktAccordionItem=oc,e.PktAlert=sc,e.PktBackLink=cc,e.PktBreadcrumbs=lc,e.PktButton=uc,e.PktCalendar=Tu,e.PktCard=Du,e.PktCheckbox=Ou,e.PktCombobox=td,e.PktConsent=nd,e.PktDatepicker=yd,e.PktFileUpload=Hf,e.PktFooter=Uf,e.PktFooterSimple=Wf,e.PktHeader=ep,e.PktHeaderMenu=lp,e.PktHeaderService=$f,e.PktHeading=yp,e.PktHelptext=xp,e.PktIcon=Q,e.PktInput=Sp,e.PktInputWrapper=Au,e.PktLink=qf,e.PktLinkCard=Cp,e.PktLoader=Tp,e.PktMessagebox=Ep,e.PktModal=vf,e.PktProgressbar=kp,e.PktRadioButton=Ap,e.PktSearchInput=jp,e.PktSelect=Mp,e.PktStep=Ip,e.PktStepper=Lp,e.PktTabItem=Wp,e.PktTable=Rp,e.PktTableBody=zp,e.PktTableDataCell=Bp,e.PktTableHeader=Vp,e.PktTableHeaderCell=Hp,e.PktTableRow=Up,e.PktTabs=qp,e.PktTag=Eu,e.PktTextarea=qd,e.PktTextinput=Qf,e.PktTimepicker=om});