@oslokommune/punkt-react 16.5.1 → 16.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/index.d.ts +22 -6
- package/dist/punkt-react.es.js +3138 -3055
- package/dist/punkt-react.umd.js +109 -107
- package/package.json +3 -3
- package/src/components/progressbar/Progressbar.test.tsx +49 -47
- package/src/components/progressbar/Progressbar.tsx +135 -20
package/dist/punkt-react.umd.js
CHANGED
|
@@ -33,71 +33,71 @@
|
|
|
33
33
|
return [];
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
(function(W,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("react/jsx-runtime"),require("react"),require("react-router-dom")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","react-router-dom"],o):(W=typeof globalThis<"u"?globalThis:W||self,o(W["punkt-react"]={},W.ReactJsxRuntime,W.React,W.ReactRouterDOM))})(this,(function(W,o,d,
|
|
36
|
+
(function(W,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("react/jsx-runtime"),require("react"),require("react-router-dom")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","react-router-dom"],o):(W=typeof globalThis<"u"?globalThis:W||self,o(W["punkt-react"]={},W.ReactJsxRuntime,W.React,W.ReactRouterDOM))})(this,(function(W,o,d,ic){"use strict";var Eb=Object.defineProperty;var Pb=(W,o,d)=>o in W?Eb(W,o,{enumerable:!0,configurable:!0,writable:!0,value:d}):W[o]=d;var tr=(W,o,d)=>Pb(W,typeof o!="symbol"?o+"":o,d);const aa=d.createContext({}),rc=()=>d.useContext(aa),oa=d.forwardRef(({compact:s=!1,skin:e="borderless",ariaLabelledBy:t,children:n,name:i,className:r},a)=>{const l=["pkt-accordion",s&&"pkt-accordion--compact",e&&`pkt-accordion--${e}`,r].filter(Boolean).join(" ");return o.jsx(aa.Provider,{value:{name:i},children:o.jsx("div",{ref:a,className:l,"data-testid":"pkt-accordion","aria-labelledby":t||void 0,children:n})})});oa.displayName="PktAccordion";/**
|
|
37
37
|
* @license
|
|
38
38
|
* Copyright 2018 Google LLC
|
|
39
39
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
40
|
-
*/const
|
|
40
|
+
*/const ac=new Set(["children","localName","ref","style","className"]),la=new WeakMap,ca=(s,e,t,n,i)=>{const r=i==null?void 0:i[e];r===void 0?(s[e]=t,t==null&&e in HTMLElement.prototype&&s.removeAttribute(e)):t!==n&&((a,l,c)=>{let h=la.get(a);h===void 0&&la.set(a,h=new Map);let m=h.get(l);c!==void 0?m===void 0?(h.set(l,m={handleEvent:c}),a.addEventListener(l,m)):m.handleEvent=c:m!==void 0&&(h.delete(l),a.removeEventListener(l,m))})(s,r,t)},xn=({react:s,tagName:e,elementClass:t,events:n,displayName:i})=>{const r=new Set(Object.keys(n??{})),a=s.forwardRef(((l,c)=>{const h=s.useRef(new Map),m=s.useRef(null),g={},f={};for(const[k,v]of Object.entries(l))ac.has(k)?g[k==="className"?"class":k]=v:r.has(k)||k in t.prototype?f[k]=v:g[k]=v;return s.useLayoutEffect((()=>{if(m.current===null)return;const k=new Map;for(const v in f)ca(m.current,v,l[v],h.current.get(v),n),h.current.delete(v),k.set(v,l[v]);for(const[v,$]of h.current)ca(m.current,v,void 0,$,n);h.current=k})),s.useLayoutEffect((()=>{var k;(k=m.current)==null||k.removeAttribute("defer-hydration")}),[]),g.suppressHydrationWarning=!0,s.createElement(e,{...g,ref:s.useCallback((k=>{m.current=k,typeof c=="function"?c(k):c!==null&&(c.current=k)}),[c])})}));return a.displayName=i??t.name,a};/**
|
|
41
41
|
* @license
|
|
42
42
|
* Copyright 2017 Google LLC
|
|
43
43
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
44
|
-
*/const gi=globalThis,ua=s=>s,mi=gi.trustedTypes,da=mi?mi.createPolicy("lit-html",{createHTML:s=>s}):void 0,ha="$lit$",ms=`lit$${Math.random().toFixed(9).slice(2)}$`,pa="?"+ms,
|
|
44
|
+
*/const gi=globalThis,ua=s=>s,mi=gi.trustedTypes,da=mi?mi.createPolicy("lit-html",{createHTML:s=>s}):void 0,ha="$lit$",ms=`lit$${Math.random().toFixed(9).slice(2)}$`,pa="?"+ms,oc=`<${pa}>`,Os=document,Cn=()=>Os.createComment(""),Sn=s=>s===null||typeof s!="object"&&typeof s!="function",sr=Array.isArray,lc=s=>sr(s)||typeof(s==null?void 0:s[Symbol.iterator])=="function",nr=`[
|
|
45
45
|
\f\r]`,Tn=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,fa=/-->/g,ga=/>/g,Es=RegExp(`>|${nr}(?:([^\\s"'>=/]+)(${nr}*=${nr}*(?:[^
|
|
46
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),ma=/'/g,ba=/"/g,va=/^(?:script|style|textarea|title)$/i,
|
|
46
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),ma=/'/g,ba=/"/g,va=/^(?:script|style|textarea|title)$/i,cc=s=>(e,...t)=>({_$litType$:s,strings:e,values:t}),y=cc(1),lt=Symbol.for("lit-noChange"),C=Symbol.for("lit-nothing"),ka=new WeakMap,Ps=Os.createTreeWalker(Os,129);function ya(s,e){if(!sr(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return da!==void 0?da.createHTML(e):e}const uc=(s,e)=>{const t=s.length-1,n=[];let i,r=e===2?"<svg>":e===3?"<math>":"",a=Tn;for(let l=0;l<t;l++){const c=s[l];let h,m,g=-1,f=0;for(;f<c.length&&(a.lastIndex=f,m=a.exec(c),m!==null);)f=a.lastIndex,a===Tn?m[1]==="!--"?a=fa:m[1]!==void 0?a=ga:m[2]!==void 0?(va.test(m[2])&&(i=RegExp("</"+m[2],"g")),a=Es):m[3]!==void 0&&(a=Es):a===Es?m[0]===">"?(a=i??Tn,g=-1):m[1]===void 0?g=-2:(g=a.lastIndex-m[2].length,h=m[1],a=m[3]===void 0?Es:m[3]==='"'?ba:ma):a===ba||a===ma?a=Es:a===fa||a===ga?a=Tn:(a=Es,i=void 0);const k=a===Es&&s[l+1].startsWith("/>")?" ":"";r+=a===Tn?c+oc:g>=0?(n.push(h),c.slice(0,g)+ha+c.slice(g)+ms+k):c+ms+(g===-2?l:k)}return[ya(s,r+(s[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]};let ir=class tc{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let r=0,a=0;const l=e.length-1,c=this.parts,[h,m]=uc(e,t);if(this.el=tc.createElement(h,n),Ps.currentNode=this.el.content,t===2||t===3){const g=this.el.content.firstChild;g.replaceWith(...g.childNodes)}for(;(i=Ps.nextNode())!==null&&c.length<l;){if(i.nodeType===1){if(i.hasAttributes())for(const g of i.getAttributeNames())if(g.endsWith(ha)){const f=m[a++],k=i.getAttribute(g).split(ms),v=/([.?@])?(.*)/.exec(f);c.push({type:1,index:r,name:v[2],strings:k,ctor:v[1]==="."?hc:v[1]==="?"?pc:v[1]==="@"?fc:vi}),i.removeAttribute(g)}else g.startsWith(ms)&&(c.push({type:6,index:r}),i.removeAttribute(g));if(va.test(i.tagName)){const g=i.textContent.split(ms),f=g.length-1;if(f>0){i.textContent=mi?mi.emptyScript:"";for(let k=0;k<f;k++)i.append(g[k],Cn()),Ps.nextNode(),c.push({type:2,index:++r});i.append(g[f],Cn())}}}else if(i.nodeType===8)if(i.data===pa)c.push({type:2,index:r});else{let g=-1;for(;(g=i.data.indexOf(ms,g+1))!==-1;)c.push({type:7,index:r}),g+=ms.length-1}r++}}static createElement(e,t){const n=Os.createElement("template");return n.innerHTML=e,n}};function Js(s,e,t=s,n){var i,r;if(e===lt)return e;let a=n!==void 0?(i=t._$Co)==null?void 0:i[n]:t._$Cl;const l=Sn(e)?void 0:e._$litDirective$;return(a==null?void 0:a.constructor)!==l&&((r=a==null?void 0:a._$AO)==null||r.call(a,!1),l===void 0?a=void 0:(a=new l(s),a._$AT(s,t,n)),n!==void 0?(t._$Co??(t._$Co=[]))[n]=a:t._$Cl=a),a!==void 0&&(e=Js(s,a._$AS(s,e.values),a,n)),e}let dc=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:n}=this._$AD,i=((e==null?void 0:e.creationScope)??Os).importNode(t,!0);Ps.currentNode=i;let r=Ps.nextNode(),a=0,l=0,c=n[0];for(;c!==void 0;){if(a===c.index){let h;c.type===2?h=new bi(r,r.nextSibling,this,e):c.type===1?h=new c.ctor(r,c.name,c.strings,this,e):c.type===6&&(h=new gc(r,this,e)),this._$AV.push(h),c=n[++l]}a!==(c==null?void 0:c.index)&&(r=Ps.nextNode(),a++)}return Ps.currentNode=Os,i}p(e){let t=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},bi=class sc{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=C,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=(i==null?void 0:i.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Js(this,e,t),Sn(e)?e===C||e==null||e===""?(this._$AH!==C&&this._$AR(),this._$AH=C):e!==this._$AH&&e!==lt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):lc(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==C&&Sn(this._$AH)?this._$AA.nextSibling.data=e:this.T(Os.createTextNode(e)),this._$AH=e}$(e){var t;const{values:n,_$litType$:i}=e,r=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=ir.createElement(ya(i.h,i.h[0]),this.options)),i);if(((t=this._$AH)==null?void 0:t._$AD)===r)this._$AH.p(n);else{const a=new dc(r,this),l=a.u(this.options);a.p(n),this.T(l),this._$AH=a}}_$AC(e){let t=ka.get(e.strings);return t===void 0&&ka.set(e.strings,t=new ir(e)),t}k(e){sr(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,i=0;for(const r of e)i===t.length?t.push(n=new sc(this.O(Cn()),this.O(Cn()),this,this.options)):n=t[i],n._$AI(r),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){var n;for((n=this._$AP)==null?void 0:n.call(this,!1,!0,t);e!==this._$AB;){const i=ua(e).nextSibling;ua(e).remove(),e=i}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}},vi=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,r){this.type=1,this._$AH=C,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=r,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=C}_$AI(e,t=this,n,i){const r=this.strings;let a=!1;if(r===void 0)e=Js(this,e,t,0),a=!Sn(e)||e!==this._$AH&&e!==lt,a&&(this._$AH=e);else{const l=e;let c,h;for(e=r[0],c=0;c<r.length-1;c++)h=Js(this,l[n+c],t,c),h===lt&&(h=this._$AH[c]),a||(a=!Sn(h)||h!==this._$AH[c]),h===C?e=C:e!==C&&(e+=(h??"")+r[c+1]),this._$AH[c]=h}a&&!i&&this.j(e)}j(e){e===C?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},hc=class extends vi{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===C?void 0:e}},pc=class extends vi{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==C)}},fc=class extends vi{constructor(e,t,n,i,r){super(e,t,n,i,r),this.type=5}_$AI(e,t=this){if((e=Js(this,e,t,0)??C)===lt)return;const n=this._$AH,i=e===C&&n!==C||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,r=e!==C&&(n===C||i);i&&this.element.removeEventListener(this.name,this,n),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}},gc=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Js(this,e)}};const mc={I:bi},_a=gi.litHtmlPolyfillSupport;_a==null||_a(ir,bi),(gi.litHtmlVersions??(gi.litHtmlVersions=[])).push("3.3.2");const bc=(s,e,t)=>{const n=(t==null?void 0:t.renderBefore)??e;let i=n._$litPart$;if(i===void 0){const r=(t==null?void 0:t.renderBefore)??null;n._$litPart$=i=new bi(e.insertBefore(Cn(),r),r,void 0,t??{})}return i._$AI(s),i};/**
|
|
47
47
|
* @license
|
|
48
48
|
* Copyright 2017 Google LLC
|
|
49
49
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
50
|
-
*/const
|
|
50
|
+
*/const fe=s=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(s,e)}):customElements.define(s,e)};/**
|
|
51
51
|
* @license
|
|
52
52
|
* Copyright 2019 Google LLC
|
|
53
53
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
54
|
-
*/const ki=globalThis,rr=ki.ShadowRoot&&(ki.ShadyCSS===void 0||ki.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,wa=Symbol(),$a=new WeakMap;let
|
|
54
|
+
*/const ki=globalThis,rr=ki.ShadowRoot&&(ki.ShadyCSS===void 0||ki.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,wa=Symbol(),$a=new WeakMap;let vc=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==wa)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(rr&&e===void 0){const n=t!==void 0&&t.length===1;n&&(e=$a.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&$a.set(t,e))}return e}toString(){return this.cssText}};const kc=s=>new vc(typeof s=="string"?s:s+"",void 0,wa),yc=(s,e)=>{if(rr)s.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const n=document.createElement("style"),i=ki.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,s.appendChild(n)}},xa=rr?s=>s:s=>s instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return kc(t)})(s):s;/**
|
|
55
55
|
* @license
|
|
56
56
|
* Copyright 2017 Google LLC
|
|
57
57
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
58
|
-
*/const{is:
|
|
58
|
+
*/const{is:_c,defineProperty:wc,getOwnPropertyDescriptor:$c,getOwnPropertyNames:xc,getOwnPropertySymbols:Cc,getPrototypeOf:Sc}=Object,Rs=globalThis,Ca=Rs.trustedTypes,Tc=Ca?Ca.emptyScript:"",Sa=Rs.reactiveElementPolyfillSupport,Nn=(s,e)=>s,yi={toAttribute(s,e){switch(e){case Boolean:s=s?Tc:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,e){let t=s;switch(e){case Boolean:t=s!==null;break;case Number:t=s===null?null:Number(s);break;case Object:case Array:try{t=JSON.parse(s)}catch{t=null}}return t}},ar=(s,e)=>!_c(s,e),Ta={attribute:!0,type:String,converter:yi,reflect:!1,useDefault:!1,hasChanged:ar};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Rs.litPropertyMetadata??(Rs.litPropertyMetadata=new WeakMap);let en=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Ta){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&wc(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:r}=$c(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:i,set(a){const l=i==null?void 0:i.call(this);r==null||r.call(this,a),this.requestUpdate(e,l,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Ta}static _$Ei(){if(this.hasOwnProperty(Nn("elementProperties")))return;const e=Sc(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Nn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Nn("properties"))){const t=this.properties,n=[...xc(t),...Cc(t)];for(const i of n)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(const[t,n]of this.elementProperties){const i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const i of n)t.unshift(xa(i))}else e!==void 0&&t.push(xa(e));return t}static _$Eu(e,t){const n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$EO)==null||t.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return yc(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(t=>{var n;return(n=t.hostConnected)==null?void 0:n.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var n;return(n=t.hostDisconnected)==null?void 0:n.call(t)})}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){var n;const i=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,i);if(r!==void 0&&i.reflect===!0){const a=(((n=i.converter)==null?void 0:n.toAttribute)!==void 0?i.converter:yi).toAttribute(t,i.type);this._$Em=e,a==null?this.removeAttribute(r):this.setAttribute(r,a),this._$Em=null}}_$AK(e,t){var n,i;const r=this.constructor,a=r._$Eh.get(e);if(a!==void 0&&this._$Em!==a){const l=r.getPropertyOptions(a),c=typeof l.converter=="function"?{fromAttribute:l.converter}:((n=l.converter)==null?void 0:n.fromAttribute)!==void 0?l.converter:yi;this._$Em=a;const h=c.fromAttribute(t,l.type);this[a]=h??((i=this._$Ej)==null?void 0:i.get(a))??h,this._$Em=null}}requestUpdate(e,t,n,i=!1,r){var a;if(e!==void 0){const l=this.constructor;if(i===!1&&(r=this[e]),n??(n=l.getPropertyOptions(e)),!((n.hasChanged??ar)(r,t)||n.useDefault&&n.reflect&&r===((a=this._$Ej)==null?void 0:a.get(e))&&!this.hasAttribute(l._$Eu(e,n))))return;this.C(e,t,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:i,wrapped:r},a){n&&!(this._$Ej??(this._$Ej=new Map)).has(e)&&(this._$Ej.set(e,a??t??this[e]),r!==!0||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??(this._$Eq=new Set)).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[r,a]of this._$Ep)this[r]=a;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[r,a]of i){const{wrapped:l}=a,c=this[r];l!==!0||this._$AL.has(r)||c===void 0||this.C(r,void 0,a,c)}}let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),(e=this._$EO)==null||e.forEach(i=>{var r;return(r=i.hostUpdate)==null?void 0:r.call(i)}),this.update(n)):this._$EM()}catch(i){throw t=!1,this._$EM(),i}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(n=>{var i;return(i=n.hostUpdated)==null?void 0:i.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}};en.elementStyles=[],en.shadowRootOptions={mode:"open"},en[Nn("elementProperties")]=new Map,en[Nn("finalized")]=new Map,Sa==null||Sa({ReactiveElement:en}),(Rs.reactiveElementVersions??(Rs.reactiveElementVersions=[])).push("2.1.2");/**
|
|
59
59
|
* @license
|
|
60
60
|
* Copyright 2017 Google LLC
|
|
61
61
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
62
|
-
*/const
|
|
62
|
+
*/const Nc={attribute:!0,type:String,converter:yi,reflect:!1,hasChanged:ar},Mc=(s=Nc,e,t)=>{const{kind:n,metadata:i}=t;let r=globalThis.litPropertyMetadata.get(i);if(r===void 0&&globalThis.litPropertyMetadata.set(i,r=new Map),n==="setter"&&((s=Object.create(s)).wrapped=!0),r.set(t.name,s),n==="accessor"){const{name:a}=t;return{set(l){const c=e.get.call(this);e.set.call(this,l),this.requestUpdate(a,c,s,!0,l)},init(l){return l!==void 0&&this.C(a,void 0,s,l),l}}}if(n==="setter"){const{name:a}=t;return function(l){const c=this[a];e.call(this,l),this.requestUpdate(a,c,s,!0,l)}}throw Error("Unsupported decorator location: "+n)};function u(s){return(e,t)=>typeof t=="object"?Mc(s,e,t):((n,i,r)=>{const a=i.hasOwnProperty(r);return i.constructor.createProperty(r,n),a?Object.getOwnPropertyDescriptor(i,r):void 0})(s,e,t)}/**
|
|
63
63
|
* @license
|
|
64
64
|
* Copyright 2017 Google LLC
|
|
65
65
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
66
|
-
*/const Mn=globalThis;let
|
|
66
|
+
*/const Mn=globalThis;let tn=class extends en{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;const t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=bc(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)==null||e.setConnected(!1)}render(){return lt}};var Na;tn._$litElement$=!0,tn.finalized=!0,(Na=Mn.litElementHydrateSupport)==null||Na.call(Mn,{LitElement:tn});const Ma=Mn.litElementPolyfillSupport;Ma==null||Ma({LitElement:tn}),(Mn.litElementVersions??(Mn.litElementVersions=[])).push("4.2.2");const Dc={hi:"Hei!"},Oc={from:"Fra",to:"Til"},Ec={buttonAltText:"Åpne kalender",deleteDate:"Fjern dato"},Pc={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"],monthsShort:["Jan","Feb","Mar","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Des"],week:"Uke",prevMonth:"Forrige måned",nextMonth:"Neste måned"},Ac={search:{placeholder:"Søk…"},labels:{optional:"Valgfritt",required:"Må fylles ut"},messages:{required:"Dette feltet er påkrevd",invalid:"Ugyldig verdi",invalidPattern:"Ugyldig format",tooShort:"For kort",tooLong:"For lang",rangeUnderflow:"For lav verdi",rangeOverflow:"For høy verdi",rangeUnderflowMin:"Verdien må være større enn eller lik {min}.",rangeOverflowMax:"Verdien må være mindre enn eller lik {max}.",dateUnderflow:"For tidlig dato",dateOverflow:"For sen dato"},helptext:{helptextDropdownButton:"Les mer"},date:{multiple:"Her kan du velge flere datoer. Trykk komma eller enter når du har skrevet inn en dato."}},$t={example:Dc,generic:Oc,calendar:Ec,dates:Pc,forms:Ac};var Ic=Object.defineProperty,Da=(s,e,t,n)=>{for(var i=void 0,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=a(e,t,i)||i);return i&&Ic(e,t,i),i};let _i=class extends tn{constructor(){super(...arguments),this.strings=$t,this.role=null}hotReplacedCallback(){this.requestUpdate()}};Da([u({type:Object})],_i.prototype,"strings"),Da([u({type:String})],_i.prototype,"role");let At=class extends _i{createRenderRoot(){return this}};/**
|
|
67
67
|
* @license
|
|
68
68
|
* Copyright 2017 Google LLC
|
|
69
69
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
70
|
-
*/const It={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4},bs=s=>(...e)=>({_$litDirective$:s,values:e});let
|
|
70
|
+
*/const It={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4},bs=s=>(...e)=>({_$litDirective$:s,values:e});let sn=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};/**
|
|
71
71
|
* @license
|
|
72
72
|
* Copyright 2018 Google LLC
|
|
73
73
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
74
|
-
*/const
|
|
74
|
+
*/const X=bs(class extends sn{constructor(s){var e;if(super(s),s.type!==It.ATTRIBUTE||s.name!=="class"||((e=s.strings)==null?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(s){return" "+Object.keys(s).filter(e=>s[e]).join(" ")+" "}update(s,[e]){var t,n;if(this.st===void 0){this.st=new Set,s.strings!==void 0&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter(r=>r!=="")));for(const r in e)e[r]&&!((t=this.nt)!=null&&t.has(r))&&this.st.add(r);return this.render(e)}const i=s.element.classList;for(const r of this.st)r in e||(i.remove(r),this.st.delete(r));for(const r in e){const a=!!e[r];a===this.st.has(r)||(n=this.nt)!=null&&n.has(r)||(a?(i.add(r),this.st.add(r)):(i.remove(r),this.st.delete(r)))}return lt}});/**
|
|
75
75
|
* @license
|
|
76
76
|
* Copyright 2017 Google LLC
|
|
77
77
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
78
|
-
*/function
|
|
78
|
+
*/function he(s){return u({...s,state:!0,attribute:!1})}/**
|
|
79
79
|
* @license
|
|
80
80
|
* Copyright 2020 Google LLC
|
|
81
81
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
82
|
-
*/const{I:
|
|
82
|
+
*/const{I:Lc}=mc,Oa=s=>s,Ea=s=>s.strings===void 0,Pa=()=>document.createComment(""),Dn=(s,e,t)=>{var n;const i=s._$AA.parentNode,r=e===void 0?s._$AB:e._$AA;if(t===void 0){const a=i.insertBefore(Pa(),r),l=i.insertBefore(Pa(),r);t=new Lc(a,l,s,s.options)}else{const a=t._$AB.nextSibling,l=t._$AM,c=l!==s;if(c){let h;(n=t._$AQ)==null||n.call(t,s),t._$AM=s,t._$AP!==void 0&&(h=s._$AU)!==l._$AU&&t._$AP(h)}if(a!==r||c){let h=t._$AA;for(;h!==a;){const m=Oa(h).nextSibling;Oa(i).insertBefore(h,r),h=m}}}return t},As=(s,e,t=s)=>(s._$AI(e,t),s),Bc={},Aa=(s,e=Bc)=>s._$AH=e,Fc=s=>s._$AH,or=s=>{s._$AR(),s._$AA.remove()};/**
|
|
83
83
|
* @license
|
|
84
84
|
* Copyright 2017 Google LLC
|
|
85
85
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
86
|
-
*/const On=(s,e)=>{var t;const n=s._$AN;if(n===void 0)return!1;for(const i of n)(t=i._$AO)==null||t.call(i,e,!1),On(i,e);return!0},wi=s=>{let e,t;do{if((e=s._$AM)===void 0)break;t=e._$AN,t.delete(s),s=e}while((t==null?void 0:t.size)===0)},Ia=s=>{for(let e;e=s._$AM;s=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(s))break;t.add(s),
|
|
86
|
+
*/const On=(s,e)=>{var t;const n=s._$AN;if(n===void 0)return!1;for(const i of n)(t=i._$AO)==null||t.call(i,e,!1),On(i,e);return!0},wi=s=>{let e,t;do{if((e=s._$AM)===void 0)break;t=e._$AN,t.delete(s),s=e}while((t==null?void 0:t.size)===0)},Ia=s=>{for(let e;e=s._$AM;s=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(s))break;t.add(s),Uc(e)}};function Vc(s){this._$AN!==void 0?(wi(this),this._$AM=s,Ia(this)):this._$AM=s}function Hc(s,e=!1,t=0){const n=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(e)if(Array.isArray(n))for(let r=t;r<n.length;r++)On(n[r],!1),wi(n[r]);else n!=null&&(On(n,!1),wi(n));else On(this,s)}const Uc=s=>{s.type==It.CHILD&&(s._$AP??(s._$AP=Hc),s._$AQ??(s._$AQ=Vc))};let La=class extends sn{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),Ia(this),this.isConnected=e._$AU}_$AO(e,t=!0){var n,i;e!==this.isConnected&&(this.isConnected=e,e?(n=this.reconnected)==null||n.call(this):(i=this.disconnected)==null||i.call(this)),t&&(On(this,e),wi(this))}setValue(e){if(Ea(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}};function Ba(s){return s.classList&&(s.classList.contains("_dialog_overlay")||s.classList.contains("backdrop"))?!0:typeof s.hasAttribute=="function"&&s.hasAttribute("data-skip")}function En(s){return s.nodeName==="OPTION"||s.nodeName==="DATA"}function Fa(s){var e;return s.nodeType===Node.TEXT_NODE&&((e=s.nodeValue)==null?void 0:e.trim())!==""}const Va=new WeakMap;function lr(s){let e=Va.get(s);return e||(e=new jc(s),Va.set(s,e)),e}const cr=Symbol("default");function ur(s){return s===void 0?cr:s}function Ha(s,e){if(s.nodeType===Node.COMMENT_NODE)return!1;if(s.nodeType===Node.TEXT_NODE)return Fa(s)?(dr(e,cr,s),!0):!1;if(s.nodeType===Node.ELEMENT_NODE){const t=s;if(Ba(t)||En(t))return!1;if(t instanceof HTMLTemplateElement){const r=Array.from(t.content.childNodes),a=ur(t.getAttribute("slot")??void 0);for(const l of r)dr(e,a,l);return!0}const n=t.getAttribute("slot"),i=n!==null?ur(n):cr;return dr(e,i,s),!0}return!1}function dr(s,e,t){let n=s.get(e);n||(n=[],s.set(e,n)),n.push(t)}const Ua=class nc{constructor(e){this.observer=null,this.nodesBySlot=new Map,this.directives=new Set,this.observing=!1,this.trackedNodes=new Set,this.generation=0,this.initialCollectionDone=!1,this.processingMutations=!1,this.placeholderToNode=new Map,this.nodeToPlaceholder=new Map,this.host=e}collectNodes(){if(this.initialCollectionDone)return;this.initialCollectionDone=!0,this.generation++;const e=Array.from(this.host.childNodes);for(const t of e)Ha(t,this.nodesBySlot)&&this.trackedNodes.add(t)}addDirective(e){this.directives.add(e),this.startObserving()}removeDirective(e){this.directives.delete(e),this.directives.size===0&&this.stopObserving()}getNodes(e){return this.nodesBySlot.get(ur(e))??[]}hasContent(e){return this.getNodes(e).length>0}ensurePlaceholder(e){if(this.nodeToPlaceholder.has(e)||e.parentNode!==this.host)return;const t=document.createComment(nc.PLACEHOLDER_PREFIX);this.host.insertBefore(t,e),this.placeholderToNode.set(t,e),this.nodeToPlaceholder.set(e,t)}startObserving(){this.observing||(this.observing=!0,setTimeout(()=>{this.observing&&(this.observer=new MutationObserver(e=>{this.handleMutations(e)}),this.observer.observe(this.host,{childList:!0}))},0))}stopObserving(){var e;this.observing&&(this.observing=!1,(e=this.observer)==null||e.disconnect(),this.observer=null)}handleMutations(e){var t,n,i;if(this.processingMutations)return;this.processingMutations=!0;let r=!1;for(const a of e)if(a.target===this.host){for(const l of a.removedNodes){const c=this.placeholderToNode.get(l);if(c){(t=c.parentNode)==null||t.removeChild(c),this.trackedNodes.delete(c),this.removeFromSlots(c),this.placeholderToNode.delete(l),this.nodeToPlaceholder.delete(c),r=!0;continue}if(this.trackedNodes.has(l)){this.trackedNodes.delete(l),this.removeFromSlots(l);const h=this.nodeToPlaceholder.get(l);h&&((n=h.parentNode)==null||n.removeChild(h),this.placeholderToNode.delete(h),this.nodeToPlaceholder.delete(l)),r=!0}}for(const l of a.addedNodes)this.placeholderToNode.has(l)||!this.trackedNodes.has(l)&&this.isUserContent(l)&&Ha(l,this.nodesBySlot)&&(this.trackedNodes.add(l),r=!0)}r&&(this.generation++,this.notifyDirectives()),(i=this.observer)==null||i.takeRecords(),this.processingMutations=!1}isUserContent(e){if(e.nodeType===Node.COMMENT_NODE)return!1;if(e.nodeType===Node.TEXT_NODE)return Fa(e);if(e.nodeType===Node.ELEMENT_NODE){const t=e;return!(Ba(t)||En(t))}return!1}removeFromSlots(e){for(const[t,n]of this.nodesBySlot){const i=n.indexOf(e);if(i!==-1){n.splice(i,1),n.length===0&&this.nodesBySlot.delete(t);return}}}notifyDirectives(){for(const e of this.directives)e.handleNodesChanged()}};Ua.PLACEHOLDER_PREFIX="pkt-slot";let jc=Ua;const ze=bs(class extends La{constructor(e){if(super(e),this.manager=null,this.lastGeneration=-1,e.type!==It.CHILD)throw new Error("slotContent() can only be used in child expressions")}render(e,t){return lt}update(e,[t,n]){return this.slotName=n,this.manager||(this.manager=lr(t),this.manager.collectNodes(),this.manager.addDirective(this)),this.ensurePlaceholders(),this.getNodesOrNoChange()}handleNodesChanged(){if(!this.isConnected||!this.manager)return;this.ensurePlaceholders();const e=this.getNodesOrNoChange();e!==lt&&this.setValue(e)}ensurePlaceholders(){if(!this.manager)return;const e=this.manager.getNodes(this.slotName);for(const t of e)this.manager.ensurePlaceholder(t)}disconnected(){var e;(e=this.manager)==null||e.removeDirective(this),this.manager=null,this.lastGeneration=-1}reconnected(){}getNodesOrNoChange(){if(!this.manager)return lt;const e=this.manager.generation;return e===this.lastGeneration?lt:(this.lastGeneration=e,this.manager.getNodes(this.slotName))}});let pt=class extends At{connectedCallback(){lr(this).collectNodes(),super.connectedCallback()}hasSlotContent(e){return lr(this).hasContent(e)}};function ja(s,e,t){const n=s.getAttribute("class")||"",i=new Set(n.split(/\s+/).filter(Boolean));t?i.add(e):i.delete(e),s.setAttribute("class",Array.from(i).join(" "))}/**
|
|
87
87
|
* @license
|
|
88
88
|
* Copyright 2017 Google LLC
|
|
89
89
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
90
|
-
*/let $i=class extends
|
|
90
|
+
*/let $i=class extends sn{constructor(e){if(super(e),this.it=C,e.type!==It.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===C||e==null)return this._t=void 0,this.it=e;if(e===lt)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};$i.directiveName="unsafeHTML",$i.resultType=1;const xi=bs($i);/**
|
|
91
91
|
* @license
|
|
92
92
|
* Copyright 2017 Google LLC
|
|
93
93
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
94
|
-
*/let hr=class extends $i{};hr.directiveName="unsafeSVG",hr.resultType=2;const pr=bs(hr);var
|
|
94
|
+
*/let hr=class extends $i{};hr.directiveName="unsafeSVG",hr.resultType=2;const pr=bs(hr);var qc=Object.defineProperty,Wc=Object.getOwnPropertyDescriptor,Pn=(s,e,t,n)=>{for(var i=n>1?void 0:n?Wc(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&qc(e,t,i),i};const fr="https://punkt-cdn.oslo.kommune.no/16.6/icons/";typeof window<"u"&&(window.pktFetch=window.pktFetch===void 0?fetch:window.pktFetch,window.pktIconPath=window.pktIconPath||fr);const An='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>',In={},zc=2,Yc=1500,qa=typeof Storage<"u"&&typeof sessionStorage<"u",Kc=s=>window.pktFetch(s).then(e=>{if(!e.ok)throw new Error("Missing icon: "+s);return e.text()}),Wa=async(s,e=zc)=>{try{return await Kc(s)}catch{return e>0?(await new Promise(t=>setTimeout(t,Yc)),Wa(s,e-1)):(console.error("Failed to fetch icon: "+s),An)}},Gc=async(s,e)=>{const t=e+s+".svg";return qa&&sessionStorage.getItem(t)?sessionStorage.getItem(t):t in In?In[t]:typeof window<"u"&&typeof window.pktFetch=="function"?(In[t]=Wa(t).then(n=>(n!==An&&qa&&sessionStorage.setItem(t,n),delete In[t],n)),In[t]):An};let Is=class extends At{constructor(){super(...arguments),this.path=typeof window<"u"?window.pktIconPath:fr,this.name="",this.icon=pr(An),this._updatedProps=[]}connectedCallback(){super.connectedCallback(),this.classList.add("pkt-icon")}async attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),(e==="name"||e==="path")&&this.getIcon(this.name)}async updated(e){super.updated(e),(e.has("name")||e.has("path"))&&this.getIcon(this.name)}async getIcon(e=""){if(this._updatedProps.length>0){this.path||(this.path=typeof window<"u"?window.pktIconPath:fr);try{this.icon=pr(await Gc(this.name||"",this.path))}catch{this.icon=pr(An)}this._updatedProps=[]}else this._updatedProps.includes(e)||this._updatedProps.push(e)}render(){return y`${this.name&&this.icon}`}};Pn([u({type:String,reflect:!1})],Is.prototype,"path",2),Pn([u({type:String,reflect:!0})],Is.prototype,"name",2),Pn([u({type:SVGElement})],Is.prototype,"icon",2),Pn([u({type:Array,noAccessor:!0})],Is.prototype,"_updatedProps",2),Is=Pn([fe("pkt-icon")],Is);/**
|
|
95
95
|
* @license
|
|
96
96
|
* Copyright 2018 Google LLC
|
|
97
97
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
98
|
-
*/const I=s=>s??C;var
|
|
98
|
+
*/const I=s=>s??C;var Xc=Object.defineProperty,Qc=Object.getOwnPropertyDescriptor,ct=(s,e,t,n)=>{for(var i=n>1?void 0:n?Qc(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Xc(e,t,i),i};window.pktAnimationPath=window.pktAnimationPath||"https://punkt-cdn.oslo.kommune.no/16.6/animations/";let it=class extends pt{constructor(){super(...arguments),this.iconName="user",this.secondIconName="user",this.mode="light",this.size="medium",this.fullWidth=!1,this.fullWidthOnMobile=!1,this.skin="primary",this.variant="label-only",this.state="normal",this.type="button",this.form=void 0,this.isLoading=!1,this.disabled=!1,this.loadingAnimationPath=window.pktAnimationPath}connectedCallback(){super.connectedCallback(),this.addEventListener("click",e=>{(this.disabled||this.hasAttribute("disabled")||this.isLoading)&&(e.preventDefault(),e.stopImmediatePropagation())},!0),this.addEventListener("keydown",e=>{(this.disabled||this.hasAttribute("disabled")||this.isLoading)&&(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.stopImmediatePropagation())},!0)}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),e==="disabled"&&n==="false"&&(this.disabled=!1),(e==="isloading"||e==="isLoading")&&n==="false"&&(this.isLoading=!1)}firstUpdated(e){super.firstUpdated(e),this.disabled==="false"&&(this.disabled=!1),this.isLoading==="false"&&(this.isLoading=!1)}render(){const e=this.form??this.getAttribute("form")??void 0,t={"pkt-btn":!0,[`pkt-btn--${this.size}`]:!!this.size,[`pkt-btn--${this.skin}`]:!!this.skin,[`pkt-btn--${this.variant}`]:!!this.variant,[`pkt-btn--${this.color}`]:!!this.color,[`pkt-btn--${this.state}`]:!!this.state,"pkt-btn--full":!!this.fullWidth,"pkt-btn--full-small":!!this.fullWidthOnMobile,"pkt-btn--disabled":!!this.disabled,"pkt-btn--isLoading":!!this.isLoading};return y`
|
|
99
99
|
<button
|
|
100
|
-
class=${
|
|
100
|
+
class=${X(t)}
|
|
101
101
|
type=${this.type}
|
|
102
102
|
?disabled=${!!this.disabled}
|
|
103
103
|
aria-busy=${I(this.isLoading?"true":void 0)}
|
|
@@ -121,9 +121,9 @@
|
|
|
121
121
|
path=${I(this.secondIconPath)}
|
|
122
122
|
></pkt-icon>`:C}
|
|
123
123
|
</button>
|
|
124
|
-
`}};ct([u({type:String})],it.prototype,"iconName",2),ct([u({type:String})],it.prototype,"secondIconName",2),ct([u({type:String})],it.prototype,"iconPath",2),ct([u({type:String})],it.prototype,"secondIconPath",2),ct([u({type:String})],it.prototype,"mode",2),ct([u({type:String})],it.prototype,"size",2),ct([u({type:Boolean,attribute:"full-width"})],it.prototype,"fullWidth",2),ct([u({type:Boolean,attribute:"full-width-on-mobile"})],it.prototype,"fullWidthOnMobile",2),ct([u({type:String})],it.prototype,"color",2),ct([u({type:String})],it.prototype,"skin",2),ct([u({type:String})],it.prototype,"variant",2),ct([u({type:String,reflect:!0})],it.prototype,"state",2),ct([u({type:String,reflect:!0})],it.prototype,"type",2),ct([u({type:String})],it.prototype,"form",2),ct([u({type:Boolean,reflect:!0})],it.prototype,"isLoading",2),ct([u({type:Boolean,reflect:!0})],it.prototype,"disabled",2),ct([u({type:String})],it.prototype,"loadingAnimationPath",2),it=ct([
|
|
125
|
-
<div class=${
|
|
126
|
-
<div class=${
|
|
124
|
+
`}};ct([u({type:String})],it.prototype,"iconName",2),ct([u({type:String})],it.prototype,"secondIconName",2),ct([u({type:String})],it.prototype,"iconPath",2),ct([u({type:String})],it.prototype,"secondIconPath",2),ct([u({type:String})],it.prototype,"mode",2),ct([u({type:String})],it.prototype,"size",2),ct([u({type:Boolean,attribute:"full-width"})],it.prototype,"fullWidth",2),ct([u({type:Boolean,attribute:"full-width-on-mobile"})],it.prototype,"fullWidthOnMobile",2),ct([u({type:String})],it.prototype,"color",2),ct([u({type:String})],it.prototype,"skin",2),ct([u({type:String})],it.prototype,"variant",2),ct([u({type:String,reflect:!0})],it.prototype,"state",2),ct([u({type:String,reflect:!0})],it.prototype,"type",2),ct([u({type:String})],it.prototype,"form",2),ct([u({type:Boolean,reflect:!0})],it.prototype,"isLoading",2),ct([u({type:Boolean,reflect:!0})],it.prototype,"disabled",2),ct([u({type:String})],it.prototype,"loadingAnimationPath",2),it=ct([fe("pkt-button")],it);const Zc={skin:{default:"info"},ariaLive:{default:"polite"},compact:{default:!1},closeAlert:{default:!1}},Ci={props:Zc};var Jc=Object.defineProperty,Rc=Object.getOwnPropertyDescriptor,Zt=(s,e,t,n)=>{for(var i=n>1?void 0:n?Rc(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Jc(e,t,i),i};let Wt=class extends pt{constructor(){super(),this.compact=Ci.props.compact.default,this.title="",this.skin=Ci.props.skin.default,this.ariaLive=Ci.props.ariaLive.default,this["aria-live"]=null,this.closeAlert=Ci.props.closeAlert.default,this.date=null,this.role="status",this._isClosed=!1,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:e},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:e},bubbles:!0,composed:!0}))},this._isClosed=!1}connectedCallback(){super.connectedCallback(),this["aria-live"]=this.getAttribute("aria-live")||this.ariaLive}attributeChangedCallback(e,t,n){e==="ariaLive"&&(this["aria-live"]=n),super.attributeChangedCallback(e,t,n)}updated(e){super.updated(e),e.has("ariaLive")&&(this["aria-live"]=this.ariaLive),e.has("_isClosed")&&ja(this,"pkt-hide",this._isClosed)}render(){const e={"pkt-alert":!0,"pkt-alert--compact":this.compact,[`pkt-alert--${this.skin}`]:this.skin,"pkt-hide":this._isClosed},t={"pkt-alert__grid":!0,"pkt-alert__noTitle":!this.title,"pkt-alert__noDate":!this.date};return y`
|
|
125
|
+
<div class=${X(e)} aria-live=${this["aria-live"]}>
|
|
126
|
+
<div class=${X(t)}>
|
|
127
127
|
<pkt-icon
|
|
128
128
|
class="pkt-alert__icon"
|
|
129
129
|
aria-hidden="true"
|
|
@@ -153,22 +153,22 @@
|
|
|
153
153
|
${this.date?y`<div class="pkt-alert__date">Sist oppdatert: ${this.date}</div>`:C}
|
|
154
154
|
</div>
|
|
155
155
|
</div>
|
|
156
|
-
`}};Zt([u({type:Boolean,reflect:!1})],Wt.prototype,"compact",2),Zt([u({type:String,reflect:!0})],Wt.prototype,"title",2),Zt([u({type:String,reflect:!0})],Wt.prototype,"skin",2),Zt([u({type:String})],Wt.prototype,"ariaLive",2),Zt([u({type:String,reflect:!0})],Wt.prototype,"aria-live",2),Zt([u({type:Boolean,reflect:!0})],Wt.prototype,"closeAlert",2),Zt([u({type:String,reflect:!0})],Wt.prototype,"date",2),Zt([u({type:String,reflect:!0})],Wt.prototype,"role",2),Zt([
|
|
156
|
+
`}};Zt([u({type:Boolean,reflect:!1})],Wt.prototype,"compact",2),Zt([u({type:String,reflect:!0})],Wt.prototype,"title",2),Zt([u({type:String,reflect:!0})],Wt.prototype,"skin",2),Zt([u({type:String})],Wt.prototype,"ariaLive",2),Zt([u({type:String,reflect:!0})],Wt.prototype,"aria-live",2),Zt([u({type:Boolean,reflect:!0})],Wt.prototype,"closeAlert",2),Zt([u({type:String,reflect:!0})],Wt.prototype,"date",2),Zt([u({type:String,reflect:!0})],Wt.prototype,"role",2),Zt([he()],Wt.prototype,"_isClosed",2),Wt=Zt([fe("pkt-alert")],Wt);/**
|
|
157
157
|
* @license
|
|
158
158
|
* Copyright 2020 Google LLC
|
|
159
159
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
160
|
-
*/const _e=()=>new
|
|
160
|
+
*/const _e=()=>new eu;let eu=class{};const gr=new WeakMap,we=bs(class extends La{render(s){return C}update(s,[e]){var t;const n=e!==this.G;return n&&this.G!==void 0&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.G=e,this.ht=(t=s.options)==null?void 0:t.host,this.rt(this.ct=s.element)),C}rt(s){if(this.isConnected||(s=void 0),typeof this.G=="function"){const e=this.ht??globalThis;let t=gr.get(e);t===void 0&&(t=new WeakMap,gr.set(e,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,s),s!==void 0&&this.G.call(this.ht,s)}else this.G.value=s}get lt(){var s,e;return typeof this.G=="function"?(s=gr.get(this.ht??globalThis))==null?void 0:s.get(this.G):(e=this.G)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var tu=Object.defineProperty,su=Object.getOwnPropertyDescriptor,Ln=(s,e,t,n)=>{for(var i=n>1?void 0:n?su(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&tu(e,t,i),i};let nn=class extends tn{constructor(){super(...arguments),this.ariaLabelledBy="",this.compact=!1,this.skin="borderless",this.name=""}updated(e){e.has("skin")&&this.requestUpdate(),e.has("name")&&this.updateAccordionItemNames()}updateAccordionItemNames(){var e;if(this.name){const t=(e=this.renderRoot)==null?void 0:e.querySelector("slot");t&&t.assignedElements().forEach(n=>{n.tagName.toLowerCase()==="pkt-accordion-item"&&(n.hasAttribute("name")||n.setAttribute("name",this.name))})}}firstUpdated(){var e;const t=(e=this.renderRoot)==null?void 0:e.querySelector("slot");t&&t.addEventListener("slotchange",()=>{this.updateAccordionItemNames()})}render(){const e={"pkt-accordion":!0,"pkt-accordion--compact":this.compact,[`pkt-accordion--${this.skin}`]:this.skin};return y`
|
|
161
161
|
<div
|
|
162
162
|
part="container"
|
|
163
|
-
class=${
|
|
163
|
+
class=${X(e)}
|
|
164
164
|
data-testid="pkt-accordion"
|
|
165
165
|
aria-labelledby=${this.ariaLabelledBy}
|
|
166
166
|
>
|
|
167
167
|
<slot></slot>
|
|
168
168
|
</div>
|
|
169
|
-
`}};Ln([u({type:String,reflect:!0,attribute:"aria-labelledby"})],
|
|
169
|
+
`}};Ln([u({type:String,reflect:!0,attribute:"aria-labelledby"})],nn.prototype,"ariaLabelledBy",2),Ln([u({type:Boolean,reflect:!0,attribute:"compact"})],nn.prototype,"compact",2),Ln([u({type:String,reflect:!0,attribute:"skin"})],nn.prototype,"skin",2),Ln([u({type:String,reflect:!0,attribute:"name"})],nn.prototype,"name",2),nn=Ln([fe("pkt-accordion")],nn);var nu=Object.defineProperty,iu=Object.getOwnPropertyDescriptor,Ls=(s,e,t,n)=>{for(var i=n>1?void 0:n?iu(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&nu(e,t,i),i};let vs=class extends pt{constructor(){super(),this.defaultOpen=!1,this.title="",this.skin=void 0,this.compact=!1,this.isOpen=!1,this.name=void 0,this.accordionItemRef=_e()}firstUpdated(e){this.defaultOpen&&(this.isOpen=!0)}render(){const e={"pkt-accordion-item":!0,"pkt-accordion-item--compact":this.compact,[`pkt-accordion-item--${this.skin}`]:!!this.skin};return y`
|
|
170
170
|
<details
|
|
171
|
-
class=${
|
|
171
|
+
class=${X(e)}
|
|
172
172
|
id=${this.id}
|
|
173
173
|
?open=${this.isOpen}
|
|
174
174
|
${we(this.accordionItemRef)}
|
|
@@ -190,7 +190,7 @@
|
|
|
190
190
|
<div class="pkt-accordion-item__content-inner">${ze(this)}</div>
|
|
191
191
|
</div>
|
|
192
192
|
</details>
|
|
193
|
-
`}};Ls([u({type:Boolean})],vs.prototype,"defaultOpen",2),Ls([u({type:String})],vs.prototype,"title",2),Ls([u({type:String,reflect:!0})],vs.prototype,"skin",2),Ls([u({type:Boolean,reflect:!0})],vs.prototype,"compact",2),Ls([u({type:Boolean,reflect:!0})],vs.prototype,"isOpen",2),Ls([u({type:String,reflect:!0})],vs.prototype,"name",2),vs=Ls([
|
|
193
|
+
`}};Ls([u({type:Boolean})],vs.prototype,"defaultOpen",2),Ls([u({type:String})],vs.prototype,"title",2),Ls([u({type:String,reflect:!0})],vs.prototype,"skin",2),Ls([u({type:Boolean,reflect:!0})],vs.prototype,"compact",2),Ls([u({type:Boolean,reflect:!0})],vs.prototype,"isOpen",2),Ls([u({type:String,reflect:!0})],vs.prototype,"name",2),vs=Ls([fe("pkt-accordion-item")],vs);var ru=Object.defineProperty,au=Object.getOwnPropertyDescriptor,Si=(s,e,t,n)=>{for(var i=n>1?void 0:n?au(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&ru(e,t,i),i};let Bn=class extends At{constructor(){super(...arguments),this.href="",this.text="Forsiden",this.ariaLabel=""}attributeChangedCallback(e,t,n){e==="arialabel"&&this.removeAttribute("arialabel"),e==="href"&&this.removeAttribute("href"),e==="text"&&this.removeAttribute("text"),super.attributeChangedCallback(e,t,n)}render(){return y`<nav
|
|
194
194
|
class="pkt-back-link"
|
|
195
195
|
aria-label=${this.ariaLabel||"Gå tilbake til forrige side"}
|
|
196
196
|
>
|
|
@@ -202,7 +202,7 @@
|
|
|
202
202
|
></pkt-icon
|
|
203
203
|
><span class="pkt-back-link__text">${this.text}</span></a
|
|
204
204
|
>
|
|
205
|
-
</nav>`}};Si([u({type:String})],Bn.prototype,"href",2),Si([u({type:String})],Bn.prototype,"text",2),Si([u({type:String})],Bn.prototype,"ariaLabel",2),Bn=Si([
|
|
205
|
+
</nav>`}};Si([u({type:String})],Bn.prototype,"href",2),Si([u({type:String})],Bn.prototype,"text",2),Si([u({type:String})],Bn.prototype,"ariaLabel",2),Bn=Si([fe("pkt-backlink")],Bn);var ou=Object.defineProperty,lu=Object.getOwnPropertyDescriptor,za=(s,e,t,n)=>{for(var i=n>1?void 0:n?lu(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&ou(e,t,i),i};let mr=class extends At{constructor(){super(...arguments),this.breadcrumbs=[]}handleLinkClick(e,t,n){const i=new CustomEvent("navigate",{detail:{item:t,index:n,originalEvent:e},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(i)||e.preventDefault()}render(){if(!this.breadcrumbs||this.breadcrumbs.length===0)return C;const e=this.breadcrumbs[this.breadcrumbs.length-2];return y`
|
|
206
206
|
<nav class="pkt-breadcrumbs" aria-label="brødsmulemeny">
|
|
207
207
|
<ol class="pkt-breadcrumbs__list pkt-breadcrumbs--desktop">
|
|
208
208
|
${this.breadcrumbs.map((t,n)=>n===this.breadcrumbs.length-1?y`
|
|
@@ -244,7 +244,7 @@
|
|
|
244
244
|
</a>
|
|
245
245
|
`:C}
|
|
246
246
|
</nav>
|
|
247
|
-
`}};za([u({type:Array})],mr.prototype,"breadcrumbs",2),mr=za([pe("pkt-breadcrumbs")],mr);const Ya=6048e5,lu=864e5,Ka=Symbol.for("constructDateFrom");function Jt(s,e){return typeof s=="function"?s(e):s&&typeof s=="object"&&Ka in s?s[Ka](e):s instanceof Date?new s.constructor(e):new Date(e)}function Mt(s,e){return Jt(e||s,s)}function Ga(s,e,t){const n=Mt(s,void 0);return isNaN(e)?Jt(s,NaN):(e&&n.setDate(n.getDate()+e),n)}let cu={};function Ti(){return cu}function Fn(s,e){var t,n,i,r;const a=Ti(),l=(e==null?void 0:e.weekStartsOn)??((n=(t=e==null?void 0:e.locale)==null?void 0:t.options)==null?void 0:n.weekStartsOn)??a.weekStartsOn??((r=(i=a.locale)==null?void 0:i.options)==null?void 0:r.weekStartsOn)??0,c=Mt(s,e==null?void 0:e.in),h=c.getDay(),g=(h<l?7:0)+h-l;return c.setDate(c.getDate()-g),c.setHours(0,0,0,0),c}function Ni(s,e){return Fn(s,{...e,weekStartsOn:1})}function Xa(s,e){const t=Mt(s,void 0),n=t.getFullYear(),i=Jt(t,0);i.setFullYear(n+1,0,4),i.setHours(0,0,0,0);const r=Ni(i),a=Jt(t,0);a.setFullYear(n,0,4),a.setHours(0,0,0,0);const l=Ni(a);return t.getTime()>=r.getTime()?n+1:t.getTime()>=l.getTime()?n:n-1}function Qa(s){const e=Mt(s),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+s-+t}function Za(s,...e){const t=Jt.bind(null,e.find(n=>typeof n=="object"));return e.map(t)}function Ja(s,e){const t=Mt(s,void 0);return t.setHours(0,0,0,0),t}function uu(s,e,t){const[n,i]=Za(void 0,s,e),r=Ja(n),a=Ja(i),l=+r-Qa(r),c=+a-Qa(a);return Math.round((l-c)/lu)}function du(s,e){const t=Xa(s),n=Jt(s,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),Ni(n)}function hu(s){return s instanceof Date||typeof s=="object"&&Object.prototype.toString.call(s)==="[object Date]"}function pu(s){return!(!hu(s)&&typeof s!="number"||isNaN(+Mt(s)))}function fu(s,e){const[t,n]=Za(s,e.start,e.end);return{start:t,end:n}}function Ra(s,e){const{start:t,end:n}=fu(void 0,s);let i=+t>+n;const r=i?+t:+n,a=i?n:t;a.setHours(0,0,0,0);let l=1;const c=[];for(;+a<=r;)c.push(Jt(t,a)),a.setDate(a.getDate()+l),a.setHours(0,0,0,0);return i?c.reverse():c}function gu(s,e){const t=Mt(s,void 0);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}const mu={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"}},bu=(s,e,t)=>{let n;const i=mu[s];return typeof i=="string"?n=i:e===1?n=i.one:n=i.other.replace("{{count}}",e.toString()),t!=null&&t.addSuffix?t.comparison&&t.comparison>0?"in "+n:n+" ago":n};function br(s){return(e={})=>{const t=e.width?String(e.width):s.defaultWidth;return s.formats[t]||s.formats[s.defaultWidth]}}const vu={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},ku={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},yu={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},_u={date:br({formats:vu,defaultWidth:"full"}),time:br({formats:ku,defaultWidth:"full"}),dateTime:br({formats:yu,defaultWidth:"full"})},wu={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},$u=(s,e,t,n)=>wu[s];function Vn(s){return(e,t)=>{const n=t!=null&&t.context?String(t.context):"standalone";let i;if(n==="formatting"&&s.formattingValues){const a=s.defaultFormattingWidth||s.defaultWidth,l=t!=null&&t.width?String(t.width):a;i=s.formattingValues[l]||s.formattingValues[a]}else{const a=s.defaultWidth,l=t!=null&&t.width?String(t.width):s.defaultWidth;i=s.values[l]||s.values[a]}const r=s.argumentCallback?s.argumentCallback(e):e;return i[r]}}const xu={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Cu={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Su={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"]},Tu={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"]},Nu={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"}},Mu={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"}},Du=(s,e)=>{const t=Number(s),n=t%100;if(n>20||n<10)switch(n%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},Ou={ordinalNumber:Du,era:Vn({values:xu,defaultWidth:"wide"}),quarter:Vn({values:Cu,defaultWidth:"wide",argumentCallback:s=>s-1}),month:Vn({values:Su,defaultWidth:"wide"}),day:Vn({values:Tu,defaultWidth:"wide"}),dayPeriod:Vn({values:Nu,defaultWidth:"wide",formattingValues:Mu,defaultFormattingWidth:"wide"})};function Hn(s){return(e,t={})=>{const n=t.width,i=n&&s.matchPatterns[n]||s.matchPatterns[s.defaultMatchWidth],r=e.match(i);if(!r)return null;const a=r[0],l=n&&s.parsePatterns[n]||s.parsePatterns[s.defaultParseWidth],c=Array.isArray(l)?Pu(l,m=>m.test(a)):Eu(l,m=>m.test(a));let h;h=s.valueCallback?s.valueCallback(c):c,h=t.valueCallback?t.valueCallback(h):h;const g=e.slice(a.length);return{value:h,rest:g}}}function Eu(s,e){for(const t in s)if(Object.prototype.hasOwnProperty.call(s,t)&&e(s[t]))return t}function Pu(s,e){for(let t=0;t<s.length;t++)if(e(s[t]))return t}function Au(s){return(e,t={})=>{const n=e.match(s.matchPattern);if(!n)return null;const i=n[0],r=e.match(s.parsePattern);if(!r)return null;let a=s.valueCallback?s.valueCallback(r[0]):r[0];a=t.valueCallback?t.valueCallback(a):a;const l=e.slice(i.length);return{value:a,rest:l}}}const Iu=/^(\d+)(th|st|nd|rd)?/i,Lu=/\d+/i,Bu={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},Fu={any:[/^b/i,/^(a|c)/i]},Vu={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Hu={any:[/1/i,/2/i,/3/i,/4/i]},Uu={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},ju={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]},qu={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},Wu={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]},zu={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},Yu={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}},Ku={ordinalNumber:Au({matchPattern:Iu,parsePattern:Lu,valueCallback:s=>parseInt(s,10)}),era:Hn({matchPatterns:Bu,defaultMatchWidth:"wide",parsePatterns:Fu,defaultParseWidth:"any"}),quarter:Hn({matchPatterns:Vu,defaultMatchWidth:"wide",parsePatterns:Hu,defaultParseWidth:"any",valueCallback:s=>s+1}),month:Hn({matchPatterns:Uu,defaultMatchWidth:"wide",parsePatterns:ju,defaultParseWidth:"any"}),day:Hn({matchPatterns:qu,defaultMatchWidth:"wide",parsePatterns:Wu,defaultParseWidth:"any"}),dayPeriod:Hn({matchPatterns:zu,defaultMatchWidth:"any",parsePatterns:Yu,defaultParseWidth:"any"})},Gu={code:"en-US",formatDistance:bu,formatLong:_u,formatRelative:$u,localize:Ou,match:Ku,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Xu(s,e){const t=Mt(s,void 0);return uu(t,gu(t))+1}function Qu(s,e){const t=Mt(s,void 0),n=+Ni(t)-+du(t);return Math.round(n/Ya)+1}function eo(s,e){var t,n,i,r;const a=Mt(s,e==null?void 0:e.in),l=a.getFullYear(),c=Ti(),h=(e==null?void 0:e.firstWeekContainsDate)??((n=(t=e==null?void 0:e.locale)==null?void 0:t.options)==null?void 0:n.firstWeekContainsDate)??c.firstWeekContainsDate??((r=(i=c.locale)==null?void 0:i.options)==null?void 0:r.firstWeekContainsDate)??1,g=Jt((e==null?void 0:e.in)||s,0);g.setFullYear(l+1,0,h),g.setHours(0,0,0,0);const m=Fn(g,e),f=Jt((e==null?void 0:e.in)||s,0);f.setFullYear(l,0,h),f.setHours(0,0,0,0);const k=Fn(f,e);return+a>=+m?l+1:+a>=+k?l:l-1}function Zu(s,e){var t,n,i,r;const a=Ti(),l=(e==null?void 0:e.firstWeekContainsDate)??((n=(t=e==null?void 0:e.locale)==null?void 0:t.options)==null?void 0:n.firstWeekContainsDate)??a.firstWeekContainsDate??((r=(i=a.locale)==null?void 0:i.options)==null?void 0:r.firstWeekContainsDate)??1,c=eo(s,e),h=Jt((e==null?void 0:e.in)||s,0);return h.setFullYear(c,0,l),h.setHours(0,0,0,0),Fn(h,e)}function to(s,e){const t=Mt(s,e==null?void 0:e.in),n=+Fn(t,e)-+Zu(t,e);return Math.round(n/Ya)+1}function xe(s,e){const t=s<0?"-":"",n=Math.abs(s).toString().padStart(e,"0");return t+n}const ks={y(s,e){const t=s.getFullYear(),n=t>0?t:1-t;return xe(e==="yy"?n%100:n,e.length)},M(s,e){const t=s.getMonth();return e==="M"?String(t+1):xe(t+1,2)},d(s,e){return xe(s.getDate(),e.length)},a(s,e){const t=s.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];case"aaaa":default:return t==="am"?"a.m.":"p.m."}},h(s,e){return xe(s.getHours()%12||12,e.length)},H(s,e){return xe(s.getHours(),e.length)},m(s,e){return xe(s.getMinutes(),e.length)},s(s,e){return xe(s.getSeconds(),e.length)},S(s,e){const t=e.length,n=s.getMilliseconds(),i=Math.trunc(n*Math.pow(10,t-3));return xe(i,e.length)}},an={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},so={G:function(s,e,t){const n=s.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(n,{width:"abbreviated"});case"GGGGG":return t.era(n,{width:"narrow"});case"GGGG":default:return t.era(n,{width:"wide"})}},y:function(s,e,t){if(e==="yo"){const n=s.getFullYear(),i=n>0?n:1-n;return t.ordinalNumber(i,{unit:"year"})}return ks.y(s,e)},Y:function(s,e,t,n){const i=eo(s,n),r=i>0?i:1-i;if(e==="YY"){const a=r%100;return xe(a,2)}return e==="Yo"?t.ordinalNumber(r,{unit:"year"}):xe(r,e.length)},R:function(s,e){const t=Xa(s);return xe(t,e.length)},u:function(s,e){const t=s.getFullYear();return xe(t,e.length)},Q:function(s,e,t){const n=Math.ceil((s.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return xe(n,2);case"Qo":return t.ordinalNumber(n,{unit:"quarter"});case"QQQ":return t.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(n,{width:"wide",context:"formatting"})}},q:function(s,e,t){const n=Math.ceil((s.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return xe(n,2);case"qo":return t.ordinalNumber(n,{unit:"quarter"});case"qqq":return t.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(n,{width:"wide",context:"standalone"})}},M:function(s,e,t){const n=s.getMonth();switch(e){case"M":case"MM":return ks.M(s,e);case"Mo":return t.ordinalNumber(n+1,{unit:"month"});case"MMM":return t.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(n,{width:"wide",context:"formatting"})}},L:function(s,e,t){const n=s.getMonth();switch(e){case"L":return String(n+1);case"LL":return xe(n+1,2);case"Lo":return t.ordinalNumber(n+1,{unit:"month"});case"LLL":return t.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(n,{width:"wide",context:"standalone"})}},w:function(s,e,t,n){const i=to(s,n);return e==="wo"?t.ordinalNumber(i,{unit:"week"}):xe(i,e.length)},I:function(s,e,t){const n=Qu(s);return e==="Io"?t.ordinalNumber(n,{unit:"week"}):xe(n,e.length)},d:function(s,e,t){return e==="do"?t.ordinalNumber(s.getDate(),{unit:"date"}):ks.d(s,e)},D:function(s,e,t){const n=Xu(s);return e==="Do"?t.ordinalNumber(n,{unit:"dayOfYear"}):xe(n,e.length)},E:function(s,e,t){const n=s.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(n,{width:"short",context:"formatting"});case"EEEE":default:return t.day(n,{width:"wide",context:"formatting"})}},e:function(s,e,t,n){const i=s.getDay(),r=(i-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(r);case"ee":return xe(r,2);case"eo":return t.ordinalNumber(r,{unit:"day"});case"eee":return t.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(i,{width:"short",context:"formatting"});case"eeee":default:return t.day(i,{width:"wide",context:"formatting"})}},c:function(s,e,t,n){const i=s.getDay(),r=(i-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(r);case"cc":return xe(r,e.length);case"co":return t.ordinalNumber(r,{unit:"day"});case"ccc":return t.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(i,{width:"narrow",context:"standalone"});case"cccccc":return t.day(i,{width:"short",context:"standalone"});case"cccc":default:return t.day(i,{width:"wide",context:"standalone"})}},i:function(s,e,t){const n=s.getDay(),i=n===0?7:n;switch(e){case"i":return String(i);case"ii":return xe(i,e.length);case"io":return t.ordinalNumber(i,{unit:"day"});case"iii":return t.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(n,{width:"short",context:"formatting"});case"iiii":default:return t.day(n,{width:"wide",context:"formatting"})}},a:function(s,e,t){const n=s.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(n,{width:"wide",context:"formatting"})}},b:function(s,e,t){const n=s.getHours();let i;switch(n===12?i=an.noon:n===0?i=an.midnight:i=n/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(s,e,t){const n=s.getHours();let i;switch(n>=17?i=an.evening:n>=12?i=an.afternoon:n>=4?i=an.morning:i=an.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(s,e,t){if(e==="ho"){let n=s.getHours()%12;return n===0&&(n=12),t.ordinalNumber(n,{unit:"hour"})}return ks.h(s,e)},H:function(s,e,t){return e==="Ho"?t.ordinalNumber(s.getHours(),{unit:"hour"}):ks.H(s,e)},K:function(s,e,t){const n=s.getHours()%12;return e==="Ko"?t.ordinalNumber(n,{unit:"hour"}):xe(n,e.length)},k:function(s,e,t){let n=s.getHours();return n===0&&(n=24),e==="ko"?t.ordinalNumber(n,{unit:"hour"}):xe(n,e.length)},m:function(s,e,t){return e==="mo"?t.ordinalNumber(s.getMinutes(),{unit:"minute"}):ks.m(s,e)},s:function(s,e,t){return e==="so"?t.ordinalNumber(s.getSeconds(),{unit:"second"}):ks.s(s,e)},S:function(s,e){return ks.S(s,e)},X:function(s,e,t){const n=s.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return io(n);case"XXXX":case"XX":return Bs(n);case"XXXXX":case"XXX":default:return Bs(n,":")}},x:function(s,e,t){const n=s.getTimezoneOffset();switch(e){case"x":return io(n);case"xxxx":case"xx":return Bs(n);case"xxxxx":case"xxx":default:return Bs(n,":")}},O:function(s,e,t){const n=s.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+no(n,":");case"OOOO":default:return"GMT"+Bs(n,":")}},z:function(s,e,t){const n=s.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+no(n,":");case"zzzz":default:return"GMT"+Bs(n,":")}},t:function(s,e,t){const n=Math.trunc(+s/1e3);return xe(n,e.length)},T:function(s,e,t){return xe(+s,e.length)}};function no(s,e=""){const t=s>0?"-":"+",n=Math.abs(s),i=Math.trunc(n/60),r=n%60;return r===0?t+String(i):t+String(i)+e+xe(r,2)}function io(s,e){return s%60===0?(s>0?"-":"+")+xe(Math.abs(s)/60,2):Bs(s,e)}function Bs(s,e=""){const t=s>0?"-":"+",n=Math.abs(s),i=xe(Math.trunc(n/60),2),r=xe(n%60,2);return t+i+e+r}const ro=(s,e)=>{switch(s){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},ao=(s,e)=>{switch(s){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Ju=(s,e)=>{const t=s.match(/(P+)(p+)?/)||[],n=t[1],i=t[2];if(!i)return ro(s,e);let r;switch(n){case"P":r=e.dateTime({width:"short"});break;case"PP":r=e.dateTime({width:"medium"});break;case"PPP":r=e.dateTime({width:"long"});break;case"PPPP":default:r=e.dateTime({width:"full"});break}return r.replace("{{date}}",ro(n,e)).replace("{{time}}",ao(i,e))},Ru={p:ao,P:Ju},ed=/^D+$/,td=/^Y+$/,sd=["D","DD","YY","YYYY"];function nd(s){return ed.test(s)}function id(s){return td.test(s)}function rd(s,e,t){const n=ad(s,e,t);if(console.warn(n),sd.includes(s))throw new RangeError(n)}function ad(s,e,t){const n=s[0]==="Y"?"years":"days of the month";return`Use \`${s.toLowerCase()}\` instead of \`${s}\` (in \`${e}\`) for formatting ${n} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const od=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,ld=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,cd=/^'([^]*?)'?$/,ud=/''/g,dd=/[a-zA-Z]/;function hd(s,e,t){var n,i,r,a;const l=Ti(),c=l.locale??Gu,h=l.firstWeekContainsDate??((i=(n=l.locale)==null?void 0:n.options)==null?void 0:i.firstWeekContainsDate)??1,g=l.weekStartsOn??((a=(r=l.locale)==null?void 0:r.options)==null?void 0:a.weekStartsOn)??0,m=Mt(s,void 0);if(!pu(m))throw new RangeError("Invalid time value");let f=e.match(ld).map(v=>{const $=v[0];if($==="p"||$==="P"){const N=Ru[$];return N(v,c.formatLong)}return v}).join("").match(od).map(v=>{if(v==="''")return{isToken:!1,value:"'"};const $=v[0];if($==="'")return{isToken:!1,value:pd(v)};if(so[$])return{isToken:!0,value:v};if($.match(dd))throw new RangeError("Format string contains an unescaped latin alphabet character `"+$+"`");return{isToken:!1,value:v}});c.localize.preprocessor&&(f=c.localize.preprocessor(m,f));const k={firstWeekContainsDate:h,weekStartsOn:g,locale:c};return f.map(v=>{if(!v.isToken)return v.value;const $=v.value;(id($)||nd($))&&rd($,e,String(s));const N=so[$[0]];return N(m,$,c.localize,k)}).join("")}function pd(s){const e=s.match(cd);return e?e[1].replace(ud,"'"):s}function fd(s,e){const t=Mt(s,void 0).getDay();return t===0?7:t}function gd(s,e,t="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:s,timeZoneName:t}).format(e).split(/\s/g).slice(2).join(" ")}const oo={},Un={};function Fs(s,e){try{const t=(oo[s]||(oo[s]=new Intl.DateTimeFormat("en-US",{timeZone:s,timeZoneName:"longOffset"}).format))(e).split("GMT")[1];return t in Un?Un[t]:lo(t,t.split(":"))}catch{if(s in Un)return Un[s];const t=s==null?void 0:s.match(md);return t?lo(s,t.slice(1)):NaN}}const md=/([+-]\d\d):?(\d\d)?/;function lo(s,e){const t=+(e[0]||0),n=+(e[1]||0),i=+(e[2]||0)/60;return Un[s]=t*60+n>0?t*60+n+i:t*60-n-i}let jn=class pi extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(Fs(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)),uo(this),vr(this)):this.setTime(Date.now())}static tz(e,...t){return t.length?new pi(...t,e):new pi(Date.now(),e)}withTimeZone(e){return new pi(+this,e)}getTimezoneOffset(){const e=-Fs(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),vr(this),+this}[Symbol.for("constructDateFrom")](e){return new pi(+new Date(e),this.timeZone)}};const co=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(s=>{if(!co.test(s))return;const e=s.replace(co,"$1UTC");jn.prototype[e]&&(s.startsWith("get")?jn.prototype[s]=function(){return this.internal[e]()}:(jn.prototype[s]=function(){return Date.prototype[e].apply(this.internal,arguments),bd(this),+this},jn.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),vr(this),+this}))});function vr(s){s.internal.setTime(+s),s.internal.setUTCSeconds(s.internal.getUTCSeconds()-Math.round(-Fs(s.timeZone,s)*60))}function bd(s){Date.prototype.setFullYear.call(s,s.internal.getUTCFullYear(),s.internal.getUTCMonth(),s.internal.getUTCDate()),Date.prototype.setHours.call(s,s.internal.getUTCHours(),s.internal.getUTCMinutes(),s.internal.getUTCSeconds(),s.internal.getUTCMilliseconds()),uo(s)}function uo(s){const e=Fs(s.timeZone,s),t=e>0?Math.floor(e):Math.ceil(e),n=new Date(+s);n.setUTCHours(n.getUTCHours()-1);const i=-new Date(+s).getTimezoneOffset(),r=-new Date(+n).getTimezoneOffset(),a=i-r,l=Date.prototype.getHours.apply(s)!==s.internal.getUTCHours();a&&l&&s.internal.setUTCMinutes(s.internal.getUTCMinutes()+a);const c=i-t;c&&Date.prototype.setUTCMinutes.call(s,Date.prototype.getUTCMinutes.call(s)+c);const h=new Date(+s);h.setUTCSeconds(0);const g=i>0?h.getSeconds():(h.getSeconds()-60)%60,m=Math.round(-(Fs(s.timeZone,s)*60))%60;(m||g)&&(s.internal.setUTCSeconds(s.internal.getUTCSeconds()+m),Date.prototype.setUTCSeconds.call(s,Date.prototype.getUTCSeconds.call(s)+m+g));const f=Fs(s.timeZone,s),k=f>0?Math.floor(f):Math.ceil(f),v=-new Date(+s).getTimezoneOffset()-k,$=k!==t,N=v-c;if($&&N){Date.prototype.setUTCMinutes.call(s,Date.prototype.getUTCMinutes.call(s)+N);const x=Fs(s.timeZone,s),T=x>0?Math.floor(x):Math.ceil(x),P=k-T;P&&(s.internal.setUTCMinutes(s.internal.getUTCMinutes()+P),Date.prototype.setUTCMinutes.call(s,Date.prototype.getUTCMinutes.call(s)+P))}}let kr=class fi extends jn{static tz(e,...t){return t.length?new fi(...t,e):new fi(Date.now(),e)}toISOString(){const[e,t,n]=this.tzComponents(),i=`${e}${t}:${n}`;return this.internal.toISOString().slice(0,-1)+i}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,t,n,i]=this.internal.toUTCString().split(" ");return`${e==null?void 0:e.slice(0,-1)} ${n} ${t} ${i}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[t,n,i]=this.tzComponents();return`${e} GMT${t}${n}${i} (${gd(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:(t==null?void 0:t.timeZone)||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:(t==null?void 0:t.timeZone)||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:(t==null?void 0:t.timeZone)||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),t=e>0?"-":"+",n=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),i=String(Math.abs(e)%60).padStart(2,"0");return[t,n,i]}withTimeZone(e){return new fi(+this,e)}[Symbol.for("constructDateFrom")](e){return new fi(+new Date(e),this.timeZone)}};window.pktTz=window.pktTz===void 0?"Europe/Oslo":window.pktTz;const vd=(s=window.pktTz)=>{const e=new kr(new Date().toISOString(),s);return e.setHours(0,0,0,0),isNaN(e.getTime())?new Date:new Date(e.getFullYear(),e.getMonth(),e.getDate())};function ls(s){if(!s||s==="")return new Date;if(/^\d{4}-\d{2}-\d{2}$/.test(s)){const[e,t,n]=s.split("-").map(Number);return new Date(e,t-1,n)}if(/^\d{4}-\d{2}$/.test(s)){const[e,t]=s.split("-").map(Number);return new Date(e,t-1,1)}return/^\d{4}$/.test(s)?new Date(Number(s),0,1):new Date(s)}const rt=s=>{if(!s||isNaN(s.getTime()))return"";const e=s.getFullYear(),t=String(s.getMonth()+1).padStart(2,"0"),n=String(s.getDate()).padStart(2,"0");return`${e}-${t}-${n}`},ys=s=>{if(!s)return null;const e=ls(s);return isNaN(e.getTime())?null:e},ho=(s,e)=>{const t=Lt(s);return isNaN(t.getTime())?"":hd(t,e)},Lt=(s="",e)=>{const t=typeof s=="string"?ls(s):s;return!t||isNaN(t.getTime())?new Date:t},Vs=(s,e,t=1)=>{if(typeof s!="number"||typeof e!="number"||typeof t!="number"||isNaN(s)||isNaN(e)||isNaN(t))return new Date;const n=new Date(s,e,t);return isNaN(n.getTime())?new Date:n},qn=s=>{let e;return typeof s=="number"?e=new kr(s,window.pktTz):e=new kr(s,window.pktTz),e.setHours(12,0,0,0),e};let yr=null,po;const kd=s=>{if(!s||isNaN(s.getTime()))return"";const e=typeof window<"u"?window.pktTz:void 0;return(!yr||po!==e)&&(yr=new Intl.DateTimeFormat("no",{dateStyle:"full",timeZone:e}),po=e),yr.format(s)},yd=(s,e,t)=>{if(!s||isNaN(s.getTime()))return!1;const n=e?Lt(e):null,i=t?Lt(t):null;return!(n&&s<n||i&&s>i)},_d=(s,e)=>{if(!s||isNaN(s.getTime())||!Array.isArray(e))return!1;const t=rt(s);return e.includes(t)},wd=(s,e)=>{if(!s||isNaN(s.getTime())||!Array.isArray(e))return!1;const t=s.getDay().toString();return e.includes(t)},fo=(s,e,t,n,i)=>!(!s||isNaN(s.getTime())||!yd(s,e,t)||n&&_d(s,n)||i&&wd(s,i)),$d=(s,e,t,n,i)=>s.filter(r=>{const a=ys(r);return a&&fo(a,e,t,n,i)}),go=s=>s.slice().sort((e,t)=>{const n=ys(e),i=ys(t);return!n||!i?0:n.getTime()-i.getTime()}),xd=(s,e)=>{const t=ys(s),n=ys(e);return!t||!n?!1:t<=n},Wn=s=>{if(!s)return[];if(Array.isArray(s))return s.filter(Boolean);if(typeof s=="string"&&s.trimStart().startsWith("["))try{const e=JSON.parse(s);if(Array.isArray(e))return e.filter(Boolean)}catch{}return String(s).split(",").map(e=>e.trim()).filter(Boolean)},Cd=s=>s.join(","),Sd=s=>Wn(s),Td=s=>s?ls(s):null,Nd=s=>{if(typeof s=="string")return s.split(",").map(e=>ls(e));if(Array.isArray(s))return s.map(e=>ls(e))},on={csvToArray:Sd,stringToDate:Td,stringsToDate:Nd},Md={earliest:{default:null},latest:{default:null},weeknumbers:{default:!1},withcontrols:{default:!1},multiple:{default:!1},maxMultiple:{default:4},range:{default:!1}},Hs={props:Md};function mo(s,e){const t=(e.excludedates??[]).map(n=>typeof n=="string"?n:rt(n));return!fo(s,e.earliest,e.latest,t,e.excludeweekdays??[])}function Dd(s,e,t,n){return!!(mo(s,t)||!e&&n.multiple&&n.maxMultiple>0&&n.selectedCount>=n.maxMultiple)}function Od(s,e,t){const n=Vs(s,e,0);return!(t&&Lt(t)>n)}function Ed(s,e,t){const n=Vs(e===11?s+1:s,e===11?0:e+1,1);return!(t&&Lt(t)<n)}const zn=7,Pd=6;function Ad(s,e){const t=Vs(s,e,1),n=Vs(s,e+1,0),i=(t.getDay()+Pd)%zn,r=n.getDate(),a=Math.ceil((r+i)/zn),l=Vs(s,e,0).getDate(),c=to(t);return{firstDayOfMonth:t,lastDayOfMonth:n,startingDay:i,numDays:r,numRows:a,numDaysPrevMonth:l,initialWeek:c}}function Id(s,e,t,n){const{startingDay:i,numDays:r}=n;return s===0&&e<i?"prev-month":t>r?"next-month":"current-month"}function Ld(s,e,t,n){const{startingDay:i,numDaysPrevMonth:r,numDays:a}=n;return s==="prev-month"?r-(i-e-1):s==="next-month"?t-a:t}function ln(s){return typeof s=="string"&&(s=s.split(",")),s.length===1&&s[0]===""?[]:s.map(e=>ls(e))}function bo(s,e){const t=Ra({start:s,end:e}),n={};if(Array.isArray(t)&&t.length)for(let i=0;i<t.length;i++){const r=t[i],a=r>s&&r<e;n[rt(r)]=a}return n}function vo(s,e,t,n){if(e.length!==1)return!0;const i=Ra({start:e[0],end:s});if(!Array.isArray(i)||!i.length)return!0;for(let r=0;r<i.length;r++){for(const a of t??[])if(a>e[0]&&a<s)return!1;if((n??[]).includes(fd(i[r]).toString()))return!1}return!0}function _r(s,e){const t=rt(s);return e.includes(t)?e:[...e,t]}function wr(s,e){const t=rt(s),n=e.indexOf(t);if(n===-1)return e;if(e.length===1)return[];const i=[...e];return i.splice(n,1),i}function Bd(s,e,t){const n=rt(s);return e.includes(n)?wr(s,e):t>0&&e.length>=t?e:_r(s,e)}function Fd(s,e,t){const n=rt(s),i=ln(e);if(e.includes(n))return e.indexOf(n)===0?[]:wr(s,e);if(e.length>1)return[n];if(e.length===1){if(!vo(s,i,t.excludedates,t.excludeweekdays))return[n];if(i[0]>s)return[n]}return _r(s,e)}const Vd={ArrowLeft:-1,ArrowRight:1,ArrowUp:-zn,ArrowDown:zn};function Hd(s){var e;const t=s.nodeName;return t==="INPUT"||t==="SELECT"||t==="BUTTON"&&!((e=s.dataset)!=null&&e.date)}function Ud(s,e,t){let n=Ga(s,e);if(!n)return null;let i=t(`button[data-date="${rt(n)}"]`);for(;i instanceof HTMLButtonElement&&i.dataset.disabled;)if(n=Ga(n,e),i=t(`button[data-date="${rt(n)}"]`),!i)return null;return n}function jd(s){return Vd[s]??null}var qd=Object.defineProperty,Wd=Object.getOwnPropertyDescriptor,Oe=(s,e,t,n)=>{for(var i=n>1?void 0:n?Wd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&qd(e,t,i),i};let Ne=class extends At{constructor(){super(...arguments),this.selected=[],this.multiple=Hs.props.multiple.default,this.maxMultiple=Hs.props.maxMultiple.default,this.range=Hs.props.range.default,this.earliest=Hs.props.earliest.default,this.latest=Hs.props.latest.default,this.excludedates=[],this.excludeweekdays=[],this.weeknumbers=Hs.props.weeknumbers.default,this.withcontrols=Hs.props.withcontrols.default,this.currentmonth=null,this.today=null,this.dayStrings=this.strings.dates.daysShort,this.dayStringsLong=this.strings.dates.days,this.monthStrings=this.strings.dates.months,this.weekString=this.strings.dates.week,this.prevMonthString=this.strings.dates.prevMonth,this.nextMonthString=this.strings.dates.nextMonth,this._selected=[],this.inRange={},this.rangeHovered=null,this.year=0,this.month=0,this.week=0,this.currentmonthtouched=!1,this.focusedDate=null,this.selectableDates=[],this.tabIndexSet=0}get todayDate(){return this.today?ls(this.today):vd()}firstUpdated(e){this.addEventListener("keydown",this.handleKeydown)}disconnectedCallback(){this.removeEventListener("keydown",this.handleKeydown),super.disconnectedCallback()}updated(e){super.updated(e),e.has("selected")&&this.convertSelected()}convertSelected(){typeof this.selected=="string"&&(this.selected=this.selected.split(",")),this.selected.length===1&&this.selected[0]===""&&(this.selected=[]),this._selected=ln(this.selected),this.range&&this.selected.length===2&&(this.inRange=bo(this._selected[0],this._selected[1])),this.setCurrentMonth()}setCurrentMonth(){if(this.currentmonth===null&&!this.currentmonthtouched&&(this.currentmonthtouched=!0),this.selected.length&&this.selected[0]!==""){const e=ls(this.selected[this.selected.length-1]);this.currentmonth=isNaN(e.getTime())?qn(this.todayDate):e}else this.currentmonth===null&&(this.currentmonth=qn(this.todayDate));(!this.currentmonth||isNaN(this.currentmonth.getTime()))&&(this.currentmonth=qn(this.todayDate)),this.year=this.currentmonth.getFullYear(),this.month=this.currentmonth.getMonth()}handleKeydown(e){const t=jd(e.key);t!==null&&this.handleArrowKey(e,t)}handleArrowKey(e,t){const n=e.target;if(Hd(n))return;if(e.preventDefault(),!this.focusedDate){this.focusOnCurrentDate();return}const i=this.focusedDate?Lt(this.focusedDate):Vs(this.year,this.month,1),r=Ud(i,t,this.querySelector.bind(this));if(r){const a=this.querySelector(`button[data-date="${rt(r)}"]`);a instanceof HTMLButtonElement&&!a.dataset.disabled&&(this.focusedDate=rt(r),a.focus())}}render(){return y`
|
|
247
|
+
`}};za([u({type:Array})],mr.prototype,"breadcrumbs",2),mr=za([fe("pkt-breadcrumbs")],mr);const Ya=6048e5,cu=864e5,Ka=Symbol.for("constructDateFrom");function Jt(s,e){return typeof s=="function"?s(e):s&&typeof s=="object"&&Ka in s?s[Ka](e):s instanceof Date?new s.constructor(e):new Date(e)}function Mt(s,e){return Jt(e||s,s)}function Ga(s,e,t){const n=Mt(s,void 0);return isNaN(e)?Jt(s,NaN):(e&&n.setDate(n.getDate()+e),n)}let uu={};function Ti(){return uu}function Fn(s,e){var t,n,i,r;const a=Ti(),l=(e==null?void 0:e.weekStartsOn)??((n=(t=e==null?void 0:e.locale)==null?void 0:t.options)==null?void 0:n.weekStartsOn)??a.weekStartsOn??((r=(i=a.locale)==null?void 0:i.options)==null?void 0:r.weekStartsOn)??0,c=Mt(s,e==null?void 0:e.in),h=c.getDay(),m=(h<l?7:0)+h-l;return c.setDate(c.getDate()-m),c.setHours(0,0,0,0),c}function Ni(s,e){return Fn(s,{...e,weekStartsOn:1})}function Xa(s,e){const t=Mt(s,void 0),n=t.getFullYear(),i=Jt(t,0);i.setFullYear(n+1,0,4),i.setHours(0,0,0,0);const r=Ni(i),a=Jt(t,0);a.setFullYear(n,0,4),a.setHours(0,0,0,0);const l=Ni(a);return t.getTime()>=r.getTime()?n+1:t.getTime()>=l.getTime()?n:n-1}function Qa(s){const e=Mt(s),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+s-+t}function Za(s,...e){const t=Jt.bind(null,e.find(n=>typeof n=="object"));return e.map(t)}function Ja(s,e){const t=Mt(s,void 0);return t.setHours(0,0,0,0),t}function du(s,e,t){const[n,i]=Za(void 0,s,e),r=Ja(n),a=Ja(i),l=+r-Qa(r),c=+a-Qa(a);return Math.round((l-c)/cu)}function hu(s,e){const t=Xa(s),n=Jt(s,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),Ni(n)}function pu(s){return s instanceof Date||typeof s=="object"&&Object.prototype.toString.call(s)==="[object Date]"}function fu(s){return!(!pu(s)&&typeof s!="number"||isNaN(+Mt(s)))}function gu(s,e){const[t,n]=Za(s,e.start,e.end);return{start:t,end:n}}function Ra(s,e){const{start:t,end:n}=gu(void 0,s);let i=+t>+n;const r=i?+t:+n,a=i?n:t;a.setHours(0,0,0,0);let l=1;const c=[];for(;+a<=r;)c.push(Jt(t,a)),a.setDate(a.getDate()+l),a.setHours(0,0,0,0);return i?c.reverse():c}function mu(s,e){const t=Mt(s,void 0);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}const bu={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"}},vu=(s,e,t)=>{let n;const i=bu[s];return typeof i=="string"?n=i:e===1?n=i.one:n=i.other.replace("{{count}}",e.toString()),t!=null&&t.addSuffix?t.comparison&&t.comparison>0?"in "+n:n+" ago":n};function br(s){return(e={})=>{const t=e.width?String(e.width):s.defaultWidth;return s.formats[t]||s.formats[s.defaultWidth]}}const ku={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},yu={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},_u={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},wu={date:br({formats:ku,defaultWidth:"full"}),time:br({formats:yu,defaultWidth:"full"}),dateTime:br({formats:_u,defaultWidth:"full"})},$u={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},xu=(s,e,t,n)=>$u[s];function Vn(s){return(e,t)=>{const n=t!=null&&t.context?String(t.context):"standalone";let i;if(n==="formatting"&&s.formattingValues){const a=s.defaultFormattingWidth||s.defaultWidth,l=t!=null&&t.width?String(t.width):a;i=s.formattingValues[l]||s.formattingValues[a]}else{const a=s.defaultWidth,l=t!=null&&t.width?String(t.width):s.defaultWidth;i=s.values[l]||s.values[a]}const r=s.argumentCallback?s.argumentCallback(e):e;return i[r]}}const Cu={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Su={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Tu={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"]},Nu={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"]},Mu={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"}},Du={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"}},Ou=(s,e)=>{const t=Number(s),n=t%100;if(n>20||n<10)switch(n%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},Eu={ordinalNumber:Ou,era:Vn({values:Cu,defaultWidth:"wide"}),quarter:Vn({values:Su,defaultWidth:"wide",argumentCallback:s=>s-1}),month:Vn({values:Tu,defaultWidth:"wide"}),day:Vn({values:Nu,defaultWidth:"wide"}),dayPeriod:Vn({values:Mu,defaultWidth:"wide",formattingValues:Du,defaultFormattingWidth:"wide"})};function Hn(s){return(e,t={})=>{const n=t.width,i=n&&s.matchPatterns[n]||s.matchPatterns[s.defaultMatchWidth],r=e.match(i);if(!r)return null;const a=r[0],l=n&&s.parsePatterns[n]||s.parsePatterns[s.defaultParseWidth],c=Array.isArray(l)?Au(l,g=>g.test(a)):Pu(l,g=>g.test(a));let h;h=s.valueCallback?s.valueCallback(c):c,h=t.valueCallback?t.valueCallback(h):h;const m=e.slice(a.length);return{value:h,rest:m}}}function Pu(s,e){for(const t in s)if(Object.prototype.hasOwnProperty.call(s,t)&&e(s[t]))return t}function Au(s,e){for(let t=0;t<s.length;t++)if(e(s[t]))return t}function Iu(s){return(e,t={})=>{const n=e.match(s.matchPattern);if(!n)return null;const i=n[0],r=e.match(s.parsePattern);if(!r)return null;let a=s.valueCallback?s.valueCallback(r[0]):r[0];a=t.valueCallback?t.valueCallback(a):a;const l=e.slice(i.length);return{value:a,rest:l}}}const Lu=/^(\d+)(th|st|nd|rd)?/i,Bu=/\d+/i,Fu={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},Vu={any:[/^b/i,/^(a|c)/i]},Hu={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Uu={any:[/1/i,/2/i,/3/i,/4/i]},ju={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},qu={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]},Wu={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},zu={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]},Yu={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},Ku={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}},Gu={ordinalNumber:Iu({matchPattern:Lu,parsePattern:Bu,valueCallback:s=>parseInt(s,10)}),era:Hn({matchPatterns:Fu,defaultMatchWidth:"wide",parsePatterns:Vu,defaultParseWidth:"any"}),quarter:Hn({matchPatterns:Hu,defaultMatchWidth:"wide",parsePatterns:Uu,defaultParseWidth:"any",valueCallback:s=>s+1}),month:Hn({matchPatterns:ju,defaultMatchWidth:"wide",parsePatterns:qu,defaultParseWidth:"any"}),day:Hn({matchPatterns:Wu,defaultMatchWidth:"wide",parsePatterns:zu,defaultParseWidth:"any"}),dayPeriod:Hn({matchPatterns:Yu,defaultMatchWidth:"any",parsePatterns:Ku,defaultParseWidth:"any"})},Xu={code:"en-US",formatDistance:vu,formatLong:wu,formatRelative:xu,localize:Eu,match:Gu,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Qu(s,e){const t=Mt(s,void 0);return du(t,mu(t))+1}function Zu(s,e){const t=Mt(s,void 0),n=+Ni(t)-+hu(t);return Math.round(n/Ya)+1}function eo(s,e){var t,n,i,r;const a=Mt(s,e==null?void 0:e.in),l=a.getFullYear(),c=Ti(),h=(e==null?void 0:e.firstWeekContainsDate)??((n=(t=e==null?void 0:e.locale)==null?void 0:t.options)==null?void 0:n.firstWeekContainsDate)??c.firstWeekContainsDate??((r=(i=c.locale)==null?void 0:i.options)==null?void 0:r.firstWeekContainsDate)??1,m=Jt((e==null?void 0:e.in)||s,0);m.setFullYear(l+1,0,h),m.setHours(0,0,0,0);const g=Fn(m,e),f=Jt((e==null?void 0:e.in)||s,0);f.setFullYear(l,0,h),f.setHours(0,0,0,0);const k=Fn(f,e);return+a>=+g?l+1:+a>=+k?l:l-1}function Ju(s,e){var t,n,i,r;const a=Ti(),l=(e==null?void 0:e.firstWeekContainsDate)??((n=(t=e==null?void 0:e.locale)==null?void 0:t.options)==null?void 0:n.firstWeekContainsDate)??a.firstWeekContainsDate??((r=(i=a.locale)==null?void 0:i.options)==null?void 0:r.firstWeekContainsDate)??1,c=eo(s,e),h=Jt((e==null?void 0:e.in)||s,0);return h.setFullYear(c,0,l),h.setHours(0,0,0,0),Fn(h,e)}function to(s,e){const t=Mt(s,e==null?void 0:e.in),n=+Fn(t,e)-+Ju(t,e);return Math.round(n/Ya)+1}function xe(s,e){const t=s<0?"-":"",n=Math.abs(s).toString().padStart(e,"0");return t+n}const ks={y(s,e){const t=s.getFullYear(),n=t>0?t:1-t;return xe(e==="yy"?n%100:n,e.length)},M(s,e){const t=s.getMonth();return e==="M"?String(t+1):xe(t+1,2)},d(s,e){return xe(s.getDate(),e.length)},a(s,e){const t=s.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];case"aaaa":default:return t==="am"?"a.m.":"p.m."}},h(s,e){return xe(s.getHours()%12||12,e.length)},H(s,e){return xe(s.getHours(),e.length)},m(s,e){return xe(s.getMinutes(),e.length)},s(s,e){return xe(s.getSeconds(),e.length)},S(s,e){const t=e.length,n=s.getMilliseconds(),i=Math.trunc(n*Math.pow(10,t-3));return xe(i,e.length)}},rn={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},so={G:function(s,e,t){const n=s.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(n,{width:"abbreviated"});case"GGGGG":return t.era(n,{width:"narrow"});case"GGGG":default:return t.era(n,{width:"wide"})}},y:function(s,e,t){if(e==="yo"){const n=s.getFullYear(),i=n>0?n:1-n;return t.ordinalNumber(i,{unit:"year"})}return ks.y(s,e)},Y:function(s,e,t,n){const i=eo(s,n),r=i>0?i:1-i;if(e==="YY"){const a=r%100;return xe(a,2)}return e==="Yo"?t.ordinalNumber(r,{unit:"year"}):xe(r,e.length)},R:function(s,e){const t=Xa(s);return xe(t,e.length)},u:function(s,e){const t=s.getFullYear();return xe(t,e.length)},Q:function(s,e,t){const n=Math.ceil((s.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return xe(n,2);case"Qo":return t.ordinalNumber(n,{unit:"quarter"});case"QQQ":return t.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(n,{width:"wide",context:"formatting"})}},q:function(s,e,t){const n=Math.ceil((s.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return xe(n,2);case"qo":return t.ordinalNumber(n,{unit:"quarter"});case"qqq":return t.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(n,{width:"wide",context:"standalone"})}},M:function(s,e,t){const n=s.getMonth();switch(e){case"M":case"MM":return ks.M(s,e);case"Mo":return t.ordinalNumber(n+1,{unit:"month"});case"MMM":return t.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(n,{width:"wide",context:"formatting"})}},L:function(s,e,t){const n=s.getMonth();switch(e){case"L":return String(n+1);case"LL":return xe(n+1,2);case"Lo":return t.ordinalNumber(n+1,{unit:"month"});case"LLL":return t.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(n,{width:"wide",context:"standalone"})}},w:function(s,e,t,n){const i=to(s,n);return e==="wo"?t.ordinalNumber(i,{unit:"week"}):xe(i,e.length)},I:function(s,e,t){const n=Zu(s);return e==="Io"?t.ordinalNumber(n,{unit:"week"}):xe(n,e.length)},d:function(s,e,t){return e==="do"?t.ordinalNumber(s.getDate(),{unit:"date"}):ks.d(s,e)},D:function(s,e,t){const n=Qu(s);return e==="Do"?t.ordinalNumber(n,{unit:"dayOfYear"}):xe(n,e.length)},E:function(s,e,t){const n=s.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(n,{width:"short",context:"formatting"});case"EEEE":default:return t.day(n,{width:"wide",context:"formatting"})}},e:function(s,e,t,n){const i=s.getDay(),r=(i-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(r);case"ee":return xe(r,2);case"eo":return t.ordinalNumber(r,{unit:"day"});case"eee":return t.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(i,{width:"short",context:"formatting"});case"eeee":default:return t.day(i,{width:"wide",context:"formatting"})}},c:function(s,e,t,n){const i=s.getDay(),r=(i-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(r);case"cc":return xe(r,e.length);case"co":return t.ordinalNumber(r,{unit:"day"});case"ccc":return t.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(i,{width:"narrow",context:"standalone"});case"cccccc":return t.day(i,{width:"short",context:"standalone"});case"cccc":default:return t.day(i,{width:"wide",context:"standalone"})}},i:function(s,e,t){const n=s.getDay(),i=n===0?7:n;switch(e){case"i":return String(i);case"ii":return xe(i,e.length);case"io":return t.ordinalNumber(i,{unit:"day"});case"iii":return t.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(n,{width:"short",context:"formatting"});case"iiii":default:return t.day(n,{width:"wide",context:"formatting"})}},a:function(s,e,t){const n=s.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(n,{width:"wide",context:"formatting"})}},b:function(s,e,t){const n=s.getHours();let i;switch(n===12?i=rn.noon:n===0?i=rn.midnight:i=n/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(s,e,t){const n=s.getHours();let i;switch(n>=17?i=rn.evening:n>=12?i=rn.afternoon:n>=4?i=rn.morning:i=rn.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(s,e,t){if(e==="ho"){let n=s.getHours()%12;return n===0&&(n=12),t.ordinalNumber(n,{unit:"hour"})}return ks.h(s,e)},H:function(s,e,t){return e==="Ho"?t.ordinalNumber(s.getHours(),{unit:"hour"}):ks.H(s,e)},K:function(s,e,t){const n=s.getHours()%12;return e==="Ko"?t.ordinalNumber(n,{unit:"hour"}):xe(n,e.length)},k:function(s,e,t){let n=s.getHours();return n===0&&(n=24),e==="ko"?t.ordinalNumber(n,{unit:"hour"}):xe(n,e.length)},m:function(s,e,t){return e==="mo"?t.ordinalNumber(s.getMinutes(),{unit:"minute"}):ks.m(s,e)},s:function(s,e,t){return e==="so"?t.ordinalNumber(s.getSeconds(),{unit:"second"}):ks.s(s,e)},S:function(s,e){return ks.S(s,e)},X:function(s,e,t){const n=s.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return io(n);case"XXXX":case"XX":return Bs(n);case"XXXXX":case"XXX":default:return Bs(n,":")}},x:function(s,e,t){const n=s.getTimezoneOffset();switch(e){case"x":return io(n);case"xxxx":case"xx":return Bs(n);case"xxxxx":case"xxx":default:return Bs(n,":")}},O:function(s,e,t){const n=s.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+no(n,":");case"OOOO":default:return"GMT"+Bs(n,":")}},z:function(s,e,t){const n=s.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+no(n,":");case"zzzz":default:return"GMT"+Bs(n,":")}},t:function(s,e,t){const n=Math.trunc(+s/1e3);return xe(n,e.length)},T:function(s,e,t){return xe(+s,e.length)}};function no(s,e=""){const t=s>0?"-":"+",n=Math.abs(s),i=Math.trunc(n/60),r=n%60;return r===0?t+String(i):t+String(i)+e+xe(r,2)}function io(s,e){return s%60===0?(s>0?"-":"+")+xe(Math.abs(s)/60,2):Bs(s,e)}function Bs(s,e=""){const t=s>0?"-":"+",n=Math.abs(s),i=xe(Math.trunc(n/60),2),r=xe(n%60,2);return t+i+e+r}const ro=(s,e)=>{switch(s){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},ao=(s,e)=>{switch(s){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Ru=(s,e)=>{const t=s.match(/(P+)(p+)?/)||[],n=t[1],i=t[2];if(!i)return ro(s,e);let r;switch(n){case"P":r=e.dateTime({width:"short"});break;case"PP":r=e.dateTime({width:"medium"});break;case"PPP":r=e.dateTime({width:"long"});break;case"PPPP":default:r=e.dateTime({width:"full"});break}return r.replace("{{date}}",ro(n,e)).replace("{{time}}",ao(i,e))},ed={p:ao,P:Ru},td=/^D+$/,sd=/^Y+$/,nd=["D","DD","YY","YYYY"];function id(s){return td.test(s)}function rd(s){return sd.test(s)}function ad(s,e,t){const n=od(s,e,t);if(console.warn(n),nd.includes(s))throw new RangeError(n)}function od(s,e,t){const n=s[0]==="Y"?"years":"days of the month";return`Use \`${s.toLowerCase()}\` instead of \`${s}\` (in \`${e}\`) for formatting ${n} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const ld=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,cd=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ud=/^'([^]*?)'?$/,dd=/''/g,hd=/[a-zA-Z]/;function pd(s,e,t){var n,i,r,a;const l=Ti(),c=l.locale??Xu,h=l.firstWeekContainsDate??((i=(n=l.locale)==null?void 0:n.options)==null?void 0:i.firstWeekContainsDate)??1,m=l.weekStartsOn??((a=(r=l.locale)==null?void 0:r.options)==null?void 0:a.weekStartsOn)??0,g=Mt(s,void 0);if(!fu(g))throw new RangeError("Invalid time value");let f=e.match(cd).map(v=>{const $=v[0];if($==="p"||$==="P"){const N=ed[$];return N(v,c.formatLong)}return v}).join("").match(ld).map(v=>{if(v==="''")return{isToken:!1,value:"'"};const $=v[0];if($==="'")return{isToken:!1,value:fd(v)};if(so[$])return{isToken:!0,value:v};if($.match(hd))throw new RangeError("Format string contains an unescaped latin alphabet character `"+$+"`");return{isToken:!1,value:v}});c.localize.preprocessor&&(f=c.localize.preprocessor(g,f));const k={firstWeekContainsDate:h,weekStartsOn:m,locale:c};return f.map(v=>{if(!v.isToken)return v.value;const $=v.value;(rd($)||id($))&&ad($,e,String(s));const N=so[$[0]];return N(g,$,c.localize,k)}).join("")}function fd(s){const e=s.match(ud);return e?e[1].replace(dd,"'"):s}function gd(s,e){const t=Mt(s,void 0).getDay();return t===0?7:t}function md(s,e,t="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:s,timeZoneName:t}).format(e).split(/\s/g).slice(2).join(" ")}const oo={},Un={};function Fs(s,e){try{const t=(oo[s]||(oo[s]=new Intl.DateTimeFormat("en-US",{timeZone:s,timeZoneName:"longOffset"}).format))(e).split("GMT")[1];return t in Un?Un[t]:lo(t,t.split(":"))}catch{if(s in Un)return Un[s];const t=s==null?void 0:s.match(bd);return t?lo(s,t.slice(1)):NaN}}const bd=/([+-]\d\d):?(\d\d)?/;function lo(s,e){const t=+(e[0]||0),n=+(e[1]||0),i=+(e[2]||0)/60;return Un[s]=t*60+n>0?t*60+n+i:t*60-n-i}let jn=class pi extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(Fs(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)),uo(this),vr(this)):this.setTime(Date.now())}static tz(e,...t){return t.length?new pi(...t,e):new pi(Date.now(),e)}withTimeZone(e){return new pi(+this,e)}getTimezoneOffset(){const e=-Fs(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),vr(this),+this}[Symbol.for("constructDateFrom")](e){return new pi(+new Date(e),this.timeZone)}};const co=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(s=>{if(!co.test(s))return;const e=s.replace(co,"$1UTC");jn.prototype[e]&&(s.startsWith("get")?jn.prototype[s]=function(){return this.internal[e]()}:(jn.prototype[s]=function(){return Date.prototype[e].apply(this.internal,arguments),vd(this),+this},jn.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),vr(this),+this}))});function vr(s){s.internal.setTime(+s),s.internal.setUTCSeconds(s.internal.getUTCSeconds()-Math.round(-Fs(s.timeZone,s)*60))}function vd(s){Date.prototype.setFullYear.call(s,s.internal.getUTCFullYear(),s.internal.getUTCMonth(),s.internal.getUTCDate()),Date.prototype.setHours.call(s,s.internal.getUTCHours(),s.internal.getUTCMinutes(),s.internal.getUTCSeconds(),s.internal.getUTCMilliseconds()),uo(s)}function uo(s){const e=Fs(s.timeZone,s),t=e>0?Math.floor(e):Math.ceil(e),n=new Date(+s);n.setUTCHours(n.getUTCHours()-1);const i=-new Date(+s).getTimezoneOffset(),r=-new Date(+n).getTimezoneOffset(),a=i-r,l=Date.prototype.getHours.apply(s)!==s.internal.getUTCHours();a&&l&&s.internal.setUTCMinutes(s.internal.getUTCMinutes()+a);const c=i-t;c&&Date.prototype.setUTCMinutes.call(s,Date.prototype.getUTCMinutes.call(s)+c);const h=new Date(+s);h.setUTCSeconds(0);const m=i>0?h.getSeconds():(h.getSeconds()-60)%60,g=Math.round(-(Fs(s.timeZone,s)*60))%60;(g||m)&&(s.internal.setUTCSeconds(s.internal.getUTCSeconds()+g),Date.prototype.setUTCSeconds.call(s,Date.prototype.getUTCSeconds.call(s)+g+m));const f=Fs(s.timeZone,s),k=f>0?Math.floor(f):Math.ceil(f),v=-new Date(+s).getTimezoneOffset()-k,$=k!==t,N=v-c;if($&&N){Date.prototype.setUTCMinutes.call(s,Date.prototype.getUTCMinutes.call(s)+N);const x=Fs(s.timeZone,s),S=x>0?Math.floor(x):Math.ceil(x),P=k-S;P&&(s.internal.setUTCMinutes(s.internal.getUTCMinutes()+P),Date.prototype.setUTCMinutes.call(s,Date.prototype.getUTCMinutes.call(s)+P))}}let kr=class fi extends jn{static tz(e,...t){return t.length?new fi(...t,e):new fi(Date.now(),e)}toISOString(){const[e,t,n]=this.tzComponents(),i=`${e}${t}:${n}`;return this.internal.toISOString().slice(0,-1)+i}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,t,n,i]=this.internal.toUTCString().split(" ");return`${e==null?void 0:e.slice(0,-1)} ${n} ${t} ${i}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[t,n,i]=this.tzComponents();return`${e} GMT${t}${n}${i} (${md(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:(t==null?void 0:t.timeZone)||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:(t==null?void 0:t.timeZone)||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:(t==null?void 0:t.timeZone)||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),t=e>0?"-":"+",n=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),i=String(Math.abs(e)%60).padStart(2,"0");return[t,n,i]}withTimeZone(e){return new fi(+this,e)}[Symbol.for("constructDateFrom")](e){return new fi(+new Date(e),this.timeZone)}};window.pktTz=window.pktTz===void 0?"Europe/Oslo":window.pktTz;const kd=(s=window.pktTz)=>{const e=new kr(new Date().toISOString(),s);return e.setHours(0,0,0,0),isNaN(e.getTime())?new Date:new Date(e.getFullYear(),e.getMonth(),e.getDate())};function ls(s){if(!s||s==="")return new Date;if(/^\d{4}-\d{2}-\d{2}$/.test(s)){const[e,t,n]=s.split("-").map(Number);return new Date(e,t-1,n)}if(/^\d{4}-\d{2}$/.test(s)){const[e,t]=s.split("-").map(Number);return new Date(e,t-1,1)}return/^\d{4}$/.test(s)?new Date(Number(s),0,1):new Date(s)}const rt=s=>{if(!s||isNaN(s.getTime()))return"";const e=s.getFullYear(),t=String(s.getMonth()+1).padStart(2,"0"),n=String(s.getDate()).padStart(2,"0");return`${e}-${t}-${n}`},ys=s=>{if(!s)return null;const e=ls(s);return isNaN(e.getTime())?null:e},ho=(s,e)=>{const t=Lt(s);return isNaN(t.getTime())?"":pd(t,e)},Lt=(s="",e)=>{const t=typeof s=="string"?ls(s):s;return!t||isNaN(t.getTime())?new Date:t},Vs=(s,e,t=1)=>{if(typeof s!="number"||typeof e!="number"||typeof t!="number"||isNaN(s)||isNaN(e)||isNaN(t))return new Date;const n=new Date(s,e,t);return isNaN(n.getTime())?new Date:n},qn=s=>{let e;return typeof s=="number"?e=new kr(s,window.pktTz):e=new kr(s,window.pktTz),e.setHours(12,0,0,0),e};let yr=null,po;const yd=s=>{if(!s||isNaN(s.getTime()))return"";const e=typeof window<"u"?window.pktTz:void 0;return(!yr||po!==e)&&(yr=new Intl.DateTimeFormat("no",{dateStyle:"full",timeZone:e}),po=e),yr.format(s)},_d=(s,e,t)=>{if(!s||isNaN(s.getTime()))return!1;const n=e?Lt(e):null,i=t?Lt(t):null;return!(n&&s<n||i&&s>i)},wd=(s,e)=>{if(!s||isNaN(s.getTime())||!Array.isArray(e))return!1;const t=rt(s);return e.includes(t)},$d=(s,e)=>{if(!s||isNaN(s.getTime())||!Array.isArray(e))return!1;const t=s.getDay().toString();return e.includes(t)},fo=(s,e,t,n,i)=>!(!s||isNaN(s.getTime())||!_d(s,e,t)||n&&wd(s,n)||i&&$d(s,i)),xd=(s,e,t,n,i)=>s.filter(r=>{const a=ys(r);return a&&fo(a,e,t,n,i)}),go=s=>s.slice().sort((e,t)=>{const n=ys(e),i=ys(t);return!n||!i?0:n.getTime()-i.getTime()}),Cd=(s,e)=>{const t=ys(s),n=ys(e);return!t||!n?!1:t<=n},Wn=s=>{if(!s)return[];if(Array.isArray(s))return s.filter(Boolean);if(typeof s=="string"&&s.trimStart().startsWith("["))try{const e=JSON.parse(s);if(Array.isArray(e))return e.filter(Boolean)}catch{}return String(s).split(",").map(e=>e.trim()).filter(Boolean)},Sd=s=>s.join(","),Td=s=>Wn(s),Nd=s=>s?ls(s):null,Md=s=>{if(typeof s=="string")return s.split(",").map(e=>ls(e));if(Array.isArray(s))return s.map(e=>ls(e))},an={csvToArray:Td,stringToDate:Nd,stringsToDate:Md},Dd={earliest:{default:null},latest:{default:null},weeknumbers:{default:!1},withcontrols:{default:!1},multiple:{default:!1},maxMultiple:{default:4},range:{default:!1}},Hs={props:Dd};function mo(s,e){const t=(e.excludedates??[]).map(n=>typeof n=="string"?n:rt(n));return!fo(s,e.earliest,e.latest,t,e.excludeweekdays??[])}function Od(s,e,t,n){return!!(mo(s,t)||!e&&n.multiple&&n.maxMultiple>0&&n.selectedCount>=n.maxMultiple)}function Ed(s,e,t){const n=Vs(s,e,0);return!(t&&Lt(t)>n)}function Pd(s,e,t){const n=Vs(e===11?s+1:s,e===11?0:e+1,1);return!(t&&Lt(t)<n)}const zn=7,Ad=6;function Id(s,e){const t=Vs(s,e,1),n=Vs(s,e+1,0),i=(t.getDay()+Ad)%zn,r=n.getDate(),a=Math.ceil((r+i)/zn),l=Vs(s,e,0).getDate(),c=to(t);return{firstDayOfMonth:t,lastDayOfMonth:n,startingDay:i,numDays:r,numRows:a,numDaysPrevMonth:l,initialWeek:c}}function Ld(s,e,t,n){const{startingDay:i,numDays:r}=n;return s===0&&e<i?"prev-month":t>r?"next-month":"current-month"}function Bd(s,e,t,n){const{startingDay:i,numDaysPrevMonth:r,numDays:a}=n;return s==="prev-month"?r-(i-e-1):s==="next-month"?t-a:t}function on(s){return typeof s=="string"&&(s=s.split(",")),s.length===1&&s[0]===""?[]:s.map(e=>ls(e))}function bo(s,e){const t=Ra({start:s,end:e}),n={};if(Array.isArray(t)&&t.length)for(let i=0;i<t.length;i++){const r=t[i],a=r>s&&r<e;n[rt(r)]=a}return n}function vo(s,e,t,n){if(e.length!==1)return!0;const i=Ra({start:e[0],end:s});if(!Array.isArray(i)||!i.length)return!0;for(let r=0;r<i.length;r++){for(const a of t??[])if(a>e[0]&&a<s)return!1;if((n??[]).includes(gd(i[r]).toString()))return!1}return!0}function _r(s,e){const t=rt(s);return e.includes(t)?e:[...e,t]}function wr(s,e){const t=rt(s),n=e.indexOf(t);if(n===-1)return e;if(e.length===1)return[];const i=[...e];return i.splice(n,1),i}function Fd(s,e,t){const n=rt(s);return e.includes(n)?wr(s,e):t>0&&e.length>=t?e:_r(s,e)}function Vd(s,e,t){const n=rt(s),i=on(e);if(e.includes(n))return e.indexOf(n)===0?[]:wr(s,e);if(e.length>1)return[n];if(e.length===1){if(!vo(s,i,t.excludedates,t.excludeweekdays))return[n];if(i[0]>s)return[n]}return _r(s,e)}const Hd={ArrowLeft:-1,ArrowRight:1,ArrowUp:-zn,ArrowDown:zn};function Ud(s){var e;const t=s.nodeName;return t==="INPUT"||t==="SELECT"||t==="BUTTON"&&!((e=s.dataset)!=null&&e.date)}function jd(s,e,t){let n=Ga(s,e);if(!n)return null;let i=t(`button[data-date="${rt(n)}"]`);for(;i instanceof HTMLButtonElement&&i.dataset.disabled;)if(n=Ga(n,e),i=t(`button[data-date="${rt(n)}"]`),!i)return null;return n}function qd(s){return Hd[s]??null}var Wd=Object.defineProperty,zd=Object.getOwnPropertyDescriptor,Oe=(s,e,t,n)=>{for(var i=n>1?void 0:n?zd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Wd(e,t,i),i};let Ne=class extends At{constructor(){super(...arguments),this.selected=[],this.multiple=Hs.props.multiple.default,this.maxMultiple=Hs.props.maxMultiple.default,this.range=Hs.props.range.default,this.earliest=Hs.props.earliest.default,this.latest=Hs.props.latest.default,this.excludedates=[],this.excludeweekdays=[],this.weeknumbers=Hs.props.weeknumbers.default,this.withcontrols=Hs.props.withcontrols.default,this.currentmonth=null,this.today=null,this.dayStrings=this.strings.dates.daysShort,this.dayStringsLong=this.strings.dates.days,this.monthStrings=this.strings.dates.months,this.weekString=this.strings.dates.week,this.prevMonthString=this.strings.dates.prevMonth,this.nextMonthString=this.strings.dates.nextMonth,this._selected=[],this.inRange={},this.rangeHovered=null,this.year=0,this.month=0,this.week=0,this.currentmonthtouched=!1,this.focusedDate=null,this.selectableDates=[],this.tabIndexSet=0}get todayDate(){return this.today?ls(this.today):kd()}firstUpdated(e){this.addEventListener("keydown",this.handleKeydown)}disconnectedCallback(){this.removeEventListener("keydown",this.handleKeydown),super.disconnectedCallback()}updated(e){super.updated(e),e.has("selected")&&this.convertSelected()}convertSelected(){typeof this.selected=="string"&&(this.selected=this.selected.split(",")),this.selected.length===1&&this.selected[0]===""&&(this.selected=[]),this._selected=on(this.selected),this.range&&this.selected.length===2&&(this.inRange=bo(this._selected[0],this._selected[1])),this.setCurrentMonth()}setCurrentMonth(){if(this.currentmonth===null&&!this.currentmonthtouched&&(this.currentmonthtouched=!0),this.selected.length&&this.selected[0]!==""){const e=ls(this.selected[this.selected.length-1]);this.currentmonth=isNaN(e.getTime())?qn(this.todayDate):e}else this.currentmonth===null&&(this.currentmonth=qn(this.todayDate));(!this.currentmonth||isNaN(this.currentmonth.getTime()))&&(this.currentmonth=qn(this.todayDate)),this.year=this.currentmonth.getFullYear(),this.month=this.currentmonth.getMonth()}handleKeydown(e){const t=qd(e.key);t!==null&&this.handleArrowKey(e,t)}handleArrowKey(e,t){const n=e.target;if(Ud(n))return;if(e.preventDefault(),!this.focusedDate){this.focusOnCurrentDate();return}const i=this.focusedDate?Lt(this.focusedDate):Vs(this.year,this.month,1),r=jd(i,t,this.querySelector.bind(this));if(r){const a=this.querySelector(`button[data-date="${rt(r)}"]`);a instanceof HTMLButtonElement&&!a.dataset.disabled&&(this.focusedDate=rt(r),a.focus())}}render(){return y`
|
|
248
248
|
<div
|
|
249
249
|
class="pkt-calendar ${this.weeknumbers?"pkt-cal-weeknumbers":""}"
|
|
250
250
|
@focusout=${this.closeEvent}
|
|
@@ -309,12 +309,12 @@
|
|
|
309
309
|
/>
|
|
310
310
|
</div>`:y`<div class="pkt-txt-16-medium pkt-calendar__month-title" aria-live="polite">
|
|
311
311
|
${this.monthStrings[this.month]} ${this.year}
|
|
312
|
-
</div>`}getDayViewData(e,t){const n=Vs(this.year,this.month,e),i=rt(n),r=i===rt(t),a=this.selected.includes(i),l=this.isDayDisabled(n,a),c=this.calculateTabIndex(i,l,e);return{currentDate:n,currentDateISO:i,isToday:r,isSelected:a,isDisabled:l,ariaLabel:
|
|
312
|
+
</div>`}getDayViewData(e,t){const n=Vs(this.year,this.month,e),i=rt(n),r=i===rt(t),a=this.selected.includes(i),l=this.isDayDisabled(n,a),c=this.calculateTabIndex(i,l,e);return{currentDate:n,currentDateISO:i,isToday:r,isSelected:a,isDisabled:l,ariaLabel:yd(n),tabindex:c}}getDateConstraints(){return{earliest:this.earliest,latest:this.latest,excludedates:this.excludedates,excludeweekdays:this.excludeweekdays}}isDayDisabled(e,t){return Od(e,t,this.getDateConstraints(),{multiple:this.multiple,maxMultiple:this.maxMultiple,selectedCount:this.selected.length})}calculateTabIndex(e,t,n){return this.focusedDate?this.focusedDate===e&&!t?"0":"-1":!t&&this.tabIndexSet===0?(this.tabIndexSet=n,"0"):this.tabIndexSet===n?"0":"-1"}getDayCellClasses(e){const{currentDateISO:t,isToday:n,isSelected:i}=e,r=this.range&&(this.selected.length===2||this.rangeHovered!==null)&&t===this.selected[0],a=this.range&&this.selected.length===2&&t===this.selected[1];return{"pkt-cal-today":n,"pkt-cal-selected":i,"pkt-cal-in-range":this.inRange[t],"pkt-cal-excluded":this.isExcluded(e.currentDate),"pkt-cal-in-range-first":r,"pkt-cal-in-range-last":a,"pkt-cal-range-hover":this.rangeHovered!==null&&t===rt(this.rangeHovered)}}getDayButtonClasses(e){const{currentDateISO:t,isToday:n,isSelected:i,isDisabled:r}=e,a=this.range&&(this.selected.length===2||this.rangeHovered!==null)&&t===this.selected[0],l=this.range&&this.selected.length===2&&t===this.selected[1];return{"pkt-calendar__date":!0,"pkt-calendar__date--today":n,"pkt-calendar__date--selected":i,"pkt-calendar__date--disabled":r,"pkt-calendar__date--in-range":this.inRange[t],"pkt-calendar__date--in-range-hover":this.rangeHovered!==null&&t===rt(this.rangeHovered),"pkt-calendar__date--range-start":a,"pkt-calendar__date--range-end":l}}handleDayFocus(e,t){this.range&&!this.isExcluded(e)&&this.handleRangeHover(e),this.focusedDate=t}renderDayView(e,t){const n=this.getDayViewData(e,t),{currentDate:i,currentDateISO:r,isSelected:a,isDisabled:l,ariaLabel:c,tabindex:h}=n;this.selectableDates.push({currentDateISO:r,isDisabled:l,tabindex:h});const m=this.getDayCellClasses(n),g=this.getDayButtonClasses(n);return y`<td class=${X(m)}>
|
|
313
313
|
<button
|
|
314
314
|
type="button"
|
|
315
315
|
aria-pressed=${a?"true":"false"}
|
|
316
316
|
?disabled=${l}
|
|
317
|
-
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only ${
|
|
317
|
+
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only ${X(g)}"
|
|
318
318
|
@mouseover=${()=>this.range&&!this.isExcluded(i)&&this.handleRangeHover(i)}
|
|
319
319
|
@focus=${()=>this.handleDayFocus(i,r)}
|
|
320
320
|
aria-label="${c}"
|
|
@@ -333,9 +333,9 @@
|
|
|
333
333
|
>
|
|
334
334
|
<span class="pkt-btn__text pkt-txt-14-light">${e}</span>
|
|
335
335
|
</div>
|
|
336
|
-
</td>`}renderWeekRow(e){return y`<tr class="pkt-cal-week-row" role="row">${e}</tr>`}renderCalendarBody(){const e=this.todayDate,t=
|
|
336
|
+
</td>`}renderWeekRow(e){return y`<tr class="pkt-cal-week-row" role="row">${e}</tr>`}renderCalendarBody(){const e=this.todayDate,t=Id(this.year,this.month);this.selectableDates=[],this.tabIndexSet=0;let n=1;this.week=t.initialWeek;const i=[];for(let r=0;r<t.numRows;r++){const a=[];this.weeknumbers&&a.push(y`<td class="pkt-cal-week">${this.week}</td>`),this.week++;for(let l=0;l<zn;l++){const c=Ld(r,l,n,t);if(c==="current-month")a.push(this.renderDayView(n,e)),n++;else{const h=Bd(c,l,n,t);a.push(this.renderEmptyDayCell(h)),c==="next-month"&&n++}}i.push(this.renderWeekRow(a))}return i}isExcluded(e){return mo(e,this.getDateConstraints())}isPrevMonthAllowed(){return Ed(this.year,this.month,this.earliest)}prevMonth(){const e=this.month===0?11:this.month-1,t=this.month===0?this.year-1:this.year;this.changeMonth(t,e)}isNextMonthAllowed(){return Pd(this.year,this.month,this.latest)}nextMonth(){const e=this.month===11?0:this.month+1,t=this.month===11?this.year+1:this.year;this.changeMonth(t,e)}changeMonth(e,t){this.year=typeof e=="string"?parseInt(e):e,this.month=typeof t=="string"?parseInt(t):t,this.currentmonth=qn(new Date(this.year,this.month,1)),this.tabIndexSet=0,this.focusedDate=null,this.selectableDates=[]}emptySelected(){this.selected=[],this._selected=[],this.inRange={}}normalizeSelected(){return typeof this.selected=="string"?this.selected.split(","):this.selected}addToSelected(e){this.selected=_r(e,this.normalizeSelected()),this._selected=on(this.selected),this.range&&this.selected.length===2&&(this.convertSelected(),this.close())}removeFromSelected(e){this.selected=wr(e,this.normalizeSelected()),this._selected=on(this.selected)}toggleSelected(e){this.selected=Fd(e,this.normalizeSelected(),this.maxMultiple),this._selected=on(this.selected)}isRangeAllowed(e){return vo(e,this._selected,this.excludedates,this.excludeweekdays)}handleRangeSelect(e){return this.selected=Vd(e,this.normalizeSelected(),{excludedates:this.excludedates,excludeweekdays:this.excludeweekdays}),this._selected=on(this.selected),this.selected.length===2?(this.convertSelected(),this.close()):this.selected.length===1&&(this.inRange={}),Promise.resolve()}handleRangeHover(e){if(!this.range||this._selected.length!==1||!this.isRangeAllowed(e)||this._selected[0]>=e){this.rangeHovered=null;return}this.rangeHovered=e,this.inRange=bo(this._selected[0],e)}handleDateSelect(e){return e&&(this.range?this.handleRangeSelect(e):this.multiple?this.toggleSelected(e):(this.selected.includes(rt(e))?this.emptySelected():(this.emptySelected(),this.addToSelected(e)),this.close()),this.dispatchEvent(new CustomEvent("date-selected",{detail:this.selected,bubbles:!0,composed:!0}))),Promise.resolve()}focusOnCurrentDate(){const e=rt(qn(this.todayDate)),t=this.querySelector(`button[data-date="${e}"]`);if(t instanceof HTMLButtonElement){this.focusedDate=e,t.focus();return}const n=this.selectableDates.find(i=>!i.isDisabled);if(n){const i=this.querySelector(`button[data-date="${n.currentDateISO}"]`);i instanceof HTMLButtonElement&&(this.focusedDate=n.currentDateISO,i.focus())}}closeEvent(e){!this.contains(e.relatedTarget)&&!e.target.classList.contains("pkt-invisible")&&this.close()}close(){this.dispatchEvent(new CustomEvent("close",{detail:!0,bubbles:!0,composed:!0}))}};Oe([u({converter:an.csvToArray})],Ne.prototype,"selected",2),Oe([u({type:Boolean})],Ne.prototype,"multiple",2),Oe([u({type:Number,attribute:"max-multiple"})],Ne.prototype,"maxMultiple",2),Oe([u({type:Boolean})],Ne.prototype,"range",2),Oe([u({type:String})],Ne.prototype,"earliest",2),Oe([u({type:String})],Ne.prototype,"latest",2),Oe([u({converter:an.stringsToDate})],Ne.prototype,"excludedates",2),Oe([u({converter:an.csvToArray})],Ne.prototype,"excludeweekdays",2),Oe([u({type:Boolean})],Ne.prototype,"weeknumbers",2),Oe([u({type:Boolean})],Ne.prototype,"withcontrols",2),Oe([u({converter:an.stringToDate})],Ne.prototype,"currentmonth",2),Oe([u({type:String})],Ne.prototype,"today",2),Oe([u({type:Array,attribute:"day-strings"})],Ne.prototype,"dayStrings",2),Oe([u({type:Array,attribute:"day-strings-long"})],Ne.prototype,"dayStringsLong",2),Oe([u({type:Array,attribute:"month-strings"})],Ne.prototype,"monthStrings",2),Oe([u({type:String,attribute:"week-string"})],Ne.prototype,"weekString",2),Oe([u({type:String,attribute:"prev-month-string"})],Ne.prototype,"prevMonthString",2),Oe([u({type:String,attribute:"next-month-string"})],Ne.prototype,"nextMonthString",2),Oe([u({type:Array})],Ne.prototype,"_selected",2),Oe([he()],Ne.prototype,"inRange",2),Oe([u({type:Date})],Ne.prototype,"rangeHovered",2),Oe([u({type:Number})],Ne.prototype,"year",2),Oe([u({type:Number})],Ne.prototype,"month",2),Oe([u({type:Number})],Ne.prototype,"week",2),Oe([he()],Ne.prototype,"currentmonthtouched",2),Oe([he()],Ne.prototype,"focusedDate",2),Ne=Oe([fe("pkt-calendar")],Ne);const Yd={size:{default:"medium"},skin:{default:"blue"},closeTag:{default:!1},type:{default:"button"}},Mi={props:Yd};var Kd=Object.defineProperty,Gd=Object.getOwnPropertyDescriptor,zt=(s,e,t,n)=>{for(var i=n>1?void 0:n?Gd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Kd(e,t,i),i};let Bt=class extends pt{constructor(){super(),this.closeTag=Mi.props.closeTag.default,this.size=Mi.props.size.default,this.skin=Mi.props.skin.default,this.textStyle=null,this.iconName=void 0,this.type=Mi.props.type.default,this.ariaLabel=null,this.buttonTabindex=void 0,this._isClosed=!1,this._ariaDescription=null,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:e},bubbles:!1,composed:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:e},bubbles:!1,composed:!0}))},this._isClosed=!1}firstUpdated(e){var t,n;if(super.firstUpdated(e),this.closeTag&&!this.ariaLabel){const i=(n=(t=this.querySelector("button span, .pkt-tag > span"))==null?void 0:t.textContent)==null?void 0:n.trim();i&&(this._ariaDescription=`Klikk for å fjerne ${i}`)}}render(){const e={"pkt-tag":!0,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,[`pkt-tag--${this.textStyle}`]:!!this.textStyle},t={"pkt-tag":!0,"pkt-btn":!0,"pkt-btn--tertiary":!0,[`pkt-tag--${this.textStyle}`]:!!this.textStyle,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,"pkt-btn--icons-right-and-left":this.closeTag&&!!this.iconName,"pkt-hide":this._isClosed};return this.closeTag?y`
|
|
337
337
|
<button
|
|
338
|
-
class=${
|
|
338
|
+
class=${X(t)}
|
|
339
339
|
type=${this.type}
|
|
340
340
|
tabindex=${I(this.buttonTabindex)}
|
|
341
341
|
@click=${this.close}
|
|
@@ -351,7 +351,7 @@
|
|
|
351
351
|
<pkt-icon class="pkt-tag__close-btn" name="close"></pkt-icon>
|
|
352
352
|
</button>
|
|
353
353
|
`:y`
|
|
354
|
-
<span class=${
|
|
354
|
+
<span class=${X(e)}>
|
|
355
355
|
${this.iconName&&y`<pkt-icon
|
|
356
356
|
class="pkt-tag__icon"
|
|
357
357
|
name=${this.iconName}
|
|
@@ -359,9 +359,9 @@
|
|
|
359
359
|
></pkt-icon>`}
|
|
360
360
|
<span>${ze(this)}</span>
|
|
361
361
|
</span>
|
|
362
|
-
`}};zt([u({type:Boolean,reflect:!0})],Bt.prototype,"closeTag",2),zt([u({type:String,reflect:!0})],Bt.prototype,"size",2),zt([u({type:String,reflect:!0})],Bt.prototype,"skin",2),zt([u({type:String,reflect:!0})],Bt.prototype,"textStyle",2),zt([u({type:String,reflect:!0})],Bt.prototype,"iconName",2),zt([u({type:String})],Bt.prototype,"type",2),zt([u({type:String})],Bt.prototype,"ariaLabel",2),zt([u({type:Number,attribute:"button-tabindex"})],Bt.prototype,"buttonTabindex",2),zt([
|
|
362
|
+
`}};zt([u({type:Boolean,reflect:!0})],Bt.prototype,"closeTag",2),zt([u({type:String,reflect:!0})],Bt.prototype,"size",2),zt([u({type:String,reflect:!0})],Bt.prototype,"skin",2),zt([u({type:String,reflect:!0})],Bt.prototype,"textStyle",2),zt([u({type:String,reflect:!0})],Bt.prototype,"iconName",2),zt([u({type:String})],Bt.prototype,"type",2),zt([u({type:String})],Bt.prototype,"ariaLabel",2),zt([u({type:Number,attribute:"button-tabindex"})],Bt.prototype,"buttonTabindex",2),zt([he()],Bt.prototype,"_isClosed",2),zt([he()],Bt.prototype,"_ariaDescription",2),Bt=zt([fe("pkt-tag")],Bt);var Xd=Object.defineProperty,Qd=Object.getOwnPropertyDescriptor,ln=(s,e,t,n)=>{for(var i=n>1?void 0:n?Qd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Xd(e,t,i),i};let _s=class extends _i{constructor(){super(...arguments),this.size=void 0,this.level=2,this.weight=void 0,this.visuallyHidden=!1,this.align=void 0}connectedCallback(){super.connectedCallback(),this.setAttribute("role","heading"),this.setAttribute("aria-level",String(this.level)),this.updateHostClasses()}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),e==="level"&&n&&this.setLevel(Number(n)),e==="visuallyHidden"&&(this.visuallyHidden=n!==null&&n!=="false"),(e==="size"||e==="visuallyHidden"||e==="align"||e==="weight")&&this.updateHostClasses()}updated(e){super.updated(e),e.has("level")&&(this.setLevel(this.level),this.hasAttribute("size")||(this.size=this.defaultSizeForLevel),this.hasAttribute("weight")||(this.weight=this.defaultWeightForLevel)),!this.hasAttribute("size")&&(e.has("level")||this.size===void 0)&&(this.size=this.defaultSizeForLevel),(e.has("size")||e.has("visuallyHidden")||e.has("align")||e.has("weight"))&&this.updateHostClasses()}setLevel(e){e>=1&&e<=6?(this.level=e,this.setAttribute("aria-level",String(e))):console.warn(`Invalid heading level: ${e}. Must be between 1 and 6.`)}get defaultSizeForLevel(){switch(this.level){case 1:return"xlarge";case 2:return"large";case 3:return"medium";case 4:return"small";case 5:return"xsmall";case 6:return"xsmall";default:return"medium"}}get defaultWeightForLevel(){switch(this.level){case 1:return"regular";case 2:return"regular";case 3:return"medium";case 4:return"medium";case 5:return"medium";case 6:return"medium";default:return"medium"}}updateHostClasses(){this.classList.remove("pkt-heading","pkt-heading--xsmall","pkt-heading--small","pkt-heading--medium","pkt-heading--large","pkt-heading--xlarge","pkt-sr-only","pkt-heading--start","pkt-heading--center","pkt-heading--end","pkt-heading--light","pkt-heading--regular","pkt-heading--medium","pkt-heading--bold"),this.classList.add("pkt-heading"),this.size&&this.classList.add(`pkt-heading--${this.size}`),this.weight&&this.classList.add(`pkt-heading--fw-${this.weight}`),this.visuallyHidden&&this.classList.add("pkt-sr-only"),this.align&&this.classList.add(`pkt-heading--${this.align}`)}render(){return y`<slot></slot>`}};ln([u({type:String,reflect:!0})],_s.prototype,"size",2),ln([u({type:Number,reflect:!0})],_s.prototype,"level",2),ln([u({type:String,reflect:!0})],_s.prototype,"weight",2),ln([u({type:Boolean,reflect:!0})],_s.prototype,"visuallyHidden",2),ln([u({type:String,reflect:!0})],_s.prototype,"align",2),_s=ln([fe("pkt-heading")],_s);const Zd={layout:{default:"vertical"},skin:{type:["outlined","outlined-beige","gray","blue","beige","green"],default:"outlined"},padding:{default:"default"}},cn={props:Zd};var Jd=Object.defineProperty,Rd=Object.getOwnPropertyDescriptor,ft=(s,e,t,n)=>{for(var i=n>1?void 0:n?Rd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Jd(e,t,i),i};let ut=class extends pt{constructor(){super(...arguments),this.ariaLabel="",this.metaLead=null,this.borderOnHover=!0,this.clickCardLink=null,this.metaTrail=null,this.layout=cn.props.layout.default,this.heading="",this.headinglevel=3,this.image={src:"",alt:""},this.imageShape="square",this.openLinkInNewTab=!1,this.padding=cn.props.padding.default,this.skin=cn.props.skin.default,this.subheading="",this.tagPosition="top",this.tags=[]}connectedCallback(){super.connectedCallback()}render(){var e,t;const n={"pkt-card":!0,[`pkt-card--${this.skin}`]:this.skin,[`pkt-card--${this.layout}`]:this.layout,[`pkt-card--padding-${this.padding}`]:this.padding,"pkt-card--border-on-hover":this.borderOnHover},i=((e=this.ariaLabel)==null?void 0:e.trim())||(this.heading?`${this.heading} lenkekort`:"lenkekort"),r=((t=this.ariaLabel)==null?void 0:t.trim())||(this.heading?this.heading:"kort");return y`
|
|
363
363
|
<article
|
|
364
|
-
class=${
|
|
364
|
+
class=${X(n)}
|
|
365
365
|
aria-label=${I(this.clickCardLink?i:r)}
|
|
366
366
|
>
|
|
367
367
|
${this.renderImage()}
|
|
@@ -375,7 +375,7 @@
|
|
|
375
375
|
</article>
|
|
376
376
|
`}renderImage(){const e={"pkt-card__image":!0,[`pkt-card__image-${this.imageShape}`]:this.imageShape};return y`
|
|
377
377
|
${this.image.src&&y`
|
|
378
|
-
<div class=${
|
|
378
|
+
<div class=${X(e)}>
|
|
379
379
|
<img src=${this.image.src} alt=${this.image.alt||""} />
|
|
380
380
|
</div>
|
|
381
381
|
`}
|
|
@@ -421,7 +421,7 @@
|
|
|
421
421
|
`}renderTags(){const e={"pkt-card__tags":!0,[`pkt-card__tags-${this.tagPosition}`]:this.tagPosition};return y`
|
|
422
422
|
${this.tags.length>0?y`
|
|
423
423
|
<div
|
|
424
|
-
class=${
|
|
424
|
+
class=${X(e)}
|
|
425
425
|
role="list"
|
|
426
426
|
aria-label=${this.tags.length>1?"merkelapper":"merkelapp"}
|
|
427
427
|
>
|
|
@@ -445,13 +445,13 @@
|
|
|
445
445
|
${this.metaTrail?y`<span class="pkt-card__metadata-trail">${this.metaTrail}</span>`:C}
|
|
446
446
|
</footer>
|
|
447
447
|
`:C}
|
|
448
|
-
`}};ft([u({type:String})],ut.prototype,"ariaLabel",2),ft([u({type:String})],ut.prototype,"metaLead",2),ft([u({type:Boolean})],ut.prototype,"borderOnHover",2),ft([u({type:String,reflect:!0})],ut.prototype,"clickCardLink",2),ft([u({type:String})],ut.prototype,"metaTrail",2),ft([u({type:String})],ut.prototype,"layout",2),ft([u({type:String})],ut.prototype,"heading",2),ft([u({type:Number})],ut.prototype,"headinglevel",2),ft([u({type:Object})],ut.prototype,"image",2),ft([u({type:String})],ut.prototype,"imageShape",2),ft([u({type:Boolean})],ut.prototype,"openLinkInNewTab",2),ft([u({type:String})],ut.prototype,"padding",2),ft([u({type:String,converter:{fromAttribute:s=>{const e=
|
|
448
|
+
`}};ft([u({type:String})],ut.prototype,"ariaLabel",2),ft([u({type:String})],ut.prototype,"metaLead",2),ft([u({type:Boolean})],ut.prototype,"borderOnHover",2),ft([u({type:String,reflect:!0})],ut.prototype,"clickCardLink",2),ft([u({type:String})],ut.prototype,"metaTrail",2),ft([u({type:String})],ut.prototype,"layout",2),ft([u({type:String})],ut.prototype,"heading",2),ft([u({type:Number})],ut.prototype,"headinglevel",2),ft([u({type:Object})],ut.prototype,"image",2),ft([u({type:String})],ut.prototype,"imageShape",2),ft([u({type:Boolean})],ut.prototype,"openLinkInNewTab",2),ft([u({type:String})],ut.prototype,"padding",2),ft([u({type:String,converter:{fromAttribute:s=>{const e=cn.props.skin.type;return s&&e.includes(s)?s:(s&&!e.includes(s)&&console.warn(`Invalid skin value "${s}". Using default skin "${cn.props.skin.default}".`),cn.props.skin.default)},toAttribute:s=>s}})],ut.prototype,"skin",2),ft([u({type:String})],ut.prototype,"subheading",2),ft([u({type:String})],ut.prototype,"tagPosition",2),ft([u({type:Array})],ut.prototype,"tags",2),ut=ft([fe("pkt-card")],ut);/**
|
|
449
449
|
* @license
|
|
450
450
|
* Copyright 2017 Google LLC
|
|
451
451
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
452
|
-
*/const ko=(s,e,t)=>{const n=new Map;for(let i=e;i<=t;i++)n.set(s[i],i);return n},$r=bs(class extends
|
|
452
|
+
*/const ko=(s,e,t)=>{const n=new Map;for(let i=e;i<=t;i++)n.set(s[i],i);return n},$r=bs(class extends sn{constructor(s){if(super(s),s.type!==It.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,e,t){let n;t===void 0?t=e:e!==void 0&&(n=e);const i=[],r=[];let a=0;for(const l of s)i[a]=n?n(l,a):a,r[a]=t(l,a),a++;return{values:r,keys:i}}render(s,e,t){return this.dt(s,e,t).values}update(s,[e,t,n]){const i=Fc(s),{values:r,keys:a}=this.dt(e,t,n);if(!Array.isArray(i))return this.ut=a,r;const l=this.ut??(this.ut=[]),c=[];let h,m,g=0,f=i.length-1,k=0,v=r.length-1;for(;g<=f&&k<=v;)if(i[g]===null)g++;else if(i[f]===null)f--;else if(l[g]===a[k])c[k]=As(i[g],r[k]),g++,k++;else if(l[f]===a[v])c[v]=As(i[f],r[v]),f--,v--;else if(l[g]===a[v])c[v]=As(i[g],r[v]),Dn(s,c[v+1],i[g]),g++,v--;else if(l[f]===a[k])c[k]=As(i[f],r[k]),Dn(s,i[g],i[f]),f--,k++;else if(h===void 0&&(h=ko(a,k,v),m=ko(l,g,f)),h.has(l[g]))if(h.has(l[f])){const $=m.get(a[k]),N=$!==void 0?i[$]:null;if(N===null){const x=Dn(s,i[g]);As(x,r[k]),c[k]=x}else c[k]=As(N,r[k]),Dn(s,i[g],N),i[$]=null;k++}else or(i[f]),f--;else or(i[g]),g++;for(;k<=v;){const $=Dn(s,c[v+1]);As($,r[k]),c[k++]=$}for(;g<=f;){const $=i[g++];$!==null&&or($)}return this.ut=a,Aa(s,c),lt}}),yo=()=>("00000000000000000"+(Math.random()*18446744073709552e3).toString(16)).slice(-16),eh=s=>new Promise(e=>setTimeout(e,s)),ws=()=>{const s=yo(),e=yo();return s.slice(0,8)+"-"+s.slice(8,12)+"-4"+s.slice(13)+"-a"+e.slice(1,4)+"-"+e.slice(4)},Rt=(s,e)=>e&&(s.find(t=>t.value===e)||s.find(t=>t.label===e))||null,_o=(s,e)=>{if(!e)return-1;const t=s.findIndex(n=>n.value===e);return t>=0?t:s.findIndex(n=>n.label===e)},th=(s,e)=>{if(!e)return[...s];const t=e.toLowerCase();return s.filter(n=>(n.fulltext||n.value+(n.label||"")+(n.prefix||"")).toLowerCase().includes(t))},wo=s=>s.value+(s.label||"")+(s.prefix||""),Di=(s,e)=>e!==null&&s>=e,sh=(s,e)=>{if(!e)return{filtered:[...s],suggestion:null};const t=e.toLowerCase(),n=s.filter(r=>{var a;return(a=r.fulltext)==null?void 0:a.toLowerCase().includes(t)}),i=n.find(r=>{var a;return!r.selected&&((a=r.label)==null?void 0:a.toLowerCase().startsWith(t))})||null;return{filtered:n,suggestion:i}},nh=(s,e,t,n)=>{if(!s.trim())return{addValueText:null,userInfoMessage:""};const i=s.trim().toLowerCase(),r=e.find(c=>c.toLowerCase()===i),a=t.filter(c=>{var h;return((h=c.label)==null?void 0:h.toLowerCase().includes(i))||c.value.toLowerCase().includes(i)}),l=a.find(c=>{var h;return((h=c.label)==null?void 0:h.toLowerCase())===i||c.value.toLowerCase()===i});return(a.length===0||!l)&&n?{addValueText:s,userInfoMessage:""}:a.length===0&&!n?{addValueText:null,userInfoMessage:"Ingen treff i søket"}:r?{addValueText:null,userInfoMessage:"Verdien er allerede valgt"}:{addValueText:null,userInfoMessage:""}},ih=s=>/^[\p{L} ]$/u.test(s),rh=(s=500)=>{let e="",t;return{append:n=>(e+=n.toLowerCase(),t!==void 0&&clearTimeout(t),t=setTimeout(()=>{e=""},s),e),reset:()=>{e="",t!==void 0&&(clearTimeout(t),t=void 0)},getBuffer:()=>e}},ah=(s,e)=>{const t=e.toLowerCase();return s.findIndex(n=>{var i;return(i=n.textContent)==null?void 0:i.trim().toLowerCase().startsWith(t)})},cs=s=>{s.scrollIntoView({block:"nearest"}),window.setTimeout(()=>s.focus(),0)},Yn=s=>Array.from(s.querySelectorAll('[role="option"]:not([data-disabled])')||[]),oh=s=>{const e=s.nextElementSibling;e&&cs(e)},lh=(s,e,t)=>{const n=s.previousElementSibling;if(s.dataset.index==="0"&&t){const i=e.querySelector('[role="searchbox"]');i&&cs(i)}else n&&cs(n)},xr=s=>{const e=Yn(s);e[0]&&cs(e[0])},$o=s=>{const e=Yn(s),t=e[e.length-1];t&&cs(t)},ch=(s,e)=>{if(e.disabled)return;const t=Yn(s);if(e.allowUserInput&&e.customUserInput){const i=s.querySelector('[data-type="new-option"]');if(i){cs(i);return}}const n=t.find(i=>i.dataset.selected==="true");if(n){cs(n);return}if(e.includeSearch&&!(document.activeElement instanceof HTMLInputElement)){const i=s.querySelector('[role="searchbox"]');if(i){window.setTimeout(()=>i.focus(),0);return}}t[0]&&cs(t[0])};var uh=Object.defineProperty,dh=Object.getOwnPropertyDescriptor,vt=(s,e,t,n)=>{for(var i=n>1?void 0:n?dh(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&uh(e,t,i),i};let gt=class extends At{constructor(){super(...arguments),this.id=ws(),this.label=null,this.options=[],this.isOpen=!1,this.disabled=!1,this.includeSearch=!1,this.isMultiSelect=!1,this.allowUserInput=!1,this.maxIsReached=!1,this.customUserInput=null,this.searchPlaceholder=null,this.searchValue=null,this.maxLength=0,this.userMessage=null,this._selectedOptions=0,this.typeahead=rh(),this._filteredOptions=[]}connectedCallback(){super.connectedCallback(),this.includeSearch&&!this.searchValue&&(this.searchValue=""),this.options.length>0&&this.filterOptions(),this.setAttribute("tabindex","-1"),this.addEventListener("focus",this.focusFirstOrSelectedOption)}disconnectedCallback(){super.disconnectedCallback(),this.typeahead.reset()}updated(e){(e.has("options")||e.has("searchValue"))&&this.filterOptions(),super.updated(e)}attributeChangedCallback(e,t,n){(e==="options"||e==="search-value")&&this.filterOptions(),super.attributeChangedCallback(e,t,n)}get _hasOptions(){return this._filteredOptions.length>0||this.options.length>0}render(){return y`
|
|
453
453
|
<div
|
|
454
|
-
class=${
|
|
454
|
+
class=${X({"pkt-listbox":!0,"pkt-listbox__open":this.isOpen,"pkt-txt-16-light":!0})}
|
|
455
455
|
role=${I(this._hasOptions?"listbox":void 0)}
|
|
456
456
|
aria-multiselectable=${I(this._hasOptions&&this.isMultiSelect?"true":void 0)}
|
|
457
457
|
aria-label=${I(this._hasOptions?this.label??void 0:void 0)}
|
|
@@ -490,7 +490,7 @@
|
|
|
490
490
|
@click=${()=>{this.toggleOption(e)}}
|
|
491
491
|
aria-selected=${e.selected?"true":"false"}
|
|
492
492
|
@keydown=${this.handleOptionKeydown}
|
|
493
|
-
class=${
|
|
493
|
+
class=${X({"pkt-listbox__option":!0,"pkt-listbox__option--selected":!!(!this.isMultiSelect&&e.selected),"pkt-listbox__option--checkBox":this.isMultiSelect})}
|
|
494
494
|
tabindex="${this.disabled||e.disabled?"-1":"0"}"
|
|
495
495
|
data-index=${t}
|
|
496
496
|
data-value=${e.value}
|
|
@@ -554,7 +554,7 @@
|
|
|
554
554
|
role="searchbox"
|
|
555
555
|
/>
|
|
556
556
|
</div>
|
|
557
|
-
`:C}handleSearchInput(e){this.searchValue=e.target.value,this.dispatchEvent(new CustomEvent("search",{detail:this.searchValue,bubbles:!1}))}handleSearchKeydown(e){switch(e.key){case"Enter":e.preventDefault();break;case"ArrowUp":case"Escape":this.closeOptions(),e.preventDefault();break;case"ArrowDown":this.focusFirstOrSelectedOption();break;case"Tab":this.tabClose();break}}handleOptionKeydown(e){const t=e.currentTarget,n=t.dataset.value,i=t.dataset.type,r=t.dataset.selected==="true";if(!(!Yn(this).length&&(!this.customUserInput||!this.allowUserInput&&this.customUserInput)&&i!=="new-option"&&i!=="searchbox"))switch(e.key){case" ":case"Enter":this.toggleOption(t),e.preventDefault();break;case"Backspace":n&&(r?this.toggleOption(t):this.closeOptions()),e.preventDefault();break;case"Escape":this.closeOptions(),e.preventDefault();break;case"Tab":this.tabClose();break;case"ArrowDown":e.altKey?$o(this):i==="searchbox"||i==="new-option"?xr(this):ah(t),e.preventDefault();break;case"ArrowUp":if(e.altKey)xr(this);else if(t.dataset.index==="0"&&this.includeSearch){const a=this.querySelector('[role="searchbox"]');a&&a.focus()}else if(t.dataset.index==="0"&&this.customUserInput){const a=this.querySelector('[data-type="new-option"]');a&&a.focus()}else oh(t,this,this.includeSearch);e.preventDefault();break;case"Home":xr(this),e.preventDefault();break;case"End":$o(this),e.preventDefault();break;default:(e.metaKey||e.ctrlKey)&&e.key==="a"&&(this.selectAll(),e.preventDefault()),nh(e.key)&&(this.handleTypeAhead(e.key),e.preventDefault());break}}focusFirstOrSelectedOption(){lh(this,{disabled:this.disabled,allowUserInput:this.allowUserInput,customUserInput:this.customUserInput,includeSearch:this.includeSearch})}toggleOption(e){const t=e instanceof HTMLElement?e.dataset.disabled:e.disabled;if(this.disabled||t)return;const n=e instanceof HTMLElement?e.dataset.value:e.value;this.dispatchEvent(new CustomEvent("option-toggle",{detail:n,bubbles:!1}))}selectAll(){this.dispatchEvent(new CustomEvent("select-all",{bubbles:!1}))}closeOptions(){this.dispatchEvent(new CustomEvent("close-options",{bubbles:!1}))}tabClose(){this.dispatchEvent(new CustomEvent("tab-close",{bubbles:!1}))}filterOptions(){this._filteredOptions=eh(this.options,this.searchValue)}handleTypeAhead(e){const t=this.typeahead.append(e),n=Yn(this),i=rh(n,t);i>=0&&cs(n[i])}};vt([u({type:String})],gt.prototype,"id",2),vt([u({type:String})],gt.prototype,"label",2),vt([u({type:Array})],gt.prototype,"options",2),vt([u({type:Boolean,reflect:!0,attribute:"is-open"})],gt.prototype,"isOpen",2),vt([u({type:Boolean})],gt.prototype,"disabled",2),vt([u({type:Boolean,attribute:"include-search"})],gt.prototype,"includeSearch",2),vt([u({type:Boolean,attribute:"is-multi-select"})],gt.prototype,"isMultiSelect",2),vt([u({type:Boolean,attribute:"allow-user-input"})],gt.prototype,"allowUserInput",2),vt([u({type:Boolean,attribute:"max-is-reached"})],gt.prototype,"maxIsReached",2),vt([u({type:String,attribute:"custom-user-input"})],gt.prototype,"customUserInput",2),vt([u({type:String,attribute:"search-placeholder"})],gt.prototype,"searchPlaceholder",2),vt([u({type:String,attribute:"search-value"})],gt.prototype,"searchValue",2),vt([u({type:Number,attribute:"max-length"})],gt.prototype,"maxLength",2),vt([u({type:String,attribute:"user-message"})],gt.prototype,"userMessage",2),vt([de()],gt.prototype,"_filteredOptions",2),gt=vt([pe("pkt-listbox")],gt);const xt={fromAttribute(s){return s==null?!1:s===""||s==="true"||s===!0?!0:s==="false"||s===!1?!1:!!s},toAttribute(s){return s?"true":"false"}},dh={helptextDropdownButton:{default:"Les mer <span class='pkt-sr-only'>om feltet</span>"},counter:{default:!1},optionalTag:{default:!1},optionalText:{default:"Valgfritt"},requiredTag:{default:!1},requiredText:{default:"Må fylles ut"},hasError:{default:!1},disabled:{default:!1},inline:{default:!1},hasFieldset:{default:!1},useWrapper:{default:!0}},Dt={props:dh};var hh={},xo;function ph(){return xo||(xo=1,(function(){(function(s){const e=new WeakMap,t=new WeakMap,n=new WeakMap,i=new WeakMap,r=new WeakMap,a=new WeakMap,l=new WeakMap,c=new WeakMap,h=new WeakMap,g=new WeakMap,m=new WeakMap,f=new WeakMap,k=new WeakMap,v=new WeakMap,$=new WeakMap,N={ariaAtomic:"aria-atomic",ariaAutoComplete:"aria-autocomplete",ariaBusy:"aria-busy",ariaChecked:"aria-checked",ariaColCount:"aria-colcount",ariaColIndex:"aria-colindex",ariaColIndexText:"aria-colindextext",ariaColSpan:"aria-colspan",ariaCurrent:"aria-current",ariaDescription:"aria-description",ariaDisabled:"aria-disabled",ariaExpanded:"aria-expanded",ariaHasPopup:"aria-haspopup",ariaHidden:"aria-hidden",ariaInvalid:"aria-invalid",ariaKeyShortcuts:"aria-keyshortcuts",ariaLabel:"aria-label",ariaLevel:"aria-level",ariaLive:"aria-live",ariaModal:"aria-modal",ariaMultiLine:"aria-multiline",ariaMultiSelectable:"aria-multiselectable",ariaOrientation:"aria-orientation",ariaPlaceholder:"aria-placeholder",ariaPosInSet:"aria-posinset",ariaPressed:"aria-pressed",ariaReadOnly:"aria-readonly",ariaRelevant:"aria-relevant",ariaRequired:"aria-required",ariaRoleDescription:"aria-roledescription",ariaRowCount:"aria-rowcount",ariaRowIndex:"aria-rowindex",ariaRowIndexText:"aria-rowindextext",ariaRowSpan:"aria-rowspan",ariaSelected:"aria-selected",ariaSetSize:"aria-setsize",ariaSort:"aria-sort",ariaValueMax:"aria-valuemax",ariaValueMin:"aria-valuemin",ariaValueNow:"aria-valuenow",ariaValueText:"aria-valuetext",role:"role"},x=(b,p)=>{for(let _ in N){p[_]=null;let S=null;const Y=N[_];Object.defineProperty(p,_,{get(){return S},set(K){S=K,b.isConnected?M(b,Y,K):g.set(b,p)}})}};function T(b){const p=i.get(b),{form:_}=p;Ue(b,_,p),ee(b,p.labels)}const P=(b,p=!1)=>{const _=document.createTreeWalker(b,NodeFilter.SHOW_ELEMENT,{acceptNode(K){return i.has(K)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let S=_.nextNode();const Y=!p||b.disabled;for(;S;)S.formDisabledCallback&&Y&&z(S,b.disabled),S=_.nextNode()},D={attributes:!0,attributeFilter:["disabled","name"]},j=te()?new MutationObserver(b=>{for(const p of b){const _=p.target;if(p.attributeName==="disabled"&&(_.constructor.formAssociated?z(_,_.hasAttribute("disabled")):_.localName==="fieldset"&&P(_)),p.attributeName==="name"&&_.constructor.formAssociated){const S=i.get(_),Y=h.get(_);S.setFormValue(Y)}}}):{};function H(b){b.forEach(p=>{const{addedNodes:_,removedNodes:S}=p,Y=Array.from(_),K=Array.from(S);Y.forEach(ce=>{var nt;if(i.has(ce)&&ce.constructor.formAssociated&&T(ce),g.has(ce)){const Je=g.get(ce);Object.keys(N).filter(Be=>Je[Be]!==null).forEach(Be=>{M(ce,N[Be],Je[Be])}),g.delete(ce)}if($.has(ce)){const Je=$.get(ce);M(ce,"internals-valid",Je.validity.valid.toString()),M(ce,"internals-invalid",(!Je.validity.valid).toString()),M(ce,"aria-invalid",(!Je.validity.valid).toString()),$.delete(ce)}if(ce.localName==="form"){const Je=c.get(ce),Be=document.createTreeWalker(ce,NodeFilter.SHOW_ELEMENT,{acceptNode(Xt){return i.has(Xt)&&Xt.constructor.formAssociated&&!(Je&&Je.has(Xt))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let Gt=Be.nextNode();for(;Gt;)T(Gt),Gt=Be.nextNode()}ce.localName==="fieldset"&&((nt=j.observe)===null||nt===void 0||nt.call(j,ce,D),P(ce,!0))}),K.forEach(ce=>{const nt=i.get(ce);nt&&n.get(nt)&&L(nt),l.has(ce)&&l.get(ce).disconnect()})})}function X(b){b.forEach(p=>{const{removedNodes:_}=p;_.forEach(S=>{const Y=k.get(p.target);i.has(S)&&De(S),Y.disconnect()})})}const fe=b=>{var p,_;const S=new MutationObserver(X);!((p=window==null?void 0:window.ShadyDOM)===null||p===void 0)&&p.inUse&&b.mode&&b.host&&(b=b.host),(_=S.observe)===null||_===void 0||_.call(S,b,{childList:!0}),k.set(b,S)};te()&&new MutationObserver(H);const q={childList:!0,subtree:!0},M=(b,p,_)=>{b.getAttribute(p)!==_&&b.setAttribute(p,_)},z=(b,p)=>{b.toggleAttribute("internals-disabled",p),p?M(b,"aria-disabled","true"):b.removeAttribute("aria-disabled"),b.formDisabledCallback&&b.formDisabledCallback.apply(b,[p])},L=b=>{n.get(b).forEach(p=>{p.remove()}),n.set(b,[])},Q=(b,p)=>{const _=document.createElement("input");return _.type="hidden",_.name=b.getAttribute("name"),b.after(_),n.get(p).push(_),_},ae=(b,p)=>{var _;n.set(p,[]),(_=j.observe)===null||_===void 0||_.call(j,b,D)},ee=(b,p)=>{if(p.length){Array.from(p).forEach(S=>S.addEventListener("click",b.click.bind(b)));let _=p[0].id;p[0].id||(_=`${p[0].htmlFor}_Label`,p[0].id=_),M(b,"aria-labelledby",_)}},ue=b=>{const p=Array.from(b.elements).filter(K=>!K.tagName.includes("-")&&K.validity).map(K=>K.validity.valid),_=c.get(b)||[],S=Array.from(_).filter(K=>K.isConnected).map(K=>i.get(K).validity.valid),Y=[...p,...S].includes(!1);b.toggleAttribute("internals-invalid",Y),b.toggleAttribute("internals-valid",!Y)},le=b=>{ue(Z(b.target))},be=b=>{ue(Z(b.target))},ne=b=>{const p=["button[type=submit]","input[type=submit]","button:not([type])"].map(_=>`${_}:not([disabled])`).map(_=>`${_}:not([form])${b.id?`,${_}[form='${b.id}']`:""}`).join(",");b.addEventListener("click",_=>{if(_.target.closest(p)){const S=c.get(b);if(b.noValidate)return;S.size&&Array.from(S).reverse().map(Y=>i.get(Y).reportValidity()).includes(!1)&&_.preventDefault()}})},re=b=>{const p=c.get(b.target);p&&p.size&&p.forEach(_=>{_.constructor.formAssociated&&_.formResetCallback&&_.formResetCallback.apply(_)})},Ue=(b,p,_)=>{if(p){const S=c.get(p);if(S)S.add(b);else{const Y=new Set;Y.add(b),c.set(p,Y),ne(p),p.addEventListener("reset",re),p.addEventListener("input",le),p.addEventListener("change",be)}a.set(p,{ref:b,internals:_}),b.constructor.formAssociated&&b.formAssociatedCallback&&setTimeout(()=>{b.formAssociatedCallback.apply(b,[p])},0),ue(p)}},Z=b=>{let p=b.parentNode;return p&&p.tagName!=="FORM"&&(p=Z(p)),p},A=(b,p,_=DOMException)=>{if(!b.constructor.formAssociated)throw new _(p)},Me=(b,p,_)=>{const S=c.get(b);return S&&S.size&&S.forEach(Y=>{i.get(Y)[_]()||(p=!1)}),p},De=b=>{if(b.constructor.formAssociated){const p=i.get(b),{labels:_,form:S}=p;ee(b,_),Ue(b,S,p)}};function te(){return typeof MutationObserver<"u"}class Ie{constructor(){this.badInput=!1,this.customError=!1,this.patternMismatch=!1,this.rangeOverflow=!1,this.rangeUnderflow=!1,this.stepMismatch=!1,this.tooLong=!1,this.tooShort=!1,this.typeMismatch=!1,this.valid=!0,this.valueMissing=!1,Object.seal(this)}}const Ee=b=>(b.badInput=!1,b.customError=!1,b.patternMismatch=!1,b.rangeOverflow=!1,b.rangeUnderflow=!1,b.stepMismatch=!1,b.tooLong=!1,b.tooShort=!1,b.typeMismatch=!1,b.valid=!0,b.valueMissing=!1,b),ye=(b,p,_)=>(b.valid=Te(p),Object.keys(p).forEach(S=>b[S]=p[S]),_&&ue(_),b),Te=b=>{let p=!0;for(let _ in b)_!=="valid"&&b[_]!==!1&&(p=!1);return p},Pe=new WeakMap;function je(b,p){b.toggleAttribute(p,!0),b.part&&b.part.add(p)}class Ae extends Set{static get isPolyfilled(){return!0}constructor(p){if(super(),!p||!p.tagName||p.tagName.indexOf("-")===-1)throw new TypeError("Illegal constructor");Pe.set(this,p)}add(p){if(!/^--/.test(p)||typeof p!="string")throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value ${p} must start with '--'.`);const _=super.add(p),S=Pe.get(this),Y=`state${p}`;return S.isConnected?je(S,Y):setTimeout(()=>{je(S,Y)}),_}clear(){for(let[p]of this.entries())this.delete(p);super.clear()}delete(p){const _=super.delete(p),S=Pe.get(this);return S.isConnected?(S.toggleAttribute(`state${p}`,!1),S.part&&S.part.remove(`state${p}`)):setTimeout(()=>{S.toggleAttribute(`state${p}`,!1),S.part&&S.part.remove(`state${p}`)}),_}}function ve(b,p,_,S){if(typeof p=="function"?b!==p||!S:!p.has(b))throw new TypeError("Cannot read private member from an object whose class did not declare it");return _==="m"?S:_==="a"?S.call(b):S?S.value:p.get(b)}function E(b,p,_,S,Y){if(typeof p=="function"?b!==p||!0:!p.has(b))throw new TypeError("Cannot write private member to an object whose class did not declare it");return p.set(b,_),_}var Le;class Ye{constructor(p){Le.set(this,void 0),E(this,Le,p);for(let _=0;_<p.length;_++){let S=p[_];this[_]=S,S.hasAttribute("name")&&(this[S.getAttribute("name")]=S)}Object.freeze(this)}get length(){return ve(this,Le,"f").length}[(Le=new WeakMap,Symbol.iterator)](){return ve(this,Le,"f")[Symbol.iterator]()}item(p){return this[p]==null?null:this[p]}namedItem(p){return this[p]==null?null:this[p]}}function U(){const b=HTMLFormElement.prototype.checkValidity;HTMLFormElement.prototype.checkValidity=_;const p=HTMLFormElement.prototype.reportValidity;HTMLFormElement.prototype.reportValidity=S;function _(...K){let ce=b.apply(this,K);return Me(this,ce,"checkValidity")}function S(...K){let ce=p.apply(this,K);return Me(this,ce,"reportValidity")}const{get:Y}=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"elements");Object.defineProperty(HTMLFormElement.prototype,"elements",{get(...K){const ce=Y.call(this,...K),nt=Array.from(c.get(this)||[]);if(nt.length===0)return ce;const Je=Array.from(ce).concat(nt).sort((Be,Gt)=>Be.compareDocumentPosition?Be.compareDocumentPosition(Gt)&2?1:-1:0);return new Ye(Je)}})}class V{static get isPolyfilled(){return!0}constructor(p){if(!p||!p.tagName||p.tagName.indexOf("-")===-1)throw new TypeError("Illegal constructor");const _=p.getRootNode(),S=new Ie;this.states=new Ae(p),e.set(this,p),t.set(this,S),i.set(p,this),x(p,this),ae(p,this),Object.seal(this),_ instanceof DocumentFragment&&fe(_)}checkValidity(){const p=e.get(this);if(A(p,"Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!this.willValidate)return!0;const _=t.get(this);if(!_.valid){const S=new Event("invalid",{bubbles:!1,cancelable:!0,composed:!1});p.dispatchEvent(S)}return _.valid}get form(){const p=e.get(this);A(p,"Failed to read the 'form' property from 'ElementInternals': The target element is not a form-associated custom element.");let _;return p.constructor.formAssociated===!0&&(_=Z(p)),_}get labels(){const p=e.get(this);A(p,"Failed to read the 'labels' property from 'ElementInternals': The target element is not a form-associated custom element.");const _=p.getAttribute("id"),S=p.getRootNode();return S&&_?S.querySelectorAll(`[for="${_}"]`):[]}reportValidity(){const p=e.get(this);if(A(p,"Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!this.willValidate)return!0;const _=this.checkValidity(),S=f.get(this);if(S&&!p.constructor.formAssociated)throw new DOMException("Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.");return!_&&S&&(p.focus(),S.focus()),_}setFormValue(p){const _=e.get(this);if(A(_,"Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element."),L(this),p!=null&&!(p instanceof FormData)){if(_.getAttribute("name")){const S=Q(_,this);S.value=p}}else p!=null&&p instanceof FormData&&Array.from(p).reverse().forEach(([S,Y])=>{if(typeof Y=="string"){const K=Q(_,this);K.name=S,K.value=Y}});h.set(_,p)}setValidity(p,_,S){const Y=e.get(this);if(A(Y,"Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!p)throw new TypeError("Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.");f.set(this,S);const K=t.get(this),ce={};for(const Be in p)ce[Be]=p[Be];Object.keys(ce).length===0&&Ee(K);const nt=Object.assign(Object.assign({},K),ce);delete nt.valid;const{valid:Je}=ye(K,nt,this.form);if(!Je&&!_)throw new DOMException("Failed to execute 'setValidity' on 'ElementInternals': The second argument should not be empty if one or more flags in the first argument are true.");r.set(this,Je?"":_),Y.isConnected?(Y.toggleAttribute("internals-invalid",!Je),Y.toggleAttribute("internals-valid",Je),M(Y,"aria-invalid",`${!Je}`)):$.set(Y,this)}get shadowRoot(){const p=e.get(this);return m.get(p)||null}get validationMessage(){const p=e.get(this);return A(p,"Failed to read the 'validationMessage' property from 'ElementInternals': The target element is not a form-associated custom element."),r.get(this)}get validity(){const p=e.get(this);return A(p,"Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element."),t.get(this)}get willValidate(){const p=e.get(this);return A(p,"Failed to read the 'willValidate' property from 'ElementInternals': The target element is not a form-associated custom element."),!(p.disabled||p.hasAttribute("disabled")||p.hasAttribute("readonly"))}}function se(){if(typeof window>"u"||!window.ElementInternals||!HTMLElement.prototype.attachInternals)return!1;class b extends HTMLElement{constructor(){super(),this.internals=this.attachInternals()}}const p=`element-internals-feature-detection-${Math.random().toString(36).replace(/[^a-z]+/g,"")}`;customElements.define(p,b);const _=new b;return["shadowRoot","form","willValidate","validity","validationMessage","labels","setFormValue","setValidity","checkValidity","reportValidity"].every(S=>S in _.internals)}let me=!1,ge=!1;function Xe(b){ge||(ge=!0,window.CustomStateSet=Ae,b&&(HTMLElement.prototype.attachInternals=function(...p){const _=b.call(this,p);return _.states=new Ae(this),_}))}function Ke(b=!0){if(!me){if(me=!0,typeof window<"u"&&(window.ElementInternals=V),typeof CustomElementRegistry<"u"){const p=CustomElementRegistry.prototype.define;CustomElementRegistry.prototype.define=function(_,S,Y){if(S.formAssociated){const K=S.prototype.connectedCallback;S.prototype.connectedCallback=function(){v.has(this)||(v.set(this,!0),this.hasAttribute("disabled")&&z(this,!0)),K!=null&&K.apply(this),De(this)}}p.call(this,_,S,Y)}}if(typeof HTMLElement<"u"&&(HTMLElement.prototype.attachInternals=function(){if(this.tagName){if(this.tagName.indexOf("-")===-1)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': Unable to attach ElementInternals to non-custom elements.")}else return{};if(i.has(this))throw new DOMException("DOMException: Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");return new V(this)}),typeof Element<"u"){let p=function(...S){const Y=_.apply(this,S);if(m.set(this,Y),te()){const K=new MutationObserver(H);window.ShadyDOM?K.observe(this,q):K.observe(Y,q),l.set(this,K)}return Y};const _=Element.prototype.attachShadow;Element.prototype.attachShadow=p}te()&&typeof document<"u"&&new MutationObserver(H).observe(document.documentElement,q),typeof HTMLFormElement<"u"&&U(),(b||typeof window<"u"&&!window.CustomStateSet)&&Xe()}}return customElements.polyfillWrapFlushCallback||(se()?typeof window<"u"&&!window.CustomStateSet&&Xe(HTMLElement.prototype.attachInternals):Ke(!1)),s.forceCustomStateSetPolyfill=Xe,s.forceElementInternalsPolyfill=Ke,Object.defineProperty(s,"__esModule",{value:!0}),s})({})})()),hh}ph();var fh=Object.defineProperty,he=(s,e,t,n)=>{for(var i=void 0,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=a(e,t,i)||i);return i&&fh(e,t,i),i};const Co="on",Cr="--checked",Oi=",";let ie=class extends pt{constructor(){super(),this.defaultValue=null,this.disabled=!1,this.readonly=!1,this.required=!1,this.max=null,this.maxlength=null,this.min=null,this.minlength=null,this.step=null,this.ariaDescribedBy=null,this.ariaLabelledby=null,this.name="",this.pattern=null,this.placeholder=null,this.id=ws(),this.counter=!1,this.hasError=!1,this.inline=!1,this.hasFieldset=!1,this.optionalTag=!1,this.requiredTag=!1,this.skipForwardTestid=!1,this.useWrapper=!0,this.fullwidth=!1,this.counterMaxLength=0,this.errorMessage="",this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=Dt.props.helptextDropdownButton.default,this.label=null,this.optionalText=$t.forms.labels.optional,this.requiredText=$t.forms.labels.required,this.tagText=null,this.dataTestid="",this.touched=!1,this.internals=this.attachInternals()}static get formAssociated(){return!0}manageValidity(e){var t,n,i,r,a,l,c,h,g,m,f;if(!e){console.warn("manageValidity called without valid input element");return}this.required&&!this.value?this.internals.setValidity({valueMissing:!0},$t.forms.messages.required,e):(t=e.validity)!=null&&t.typeMismatch||(n=e.validity)!=null&&n.badInput?this.internals.setValidity({typeMismatch:!0},$t.forms.messages.invalid,e):(i=e.validity)!=null&&i.patternMismatch?this.internals.setValidity({patternMismatch:!0},$t.forms.messages.invalidPattern,e):(r=e.validity)!=null&&r.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},$t.forms.messages.tooShort,e):(a=e.validity)!=null&&a.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},$t.forms.messages.tooLong,e):(l=e.validity)!=null&&l.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},this.min?$t.forms.messages.rangeUnderflowMin.replace("{min}",(c=this.min)==null?void 0:c.toString()):$t.forms.messages.rangeUnderflow,e):(h=e.validity)!=null&&h.stepMismatch?this.internals.setValidity({stepMismatch:!0},$t.forms.messages.invalid,e):(g=e.validity)!=null&&g.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},this.max?$t.forms.messages.rangeOverflowMax.replace("{max}",(m=this.max)==null?void 0:m.toString()):$t.forms.messages.rangeOverflow,e):(f=e.validity)!=null&&f.customError?this.internals.setValidity({customError:!0},e.validationMessage,e):this.internals.setValidity({})}setFormValue(e){if(this.internals)if(Array.isArray(e)){const t=new FormData;e.forEach(n=>{t.append(this.name,n)}),this.internals.setFormValue(t)}else this.internals.setFormValue(e)}coordinateRadioGroup(){if(!this.form||!this.name||this.type!=="radio")return;const e=`pkt-radiobutton[name="${this.name}"], input[type=radio][name="${this.name}"]`;this.form.querySelectorAll(e).forEach(t=>{var n;if(t!==this&&t.getAttribute("name")===this.name&&t.getAttribute("value")!==this.value){const i=t;i.checked&&(i.checked=!1,i.internals&&(i.internals.setFormValue(null),(n=i.internals.states)==null||n.delete(Cr)))}})}valueChecked(e){if(!this.touched)return;const t=this.internals.form||this.closest("form"),n=t?new FormData(t):null;if(this.type==="radio"&&this.coordinateRadioGroup(),typeof e=="string"?(this.checked=e==="true",this.internals.ariaChecked=String(e==="true")):typeof e=="boolean"&&(this.checked=e,this.internals.ariaChecked=String(e)),this.checked){const i=(typeof this.value=="string"?this.value:"")||Co;this.internals.setFormValue(i),n&&n.append(this.name,i),this.internals.states.add(Cr)}else this.internals.setFormValue(null),n&&n.delete(this.name),this.internals.states.delete(Cr);this.dispatchChangeEvents(this.checked),this.internals.reportValidity()}valueChanged(e,t){(t!==this.value||t!==this._value)&&(typeof e=="string"?((this.multiple||this.range)&&e.includes(Oi)&&(e=e.split(Oi)),this.value=e,this._value=Array.isArray(e)?e:[e]):Array.isArray(e)?(this.value=this.multiple||this.range?e:e[0],this._value=e):(this.value="",this._value=[]),(!this.value||this.value.length===0)&&t&&t.length!==0?this.clearInputValue():this.value&&this.value.toString()!==(t==null?void 0:t.toString())&&this.onChange(this.value))}dispatchChangeEvents(e){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:e,bubbles:!0,composed:!0}))}clearInputValue(){const e=this.multiple||this.range?[]:"";this.value=e,this.setFormValue(e),this.dispatchChangeEvents(e)}onFocus(){this.dispatchEvent(new FocusEvent("focus",{bubbles:!0,composed:!0}))}onBlur(){this.dispatchEvent(new FocusEvent("blur",{bubbles:!0,composed:!0}))}onInput(){this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0}))}normalizeValue(e){return(this.range||this.multiple)&&typeof e=="string"&&e.includes(Oi)?e.split(Oi):!this.multiple&&!this.range&&Array.isArray(e)?e[0]||"":e}validate(){var e,t;(e=this.inputRef)!=null&&e.value&&this.manageValidity(this.inputRef.value),(t=this.inputRefTo)!=null&&t.value&&this.manageValidity(this.inputRefTo.value)}onChange(e){if(!this.touched){this.touched=!0,e&&this.setFormValue(e);return}if(typeof e!="string"&&!Array.isArray(e))return;const t=this.normalizeValue(e);this.setFormValue(t),this.validate(),this.dispatchChangeEvents(t)}formResetCallback(){var e;if(this.touched=!1,this._options&&this._options.length&&this._options.forEach(t=>{"selected"in t&&(t.selected=!1)}),this.checked!==void 0)this.checked=!1,this.internals.ariaChecked="false",this.internals.setFormValue(""),(e=this.inputRef)!=null&&e.value&&"checked"in this.inputRef.value&&(this.inputRef.value.checked=!1),this.valueChecked(this.checked);else{this.internals.setFormValue("");const t=this.defaultValue||(this.multiple||this.range?[]:"");this.value=t,this._value=Array.isArray(t)?t:[t],this.valueChanged(this.value,null)}this.internals.ariaInvalid="false"}updated(e){super.updated(e),e.has("dataTestid")&&this.dataTestid&&this.inputRef.value&&(this.skipForwardTestid?this.hasAttribute("data-testid")||this.setAttribute("data-testid",this.dataTestid):(this.inputRef.value.dataset.testid=this.dataTestid,this.removeAttribute("data-testid")))}firstUpdated(e){if(super.firstUpdated(e),!this.form){const t=this.internals.form||this.closest("form");this.form=t}if(this.value&&this.defaultValue===null&&(this.defaultValue=this.value),this.defaultValue!==null&&!this.value&&this.valueChanged(this.defaultValue,null),this.defaultChecked&&(this.internals.ariaChecked="true",this.checked=!0),this.required&&(this.internals.ariaRequired="true"),this.disabled&&(this.internals.ariaDisabled="true"),this.id&&!this.name&&(this.name=this.id),this.checked!==void 0){const t=this.checked===""||this.checked==="true"||this.checked===!0;this.internals.ariaChecked=String(t);const n=t?(typeof this.value=="string"?this.value:"")||Co:null;this.internals.setFormValue(n)}else this.setFormValue(this.value);this.inputRef&&this.inputRef.value&&(this.inputRef.value.setAttribute("form",""),this.manageValidity(this.inputRef.value)),this.inputRefTo&&this.inputRefTo.value&&(this.inputRefTo.value.setAttribute("form",""),this.manageValidity(this.inputRefTo.value))}};he([u({type:Boolean,reflect:!0})],ie.prototype,"checked"),he([u({type:Boolean})],ie.prototype,"defaultChecked"),he([u({type:Boolean})],ie.prototype,"multiple"),he([u({type:Boolean})],ie.prototype,"range"),he([u({type:String,reflect:!0})],ie.prototype,"type"),he([u()],ie.prototype,"defaultValue"),he([u({type:Boolean,reflect:!0})],ie.prototype,"disabled"),he([u({type:Boolean,reflect:!0})],ie.prototype,"readonly"),he([u({type:Boolean,reflect:!0})],ie.prototype,"required"),he([u({reflect:!0,converter:{fromAttribute:s=>s,toAttribute:s=>(s==null?void 0:s.toString())??null}})],ie.prototype,"max"),he([u({type:Number,reflect:!0})],ie.prototype,"maxlength"),he([u({reflect:!0,converter:{fromAttribute:s=>s,toAttribute:s=>(s==null?void 0:s.toString())??null}})],ie.prototype,"min"),he([u({type:Number,reflect:!0})],ie.prototype,"minlength"),he([u({type:Number,reflect:!0})],ie.prototype,"step"),he([u({type:String})],ie.prototype,"ariaDescribedBy"),he([u({type:String})],ie.prototype,"ariaLabelledby"),he([u({type:String,reflect:!0})],ie.prototype,"name"),he([u({type:String,reflect:!0})],ie.prototype,"pattern"),he([u({type:String,reflect:!0})],ie.prototype,"placeholder"),he([u({type:String,reflect:!0})],ie.prototype,"id"),he([u({type:Boolean})],ie.prototype,"counter"),he([u({type:Boolean})],ie.prototype,"hasError"),he([u({type:Boolean})],ie.prototype,"inline"),he([u({type:Boolean})],ie.prototype,"hasFieldset"),he([u({type:Boolean})],ie.prototype,"optionalTag"),he([u({type:Boolean})],ie.prototype,"requiredTag"),he([u({type:Boolean})],ie.prototype,"skipForwardTestid"),he([u({type:Boolean,reflect:!0,converter:xt})],ie.prototype,"useWrapper"),he([u({type:Boolean,reflect:!0})],ie.prototype,"fullwidth"),he([u({type:Number})],ie.prototype,"counterMaxLength"),he([u({type:String})],ie.prototype,"errorMessage"),he([u({type:String})],ie.prototype,"helptext"),he([u({type:String})],ie.prototype,"helptextDropdown"),he([u({type:String,reflect:!1})],ie.prototype,"helptextDropdownButton"),he([u({type:String})],ie.prototype,"label"),he([u({type:String,reflect:!1})],ie.prototype,"optionalText"),he([u({type:String,reflect:!1})],ie.prototype,"requiredText"),he([u({type:String,reflect:!1})],ie.prototype,"tagText"),he([u({type:String,attribute:"data-testid"})],ie.prototype,"dataTestid");let So=class{constructor(e){this.nodes=[],this.options=[],this.generation=0,this.host=e,this.host.addController(this),this.nodes=[],this.options=[],this.observer=new MutationObserver(t=>this.handleMutations(t))}hostConnected(){Array.from(this.host.childNodes).forEach(e=>{(e.nodeName==="OPTION"||e.nodeName==="DATA")&&this.addNode(e)}),this.createOptions(),this.observer.observe(this.host,{childList:!0,subtree:!1,attributes:!0})}hostDisconnected(){this.observer.disconnect()}addNode(e){(e.nodeName==="OPTION"||e.nodeName==="DATA")&&(e.hasAttribute("hidden")&&!e.hasAttribute("data-skip")&&e.setAttribute("data-hidden","true"),!e.hasAttribute("hidden")&&e.hasAttribute("data-skip")&&e.hasAttribute("data-hidden")&&e.removeAttribute("data-hidden"),e.setAttribute("class","pkt-hide"),e.setAttribute("data-skip","true"),e.setAttribute("hidden","true"),this.nodes.push(e))}createOptions(){this.options=this.nodes.map(e=>({value:e.hasAttribute("value")?e.getAttribute("value")??"":e.textContent??"",label:e.textContent||e.getAttribute("value")||"",selected:e.hasAttribute("selected"),disabled:e.hasAttribute("disabled"),hidden:e.hasAttribute("data-hidden")})),this.generation++,this.host.requestUpdate()}handleMutations(e){let t=!1;e.forEach(n=>{n.type==="childList"&&(n.addedNodes.forEach(i=>{En(i)&&(this.addNode(i),t=!0)}),n.removedNodes.forEach(i=>{En(i)&&(this.nodes=this.nodes.filter(r=>r!==i),t=!0)})),n.type==="attributes"&&En(n.target)&&(this.addNode(n.target),t=!0)}),t&&this.createOptions()}};var gh=Object.defineProperty,mh=Object.getOwnPropertyDescriptor,dn=(s,e,t,n)=>{for(var i=n>1?void 0:n?mh(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&gh(e,t,i),i};let $s=class extends pt{constructor(){super(...arguments),this.forId=ws(),this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=Dt.props.helptextDropdownButton.default,this.isHelpTextOpen=!1}render(){const e=()=>{const i=!this.isHelpTextOpen;this.isHelpTextOpen=i,this.dispatchEvent(new CustomEvent("toggleHelpText",{bubbles:!0,detail:{isOpen:i}}))},t=G({"pkt-inputwrapper__helptext-container":!0,"pkt-inputwrapper__has-helptext":this.helptext||this.helptextDropdown||this.hasSlotContent()}),n=()=>this.helptextDropdown?y`<div class="pkt-inputwrapper__helptext-expandable">
|
|
557
|
+
`:C}handleSearchInput(e){this.searchValue=e.target.value,this.dispatchEvent(new CustomEvent("search",{detail:this.searchValue,bubbles:!1}))}handleSearchKeydown(e){switch(e.key){case"Enter":e.preventDefault();break;case"ArrowUp":case"Escape":this.closeOptions(),e.preventDefault();break;case"ArrowDown":this.focusFirstOrSelectedOption();break;case"Tab":this.tabClose();break}}handleOptionKeydown(e){const t=e.currentTarget,n=t.dataset.value,i=t.dataset.type,r=t.dataset.selected==="true";if(!(!Yn(this).length&&(!this.customUserInput||!this.allowUserInput&&this.customUserInput)&&i!=="new-option"&&i!=="searchbox"))switch(e.key){case" ":case"Enter":this.toggleOption(t),e.preventDefault();break;case"Backspace":n&&(r?this.toggleOption(t):this.closeOptions()),e.preventDefault();break;case"Escape":this.closeOptions(),e.preventDefault();break;case"Tab":this.tabClose();break;case"ArrowDown":e.altKey?$o(this):i==="searchbox"||i==="new-option"?xr(this):oh(t),e.preventDefault();break;case"ArrowUp":if(e.altKey)xr(this);else if(t.dataset.index==="0"&&this.includeSearch){const a=this.querySelector('[role="searchbox"]');a&&a.focus()}else if(t.dataset.index==="0"&&this.customUserInput){const a=this.querySelector('[data-type="new-option"]');a&&a.focus()}else lh(t,this,this.includeSearch);e.preventDefault();break;case"Home":xr(this),e.preventDefault();break;case"End":$o(this),e.preventDefault();break;default:(e.metaKey||e.ctrlKey)&&e.key==="a"&&(this.selectAll(),e.preventDefault()),ih(e.key)&&(this.handleTypeAhead(e.key),e.preventDefault());break}}focusFirstOrSelectedOption(){ch(this,{disabled:this.disabled,allowUserInput:this.allowUserInput,customUserInput:this.customUserInput,includeSearch:this.includeSearch})}toggleOption(e){const t=e instanceof HTMLElement?e.dataset.disabled:e.disabled;if(this.disabled||t)return;const n=e instanceof HTMLElement?e.dataset.value:e.value;this.dispatchEvent(new CustomEvent("option-toggle",{detail:n,bubbles:!1}))}selectAll(){this.dispatchEvent(new CustomEvent("select-all",{bubbles:!1}))}closeOptions(){this.dispatchEvent(new CustomEvent("close-options",{bubbles:!1}))}tabClose(){this.dispatchEvent(new CustomEvent("tab-close",{bubbles:!1}))}filterOptions(){this._filteredOptions=th(this.options,this.searchValue)}handleTypeAhead(e){const t=this.typeahead.append(e),n=Yn(this),i=ah(n,t);i>=0&&cs(n[i])}};vt([u({type:String})],gt.prototype,"id",2),vt([u({type:String})],gt.prototype,"label",2),vt([u({type:Array})],gt.prototype,"options",2),vt([u({type:Boolean,reflect:!0,attribute:"is-open"})],gt.prototype,"isOpen",2),vt([u({type:Boolean})],gt.prototype,"disabled",2),vt([u({type:Boolean,attribute:"include-search"})],gt.prototype,"includeSearch",2),vt([u({type:Boolean,attribute:"is-multi-select"})],gt.prototype,"isMultiSelect",2),vt([u({type:Boolean,attribute:"allow-user-input"})],gt.prototype,"allowUserInput",2),vt([u({type:Boolean,attribute:"max-is-reached"})],gt.prototype,"maxIsReached",2),vt([u({type:String,attribute:"custom-user-input"})],gt.prototype,"customUserInput",2),vt([u({type:String,attribute:"search-placeholder"})],gt.prototype,"searchPlaceholder",2),vt([u({type:String,attribute:"search-value"})],gt.prototype,"searchValue",2),vt([u({type:Number,attribute:"max-length"})],gt.prototype,"maxLength",2),vt([u({type:String,attribute:"user-message"})],gt.prototype,"userMessage",2),vt([he()],gt.prototype,"_filteredOptions",2),gt=vt([fe("pkt-listbox")],gt);const xt={fromAttribute(s){return s==null?!1:s===""||s==="true"||s===!0?!0:s==="false"||s===!1?!1:!!s},toAttribute(s){return s?"true":"false"}},hh={helptextDropdownButton:{default:"Les mer <span class='pkt-sr-only'>om feltet</span>"},counter:{default:!1},optionalTag:{default:!1},optionalText:{default:"Valgfritt"},requiredTag:{default:!1},requiredText:{default:"Må fylles ut"},hasError:{default:!1},disabled:{default:!1},inline:{default:!1},hasFieldset:{default:!1},useWrapper:{default:!0}},Dt={props:hh};var ph={},xo;function fh(){return xo||(xo=1,(function(){(function(s){const e=new WeakMap,t=new WeakMap,n=new WeakMap,i=new WeakMap,r=new WeakMap,a=new WeakMap,l=new WeakMap,c=new WeakMap,h=new WeakMap,m=new WeakMap,g=new WeakMap,f=new WeakMap,k=new WeakMap,v=new WeakMap,$=new WeakMap,N={ariaAtomic:"aria-atomic",ariaAutoComplete:"aria-autocomplete",ariaBusy:"aria-busy",ariaChecked:"aria-checked",ariaColCount:"aria-colcount",ariaColIndex:"aria-colindex",ariaColIndexText:"aria-colindextext",ariaColSpan:"aria-colspan",ariaCurrent:"aria-current",ariaDescription:"aria-description",ariaDisabled:"aria-disabled",ariaExpanded:"aria-expanded",ariaHasPopup:"aria-haspopup",ariaHidden:"aria-hidden",ariaInvalid:"aria-invalid",ariaKeyShortcuts:"aria-keyshortcuts",ariaLabel:"aria-label",ariaLevel:"aria-level",ariaLive:"aria-live",ariaModal:"aria-modal",ariaMultiLine:"aria-multiline",ariaMultiSelectable:"aria-multiselectable",ariaOrientation:"aria-orientation",ariaPlaceholder:"aria-placeholder",ariaPosInSet:"aria-posinset",ariaPressed:"aria-pressed",ariaReadOnly:"aria-readonly",ariaRelevant:"aria-relevant",ariaRequired:"aria-required",ariaRoleDescription:"aria-roledescription",ariaRowCount:"aria-rowcount",ariaRowIndex:"aria-rowindex",ariaRowIndexText:"aria-rowindextext",ariaRowSpan:"aria-rowspan",ariaSelected:"aria-selected",ariaSetSize:"aria-setsize",ariaSort:"aria-sort",ariaValueMax:"aria-valuemax",ariaValueMin:"aria-valuemin",ariaValueNow:"aria-valuenow",ariaValueText:"aria-valuetext",role:"role"},x=(b,p)=>{for(let _ in N){p[_]=null;let T=null;const K=N[_];Object.defineProperty(p,_,{get(){return T},set(G){T=G,b.isConnected?M(b,K,G):m.set(b,p)}})}};function S(b){const p=i.get(b),{form:_}=p;Ue(b,_,p),ee(b,p.labels)}const P=(b,p=!1)=>{const _=document.createTreeWalker(b,NodeFilter.SHOW_ELEMENT,{acceptNode(G){return i.has(G)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let T=_.nextNode();const K=!p||b.disabled;for(;T;)T.formDisabledCallback&&K&&z(T,b.disabled),T=_.nextNode()},D={attributes:!0,attributeFilter:["disabled","name"]},U=te()?new MutationObserver(b=>{for(const p of b){const _=p.target;if(p.attributeName==="disabled"&&(_.constructor.formAssociated?z(_,_.hasAttribute("disabled")):_.localName==="fieldset"&&P(_)),p.attributeName==="name"&&_.constructor.formAssociated){const T=i.get(_),K=h.get(_);T.setFormValue(K)}}}):{};function V(b){b.forEach(p=>{const{addedNodes:_,removedNodes:T}=p,K=Array.from(_),G=Array.from(T);K.forEach(ce=>{var nt;if(i.has(ce)&&ce.constructor.formAssociated&&S(ce),m.has(ce)){const Ze=m.get(ce);Object.keys(N).filter(Be=>Ze[Be]!==null).forEach(Be=>{M(ce,N[Be],Ze[Be])}),m.delete(ce)}if($.has(ce)){const Ze=$.get(ce);M(ce,"internals-valid",Ze.validity.valid.toString()),M(ce,"internals-invalid",(!Ze.validity.valid).toString()),M(ce,"aria-invalid",(!Ze.validity.valid).toString()),$.delete(ce)}if(ce.localName==="form"){const Ze=c.get(ce),Be=document.createTreeWalker(ce,NodeFilter.SHOW_ELEMENT,{acceptNode(Xt){return i.has(Xt)&&Xt.constructor.formAssociated&&!(Ze&&Ze.has(Xt))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let Gt=Be.nextNode();for(;Gt;)S(Gt),Gt=Be.nextNode()}ce.localName==="fieldset"&&((nt=U.observe)===null||nt===void 0||nt.call(U,ce,D),P(ce,!0))}),G.forEach(ce=>{const nt=i.get(ce);nt&&n.get(nt)&&L(nt),l.has(ce)&&l.get(ce).disconnect()})})}function Y(b){b.forEach(p=>{const{removedNodes:_}=p;_.forEach(T=>{const K=k.get(p.target);i.has(T)&&De(T),K.disconnect()})})}const ue=b=>{var p,_;const T=new MutationObserver(Y);!((p=window==null?void 0:window.ShadyDOM)===null||p===void 0)&&p.inUse&&b.mode&&b.host&&(b=b.host),(_=T.observe)===null||_===void 0||_.call(T,b,{childList:!0}),k.set(b,T)};te()&&new MutationObserver(V);const j={childList:!0,subtree:!0},M=(b,p,_)=>{b.getAttribute(p)!==_&&b.setAttribute(p,_)},z=(b,p)=>{b.toggleAttribute("internals-disabled",p),p?M(b,"aria-disabled","true"):b.removeAttribute("aria-disabled"),b.formDisabledCallback&&b.formDisabledCallback.apply(b,[p])},L=b=>{n.get(b).forEach(p=>{p.remove()}),n.set(b,[])},Q=(b,p)=>{const _=document.createElement("input");return _.type="hidden",_.name=b.getAttribute("name"),b.after(_),n.get(p).push(_),_},oe=(b,p)=>{var _;n.set(p,[]),(_=U.observe)===null||_===void 0||_.call(U,b,D)},ee=(b,p)=>{if(p.length){Array.from(p).forEach(T=>T.addEventListener("click",b.click.bind(b)));let _=p[0].id;p[0].id||(_=`${p[0].htmlFor}_Label`,p[0].id=_),M(b,"aria-labelledby",_)}},de=b=>{const p=Array.from(b.elements).filter(G=>!G.tagName.includes("-")&&G.validity).map(G=>G.validity.valid),_=c.get(b)||[],T=Array.from(_).filter(G=>G.isConnected).map(G=>i.get(G).validity.valid),K=[...p,...T].includes(!1);b.toggleAttribute("internals-invalid",K),b.toggleAttribute("internals-valid",!K)},le=b=>{de(Z(b.target))},be=b=>{de(Z(b.target))},ne=b=>{const p=["button[type=submit]","input[type=submit]","button:not([type])"].map(_=>`${_}:not([disabled])`).map(_=>`${_}:not([form])${b.id?`,${_}[form='${b.id}']`:""}`).join(",");b.addEventListener("click",_=>{if(_.target.closest(p)){const T=c.get(b);if(b.noValidate)return;T.size&&Array.from(T).reverse().map(K=>i.get(K).reportValidity()).includes(!1)&&_.preventDefault()}})},ae=b=>{const p=c.get(b.target);p&&p.size&&p.forEach(_=>{_.constructor.formAssociated&&_.formResetCallback&&_.formResetCallback.apply(_)})},Ue=(b,p,_)=>{if(p){const T=c.get(p);if(T)T.add(b);else{const K=new Set;K.add(b),c.set(p,K),ne(p),p.addEventListener("reset",ae),p.addEventListener("input",le),p.addEventListener("change",be)}a.set(p,{ref:b,internals:_}),b.constructor.formAssociated&&b.formAssociatedCallback&&setTimeout(()=>{b.formAssociatedCallback.apply(b,[p])},0),de(p)}},Z=b=>{let p=b.parentNode;return p&&p.tagName!=="FORM"&&(p=Z(p)),p},A=(b,p,_=DOMException)=>{if(!b.constructor.formAssociated)throw new _(p)},Me=(b,p,_)=>{const T=c.get(b);return T&&T.size&&T.forEach(K=>{i.get(K)[_]()||(p=!1)}),p},De=b=>{if(b.constructor.formAssociated){const p=i.get(b),{labels:_,form:T}=p;ee(b,_),Ue(b,T,p)}};function te(){return typeof MutationObserver<"u"}class Ie{constructor(){this.badInput=!1,this.customError=!1,this.patternMismatch=!1,this.rangeOverflow=!1,this.rangeUnderflow=!1,this.stepMismatch=!1,this.tooLong=!1,this.tooShort=!1,this.typeMismatch=!1,this.valid=!0,this.valueMissing=!1,Object.seal(this)}}const Ee=b=>(b.badInput=!1,b.customError=!1,b.patternMismatch=!1,b.rangeOverflow=!1,b.rangeUnderflow=!1,b.stepMismatch=!1,b.tooLong=!1,b.tooShort=!1,b.typeMismatch=!1,b.valid=!0,b.valueMissing=!1,b),ye=(b,p,_)=>(b.valid=Te(p),Object.keys(p).forEach(T=>b[T]=p[T]),_&&de(_),b),Te=b=>{let p=!0;for(let _ in b)_!=="valid"&&b[_]!==!1&&(p=!1);return p},Pe=new WeakMap;function je(b,p){b.toggleAttribute(p,!0),b.part&&b.part.add(p)}class Ae extends Set{static get isPolyfilled(){return!0}constructor(p){if(super(),!p||!p.tagName||p.tagName.indexOf("-")===-1)throw new TypeError("Illegal constructor");Pe.set(this,p)}add(p){if(!/^--/.test(p)||typeof p!="string")throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value ${p} must start with '--'.`);const _=super.add(p),T=Pe.get(this),K=`state${p}`;return T.isConnected?je(T,K):setTimeout(()=>{je(T,K)}),_}clear(){for(let[p]of this.entries())this.delete(p);super.clear()}delete(p){const _=super.delete(p),T=Pe.get(this);return T.isConnected?(T.toggleAttribute(`state${p}`,!1),T.part&&T.part.remove(`state${p}`)):setTimeout(()=>{T.toggleAttribute(`state${p}`,!1),T.part&&T.part.remove(`state${p}`)}),_}}function ve(b,p,_,T){if(typeof p=="function"?b!==p||!T:!p.has(b))throw new TypeError("Cannot read private member from an object whose class did not declare it");return _==="m"?T:_==="a"?T.call(b):T?T.value:p.get(b)}function E(b,p,_,T,K){if(typeof p=="function"?b!==p||!0:!p.has(b))throw new TypeError("Cannot write private member to an object whose class did not declare it");return p.set(b,_),_}var Le;class Ye{constructor(p){Le.set(this,void 0),E(this,Le,p);for(let _=0;_<p.length;_++){let T=p[_];this[_]=T,T.hasAttribute("name")&&(this[T.getAttribute("name")]=T)}Object.freeze(this)}get length(){return ve(this,Le,"f").length}[(Le=new WeakMap,Symbol.iterator)](){return ve(this,Le,"f")[Symbol.iterator]()}item(p){return this[p]==null?null:this[p]}namedItem(p){return this[p]==null?null:this[p]}}function q(){const b=HTMLFormElement.prototype.checkValidity;HTMLFormElement.prototype.checkValidity=_;const p=HTMLFormElement.prototype.reportValidity;HTMLFormElement.prototype.reportValidity=T;function _(...G){let ce=b.apply(this,G);return Me(this,ce,"checkValidity")}function T(...G){let ce=p.apply(this,G);return Me(this,ce,"reportValidity")}const{get:K}=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"elements");Object.defineProperty(HTMLFormElement.prototype,"elements",{get(...G){const ce=K.call(this,...G),nt=Array.from(c.get(this)||[]);if(nt.length===0)return ce;const Ze=Array.from(ce).concat(nt).sort((Be,Gt)=>Be.compareDocumentPosition?Be.compareDocumentPosition(Gt)&2?1:-1:0);return new Ye(Ze)}})}class H{static get isPolyfilled(){return!0}constructor(p){if(!p||!p.tagName||p.tagName.indexOf("-")===-1)throw new TypeError("Illegal constructor");const _=p.getRootNode(),T=new Ie;this.states=new Ae(p),e.set(this,p),t.set(this,T),i.set(p,this),x(p,this),oe(p,this),Object.seal(this),_ instanceof DocumentFragment&&ue(_)}checkValidity(){const p=e.get(this);if(A(p,"Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!this.willValidate)return!0;const _=t.get(this);if(!_.valid){const T=new Event("invalid",{bubbles:!1,cancelable:!0,composed:!1});p.dispatchEvent(T)}return _.valid}get form(){const p=e.get(this);A(p,"Failed to read the 'form' property from 'ElementInternals': The target element is not a form-associated custom element.");let _;return p.constructor.formAssociated===!0&&(_=Z(p)),_}get labels(){const p=e.get(this);A(p,"Failed to read the 'labels' property from 'ElementInternals': The target element is not a form-associated custom element.");const _=p.getAttribute("id"),T=p.getRootNode();return T&&_?T.querySelectorAll(`[for="${_}"]`):[]}reportValidity(){const p=e.get(this);if(A(p,"Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!this.willValidate)return!0;const _=this.checkValidity(),T=f.get(this);if(T&&!p.constructor.formAssociated)throw new DOMException("Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.");return!_&&T&&(p.focus(),T.focus()),_}setFormValue(p){const _=e.get(this);if(A(_,"Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element."),L(this),p!=null&&!(p instanceof FormData)){if(_.getAttribute("name")){const T=Q(_,this);T.value=p}}else p!=null&&p instanceof FormData&&Array.from(p).reverse().forEach(([T,K])=>{if(typeof K=="string"){const G=Q(_,this);G.name=T,G.value=K}});h.set(_,p)}setValidity(p,_,T){const K=e.get(this);if(A(K,"Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!p)throw new TypeError("Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.");f.set(this,T);const G=t.get(this),ce={};for(const Be in p)ce[Be]=p[Be];Object.keys(ce).length===0&&Ee(G);const nt=Object.assign(Object.assign({},G),ce);delete nt.valid;const{valid:Ze}=ye(G,nt,this.form);if(!Ze&&!_)throw new DOMException("Failed to execute 'setValidity' on 'ElementInternals': The second argument should not be empty if one or more flags in the first argument are true.");r.set(this,Ze?"":_),K.isConnected?(K.toggleAttribute("internals-invalid",!Ze),K.toggleAttribute("internals-valid",Ze),M(K,"aria-invalid",`${!Ze}`)):$.set(K,this)}get shadowRoot(){const p=e.get(this);return g.get(p)||null}get validationMessage(){const p=e.get(this);return A(p,"Failed to read the 'validationMessage' property from 'ElementInternals': The target element is not a form-associated custom element."),r.get(this)}get validity(){const p=e.get(this);return A(p,"Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element."),t.get(this)}get willValidate(){const p=e.get(this);return A(p,"Failed to read the 'willValidate' property from 'ElementInternals': The target element is not a form-associated custom element."),!(p.disabled||p.hasAttribute("disabled")||p.hasAttribute("readonly"))}}function se(){if(typeof window>"u"||!window.ElementInternals||!HTMLElement.prototype.attachInternals)return!1;class b extends HTMLElement{constructor(){super(),this.internals=this.attachInternals()}}const p=`element-internals-feature-detection-${Math.random().toString(36).replace(/[^a-z]+/g,"")}`;customElements.define(p,b);const _=new b;return["shadowRoot","form","willValidate","validity","validationMessage","labels","setFormValue","setValidity","checkValidity","reportValidity"].every(T=>T in _.internals)}let me=!1,ge=!1;function Xe(b){ge||(ge=!0,window.CustomStateSet=Ae,b&&(HTMLElement.prototype.attachInternals=function(...p){const _=b.call(this,p);return _.states=new Ae(this),_}))}function Ke(b=!0){if(!me){if(me=!0,typeof window<"u"&&(window.ElementInternals=H),typeof CustomElementRegistry<"u"){const p=CustomElementRegistry.prototype.define;CustomElementRegistry.prototype.define=function(_,T,K){if(T.formAssociated){const G=T.prototype.connectedCallback;T.prototype.connectedCallback=function(){v.has(this)||(v.set(this,!0),this.hasAttribute("disabled")&&z(this,!0)),G!=null&&G.apply(this),De(this)}}p.call(this,_,T,K)}}if(typeof HTMLElement<"u"&&(HTMLElement.prototype.attachInternals=function(){if(this.tagName){if(this.tagName.indexOf("-")===-1)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': Unable to attach ElementInternals to non-custom elements.")}else return{};if(i.has(this))throw new DOMException("DOMException: Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");return new H(this)}),typeof Element<"u"){let p=function(...T){const K=_.apply(this,T);if(g.set(this,K),te()){const G=new MutationObserver(V);window.ShadyDOM?G.observe(this,j):G.observe(K,j),l.set(this,G)}return K};const _=Element.prototype.attachShadow;Element.prototype.attachShadow=p}te()&&typeof document<"u"&&new MutationObserver(V).observe(document.documentElement,j),typeof HTMLFormElement<"u"&&q(),(b||typeof window<"u"&&!window.CustomStateSet)&&Xe()}}return customElements.polyfillWrapFlushCallback||(se()?typeof window<"u"&&!window.CustomStateSet&&Xe(HTMLElement.prototype.attachInternals):Ke(!1)),s.forceCustomStateSetPolyfill=Xe,s.forceElementInternalsPolyfill=Ke,Object.defineProperty(s,"__esModule",{value:!0}),s})({})})()),ph}fh();var gh=Object.defineProperty,pe=(s,e,t,n)=>{for(var i=void 0,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=a(e,t,i)||i);return i&&gh(e,t,i),i};const Co="on",Cr="--checked",Oi=",";let ie=class extends pt{constructor(){super(),this.defaultValue=null,this.disabled=!1,this.readonly=!1,this.required=!1,this.max=null,this.maxlength=null,this.min=null,this.minlength=null,this.step=null,this.ariaDescribedBy=null,this.ariaLabelledby=null,this.name="",this.pattern=null,this.placeholder=null,this.id=ws(),this.counter=!1,this.hasError=!1,this.inline=!1,this.hasFieldset=!1,this.optionalTag=!1,this.requiredTag=!1,this.skipForwardTestid=!1,this.useWrapper=!0,this.fullwidth=!1,this.counterMaxLength=0,this.errorMessage="",this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=Dt.props.helptextDropdownButton.default,this.label=null,this.optionalText=$t.forms.labels.optional,this.requiredText=$t.forms.labels.required,this.tagText=null,this.dataTestid="",this.touched=!1,this.internals=this.attachInternals()}static get formAssociated(){return!0}manageValidity(e){var t,n,i,r,a,l,c,h,m,g,f;if(!e){console.warn("manageValidity called without valid input element");return}this.required&&!this.value?this.internals.setValidity({valueMissing:!0},$t.forms.messages.required,e):(t=e.validity)!=null&&t.typeMismatch||(n=e.validity)!=null&&n.badInput?this.internals.setValidity({typeMismatch:!0},$t.forms.messages.invalid,e):(i=e.validity)!=null&&i.patternMismatch?this.internals.setValidity({patternMismatch:!0},$t.forms.messages.invalidPattern,e):(r=e.validity)!=null&&r.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},$t.forms.messages.tooShort,e):(a=e.validity)!=null&&a.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},$t.forms.messages.tooLong,e):(l=e.validity)!=null&&l.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},this.min?$t.forms.messages.rangeUnderflowMin.replace("{min}",(c=this.min)==null?void 0:c.toString()):$t.forms.messages.rangeUnderflow,e):(h=e.validity)!=null&&h.stepMismatch?this.internals.setValidity({stepMismatch:!0},$t.forms.messages.invalid,e):(m=e.validity)!=null&&m.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},this.max?$t.forms.messages.rangeOverflowMax.replace("{max}",(g=this.max)==null?void 0:g.toString()):$t.forms.messages.rangeOverflow,e):(f=e.validity)!=null&&f.customError?this.internals.setValidity({customError:!0},e.validationMessage,e):this.internals.setValidity({})}setFormValue(e){if(this.internals)if(Array.isArray(e)){const t=new FormData;e.forEach(n=>{t.append(this.name,n)}),this.internals.setFormValue(t)}else this.internals.setFormValue(e)}coordinateRadioGroup(){if(!this.form||!this.name||this.type!=="radio")return;const e=`pkt-radiobutton[name="${this.name}"], input[type=radio][name="${this.name}"]`;this.form.querySelectorAll(e).forEach(t=>{var n;if(t!==this&&t.getAttribute("name")===this.name&&t.getAttribute("value")!==this.value){const i=t;i.checked&&(i.checked=!1,i.internals&&(i.internals.setFormValue(null),(n=i.internals.states)==null||n.delete(Cr)))}})}valueChecked(e){if(!this.touched)return;const t=this.internals.form||this.closest("form"),n=t?new FormData(t):null;if(this.type==="radio"&&this.coordinateRadioGroup(),typeof e=="string"?(this.checked=e==="true",this.internals.ariaChecked=String(e==="true")):typeof e=="boolean"&&(this.checked=e,this.internals.ariaChecked=String(e)),this.checked){const i=(typeof this.value=="string"?this.value:"")||Co;this.internals.setFormValue(i),n&&n.append(this.name,i),this.internals.states.add(Cr)}else this.internals.setFormValue(null),n&&n.delete(this.name),this.internals.states.delete(Cr);this.dispatchChangeEvents(this.checked),this.internals.reportValidity()}valueChanged(e,t){(t!==this.value||t!==this._value)&&(typeof e=="string"?((this.multiple||this.range)&&e.includes(Oi)&&(e=e.split(Oi)),this.value=e,this._value=Array.isArray(e)?e:[e]):Array.isArray(e)?(this.value=this.multiple||this.range?e:e[0],this._value=e):(this.value="",this._value=[]),(!this.value||this.value.length===0)&&t&&t.length!==0?this.clearInputValue():this.value&&this.value.toString()!==(t==null?void 0:t.toString())&&this.onChange(this.value))}dispatchChangeEvents(e){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:e,bubbles:!0,composed:!0}))}clearInputValue(){const e=this.multiple||this.range?[]:"";this.value=e,this.setFormValue(e),this.dispatchChangeEvents(e)}onFocus(){this.dispatchEvent(new FocusEvent("focus",{bubbles:!0,composed:!0}))}onBlur(){this.dispatchEvent(new FocusEvent("blur",{bubbles:!0,composed:!0}))}onInput(){this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0}))}normalizeValue(e){return(this.range||this.multiple)&&typeof e=="string"&&e.includes(Oi)?e.split(Oi):!this.multiple&&!this.range&&Array.isArray(e)?e[0]||"":e}validate(){var e,t;(e=this.inputRef)!=null&&e.value&&this.manageValidity(this.inputRef.value),(t=this.inputRefTo)!=null&&t.value&&this.manageValidity(this.inputRefTo.value)}onChange(e){if(!this.touched){this.touched=!0,e&&this.setFormValue(e);return}if(typeof e!="string"&&!Array.isArray(e))return;const t=this.normalizeValue(e);this.setFormValue(t),this.validate(),this.dispatchChangeEvents(t)}formResetCallback(){var e;if(this.touched=!1,this._options&&this._options.length&&this._options.forEach(t=>{"selected"in t&&(t.selected=!1)}),this.checked!==void 0)this.checked=!1,this.internals.ariaChecked="false",this.internals.setFormValue(""),(e=this.inputRef)!=null&&e.value&&"checked"in this.inputRef.value&&(this.inputRef.value.checked=!1),this.valueChecked(this.checked);else{this.internals.setFormValue("");const t=this.defaultValue||(this.multiple||this.range?[]:"");this.value=t,this._value=Array.isArray(t)?t:[t],this.valueChanged(this.value,null)}this.internals.ariaInvalid="false"}updated(e){super.updated(e),e.has("dataTestid")&&this.dataTestid&&this.inputRef.value&&(this.skipForwardTestid?this.hasAttribute("data-testid")||this.setAttribute("data-testid",this.dataTestid):(this.inputRef.value.dataset.testid=this.dataTestid,this.removeAttribute("data-testid")))}firstUpdated(e){if(super.firstUpdated(e),!this.form){const t=this.internals.form||this.closest("form");this.form=t}if(this.value&&this.defaultValue===null&&(this.defaultValue=this.value),this.defaultValue!==null&&!this.value&&this.valueChanged(this.defaultValue,null),this.defaultChecked&&(this.internals.ariaChecked="true",this.checked=!0),this.required&&(this.internals.ariaRequired="true"),this.disabled&&(this.internals.ariaDisabled="true"),this.id&&!this.name&&(this.name=this.id),this.checked!==void 0){const t=this.checked===""||this.checked==="true"||this.checked===!0;this.internals.ariaChecked=String(t);const n=t?(typeof this.value=="string"?this.value:"")||Co:null;this.internals.setFormValue(n)}else this.setFormValue(this.value);this.inputRef&&this.inputRef.value&&(this.inputRef.value.setAttribute("form",""),this.manageValidity(this.inputRef.value)),this.inputRefTo&&this.inputRefTo.value&&(this.inputRefTo.value.setAttribute("form",""),this.manageValidity(this.inputRefTo.value))}};pe([u({type:Boolean,reflect:!0})],ie.prototype,"checked"),pe([u({type:Boolean})],ie.prototype,"defaultChecked"),pe([u({type:Boolean})],ie.prototype,"multiple"),pe([u({type:Boolean})],ie.prototype,"range"),pe([u({type:String,reflect:!0})],ie.prototype,"type"),pe([u()],ie.prototype,"defaultValue"),pe([u({type:Boolean,reflect:!0})],ie.prototype,"disabled"),pe([u({type:Boolean,reflect:!0})],ie.prototype,"readonly"),pe([u({type:Boolean,reflect:!0})],ie.prototype,"required"),pe([u({reflect:!0,converter:{fromAttribute:s=>s,toAttribute:s=>(s==null?void 0:s.toString())??null}})],ie.prototype,"max"),pe([u({type:Number,reflect:!0})],ie.prototype,"maxlength"),pe([u({reflect:!0,converter:{fromAttribute:s=>s,toAttribute:s=>(s==null?void 0:s.toString())??null}})],ie.prototype,"min"),pe([u({type:Number,reflect:!0})],ie.prototype,"minlength"),pe([u({type:Number,reflect:!0})],ie.prototype,"step"),pe([u({type:String})],ie.prototype,"ariaDescribedBy"),pe([u({type:String})],ie.prototype,"ariaLabelledby"),pe([u({type:String,reflect:!0})],ie.prototype,"name"),pe([u({type:String,reflect:!0})],ie.prototype,"pattern"),pe([u({type:String,reflect:!0})],ie.prototype,"placeholder"),pe([u({type:String,reflect:!0})],ie.prototype,"id"),pe([u({type:Boolean})],ie.prototype,"counter"),pe([u({type:Boolean})],ie.prototype,"hasError"),pe([u({type:Boolean})],ie.prototype,"inline"),pe([u({type:Boolean})],ie.prototype,"hasFieldset"),pe([u({type:Boolean})],ie.prototype,"optionalTag"),pe([u({type:Boolean})],ie.prototype,"requiredTag"),pe([u({type:Boolean})],ie.prototype,"skipForwardTestid"),pe([u({type:Boolean,reflect:!0,converter:xt})],ie.prototype,"useWrapper"),pe([u({type:Boolean,reflect:!0})],ie.prototype,"fullwidth"),pe([u({type:Number})],ie.prototype,"counterMaxLength"),pe([u({type:String})],ie.prototype,"errorMessage"),pe([u({type:String})],ie.prototype,"helptext"),pe([u({type:String})],ie.prototype,"helptextDropdown"),pe([u({type:String,reflect:!1})],ie.prototype,"helptextDropdownButton"),pe([u({type:String})],ie.prototype,"label"),pe([u({type:String,reflect:!1})],ie.prototype,"optionalText"),pe([u({type:String,reflect:!1})],ie.prototype,"requiredText"),pe([u({type:String,reflect:!1})],ie.prototype,"tagText"),pe([u({type:String,attribute:"data-testid"})],ie.prototype,"dataTestid");let So=class{constructor(e){this.nodes=[],this.options=[],this.generation=0,this.host=e,this.host.addController(this),this.nodes=[],this.options=[],this.observer=new MutationObserver(t=>this.handleMutations(t))}hostConnected(){Array.from(this.host.childNodes).forEach(e=>{(e.nodeName==="OPTION"||e.nodeName==="DATA")&&this.addNode(e)}),this.createOptions(),this.observer.observe(this.host,{childList:!0,subtree:!1,attributes:!0})}hostDisconnected(){this.observer.disconnect()}addNode(e){(e.nodeName==="OPTION"||e.nodeName==="DATA")&&(e.hasAttribute("hidden")&&!e.hasAttribute("data-skip")&&e.setAttribute("data-hidden","true"),!e.hasAttribute("hidden")&&e.hasAttribute("data-skip")&&e.hasAttribute("data-hidden")&&e.removeAttribute("data-hidden"),e.setAttribute("class","pkt-hide"),e.setAttribute("data-skip","true"),e.setAttribute("hidden","true"),this.nodes.push(e))}createOptions(){this.options=this.nodes.map(e=>({value:e.hasAttribute("value")?e.getAttribute("value")??"":e.textContent??"",label:e.textContent||e.getAttribute("value")||"",selected:e.hasAttribute("selected"),disabled:e.hasAttribute("disabled"),hidden:e.hasAttribute("data-hidden")})),this.generation++,this.host.requestUpdate()}handleMutations(e){let t=!1;e.forEach(n=>{n.type==="childList"&&(n.addedNodes.forEach(i=>{En(i)&&(this.addNode(i),t=!0)}),n.removedNodes.forEach(i=>{En(i)&&(this.nodes=this.nodes.filter(r=>r!==i),t=!0)})),n.type==="attributes"&&En(n.target)&&(this.addNode(n.target),t=!0)}),t&&this.createOptions()}};var mh=Object.defineProperty,bh=Object.getOwnPropertyDescriptor,un=(s,e,t,n)=>{for(var i=n>1?void 0:n?bh(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&mh(e,t,i),i};let $s=class extends pt{constructor(){super(...arguments),this.forId=ws(),this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=Dt.props.helptextDropdownButton.default,this.isHelpTextOpen=!1}render(){const e=()=>{const i=!this.isHelpTextOpen;this.isHelpTextOpen=i,this.dispatchEvent(new CustomEvent("toggleHelpText",{bubbles:!0,detail:{isOpen:i}}))},t=X({"pkt-inputwrapper__helptext-container":!0,"pkt-inputwrapper__has-helptext":this.helptext||this.helptextDropdown||this.hasSlotContent()}),n=()=>this.helptextDropdown?y`<div class="pkt-inputwrapper__helptext-expandable">
|
|
558
558
|
<button
|
|
559
559
|
class="pkt-link pkt-link--icon-right pkt-btn pkt-btn--small pkt-btn--tertiary pkt-btn--icon-right"
|
|
560
560
|
type="button"
|
|
@@ -567,7 +567,7 @@
|
|
|
567
567
|
<span class="pkt-btn__text">${xi(this.helptextDropdownButton)}</span>
|
|
568
568
|
</button>
|
|
569
569
|
<div
|
|
570
|
-
class="${
|
|
570
|
+
class="${X({"pkt-inputwrapper__helptext":!0,"pkt-inputwrapper__helptext-expandable-open":this.isHelpTextOpen,"pkt-inputwrapper__helptext-expandable-closed":!this.isHelpTextOpen})}"
|
|
571
571
|
>
|
|
572
572
|
${xi(this.helptextDropdown)}
|
|
573
573
|
</div>
|
|
@@ -577,7 +577,7 @@
|
|
|
577
577
|
${this.helptext&&xi(this.helptext)}
|
|
578
578
|
</div>
|
|
579
579
|
${n()}
|
|
580
|
-
</div>`}`}};
|
|
580
|
+
</div>`}`}};un([u({type:String,reflect:!0})],$s.prototype,"forId",2),un([u({type:String})],$s.prototype,"helptext",2),un([u({type:String})],$s.prototype,"helptextDropdown",2),un([u({type:String})],$s.prototype,"helptextDropdownButton",2),un([he()],$s.prototype,"isHelpTextOpen",2),$s=un([fe("pkt-helptext")],$s);var vh=Object.defineProperty,kh=Object.getOwnPropertyDescriptor,qe=(s,e,t,n)=>{for(var i=n>1?void 0:n?kh(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&vh(e,t,i),i};let Ve=class extends pt{constructor(){super(...arguments),this.forId=ws(),this.label="",this.helptext=null,this.helptextDropdown=null,this.helptextDropdownButton=null,this.counter=Dt.props.counter.default,this.counterCurrent=0,this.counterMaxLength=0,this.counterError=null,this.counterPosition="bottom",this.optionalTag=Dt.props.optionalTag.default,this.optionalText=Dt.props.optionalText.default,this.requiredTag=Dt.props.requiredTag.default,this.requiredText=Dt.props.requiredText.default,this.tagText=null,this.hasError=Dt.props.hasError.default,this.errorMessage="",this.disabled=Dt.props.disabled.default,this.inline=Dt.props.inline.default,this.ariaDescribedby=void 0,this.hasFieldset=Dt.props.hasFieldset.default,this.role="group",this.useWrapper=Dt.props.useWrapper.default}updated(e){super.updated(e)}render(){const e={"pkt-inputwrapper":!0,"pkt-inputwrapper--error":this.hasError,"pkt-inputwrapper--disabled":this.disabled,"pkt-inputwrapper--inline":this.inline},t="pkt-tag pkt-tag--small pkt-tag--thin-text",n=this.ariaDescribedby?this.ariaDescribedby:this.helptext?`${this.forId}-helptext`:C,i=()=>y`
|
|
581
581
|
${this.tagText?y`<span class=${t+" pkt-tag--gray"}>${this.tagText}</span>`:C}
|
|
582
582
|
${this.optionalTag?y`<span class=${t+" pkt-tag--blue-light"}>${this.optionalText}</span>`:C}
|
|
583
583
|
${this.requiredTag?y`<span class=${t+" pkt-tag--beige"}>${this.requiredText}</span>`:C}
|
|
@@ -608,7 +608,7 @@
|
|
|
608
608
|
.helptext=${this.helptext}
|
|
609
609
|
.helptextDropdown=${this.helptextDropdown}
|
|
610
610
|
.helptextDropdownButton=${this.helptextDropdownButton||Dt.props.helptextDropdownButton.default}
|
|
611
|
-
@toggleHelpText=${
|
|
611
|
+
@toggleHelpText=${g=>{this.toggleDropdown(g)}}
|
|
612
612
|
>${ze(this,"helptext")}</pkt-helptext>
|
|
613
613
|
`,l=()=>this.counter?y`<div class="pkt-input__counter" aria-live="polite" aria-atomic="true">
|
|
614
614
|
${this.counterError?this.counterError:C} ${this.counterCurrent||0}
|
|
@@ -628,9 +628,9 @@
|
|
|
628
628
|
<div class="pkt-contents">${ze(this)}</div>
|
|
629
629
|
${this.counterPosition==="bottom"?l():C}
|
|
630
630
|
${c()}
|
|
631
|
-
`,
|
|
631
|
+
`,m=()=>this.hasFieldset?y`<fieldset class="pkt-inputwrapper__fieldset" aria-describedby="${n}">
|
|
632
632
|
${h()}
|
|
633
|
-
</fieldset>`:y`<div class="pkt-inputwrapper__fieldset">${h()}</div>`;return y`<div class=${G(e)}>${g()}</div> `}toggleDropdown(e){this.dispatchEvent(new CustomEvent("toggleHelpText",{bubbles:!1,detail:{isOpen:e.detail.isOpen}}))}handleLabelClick(){this.dispatchEvent(new CustomEvent("labelClick",{bubbles:!0,composed:!0,detail:"label clicked"}))}};qe([u({type:String})],Ve.prototype,"forId",2),qe([u({type:String})],Ve.prototype,"label",2),qe([u({type:String})],Ve.prototype,"helptext",2),qe([u({type:String})],Ve.prototype,"helptextDropdown",2),qe([u({type:String})],Ve.prototype,"helptextDropdownButton",2),qe([u({type:Boolean})],Ve.prototype,"counter",2),qe([u({type:Number})],Ve.prototype,"counterCurrent",2),qe([u({type:Number})],Ve.prototype,"counterMaxLength",2),qe([u({type:String})],Ve.prototype,"counterError",2),qe([u({type:String,reflect:!1})],Ve.prototype,"counterPosition",2),qe([u({type:Boolean})],Ve.prototype,"optionalTag",2),qe([u({type:String})],Ve.prototype,"optionalText",2),qe([u({type:Boolean})],Ve.prototype,"requiredTag",2),qe([u({type:String})],Ve.prototype,"requiredText",2),qe([u({type:String})],Ve.prototype,"tagText",2),qe([u({type:Boolean})],Ve.prototype,"hasError",2),qe([u({type:String})],Ve.prototype,"errorMessage",2),qe([u({type:Boolean})],Ve.prototype,"disabled",2),qe([u({type:Boolean})],Ve.prototype,"inline",2),qe([u({type:String})],Ve.prototype,"ariaDescribedby",2),qe([u({type:Boolean})],Ve.prototype,"hasFieldset",2),qe([u({type:String,reflect:!0})],Ve.prototype,"role",2),qe([u({type:Boolean,reflect:!0,converter:xt})],Ve.prototype,"useWrapper",2),Ve=qe([pe("pkt-input-wrapper")],Ve);const kh=(s,e,t)=>{switch(s){case",":return t?"addValue":null;case"Enter":return"addValue";case"Tab":case"ArrowDown":return e?null:"focusListbox";case"Escape":return"closeOptions";default:return null}},yh=(s,e,t,n,i)=>{if(!s)return{action:"none",value:null};const r=Rt(t,s);return!e.includes(s)&&!r?n?{action:"addUserValue",value:s}:i?{action:"none",value:null}:{action:"removeValue",value:e[0]}:r&&!e.includes(r.value)?{action:"selectOption",value:r.value}:{action:"none",value:null}},_h=(s,e,t,n,i)=>s.trim().toLowerCase()?{...sh(s,e,t,n),shouldRemoveValue:!1,shouldResetInput:!1}:{addValueText:null,userInfoMessage:"",shouldRemoveValue:!i&&!!e[0],shouldResetInput:!0},Ei=(s,e,t)=>{const n=Rt(e,s);return t==="label"&&n!=null&&n.label?n.label:s},Kn={markOptionSelected(s,e){if(e){for(const t of s)if(t.value===e){t.selected=!0;break}}},markOptionDeselected(s,e){if(e){for(const t of s)if(t.value===e){t.selected=!1;break}}},markAllSelected(s){for(const e of s)e.selected=!0},markAllDeselected(s){for(const e of s)e.selected=!1},removeUserAddedOptions(s){return s.filter(e=>!e.userAdded)}},To={parseOptionsFromSlot(s){const e=[];return s.forEach(t=>{if(!t.textContent&&!t.getAttribute("value"))return;const n={value:t.getAttribute("value")||t.textContent||"",label:t.textContent||t.getAttribute("value")||""};t.getAttribute("data-prefix")&&(n.prefix=t.getAttribute("data-prefix")||void 0),t.getAttribute("tagskincolor")&&(n.tagSkinColor=t.getAttribute("tagskincolor")),t.getAttribute("description")&&(n.description=t.getAttribute("description")||void 0),n.fulltext=wo(n),e.push(n)}),e}},Sr={syncOptionsWithValues(s,e){const t=[...e];return s.forEach(n=>{n.value&&!n.label&&(n.label=n.value),n.selected&&!t.includes(n.value)&&t.push(n.value),n.fulltext=wo(n),n.selected=n.selected||t.includes(n.value)}),{options:s,newValues:t}},mergeWithUserAdded(s,e){return[...e.filter(t=>(t==null?void 0:t.userAdded)&&t.selected).filter(t=>!(Array.isArray(s)?s:[]).some(n=>n.value===t.value)),...s]}},wh={displayValueAs:{default:"label"}},$h={props:wh};var xh=Object.defineProperty,tt=(s,e,t,n)=>{for(var i=void 0,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=a(e,t,i)||i);return i&&xh(e,t,i),i};let Qe=class extends ie{constructor(){super(),this.value="",this.options=[],this.defaultOptions=[],this.allowUserInput=!1,this.typeahead=!1,this.includeSearch=!1,this.searchPlaceholder="",this.multiple=!1,this.maxlength=null,this.displayValueAs=$h.props.displayValueAs.default,this.tagPlacement=null,this.isOpen=!1,this._options=[],this._value=[],this._isOptionsOpen=!1,this._userInfoMessage="",this._addValueText=null,this._maxIsReached=!1,this._search="",this._inputFocus=!1,this._internalValueSync=!1,this._optionsFromSlot=!1,this._lastSlotGeneration=0,this._suppressNextOpen=!1,this.inputRef=_e(),this.triggerRef=_e(),this.listboxRef=_e(),this.optionsController=new So(this)}get _hasTextInput(){return this.typeahead||this.allowUserInput}get _selectionDescription(){if(!(!this.multiple||this._value.length===0))return`${this._value.length} valgt`}focusTrigger(){var e,t;this._hasTextInput?(e=this.inputRef.value)==null||e.focus():(t=this.triggerRef.value)==null||t.focus()}parseValue(){return Array.isArray(this.value)?this.multiple?this.value:this.value.length>0?[this.value[0]]:[]:this.value&&this.multiple?this.value.split(","):this.value?[this.value]:[]}updateMaxReached(){this._maxIsReached=Di(this._value.length,this.maxlength)}syncValueAndDispatch(e){const t=this._value,n=this.multiple?t.join(","):t[0]||"",i=Array.isArray(this.value)?this.value.join(","):String(this.value||"");if(n!==i&&(this._internalValueSync=!0,this.value=n),(e==null?void 0:e.join(","))!==t.join(",")){const r=this.multiple?[...t]:t[0]||"";this.onChange(r)}else t.length===0&&e&&e.length>0&&this.clearInputValue()}onChange(e){this.touched=!0,super.onChange(e)}valueChanged(){}};tt([u({type:String,reflect:!0})],Qe.prototype,"value"),tt([u({type:Array})],Qe.prototype,"options"),tt([u({type:Array,attribute:"default-options"})],Qe.prototype,"defaultOptions"),tt([u({type:Boolean,attribute:"allow-user-input"})],Qe.prototype,"allowUserInput"),tt([u({type:Boolean})],Qe.prototype,"typeahead"),tt([u({type:Boolean,attribute:"include-search"})],Qe.prototype,"includeSearch"),tt([u({type:String,attribute:"search-placeholder"})],Qe.prototype,"searchPlaceholder"),tt([u({type:Boolean})],Qe.prototype,"multiple"),tt([u({type:Number})],Qe.prototype,"maxlength"),tt([u({type:String,attribute:"display-value-as"})],Qe.prototype,"displayValueAs"),tt([u({type:String,attribute:"tag-placement"})],Qe.prototype,"tagPlacement"),tt([u({type:Boolean,attribute:"open"})],Qe.prototype,"isOpen"),tt([de()],Qe.prototype,"_options"),tt([de()],Qe.prototype,"_value"),tt([de()],Qe.prototype,"_isOptionsOpen"),tt([de()],Qe.prototype,"_userInfoMessage"),tt([de()],Qe.prototype,"_addValueText"),tt([de()],Qe.prototype,"_maxIsReached"),tt([de()],Qe.prototype,"_search"),tt([de()],Qe.prototype,"_inputFocus");class Ch extends Qe{toggleValue(e){var t,n;if(this.disabled)return;this.touched=!0,this._userInfoMessage="",this._addValueText=null;const i=((t=Rt(this.options,e))==null?void 0:t.value)||null,r=this._value.includes(e||i||""),a=!!i,l=((n=this._options.find(N=>N.value===e))==null?void 0:n.disabled)||!1,c=!(e!=null&&e.trim()),h=!this.multiple,g=this.multiple,m=Di(this._value.length,this.maxlength);let f=!1,k=!0,v="",$="";l||(!a&&this.allowUserInput&&!c?(this.addNewUserValue(e),v="Ny verdi lagt til",f=g):!a&&!this.allowUserInput?(h&&this._value[0]&&this.removeValue(this._value[0]),k=!1,f=!0,v="Ingen treff i søket"):r?(this.removeValue(i),f=!0,h&&this._hasTextInput&&this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(this.inputRef.value.value="")):c&&h?(this.removeAllSelected(),f=!0):h?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(i),f=!1):g&&!m?(this.setSelected(i),f=!0):g&&m?(v="Maks antall valg nådd",k=!1,$=e):(h&&this.removeAllSelected(),v="Ingen gyldig verdi valgt",k=!1,f=!0,$=e),this._isOptionsOpen=f,f||(h&&this._hasTextInput&&(this._suppressNextOpen=!0),window.setTimeout(()=>{this.focusTrigger()},0)),this._userInfoMessage=v,this._search=$||"",this.resetComboboxInput(k),g&&this.updateMaxReached())}setSelected(e){if(!this._value.includes(e)){if(this.multiple&&Di(this._value.length,this.maxlength)){this._userInfoMessage="Maks antall valg nådd";return}!this.multiple&&this.removeAllSelected(),this._value=e?[...this._value,e]:this._value,Kn.markOptionSelected(this._options,e),this.resetComboboxInput(!0)}}removeSelected(e){if(!e)return;this._value=this._value.filter(n=>n!==e);const t=Rt(this.options,e);t&&(Kn.markOptionDeselected(this.options,e),t.userAdded?(this._options=[...this._options.filter(n=>n.value!==e)],this.options=[...this.options.filter(n=>n.value!==e)]):this._options.some(n=>n.value===e)||(this._options=[...this._options,t]))}addAllOptions(){if(this.multiple){if(this.maxlength&&this._options.length>this.maxlength){this._userInfoMessage="For mange valgt";return}this._value=this._options.map(e=>e.value),Kn.markAllSelected(this._options),this.requestUpdate()}}removeAllSelected(){this._value=[],Kn.markAllDeselected(this._options),this._options=Kn.removeUserAddedOptions(this._options),this.requestUpdate()}addValue(){var e;const t=((e=this.inputRef.value)==null?void 0:e.value.trim())||"";if(this._search=t,t&&this._value.includes(t)){this.resetComboboxInput(!0),this._userInfoMessage="Verdien er allerede valgt";return}this.toggleValue(t)}removeValue(e){this._value=this.multiple?this._value.filter(t=>t!==e):[],this.removeSelected(e)}addNewUserValue(e){if(!e||e.trim()==="")return;if(!this.multiple)this._value[0]&&this.removeSelected(this._value[0]),this._value=[e];else if(!Rt(this.options,e)){if(Di(this._value.length,this.maxlength))return;this._value=[...this._value,e]}const t={value:e,label:e,userAdded:!0,selected:!0};this.options=[t,...this.options],this._options=[t,...this._options],this.resetComboboxInput(!0),this.multiple||(this._isOptionsOpen=!1,this._hasTextInput&&(this._suppressNextOpen=!0),window.setTimeout(()=>{this.focusTrigger()},0)),this.requestUpdate()}resetComboboxInput(e=!0){this._addValueText=null,this.inputRef.value&&this.inputRef.value.type!=="hidden"&&e&&(this._search="",this.multiple?this.inputRef.value.value="":(this.inputRef.value.value=this._value[0]?Ei(this._value[0],this.options,this.displayValueAs):"",this._userInfoMessage="")),this._options=[...this.options]}removeLastValue(e){if(this._value.length===0)return;e.preventDefault();const t=this._value[this._value.length-1];t&&this.removeSelected(t),this.updateMaxReached()}}class Sh extends Ch{handleInput(e){if(e.stopPropagation(),e.stopImmediatePropagation(),this.disabled)return;this.touched=!0;const t=e.target;if(this._search=t.value,this.checkForMatches(),this.typeahead)if(this._search){const{filtered:n,suggestion:i}=th(this.options,this._search);this._options=n,e.inputType!=="deleteContentBackward"&&i!=null&&i.label&&this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(t.value=i.label,window.setTimeout(()=>t.setSelectionRange(this._search.length,t.value.length),0),t.selectionDirection="backward")}else this._options=[...this.options]}handleFocus(){if(!this.disabled){if(this._suppressNextOpen){this._suppressNextOpen=!1,this._inputFocus=!0,this.requestUpdate();return}!this.multiple&&this._value[0]&&this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(this.inputRef.value.value=Ei(this._value[0],this.options,this.displayValueAs)),this._inputFocus=!0,this._search="",this._options=[...this.options],this._isOptionsOpen=!0,this.onFocus(),this.requestUpdate()}}handleFocusOut(e){var t,n;if(this.disabled||!this._isOptionsOpen)return;const i=e.relatedTarget;((t=i==null?void 0:i.closest("pkt-combobox"))==null?void 0:t.id)===this.id||((n=e.target)==null?void 0:n.getAttribute("data-focusfix"))===this.id||i===this.inputRef.value||i===this.triggerRef.value||this.closeAndProcessInput()}closeAndProcessInput(){if(this._inputFocus=!1,this._addValueText=null,this._userInfoMessage="",this._search="",this.inputRef.value&&this.inputRef.value.type!=="hidden"){const e=this.inputRef.value.value;if(this.multiple){if(e!==""){const{action:t,value:n}=yh(e,this._value,this.options,this.allowUserInput,this.multiple);switch(t){case"addUserValue":this.addNewUserValue(n);break;case"selectOption":this.setSelected(n);break;case"removeValue":this.removeValue(n);break}}}else if(!e)this._value[0]&&this.removeSelected(this._value[0]);else{const t=Rt(this.options,e);t&&t.value!==this._value[0]?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(t.value)):!t&&this.allowUserInput&&(this._value[0]&&this.removeSelected(this._value[0]),this.addNewUserValue(e))}!this.multiple&&this._value[0]?this.inputRef.value.value=Ei(this._value[0],this.options,this.displayValueAs):this.inputRef.value.value=""}this._isOptionsOpen=!1,this.onBlur()}handleBlur(){this._inputFocus=!1,this.onBlur()}handleInputClick(e){var t,n;if(this.disabled){e.preventDefault(),e.stopImmediatePropagation();return}this._hasTextInput?((t=this.inputRef.value)==null||t.focus(),this.requestUpdate()):(e.stopImmediatePropagation(),e.preventDefault(),this._isOptionsOpen=!this._isOptionsOpen,this._isOptionsOpen&&((n=this.listboxRef.value)==null||n.focusFirstOrSelectedOption()))}handlePlaceholderClick(e){this.disabled||(e.stopPropagation(),this._hasTextInput&&this.inputRef.value?(this.inputRef.value.focus(),this._inputFocus=!0,this.requestUpdate()):(this._isOptionsOpen=!this._isOptionsOpen,this.requestUpdate()))}handleSelectOnlyKeydown(e){var t,n;if(!this.disabled)switch(e.key){case"Enter":case" ":case"ArrowDown":case"ArrowUp":e.preventDefault(),this._isOptionsOpen?this._isOptionsOpen=!1:(this._isOptionsOpen=!0,(t=this.listboxRef.value)==null||t.focusFirstOrSelectedOption());break;case"Escape":this._isOptionsOpen&&(e.preventDefault(),this._isOptionsOpen=!1);break;case"Home":case"End":e.preventDefault(),this._isOptionsOpen||(this._isOptionsOpen=!0),(n=this.listboxRef.value)==null||n.focusFirstOrSelectedOption();break;case"ArrowLeft":this.multiple&&this._value.length>0&&(e.preventDefault(),this.focusTag(this._value.length-1));break;case"Backspace":case"Delete":this.multiple&&this._value.length>0&&(e.preventDefault(),this.removeSelected(this._value[this._value.length-1]));break}}handleOptionToggled(e){this.toggleValue(e.detail)}handleSearch(e){e.stopPropagation(),this._search=e.detail.toLowerCase(),this.checkForMatches()}handleInputKeydown(e){var t,n,i;if(e.key==="Backspace"){const a=!((t=this.inputRef.value)!=null&&t.value);!this._search&&a&&this.multiple&&this._value.length>0&&this.removeLastValue(e);return}if(e.key==="ArrowLeft"&&this.multiple&&this._value.length>0){const a=this.inputRef.value;if(a&&a.selectionStart===0&&!a.value){e.preventDefault(),this.focusTag(this._value.length-1);return}}const r=kh(e.key,e.shiftKey,this.multiple);if(r&&!(e.key==="Tab"&&!this._isOptionsOpen)){if(r==="focusListbox"&&e.key==="Tab"&&!((n=this.listboxRef.value)!=null&&n.querySelector('[role="option"]:not([data-disabled]), [data-type="new-option"]'))){this.closeAndProcessInput();return}switch(e.preventDefault(),r){case"addValue":this.addValue();break;case"focusListbox":(i=this.listboxRef.value)==null||i.focusFirstOrSelectedOption();break;case"closeOptions":this._isOptionsOpen=!1;break}}}handleTagRemove(e){this.removeSelected(e),this._hasTextInput&&this.inputRef.value&&(this._inputFocus=!0,this.inputRef.value.focus(),this.requestUpdate())}getInsideTags(){return Array.from(this.querySelectorAll(".pkt-combobox__input .pkt-combobox__tag-list pkt-tag"))}focusTag(e){var t;const n=this.getInsideTags();n.forEach((r,a)=>{r.buttonTabindex=a===e?0:-1});const i=(t=n[e])==null?void 0:t.querySelector("button");i==null||i.focus()}resetTagTabindices(){this.getInsideTags().forEach(e=>{e.buttonTabindex=-1})}handleTagKeydown(e,t){e.stopPropagation();const n=()=>{var i;this.resetTagTabindices(),this._hasTextInput&&this.inputRef.value?this.inputRef.value.focus():(i=this.triggerRef.value)==null||i.focus()};switch(e.key){case"ArrowLeft":e.preventDefault(),t>0&&this.focusTag(t-1);break;case"ArrowRight":e.preventDefault(),t<this._value.length-1?this.focusTag(t+1):n();break;case"Backspace":case"Delete":e.preventDefault();{const i=this._value[t],r=t>=this._value.length-1?t-1:t;this.removeSelected(i),r>=0?(this.requestUpdate(),this.updateComplete.then(()=>this.focusTag(r))):n()}break;case"Tab":this.resetTagTabindices();break;case"Escape":e.preventDefault(),n();break}}checkForMatches(){var e;const t=((e=this.inputRef.value)==null?void 0:e.value)||this._search||"",n=_h(t,this._value,this.options,this.allowUserInput,this.multiple);if(n.shouldRemoveValue&&this.removeValue(this._value[0]),n.shouldResetInput){this.resetComboboxInput(!1);return}this._addValueText=n.addValueText,this._userInfoMessage=n.userInfoMessage}}var Th=(s,e,t,n)=>{for(var i=e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=a(i)||i);return i};let No=class extends Sh{constructor(){super(...arguments),this.handleBodyClick=e=>{this._isOptionsOpen&&!this.contains(e.target)&&this.closeAndProcessInput()}}connectedCallback(){var e,t;if(super.connectedCallback(),document==null||document.body.addEventListener("click",this.handleBodyClick),this._options=[],this.defaultOptions&&this.defaultOptions.length){const n=((e=this.options)==null?void 0:e.filter(i=>i.userAdded))||[];this.options=[...n,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=Array.isArray(this.options)?[...this.options]:[]}if((t=this.optionsController)!=null&&t.nodes&&this.optionsController.nodes.length){const n=To.parseOptionsFromSlot(this.optionsController.nodes);n.length&&(this.options=[...n],this._options=[...n],this._optionsFromSlot=!0,this._lastSlotGeneration=this.optionsController.generation)}}willUpdate(e){if(this._optionsFromSlot&&this.optionsController){const t=this.optionsController.generation;if(t!==this._lastSlotGeneration){this._lastSlotGeneration=t;const n=To.parseOptionsFromSlot(this.optionsController.nodes),i=this._options.filter(r=>r.userAdded);this.options=[...i,...n]}}super.willUpdate(e)}disconnectedCallback(){super.disconnectedCallback(),document==null||document.body.removeEventListener("click",this.handleBodyClick)}firstUpdated(e){this.defaultValue!==null&&!this.value&&(this.value=this.defaultValue),super.firstUpdated(e)}updated(e){e.has("isOpen")&&(this._isOptionsOpen=this.isOpen);const t=e.has("value"),n=e.has("_value");if(t&&this._internalValueSync)this._internalValueSync=!1,n&&this.syncValueAndDispatch(e.get("_value"));else if(t){const i=[...this._value],r=this.parseValue();r.join(",")!==this._value.join(",")&&(this._value=r),this.updateMaxReached(),this.syncValueAndDispatch(i)}else n&&this.syncValueAndDispatch(e.get("_value"));if(e.has("defaultOptions")&&this.defaultOptions.length){const i=(Array.isArray(this.options)?this.options:[]).filter(r=>r.userAdded)||[];this.options=[...i,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=Array.isArray(this.options)?[...this.options]:[]}if(e.has("options")){const i=e.get("options")||this._options||[],r=Sr.mergeWithUserAdded(this.options,i);this._options=r,r.length>this.options.length&&(this.options=r);const a=Sr.syncOptionsWithValues(this._options,this._value);if(this._options=a.options,a.newValues.length>this._value.length){const l=[...this._value];this._value=a.newValues,this.syncValueAndDispatch(l)}}if(e.has("_search")&&this.dispatchEvent(new CustomEvent("search",{detail:this._search,bubbles:!1})),!this._isOptionsOpen&&!this.multiple&&this._hasTextInput&&this.inputRef.value&&this.inputRef.value.type!=="hidden"){const i=this._value[0]?Ei(this._value[0],this.options,this.displayValueAs):"";this.inputRef.value.value!==i&&(this.inputRef.value.value=i)}super.updated(e)}formResetCallback(){this.touched=!1;const e=this.defaultValue||(this.multiple,"");this.value=e,this._value=this.parseValue(),this._options=this._options.filter(t=>!t.userAdded).map(t=>({...t,selected:this._value.includes(t.value)})),this.options=this.options.filter(t=>!t.userAdded).map(t=>({...t,selected:this._value.includes(t.value)})),this._search="",this._isOptionsOpen=!1,this._userInfoMessage="",this._addValueText=null,this._inputFocus=!1,this.updateMaxReached(),this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(this.inputRef.value.value=""),this.internals.setFormValue(""),this.internals.ariaInvalid="false",this.requestUpdate()}attributeChangedCallback(e,t,n){if(e==="options"){this._options=Array.isArray(this.options)?[...this.options]:[];const i=Sr.syncOptionsWithValues(this._options,this._value);this._options=i.options,i.newValues.length>this._value.length&&(this._value=i.newValues),this._search=""}super.attributeChangedCallback(e,t,n)}render(){return y`
|
|
633
|
+
</fieldset>`:y`<div class="pkt-inputwrapper__fieldset">${h()}</div>`;return y`<div class=${X(e)}>${m()}</div> `}toggleDropdown(e){this.dispatchEvent(new CustomEvent("toggleHelpText",{bubbles:!1,detail:{isOpen:e.detail.isOpen}}))}handleLabelClick(){this.dispatchEvent(new CustomEvent("labelClick",{bubbles:!0,composed:!0,detail:"label clicked"}))}};qe([u({type:String})],Ve.prototype,"forId",2),qe([u({type:String})],Ve.prototype,"label",2),qe([u({type:String})],Ve.prototype,"helptext",2),qe([u({type:String})],Ve.prototype,"helptextDropdown",2),qe([u({type:String})],Ve.prototype,"helptextDropdownButton",2),qe([u({type:Boolean})],Ve.prototype,"counter",2),qe([u({type:Number})],Ve.prototype,"counterCurrent",2),qe([u({type:Number})],Ve.prototype,"counterMaxLength",2),qe([u({type:String})],Ve.prototype,"counterError",2),qe([u({type:String,reflect:!1})],Ve.prototype,"counterPosition",2),qe([u({type:Boolean})],Ve.prototype,"optionalTag",2),qe([u({type:String})],Ve.prototype,"optionalText",2),qe([u({type:Boolean})],Ve.prototype,"requiredTag",2),qe([u({type:String})],Ve.prototype,"requiredText",2),qe([u({type:String})],Ve.prototype,"tagText",2),qe([u({type:Boolean})],Ve.prototype,"hasError",2),qe([u({type:String})],Ve.prototype,"errorMessage",2),qe([u({type:Boolean})],Ve.prototype,"disabled",2),qe([u({type:Boolean})],Ve.prototype,"inline",2),qe([u({type:String})],Ve.prototype,"ariaDescribedby",2),qe([u({type:Boolean})],Ve.prototype,"hasFieldset",2),qe([u({type:String,reflect:!0})],Ve.prototype,"role",2),qe([u({type:Boolean,reflect:!0,converter:xt})],Ve.prototype,"useWrapper",2),Ve=qe([fe("pkt-input-wrapper")],Ve);const yh=(s,e,t)=>{switch(s){case",":return t?"addValue":null;case"Enter":return"addValue";case"Tab":case"ArrowDown":return e?null:"focusListbox";case"Escape":return"closeOptions";default:return null}},_h=(s,e,t,n,i)=>{if(!s)return{action:"none",value:null};const r=Rt(t,s);return!e.includes(s)&&!r?n?{action:"addUserValue",value:s}:i?{action:"none",value:null}:{action:"removeValue",value:e[0]}:r&&!e.includes(r.value)?{action:"selectOption",value:r.value}:{action:"none",value:null}},wh=(s,e,t,n,i)=>s.trim().toLowerCase()?{...nh(s,e,t,n),shouldRemoveValue:!1,shouldResetInput:!1}:{addValueText:null,userInfoMessage:"",shouldRemoveValue:!i&&!!e[0],shouldResetInput:!0},Ei=(s,e,t)=>{const n=Rt(e,s);return t==="label"&&n!=null&&n.label?n.label:s},Kn={markOptionSelected(s,e){if(e){for(const t of s)if(t.value===e){t.selected=!0;break}}},markOptionDeselected(s,e){if(e){for(const t of s)if(t.value===e){t.selected=!1;break}}},markAllSelected(s){for(const e of s)e.selected=!0},markAllDeselected(s){for(const e of s)e.selected=!1},removeUserAddedOptions(s){return s.filter(e=>!e.userAdded)}},To={parseOptionsFromSlot(s){const e=[];return s.forEach(t=>{if(!t.textContent&&!t.getAttribute("value"))return;const n={value:t.getAttribute("value")||t.textContent||"",label:t.textContent||t.getAttribute("value")||""};t.getAttribute("data-prefix")&&(n.prefix=t.getAttribute("data-prefix")||void 0),t.getAttribute("tagskincolor")&&(n.tagSkinColor=t.getAttribute("tagskincolor")),t.getAttribute("description")&&(n.description=t.getAttribute("description")||void 0),n.fulltext=wo(n),e.push(n)}),e}},Sr={syncOptionsWithValues(s,e){const t=[...e];return s.forEach(n=>{n.value&&!n.label&&(n.label=n.value),n.selected&&!t.includes(n.value)&&t.push(n.value),n.fulltext=wo(n),n.selected=n.selected||t.includes(n.value)}),{options:s,newValues:t}},mergeWithUserAdded(s,e){return[...e.filter(t=>(t==null?void 0:t.userAdded)&&t.selected).filter(t=>!(Array.isArray(s)?s:[]).some(n=>n.value===t.value)),...s]}},$h={displayValueAs:{default:"label"}},xh={props:$h};var Ch=Object.defineProperty,et=(s,e,t,n)=>{for(var i=void 0,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=a(e,t,i)||i);return i&&Ch(e,t,i),i};let Qe=class extends ie{constructor(){super(),this.value="",this.options=[],this.defaultOptions=[],this.allowUserInput=!1,this.typeahead=!1,this.includeSearch=!1,this.searchPlaceholder="",this.multiple=!1,this.maxlength=null,this.displayValueAs=xh.props.displayValueAs.default,this.tagPlacement=null,this.isOpen=!1,this._options=[],this._value=[],this._isOptionsOpen=!1,this._userInfoMessage="",this._addValueText=null,this._maxIsReached=!1,this._search="",this._inputFocus=!1,this._internalValueSync=!1,this._optionsFromSlot=!1,this._lastSlotGeneration=0,this._suppressNextOpen=!1,this.inputRef=_e(),this.triggerRef=_e(),this.listboxRef=_e(),this.optionsController=new So(this)}get _hasTextInput(){return this.typeahead||this.allowUserInput}get _selectionDescription(){if(!(!this.multiple||this._value.length===0))return`${this._value.length} valgt`}focusTrigger(){var e,t;this._hasTextInput?(e=this.inputRef.value)==null||e.focus():(t=this.triggerRef.value)==null||t.focus()}parseValue(){return Array.isArray(this.value)?this.multiple?this.value:this.value.length>0?[this.value[0]]:[]:this.value&&this.multiple?this.value.split(","):this.value?[this.value]:[]}updateMaxReached(){this._maxIsReached=Di(this._value.length,this.maxlength)}syncValueAndDispatch(e){const t=this._value,n=this.multiple?t.join(","):t[0]||"",i=Array.isArray(this.value)?this.value.join(","):String(this.value||"");if(n!==i&&(this._internalValueSync=!0,this.value=n),(e==null?void 0:e.join(","))!==t.join(",")){const r=this.multiple?[...t]:t[0]||"";this.onChange(r)}else t.length===0&&e&&e.length>0&&this.clearInputValue()}onChange(e){this.touched=!0,super.onChange(e)}valueChanged(){}};et([u({type:String,reflect:!0})],Qe.prototype,"value"),et([u({type:Array})],Qe.prototype,"options"),et([u({type:Array,attribute:"default-options"})],Qe.prototype,"defaultOptions"),et([u({type:Boolean,attribute:"allow-user-input"})],Qe.prototype,"allowUserInput"),et([u({type:Boolean})],Qe.prototype,"typeahead"),et([u({type:Boolean,attribute:"include-search"})],Qe.prototype,"includeSearch"),et([u({type:String,attribute:"search-placeholder"})],Qe.prototype,"searchPlaceholder"),et([u({type:Boolean})],Qe.prototype,"multiple"),et([u({type:Number})],Qe.prototype,"maxlength"),et([u({type:String,attribute:"display-value-as"})],Qe.prototype,"displayValueAs"),et([u({type:String,attribute:"tag-placement"})],Qe.prototype,"tagPlacement"),et([u({type:Boolean,attribute:"open"})],Qe.prototype,"isOpen"),et([he()],Qe.prototype,"_options"),et([he()],Qe.prototype,"_value"),et([he()],Qe.prototype,"_isOptionsOpen"),et([he()],Qe.prototype,"_userInfoMessage"),et([he()],Qe.prototype,"_addValueText"),et([he()],Qe.prototype,"_maxIsReached"),et([he()],Qe.prototype,"_search"),et([he()],Qe.prototype,"_inputFocus");class Sh extends Qe{toggleValue(e){var t,n;if(this.disabled)return;this.touched=!0,this._userInfoMessage="",this._addValueText=null;const i=((t=Rt(this.options,e))==null?void 0:t.value)||null,r=this._value.includes(e||i||""),a=!!i,l=((n=this._options.find(N=>N.value===e))==null?void 0:n.disabled)||!1,c=!(e!=null&&e.trim()),h=!this.multiple,m=this.multiple,g=Di(this._value.length,this.maxlength);let f=!1,k=!0,v="",$="";l||(!a&&this.allowUserInput&&!c?(this.addNewUserValue(e),v="Ny verdi lagt til",f=m):!a&&!this.allowUserInput?(h&&this._value[0]&&this.removeValue(this._value[0]),k=!1,f=!0,v="Ingen treff i søket"):r?(this.removeValue(i),f=!0,h&&this._hasTextInput&&this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(this.inputRef.value.value="")):c&&h?(this.removeAllSelected(),f=!0):h?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(i),f=!1):m&&!g?(this.setSelected(i),f=!0):m&&g?(v="Maks antall valg nådd",k=!1,$=e):(h&&this.removeAllSelected(),v="Ingen gyldig verdi valgt",k=!1,f=!0,$=e),this._isOptionsOpen=f,f||(h&&this._hasTextInput&&(this._suppressNextOpen=!0),window.setTimeout(()=>{this.focusTrigger()},0)),this._userInfoMessage=v,this._search=$||"",this.resetComboboxInput(k),m&&this.updateMaxReached())}setSelected(e){if(!this._value.includes(e)){if(this.multiple&&Di(this._value.length,this.maxlength)){this._userInfoMessage="Maks antall valg nådd";return}!this.multiple&&this.removeAllSelected(),this._value=e?[...this._value,e]:this._value,Kn.markOptionSelected(this._options,e),this.resetComboboxInput(!0)}}removeSelected(e){if(!e)return;this._value=this._value.filter(n=>n!==e);const t=Rt(this.options,e);t&&(Kn.markOptionDeselected(this.options,e),t.userAdded?(this._options=[...this._options.filter(n=>n.value!==e)],this.options=[...this.options.filter(n=>n.value!==e)]):this._options.some(n=>n.value===e)||(this._options=[...this._options,t]))}addAllOptions(){if(this.multiple){if(this.maxlength&&this._options.length>this.maxlength){this._userInfoMessage="For mange valgt";return}this._value=this._options.map(e=>e.value),Kn.markAllSelected(this._options),this.requestUpdate()}}removeAllSelected(){this._value=[],Kn.markAllDeselected(this._options),this._options=Kn.removeUserAddedOptions(this._options),this.requestUpdate()}addValue(){var e;const t=((e=this.inputRef.value)==null?void 0:e.value.trim())||"";if(this._search=t,t&&this._value.includes(t)){this.resetComboboxInput(!0),this._userInfoMessage="Verdien er allerede valgt";return}this.toggleValue(t)}removeValue(e){this._value=this.multiple?this._value.filter(t=>t!==e):[],this.removeSelected(e)}addNewUserValue(e){if(!e||e.trim()==="")return;if(!this.multiple)this._value[0]&&this.removeSelected(this._value[0]),this._value=[e];else if(!Rt(this.options,e)){if(Di(this._value.length,this.maxlength))return;this._value=[...this._value,e]}const t={value:e,label:e,userAdded:!0,selected:!0};this.options=[t,...this.options],this._options=[t,...this._options],this.resetComboboxInput(!0),this.multiple||(this._isOptionsOpen=!1,this._hasTextInput&&(this._suppressNextOpen=!0),window.setTimeout(()=>{this.focusTrigger()},0)),this.requestUpdate()}resetComboboxInput(e=!0){this._addValueText=null,this.inputRef.value&&this.inputRef.value.type!=="hidden"&&e&&(this._search="",this.multiple?this.inputRef.value.value="":(this.inputRef.value.value=this._value[0]?Ei(this._value[0],this.options,this.displayValueAs):"",this._userInfoMessage="")),this._options=[...this.options]}removeLastValue(e){if(this._value.length===0)return;e.preventDefault();const t=this._value[this._value.length-1];t&&this.removeSelected(t),this.updateMaxReached()}}class Th extends Sh{handleInput(e){if(e.stopPropagation(),e.stopImmediatePropagation(),this.disabled)return;this.touched=!0;const t=e.target;if(this._search=t.value,this.checkForMatches(),this.typeahead)if(this._search){const{filtered:n,suggestion:i}=sh(this.options,this._search);this._options=n,e.inputType!=="deleteContentBackward"&&i!=null&&i.label&&this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(t.value=i.label,window.setTimeout(()=>t.setSelectionRange(this._search.length,t.value.length),0),t.selectionDirection="backward")}else this._options=[...this.options]}handleFocus(){if(!this.disabled){if(this._suppressNextOpen){this._suppressNextOpen=!1,this._inputFocus=!0,this.requestUpdate();return}!this.multiple&&this._value[0]&&this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(this.inputRef.value.value=Ei(this._value[0],this.options,this.displayValueAs)),this._inputFocus=!0,this._search="",this._options=[...this.options],this._isOptionsOpen=!0,this.onFocus(),this.requestUpdate()}}handleFocusOut(e){var t,n;if(this.disabled||!this._isOptionsOpen)return;const i=e.relatedTarget;((t=i==null?void 0:i.closest("pkt-combobox"))==null?void 0:t.id)===this.id||((n=e.target)==null?void 0:n.getAttribute("data-focusfix"))===this.id||i===this.inputRef.value||i===this.triggerRef.value||this.closeAndProcessInput()}closeAndProcessInput(){if(this._inputFocus=!1,this._addValueText=null,this._userInfoMessage="",this._search="",this.inputRef.value&&this.inputRef.value.type!=="hidden"){const e=this.inputRef.value.value;if(this.multiple){if(e!==""){const{action:t,value:n}=_h(e,this._value,this.options,this.allowUserInput,this.multiple);switch(t){case"addUserValue":this.addNewUserValue(n);break;case"selectOption":this.setSelected(n);break;case"removeValue":this.removeValue(n);break}}}else if(!e)this._value[0]&&this.removeSelected(this._value[0]);else{const t=Rt(this.options,e);t&&t.value!==this._value[0]?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(t.value)):!t&&this.allowUserInput&&(this._value[0]&&this.removeSelected(this._value[0]),this.addNewUserValue(e))}!this.multiple&&this._value[0]?this.inputRef.value.value=Ei(this._value[0],this.options,this.displayValueAs):this.inputRef.value.value=""}this._isOptionsOpen=!1,this.onBlur()}handleBlur(){this._inputFocus=!1,this.onBlur()}handleInputClick(e){var t,n;if(this.disabled){e.preventDefault(),e.stopImmediatePropagation();return}this._hasTextInput?((t=this.inputRef.value)==null||t.focus(),this.requestUpdate()):(e.stopImmediatePropagation(),e.preventDefault(),this._isOptionsOpen=!this._isOptionsOpen,this._isOptionsOpen&&((n=this.listboxRef.value)==null||n.focusFirstOrSelectedOption()))}handlePlaceholderClick(e){this.disabled||(e.stopPropagation(),this._hasTextInput&&this.inputRef.value?(this.inputRef.value.focus(),this._inputFocus=!0,this.requestUpdate()):(this._isOptionsOpen=!this._isOptionsOpen,this.requestUpdate()))}handleSelectOnlyKeydown(e){var t,n;if(!this.disabled)switch(e.key){case"Enter":case" ":case"ArrowDown":case"ArrowUp":e.preventDefault(),this._isOptionsOpen?this._isOptionsOpen=!1:(this._isOptionsOpen=!0,(t=this.listboxRef.value)==null||t.focusFirstOrSelectedOption());break;case"Escape":this._isOptionsOpen&&(e.preventDefault(),this._isOptionsOpen=!1);break;case"Home":case"End":e.preventDefault(),this._isOptionsOpen||(this._isOptionsOpen=!0),(n=this.listboxRef.value)==null||n.focusFirstOrSelectedOption();break;case"ArrowLeft":this.multiple&&this._value.length>0&&(e.preventDefault(),this.focusTag(this._value.length-1));break;case"Backspace":case"Delete":this.multiple&&this._value.length>0&&(e.preventDefault(),this.removeSelected(this._value[this._value.length-1]));break}}handleOptionToggled(e){this.toggleValue(e.detail)}handleSearch(e){e.stopPropagation(),this._search=e.detail.toLowerCase(),this.checkForMatches()}handleInputKeydown(e){var t,n,i;if(e.key==="Backspace"){const a=!((t=this.inputRef.value)!=null&&t.value);!this._search&&a&&this.multiple&&this._value.length>0&&this.removeLastValue(e);return}if(e.key==="ArrowLeft"&&this.multiple&&this._value.length>0){const a=this.inputRef.value;if(a&&a.selectionStart===0&&!a.value){e.preventDefault(),this.focusTag(this._value.length-1);return}}const r=yh(e.key,e.shiftKey,this.multiple);if(r&&!(e.key==="Tab"&&!this._isOptionsOpen)){if(r==="focusListbox"&&e.key==="Tab"&&!((n=this.listboxRef.value)!=null&&n.querySelector('[role="option"]:not([data-disabled]), [data-type="new-option"]'))){this.closeAndProcessInput();return}switch(e.preventDefault(),r){case"addValue":this.addValue();break;case"focusListbox":(i=this.listboxRef.value)==null||i.focusFirstOrSelectedOption();break;case"closeOptions":this._isOptionsOpen=!1;break}}}handleTagRemove(e){this.removeSelected(e),this._hasTextInput&&this.inputRef.value&&(this._inputFocus=!0,this.inputRef.value.focus(),this.requestUpdate())}getInsideTags(){return Array.from(this.querySelectorAll(".pkt-combobox__input .pkt-combobox__tag-list pkt-tag"))}focusTag(e){var t;const n=this.getInsideTags();n.forEach((r,a)=>{r.buttonTabindex=a===e?0:-1});const i=(t=n[e])==null?void 0:t.querySelector("button");i==null||i.focus()}resetTagTabindices(){this.getInsideTags().forEach(e=>{e.buttonTabindex=-1})}handleTagKeydown(e,t){e.stopPropagation();const n=()=>{var i;this.resetTagTabindices(),this._hasTextInput&&this.inputRef.value?this.inputRef.value.focus():(i=this.triggerRef.value)==null||i.focus()};switch(e.key){case"ArrowLeft":e.preventDefault(),t>0&&this.focusTag(t-1);break;case"ArrowRight":e.preventDefault(),t<this._value.length-1?this.focusTag(t+1):n();break;case"Backspace":case"Delete":e.preventDefault();{const i=this._value[t],r=t>=this._value.length-1?t-1:t;this.removeSelected(i),r>=0?(this.requestUpdate(),this.updateComplete.then(()=>this.focusTag(r))):n()}break;case"Tab":this.resetTagTabindices();break;case"Escape":e.preventDefault(),n();break}}checkForMatches(){var e;const t=((e=this.inputRef.value)==null?void 0:e.value)||this._search||"",n=wh(t,this._value,this.options,this.allowUserInput,this.multiple);if(n.shouldRemoveValue&&this.removeValue(this._value[0]),n.shouldResetInput){this.resetComboboxInput(!1);return}this._addValueText=n.addValueText,this._userInfoMessage=n.userInfoMessage}}var Nh=(s,e,t,n)=>{for(var i=e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=a(i)||i);return i};let No=class extends Th{constructor(){super(...arguments),this.handleBodyClick=e=>{this._isOptionsOpen&&!this.contains(e.target)&&this.closeAndProcessInput()}}connectedCallback(){var e,t;if(super.connectedCallback(),document==null||document.body.addEventListener("click",this.handleBodyClick),this._options=[],this.defaultOptions&&this.defaultOptions.length){const n=((e=this.options)==null?void 0:e.filter(i=>i.userAdded))||[];this.options=[...n,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=Array.isArray(this.options)?[...this.options]:[]}if((t=this.optionsController)!=null&&t.nodes&&this.optionsController.nodes.length){const n=To.parseOptionsFromSlot(this.optionsController.nodes);n.length&&(this.options=[...n],this._options=[...n],this._optionsFromSlot=!0,this._lastSlotGeneration=this.optionsController.generation)}}willUpdate(e){if(this._optionsFromSlot&&this.optionsController){const t=this.optionsController.generation;if(t!==this._lastSlotGeneration){this._lastSlotGeneration=t;const n=To.parseOptionsFromSlot(this.optionsController.nodes),i=this._options.filter(r=>r.userAdded);this.options=[...i,...n]}}super.willUpdate(e)}disconnectedCallback(){super.disconnectedCallback(),document==null||document.body.removeEventListener("click",this.handleBodyClick)}firstUpdated(e){this.defaultValue!==null&&!this.value&&(this.value=this.defaultValue),super.firstUpdated(e)}updated(e){e.has("isOpen")&&(this._isOptionsOpen=this.isOpen);const t=e.has("value"),n=e.has("_value");if(t&&this._internalValueSync)this._internalValueSync=!1,n&&this.syncValueAndDispatch(e.get("_value"));else if(t){const i=[...this._value],r=this.parseValue();r.join(",")!==this._value.join(",")&&(this._value=r),this.updateMaxReached(),this.syncValueAndDispatch(i)}else n&&this.syncValueAndDispatch(e.get("_value"));if(e.has("defaultOptions")&&this.defaultOptions.length){const i=(Array.isArray(this.options)?this.options:[]).filter(r=>r.userAdded)||[];this.options=[...i,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=Array.isArray(this.options)?[...this.options]:[]}if(e.has("options")){const i=e.get("options")||this._options||[],r=Sr.mergeWithUserAdded(this.options,i);this._options=r,r.length>this.options.length&&(this.options=r);const a=Sr.syncOptionsWithValues(this._options,this._value);if(this._options=a.options,a.newValues.length>this._value.length){const l=[...this._value];this._value=a.newValues,this.syncValueAndDispatch(l)}}if(e.has("_search")&&this.dispatchEvent(new CustomEvent("search",{detail:this._search,bubbles:!1})),!this._isOptionsOpen&&!this.multiple&&this._hasTextInput&&this.inputRef.value&&this.inputRef.value.type!=="hidden"){const i=this._value[0]?Ei(this._value[0],this.options,this.displayValueAs):"";this.inputRef.value.value!==i&&(this.inputRef.value.value=i)}super.updated(e)}formResetCallback(){this.touched=!1;const e=this.defaultValue||(this.multiple,"");this.value=e,this._value=this.parseValue(),this._options=this._options.filter(t=>!t.userAdded).map(t=>({...t,selected:this._value.includes(t.value)})),this.options=this.options.filter(t=>!t.userAdded).map(t=>({...t,selected:this._value.includes(t.value)})),this._search="",this._isOptionsOpen=!1,this._userInfoMessage="",this._addValueText=null,this._inputFocus=!1,this.updateMaxReached(),this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(this.inputRef.value.value=""),this.internals.setFormValue(""),this.internals.ariaInvalid="false",this.requestUpdate()}attributeChangedCallback(e,t,n){if(e==="options"){this._options=Array.isArray(this.options)?[...this.options]:[];const i=Sr.syncOptionsWithValues(this._options,this._value);this._options=i.options,i.newValues.length>this._value.length&&(this._value=i.newValues),this._search=""}super.attributeChangedCallback(e,t,n)}render(){return y`
|
|
634
634
|
<pkt-input-wrapper
|
|
635
635
|
.label=${this.label}
|
|
636
636
|
.helptext=${this.helptext}
|
|
@@ -655,7 +655,7 @@
|
|
|
655
655
|
<div class="pkt-contents" slot="helptext">${ze(this,"helptext")}</div>
|
|
656
656
|
<div class="pkt-combobox" @focusout=${this.handleFocusOut}>
|
|
657
657
|
<div
|
|
658
|
-
class=${
|
|
658
|
+
class=${X({"pkt-combobox__input":!0,"pkt-combobox__input--fullwidth":this.fullwidth,"pkt-combobox__input--open":this._isOptionsOpen,"pkt-combobox__input--error":this.hasError,"pkt-combobox__input--disabled":this.disabled})}
|
|
659
659
|
id=${I(this._hasTextInput?void 0:`${this.id}-combobox`)}
|
|
660
660
|
role=${I(this._hasTextInput?void 0:"combobox")}
|
|
661
661
|
aria-expanded=${I(this._hasTextInput?void 0:this._isOptionsOpen?"true":"false")}
|
|
@@ -674,7 +674,7 @@
|
|
|
674
674
|
>`:this.tagPlacement!=="outside"?this.renderSingleOrMultipleValues():C}
|
|
675
675
|
${this.renderInputField()}
|
|
676
676
|
<pkt-icon
|
|
677
|
-
class=${
|
|
677
|
+
class=${X({"pkt-combobox__arrow-icon":!0,"pkt-combobox__arrow-icon--open":this._isOptionsOpen})}
|
|
678
678
|
name="chevron-thin-down"
|
|
679
679
|
aria-hidden="true"
|
|
680
680
|
></pkt-icon>
|
|
@@ -764,7 +764,7 @@
|
|
|
764
764
|
>${e.value}</span
|
|
765
765
|
>`;case"label":default:return y`<span class="pkt-combobox__value" data-focusfix=${this.id}
|
|
766
766
|
>${e.label||e.value}</span
|
|
767
|
-
>`}}};No=
|
|
767
|
+
>`}}};No=Nh([fe("pkt-combobox")],No);const Mh={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"}}}}};var Dh=Object.defineProperty,Oh=Object.getOwnPropertyDescriptor,es=(s,e,t,n)=>{for(var i=n>1?void 0:n?Oh(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Dh(e,t,i),i};let Tr=null;function Eh(){return Tr||(Tr=new Promise((s,e)=>{if(document.querySelector("#oslo-consent-script")){s();return}const t=document.createElement("script");t.src="https://cdn.web.oslo.kommune.no/cb/cb-v1.1.0.js",t.id="oslo-consent-script",t.onload=()=>s(),t.onerror=e,document.head.appendChild(t);const n=document.createElement("link");n.href="https://cdn.web.oslo.kommune.no/cb/cb-v1.1.0.css",n.type="text/css",n.rel="stylesheet",n.id="oslo-consent-styles",document.head.appendChild(n)}),Tr)}let Ft=class extends At{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||Mh.i18n[this.i18nLanguage].contentPresentation.buttons.settings}disconnectedCallback(){var e;super.disconnectedCallback(),this._cookieEventHandler&&((e=window.__cookieEvents)==null||e.off("CookieManager.setCookie",this._cookieEventHandler))}returnJsonOrObject(e){let t;try{t=JSON.parse(e)}catch{t=e}return t}emitCookieConsents(e){const t=this.returnJsonOrObject(e.value).items.reduce((n,i)=>(n[i.name]=i.consent,n),{});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 Eh(),this.triggerInit()}triggerInit(){window.document.dispatchEvent(new Event("CookieBannerReady",{bubbles:!0,cancelable:!0})),window.cookieBanner.cookieConsent.validateConsentCookie().then(e=>{if(e){const t={value:window.cookieBanner.cookieConsent.getConsentCookie()};window.setTimeout(()=>this.emitCookieConsents(t),0),this._cookieEventHandler&&window.__cookieEvents.off("CookieManager.setCookie",this._cookieEventHandler),this._cookieEventHandler=n=>{this.emitCookieConsents(n)},window.__cookieEvents.on("CookieManager.setCookie",this._cookieEventHandler)}})}openModal(e){var t;e.preventDefault(),(t=window.cookieBanner)!=null&&t.cookieConsent||this.triggerInit(),setTimeout(()=>window.cookieBanner.openCookieModal())}render(){return this.triggerType==="link"?y`<a href="#" class="pkt-link" @click=${this.openModal}>${this.triggerText}</a>`:this.triggerType==="footerlink"?y`<a href="#" class="pkt-footer__link" @click=${this.openModal}>
|
|
768
768
|
<pkt-icon name="chevron-right" class="pkt-footer__link-icon"></pkt-icon>
|
|
769
769
|
${this.triggerText}
|
|
770
770
|
</a>`:this.triggerType==="icon"?y`<pkt-button
|
|
@@ -774,7 +774,7 @@
|
|
|
774
774
|
@click=${this.openModal}
|
|
775
775
|
>
|
|
776
776
|
>${this.triggerText}</pkt-button
|
|
777
|
-
>`:y`<pkt-button @click=${this.openModal}>${this.triggerText}</pkt-button>`}};es([u({type:Boolean})],Ft.prototype,"devMode",2),es([u({type:String})],Ft.prototype,"hotjarId",2),es([u({type:String})],Ft.prototype,"googleAnalyticsId",2),es([u({type:String})],Ft.prototype,"cookieDomain",2),es([u({type:String})],Ft.prototype,"cookieSecure",2),es([u({type:String})],Ft.prototype,"cookieExpiryDays",2),es([u({type:String})],Ft.prototype,"triggerType",2),es([u({type:String})],Ft.prototype,"triggerText",2),es([u({type:String})],Ft.prototype,"i18nLanguage",2),Ft=es([
|
|
777
|
+
>`:y`<pkt-button @click=${this.openModal}>${this.triggerText}</pkt-button>`}};es([u({type:Boolean})],Ft.prototype,"devMode",2),es([u({type:String})],Ft.prototype,"hotjarId",2),es([u({type:String})],Ft.prototype,"googleAnalyticsId",2),es([u({type:String})],Ft.prototype,"cookieDomain",2),es([u({type:String})],Ft.prototype,"cookieSecure",2),es([u({type:String})],Ft.prototype,"cookieExpiryDays",2),es([u({type:String})],Ft.prototype,"triggerType",2),es([u({type:String})],Ft.prototype,"triggerText",2),es([u({type:String})],Ft.prototype,"i18nLanguage",2),Ft=es([fe("pkt-consent")],Ft);var Ph=Object.defineProperty,Ah=Object.getOwnPropertyDescriptor,kt=(s,e,t,n)=>{for(var i=n>1?void 0:n?Ah(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Ph(e,t,i),i};let mt=class extends ie{constructor(){super(...arguments),this.inputRef=_e(),this.value="",this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.isSwitch=!1,this.labelPosition="right",this.hideLabel=!1,this.checked=null,this.indeterminate=!1,this.type="checkbox",this.tagText=null,this.optionalTag=!1,this.optionalText="Valgfritt",this.requiredTag=!1,this.requiredText="Må fylles ut"}connectedCallback(){super.connectedCallback()}attributeChangedCallback(e,t,n){e==="defaultChecked"&&!this.checked&&(this.checked=this.defaultChecked),e==="checked"&&(this.checked=this.checked===""||this.checked==="true"||this.checked===!0,this.inputRef.value&&(this.inputRef.value.checked=this.checked)),e==="indeterminate"&&(this.indeterminate=this.indeterminate===""||this.indeterminate==="true"||this.indeterminate===!0,this.inputRef.value&&(this.inputRef.value.indeterminate=this.indeterminate)),super.attributeChangedCallback(e,t,n)}firstUpdated(e){e.has("defaultChecked")&&!this.checked&&(this.checked=this.defaultChecked),this.inputRef.value&&(this.inputRef.value.indeterminate=this.indeterminate===""||this.indeterminate==="true"||this.indeterminate===!0),super.firstUpdated(e)}updated(e){e.has("defaultChecked")&&!this.checked&&(this.checked=this.defaultChecked),e.has("checked")&&this.inputRef.value&&(this.inputRef.value.checked=this.checked===""||this.checked==="true"||this.checked===!0),e.has("indeterminate")&&this.inputRef.value&&(this.inputRef.value.indeterminate=this.indeterminate===""||this.indeterminate==="true"||this.indeterminate===!0),super.updated(e)}render(){const e=X({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),t=X({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError}),n=X({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--disabled":this.disabled,"pkt-input-check__input-label--left":this.labelPosition==="left","pkt-input-check__input-label--right":this.labelPosition==="right","pkt-sr-only":this.hideLabel}),i="pkt-tag pkt-tag--small pkt-tag--thin-text",r=()=>y`
|
|
778
778
|
${this.tagText?y`<span class=${i+" pkt-tag--gray"}>${this.tagText}</span>`:C}
|
|
779
779
|
${this.optionalTag?y`<span class=${i+" pkt-tag--blue-light"}>${this.optionalText}</span>`:C}
|
|
780
780
|
${this.requiredTag?y`<span class=${i+" pkt-tag--beige"}>${this.requiredText}</span>`:C}
|
|
@@ -804,8 +804,8 @@
|
|
|
804
804
|
${this.labelPosition==="right"?a():C}
|
|
805
805
|
</div>
|
|
806
806
|
</div>
|
|
807
|
-
`}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}const 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))}};kt([u({type:String,reflect:!0})],mt.prototype,"value",2),kt([u({type:String})],mt.prototype,"checkHelptext",2),kt([u({type:Boolean})],mt.prototype,"defaultChecked",2),kt([u({type:Boolean})],mt.prototype,"hasTile",2),kt([u({type:Boolean})],mt.prototype,"isSwitch",2),kt([u({type:String})],mt.prototype,"labelPosition",2),kt([u({type:Boolean})],mt.prototype,"hideLabel",2),kt([u({type:Boolean,reflect:!0})],mt.prototype,"checked",2),kt([u({type:Boolean,reflect:!0})],mt.prototype,"indeterminate",2),kt([u({type:String,reflect:!0})],mt.prototype,"type",2),kt([u({type:String})],mt.prototype,"tagText",2),kt([u({type:Boolean})],mt.prototype,"optionalTag",2),kt([u({type:String})],mt.prototype,"optionalText",2),kt([u({type:Boolean})],mt.prototype,"requiredTag",2),kt([u({type:String})],mt.prototype,"requiredText",2),mt=kt([
|
|
808
|
-
<div class=${
|
|
807
|
+
`}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}const 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))}};kt([u({type:String,reflect:!0})],mt.prototype,"value",2),kt([u({type:String})],mt.prototype,"checkHelptext",2),kt([u({type:Boolean})],mt.prototype,"defaultChecked",2),kt([u({type:Boolean})],mt.prototype,"hasTile",2),kt([u({type:Boolean})],mt.prototype,"isSwitch",2),kt([u({type:String})],mt.prototype,"labelPosition",2),kt([u({type:Boolean})],mt.prototype,"hideLabel",2),kt([u({type:Boolean,reflect:!0})],mt.prototype,"checked",2),kt([u({type:Boolean,reflect:!0})],mt.prototype,"indeterminate",2),kt([u({type:String,reflect:!0})],mt.prototype,"type",2),kt([u({type:String})],mt.prototype,"tagText",2),kt([u({type:Boolean})],mt.prototype,"optionalTag",2),kt([u({type:String})],mt.prototype,"optionalText",2),kt([u({type:Boolean})],mt.prototype,"requiredTag",2),kt([u({type:String})],mt.prototype,"requiredText",2),mt=kt([fe("pkt-checkbox")],mt);const Mo={calendar:{buttonAltText:"Åpne kalender"}},Ih={calendar:{buttonAltText:"Åpne kalender"},generic:{from:"Fra",to:"Til"}};var Lh=Object.defineProperty,Bh=Object.getOwnPropertyDescriptor,Gn=(s,e,t,n)=>{for(var i=n>1?void 0:n?Bh(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Lh(e,t,i),i};let dn=class extends At{constructor(){super(...arguments),this.dates=[],this.dateformat="dd.MM.yyyy",this.className="pkt-datepicker__tags",this.idBase=ws()}render(){return this.classes={"pkt-date-tags":!0,[this.className]:!0},y`
|
|
808
|
+
<div class=${X(this.classes)} aria-live="polite">
|
|
809
809
|
${Array.isArray(this.dates)&&this.dates[0]?$r(go((this.dates??[]).filter(Boolean)),e=>e,e=>{var t;return y` <pkt-tag
|
|
810
810
|
id=${this.idBase+e+"-tag"}
|
|
811
811
|
closeTag
|
|
@@ -815,9 +815,9 @@
|
|
|
815
815
|
<time datetime=${e}>${ho(e,this.dateformat)}</time>
|
|
816
816
|
</pkt-tag>`}):C}
|
|
817
817
|
</div>
|
|
818
|
-
`}};Gn([u({type:Array})],
|
|
818
|
+
`}};Gn([u({type:Array})],dn.prototype,"dates",2),Gn([u({type:String})],dn.prototype,"dateformat",2),Gn([u({type:String,attribute:"class"})],dn.prototype,"className",2),Gn([u({type:String,attribute:"id-base"})],dn.prototype,"idBase",2),dn=Gn([fe("pkt-date-tags")],dn);const Fh={dateformat:{default:"dd.MM.yyyy"},weeknumbers:{default:!1},withcontrols:{default:!1},multiple:{default:!1},range:{default:!1}},Xn={props:Fh},Us=()=>{const s=navigator.userAgent;return!!(/iP(hone|od|ad)/.test(s)||/Macintosh/.test(s)&&"ontouchend"in document)},Vh=()=>Us()?"text":"date",Hh=s=>!s||s.length!==2?!0:Cd(s[0],s[1]),Uh=s=>go(s),jh=(s,e,t,n,i)=>xd(s,e,t,n,i),qh=(s,e,t,n,i,r)=>({"pkt-input":!0,"pkt-datepicker__input":!0,"pkt-input--fullwidth":s,"pkt-datepicker--hasrangelabels":e,"pkt-datepicker--multiple":t,"pkt-datepicker--range":n,"ios-readonly-hack":i===!1&&r==="text"}),Wh=()=>({"pkt-input-icon":!0,"pkt-btn":!0,"pkt-btn--icon-only":!0,"pkt-btn--tertiary":!0,"pkt-datepicker__calendar-button":!0}),zh=s=>({"pkt-input-prefix":s,"pkt-hide":!s}),Yh=(s,e,t)=>!e&&!t?Array.isArray(s)?s[0]||"":s:Array.isArray(s)?s.join(","):s,Kh=(s,e,t=!1)=>{var n;if(!s||!e)return;const i=((n=e.parentElement)==null?void 0:n.getBoundingClientRect())||e.getBoundingClientRect(),r=t?i.height+30:i.height,a=s.getBoundingClientRect().height;let l=t?"calc(100% - 30px)":"100%";i&&i.top+a>window.innerHeight&&i.top-a>0&&(l=`calc(100% - ${r}px - ${a}px)`),s.style.top=l},Gh=(s,e,t,n,i,r)=>{const{key:a}=s;a===","&&(s.preventDefault(),r?r(s):i&&i()),(a==="Space"||a===" ")&&(s.preventDefault(),e(s)),a==="Enter"&&(s.preventDefault(),t?t():n?n():i&&i())},Xh=(s,e)=>{const{key:t}=s;(t==="Enter"||t===" "||t==="Space")&&(s.preventDefault(),e(s))},Do={validateRangeOrder:Hh,sortDates:Uh,filterSelectableDates:jh},Qh={getInputType:Vh},Qn={submitForm(s){var e;const t=(e=s.internals)==null?void 0:e.form;t&&t.requestSubmit()},submitFormOrFallback(s,e){const t=s==null?void 0:s.form;t?t.requestSubmit():e()},validateDateInput(s,e,t,n,i){var r,a,l,c;const h=s.value;h&&(t&&t>h?e.setValidity({rangeUnderflow:!0},((a=(r=i==null?void 0:i.forms)==null?void 0:r.messages)==null?void 0:a.rangeUnderflow)||"Value is below minimum",s):n&&n<h&&e.setValidity({rangeOverflow:!0},((c=(l=i==null?void 0:i.forms)==null?void 0:l.messages)==null?void 0:c.rangeOverflow)||"Value is above maximum",s))}},Pi={addToSelected(s,e,t,n){const i=s.target;if(!i.value)return;const r=t?Lt(t):null,a=n?Lt(n):null,l=Lt(i.value.split(",")[0]);l&&!isNaN(l.getTime())&&(!r||l>=r)&&(!a||l<=a)&&e.value&&e.value.handleDateSelect(l),i.value=""},handleCalendarPosition(s,e,t=!1){Kh(s.value??null,e.value??null,t)}},Nr={getInputClasses:qh,getButtonClasses:Wh,getRangeLabelClasses:zh},Mr={processDateSelection:Yh,updateInputValues(s,e,t,n,i,r){s.value&&(n&&e!=null&&e.value?(s.value.value=t[0]??"",e.value.value=t[1]??"",r(s.value),r(e.value)):i||(s.value.value=t.length?t[0]:"",r(s.value)))},processRangeBlur(s,e,t,n,i){var r;const a=s.target;if(a.value){i(a);const l=ys(a.value);l&&((r=t==null?void 0:t.value)==null||r.handleDateSelect(l))}else e[0]&&n()}},Ai={handleInputKeydown:Gh,handleButtonKeydown:Xh};var Zh=Object.defineProperty,Jh=Object.getOwnPropertyDescriptor,wt=(s,e,t,n)=>{for(var i=n>1?void 0:n?Jh(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Zh(e,t,i),i};let yt=class extends At{constructor(){super(...arguments),this.open=!1,this.multiple=!1,this.range=!1,this.weeknumbers=!1,this.withcontrols=!1,this.maxMultiple=null,this.selected=[],this.earliest=null,this.latest=null,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.today=null,this._hasBeenOpened=!1,this.popupRef=_e(),this.calendarRef=_e(),this.handleDocumentClick=e=>{if(!this.open)return;const t=e.composedPath(),n=this.parentElement,i=this.popupRef.value;!t.includes(this)&&!t.includes(i)&&!(n&&t.includes(n))&&(this.hide(),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))},this.handleDocumentKeydown=e=>{this.open&&e.key==="Escape"&&(this.hide(),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))}}firstUpdated(){this.calRef=this.calendarRef}updated(e){super.updated(e),e.has("open")&&(this.open?(this._hasBeenOpened=!0,document.addEventListener("keydown",this.handleDocumentKeydown),document.addEventListener("click",this.handleDocumentClick)):(document.removeEventListener("click",this.handleDocumentClick),document.removeEventListener("keydown",this.handleDocumentKeydown)))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.handleDocumentClick),document.removeEventListener("keydown",this.handleDocumentKeydown)}show(){var e;this.open=!0,(e=this.calendarRef.value)==null||e.focus()}hide(){this.open=!1}toggle(){this.open?this.hide():this.show()}contains(e){var t;return!!e&&!!((t=this.popupRef.value)!=null&&t.contains(e))}focusOnCurrentDate(){const e=this.calendarRef.value;e&&typeof e.focusOnCurrentDate=="function"&&e.focusOnCurrentDate()}addToSelected(e,t,n){if(this.calendarRef.value&&typeof Pi.addToSelected=="function")return Pi.addToSelected(e,this.calendarRef,t,n);const i=e.target;if(!i.value)return;const r=t?Lt(t):null,a=n?Lt(n):null,l=Lt(i.value.split(",")[0]);l&&!isNaN(l.getTime())&&(!r||l>=r)&&(!a||l<=a)&&this.handleDateSelect(l),i.value=""}handleDateSelect(e){const t=this.calendarRef.value;if(t&&typeof t.handleDateSelect=="function")return t.handleDateSelect(e);const n=rt(e),i=this.selected.indexOf(n)>=0?this.selected.filter(r=>r!==n):[...this.selected,n];this.selected=i,this.dispatchEvent(new CustomEvent("date-selected",{detail:i,bubbles:!0,composed:!0}))}render(){const e={"pkt-calendar-popup":!0,show:this.open,hide:!this.open};return y`
|
|
819
819
|
<div
|
|
820
|
-
class="${
|
|
820
|
+
class="${X(e)}"
|
|
821
821
|
${we(this.popupRef)}
|
|
822
822
|
id="date-popup"
|
|
823
823
|
?hidden=${!this.open}
|
|
@@ -841,9 +841,9 @@
|
|
|
841
841
|
@close=${()=>{this.hide(),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}}
|
|
842
842
|
></pkt-calendar>`:C}
|
|
843
843
|
</div>
|
|
844
|
-
`}};wt([u({type:Boolean,reflect:!0})],yt.prototype,"open",2),wt([u({type:Boolean})],yt.prototype,"multiple",2),wt([u({type:Boolean})],yt.prototype,"range",2),wt([u({type:Boolean})],yt.prototype,"weeknumbers",2),wt([u({type:Boolean})],yt.prototype,"withcontrols",2),wt([u({type:Number})],yt.prototype,"maxMultiple",2),wt([u({type:Array})],yt.prototype,"selected",2),wt([u({type:String})],yt.prototype,"earliest",2),wt([u({type:String})],yt.prototype,"latest",2),wt([u({type:Array})],yt.prototype,"excludedates",2),wt([u({type:Array})],yt.prototype,"excludeweekdays",2),wt([u({type:String})],yt.prototype,"currentmonth",2),wt([u({type:String})],yt.prototype,"today",2),wt([
|
|
844
|
+
`}};wt([u({type:Boolean,reflect:!0})],yt.prototype,"open",2),wt([u({type:Boolean})],yt.prototype,"multiple",2),wt([u({type:Boolean})],yt.prototype,"range",2),wt([u({type:Boolean})],yt.prototype,"weeknumbers",2),wt([u({type:Boolean})],yt.prototype,"withcontrols",2),wt([u({type:Number})],yt.prototype,"maxMultiple",2),wt([u({type:Array})],yt.prototype,"selected",2),wt([u({type:String})],yt.prototype,"earliest",2),wt([u({type:String})],yt.prototype,"latest",2),wt([u({type:Array})],yt.prototype,"excludedates",2),wt([u({type:Array})],yt.prototype,"excludeweekdays",2),wt([u({type:String})],yt.prototype,"currentmonth",2),wt([u({type:String})],yt.prototype,"today",2),wt([he()],yt.prototype,"_hasBeenOpened",2),yt=wt([fe("pkt-datepicker-popup")],yt);var Rh=Object.defineProperty,us=(s,e,t,n)=>{for(var i=void 0,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=a(e,t,i)||i);return i&&Rh(e,t,i),i};let Vt=class extends At{constructor(){super(...arguments),this.inputType="date",this.id="",this.readonly=!1,this.disabled=!1,this.inputClasses={},this.inputRef=_e(),this.btnRef=_e()}get inputElement(){return this.inputRef.value}get buttonElement(){return this.btnRef.value}get isInputReadonly(){return this.readonly||this.inputType==="text"}dispatchToggleCalendar(e){this.readonly||this.dispatchEvent(new CustomEvent("toggle-calendar",{detail:e,bubbles:!0,composed:!0}))}dispatchInput(e){this.dispatchEvent(new CustomEvent("input-change",{detail:e,bubbles:!0,composed:!0}))}dispatchFocus(){this.dispatchEvent(new CustomEvent("input-focus",{bubbles:!0,composed:!0}))}dispatchBlur(e){this.dispatchEvent(new CustomEvent("input-blur",{detail:e,bubbles:!0,composed:!0}))}dispatchChange(e){this.dispatchEvent(new CustomEvent("input-changed",{detail:e,bubbles:!0,composed:!0}))}renderCalendarButton(){var e;return y`
|
|
845
845
|
<button
|
|
846
|
-
class="${
|
|
846
|
+
class="${X(Nr.getButtonClasses())}"
|
|
847
847
|
type="button"
|
|
848
848
|
@click=${t=>this.dispatchToggleCalendar(t)}
|
|
849
849
|
@keydown=${t=>{const{key:n}=t;(n==="Enter"||n===" "||n==="Space")&&(t.preventDefault(),this.dispatchToggleCalendar(t))}}
|
|
@@ -853,10 +853,10 @@
|
|
|
853
853
|
<pkt-icon name="calendar"></pkt-icon>
|
|
854
854
|
<span class="pkt-btn__text">${((e=this.strings.calendar)==null?void 0:e.buttonAltText)||"Åpne kalender"}</span>
|
|
855
855
|
</button>
|
|
856
|
-
`}createRenderRoot(){return this}};us([u({type:String})],Vt.prototype,"inputType"),us([u({type:String})],Vt.prototype,"id"),us([u({type:String})],Vt.prototype,"min"),us([u({type:String})],Vt.prototype,"max"),us([u({type:String})],Vt.prototype,"placeholder"),us([u({type:Boolean})],Vt.prototype,"readonly"),us([u({type:Boolean})],Vt.prototype,"disabled"),us([u({type:Object})],Vt.prototype,"inputClasses"),us([u({type:Object})],Vt.prototype,"internals");var
|
|
856
|
+
`}createRenderRoot(){return this}};us([u({type:String})],Vt.prototype,"inputType"),us([u({type:String})],Vt.prototype,"id"),us([u({type:String})],Vt.prototype,"min"),us([u({type:String})],Vt.prototype,"max"),us([u({type:String})],Vt.prototype,"placeholder"),us([u({type:Boolean})],Vt.prototype,"readonly"),us([u({type:Boolean})],Vt.prototype,"disabled"),us([u({type:Object})],Vt.prototype,"inputClasses"),us([u({type:Object})],Vt.prototype,"internals");var ep=Object.defineProperty,tp=Object.getOwnPropertyDescriptor,Dr=(s,e,t,n)=>{for(var i=n>1?void 0:n?tp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&ep(e,t,i),i};let Ii=class extends Vt{constructor(){super(...arguments),this.value="",this.strings=Mo}dispatchManageValidity(e){this.dispatchEvent(new CustomEvent("manage-validity",{detail:e,bubbles:!0,composed:!0}))}render(){return y`
|
|
857
857
|
<div class="pkt-input__container">
|
|
858
858
|
<input
|
|
859
|
-
class="${
|
|
859
|
+
class="${X(this.inputClasses)}"
|
|
860
860
|
.type=${this.inputType}
|
|
861
861
|
id="${this.id}-input"
|
|
862
862
|
.value=${this.value}
|
|
@@ -877,11 +877,11 @@
|
|
|
877
877
|
/>
|
|
878
878
|
${this.renderCalendarButton()}
|
|
879
879
|
</div>
|
|
880
|
-
`}};Dr([u({type:String})],Ii.prototype,"value",2),Dr([u({type:Object})],Ii.prototype,"strings",2),Ii=Dr([
|
|
880
|
+
`}};Dr([u({type:String})],Ii.prototype,"value",2),Dr([u({type:Object})],Ii.prototype,"strings",2),Ii=Dr([fe("pkt-datepicker-single")],Ii);var sp=Object.defineProperty,np=Object.getOwnPropertyDescriptor,Zn=(s,e,t,n)=>{for(var i=n>1?void 0:n?np(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&sp(e,t,i),i};let hn=class extends Vt{constructor(){super(...arguments),this.value=[],this.label="",this.showRangeLabels=!1,this.strings=Ih,this.inputRefTo=_e()}get inputElementTo(){return this.inputRefTo.value}render(){var e,t,n,i;const r=Nr.getRangeLabelClasses(this.showRangeLabels);return y`
|
|
881
881
|
<div class="pkt-input__container">
|
|
882
882
|
${this.showRangeLabels?y` <div class="pkt-input-prefix">${(e=this.strings.generic)==null?void 0:e.from}</div> `:C}
|
|
883
883
|
<input
|
|
884
|
-
class=${
|
|
884
|
+
class=${X(this.inputClasses)}
|
|
885
885
|
.type=${this.inputType}
|
|
886
886
|
id="${this.id}-input"
|
|
887
887
|
aria-label="${this.label} ${((t=this.strings.generic)==null?void 0:t.from)??"Fra"}"
|
|
@@ -900,12 +900,12 @@
|
|
|
900
900
|
@change=${a=>{this.dispatchChange(a),a.stopImmediatePropagation()}}
|
|
901
901
|
${we(this.inputRef)}
|
|
902
902
|
/>
|
|
903
|
-
<div class="${
|
|
903
|
+
<div class="${X(r)}" id="${this.id}-to-label">
|
|
904
904
|
${(n=this.strings.generic)==null?void 0:n.to}
|
|
905
905
|
</div>
|
|
906
906
|
${this.showRangeLabels?C:y` <div class="pkt-input-separator">–</div> `}
|
|
907
907
|
<input
|
|
908
|
-
class=${
|
|
908
|
+
class=${X(this.inputClasses)}
|
|
909
909
|
.type=${this.inputType}
|
|
910
910
|
id="${this.id}-to"
|
|
911
911
|
aria-label="${this.label} ${((i=this.strings.generic)==null?void 0:i.to)??"Til"}"
|
|
@@ -926,10 +926,10 @@
|
|
|
926
926
|
/>
|
|
927
927
|
${this.renderCalendarButton()}
|
|
928
928
|
</div>
|
|
929
|
-
`}};Zn([u({type:Array})],
|
|
929
|
+
`}};Zn([u({type:Array})],hn.prototype,"value",2),Zn([u({type:String})],hn.prototype,"label",2),Zn([u({type:Boolean})],hn.prototype,"showRangeLabels",2),Zn([u({type:Object})],hn.prototype,"strings",2),hn=Zn([fe("pkt-datepicker-range")],hn);var ip=Object.defineProperty,rp=Object.getOwnPropertyDescriptor,Li=(s,e,t,n)=>{for(var i=n>1?void 0:n?rp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&ip(e,t,i),i};let Jn=class extends Vt{constructor(){super(...arguments),this.value=[],this.strings=Mo}get isInputDisabled(){return this.disabled||this.maxlength!==void 0&&this.maxlength!==null&&this.value.length>=this.maxlength}dispatchAddToSelected(e){this.dispatchEvent(new CustomEvent("add-to-selected",{detail:e,bubbles:!0,composed:!0}))}render(){return y`
|
|
930
930
|
<div class="pkt-input__container">
|
|
931
931
|
<input
|
|
932
|
-
class=${
|
|
932
|
+
class=${X(this.inputClasses)}
|
|
933
933
|
.type=${this.inputType}
|
|
934
934
|
id="${this.id}-input"
|
|
935
935
|
min=${I(this.min)}
|
|
@@ -948,7 +948,7 @@
|
|
|
948
948
|
/>
|
|
949
949
|
${this.renderCalendarButton()}
|
|
950
950
|
</div>
|
|
951
|
-
`}};Li([u({type:Array})],Jn.prototype,"value",2),Li([u({type:Number})],Jn.prototype,"maxlength",2),Li([u({type:Object})],Jn.prototype,"strings",2),Jn=Li([
|
|
951
|
+
`}};Li([u({type:Array})],Jn.prototype,"value",2),Li([u({type:Number})],Jn.prototype,"maxlength",2),Li([u({type:Object})],Jn.prototype,"strings",2),Jn=Li([fe("pkt-datepicker-multiple")],Jn);var ap=Object.defineProperty,op=Object.getOwnPropertyDescriptor,at=(s,e,t,n)=>{for(var i=n>1?void 0:n?op(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&ap(e,t,i),i};let tt=class extends ie{constructor(){super(...arguments),this._valueProperty="",this._valueProcessing=!1,this.datepickerPopupRef=_e(),this._value=[],this.label="Datovelger",this.dateformat=Xn.props.dateformat.default,this.multiple=Xn.props.multiple.default,this.maxlength=null,this.range=Xn.props.range.default,this.showRangeLabels=!1,this.min=null,this.max=null,this.weeknumbers=Xn.props.weeknumbers.default,this.withcontrols=Xn.props.withcontrols.default,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.today=null,this.calendarOpen=!1,this.timezone="Europe/Oslo",this.inputClasses={},this.calRef=_e(),this.popupRef=_e(),this.singleInputRef=_e(),this.rangeInputRef=_e(),this.multipleInputRef=_e(),this.addToSelected=e=>{const t=this.datepickerPopupRef.value;return t&&typeof t.addToSelected=="function"?t.addToSelected(e,this.min,this.max):Pi.addToSelected(e,this.calRef,this.min,this.max)}}get value(){return this._valueProperty}set value(e){const t=this._valueProperty;this._valueProperty=Array.isArray(e)?e.join(","):e||"",this.valueChanged(this._valueProperty,t),this.requestUpdate("value",t)}get inputType(){return Qh.getInputType()}connectedCallback(){super.connectedCallback(),this.timezone&&this.timezone!==window.pktTz&&(window.pktTz=this.timezone)}disconnectedCallback(){super.disconnectedCallback()}onInput(){this.dispatchEvent(new Event("input",{bubbles:!0}))}valueChanged(e,t){if(!(this._valueProcessing||e===t)){this._valueProcessing=!0;try{const n=Wn(e),i=this.multiple&&n.length>1?Do.filterSelectableDates(n,this.min,this.max,this.excludedates,this.excludeweekdays):n;if(this.range&&!Do.validateRangeOrder(i)){this._value=[],this._valueProperty="",super.valueChanged("",t);return}this._value=i;const r=Sd(i);if(this._valueProperty!==r&&(this._valueProperty=r),this.range&&i.length<2)return;super.valueChanged(r,t)}finally{this._valueProcessing=!1}}}attributeChangedCallback(e,t,n){e==="value"&&this.value!==t&&this.valueChanged(n,t),e==="excludedates"&&typeof this.excludedates=="string"&&(this.excludedates=Wn(n||"")),e==="excludeweekdays"&&typeof this.excludeweekdays=="string"&&(this.excludeweekdays=Wn(n||"")),super.attributeChangedCallback(e,t,n)}updated(e){if(e.has("value")&&(e.has("multiple")||e.has("range"))){const t=Array.isArray(this.value)?this.value.join(","):this.value,n=e.get("value"),i=Array.isArray(n)?n.join(","):n;this.valueChanged(t,i)}e.has("multiple")&&(this.multiple&&!Array.isArray(this._value)?this._value=Wn(this.value):!this.multiple&&Array.isArray(this._value)&&(this._value=this._value.filter(Boolean)),!this.multiple&&!this.range&&Array.isArray(this._value)&&(this._value=[this._value[0]??""])),super.updated(e)}get inputRef(){return{value:this.currentInputElement}}get inputRefTo(){return{value:this.currentInputElementTo}}get currentInputElement(){var e,t,n;return this.multiple?(e=this.multipleInputRef.value)==null?void 0:e.inputElement:this.range?(t=this.rangeInputRef.value)==null?void 0:t.inputElement:(n=this.singleInputRef.value)==null?void 0:n.inputElement}get currentInputElementTo(){var e;if(this.range)return(e=this.rangeInputRef.value)==null?void 0:e.inputElementTo}get currentButtonElement(){var e,t,n;return this.multiple?(e=this.multipleInputRef.value)==null?void 0:e.buttonElement:this.range?(t=this.rangeInputRef.value)==null?void 0:t.buttonElement:(n=this.singleInputRef.value)==null?void 0:n.buttonElement}get btnRef(){return{value:this.currentButtonElement}}renderInput(){return y`
|
|
952
952
|
<pkt-datepicker-single
|
|
953
953
|
.value=${this._value[0]??""}
|
|
954
954
|
.inputType=${this.inputType}
|
|
@@ -1076,13 +1076,13 @@
|
|
|
1076
1076
|
</div>
|
|
1077
1077
|
</pkt-input-wrapper>
|
|
1078
1078
|
${this.renderCalendar()}
|
|
1079
|
-
`}handleCalendarPosition(){const e=this.multiple&&!!this.maxlength;Pi.handleCalendarPosition(this.popupRef,this.inputRef,e)}async showCalendar(){var e;const t=this.datepickerPopupRef.value;if(this.calendarOpen=!0,t&&typeof t.show=="function"){t.show(),Us()&&t.focusOnCurrentDate();return}await
|
|
1080
|
-
class=${
|
|
1079
|
+
`}handleCalendarPosition(){const e=this.multiple&&!!this.maxlength;Pi.handleCalendarPosition(this.popupRef,this.inputRef,e)}async showCalendar(){var e;const t=this.datepickerPopupRef.value;if(this.calendarOpen=!0,t&&typeof t.show=="function"){t.show(),Us()&&t.focusOnCurrentDate();return}await eh(20),this.handleCalendarPosition(),Us()&&((e=this.calRef.value)==null||e.focusOnCurrentDate())}hideCalendar(){const e=this.datepickerPopupRef.value;if(this.calendarOpen=!1,e&&typeof e.hide=="function")return e.hide()}async toggleCalendar(e){e.preventDefault();const t=this.datepickerPopupRef.value;if(t&&typeof t.toggle=="function"){const n=!!t.open;t.toggle(),this.calendarOpen=!n;return}this.calendarOpen?this.hideCalendar():this.showCalendar()}clearInputValue(){this._value=[],this.value="",this.internals.setFormValue(this.value),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:this._value,bubbles:!0,composed:!0}))}};at([u({type:String,reflect:!0})],tt.prototype,"value",1),at([u({type:String,reflect:!0})],tt.prototype,"label",2),at([u({type:String})],tt.prototype,"dateformat",2),at([u({type:Boolean,reflect:!0})],tt.prototype,"multiple",2),at([u({type:Number,reflect:!0})],tt.prototype,"maxlength",2),at([u({type:Boolean,reflect:!0})],tt.prototype,"range",2),at([u({type:Boolean,attribute:"show-range-labels"})],tt.prototype,"showRangeLabels",2),at([u({type:String,reflect:!0})],tt.prototype,"min",2),at([u({type:String,reflect:!0})],tt.prototype,"max",2),at([u({type:Boolean})],tt.prototype,"weeknumbers",2),at([u({type:Boolean,reflect:!0})],tt.prototype,"withcontrols",2),at([u({converter:an.csvToArray})],tt.prototype,"excludedates",2),at([u({converter:an.csvToArray})],tt.prototype,"excludeweekdays",2),at([u({type:String})],tt.prototype,"currentmonth",2),at([u({type:String})],tt.prototype,"today",2),at([u({type:Boolean,reflect:!0,attribute:"calendar-open"})],tt.prototype,"calendarOpen",2),at([u({type:String})],tt.prototype,"timezone",2),at([he()],tt.prototype,"inputClasses",2),tt=at([fe("pkt-datepicker")],tt);const lp={href:{default:"#"},target:{default:"_self"}},Oo={props:lp};var cp=Object.defineProperty,up=Object.getOwnPropertyDescriptor,pn=(s,e,t,n)=>{for(var i=n>1?void 0:n?up(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&cp(e,t,i),i};let js=class extends pt{constructor(){super(...arguments),this.href=Oo.props.href.default,this.iconName=void 0,this.iconPosition=void 0,this.external=!1,this.target=Oo.props.target.default}render(){const e={"pkt-link":!0,"pkt-link--icon-left":!!this.iconName&&this.iconPosition==="left"||!!(this.iconName&&!this.iconPosition),"pkt-link--icon-right":!!this.iconName&&this.iconPosition==="right","pkt-link--external":this.external};return y`<a
|
|
1080
|
+
class=${X(e)}
|
|
1081
1081
|
href=${this.href}
|
|
1082
1082
|
.target=${this.target}
|
|
1083
1083
|
.rel=${this.external?"noopener noreferrer":C}
|
|
1084
1084
|
>${this.iconName?y`<pkt-icon name=${this.iconName} class="pkt-link__icon"></pkt-icon>`:""} <span>${ze(this)}</span></a
|
|
1085
|
-
>`}};
|
|
1085
|
+
>`}};pn([u({type:String,reflect:!0})],js.prototype,"href",2),pn([u({type:String,reflect:!0})],js.prototype,"iconName",2),pn([u({type:String,reflect:!0})],js.prototype,"iconPosition",2),pn([u({type:Boolean,reflect:!0})],js.prototype,"external",2),pn([u({type:String,reflect:!0})],js.prototype,"target",2),js=pn([fe("pkt-link")],js);var dp=Object.defineProperty,hp=Object.getOwnPropertyDescriptor,ts=(s,e,t,n)=>{for(var i=n>1?void 0:n?hp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&dp(e,t,i),i};let Yt=class extends ie{constructor(){super(...arguments),this.inputRef=_e(),this.value="",this.type="text",this.size=null,this.autocomplete=null,this.iconNameRight=null,this.prefix=null,this.suffix=null,this.omitSearchIcon=!1,this.counterCurrent=0}attributeChangedCallback(s,e,t){s==="value"&&this.value!==e&&(this.counterCurrent=t?t.length:0,this.valueChanged(t,e)),super.attributeChangedCallback(s,e,t)}updated(s){var e;super.updated(s),s.has("value")&&(this.counterCurrent=((e=this.value)==null?void 0:e.length)||0,this.valueChanged(this.value,s.get("value"))),s.has("id")&&!this.name&&this.id&&(this.name=this.id)}render(){const s=this.type==="search"&&!this.iconNameRight&&!this.omitSearchIcon,e=X({"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 y`
|
|
1086
1086
|
<pkt-input-wrapper
|
|
1087
1087
|
label="${this.label}"
|
|
1088
1088
|
?counter=${this.counter}
|
|
@@ -1151,7 +1151,7 @@
|
|
|
1151
1151
|
${!this.suffix&&s?y`<pkt-icon class="pkt-input-icon" name="magnifying-glass-big"></pkt-icon>`:C}
|
|
1152
1152
|
</div>
|
|
1153
1153
|
</pkt-input-wrapper>
|
|
1154
|
-
`}};ts([u({type:String,reflect:!0})],Yt.prototype,"value",2),ts([u({type:String})],Yt.prototype,"type",2),ts([u({type:Number})],Yt.prototype,"size",2),ts([u({type:String})],Yt.prototype,"autocomplete",2),ts([u({type:String})],Yt.prototype,"iconNameRight",2),ts([u({type:String})],Yt.prototype,"prefix",2),ts([u({type:String})],Yt.prototype,"suffix",2),ts([u({type:Boolean})],Yt.prototype,"omitSearchIcon",2),ts([
|
|
1154
|
+
`}};ts([u({type:String,reflect:!0})],Yt.prototype,"value",2),ts([u({type:String})],Yt.prototype,"type",2),ts([u({type:Number})],Yt.prototype,"size",2),ts([u({type:String})],Yt.prototype,"autocomplete",2),ts([u({type:String})],Yt.prototype,"iconNameRight",2),ts([u({type:String})],Yt.prototype,"prefix",2),ts([u({type:String})],Yt.prototype,"suffix",2),ts([u({type:Boolean})],Yt.prototype,"omitSearchIcon",2),ts([he()],Yt.prototype,"counterCurrent",2),Yt=ts([fe("pkt-textinput")],Yt);const pp=s=>typeof s.target=="string"?{title:s.title,iconName:s.iconName,href:s.target}:{title:s.title,iconName:s.iconName,onClick:s.target},fp=s=>pp(s),gp=s=>{if(!s)return;const e=typeof s=="string"?new Date(s):s;if(!isNaN(e.getTime()))return e.toLocaleDateString("nb-NO",{day:"numeric",month:"long",year:"numeric",hour:"2-digit",minute:"2-digit"})};var mp=Object.defineProperty,bp=Object.getOwnPropertyDescriptor,qs=(s,e,t,n)=>{for(var i=n>1?void 0:n?bp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&mp(e,t,i),i};let xs=class extends At{constructor(){super(...arguments),this.canChangeRepresentation=!1,this.logoutOnClick=!1}handleChangeRepresentation(){this.dispatchEvent(new CustomEvent("change-representation",{bubbles:!0,composed:!0}))}handleLogout(){this.dispatchEvent(new CustomEvent("log-out",{bubbles:!0,composed:!0}))}handleMenuItemClick(e){"onClick"in e&&typeof e.onClick=="function"&&e.onClick()}renderLinkOrButton(e,t){const n="href"in e,i=X({"pkt-user-menu__link":!0,"pkt-link-button":!n,"pkt-link":!n,"pkt-link--icon-left":!n,[t||""]:!!t});return n?y`
|
|
1155
1155
|
<pkt-link
|
|
1156
1156
|
icon-name=${e.iconName||C}
|
|
1157
1157
|
href=${e.href}
|
|
@@ -1175,7 +1175,7 @@
|
|
|
1175
1175
|
<li class="pkt-user-menu__subitem">${this.renderLinkOrButton(t)}</li>
|
|
1176
1176
|
`)}
|
|
1177
1177
|
</ul>
|
|
1178
|
-
`}render(){var e;const t=(e=this.userMenu)==null?void 0:e.map(
|
|
1178
|
+
`}render(){var e;const t=(e=this.userMenu)==null?void 0:e.map(fp);return y`
|
|
1179
1179
|
<nav class="pkt-user-menu" aria-label="Meny for innlogget bruker">
|
|
1180
1180
|
<ul class="pkt-user-menu__list">
|
|
1181
1181
|
<!-- User section -->
|
|
@@ -1233,8 +1233,8 @@
|
|
|
1233
1233
|
`:C}
|
|
1234
1234
|
</ul>
|
|
1235
1235
|
</nav>
|
|
1236
|
-
`}};qs([u({type:Object})],xs.prototype,"user",2),qs([u({type:String,attribute:"formatted-last-logged-in"})],xs.prototype,"formattedLastLoggedIn",2),qs([u({type:Object})],xs.prototype,"representing",2),qs([u({type:Array,attribute:"user-menu"})],xs.prototype,"userMenu",2),qs([u({type:Boolean,attribute:"can-change-representation",converter:xt})],xs.prototype,"canChangeRepresentation",2),qs([u({type:Boolean,attribute:"logout-on-click",converter:xt})],xs.prototype,"logoutOnClick",2),xs=qs([
|
|
1237
|
-
<pkt-icon name="oslologo" aria-hidden="true" path=${
|
|
1236
|
+
`}};qs([u({type:Object})],xs.prototype,"user",2),qs([u({type:String,attribute:"formatted-last-logged-in"})],xs.prototype,"formattedLastLoggedIn",2),qs([u({type:Object})],xs.prototype,"representing",2),qs([u({type:Array,attribute:"user-menu"})],xs.prototype,"userMenu",2),qs([u({type:Boolean,attribute:"can-change-representation",converter:xt})],xs.prototype,"canChangeRepresentation",2),qs([u({type:Boolean,attribute:"logout-on-click",converter:xt})],xs.prototype,"logoutOnClick",2),xs=qs([fe("pkt-header-user-menu")],xs);var vp=Object.defineProperty,kp=Object.getOwnPropertyDescriptor,Ce=(s,e,t,n)=>{for(var i=n>1?void 0:n?kp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&vp(e,t,i),i};const yp="https://punkt-cdn.oslo.kommune.no/16.6/logos/";let $e=class extends pt{constructor(){super(...arguments),this.searchPlaceholder="Søk",this.searchValue="",this.mobileBreakpoint=768,this.tabletBreakpoint=1280,this.openedMenu="none",this.logOutButtonPlacement="none",this.position="fixed",this.scrollBehavior="hide",this.slotMenuVariant="icon-only",this.slotMenuText="Meny",this.hideLogo=!1,this.compact=!1,this.showSearch=!1,this.canChangeRepresentation=!1,this.hasLogOut=!1,this.isMobile=!1,this.isTablet=!1,this.openMenu="none",this.isHidden=!1,this.componentWidth=typeof window<"u"?window.innerWidth:0,this.alignSlotRight=!1,this.alignSearchRight=!1,this.headerRef=_e(),this.userContainerRef=_e(),this.slotContainerRef=_e(),this.searchContainerRef=_e(),this.slotContentRef=_e(),this.searchMenuRef=_e(),this.lastScrollPosition=0,this.savedScrollY=0,this.lastFocusedElement=null,this.shouldRestoreFocus=!1,this.handleScroll=()=>{if(!this.shouldHideOnScroll)return;const e=window.pageYOffset||document.documentElement.scrollTop;e<0||Math.abs(e-this.lastScrollPosition)<60||(this.isHidden=e>this.lastScrollPosition,this.lastScrollPosition=e)},this.handleClickOutside=e=>{const t=e.target;this.user&&this.openMenu==="user"&&!t.closest(".pkt-header-service__user-container")&&(this.openMenu="none"),this.openMenu==="slot"&&!t.closest(".pkt-header-service__slot-container")&&(this.openMenu="none"),this.openMenu==="search"&&!t.closest(".pkt-header-service__search-container")&&!t.closest(".pkt-header-service__search-input")&&(this.openMenu="none")},this.handleFocusOut=(e,t)=>{const n=e.relatedTarget;let i;switch(t){case"user":i=this.userContainerRef;break;case"slot":i=this.slotContainerRef;break;case"search":i=this.searchContainerRef;break;default:return}const r=i.value;r&&(!n||!r.contains(n))&&(this.openMenu="none")},this.handleEscapeKey=e=>{e.key==="Escape"&&this.openMenu!=="none"&&(e.preventDefault(),this.shouldRestoreFocus=!0,this.openMenu="none")}}connectedCallback(){super.connectedCallback(),this.setupScrollListener()}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this.resizeObserver)==null||e.disconnect(),window.removeEventListener("scroll",this.handleScroll),this.unlockScroll()}firstUpdated(){this.setupResizeObserver()}updated(e){if(super.updated(e),e.has("openedMenu")&&this.openedMenu!==this.openMenu&&(this.openMenu=this.openedMenu),(e.has("mobileBreakpoint")||e.has("tabletBreakpoint"))&&(this.updateIsMobile(),this.updateIsTablet()),e.has("openMenu")){const t=e.get("openMenu");this.openMenu!=="none"&&(t==="none"||t===void 0)?(document.addEventListener("mousedown",this.handleClickOutside),document.addEventListener("keydown",this.handleEscapeKey),(this.openMenu==="slot"||this.openMenu==="search")&&requestAnimationFrame(()=>{this.checkDropdownAlignment(this.openMenu)})):this.openMenu==="none"&&t!=="none"&&(document.removeEventListener("mousedown",this.handleClickOutside),document.removeEventListener("keydown",this.handleEscapeKey),this.restoreFocus())}(e.has("openMenu")||e.has("isMobile"))&&this.updateScrollLock()}setupResizeObserver(){const e=this.headerRef.value;e&&(this.componentWidth=e.offsetWidth,this.updateIsMobile(),this.updateIsTablet(),this.resizeObserver=new ResizeObserver(t=>{for(const n of t)n.borderBoxSize&&n.borderBoxSize.length>0?this.componentWidth=n.borderBoxSize[0].inlineSize:this.componentWidth=n.contentRect.width,this.updateIsMobile(),this.updateIsTablet()}),this.resizeObserver.observe(e))}updateIsMobile(){this.isMobile=this.componentWidth<this.mobileBreakpoint}updateIsTablet(){this.isTablet=this.componentWidth<this.tabletBreakpoint}updateScrollLock(){this.position==="fixed"&&this.isMobile&&this.openMenu!=="none"?this.lockScroll():this.unlockScroll()}lockScroll(){const e=document.body,t=document.documentElement;this.savedScrollY=window.scrollY||window.pageYOffset;const n=window.innerWidth-t.clientWidth;n>0&&(e.style.paddingRight=`${n}px`),e.style.position="fixed",e.style.top=`-${this.savedScrollY}px`,e.style.left="0",e.style.right="0",e.style.width="100%",e.style.overflow="hidden",t.classList.add("is-scroll-locked")}unlockScroll(){const e=document.body,t=document.documentElement;t.classList.contains("is-scroll-locked")&&(e.style.removeProperty("position"),e.style.removeProperty("top"),e.style.removeProperty("left"),e.style.removeProperty("right"),e.style.removeProperty("width"),e.style.removeProperty("overflow"),e.style.removeProperty("padding-right"),t.classList.remove("is-scroll-locked"),window.scrollTo({top:this.savedScrollY}))}setupScrollListener(){window.addEventListener("scroll",this.handleScroll)}restoreFocus(){this.shouldRestoreFocus&&this.lastFocusedElement&&document.contains(this.lastFocusedElement)&&this.lastFocusedElement.focus(),this.lastFocusedElement=null,this.shouldRestoreFocus=!1}checkDropdownAlignment(e){const t=e==="slot"?this.slotContainerRef:this.searchContainerRef,n=e==="slot"?this.slotContentRef:this.searchMenuRef;if(!t.value||!n.value||!this.isTablet||this.isMobile)return;const i=t.value.getBoundingClientRect(),r=n.value.offsetWidth,a=i.left+r>window.innerWidth;e==="slot"?this.alignSlotRight=a:this.alignSearchRight=a}handleMenuToggle(e){this.openMenu!=="none"?this.openMenu="none":(this.lastFocusedElement=document.activeElement,this.openMenu=e)}handleLogoClick(e){this.dispatchEvent(new CustomEvent("logo-click",{bubbles:!0,composed:!0,detail:{originalEvent:e}}))}handleServiceClick(e){this.dispatchEvent(new CustomEvent("service-click",{bubbles:!0,composed:!0,detail:{originalEvent:e}}))}handleLogout(){this.dispatchEvent(new CustomEvent("log-out",{bubbles:!0,composed:!0}))}handleSearch(e){this.dispatchEvent(new CustomEvent("search",{detail:{query:e},bubbles:!0,composed:!0}))}handleSearchChange(e){this.dispatchEvent(new CustomEvent("search-change",{detail:{query:e},bubbles:!0,composed:!0}))}handleSearchInputChange(e){const t=e.target.value;this.handleSearchChange(t)}handleSearchKeyDown(e){e.key==="Enter"&&this.handleSearch(e.target.value)}get formattedLastLoggedIn(){var e;return gp((e=this.user)==null?void 0:e.lastLoggedIn)}get isFixed(){return this.position==="fixed"}get shouldHideOnScroll(){return this.scrollBehavior==="hide"}get showLogoutInHeader(){return this.hasLogOut&&(this.logOutButtonPlacement==="header"||this.logOutButtonPlacement==="both")}get showLogoutInUserMenu(){return this.hasLogOut&&(this.logOutButtonPlacement==="userMenu"||this.logOutButtonPlacement==="both")}renderLogo(){if(this.hideLogo)return C;const e=y`
|
|
1237
|
+
<pkt-icon name="oslologo" aria-hidden="true" path=${yp}></pkt-icon>
|
|
1238
1238
|
`;return this.logoLink&&typeof this.logoLink=="string"?y`
|
|
1239
1239
|
<span class="pkt-header-service__logo">
|
|
1240
1240
|
<a href=${this.logoLink} aria-label="Tilbake til forside" @click=${this.handleLogoClick}>
|
|
@@ -1276,7 +1276,7 @@
|
|
|
1276
1276
|
<span class="pkt-header-service__service-name" @click=${this.handleServiceClick}>
|
|
1277
1277
|
<span class="pkt-header-service__service-link">${this.serviceName}</span>
|
|
1278
1278
|
</span>
|
|
1279
|
-
`:C}renderSlotContainer(){const e=
|
|
1279
|
+
`:C}renderSlotContainer(){const e=X({"pkt-header-service__slot-container":!0,"is-open":this.openMenu==="slot"}),t=X({"pkt-header-service__slot-content":!0,"align-right":this.alignSlotRight});return y`
|
|
1280
1280
|
<div
|
|
1281
1281
|
class=${e}
|
|
1282
1282
|
@focusout=${n=>this.handleFocusOut(n,"slot")}
|
|
@@ -1303,9 +1303,11 @@
|
|
|
1303
1303
|
role=${this.isTablet?"menu":C}
|
|
1304
1304
|
aria-label=${this.isTablet?"Meny":C}
|
|
1305
1305
|
${we(this.slotContentRef)}
|
|
1306
|
-
|
|
1306
|
+
>
|
|
1307
|
+
${ze(this)}
|
|
1308
|
+
</div>
|
|
1307
1309
|
</div>
|
|
1308
|
-
`}renderSearch(){if(!this.showSearch)return C;if(this.isTablet){const e=
|
|
1310
|
+
`}renderSearch(){if(!this.showSearch)return C;if(this.isTablet){const e=X({"pkt-header-service__search-container":!0,"is-open":this.openMenu==="search"}),t=X({"pkt-header-service__mobile-menu":!0,"is-open":this.openMenu==="search","align-right":this.alignSearchRight});return y`
|
|
1309
1311
|
<div
|
|
1310
1312
|
class=${e}
|
|
1311
1313
|
@focusout=${n=>this.handleFocusOut(n,"search")}
|
|
@@ -1354,14 +1356,14 @@
|
|
|
1354
1356
|
@input=${this.handleSearchInputChange}
|
|
1355
1357
|
@keydown=${this.handleSearchKeyDown}
|
|
1356
1358
|
></pkt-textinput>
|
|
1357
|
-
`}renderUserButton(){var e;if(!this.user)return C;const t=
|
|
1359
|
+
`}renderUserButton(){var e;if(!this.user)return C;const t=X({"pkt-header-service__user-menu":this.isMobile===!1,"pkt-header-service__mobile-menu":this.isMobile===!0,"is-open":this.openMenu==="user"});return y`
|
|
1358
1360
|
<div
|
|
1359
1361
|
class="pkt-header-service__user-container"
|
|
1360
1362
|
@focusout=${n=>this.handleFocusOut(n,"user")}
|
|
1361
1363
|
${we(this.userContainerRef)}
|
|
1362
1364
|
>
|
|
1363
1365
|
<pkt-button
|
|
1364
|
-
class=${
|
|
1366
|
+
class=${X({"pkt-header-service__user-button":!0,"pkt-header-service__user-button--mobile":this.isMobile})}
|
|
1365
1367
|
skin="secondary"
|
|
1366
1368
|
size=${this.isMobile?"small":"medium"}
|
|
1367
1369
|
state=${this.openMenu==="user"?"active":"normal"}
|
|
@@ -1371,7 +1373,7 @@
|
|
|
1371
1373
|
@click=${()=>this.handleMenuToggle("user")}
|
|
1372
1374
|
>
|
|
1373
1375
|
<span class="pkt-sr-only">Brukermeny: </span>
|
|
1374
|
-
|
|
1376
|
+
<span>${((e=this.representing)==null?void 0:e.name)||this.user.name}</span>
|
|
1375
1377
|
</pkt-button>
|
|
1376
1378
|
${this.openMenu==="user"&&this.user?y`
|
|
1377
1379
|
<div class=${t}>
|
|
@@ -1388,7 +1390,7 @@
|
|
|
1388
1390
|
</div>
|
|
1389
1391
|
`:C}
|
|
1390
1392
|
</div>
|
|
1391
|
-
`}renderHeader(){const e=
|
|
1393
|
+
`}renderHeader(){const e=X({"pkt-header-service":!0,"pkt-header-service--compact":this.compact,"pkt-header-service--mobile":this.isMobile,"pkt-header-service--tablet":this.isTablet,"pkt-header-service--fixed":this.isFixed,"pkt-header-service--scroll-to-hide":this.shouldHideOnScroll,"pkt-header-service--hidden":this.isHidden}),t=X({"pkt-header-service__logo-area":!0,"pkt-header-service__logo-area--without-service":!this.serviceName});return y`
|
|
1392
1394
|
<header class=${e} ${we(this.headerRef)}>
|
|
1393
1395
|
<div class=${t}>${this.renderLogo()} ${this.renderServiceName()}</div>
|
|
1394
1396
|
|
|
@@ -1422,12 +1424,12 @@
|
|
|
1422
1424
|
`:C}
|
|
1423
1425
|
</div>
|
|
1424
1426
|
</header>
|
|
1425
|
-
`}render(){const e=this.renderHeader();if(this.isFixed){const t=
|
|
1427
|
+
`}render(){const e=this.renderHeader();if(this.isFixed){const t=X({"pkt-header-service-spacer":!0,"pkt-header-service-spacer--compact":this.compact,"pkt-header-service-spacer--has-user":!!this.user,"pkt-header-service-spacer--mobile":this.isMobile});return y`
|
|
1426
1428
|
<div class="pkt-header-service-wrapper">
|
|
1427
1429
|
${e}
|
|
1428
1430
|
<div class=${t}></div>
|
|
1429
1431
|
</div>
|
|
1430
|
-
`}return e}};Ce([u({type:String,attribute:"service-name"})],$e.prototype,"serviceName",2),Ce([u({type:String,attribute:"service-link"})],$e.prototype,"serviceLink",2),Ce([u({type:String,attribute:"logo-link"})],$e.prototype,"logoLink",2),Ce([u({type:String,attribute:"search-placeholder"})],$e.prototype,"searchPlaceholder",2),Ce([u({type:String,attribute:"search-value"})],$e.prototype,"searchValue",2),Ce([u({type:Number,attribute:"mobile-breakpoint"})],$e.prototype,"mobileBreakpoint",2),Ce([u({type:Number,attribute:"tablet-breakpoint"})],$e.prototype,"tabletBreakpoint",2),Ce([u({type:String,attribute:"opened-menu"})],$e.prototype,"openedMenu",2),Ce([u({type:String,attribute:"log-out-button-placement"})],$e.prototype,"logOutButtonPlacement",2),Ce([u({type:String})],$e.prototype,"position",2),Ce([u({type:String,attribute:"scroll-behavior"})],$e.prototype,"scrollBehavior",2),Ce([u({type:String,attribute:"slot-menu-variant"})],$e.prototype,"slotMenuVariant",2),Ce([u({type:String,attribute:"slot-menu-text"})],$e.prototype,"slotMenuText",2),Ce([u({type:Boolean,attribute:"hide-logo",converter:xt})],$e.prototype,"hideLogo",2),Ce([u({type:Boolean,converter:xt})],$e.prototype,"compact",2),Ce([u({type:Boolean,attribute:"show-search",converter:xt})],$e.prototype,"showSearch",2),Ce([u({type:Boolean,attribute:"can-change-representation",converter:xt})],$e.prototype,"canChangeRepresentation",2),Ce([u({type:Boolean,attribute:"has-log-out",converter:xt})],$e.prototype,"hasLogOut",2),Ce([u({type:Object})],$e.prototype,"user",2),Ce([u({type:Array,attribute:"user-menu"})],$e.prototype,"userMenu",2),Ce([u({type:Object})],$e.prototype,"representing",2),Ce([
|
|
1432
|
+
`}return e}};Ce([u({type:String,attribute:"service-name"})],$e.prototype,"serviceName",2),Ce([u({type:String,attribute:"service-link"})],$e.prototype,"serviceLink",2),Ce([u({type:String,attribute:"logo-link"})],$e.prototype,"logoLink",2),Ce([u({type:String,attribute:"search-placeholder"})],$e.prototype,"searchPlaceholder",2),Ce([u({type:String,attribute:"search-value"})],$e.prototype,"searchValue",2),Ce([u({type:Number,attribute:"mobile-breakpoint"})],$e.prototype,"mobileBreakpoint",2),Ce([u({type:Number,attribute:"tablet-breakpoint"})],$e.prototype,"tabletBreakpoint",2),Ce([u({type:String,attribute:"opened-menu"})],$e.prototype,"openedMenu",2),Ce([u({type:String,attribute:"log-out-button-placement"})],$e.prototype,"logOutButtonPlacement",2),Ce([u({type:String})],$e.prototype,"position",2),Ce([u({type:String,attribute:"scroll-behavior"})],$e.prototype,"scrollBehavior",2),Ce([u({type:String,attribute:"slot-menu-variant"})],$e.prototype,"slotMenuVariant",2),Ce([u({type:String,attribute:"slot-menu-text"})],$e.prototype,"slotMenuText",2),Ce([u({type:Boolean,attribute:"hide-logo",converter:xt})],$e.prototype,"hideLogo",2),Ce([u({type:Boolean,converter:xt})],$e.prototype,"compact",2),Ce([u({type:Boolean,attribute:"show-search",converter:xt})],$e.prototype,"showSearch",2),Ce([u({type:Boolean,attribute:"can-change-representation",converter:xt})],$e.prototype,"canChangeRepresentation",2),Ce([u({type:Boolean,attribute:"has-log-out",converter:xt})],$e.prototype,"hasLogOut",2),Ce([u({type:Object})],$e.prototype,"user",2),Ce([u({type:Array,attribute:"user-menu"})],$e.prototype,"userMenu",2),Ce([u({type:Object})],$e.prototype,"representing",2),Ce([he()],$e.prototype,"isMobile",2),Ce([he()],$e.prototype,"isTablet",2),Ce([he()],$e.prototype,"openMenu",2),Ce([he()],$e.prototype,"isHidden",2),Ce([he()],$e.prototype,"componentWidth",2),Ce([he()],$e.prototype,"alignSlotRight",2),Ce([he()],$e.prototype,"alignSearchRight",2),$e=Ce([fe("pkt-header-service")],$e);var _p=Object.defineProperty,wp=Object.getOwnPropertyDescriptor,We=(s,e,t,n)=>{for(var i=n>1?void 0:n?wp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&_p(e,t,i),i};let He=class extends pt{constructor(){super(...arguments),this.searchPlaceholder="Søk",this.searchValue="",this.mobileBreakpoint=768,this.tabletBreakpoint=1280,this.openedMenu="none",this.logOutButtonPlacement="none",this.position="fixed",this.scrollBehavior="hide",this.slotMenuVariant="icon-only",this.slotMenuText="Meny",this.hideLogo=!1,this.compact=!1,this.showSearch=!1,this.canChangeRepresentation=!1,this.hasLogOut=!1}firstUpdated(e){super.firstUpdated(e),this.emitDeprecationWarnings()}emitDeprecationWarnings(){this.userMenuFooter!==void 0&&console.warn("[PktHeader] userMenuFooter is deprecated. Use userMenu instead."),this.userOptions!==void 0&&console.warn("[PktHeader] userOptions is deprecated. Use userMenu instead.")}get effectiveUserMenu(){const e=this.userMenu||[],t=this.userMenuFooter||[],n=this.userOptions||[];return t.length||n.length?[...e,...n,...t]:this.userMenu}render(){return y`
|
|
1431
1433
|
<pkt-header-service
|
|
1432
1434
|
service-name=${I(this.serviceName)}
|
|
1433
1435
|
service-link=${I(this.serviceLink)}
|
|
@@ -1453,7 +1455,7 @@
|
|
|
1453
1455
|
>
|
|
1454
1456
|
<div class="pkt-contents">${ze(this)}</div>
|
|
1455
1457
|
</pkt-header-service>
|
|
1456
|
-
`}};We([u({type:String,attribute:"service-name"})],He.prototype,"serviceName",2),We([u({type:String,attribute:"service-link"})],He.prototype,"serviceLink",2),We([u({type:String,attribute:"logo-link"})],He.prototype,"logoLink",2),We([u({type:String,attribute:"search-placeholder"})],He.prototype,"searchPlaceholder",2),We([u({type:String,attribute:"search-value"})],He.prototype,"searchValue",2),We([u({type:Number,attribute:"mobile-breakpoint"})],He.prototype,"mobileBreakpoint",2),We([u({type:Number,attribute:"tablet-breakpoint"})],He.prototype,"tabletBreakpoint",2),We([u({type:String,attribute:"opened-menu"})],He.prototype,"openedMenu",2),We([u({type:String,attribute:"log-out-button-placement"})],He.prototype,"logOutButtonPlacement",2),We([u({type:String})],He.prototype,"position",2),We([u({type:String,attribute:"scroll-behavior"})],He.prototype,"scrollBehavior",2),We([u({type:String,attribute:"slot-menu-variant"})],He.prototype,"slotMenuVariant",2),We([u({type:String,attribute:"slot-menu-text"})],He.prototype,"slotMenuText",2),We([u({type:Boolean,attribute:"hide-logo",converter:xt})],He.prototype,"hideLogo",2),We([u({type:Boolean,converter:xt})],He.prototype,"compact",2),We([u({type:Boolean,attribute:"show-search",converter:xt})],He.prototype,"showSearch",2),We([u({type:Boolean,attribute:"can-change-representation",converter:xt})],He.prototype,"canChangeRepresentation",2),We([u({type:Boolean,attribute:"has-log-out",converter:xt})],He.prototype,"hasLogOut",2),We([u({type:Object})],He.prototype,"user",2),We([u({type:Array,attribute:"user-menu"})],He.prototype,"userMenu",2),We([u({type:Object})],He.prototype,"representing",2),We([u({type:Array,attribute:"user-menu-footer"})],He.prototype,"userMenuFooter",2),We([u({type:Array,attribute:"user-options"})],He.prototype,"userOptions",2),He=We([
|
|
1458
|
+
`}};We([u({type:String,attribute:"service-name"})],He.prototype,"serviceName",2),We([u({type:String,attribute:"service-link"})],He.prototype,"serviceLink",2),We([u({type:String,attribute:"logo-link"})],He.prototype,"logoLink",2),We([u({type:String,attribute:"search-placeholder"})],He.prototype,"searchPlaceholder",2),We([u({type:String,attribute:"search-value"})],He.prototype,"searchValue",2),We([u({type:Number,attribute:"mobile-breakpoint"})],He.prototype,"mobileBreakpoint",2),We([u({type:Number,attribute:"tablet-breakpoint"})],He.prototype,"tabletBreakpoint",2),We([u({type:String,attribute:"opened-menu"})],He.prototype,"openedMenu",2),We([u({type:String,attribute:"log-out-button-placement"})],He.prototype,"logOutButtonPlacement",2),We([u({type:String})],He.prototype,"position",2),We([u({type:String,attribute:"scroll-behavior"})],He.prototype,"scrollBehavior",2),We([u({type:String,attribute:"slot-menu-variant"})],He.prototype,"slotMenuVariant",2),We([u({type:String,attribute:"slot-menu-text"})],He.prototype,"slotMenuText",2),We([u({type:Boolean,attribute:"hide-logo",converter:xt})],He.prototype,"hideLogo",2),We([u({type:Boolean,converter:xt})],He.prototype,"compact",2),We([u({type:Boolean,attribute:"show-search",converter:xt})],He.prototype,"showSearch",2),We([u({type:Boolean,attribute:"can-change-representation",converter:xt})],He.prototype,"canChangeRepresentation",2),We([u({type:Boolean,attribute:"has-log-out",converter:xt})],He.prototype,"hasLogOut",2),We([u({type:Object})],He.prototype,"user",2),We([u({type:Array,attribute:"user-menu"})],He.prototype,"userMenu",2),We([u({type:Object})],He.prototype,"representing",2),We([u({type:Array,attribute:"user-menu-footer"})],He.prototype,"userMenuFooter",2),We([u({type:Array,attribute:"user-options"})],He.prototype,"userOptions",2),He=We([fe("pkt-header")],He);var $p=Object.defineProperty,xp=Object.getOwnPropertyDescriptor,Ws=(s,e,t,n)=>{for(var i=n>1?void 0:n?xp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&$p(e,t,i),i};let Cs=class extends pt{constructor(){super(...arguments),this.title="",this.href="#",this.iconName="",this.external=!1,this.openInNewTab=!1,this.skin="normal"}render(){const e=["pkt-linkcard",this.skin&&`pkt-linkcard--${this.skin}`].filter(Boolean).join(" "),t=["pkt-linkcard__title",this.external&&"pkt-link pkt-link--external"].filter(Boolean).join(" ");return y`
|
|
1457
1459
|
<a
|
|
1458
1460
|
href=${this.href}
|
|
1459
1461
|
class=${e}
|
|
@@ -1465,7 +1467,7 @@
|
|
|
1465
1467
|
|
|
1466
1468
|
<div class="pkt-linkcard__text">${ze(this)}</div>
|
|
1467
1469
|
</a>
|
|
1468
|
-
`}};Ws([u({type:String,reflect:!0})],Cs.prototype,"title",2),Ws([u({type:String,reflect:!0})],Cs.prototype,"href",2),Ws([u({type:String,reflect:!0})],Cs.prototype,"iconName",2),Ws([u({type:Boolean,reflect:!0})],Cs.prototype,"external",2),Ws([u({type:Boolean,reflect:!0})],Cs.prototype,"openInNewTab",2),Ws([u({type:String,reflect:!0})],Cs.prototype,"skin",2),Cs=Ws([
|
|
1470
|
+
`}};Ws([u({type:String,reflect:!0})],Cs.prototype,"title",2),Ws([u({type:String,reflect:!0})],Cs.prototype,"href",2),Ws([u({type:String,reflect:!0})],Cs.prototype,"iconName",2),Ws([u({type:Boolean,reflect:!0})],Cs.prototype,"external",2),Ws([u({type:Boolean,reflect:!0})],Cs.prototype,"openInNewTab",2),Ws([u({type:String,reflect:!0})],Cs.prototype,"skin",2),Cs=Ws([fe("pkt-linkcard")],Cs);var Cp=Object.defineProperty,Sp=Object.getOwnPropertyDescriptor,ds=(s,e,t,n)=>{for(var i=n>1?void 0:n?Sp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Cp(e,t,i),i};window.pktAnimationPath=window.pktAnimationPath||"https://punkt-cdn.oslo.kommune.no/16.6/animations/";let Kt=class extends pt{constructor(){super(...arguments),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(){const e=X({"pkt-loader":!0,[`pkt-loader--${this.inline?"inline":"box"}`]:!0,[`pkt-loader--${this.size}`]:!0}),t=X({"pkt-contents":!0,"pkt-hide":this.isLoading});return y`<div
|
|
1469
1471
|
role="status"
|
|
1470
1472
|
aria-live="polite"
|
|
1471
1473
|
aria-busy=${this.isLoading?"true":"false"}
|
|
@@ -1480,7 +1482,7 @@
|
|
|
1480
1482
|
${this.message&&y`<p>${this.message}</p>`}
|
|
1481
1483
|
</div>`:C}
|
|
1482
1484
|
<div class=${t}>${ze(this)}</div>
|
|
1483
|
-
</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))}};ds([u({type:Number})],Kt.prototype,"delay",2),ds([u({type:Boolean})],Kt.prototype,"inline",2),ds([u({type:Boolean})],Kt.prototype,"isLoading",2),ds([u({type:String})],Kt.prototype,"message",2),ds([u({type:String})],Kt.prototype,"size",2),ds([u({type:String})],Kt.prototype,"variant",2),ds([u({type:String})],Kt.prototype,"loadingAnimationPath",2),ds([
|
|
1485
|
+
</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))}};ds([u({type:Number})],Kt.prototype,"delay",2),ds([u({type:Boolean})],Kt.prototype,"inline",2),ds([u({type:Boolean})],Kt.prototype,"isLoading",2),ds([u({type:String})],Kt.prototype,"message",2),ds([u({type:String})],Kt.prototype,"size",2),ds([u({type:String})],Kt.prototype,"variant",2),ds([u({type:String})],Kt.prototype,"loadingAnimationPath",2),ds([he()],Kt.prototype,"_shouldDisplayLoader",2),Kt=ds([fe("pkt-loader")],Kt);const Tp={skin:{default:"beige"},compact:{default:!1},closable:{default:!1}},Or={props:Tp};var Np=Object.defineProperty,Mp=Object.getOwnPropertyDescriptor,fn=(s,e,t,n)=>{for(var i=n>1?void 0:n?Mp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Np(e,t,i),i};let zs=class extends pt{constructor(){super(),this.closable=Or.props.closable.default,this.compact=Or.props.compact.default,this.title="",this.skin=Or.props.skin.default,this._isClosed=!1,this.close=s=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:s},bubbles:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:s},bubbles:!0}))},this._isClosed=!1}updated(s){super.updated(s),s.has("_isClosed")&&ja(this,"pkt-hide",this._isClosed)}render(){const s={"pkt-messagebox":!0,"pkt-messagebox--compact":this.compact,[`pkt-messagebox--${this.skin}`]:this.skin,"pkt-messagebox--closable":this.closable,"pkt-hide":this._isClosed};return y`<div class=${X(s)}>
|
|
1484
1486
|
${this.closable?y`<div class="pkt-messagebox__close">
|
|
1485
1487
|
<button
|
|
1486
1488
|
@click=${this.close}
|
|
@@ -1492,9 +1494,9 @@
|
|
|
1492
1494
|
</div>`:C}
|
|
1493
1495
|
${this.title?y`<div class="pkt-messagebox__title">${this.title}</div>`:C}
|
|
1494
1496
|
<div class="pkt-messagebox__text">${ze(this)}</div>
|
|
1495
|
-
</div>`}};
|
|
1497
|
+
</div>`}};fn([u({type:Boolean,reflect:!0})],zs.prototype,"closable",2),fn([u({type:Boolean,reflect:!0})],zs.prototype,"compact",2),fn([u({type:String,reflect:!0})],zs.prototype,"title",2),fn([u({type:String,reflect:!0})],zs.prototype,"skin",2),fn([he()],zs.prototype,"_isClosed",2),zs=fn([fe("pkt-messagebox")],zs);const Dp={hideCloseButton:{default:!1},closeOnBackdropClick:{default:!1},size:{default:"medium"}},Er={props:Dp};var Op=Object.defineProperty,Ep=Object.getOwnPropertyDescriptor,Ht=(s,e,t,n)=>{for(var i=n>1?void 0:n?Ep(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Op(e,t,i),i};let Ot=class extends pt{constructor(){super(),this.open=!1,this.headingText="",this.removePadding=!1,this.hideCloseButton=Er.props.hideCloseButton.default,this.closeOnBackdropClick=Er.props.closeOnBackdropClick.default,this.closeButtonSkin="blue",this.size=Er.props.size.default,this.variant="dialog",this.drawerPosition="right",this.transparentBackdrop=!1,this.dialogRef=_e(),this._isOpen=!1,this.close=(e,t=!1)=>{var n;if(!this._isOpen)return;this._isOpen=!1,this.open=!1,document.body.classList.remove("pkt-modal--open");const i=document.activeElement;i&&!this.isElementInViewport(i)&&i.scrollIntoView({behavior:"smooth",block:"nearest"}),this.dispatchEvent(new CustomEvent("close",{detail:{origin:e},bubbles:!0,composed:!0})),t||(n=this.dialogRef.value)==null||n.close(),this.requestUpdate()},this.showModal=(e=null)=>{var t;this._isOpen=!0,this.open=!0,(t=this.dialogRef.value)==null||t.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(()=>Tb).then(t=>t.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){var t;this.closeOnBackdropClick&&e.target===((t=this.dialogRef)==null?void 0:t.value)&&this.close(e)}isElementInViewport(e){const 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(){const 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},i=this.closeButtonSkin==="blue",r={"pkt-modal__closeButton":!0,[`pkt-modal__closeButton--${this.closeButtonSkin}`]:!0};return y`
|
|
1496
1498
|
<dialog
|
|
1497
|
-
class=${
|
|
1499
|
+
class=${X(e)}
|
|
1498
1500
|
${we(this.dialogRef)}
|
|
1499
1501
|
aria-labelledby=${this.headingText?"pkt-modal__headingText":C}
|
|
1500
1502
|
aria-describedby="pkt-modal__content"
|
|
@@ -1503,10 +1505,10 @@
|
|
|
1503
1505
|
<div class="pkt-modal__wrapper">
|
|
1504
1506
|
${this.headingText||!this.hideCloseButton?y`<div class="pkt-modal__header">
|
|
1505
1507
|
<div class="pkt-modal__header-background"></div>
|
|
1506
|
-
${this.headingText?y`<h1 id="pkt-modal__headingText" class=${
|
|
1508
|
+
${this.headingText?y`<h1 id="pkt-modal__headingText" class=${X(t)}>
|
|
1507
1509
|
${this.headingText}
|
|
1508
1510
|
</h1>`:y`<div class="pkt-modal__headingText"></div>`}
|
|
1509
|
-
${this.hideCloseButton?y`<div class="pkt-modal__noCloseButton"></div>`:y`<div class="${
|
|
1511
|
+
${this.hideCloseButton?y`<div class="pkt-modal__noCloseButton"></div>`:y`<div class="${X(r)}">
|
|
1510
1512
|
<pkt-button
|
|
1511
1513
|
@click=${a=>this.close(a)}
|
|
1512
1514
|
aria-label="close"
|
|
@@ -1522,19 +1524,19 @@
|
|
|
1522
1524
|
<div class="pkt-modal__container">
|
|
1523
1525
|
<div
|
|
1524
1526
|
id="pkt-modal__content"
|
|
1525
|
-
class=${
|
|
1527
|
+
class=${X(n)}
|
|
1526
1528
|
>${ze(this)}</div>
|
|
1527
1529
|
</div>
|
|
1528
1530
|
</div>
|
|
1529
1531
|
</dialog>
|
|
1530
|
-
`}};Ht([u({type:Boolean,reflect:!0})],Ot.prototype,"open",2),Ht([u({type:String})],Ot.prototype,"headingText",2),Ht([u({type:Boolean})],Ot.prototype,"removePadding",2),Ht([u({type:Boolean})],Ot.prototype,"hideCloseButton",2),Ht([u({type:Boolean})],Ot.prototype,"closeOnBackdropClick",2),Ht([u({type:String})],Ot.prototype,"closeButtonSkin",2),Ht([u({type:String})],Ot.prototype,"size",2),Ht([u({type:String})],Ot.prototype,"variant",2),Ht([u({type:String})],Ot.prototype,"drawerPosition",2),Ht([u({type:Boolean})],Ot.prototype,"transparentBackdrop",2),Ht([
|
|
1532
|
+
`}};Ht([u({type:Boolean,reflect:!0})],Ot.prototype,"open",2),Ht([u({type:String})],Ot.prototype,"headingText",2),Ht([u({type:Boolean})],Ot.prototype,"removePadding",2),Ht([u({type:Boolean})],Ot.prototype,"hideCloseButton",2),Ht([u({type:Boolean})],Ot.prototype,"closeOnBackdropClick",2),Ht([u({type:String})],Ot.prototype,"closeButtonSkin",2),Ht([u({type:String})],Ot.prototype,"size",2),Ht([u({type:String})],Ot.prototype,"variant",2),Ht([u({type:String})],Ot.prototype,"drawerPosition",2),Ht([u({type:Boolean})],Ot.prototype,"transparentBackdrop",2),Ht([he()],Ot.prototype,"_isOpen",2),Ot=Ht([fe("pkt-modal")],Ot);/**
|
|
1531
1533
|
* @license
|
|
1532
1534
|
* Copyright 2018 Google LLC
|
|
1533
1535
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1534
|
-
*/const Eo="important",
|
|
1536
|
+
*/const Eo="important",Pp=" !"+Eo,Ap=bs(class extends sn{constructor(s){var e;if(super(s),s.type!==It.ATTRIBUTE||s.name!=="style"||((e=s.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(s){return Object.keys(s).reduce((e,t)=>{const n=s[t];return n==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`},"")}update(s,[e]){const{style:t}=s.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const n of this.ft)e[n]==null&&(this.ft.delete(n),n.includes("-")?t.removeProperty(n):t[n]=null);for(const n in e){const i=e[n];if(i!=null){this.ft.add(n);const r=typeof i=="string"&&i.endsWith(Pp);n.includes("-")||r?t.setProperty(n,r?i.slice(0,-11):i,r?Eo:""):t[n]=i}}return lt}});var Ip=Object.defineProperty,Lp=Object.getOwnPropertyDescriptor,ot=(s,e,t,n)=>{for(var i=n>1?void 0:n?Lp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Ip(e,t,i),i};let st=class extends At{constructor(){super(),this.ariaLabel=null,this.ariaLabelledby=null,this.ariaValueText=null,this.ariaLive="polite",this.id=ws(),this.role="progressbar",this.skin="dark-blue",this.statusPlacement="following",this.statusType="none",this.title="",this.titlePosition="left",this.valueCurrent=0,this.valueMax=100,this.valueMin=0,this.labelWidth=0,this.progressbarId=this.id,this.computedAriaLabelledby=null,this.computedAriaValueText="",this.labelRef=_e(),this.progressBarRef=_e()}firstUpdated(e){super.firstUpdated(e),this.setComputedValues(),this.syncAttributes()}updated(e){super.updated(e),e.has("valueCurrent")&&this.labelRef.value&&(this.labelWidth=this.labelRef.value.getBoundingClientRect().width||0),e.has("id")&&this.id&&(this.progressBarId=this.id),(e.has("statusType")||e.has("id")||e.has("ariaLabelledby"))&&(this.progressbarId=this.id||ws(),this.computedAriaLabelledby=this.ariaLabelledby||`${this.progressbarId}-title`),(e.has("ariaValueText")||e.has("valueCurrent")||e.has("valueMax"))&&(this.computedAriaValueText=this.statusType==="fraction"&&!this.ariaValueText?`${this.valueCurrent} av ${this.valueMax-this.valueMin}`:this.ariaValueText||""),this.syncAttributes()}render(){const e=this.statusType!=="none",t=this.valueMax-this.valueMin,n=this.valueCurrent/t*100,i=this.statusType==="fraction"?Math.round(n):Math.round((this.valueCurrent-this.valueMin)/(this.valueMax-this.valueMin)*100),r=`${this.valueCurrent} av ${t}`,a=X({"pkt-progressbar__bar":!0,[`pkt-progressbar__bar--${this.skin}`]:!!this.skin}),l=X({"pkt-progressbar__title":!0,"pkt-progressbar__title-center":this.titlePosition==="center"}),c=X({"pkt-progressbar__status":!0,"pkt-progressbar__status--center":this.statusPlacement==="center"}),h=X({"pkt-progressbar__status-placement--following":this.statusPlacement==="following","pkt-progressbar__status-placement--center":this.statusPlacement==="center","pkt-progressbar__status-placement--left":this.statusPlacement==="left"});return y` <div
|
|
1535
1537
|
class="pkt-progressbar__container"
|
|
1536
1538
|
.ref=${this.progressBarRef}
|
|
1537
|
-
style=${
|
|
1539
|
+
style=${Ap({"--pkt-progress-label-width":`${this.labelWidth}px`,"--pkt-progress-width":`${i}%`})}
|
|
1538
1540
|
>
|
|
1539
1541
|
${this.title?y`<p id=${`${this.progressBarId}-title`} class=${l}>${this.title}</p>`:C}
|
|
1540
1542
|
|
|
@@ -1547,7 +1549,7 @@
|
|
|
1547
1549
|
${this.statusType==="percentage"?`${i}%`:r}
|
|
1548
1550
|
</span>
|
|
1549
1551
|
</div>`:C}
|
|
1550
|
-
</div>`}setComputedValues(){this.progressbarId=this.id||ws(),this.computedAriaLabelledby=this.ariaLabelledby||`${this.progressbarId}-title`,this.computedAriaValueText=this.statusType==="fraction"&&!this.ariaValueText?`${this.valueCurrent} av ${this.valueMax-this.valueMin}`:this.ariaValueText||""}syncAttributes(){this._handleAttribute("aria-live",this.ariaLive),this._handleAttribute("aria-valuenow",this.valueCurrent),this._handleAttribute("aria-valuemin",this.valueMin),this._handleAttribute("aria-valuemax",this.valueMax),this._handleAttribute("aria-valuetext",this.computedAriaValueText),this._handleAttribute("aria-label",this.ariaLabel),this._handleAttribute("role",this.role),this._handleAttribute("aria-atomic","true"),this._handleAttribute("id",this.progressbarId),this.ariaLabel||this._handleAttribute("aria-labelledby",this.computedAriaLabelledby)}_handleAttribute(e,t){t==null||t===""?this.removeAttribute(e):this.setAttribute(e,String(t))}};ot([u({type:String})],
|
|
1552
|
+
</div>`}setComputedValues(){this.progressbarId=this.id||ws(),this.computedAriaLabelledby=this.ariaLabelledby||`${this.progressbarId}-title`,this.computedAriaValueText=this.statusType==="fraction"&&!this.ariaValueText?`${this.valueCurrent} av ${this.valueMax-this.valueMin}`:this.ariaValueText||""}syncAttributes(){this._handleAttribute("aria-live",this.ariaLive),this._handleAttribute("aria-valuenow",this.valueCurrent),this._handleAttribute("aria-valuemin",this.valueMin),this._handleAttribute("aria-valuemax",this.valueMax),this._handleAttribute("aria-valuetext",this.computedAriaValueText),this._handleAttribute("aria-label",this.ariaLabel),this._handleAttribute("role",this.role),this._handleAttribute("aria-atomic","true"),this._handleAttribute("id",this.progressbarId),this.ariaLabel||this._handleAttribute("aria-labelledby",this.computedAriaLabelledby)}_handleAttribute(e,t){t==null||t===""?this.removeAttribute(e):this.setAttribute(e,String(t))}};ot([u({type:String})],st.prototype,"ariaLabel",2),ot([u({type:String,reflect:!0})],st.prototype,"ariaLabelledby",2),ot([u({type:String,reflect:!0})],st.prototype,"ariaValueText",2),ot([u({type:String})],st.prototype,"ariaLive",2),ot([u({type:String,reflect:!0})],st.prototype,"id",2),ot([u({type:String})],st.prototype,"role",2),ot([u({type:String})],st.prototype,"skin",2),ot([u({type:String})],st.prototype,"statusPlacement",2),ot([u({type:String})],st.prototype,"statusType",2),ot([u({type:String,reflect:!0})],st.prototype,"title",2),ot([u({type:String})],st.prototype,"titlePosition",2),ot([u({type:Number,reflect:!0})],st.prototype,"valueCurrent",2),ot([u({type:Number})],st.prototype,"valueMax",2),ot([u({type:Number})],st.prototype,"valueMin",2),ot([he()],st.prototype,"labelWidth",2),ot([he()],st.prototype,"progressbarId",2),ot([he()],st.prototype,"computedAriaLabelledby",2),ot([he()],st.prototype,"computedAriaValueText",2),st=ot([fe("pkt-progressbar")],st);var Bp=Object.defineProperty,Fp=Object.getOwnPropertyDescriptor,Et=(s,e,t,n)=>{for(var i=n>1?void 0:n?Fp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Bp(e,t,i),i};let Ct=class extends ie{constructor(){super(...arguments),this.inputRef=_e(),this.value="",this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.checked=null,this.type="radio",this.tagText=null,this.optionalTag=!1,this.optionalText="Valgfritt",this.requiredTag=!1,this.requiredText="Må fylles ut",this._checked=!1}connectedCallback(){super.connectedCallback()}attributeChangedCallback(s,e,t){s==="defaultChecked"&&(this._checked=this.defaultChecked),s==="checked"&&(this._checked=this.checked===""||this.checked==="true"||this.checked===!0),super.attributeChangedCallback(s,e,t)}render(){const s=X({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),e=X({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError}),t=X({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--disabled":this.disabled,"pkt-sr-only":this.hideLabel}),n="pkt-tag pkt-tag--small pkt-tag--thin-text",i=()=>y`
|
|
1551
1553
|
${this.tagText?y`<span class=${n+" pkt-tag--gray"}>${this.tagText}</span>`:C}
|
|
1552
1554
|
${this.optionalTag?y`<span class=${n+" pkt-tag--blue-light"}>${this.optionalText}</span>`:C}
|
|
1553
1555
|
${this.requiredTag?y`<span class=${n+" pkt-tag--beige"}>${this.requiredText}</span>`:C}
|
|
@@ -1577,7 +1579,7 @@
|
|
|
1577
1579
|
${r()}
|
|
1578
1580
|
</div>
|
|
1579
1581
|
</div>
|
|
1580
|
-
`}toggleChecked(s=null){s&&s.preventDefault(),s&&s.stopImmediatePropagation(),this.touched=!0,this.inputRef.value&&(this._checked=this.inputRef.value.matches(":checked"),this.valueChecked(this._checked))}};Et([u({type:String,reflect:!0})],Ct.prototype,"value",2),Et([u({type:String})],Ct.prototype,"checkHelptext",2),Et([u({type:Boolean})],Ct.prototype,"defaultChecked",2),Et([u({type:Boolean})],Ct.prototype,"hasTile",2),Et([u({type:Boolean,reflect:!0})],Ct.prototype,"checked",2),Et([u({type:String,reflect:!0})],Ct.prototype,"type",2),Et([u({type:String})],Ct.prototype,"tagText",2),Et([u({type:Boolean})],Ct.prototype,"optionalTag",2),Et([u({type:String})],Ct.prototype,"optionalText",2),Et([u({type:Boolean})],Ct.prototype,"requiredTag",2),Et([u({type:String})],Ct.prototype,"requiredText",2),Et([
|
|
1582
|
+
`}toggleChecked(s=null){s&&s.preventDefault(),s&&s.stopImmediatePropagation(),this.touched=!0,this.inputRef.value&&(this._checked=this.inputRef.value.matches(":checked"),this.valueChecked(this._checked))}};Et([u({type:String,reflect:!0})],Ct.prototype,"value",2),Et([u({type:String})],Ct.prototype,"checkHelptext",2),Et([u({type:Boolean})],Ct.prototype,"defaultChecked",2),Et([u({type:Boolean})],Ct.prototype,"hasTile",2),Et([u({type:Boolean,reflect:!0})],Ct.prototype,"checked",2),Et([u({type:String,reflect:!0})],Ct.prototype,"type",2),Et([u({type:String})],Ct.prototype,"tagText",2),Et([u({type:Boolean})],Ct.prototype,"optionalTag",2),Et([u({type:String})],Ct.prototype,"optionalText",2),Et([u({type:Boolean})],Ct.prototype,"requiredTag",2),Et([u({type:String})],Ct.prototype,"requiredText",2),Et([he()],Ct.prototype,"_checked",2),Ct=Et([fe("pkt-radiobutton")],Ct);/**
|
|
1581
1583
|
* @license
|
|
1582
1584
|
* Copyright 2021 Google LLC
|
|
1583
1585
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -1593,23 +1595,23 @@
|
|
|
1593
1595
|
* @license
|
|
1594
1596
|
* Copyright 2021 Google LLC
|
|
1595
1597
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1596
|
-
*/class
|
|
1598
|
+
*/class Vp{get value(){return this.o}set value(e){this.setValue(e)}setValue(e,t=!1){const n=t||!Object.is(e,this.o);this.o=e,n&&this.updateObservers()}constructor(e){this.subscriptions=new Map,this.updateObservers=()=>{for(const[t,{disposer:n}]of this.subscriptions)t(this.o,n)},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});const{disposer:i}=this.subscriptions.get(e);e(this.value,i)}clearCallbacks(){this.subscriptions.clear()}}/**
|
|
1597
1599
|
* @license
|
|
1598
1600
|
* Copyright 2021 Google LLC
|
|
1599
1601
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1600
|
-
*/let
|
|
1602
|
+
*/let Hp=class extends Event{constructor(s,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=s,this.contextTarget=e}},Io=class extends Vp{constructor(e,t,n){var i,r;super(t.context!==void 0?t.initialValue:n),this.onContextRequest=a=>{if(a.context!==this.context)return;const l=a.contextTarget??a.composedPath()[0];l!==this.host&&(a.stopPropagation(),this.addCallback(a.callback,l,a.subscribe))},this.onProviderRequest=a=>{if(a.context!==this.context||(a.contextTarget??a.composedPath()[0])===this.host)return;const l=new Set;for(const[c,{consumerHost:h}]of this.subscriptions)l.has(c)||(l.add(c),h.dispatchEvent(new Po(this.context,h,c,!0)));a.stopPropagation()},this.host=e,t.context!==void 0?this.context=t.context:this.context=t,this.attachListeners(),(r=(i=this.host).addController)==null||r.call(i,this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Hp(this.context,this.host))}};/**
|
|
1601
1603
|
* @license
|
|
1602
1604
|
* Copyright 2017 Google LLC
|
|
1603
1605
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1604
|
-
*/function
|
|
1606
|
+
*/function Up({context:s}){return(e,t)=>{const n=new WeakMap;if(typeof t=="object")return{get(){return e.get.call(this)},set(i){return n.get(this).setValue(i),e.set.call(this,i)},init(i){return n.set(this,new Io(this,{context:s,initialValue:i})),i}};{e.constructor.addInitializer((a=>{n.set(a,new Io(a,{context:s}))}));const i=Object.getOwnPropertyDescriptor(e,t);let r;if(i===void 0){const a=new WeakMap;r={get(){return a.get(this)},set(l){n.get(this).setValue(l),a.set(this,l)},configurable:!0,enumerable:!0}}else{const a=i.set;r={...i,set(l){n.get(this).setValue(l),a==null||a.call(this,l)}}}return void Object.defineProperty(e,t,r)}}}/**
|
|
1605
1607
|
* @license
|
|
1606
1608
|
* Copyright 2022 Google LLC
|
|
1607
1609
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1608
|
-
*/function
|
|
1610
|
+
*/function jp({context:s,subscribe:e}){return(t,n)=>{typeof n=="object"?n.addInitializer((function(){new Ao(this,{context:s,callback:i=>{t.set.call(this,i)},subscribe:e})})):t.constructor.addInitializer((i=>{new Ao(i,{context:s,callback:r=>{i[n]=r},subscribe:e})}))}}const Lo=Symbol("pkt-tabs-context");var qp=Object.defineProperty,Wp=Object.getOwnPropertyDescriptor,gn=(s,e,t,n)=>{for(var i=n>1?void 0:n?Wp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&qp(e,t,i),i};let Ys=class extends pt{constructor(){super(...arguments),this.arrowNav=!0,this.disableArrowNav=!1,this.tabRefs=[],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})}registerTab(e,t){this.tabRefs[t]=e,this.tabCount=Math.max(this.tabCount,t+1)}handleClick(e){this.dispatchEvent(new CustomEvent("tab-selected",{detail:{index:e},bubbles:!0,composed:!0}))}handleKeyUp(e,t){var n,i;this.useArrowNav&&(e.code==="ArrowLeft"&&t!==0&&((n=this.tabRefs[t-1])==null||n.focus()),e.code==="ArrowRight"&&t<this.tabCount-1&&((i=this.tabRefs[t+1])==null||i.focus()),(e.code==="ArrowDown"||e.code==="Space")&&this.dispatchEvent(new CustomEvent("tab-selected",{detail:{index:t},bubbles:!0,composed:!0})))}render(){const e=this.useArrowNav?"tablist":"navigation";return y`
|
|
1609
1611
|
<div class="pkt-tabs">
|
|
1610
1612
|
<div class="pkt-tabs__list" role=${e}>${ze(this)}</div>
|
|
1611
1613
|
</div>
|
|
1612
|
-
`}};
|
|
1614
|
+
`}};gn([u({type:Boolean,reflect:!0,attribute:"arrow-nav"})],Ys.prototype,"arrowNav",2),gn([u({type:Boolean,reflect:!0,attribute:"disable-arrow-nav"})],Ys.prototype,"disableArrowNav",2),gn([he()],Ys.prototype,"tabRefs",2),gn([he()],Ys.prototype,"tabCount",2),gn([Up({context:Lo}),he()],Ys.prototype,"context",2),Ys=gn([fe("pkt-tabs")],Ys);var zp=Object.defineProperty,Yp=Object.getOwnPropertyDescriptor,hs=(s,e,t,n)=>{for(var i=n>1?void 0:n?Yp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&zp(e,t,i),i};let ss=class extends pt{constructor(){super(),this.active=!1,this.href="",this.icon="",this.controls="",this.tag="",this.tagSkin="blue",this.index=0,this.elementRef=_e()}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.elementRef.value&&this.context&&this.context.registerTab(this.elementRef.value,this.index)})}handleClick(){this.context&&this.context.handleClick(this.index)}handleKeyUp(e){this.context&&this.context.handleKeyUp(e,this.index)}render(){var e;const t=((e=this.context)==null?void 0:e.useArrowNav)??!0,n=this.active?"active":"",i=t?"tab":void 0,r=t?this.active:void 0,a=this.active||!t?void 0:-1,l=y`
|
|
1613
1615
|
${this.icon?y`<pkt-icon name=${this.icon} class="pkt-icon--small"></pkt-icon>`:""}
|
|
1614
1616
|
<span>${ze(this)}</span>
|
|
1615
1617
|
${this.tag?y`<pkt-tag skin=${this.tagSkin} size="small">${this.tag}</pkt-tag>`:""}
|
|
@@ -1641,11 +1643,11 @@
|
|
|
1641
1643
|
>
|
|
1642
1644
|
${l}
|
|
1643
1645
|
</button>
|
|
1644
|
-
`}};hs([u({type:Boolean,reflect:!0})],ss.prototype,"active",2),hs([u({type:String,reflect:!0})],ss.prototype,"href",2),hs([u({type:String,reflect:!0})],ss.prototype,"icon",2),hs([u({type:String,reflect:!0})],ss.prototype,"controls",2),hs([u({type:String,reflect:!0})],ss.prototype,"tag",2),hs([u({type:String,reflect:!0,attribute:"tag-skin"})],ss.prototype,"tagSkin",2),hs([u({type:Number,reflect:!0})],ss.prototype,"index",2),hs([
|
|
1646
|
+
`}};hs([u({type:Boolean,reflect:!0})],ss.prototype,"active",2),hs([u({type:String,reflect:!0})],ss.prototype,"href",2),hs([u({type:String,reflect:!0})],ss.prototype,"icon",2),hs([u({type:String,reflect:!0})],ss.prototype,"controls",2),hs([u({type:String,reflect:!0})],ss.prototype,"tag",2),hs([u({type:String,reflect:!0,attribute:"tag-skin"})],ss.prototype,"tagSkin",2),hs([u({type:Number,reflect:!0})],ss.prototype,"index",2),hs([jp({context:Lo,subscribe:!0}),u({attribute:!1})],ss.prototype,"context",2),ss=hs([fe("pkt-tab-item")],ss);/**
|
|
1645
1647
|
* @license
|
|
1646
1648
|
* Copyright 2020 Google LLC
|
|
1647
1649
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1648
|
-
*/const
|
|
1650
|
+
*/const Kp=bs(class extends sn{constructor(s){if(super(s),s.type!==It.PROPERTY&&s.type!==It.ATTRIBUTE&&s.type!==It.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!Ea(s))throw Error("`live` bindings can only contain a single expression")}render(s){return s}update(s,[e]){if(e===lt||e===C)return e;const t=s.element,n=s.name;if(s.type===It.PROPERTY){if(e===t[n])return lt}else if(s.type===It.BOOLEAN_ATTRIBUTE){if(!!e===t.hasAttribute(n))return lt}else if(s.type===It.ATTRIBUTE&&t.getAttribute(n)===e+"")return lt;return Aa(s),e}});var Gp=Object.defineProperty,Xp=Object.getOwnPropertyDescriptor,Rn=(s,e,t,n)=>{for(var i=n>1?void 0:n?Xp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Gp(e,t,i),i};let mn=class extends ie{constructor(){super(...arguments),this.inputRef=_e(),this.value="",this.autocomplete="off",this.rows=null,this.counterCurrent=0}attributeChangedCallback(s,e,t){s==="value"&&this.value!==e&&(this.counterCurrent=t?t.length:0,this.valueChanged(t,e)),super.attributeChangedCallback(s,e,t)}updated(s){var e;super.updated(s),s.has("value")&&(this.counterCurrent=((e=this.value)==null?void 0:e.length)||0,this.valueChanged(this.value,s.get("value"))),s.has("id")&&!this.name&&this.id&&(this.name=this.id)}render(){const s=X({"pkt-input":!0,"pkt-input--fullwidth":this.fullwidth,"pkt-input--counter-error":this.counter&&this.counterMaxLength&&this.value.length&&this.value.length>this.counterMaxLength}),e=this.ariaLabelledby||`${this.id}-input-label`;return y`<pkt-input-wrapper
|
|
1649
1651
|
label=${this.label}
|
|
1650
1652
|
?counter=${this.counter}
|
|
1651
1653
|
?disabled=${this.disabled}
|
|
@@ -1675,7 +1677,7 @@
|
|
|
1675
1677
|
id=${this.id+"-input"}
|
|
1676
1678
|
name=${(this.name||this.id)+"-input"}
|
|
1677
1679
|
placeholder=${I(this.placeholder)}
|
|
1678
|
-
.value=${
|
|
1680
|
+
.value=${Kp(this.value)}
|
|
1679
1681
|
minlength=${I(this.minlength)}
|
|
1680
1682
|
maxlength=${I(this.maxlength)}
|
|
1681
1683
|
?readonly=${this.readonly}
|
|
@@ -1690,7 +1692,7 @@
|
|
|
1690
1692
|
@focus=${t=>{this.onFocus(),t.stopImmediatePropagation()}}
|
|
1691
1693
|
@blur=${t=>{this.value=t.target.value,this.onBlur(),t.stopImmediatePropagation()}}
|
|
1692
1694
|
></textarea>
|
|
1693
|
-
</pkt-input-wrapper>`}};Rn([u({type:String,reflect:!0})],
|
|
1695
|
+
</pkt-input-wrapper>`}};Rn([u({type:String,reflect:!0})],mn.prototype,"value",2),Rn([u({type:String})],mn.prototype,"autocomplete",2),Rn([u({type:Number})],mn.prototype,"rows",2),Rn([he()],mn.prototype,"counterCurrent",2),mn=Rn([fe("pkt-textarea")],mn);var Qp=Object.defineProperty,Bo=(s,e,t,n)=>{for(var i=void 0,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=a(e,t,i)||i);return i&&Qp(e,t,i),i};let Pr=class extends ie{constructor(){super(...arguments),this._optionsProp=[],this._options=[]}get options(){return this._options.map(e=>({...e,selected:this.isOptionSelected(e)}))}set options(e){this._optionsProp=e,this.requestUpdate("_optionsProp",this._options)}isOptionSelected(e){return Array.isArray(this.value)?this.value.includes(e.value):e.value===this.value}findOptionByValue(e){return this._options.find(t=>t.value===e)}getSelectedOptions(){return this._options.filter(e=>this.isOptionSelected(e))}parseOptions(){var e,t;const n=this._optionsProp.length>0,i=((t=(e=this.optionsController)==null?void 0:e.nodes)==null?void 0:t.length)&&this.optionsController.nodes.length>0;n?this._options=this._optionsProp:i&&(this._options=this.optionsController.options)}willUpdate(e){super.willUpdate(e),this.parseOptions()}};Bo([u({type:Array,attribute:"options"})],Pr.prototype,"_optionsProp"),Bo([he()],Pr.prototype,"_options");var Zp=Object.defineProperty,Jp=Object.getOwnPropertyDescriptor,Fo=(s,e,t,n)=>{for(var i=n>1?void 0:n?Jp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Zp(e,t,i),i};let Ar=class extends Pr{constructor(){super(),this.inputRef=_e(),this.value="",this.selectedIndex=-1,this.selectedOptions=void 0,this.optionsController=new So(this)}connectedCallback(){super.connectedCallback(),this.parseOptions(),this._options.forEach(s=>{s.selected&&!this.value&&(this.value=s.value)})}add(s,e){const t={value:s.value||s.text,label:s.text||s.value,selected:s.selected,disabled:s.disabled};if(e===void 0)this._options.push(t);else if(typeof e=="number")this._options.splice(e,0,t);else{const n=e.value||e.text,i=this._options.findIndex(r=>r.value===n);i>=0?this._options.splice(i,0,t):this._options.push(t)}s.selected&&(this.value=s.value||s.text,this.selectedIndex=this._options.findIndex(n=>n.value===this.value)),this.requestUpdate()}remove(s){var e;typeof s=="number"&&(this.selectedIndex===s&&(this.value=((e=this._options[0])==null?void 0:e.value)||""),this._options.splice(s,1),this.requestUpdate())}item(s){var e;return(e=this.inputRef.value)==null?void 0:e.item(s)}namedItem(s){var e;return(e=this.inputRef.value)==null?void 0:e.namedItem(s)}showPicker(){this.inputRef.value&&"showPicker"in this.inputRef.value&&this.inputRef.value.showPicker()}attributeChangedCallback(s,e,t){var n,i;s==="options"&&(this._options=t?JSON.parse(t):[]),s==="value"&&this.value!==e&&(this.selectedIndex=this.touched?this.returnNumberOrNull((n=this.inputRef.value)==null?void 0:n.selectedIndex):this._options.findIndex(r=>r.value===t),this.selectedOptions=(i=this.inputRef.value)==null?void 0:i.selectedOptions,this.valueChanged(t,e)),super.attributeChangedCallback(s,e,t)}update(s){var e,t;super.update(s),s.has("_optionsProp")&&this._optionsProp.length>0&&(this._options=this._optionsProp,this.requestUpdate("_options"),!this.value&&this._options.length>0&&(this.value=this._options[0].value,this.selectedIndex=0)),s.has("value")&&this.value!==s.get("value")&&(this.selectedIndex=this.touched?this.returnNumberOrNull((e=this.inputRef.value)==null?void 0:e.selectedIndex):this._options.findIndex(n=>n.value===this.value),this.selectedOptions=(t=this.inputRef.value)==null?void 0:t.selectedOptions,this.valueChanged(this.value,s.get("value"))),s.has("id")&&!this.name&&this.id&&(this.name=this.id)}firstUpdated(s){var e;super.firstUpdated(s),this._optionsProp.length&&(this._options=this._optionsProp),!this.value&&this._options.length>0?(this.value=this._options[0].value,this.selectedIndex=0):this.selectedIndex=this._options.findIndex(t=>t.value===this.value),this.selectedOptions=(e=this.inputRef.value)==null?void 0:e.selectedOptions}render(){const s=`pkt-input ${this.fullwidth?"pkt-input--fullwidth":""}`;return y`
|
|
1694
1696
|
<pkt-input-wrapper
|
|
1695
1697
|
?counter=${this.counter}
|
|
1696
1698
|
?disabled=${this.disabled}
|
|
@@ -1738,8 +1740,8 @@
|
|
|
1738
1740
|
</select>
|
|
1739
1741
|
<div class="pkt-contents" slot="helptext">${ze(this,"helptext")}</div>
|
|
1740
1742
|
</pkt-input-wrapper>
|
|
1741
|
-
`}returnNumberOrNull(s){return s==null||isNaN(s)?null:s}};Fo([u({type:String})],Ar.prototype,"value",2),Ar=Fo([
|
|
1743
|
+
`}returnNumberOrNull(s){return s==null||isNaN(s)?null:s}};Fo([u({type:String})],Ar.prototype,"value",2),Ar=Fo([fe("pkt-select")],Ar);const R=xn({tagName:"pkt-icon",elementClass:Is,react:d,displayName:"PktIcon",events:{}}),Vo=d.forwardRef(({defaultOpen:s=!1,id:e,title:t,skin:n,compact:i=!1,isOpen:r,children:a,name:l,className:c,onClick:h,onToggle:m},g)=>{const[f,k]=d.useState(s),{name:v}=rc(),$=l||v,N=r!==void 0?r:f;d.useEffect(()=>{r===void 0&&k(s)},[s,r]);const x=D=>{const V=D.currentTarget.open;V!==N&&(r===void 0&&k(V),m==null||m(D))},S=D=>{setTimeout(()=>{h==null||h(D)},0)},P=["pkt-accordion-item",i&&"pkt-accordion-item--compact",n&&`pkt-accordion-item--${n}`,c].filter(Boolean).join(" ");return o.jsxs("details",{ref:g,className:P,id:e,open:N,onClick:S,name:$,onToggle:x,children:[o.jsxs("summary",{className:"pkt-accordion-item__title",id:`pkt-accordion-item-summary-${e}`,children:[t,o.jsx(R,{name:"chevron-thin-down",className:"pkt-accordion-item__icon","aria-hidden":"true"})]}),o.jsx("div",{className:"pkt-accordion-item__content",id:`pkt-accordion-item__content-${e}`,role:"region",children:o.jsx("div",{className:"pkt-accordion-item__content-inner",children:a})})]})});Vo.displayName="PktAccordionItem";function Rp(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Ir={exports:{}};/*!
|
|
1742
1744
|
Copyright (c) 2018 Jed Watson.
|
|
1743
1745
|
Licensed under the MIT License (MIT), see
|
|
1744
1746
|
http://jedwatson.github.io/classnames
|
|
1745
|
-
*/var Ho;function Rp(){return Ho||(Ho=1,(function(s){(function(){var e={}.hasOwnProperty;function t(){for(var r="",a=0;a<arguments.length;a++){var l=arguments[a];l&&(r=i(r,n(l)))}return r}function n(r){if(typeof r=="string"||typeof r=="number")return r;if(typeof r!="object")return"";if(Array.isArray(r))return t.apply(null,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var a="";for(var l in r)e.call(r,l)&&r[l]&&(a=i(a,l));return a}function i(r,a){return a?r?r+" "+a:r+a:r}s.exports?(t.default=t,s.exports=t):window.classNames=t})()})(Ir)),Ir.exports}var ef=Rp();const oe=Jp(ef),Bi=({children:s,closeAlert:e,compact:t,title:n,date:i,ariaLive:r,"aria-live":a="polite",role:l="status",skin:c="info",className:h,...g})=>{const[m,f]=d.useState(!1),k={"pkt-alert":!0,"pkt-alert--compact":t,[`pkt-alert--${c}`]:c,"pkt-hide":m},v={"pkt-alert__grid":!0,"pkt-alert__noTitle":!n,"pkt-alert__noDate":!i},$=d.useCallback(()=>{f(!0),g.onClose&&g.onClose(new CustomEvent("close",{detail:{origin:event},bubbles:!0,composed:!0}))},[g.onClose,f]),N=r||a;return o.jsx("div",{...g,"aria-live":N,role:l,className:oe(k,h),children:o.jsxs("div",{className:oe(v),children:[o.jsx(R,{className:"pkt-alert__icon","aria-hidden":"true",name:c==="info"?"alert-information":`alert-${c}`}),e&&o.jsx("div",{className:"pkt-alert__close",children:o.jsx(dt,{tabIndex:0,"aria-label":"close",size:t?"small":"medium",type:"button",skin:"tertiary",iconName:"close",variant:"icon-only",onClick:$,children:o.jsx("span",{className:"sr-only",children:"Lukk"})})}),n&&o.jsx("div",{className:"pkt-alert__title",children:n}),o.jsx("div",{className:"pkt-alert__text",children:s}),i&&o.jsxs("div",{className:"pkt-alert__date",children:["Sist oppdatert: ",i]})]})})};Bi.displayName="PktAlert";const Uo=d.forwardRef(({href:s="/",text:e="Forsiden",ariaLabel:t,renderLink:n,...i},r)=>{const a=o.jsxs(o.Fragment,{children:[o.jsx(R,{className:"pkt-back-link__icon pkt-icon pkt-link__icon",name:"chevron-thin-left","aria-hidden":"true"}),o.jsx("span",{className:"pkt-back-link__text",children:e})]}),l=n||(({href:c,className:h,children:g,props:m})=>o.jsx("a",{href:c,className:h,...m,children:g}));return o.jsx("nav",{className:"pkt-back-link","aria-label":t||"Gå tilbake til forrige side",ref:r,children:l({href:s,className:"pkt-link pkt-link--icon-left",children:a,props:i})})});Uo.displayName="PktBackLink";const jo=d.forwardRef(({breadcrumbs:s,navigationType:e,renderLink:t,className:n,...i},r)=>{const a=s,l=a[a.length-2],c=[n,"pkt-breadcrumbs"].filter(Boolean).join(" "),h=t||(e==="router"?({href:g,className:m,children:f,props:k})=>o.jsx(nc.Link,{to:g,className:m,...k,children:f}):({href:g,className:m,children:f,props:k})=>o.jsx("a",{href:g,className:m,...k,children:f}));return o.jsxs("nav",{ref:r,"aria-label":"brødsmulemeny",className:c,children:[o.jsx("ol",{className:"pkt-breadcrumbs__list pkt-breadcrumbs--desktop",children:a.map((g,m)=>o.jsx("li",{className:"pkt-breadcrumbs__item",children:m===a.length-1?o.jsx("span",{className:"pkt-breadcrumbs__label","aria-current":"true",children:o.jsx("span",{className:"pkt-breadcrumbs__text",children:g.text})}):h({href:g.href,className:"pkt-link pkt-link--icon-right pkt-breadcrumbs__label pkt-breadcrumbs__link",children:o.jsxs(o.Fragment,{children:[o.jsx(R,{className:"pkt-icon pkt-breadcrumbs__icon pkt-link__icon",name:"chevron-thin-right"}),o.jsx("span",{className:"pkt-breadcrumbs__text",children:g.text})]}),props:i})},`breadcrumb-${m}`))}),h({href:l.href,className:"pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile",children:o.jsxs(o.Fragment,{children:[o.jsx(R,{className:"pkt-back-link__icon pkt-icon pkt-link__icon",name:"chevron-thin-left"}),o.jsx("span",{className:"pkt-breadcrumbs__text",children:l.text})]}),props:i})]})});jo.displayName="PktBreadcrumbs",window.pktAnimationPath=window.pktAnimationPath||"https://punkt-cdn.oslo.kommune.no/16.5/animations/";const dt=d.forwardRef(({children:s,className:e,iconName:t="user",secondIconName:n="user",iconPath:i,secondIconPath:r,size:a="medium",fullWidth:l=!1,fullWidthOnMobile:c=!1,skin:h="primary",type:g="button",variant:m="label-only",state:f,color:k,isLoading:v=void 0,disabled:$=void 0,loadingAnimationPath:N=window.pktAnimationPath,...x},T)=>{const P=[e,"pkt-btn",a&&`pkt-btn--${a}`,l&&"pkt-btn--full",c&&"pkt-btn--full-small",h&&`pkt-btn--${h}`,m&&`pkt-btn--${m}`,k&&`pkt-btn--${k}`,f&&`pkt-btn--${f}`,v&&"pkt-btn--isLoading"].filter(Boolean).join(" ");return o.jsxs("button",{...x,"aria-busy":v||void 0,"aria-disabled":$||void 0,disabled:$,className:P,type:g,ref:T,children:[v&&o.jsx(R,{className:"pkt-btn__icon pkt-btn__spinner",name:"spinner-blue",path:N}),m!=="label-only"&&o.jsx(R,{className:"pkt-btn__icon",name:t,...i&&{path:i}}),o.jsx("span",{className:"pkt-btn__text",children:s}),m==="icons-right-and-left"&&o.jsx(R,{className:"pkt-btn__icon",name:n,...r&&{path:r}})]})});dt.displayName="PktButton";const qo=6048e5,tf=864e5,Wo=Symbol.for("constructDateFrom");function ns(s,e){return typeof s=="function"?s(e):s&&typeof s=="object"&&Wo in s?s[Wo](e):s instanceof Date?new s.constructor(e):new Date(e)}function St(s,e){return ns(e||s,s)}function zo(s,e,t){const n=St(s,t==null?void 0:t.in);return isNaN(e)?ns(s,NaN):(e&&n.setDate(n.getDate()+e),n)}let sf={};function Fi(){return sf}function ei(s,e){var l,c,h,g;const t=Fi(),n=(e==null?void 0:e.weekStartsOn)??((c=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??t.weekStartsOn??((g=(h=t.locale)==null?void 0:h.options)==null?void 0:g.weekStartsOn)??0,i=St(s,e==null?void 0:e.in),r=i.getDay(),a=(r<n?7:0)+r-n;return i.setDate(i.getDate()-a),i.setHours(0,0,0,0),i}function Vi(s,e){return ei(s,{...e,weekStartsOn:1})}function Yo(s,e){const t=St(s,e==null?void 0:e.in),n=t.getFullYear(),i=ns(t,0);i.setFullYear(n+1,0,4),i.setHours(0,0,0,0);const r=Vi(i),a=ns(t,0);a.setFullYear(n,0,4),a.setHours(0,0,0,0);const l=Vi(a);return t.getTime()>=r.getTime()?n+1:t.getTime()>=l.getTime()?n:n-1}function Ko(s){const e=St(s),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+s-+t}function Go(s,...e){const t=ns.bind(null,e.find(n=>typeof n=="object"));return e.map(t)}function Lr(s,e){const t=St(s,e==null?void 0:e.in);return t.setHours(0,0,0,0),t}function nf(s,e,t){const[n,i]=Go(t==null?void 0:t.in,s,e),r=Lr(n),a=Lr(i),l=+r-Ko(r),c=+a-Ko(a);return Math.round((l-c)/tf)}function rf(s,e){const t=Yo(s,e),n=ns(s,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),Vi(n)}function af(s){return s instanceof Date||typeof s=="object"&&Object.prototype.toString.call(s)==="[object Date]"}function of(s){return!(!af(s)&&typeof s!="number"||isNaN(+St(s)))}function lf(s,e){const t=St(s,e==null?void 0:e.in);return t.setHours(23,59,59,999),t}function cf(s,e){const[t,n]=Go(s,e.start,e.end);return{start:t,end:n}}function Xo(s,e){const{start:t,end:n}=cf(e==null?void 0:e.in,s);let i=+t>+n;const r=i?+t:+n,a=i?n:t;a.setHours(0,0,0,0);let l=1;const c=[];for(;+a<=r;)c.push(ns(t,a)),a.setDate(a.getDate()+l),a.setHours(0,0,0,0);return i?c.reverse():c}function uf(s,e){const t=St(s,e==null?void 0:e.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}const df={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"}},hf=(s,e,t)=>{let n;const i=df[s];return typeof i=="string"?n=i:e===1?n=i.one:n=i.other.replace("{{count}}",e.toString()),t!=null&&t.addSuffix?t.comparison&&t.comparison>0?"in "+n:n+" ago":n};function Br(s){return(e={})=>{const t=e.width?String(e.width):s.defaultWidth;return s.formats[t]||s.formats[s.defaultWidth]}}const pf={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},ff={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},gf={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},mf={date:Br({formats:pf,defaultWidth:"full"}),time:Br({formats:ff,defaultWidth:"full"}),dateTime:Br({formats:gf,defaultWidth:"full"})},bf={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},vf=(s,e,t,n)=>bf[s];function ti(s){return(e,t)=>{const n=t!=null&&t.context?String(t.context):"standalone";let i;if(n==="formatting"&&s.formattingValues){const a=s.defaultFormattingWidth||s.defaultWidth,l=t!=null&&t.width?String(t.width):a;i=s.formattingValues[l]||s.formattingValues[a]}else{const a=s.defaultWidth,l=t!=null&&t.width?String(t.width):s.defaultWidth;i=s.values[l]||s.values[a]}const r=s.argumentCallback?s.argumentCallback(e):e;return i[r]}}const kf={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},yf={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},_f={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"]},wf={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"]},$f={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"}},xf={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"}},Cf={ordinalNumber:(s,e)=>{const t=Number(s),n=t%100;if(n>20||n<10)switch(n%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},era:ti({values:kf,defaultWidth:"wide"}),quarter:ti({values:yf,defaultWidth:"wide",argumentCallback:s=>s-1}),month:ti({values:_f,defaultWidth:"wide"}),day:ti({values:wf,defaultWidth:"wide"}),dayPeriod:ti({values:$f,defaultWidth:"wide",formattingValues:xf,defaultFormattingWidth:"wide"})};function si(s){return(e,t={})=>{const n=t.width,i=n&&s.matchPatterns[n]||s.matchPatterns[s.defaultMatchWidth],r=e.match(i);if(!r)return null;const a=r[0],l=n&&s.parsePatterns[n]||s.parsePatterns[s.defaultParseWidth],c=Array.isArray(l)?Tf(l,m=>m.test(a)):Sf(l,m=>m.test(a));let h;h=s.valueCallback?s.valueCallback(c):c,h=t.valueCallback?t.valueCallback(h):h;const g=e.slice(a.length);return{value:h,rest:g}}}function Sf(s,e){for(const t in s)if(Object.prototype.hasOwnProperty.call(s,t)&&e(s[t]))return t}function Tf(s,e){for(let t=0;t<s.length;t++)if(e(s[t]))return t}function Nf(s){return(e,t={})=>{const n=e.match(s.matchPattern);if(!n)return null;const i=n[0],r=e.match(s.parsePattern);if(!r)return null;let a=s.valueCallback?s.valueCallback(r[0]):r[0];a=t.valueCallback?t.valueCallback(a):a;const l=e.slice(i.length);return{value:a,rest:l}}}const Mf=/^(\d+)(th|st|nd|rd)?/i,Df=/\d+/i,Of={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},Ef={any:[/^b/i,/^(a|c)/i]},Pf={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Af={any:[/1/i,/2/i,/3/i,/4/i]},If={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},Lf={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]},Bf={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},Ff={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]},Vf={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},Hf={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}},Uf={ordinalNumber:Nf({matchPattern:Mf,parsePattern:Df,valueCallback:s=>parseInt(s,10)}),era:si({matchPatterns:Of,defaultMatchWidth:"wide",parsePatterns:Ef,defaultParseWidth:"any"}),quarter:si({matchPatterns:Pf,defaultMatchWidth:"wide",parsePatterns:Af,defaultParseWidth:"any",valueCallback:s=>s+1}),month:si({matchPatterns:If,defaultMatchWidth:"wide",parsePatterns:Lf,defaultParseWidth:"any"}),day:si({matchPatterns:Bf,defaultMatchWidth:"wide",parsePatterns:Ff,defaultParseWidth:"any"}),dayPeriod:si({matchPatterns:Vf,defaultMatchWidth:"any",parsePatterns:Hf,defaultParseWidth:"any"})},jf={code:"en-US",formatDistance:hf,formatLong:mf,formatRelative:vf,localize:Cf,match:Uf,options:{weekStartsOn:0,firstWeekContainsDate:1}};function qf(s,e){const t=St(s,e==null?void 0:e.in);return nf(t,uf(t))+1}function Wf(s,e){const t=St(s,e==null?void 0:e.in),n=+Vi(t)-+rf(t);return Math.round(n/qo)+1}function Qo(s,e){var g,m,f,k;const t=St(s,e==null?void 0:e.in),n=t.getFullYear(),i=Fi(),r=(e==null?void 0:e.firstWeekContainsDate)??((m=(g=e==null?void 0:e.locale)==null?void 0:g.options)==null?void 0:m.firstWeekContainsDate)??i.firstWeekContainsDate??((k=(f=i.locale)==null?void 0:f.options)==null?void 0:k.firstWeekContainsDate)??1,a=ns((e==null?void 0:e.in)||s,0);a.setFullYear(n+1,0,r),a.setHours(0,0,0,0);const l=ei(a,e),c=ns((e==null?void 0:e.in)||s,0);c.setFullYear(n,0,r),c.setHours(0,0,0,0);const h=ei(c,e);return+t>=+l?n+1:+t>=+h?n:n-1}function zf(s,e){var l,c,h,g;const t=Fi(),n=(e==null?void 0:e.firstWeekContainsDate)??((c=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??t.firstWeekContainsDate??((g=(h=t.locale)==null?void 0:h.options)==null?void 0:g.firstWeekContainsDate)??1,i=Qo(s,e),r=ns((e==null?void 0:e.in)||s,0);return r.setFullYear(i,0,n),r.setHours(0,0,0,0),ei(r,e)}function Zo(s,e){const t=St(s,e==null?void 0:e.in),n=+ei(t,e)-+zf(t,e);return Math.round(n/qo)+1}function Se(s,e){const t=s<0?"-":"",n=Math.abs(s).toString().padStart(e,"0");return t+n}const Ss={y(s,e){const t=s.getFullYear(),n=t>0?t:1-t;return Se(e==="yy"?n%100:n,e.length)},M(s,e){const t=s.getMonth();return e==="M"?String(t+1):Se(t+1,2)},d(s,e){return Se(s.getDate(),e.length)},a(s,e){const t=s.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];case"aaaa":default:return t==="am"?"a.m.":"p.m."}},h(s,e){return Se(s.getHours()%12||12,e.length)},H(s,e){return Se(s.getHours(),e.length)},m(s,e){return Se(s.getMinutes(),e.length)},s(s,e){return Se(s.getSeconds(),e.length)},S(s,e){const t=e.length,n=s.getMilliseconds(),i=Math.trunc(n*Math.pow(10,t-3));return Se(i,e.length)}},vn={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Jo={G:function(s,e,t){const n=s.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(n,{width:"abbreviated"});case"GGGGG":return t.era(n,{width:"narrow"});case"GGGG":default:return t.era(n,{width:"wide"})}},y:function(s,e,t){if(e==="yo"){const n=s.getFullYear(),i=n>0?n:1-n;return t.ordinalNumber(i,{unit:"year"})}return Ss.y(s,e)},Y:function(s,e,t,n){const i=Qo(s,n),r=i>0?i:1-i;if(e==="YY"){const a=r%100;return Se(a,2)}return e==="Yo"?t.ordinalNumber(r,{unit:"year"}):Se(r,e.length)},R:function(s,e){const t=Yo(s);return Se(t,e.length)},u:function(s,e){const t=s.getFullYear();return Se(t,e.length)},Q:function(s,e,t){const n=Math.ceil((s.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return Se(n,2);case"Qo":return t.ordinalNumber(n,{unit:"quarter"});case"QQQ":return t.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(n,{width:"wide",context:"formatting"})}},q:function(s,e,t){const n=Math.ceil((s.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return Se(n,2);case"qo":return t.ordinalNumber(n,{unit:"quarter"});case"qqq":return t.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(n,{width:"wide",context:"standalone"})}},M:function(s,e,t){const n=s.getMonth();switch(e){case"M":case"MM":return Ss.M(s,e);case"Mo":return t.ordinalNumber(n+1,{unit:"month"});case"MMM":return t.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(n,{width:"wide",context:"formatting"})}},L:function(s,e,t){const n=s.getMonth();switch(e){case"L":return String(n+1);case"LL":return Se(n+1,2);case"Lo":return t.ordinalNumber(n+1,{unit:"month"});case"LLL":return t.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(n,{width:"wide",context:"standalone"})}},w:function(s,e,t,n){const i=Zo(s,n);return e==="wo"?t.ordinalNumber(i,{unit:"week"}):Se(i,e.length)},I:function(s,e,t){const n=Wf(s);return e==="Io"?t.ordinalNumber(n,{unit:"week"}):Se(n,e.length)},d:function(s,e,t){return e==="do"?t.ordinalNumber(s.getDate(),{unit:"date"}):Ss.d(s,e)},D:function(s,e,t){const n=qf(s);return e==="Do"?t.ordinalNumber(n,{unit:"dayOfYear"}):Se(n,e.length)},E:function(s,e,t){const n=s.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(n,{width:"short",context:"formatting"});case"EEEE":default:return t.day(n,{width:"wide",context:"formatting"})}},e:function(s,e,t,n){const i=s.getDay(),r=(i-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(r);case"ee":return Se(r,2);case"eo":return t.ordinalNumber(r,{unit:"day"});case"eee":return t.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(i,{width:"short",context:"formatting"});case"eeee":default:return t.day(i,{width:"wide",context:"formatting"})}},c:function(s,e,t,n){const i=s.getDay(),r=(i-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(r);case"cc":return Se(r,e.length);case"co":return t.ordinalNumber(r,{unit:"day"});case"ccc":return t.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(i,{width:"narrow",context:"standalone"});case"cccccc":return t.day(i,{width:"short",context:"standalone"});case"cccc":default:return t.day(i,{width:"wide",context:"standalone"})}},i:function(s,e,t){const n=s.getDay(),i=n===0?7:n;switch(e){case"i":return String(i);case"ii":return Se(i,e.length);case"io":return t.ordinalNumber(i,{unit:"day"});case"iii":return t.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(n,{width:"short",context:"formatting"});case"iiii":default:return t.day(n,{width:"wide",context:"formatting"})}},a:function(s,e,t){const i=s.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(s,e,t){const n=s.getHours();let i;switch(n===12?i=vn.noon:n===0?i=vn.midnight:i=n/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(s,e,t){const n=s.getHours();let i;switch(n>=17?i=vn.evening:n>=12?i=vn.afternoon:n>=4?i=vn.morning:i=vn.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(s,e,t){if(e==="ho"){let n=s.getHours()%12;return n===0&&(n=12),t.ordinalNumber(n,{unit:"hour"})}return Ss.h(s,e)},H:function(s,e,t){return e==="Ho"?t.ordinalNumber(s.getHours(),{unit:"hour"}):Ss.H(s,e)},K:function(s,e,t){const n=s.getHours()%12;return e==="Ko"?t.ordinalNumber(n,{unit:"hour"}):Se(n,e.length)},k:function(s,e,t){let n=s.getHours();return n===0&&(n=24),e==="ko"?t.ordinalNumber(n,{unit:"hour"}):Se(n,e.length)},m:function(s,e,t){return e==="mo"?t.ordinalNumber(s.getMinutes(),{unit:"minute"}):Ss.m(s,e)},s:function(s,e,t){return e==="so"?t.ordinalNumber(s.getSeconds(),{unit:"second"}):Ss.s(s,e)},S:function(s,e){return Ss.S(s,e)},X:function(s,e,t){const n=s.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return el(n);case"XXXX":case"XX":return Ks(n);case"XXXXX":case"XXX":default:return Ks(n,":")}},x:function(s,e,t){const n=s.getTimezoneOffset();switch(e){case"x":return el(n);case"xxxx":case"xx":return Ks(n);case"xxxxx":case"xxx":default:return Ks(n,":")}},O:function(s,e,t){const n=s.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Ro(n,":");case"OOOO":default:return"GMT"+Ks(n,":")}},z:function(s,e,t){const n=s.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Ro(n,":");case"zzzz":default:return"GMT"+Ks(n,":")}},t:function(s,e,t){const n=Math.trunc(+s/1e3);return Se(n,e.length)},T:function(s,e,t){return Se(+s,e.length)}};function Ro(s,e=""){const t=s>0?"-":"+",n=Math.abs(s),i=Math.trunc(n/60),r=n%60;return r===0?t+String(i):t+String(i)+e+Se(r,2)}function el(s,e){return s%60===0?(s>0?"-":"+")+Se(Math.abs(s)/60,2):Ks(s,e)}function Ks(s,e=""){const t=s>0?"-":"+",n=Math.abs(s),i=Se(Math.trunc(n/60),2),r=Se(n%60,2);return t+i+e+r}const tl=(s,e)=>{switch(s){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},sl=(s,e)=>{switch(s){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Yf={p:sl,P:(s,e)=>{const t=s.match(/(P+)(p+)?/)||[],n=t[1],i=t[2];if(!i)return tl(s,e);let r;switch(n){case"P":r=e.dateTime({width:"short"});break;case"PP":r=e.dateTime({width:"medium"});break;case"PPP":r=e.dateTime({width:"long"});break;case"PPPP":default:r=e.dateTime({width:"full"});break}return r.replace("{{date}}",tl(n,e)).replace("{{time}}",sl(i,e))}},Kf=/^D+$/,Gf=/^Y+$/,Xf=["D","DD","YY","YYYY"];function Qf(s){return Kf.test(s)}function Zf(s){return Gf.test(s)}function Jf(s,e,t){const n=Rf(s,e,t);if(console.warn(n),Xf.includes(s))throw new RangeError(n)}function Rf(s,e,t){const n=s[0]==="Y"?"years":"days of the month";return`Use \`${s.toLowerCase()}\` instead of \`${s}\` (in \`${e}\`) for formatting ${n} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const eg=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,tg=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,sg=/^'([^]*?)'?$/,ng=/''/g,ig=/[a-zA-Z]/;function rg(s,e,t){var g,m,f,k;const n=Fi(),i=n.locale??jf,r=n.firstWeekContainsDate??((m=(g=n.locale)==null?void 0:g.options)==null?void 0:m.firstWeekContainsDate)??1,a=n.weekStartsOn??((k=(f=n.locale)==null?void 0:f.options)==null?void 0:k.weekStartsOn)??0,l=St(s,t==null?void 0:t.in);if(!of(l))throw new RangeError("Invalid time value");let c=e.match(tg).map(v=>{const $=v[0];if($==="p"||$==="P"){const N=Yf[$];return N(v,i.formatLong)}return v}).join("").match(eg).map(v=>{if(v==="''")return{isToken:!1,value:"'"};const $=v[0];if($==="'")return{isToken:!1,value:ag(v)};if(Jo[$])return{isToken:!0,value:v};if($.match(ig))throw new RangeError("Format string contains an unescaped latin alphabet character `"+$+"`");return{isToken:!1,value:v}});i.localize.preprocessor&&(c=i.localize.preprocessor(l,c));const h={firstWeekContainsDate:r,weekStartsOn:a,locale:i};return c.map(v=>{if(!v.isToken)return v.value;const $=v.value;(Zf($)||Qf($))&&Jf($,e,String(s));const N=Jo[$[0]];return N(l,$,i.localize,h)}).join("")}function ag(s){const e=s.match(sg);return e?e[1].replace(ng,"'"):s}function og(s,e){const t=St(s,e==null?void 0:e.in).getDay();return t===0?7:t}function lg(s,e,t="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:s,timeZoneName:t}).format(e).split(/\s/g).slice(2).join(" ")}const Fr={},ni={};function Gs(s,e){try{const n=(Fr[s]||(Fr[s]=new Intl.DateTimeFormat("en-US",{timeZone:s,timeZoneName:"longOffset"}).format))(e).split("GMT")[1];return n in ni?ni[n]:nl(n,n.split(":"))}catch{if(s in ni)return ni[s];const t=s==null?void 0:s.match(cg);return t?nl(s,t.slice(1)):NaN}}const cg=/([+-]\d\d):?(\d\d)?/;function nl(s,e){const t=+(e[0]||0),n=+(e[1]||0),i=+(e[2]||0)/60;return ni[s]=t*60+n>0?t*60+n+i:t*60-n-i}class is extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(Gs(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),rl(this),Vr(this)):this.setTime(Date.now())}static tz(e,...t){return t.length?new is(...t,e):new is(Date.now(),e)}withTimeZone(e){return new is(+this,e)}getTimezoneOffset(){const e=-Gs(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),Vr(this),+this}[Symbol.for("constructDateFrom")](e){return new is(+new Date(e),this.timeZone)}}const il=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(s=>{if(!il.test(s))return;const e=s.replace(il,"$1UTC");is.prototype[e]&&(s.startsWith("get")?is.prototype[s]=function(){return this.internal[e]()}:(is.prototype[s]=function(){return Date.prototype[e].apply(this.internal,arguments),ug(this),+this},is.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),Vr(this),+this}))});function Vr(s){s.internal.setTime(+s),s.internal.setUTCSeconds(s.internal.getUTCSeconds()-Math.round(-Gs(s.timeZone,s)*60))}function ug(s){Date.prototype.setFullYear.call(s,s.internal.getUTCFullYear(),s.internal.getUTCMonth(),s.internal.getUTCDate()),Date.prototype.setHours.call(s,s.internal.getUTCHours(),s.internal.getUTCMinutes(),s.internal.getUTCSeconds(),s.internal.getUTCMilliseconds()),rl(s)}function rl(s){const e=Gs(s.timeZone,s),t=e>0?Math.floor(e):Math.ceil(e),n=new Date(+s);n.setUTCHours(n.getUTCHours()-1);const i=-new Date(+s).getTimezoneOffset(),r=-new Date(+n).getTimezoneOffset(),a=i-r,l=Date.prototype.getHours.apply(s)!==s.internal.getUTCHours();a&&l&&s.internal.setUTCMinutes(s.internal.getUTCMinutes()+a);const c=i-t;c&&Date.prototype.setUTCMinutes.call(s,Date.prototype.getUTCMinutes.call(s)+c);const h=new Date(+s);h.setUTCSeconds(0);const g=i>0?h.getSeconds():(h.getSeconds()-60)%60,m=Math.round(-(Gs(s.timeZone,s)*60))%60;(m||g)&&(s.internal.setUTCSeconds(s.internal.getUTCSeconds()+m),Date.prototype.setUTCSeconds.call(s,Date.prototype.getUTCSeconds.call(s)+m+g));const f=Gs(s.timeZone,s),k=f>0?Math.floor(f):Math.ceil(f),$=-new Date(+s).getTimezoneOffset()-k,N=k!==t,x=$-c;if(N&&x){Date.prototype.setUTCMinutes.call(s,Date.prototype.getUTCMinutes.call(s)+x);const T=Gs(s.timeZone,s),P=T>0?Math.floor(T):Math.ceil(T),D=k-P;D&&(s.internal.setUTCMinutes(s.internal.getUTCMinutes()+D),Date.prototype.setUTCMinutes.call(s,Date.prototype.getUTCMinutes.call(s)+D))}}class Ts extends is{static tz(e,...t){return t.length?new Ts(...t,e):new Ts(Date.now(),e)}toISOString(){const[e,t,n]=this.tzComponents(),i=`${e}${t}:${n}`;return this.internal.toISOString().slice(0,-1)+i}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,t,n,i]=this.internal.toUTCString().split(" ");return`${e==null?void 0:e.slice(0,-1)} ${n} ${t} ${i}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[t,n,i]=this.tzComponents();return`${e} GMT${t}${n}${i} (${lg(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:(t==null?void 0:t.timeZone)||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:(t==null?void 0:t.timeZone)||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:(t==null?void 0:t.timeZone)||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),t=e>0?"-":"+",n=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),i=String(Math.abs(e)%60).padStart(2,"0");return[t,n,i]}withTimeZone(e){return new Ts(+this,e)}[Symbol.for("constructDateFrom")](e){return new Ts(+new Date(e),this.timeZone)}}window.pktTz=window.pktTz===void 0?"Europe/Oslo":window.pktTz;const dg=(s=window.pktTz)=>{const e=new Ts(new Date().toISOString(),s);return e.setHours(0,0,0,0),isNaN(e.getTime())?new Date:new Date(e.getFullYear(),e.getMonth(),e.getDate())};function rs(s){if(!s||s==="")return new Date;if(/^\d{4}-\d{2}-\d{2}$/.test(s)){const[e,t,n]=s.split("-").map(Number);return new Date(e,t-1,n)}if(/^\d{4}-\d{2}$/.test(s)){const[e,t]=s.split("-").map(Number);return new Date(e,t-1,1)}return/^\d{4}$/.test(s)?new Date(Number(s),0,1):new Date(s)}const bt=s=>{if(!s||isNaN(s.getTime()))return"";const e=s.getFullYear(),t=String(s.getMonth()+1).padStart(2,"0"),n=String(s.getDate()).padStart(2,"0");return`${e}-${t}-${n}`},ii=s=>{if(!s)return null;const e=rs(s);return isNaN(e.getTime())?null:e},hg=(s,e)=>{const t=ps(s);return isNaN(t.getTime())?"":rg(t,e)},ps=(s="",e)=>{const t=typeof s=="string"?rs(s):s;return!t||isNaN(t.getTime())?new Date:e?e==="end"?lf(t):Lr(t):t},kn=(s,e,t=1)=>{if(typeof s!="number"||typeof e!="number"||typeof t!="number"||isNaN(s)||isNaN(e)||isNaN(t))return new Date;const n=new Date(s,e,t);return isNaN(n.getTime())?new Date:n},ri=s=>{let e;return typeof s=="number"?e=new Ts(s,window.pktTz):e=new Ts(s,window.pktTz),e.setHours(12,0,0,0),e};let Hr=null,al;const pg=s=>{if(!s||isNaN(s.getTime()))return"";const e=typeof window<"u"?window.pktTz:void 0;return(!Hr||al!==e)&&(Hr=new Intl.DateTimeFormat("no",{dateStyle:"full",timeZone:e}),al=e),Hr.format(s)},fg=(s,e,t)=>{if(!s||isNaN(s.getTime()))return!1;const n=e?ps(e):null,i=t?ps(t):null;return!(n&&s<n||i&&s>i)},gg=(s,e)=>{if(!s||isNaN(s.getTime())||!Array.isArray(e))return!1;const t=bt(s);return e.includes(t)},mg=(s,e)=>{if(!s||isNaN(s.getTime())||!Array.isArray(e))return!1;const t=s.getDay().toString();return e.includes(t)},ol=(s,e,t,n,i)=>!(!s||isNaN(s.getTime())||!fg(s,e,t)||n&&gg(s,n)||i&&mg(s,i)),bg=(s,e,t,n,i)=>s.filter(r=>{const a=ii(r);return a&&ol(a,e,t,n,i)}),vg=s=>s.slice().sort((e,t)=>{const n=ii(e),i=ii(t);return!n||!i?0:n.getTime()-i.getTime()}),kg=(s,e)=>{const t=ii(s),n=ii(e);return!t||!n?!1:t<=n};function ll(s,e){const t=(e.excludedates??[]).map(n=>typeof n=="string"?n:bt(n));return!ol(s,e.earliest,e.latest,t,e.excludeweekdays??[])}function yg(s,e,t,n){return!!(ll(s,t)||!e&&n.multiple&&n.maxMultiple>0&&n.selectedCount>=n.maxMultiple)}function _g(s,e,t){const n=kn(s,e,0);return!(t&&ps(t)>n)}function wg(s,e,t){const n=kn(e===11?s+1:s,e===11?0:e+1,1);return!(t&&ps(t)<n)}function cl(s){return typeof s=="string"&&(s=s.split(",")),s.length===1&&s[0]===""?[]:s.map(e=>rs(e))}function ul(s,e){const t=Xo({start:s,end:e}),n={};if(Array.isArray(t)&&t.length)for(let i=0;i<t.length;i++){const r=t[i],a=r>s&&r<e;n[bt(r)]=a}return n}function dl(s,e,t,n){if(e.length!==1)return!0;const i=Xo({start:e[0],end:s});if(!Array.isArray(i)||!i.length)return!0;for(let r=0;r<i.length;r++){for(const a of t??[])if(a>e[0]&&a<s)return!1;if((n??[]).includes(og(i[r]).toString()))return!1}return!0}function Ur(s,e){const t=bt(s);return e.includes(t)?e:[...e,t]}function jr(s,e){const t=bt(s),n=e.indexOf(t);if(n===-1)return e;if(e.length===1)return[];const i=[...e];return i.splice(n,1),i}function hl(s,e,t){const n=bt(s);return e.includes(n)?jr(s,e):t>0&&e.length>=t?e:Ur(s,e)}function $g(s,e,t){const n=bt(s),i=cl(e);if(e.includes(n))return e.indexOf(n)===0?[]:jr(s,e);if(e.length>1)return[n];if(e.length===1){if(!dl(s,i,t.excludedates,t.excludeweekdays))return[n];if(i[0]>s)return[n]}return Ur(s,e)}const ai=7,xg=6;function Cg(s,e){const t=kn(s,e,1),n=kn(s,e+1,0),i=(t.getDay()+xg)%ai,r=n.getDate(),a=Math.ceil((r+i)/ai),c=kn(s,e,0).getDate(),h=Zo(t);return{firstDayOfMonth:t,lastDayOfMonth:n,startingDay:i,numDays:r,numRows:a,numDaysPrevMonth:c,initialWeek:h}}function Sg(s,e,t,n){const{startingDay:i,numDays:r}=n;return s===0&&e<i?"prev-month":t>r?"next-month":"current-month"}function Tg(s,e,t,n){const{startingDay:i,numDaysPrevMonth:r,numDays:a}=n;return s==="prev-month"?r-(i-e-1):s==="next-month"?t-a:t}const Ng={ArrowLeft:-1,ArrowRight:1,ArrowUp:-ai,ArrowDown:ai};function Mg(s){var t;const e=s.nodeName;return e==="INPUT"||e==="SELECT"||e==="BUTTON"&&!((t=s.dataset)!=null&&t.date)}function Dg(s,e,t){let n=zo(s,e);if(!n)return null;let i=t(`button[data-date="${bt(n)}"]`);for(;i instanceof HTMLButtonElement&&i.dataset.disabled;)if(n=zo(n,e),i=t(`button[data-date="${bt(n)}"]`),!i)return null;return n}function Og(s){return Ng[s]??null}const Eg={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 Pg(s){const{selected:e,multiple:t=!1,maxMultiple:n=0,range:i=!1,earliest:r=null,latest:a=null,excludedates:l,excludeweekdays:c=[],weeknumbers:h=!1,withcontrols:g=!1,currentmonth:m,today:f,strings:k,onDateSelected:v,onClose:$,id:N,className:x}=s,T=d.useId(),P=N??T,D=d.useMemo(()=>({...Eg,...k}),[k]),j=d.useMemo(()=>f?rs(f):dg(),[f]),H=d.useMemo(()=>l?l.map(b=>typeof b=="string"?rs(b):b):[],[l]),X=e!==void 0,[fe,q]=d.useState([]),M=X?e:fe,z=d.useMemo(()=>cl(M),[M]),[L,Q]=d.useState(0),[ae,ee]=d.useState(0),[ue,le]=d.useState({}),[be,ne]=d.useState(null),[re,Ue]=d.useState(null),Z=d.useRef(null),A=d.useRef([]),Me=d.useRef(0),De=d.useRef(!1),te=d.useRef(!1),Ie=d.useMemo(()=>({earliest:r,latest:a,excludedates:H,excludeweekdays:c}),[r,a,H,c]);d.useEffect(()=>{let b=null;if(m!=null&&(m instanceof Date?b=ri(m):typeof m=="string"&&(b=rs(m))),!b||isNaN(b.getTime()))if(M.length>0&&M[0]!==""){const p=rs(M[M.length-1]);b=isNaN(p.getTime())?ri(j):p}else b=ri(j);if((!b||isNaN(b.getTime()))&&(b=ri(j)),a){const p=typeof a=="string"?rs(a):a;!isNaN(p.getTime())&&b>p&&(b=p)}if(r){const p=typeof r=="string"?rs(r):r;!isNaN(p.getTime())&&b<p&&(b=p)}Q(b.getFullYear()),ee(b.getMonth()),te.current=!0},[]),d.useEffect(()=>{if(te.current&&!De.current&&M.length>0&&M[0]!==""){const b=rs(M[M.length-1]);isNaN(b.getTime())||(Q(b.getFullYear()),ee(b.getMonth()))}},[M]),d.useEffect(()=>{i&&z.length===2?le(ul(z[0],z[1])):(!i||z.length<2)&&le({})},[i,z]);const Ee=d.useCallback(b=>{X||q(b),v==null||v(b)},[X,v]),ye=d.useCallback(()=>{$==null||$()},[$]),Te=d.useCallback((b,p)=>{Q(typeof b=="string"?parseInt(b):b),ee(typeof p=="string"?parseInt(p):p),Me.current=0,Ue(null),A.current=[],De.current=!0},[]),Pe=d.useCallback(()=>{const b=ae===0?11:ae-1,p=ae===0?L-1:L;Te(p,b)},[L,ae,Te]),je=d.useCallback(()=>{const b=ae===11?0:ae+1,p=ae===11?L+1:L;Te(p,b)},[L,ae,Te]),Ae=d.useCallback(b=>ll(b,Ie),[Ie]),ve=d.useCallback((b,p)=>yg(b,p,Ie,{multiple:t,maxMultiple:n,selectedCount:M.length}),[Ie,t,n,M.length]),E=d.useCallback(()=>typeof M=="string"?M.split(","):M,[M]),Le=d.useCallback(b=>{if(!i||z.length!==1||!dl(b,z,H,c)||z[0]>=b){ne(null);return}ne(b),le(ul(z[0],b))},[i,z,H,c]),Ye=d.useCallback(b=>{if(!b)return;let p;if(i)p=$g(b,E(),{excludedates:H,excludeweekdays:c}),X||q(p),p.length===2?(v==null||v(p),ye()):(p.length===1&&le({}),v==null||v(p));else if(t)p=hl(b,E(),n),Ee(p);else{const _=bt(b);M.includes(_)?p=[]:p=[_],Ee(p),ye()}},[i,t,n,E,M,H,c,X,Ee,ye,v]),U=d.useCallback(b=>{const p=Ur(b,E());X||q(p),i&&p.length===2&&(v==null||v(p),ye())},[E,X,i,v,ye]),V=d.useCallback(b=>{const p=jr(b,E());X||q(p)},[E,X]),se=d.useCallback(b=>{const p=hl(b,E(),n);X||q(p)},[E,n,X]),me=d.useCallback(()=>{var S,Y;const b=bt(ri(j)),p=(S=Z.current)==null?void 0:S.querySelector(`button[data-date="${b}"]`);if(p instanceof HTMLButtonElement){Ue(b),p.focus();return}const _=A.current.find(K=>!K.isDisabled);if(_){const K=(Y=Z.current)==null?void 0:Y.querySelector(`button[data-date="${_.currentDateISO}"]`);K instanceof HTMLButtonElement&&(Ue(_.currentDateISO),K.focus())}},[]),ge=d.useCallback((b,p)=>{const _=b.target;if(Mg(_))return;if(b.preventDefault(),!re){me();return}const S=ps(re),Y=Dg(S,p,Z.current.querySelector.bind(Z.current));if(Y){const K=Z.current.querySelector(`button[data-date="${bt(Y)}"]`);K instanceof HTMLButtonElement&&!K.dataset.disabled&&(Ue(bt(Y)),K.focus())}},[re,me]),Xe=d.useCallback(b=>{if(b.key==="Escape"){b.preventDefault(),ye();return}const p=Og(b.key);p!==null&&ge(b.nativeEvent,p)},[ye,ge]),Ke=d.useCallback(b=>{Z.current&&!Z.current.contains(b.relatedTarget)&&!b.target.classList.contains("pkt-hide")&&ye()},[ye]);return{componentId:P,strings:D,todayDate:j,year:L,month:ae,activeSelected:M,_selected:z,inRange:ue,rangeHovered:be,focusedDate:re,range:i,multiple:t,weeknumbers:h,withcontrols:g,earliest:r,latest:a,excludedates:H,excludeweekdays:c,className:x,dateConstraints:Ie,calendarRef:Z,selectableDatesRef:A,tabIndexSetRef:Me,prevMonth:Pe,nextMonth:je,changeMonth:Te,handleDateSelect:Ye,addToSelected:U,removeFromSelected:V,toggleSelectedDate:se,handleRangeHover:Le,isExcluded:Ae,isDayDisabled:ve,focusOnCurrentDate:me,handleKeydown:Xe,handleFocusOut:Ke,close:ye,setFocusedDate:Ue}}const Ag=({componentId:s,strings:e,year:t,month:n,earliest:i,latest:r,withcontrols:a,prevMonth:l,nextMonth:c,changeMonth:h})=>{const g=f=>{const k=f==="prev",v=k?_g(t,n,i):wg(t,n,r),$=k?e.prevMonth:e.nextMonth,N=k?"chevron-thin-left":"chevron-thin-right",x=k?"pkt-calendar__prev-month":"pkt-calendar__next-month",T=k?l:c;return o.jsx("div",{children:o.jsxs("button",{type:"button","aria-label":$,onClick:()=>v&&T(),onKeyDown:P=>{(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),v&&T())},className:["pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only",x,!v&&"pkt-invisible"].filter(Boolean).join(" "),"data-disabled":v?void 0:"disabled","aria-disabled":!v||void 0,tabIndex:v?0:-1,children:[o.jsx(R,{className:"pkt-btn__icon",name:N}),o.jsx("span",{className:"pkt-btn__text",children:$})]})})},m=()=>a?o.jsxs("div",{className:"pkt-cal-month-picker",children:[o.jsx("label",{htmlFor:`${s}-monthnav`,className:"pkt-hide",children:e.month}),o.jsx("select",{"aria-label":e.month,className:"pkt-input pkt-input-compact",id:`${s}-monthnav`,value:n,onChange:f=>{f.stopPropagation(),h(t,parseInt(f.target.value))},children:e.months.map((f,k)=>o.jsx("option",{value:k,children:f},k))}),o.jsx("label",{htmlFor:`${s}-yearnav`,className:"pkt-hide",children:e.year}),o.jsx("input",{"aria-label":e.year,className:"pkt-input pkt-cal-input-year pkt-input-compact",id:`${s}-yearnav`,type:"number",size:4,placeholder:"0000",value:t,onChange:f=>{f.stopPropagation(),h(parseInt(f.target.value),n)}})]}):o.jsxs("div",{className:"pkt-txt-16-medium pkt-calendar__month-title","aria-live":"polite",children:[e.months[n]," ",t]});return o.jsxs("nav",{className:"pkt-cal-month-nav",children:[g("prev"),m(),g("next")]})};function Ig(s,e,t){const n=kn(t.year,t.month,s),i=bt(n),r=i===bt(e),a=t.activeSelected.includes(i),l=t.isDayDisabled(n,a);let c;return t.focusedDate?c=t.focusedDate===i&&!l?"0":"-1":!l&&t.tabIndexSetRef.current===0?(t.tabIndexSetRef.current=s,c="0"):c=t.tabIndexSetRef.current===s?"0":"-1",{currentDate:n,currentDateISO:i,isToday:r,isSelected:a,isDisabled:l,ariaLabel:pg(n),tabindex:c}}function Lg(s,e){const{currentDateISO:t,isToday:n,isSelected:i}=s,r=e.range&&(e.activeSelected.length===2||e.rangeHovered!==null)&&t===e.activeSelected[0],a=e.range&&e.activeSelected.length===2&&t===e.activeSelected[1];return oe({"pkt-cal-today":n,"pkt-cal-selected":i,"pkt-cal-in-range":e.inRange[t],"pkt-cal-excluded":e.isExcluded(s.currentDate),"pkt-cal-in-range-first":r,"pkt-cal-in-range-last":a,"pkt-cal-range-hover":e.rangeHovered!==null&&t===bt(e.rangeHovered)})}function Bg(s,e){const{currentDateISO:t,isToday:n,isSelected:i,isDisabled:r}=s,a=e.range&&(e.activeSelected.length===2||e.rangeHovered!==null)&&t===e.activeSelected[0],l=e.range&&e.activeSelected.length===2&&t===e.activeSelected[1];return oe({"pkt-calendar__date":!0,"pkt-calendar__date--today":n,"pkt-calendar__date--selected":i,"pkt-calendar__date--disabled":r,"pkt-calendar__date--in-range":e.inRange[t],"pkt-calendar__date--in-range-hover":e.rangeHovered!==null&&t===bt(e.rangeHovered),"pkt-calendar__date--range-start":a,"pkt-calendar__date--range-end":l})}const Fg=({state:s})=>{const{strings:e,year:t,month:n,activeSelected:i,focusedDate:r,inRange:a,rangeHovered:l,range:c,multiple:h,weeknumbers:g,selectableDatesRef:m,tabIndexSetRef:f,handleDateSelect:k,handleRangeHover:v,isExcluded:$,isDayDisabled:N,setFocusedDate:x,todayDate:T}=s,P={year:t,month:n,activeSelected:i,focusedDate:r,tabIndexSetRef:f,isDayDisabled:N},D={range:c,activeSelected:i,rangeHovered:l,inRange:a,isExcluded:$},j=()=>{const q=[];g&&q.push(o.jsx("th",{children:o.jsx("div",{className:"pkt-calendar__week-number",children:e.week})},"week-header"));for(let M=0;M<e.daysShort.length;M++)q.push(o.jsx("th",{children:o.jsx("div",{className:"pkt-calendar__day-name","aria-label":e.days[M],children:e.daysShort[M]})},`day-${M}`));return o.jsx("tr",{className:"pkt-cal-week-row",children:q})},H=(q,M)=>{const z=Ig(q,M,P),{currentDate:L,currentDateISO:Q,isSelected:ae,isDisabled:ee,ariaLabel:ue,tabindex:le}=z;m.current.push({currentDateISO:Q,isDisabled:ee,tabindex:le});const be=Lg(z,D),ne=Bg(z,D);return o.jsx("td",{className:be,children:o.jsx("button",{type:"button","aria-pressed":ae?"true":"false",disabled:ee,className:`pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only ${ne}`,onMouseOver:()=>c&&!$(L)&&v(L),onFocus:()=>{c&&!$(L)&&v(L),x(Q)},"aria-label":ue,tabIndex:parseInt(le),"data-disabled":ee?"disabled":void 0,"data-date":Q,onKeyDown:re=>{(re.key==="Enter"||re.key===" ")&&(re.preventDefault(),k(L))},onClick:re=>{ee||(re.preventDefault(),k(L))},children:o.jsx("span",{className:"pkt-btn__text pkt-txt-14-light",children:q})})},Q)},X=(q,M)=>o.jsx("td",{className:"pkt-cal-other",children:o.jsx("div",{className:"pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only","data-disabled":"disabled",children:o.jsx("span",{className:"pkt-btn__text pkt-txt-14-light",children:q})})},M),fe=()=>{const q=T,M=Cg(t,n);m.current=[],f.current=0;let z=1,L=M.initialWeek;const Q=[];for(let ae=0;ae<M.numRows;ae++){const ee=[];g&&ee.push(o.jsx("td",{className:"pkt-cal-week",children:L},`week-${L}`)),L++;for(let ue=0;ue<ai;ue++){const le=Sg(ae,ue,z,M);if(le==="current-month")ee.push(H(z,q)),z++;else{const be=Tg(le,ue,z,M);ee.push(X(be,`${le}-${ae}-${ue}`)),le==="next-month"&&z++}}Q.push(o.jsx("tr",{className:"pkt-cal-week-row",role:"row",children:ee},`row-${ae}`))}return Q};return o.jsxs("table",{className:"pkt-cal-days pkt-txt-12-medium pkt-calendar__body",role:"grid","aria-multiselectable":c||h||void 0,children:[o.jsx("thead",{children:j()}),o.jsx("tbody",{children:fe()})]})},qr=d.forwardRef((s,e)=>{const t=Pg(s);return d.useImperativeHandle(e,()=>({handleDateSelect:t.handleDateSelect,addToSelected:t.addToSelected,removeFromSelected:t.removeFromSelected,toggleSelected:t.toggleSelectedDate,focusOnCurrentDate:t.focusOnCurrentDate,close:t.close}),[t.handleDateSelect,t.addToSelected,t.removeFromSelected,t.toggleSelectedDate,t.focusOnCurrentDate,t.close]),o.jsxs("div",{ref:t.calendarRef,className:["pkt-calendar",t.weeknumbers&&"pkt-cal-weeknumbers",t.className].filter(Boolean).join(" "),onBlur:t.handleFocusOut,onKeyDown:t.handleKeydown,children:[o.jsx(Ag,{componentId:t.componentId,strings:t.strings,year:t.year,month:t.month,earliest:t.earliest,latest:t.latest,withcontrols:t.withcontrols,prevMonth:t.prevMonth,nextMonth:t.nextMonth,changeMonth:t.changeMonth}),o.jsx(Fg,{state:t})]})});qr.displayName="PktCalendar";const Ns=d.forwardRef(({children:s,skin:e,textStyle:t,size:n,closeTag:i,className:r,iconName:a,ariaLabel:l,onClose:c,type:h,"aria-description":g,...m},f)=>{const[k,v]=d.useState(!1),$=d.useCallback(()=>{v(!0),c&&c()},[c]),N=d.useRef(null),[x,T]=d.useState("");d.useEffect(()=>{var H,X;T(((X=(H=N.current)==null?void 0:H.textContent)==null?void 0:X.trim())??"")},[s]);const P=d.useMemo(()=>{if(i&&!l)return x&&`Klikk for å fjerne ${x}`||g},[i,l,x,g]),D={"pkt-tag":!0,[`pkt-tag--${n}`]:!!n,[`pkt-tag--${e}`]:!!e,[`pkt-tag--${t}`]:!!t},j={"pkt-tag":!0,"pkt-btn":!0,"pkt-btn--tertiary":!0,[`pkt-tag--${t}`]:!!t,[`pkt-tag--${n}`]:!!n,[`pkt-tag--${e}`]:!!e,"pkt-btn--icons-right-and-left":i&&!!a,"pkt-hide":k};return i?o.jsxs("button",{...m,className:oe(j,r),type:h,onClick:$,"aria-label":l,"aria-description":P,ref:f,children:[a&&o.jsx(R,{className:"pkt-tag__icon",name:a}),o.jsx("span",{ref:N,children:s}),o.jsx(R,{className:"pkt-tag__close-btn",name:"close"})]}):o.jsxs("span",{...m,className:oe(D,r),ref:f,children:[a&&o.jsx(R,{className:"pkt-tag__icon",name:a,"aria-hidden":"true"}),o.jsx("span",{ref:N,children:s})]})});Ns.displayName="PktTag";const pl=d.forwardRef(({children:s,className:e,ariaLabel:t,metaLead:n,borderOnHover:i=!0,metaTrail:r,layout:a="vertical",heading:l="",headingLevel:c=3,image:h,imageShape:g="square",clickCardLink:m,padding:f="default",openLinkInNewTab:k=!1,skin:v="outlined",subheading:$="",tagPosition:N="top",tags:x=[],...T},P)=>{const D=oe({"pkt-card":!0,[`pkt-card--${v}`]:v,[`pkt-card--${a}`]:a,[`pkt-card--padding-${f}`]:f,"pkt-card--border-on-hover":i}),j=(t==null?void 0:t.trim())||(l?`${l} lenkekort`:"lenkekort"),H=(t==null?void 0:t.trim())||l||"kort",X=`h${c}`,fe=()=>h!=null&&h.src?o.jsx("div",{className:oe("pkt-card__image",`pkt-card__image-${g}`),children:o.jsx("img",{src:h.src,alt:h.alt||""})}):null,q=()=>x.length===0?null:o.jsx("div",{className:oe("pkt-card__tags",`pkt-card__tags-${N}`),role:"list","aria-label":x.length>1?"merkelapper":"merkelapp",children:x.map((ee,ue)=>o.jsx(Ns,{role:"listitem",textStyle:"normal-text",size:"medium",skin:ee.skin,iconName:ee.iconName,children:o.jsx("span",{children:ee.text})},ue))}),M=()=>!l||m?null:o.jsx(X,{className:"pkt-heading pkt-heading--medium pkt-heading--fw-regular pkt-card__heading",children:l}),z=()=>m?o.jsx(X,{className:"pkt-heading pkt-heading--medium pkt-heading--fw-regular pkt-card__link-heading pkt-card__heading",children:o.jsx("a",{className:"pkt-card__link",href:m,target:k?"_blank":"_self",rel:k?"noopener noreferrer":void 0,children:l})}):null,L=()=>$?o.jsx("p",{className:"pkt-card__subheading",children:$}):null,Q=()=>!l&&!$?null:o.jsxs("header",{className:"pkt-card__header",children:[M(),z(),L()]}),ae=()=>!n&&!r?null:o.jsxs("footer",{className:"pkt-card__metadata",children:[n&&o.jsx("span",{className:"pkt-card__metadata-lead",children:n}),r&&o.jsx("span",{className:"pkt-card__metadata-trail",children:r})]});return o.jsx("div",{ref:P,className:oe("pkt-card-root",e),style:{display:"block",width:"100%"},children:o.jsxs("article",{...T,className:D,"aria-label":m?j:H,children:[fe(),o.jsxs("div",{className:"pkt-card__wrapper",children:[N==="top"&&q(),Q(),o.jsx("section",{className:"pkt-card__content",children:s}),N==="bottom"&&q(),ae()]})]})})});pl.displayName="PktCard";const fl=d.forwardRef(({id:s,hasTile:e=!1,disabled:t=!1,label:n,checkHelptext:i,hasError:r=!1,className:a,isSwitch:l=!1,hideLabel:c=!1,labelPosition:h="right",defaultChecked:g,checked:m,indeterminate:f,optionalTag:k,optionalText:v="Valgfritt",requiredTag:$,requiredText:N="Må fylles ut",tagText:x,...T},P)=>{const D=d.useRef(null);d.useEffect(()=>{D.current&&f!==void 0&&(D.current.indeterminate=f)},[f]),d.useEffect(()=>{typeof P=="function"?P(D.current):P&&(P.current=D.current)},[P]);const j=[a,"pkt-input-check"].filter(Boolean).join(" "),H=["pkt-input-check__input-label",t?"pkt-input-check__input-label--disabled":"",`pkt-input-check__input-label--${h}`,c?"pkt-sr-only":""].filter(Boolean).join(" "),X=["pkt-input-check__input",e?"pkt-input-check__input--tile":"",t&&e?"pkt-input-check__input--tile-disabled":""].filter(Boolean).join(" "),fe=["pkt-tag","pkt-tag--small","pkt-tag--thin-text"].join(" "),q=()=>o.jsxs(o.Fragment,{children:[x&&o.jsx("span",{className:fe+" pkt-tag--gray",children:x}),k&&o.jsx("span",{className:fe+" pkt-tag--blue-light",children:v}),$&&o.jsx("span",{className:fe+" pkt-tag--beige",children:N})]});return o.jsx("div",{className:j,children:o.jsxs("div",{className:X,children:[h==="left"&&o.jsxs("label",{className:H,htmlFor:s,children:[n," ",q(),i&&o.jsx("div",{className:"pkt-input-check__input-helptext",children:i})]}),o.jsx("input",{role:l?"switch":"checkbox",ref:D,className:`pkt-input-check__input-checkbox ${r?"pkt-input-check__input-checkbox--error":""}`,type:"checkbox",id:s,disabled:t,...m!==void 0?{checked:m}:{defaultChecked:g},...T}),h==="right"&&o.jsxs("label",{className:H,htmlFor:s,children:[n," ",q(),i&&o.jsx("div",{className:"pkt-input-check__input-helptext",children:i})]})]})})});fl.displayName="PktCheckbox";const Ms=d.forwardRef(({forId:s,label:e,helptext:t,helptextDropdown:n,helptextDropdownButton:i,counter:r,counterCurrent:a=0,counterMaxLength:l,optionalTag:c=!1,optionalText:h="Valgfritt",requiredTag:g=!1,requiredText:m="Må fylles ut",tagText:f=null,hasError:k=!1,errorMessage:v,disabled:$=!1,inline:N=!1,ariaDescribedby:x,useWrapper:T=!0,children:P,className:D="",hasFieldset:j=!1,role:H="group",counterPosition:X="bottom"},fe)=>{const[q,M]=d.useState(!1),z=x||(t?`${s}-helptext`:void 0),L=!!r,Q=L&&X==="top",ae=L&&X==="bottom",ee=()=>M(A=>!A),ue=["pkt-inputwrapper",D,k?"pkt-inputwrapper--error":"",$?"pkt-inputwrapper--disabled":"",N?"pkt-inputwrapper--inline":""].filter(Boolean).join(" "),le=["pkt-tag","pkt-tag--small","pkt-tag--thin-text"].join(" "),be=()=>L?o.jsxs("div",{className:"pkt-input__counter","aria-live":"polite","aria-atomic":"true",children:[a,l?`/${l}`:""]}):null,ne=()=>o.jsxs(o.Fragment,{children:[f&&o.jsx("span",{className:le+" pkt-tag--gray",children:f}),c&&o.jsx("span",{className:le+" pkt-tag--blue-light",children:h}),g&&o.jsx("span",{className:le+" pkt-tag--beige",children:m})]}),re=()=>{const A=o.jsxs(o.Fragment,{children:[e," ",ne()]});return T?j?o.jsx("legend",{className:"pkt-inputwrapper__legend",id:`${s}-label`,children:A}):o.jsx("label",{className:"pkt-inputwrapper__label",htmlFor:s,"aria-describedby":z,id:`${s}-label`,children:A}):o.jsx("label",{htmlFor:s,className:"pkt-sr-only","aria-describedby":z,id:`${s}-label`,children:e})},Ue=()=>!t&&!n?null:o.jsxs(o.Fragment,{children:[t&&T&&o.jsx("div",{className:"pkt-inputwrapper__helptext",id:`${s}-helptext`,children:t}),n&&o.jsxs("div",{className:"pkt-inputwrapper__helptext-expandable",children:[o.jsx(dt,{skin:"tertiary",size:"small",variant:"icon-right",iconName:q?"chevron-thin-up":"chevron-thin-down",className:"pkt-link pkt-link--icon-right",onClick:ee,children:o.jsx("span",{dangerouslySetInnerHTML:{__html:i??'Les mer <span class="pkt-sr-only">om inputfeltet</span>'}})}),o.jsx("div",{className:`pkt-inputwrapper__helptext ${q?"pkt-inputwrapper__helptext-expandable-open":"pkt-inputwrapper__helptext-expandable-closed"}`,children:n})]})]}),Z=o.jsxs(o.Fragment,{children:[re(),Ue(),Q&&o.jsx(be,{}),P,ae&&o.jsx(be,{}),k&&v&&o.jsx("div",{className:"pkt-inputwrapper__alert-wrapper",children:o.jsx(Bi,{skin:"error","aria-live":"assertive",role:"alert",id:`${s}-error`,compact:!0,children:v})})]});return o.jsx("div",{className:ue,ref:fe,role:H,children:j?o.jsx("fieldset",{className:"pkt-inputwrapper__fieldset","aria-describedby":z,children:Z}):o.jsx("div",{className:"pkt-inputwrapper__fieldset",children:Z})})});Ms.displayName="PktInputWrapper";const fs=(s,e)=>e&&(s.find(t=>t.value===e)||s.find(t=>t.label===e))||null,Vg=(s,e)=>{if(!e)return-1;const t=s.findIndex(n=>n.value===e);return t>=0?t:s.findIndex(n=>n.label===e)},Hg=(s,e)=>{if(!e)return[...s];const t=e.toLowerCase();return s.filter(n=>(n.fulltext||n.value+(n.label||"")+(n.prefix||"")).toLowerCase().includes(t))},Hi=s=>s.value+(s.label||"")+(s.prefix||""),Ui=(s,e)=>e!==null&&s>=e,gl=(s,e)=>{if(!s)return"";switch(e){case"prefixAndValue":return`${s.prefix||""} ${s.value}`.trim();case"value":return s.value;case"label":default:return s.label||s.value}},Wr=(s,e)=>s?Array.isArray(s)?e?s:s.length>0?[s[0]]:[]:e?s.split(",").filter(Boolean):[s]:[],ml=(s,e)=>{if(!e)return{filtered:[...s],suggestion:null};const t=e.toLowerCase(),n=s.filter(r=>{var a;return(a=r.fulltext)==null?void 0:a.toLowerCase().includes(t)}),i=n.find(r=>{var a;return!r.selected&&((a=r.label)==null?void 0:a.toLowerCase().startsWith(t))})||null;return{filtered:n,suggestion:i}},Ug=(s,e,t,n)=>{if(!s.trim())return{addValueText:null,userInfoMessage:""};const i=s.trim().toLowerCase(),r=e.find(c=>c.toLowerCase()===i),a=t.filter(c=>{var h;return((h=c.label)==null?void 0:h.toLowerCase().includes(i))||c.value.toLowerCase().includes(i)}),l=a.find(c=>{var h;return((h=c.label)==null?void 0:h.toLowerCase())===i||c.value.toLowerCase()===i});return(a.length===0||!l)&&n?{addValueText:s,userInfoMessage:""}:a.length===0&&!n?{addValueText:null,userInfoMessage:"Ingen treff i søket"}:r?{addValueText:null,userInfoMessage:"Verdien er allerede valgt"}:{addValueText:null,userInfoMessage:""}},jg=(s,e,t)=>{switch(s){case",":return t?"addValue":null;case"Enter":return"addValue";case"Tab":case"ArrowDown":return e?null:"focusListbox";case"Escape":return"closeOptions";default:return null}},qg=(s,e,t,n,i)=>{if(!s)return{action:"none",value:null};const r=fs(t,s);return!e.includes(s)&&!r?n?{action:"addUserValue",value:s}:i?{action:"none",value:null}:{action:"removeValue",value:e[0]}:r&&!e.includes(r.value)?{action:"selectOption",value:r.value}:{action:"none",value:null}},ji=(s,e,t)=>{const n=fs(e,s);return t==="label"&&(n!=null&&n.label)?n.label:s},Xs=s=>{s.scrollIntoView({block:"nearest"}),window.setTimeout(()=>s.focus(),0)},bl=s=>Array.from(s.querySelectorAll('[role="option"]:not([data-disabled])')||[]),Wg=s=>{const e=s.nextElementSibling;e&&Xs(e)},vl=(s,e,t)=>{const n=s.previousElementSibling;if(s.dataset.index==="0"&&t){const i=e.querySelector('[role="searchbox"]');i&&Xs(i)}else n&&Xs(n)},zg=s=>{const e=bl(s);e[0]&&Xs(e[0])},qi=(s,e)=>{if(e.disabled)return;const t=bl(s);if(e.allowUserInput&&e.customUserInput){const i=s.querySelector('[data-type="new-option"]');if(i){Xs(i);return}}const n=t.find(i=>i.dataset.selected==="true");if(n){Xs(n);return}if(e.includeSearch&&!(document.activeElement instanceof HTMLInputElement)){const i=s.querySelector('[role="searchbox"]');if(i){window.setTimeout(()=>i.focus(),0);return}}t[0]&&Xs(t[0])},kl=({state:s,outside:e=!1})=>{const{values:t,options:n,disabled:i,displayValueAs:r,handleTagRemove:a,handleTagKeydown:l,focusedTagIndex:c}=s,h=d.useRef([]);if(d.useEffect(()=>{var f;!e&&c>=0&&c<t.length&&((f=h.current[c])==null||f.focus())},[e,c,t.length]),t.length===0)return null;const g=(f,k)=>{const v=fs(n,f),$=v==null?void 0:v.tagSkinColor,N=v?gl(v,r):f;return i?o.jsx("li",{role:"listitem",children:o.jsx(Ns,{skin:$||"blue-dark",children:o.jsx("span",{className:"pkt-combobox__value",children:N})})},f):e?o.jsx("li",{role:"listitem",children:o.jsx(Ns,{skin:$||"blue-dark",closeTag:!0,onClose:()=>a(f),children:o.jsx("span",{className:"pkt-combobox__value",children:N})})},f):o.jsx("li",{role:"listitem",onClick:x=>x.stopPropagation(),onMouseDown:x=>x.preventDefault(),children:o.jsx(Ns,{ref:x=>{h.current[k]=x},skin:$||"blue-dark",closeTag:!0,tabIndex:c===k?0:-1,onClose:()=>a(f),onKeyDown:x=>l(x,k),children:o.jsx("span",{className:"pkt-combobox__value",children:N})})},f)},m=t.map(g);return e?o.jsx("div",{className:"pkt-combobox__tags-outside",children:o.jsx("ul",{role:"list",className:"pkt-combobox__tag-list",children:m})}):o.jsx("ul",{role:"list",className:"pkt-combobox__tag-list",children:m})},Yg=({state:s})=>{const{values:e,options:t,editingSingleValue:n,displayValueAs:i}=s;if(n||e.length===0)return null;const r=fs(t,e[0]);if(!r)return null;const a=gl(r,i);return o.jsx("span",{className:"pkt-combobox__value",children:a})},Kg=({state:s})=>{const{id:e,inputId:t,listboxId:n,values:i,options:r,isOpen:a,multiple:l,typeahead:c,allowUserInput:h,tagPlacement:g,placeholder:m,disabled:f,fullwidth:k,hasError:v,label:$,inputFocus:N,inputRef:x,triggerRef:T,handleInputChange:P,handleInputKeydown:D,handleInputFocus:j,handleInputBlur:H,handleInputClick:X,handlePlaceholderClick:fe,handleSelectOnlyKeydown:q,name:M}=s,z=["pkt-combobox__input",k&&"pkt-combobox__input--fullwidth",a&&"pkt-combobox__input--open",v&&"pkt-combobox__input--error",f&&"pkt-combobox__input--disabled"].filter(Boolean).join(" "),L=["pkt-combobox__arrow-icon",a&&"pkt-combobox__arrow-icon--open"].filter(Boolean).join(" "),Q=c||h,ae=!Q&&m&&(!i.length||l&&g==="outside")&&!N,ee=g!=="outside",ue=i[0]&&fs(r,i[0])?`${n}-${Vg(r,i[0])}`:void 0,le=l&&i.length>0?`${i.length} valgt`:void 0,be=Q?{tabIndex:-1}:{id:`${e}-combobox`,role:"combobox","aria-expanded":a?"true":"false","aria-controls":n,"aria-haspopup":"listbox","aria-labelledby":`${e}-combobox-label`,"aria-activedescendant":ue,"aria-description":le,tabIndex:f?-1:0,onKeyDown:q};return o.jsxs("div",{ref:T,className:z,onClick:X,...be,children:[ae?o.jsx("span",{className:"pkt-combobox__placeholder",onClick:fe,children:m}):ee?l?o.jsx(kl,{state:s}):Q?null:o.jsx(Yg,{state:s}):null,Q?o.jsx("div",{className:"pkt-combobox__input-div combobox__input",children:o.jsx("input",{ref:x,type:"text",id:t,name:`${M||e}-input`,onChange:P,onKeyDown:D,onFocus:j,onBlur:H,placeholder:!i.length||l&&g==="outside"?m:void 0,autoComplete:"off",role:"combobox","aria-expanded":a?"true":"false","aria-label":$,"aria-autocomplete":c?"both":h?"list":"none","aria-controls":n,"aria-activedescendant":ue,"aria-description":le,disabled:f})}):o.jsx("input",{ref:x,type:"hidden",id:t,name:`${M||e}-input`,value:i.join(","),readOnly:!0}),o.jsx(R,{className:L,name:"chevron-thin-down","aria-hidden":"true"})]})},Gg=({state:s})=>{const{listboxId:e,label:t,isOpen:n,options:i,filteredOptions:r,multiple:a,disabled:l,maxIsReached:c,maxlength:h,includeSearch:g,allowUserInput:m,addValueText:f,userInfoMessage:k,searchPlaceholder:v,searchValue:$,handleOptionClick:N,handleOptionKeydown:x,handleSearchInput:T,handleSearchKeydown:P,handleNewOptionClick:D,handleNewOptionKeydown:j,listboxRef:H}=s,X=r.filter(L=>L.selected).length,fe=a&&X>0&&h!=null&&h>0,q=m&&f&&!c,M=!!k,z=["pkt-listbox",n&&"pkt-listbox__open","pkt-txt-16-light"].filter(Boolean).join(" ");return o.jsxs(o.Fragment,{children:[o.jsxs("div",{ref:H,id:e,className:z,role:r.length>0?"listbox":void 0,"aria-label":r.length>0?`Liste: ${t||""}`:void 0,"aria-multiselectable":r.length>0&&a?"true":void 0,children:[o.jsxs("div",{className:"pkt-listbox__banners",children:[g&&o.jsxs("div",{className:"pkt-listbox__search",children:[o.jsx("span",{className:"pkt-listbox__search-icon",children:o.jsx(R,{name:"magnifying-glass-small"})}),o.jsx("input",{className:"pkt-txt-16-light",type:"text","aria-label":"Søk i listen",form:"",placeholder:v||"Søk...",onChange:T,onKeyDown:P,value:$,"data-type":"searchbox",disabled:l,readOnly:l,role:"searchbox"})]}),fe&&o.jsxs("div",{className:"pkt-listbox__banner pkt-listbox__banner--maximum-reached",children:[X," av maks ",h," mulige er valgt."]}),M&&o.jsxs("div",{className:"pkt-listbox__banner pkt-listbox__banner--user-message",children:[o.jsx(R,{className:"pkt-listbox__banner-icon",name:"exclamation-mark-circle"}),k]}),q&&o.jsxs("div",{className:"pkt-listbox__banner pkt-listbox__banner--new-option pkt-listbox__option","data-type":"new-option","data-value":f,"data-selected":"false",tabIndex:0,onClick:()=>D(f),onKeyDown:j,children:[o.jsx(R,{className:"pkt-listbox__banner-icon",name:"plus-sign"}),'Legg til "',f,'"']}),i.length===0&&r.length===0&&!M&&o.jsxs("div",{className:"pkt-listbox__banner pkt-listbox__banner--empty",children:[o.jsx(R,{className:"pkt-listbox__banner-icon",name:"exclamation-mark-circle"}),"Tom liste"]})]}),o.jsx("ul",{className:"pkt-listbox__options",role:"presentation",children:r.map((L,Q)=>{const ae=["pkt-listbox__option",!a&&L.selected&&"pkt-listbox__option--selected",a&&"pkt-listbox__option--checkBox"].filter(Boolean).join(" "),ee=l||L.disabled||c&&!L.selected;return o.jsxs("li",{className:ae,onClick:()=>N(L.value),onKeyDown:ue=>x(ue,L.value),"aria-selected":L.selected?"true":"false",tabIndex:ee?-1:0,"data-index":Q,"data-value":L.value,"data-selected":L.selected?"true":"false","data-disabled":ee||void 0,"aria-disabled":ee?"true":"false",role:"option",id:`${e}-${Q}`,children:[a?o.jsx("input",{className:"pkt-input-check__input-checkbox",type:"checkbox",tabIndex:-1,value:L.value,checked:L.selected||!1,readOnly:!0,"aria-hidden":"true",disabled:ee}):L.selected?o.jsx(R,{name:"check-big"}):null,o.jsxs("span",{className:"pkt-listbox__option-label",id:`${e}-option-label-${Q}`,children:[L.prefix&&o.jsx("span",{className:"pkt-listbox__option-prefix",children:L.prefix}),L.label||L.value]}),L.description&&o.jsx("span",{className:"pkt-listbox__option-description pkt-txt-14-light",children:L.description})]},`${L.value}-${Q}`)})})]}),o.jsx("div",{"aria-live":"polite",className:"pkt-visually-hidden",children:k})]})};function Xg(s,e){return s.map(t=>({...t,label:t.label||t.value,fulltext:Hi(t),selected:e.includes(t.value)}))}function Qg(s,e){const{id:t="",label:n,value:i,defaultValue:r,options:a,defaultOptions:l,multiple:c=!1,maxlength:h,typeahead:g=!1,includeSearch:m=!1,allowUserInput:f=!1,displayValueAs:k="label",tagPlacement:v,searchPlaceholder:$,placeholder:N,disabled:x=!1,required:T=!1,fullwidth:P=!1,hasError:D=!1,errorMessage:j,helptext:H,helptextDropdown:X,helptextDropdownButton:fe,optionalTag:q=!1,optionalText:M,requiredTag:z=!1,requiredText:L,tagText:Q,useWrapper:ae=!0,name:ee,className:ue,onChange:le,onValueChange:be,children:ne}=s,re=`${t}-input`,Ue=`${t}-listbox`,Z=g||f,A=d.useRef(null),Me=d.useRef(null),De=d.useRef(null),te=d.useRef(null),Ie=d.useRef(null),Ee=d.useCallback(()=>{var w,O;Z?(w=A.current)==null||w.focus():(O=De.current)==null||O.focus()},[Z]),ye=d.useMemo(()=>{const w=[];return d.Children.forEach(ne,O=>{if(d.isValidElement(O)&&O.type==="option"){const J=O.props;w.push({value:J.value??J.children??"",label:J.children??J.value??"",selected:J.selected,disabled:J.disabled})}}),w},[ne]),Te=d.useMemo(()=>l&&l.length>0?l.map(w=>({...w,fulltext:Hi(w)})):a&&a.length>0?a.map(w=>({...w,fulltext:Hi(w)})):ye.length>0?ye.map(w=>({...w,fulltext:Hi(w)})):[],[l,a,ye]),Pe=i!==void 0,[je,Ae]=d.useState(()=>Wr(i??r,c)),ve=d.useRef(je);d.useEffect(()=>{Pe&&Ae(Wr(i,c))},[i,Pe,c]);const E=Pe?Wr(i,c):je,[Le,Ye]=d.useState([]),U=d.useMemo(()=>{const w=[...Le.filter(O=>!Te.some(J=>J.value===O.value)),...Te];return Xg(w,E)},[Te,Le,E]),[V,se]=d.useState(!1),[me,ge]=d.useState(""),[Xe,Ke]=d.useState(""),[b,p]=d.useState(""),[_,S]=d.useState(null),[Y,K]=d.useState(!1),[ce,nt]=d.useState(!1),[Je,Be]=d.useState(-1),Gt=d.useRef(!1),Xt=Ui(E.length,h??null),_t=c&&h!=null,ci=d.useMemo(()=>me?g?ml(U,me).filtered:Hg(U,me):U,[U,me,g]),ht=d.useMemo(()=>{var w;return(w=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value"))==null?void 0:w.set},[]),Ut=d.useCallback(w=>{const O=Me.current;if(!O||!ht)return;const J=c?w.join(","):w[0]||"";ht.call(O,J),O.dispatchEvent(new Event("input",{bubbles:!0}))},[ht,c]),Qt=c?E.join(","):E[0]||"";d.useEffect(()=>{Me.current&&(Me.current.value=Qt)},[Qt]),d.useEffect(()=>{if(V||c||!A.current)return;const w=E[0]?ji(E[0],U,k):"";A.current.value!==w&&(A.current.value=w)},[E,U,k,c,V]);const as=d.useCallback((w,O=!0)=>{Pe||Ae(w),O&&(be==null||be(w),Ut(w))},[Pe,be,Ut]),Ds=d.useCallback(w=>{if(!w||E.includes(w))return;if(c&&Ui(E.length,h??null)){p("Maks antall valg nådd");return}const O=c?[...E,w]:[w];as(O)},[E,c,h,as]),Re=d.useCallback(w=>{if(!w)return;const O=E.filter(Fe=>Fe!==w),J=fs(U,w);J!=null&&J.userAdded&&Ye(Fe=>Fe.filter(Nt=>Nt.value!==w)),as(O)},[E,U,as]),ui=d.useCallback(()=>{Ye([]),as([])},[as]),Qs=d.useCallback(w=>{if(!w||w.trim()==="")return;let O;if(!c)O=[w];else{if(fs(U,w)||Ui(E.length,h??null))return;O=[...E,w]}const J={value:w,label:w,userAdded:!0,selected:!0};Ye(Fe=>[J,...Fe.filter(Nt=>Nt.value!==w)]),as(O)},[c,U,E,h,as]),di=d.useCallback((w=!0,O)=>{if(S(null),w&&A.current&&A.current.type!=="hidden"){ge(""),Ke("");const J=O!==void 0?O:E[0];!c&&J?A.current.value=ji(J,U,k):A.current.value="",c||(nt(!1),p(""))}},[c,E,U,k]),jt=d.useCallback(w=>{var Jl,Rl;if(x)return;p(""),S(null);const O=((Jl=fs(U,w))==null?void 0:Jl.value)||null,J=E.includes(w||O||""),Fe=!!O,Nt=((Rl=U.find(Db=>Db.value===w))==null?void 0:Rl.disabled)||!1,Zs=!(w!=null&&w.trim()),Pt=!c,qt=c,Ri=Ui(E.length,h??null);let gs=!1,er=!0,hi="",ra="",xn;Nt||(!Fe&&f&&!Zs?(Qs(w),hi="Ny verdi lagt til",gs=qt,Pt&&(xn=w||"")):!Fe&&!f?(Pt&&E[0]&&Re(E[0]),er=!1,gs=!0,hi="Ingen treff i søket"):J?(Re(O),gs=!0,xn="",Pt&&Z&&A.current&&A.current.type!=="hidden"&&(A.current.value="")):Zs&&Pt?(ui(),gs=!0,xn=""):Pt?(E[0]&&Re(E[0]),Ds(O),gs=!1,xn=O||""):qt&&!Ri?(Ds(O),gs=!0):qt&&Ri?(hi="Maks antall valg nådd",er=!1,ra=w||""):(Pt&&ui(),hi="Ingen gyldig verdi valgt",er=!1,gs=!0,ra=w||"",xn=""),se(gs),p(hi),ge(ra),di(er,xn),gs||(Pt&&Z&&(Gt.current=!0),window.setTimeout(()=>{Ee()},0)))},[x,U,E,c,h,f,Qs,Re,ui,Ds,di,Ee]),Tt=d.useCallback(()=>{if(K(!1),S(null),p(""),ge(""),A.current&&A.current.type!=="hidden"){const w=A.current.value;let O=E[0];if(c){if(w!==""){const{action:J,value:Fe}=qg(w,E,U,f,c);switch(J){case"addUserValue":Qs(Fe);break;case"selectOption":Ds(Fe);break;case"removeValue":Re(Fe);break}}}else if(!w)E[0]&&Re(E[0]),O=void 0;else{const J=fs(U,w);J&&J.value!==E[0]?(E[0]&&Re(E[0]),Ds(J.value),O=J.value):!J&&f&&(E[0]&&Re(E[0]),Qs(w),O=w)}!c&&O?A.current.value=ji(O,U,k):A.current.value=""}se(!1),nt(!1)},[E,U,f,c,k,Qs,Ds,Re]),wn=d.useCallback(w=>{if(!w.trim().toLowerCase()){S(null),p(""),!c&&E[0]&&Re(E[0]);return}const J=Ug(w,E,U,f);S(J.addValueText),p(J.userInfoMessage)},[E,U,f,c,Re]),Zi=d.useCallback(w=>{var J;if(x)return;const O=w.target.value;if(Ke(O),ge(O),wn(O),g&&O){const{suggestion:Fe}=ml(U,O);Fe!=null&&Fe.label&&A.current&&!((J=w.nativeEvent.inputType)!=null&&J.includes("deleteContent"))&&(A.current.value=Fe.label,window.setTimeout(()=>{var Nt;return(Nt=A.current)==null?void 0:Nt.setSelectionRange(O.length,Fe.label.length)},0))}},[x,g,U,wn]),ea=d.useCallback(w=>{var J,Fe,Nt,Zs,Pt;if(w.key==="Backspace"){const qt=!((J=A.current)!=null&&J.value);if(!me&&qt&&c&&E.length>0){w.preventDefault();const Ri=E[E.length-1];Re(Ri)}return}if(w.key==="ArrowLeft"&&c&&E.length>0&&(((Fe=A.current)==null?void 0:Fe.selectionStart)??0)===0&&!((Nt=A.current)!=null&&Nt.value)){w.preventDefault(),Be(E.length-1);return}const O=jg(w.key,w.shiftKey,c);if(O&&!(w.key==="Tab"&&!V)){if(O==="focusListbox"&&w.key==="Tab"&&!((Zs=te.current)==null?void 0:Zs.querySelector('[role="option"]:not([data-disabled]), [data-type="new-option"]'))){Tt();return}switch(w.preventDefault(),O){case"addValue":{const qt=((Pt=A.current)==null?void 0:Pt.value.trim())||"";if(ge(qt),qt&&E.includes(qt)){di(!0),p("Verdien er allerede valgt");break}jt(qt);break}case"focusListbox":te.current&&(V||se(!0),qi(te.current,{disabled:x,allowUserInput:f,customUserInput:_,includeSearch:m}));break;case"closeOptions":se(!1);break}}},[me,E,c,x,f,_,m,V,Re,jt,Ee]),os=d.useCallback(()=>{if(!x){if(Gt.current){Gt.current=!1,K(!0);return}!c&&E[0]&&A.current&&A.current.type!=="hidden"&&(nt(!0),A.current.value=ji(E[0],U,k)),K(!0),ge(""),se(!0)}},[x,c,E,U,k]),ta=d.useCallback(()=>{K(!1),nt(!1)},[]),sa=d.useCallback(w=>{if(x||!V)return;const O=w.relatedTarget,J=Ie.current;J&&O&&J.contains(O)||Tt()},[x,V,Tt]),na=d.useCallback(w=>{var O;if(x){w.preventDefault(),w.stopPropagation();return}if(Z)(O=A.current)==null||O.focus();else{w.stopPropagation(),w.preventDefault();const J=!V;se(J),J&&te.current&&qi(te.current,{disabled:x,allowUserInput:f,customUserInput:_,includeSearch:m})}},[x,Z,V,f,_,m]),ia=d.useCallback(w=>{x||(w.stopPropagation(),Z&&A.current?(A.current.focus(),K(!0)):se(O=>!O))},[x,Z]),B=d.useCallback(w=>{if(!x)switch(w.key){case"Enter":case" ":case"ArrowDown":case"ArrowUp":w.preventDefault(),V?se(!1):(se(!0),te.current&&window.setTimeout(()=>{te.current&&qi(te.current,{disabled:x,allowUserInput:f&&!Xt,customUserInput:_,includeSearch:m})},0));break;case"Escape":V&&(w.preventDefault(),se(!1));break;case"Home":case"End":w.preventDefault(),V||se(!0),te.current&&window.setTimeout(()=>{te.current&&qi(te.current,{disabled:x,allowUserInput:f&&!Xt,customUserInput:_,includeSearch:m})},0);break;case"ArrowLeft":c&&E.length>0&&(w.preventDefault(),Be(E.length-1));break;case"Backspace":case"Delete":if(c&&E.length>0){w.preventDefault();const O=E[E.length-1];Re(O)}break}},[x,V,f,Xt,_,m,c,E,Re]),F=d.useCallback(w=>{jt(w)},[jt]),Ge=d.useCallback((w,O)=>{switch(w.key){case"Enter":case" ":w.preventDefault(),jt(O);break;case"ArrowDown":w.preventDefault(),Wg(w.currentTarget);break;case"ArrowUp":w.preventDefault(),te.current&&vl(w.currentTarget,te.current,m);break;case"Escape":w.preventDefault(),se(!1),Ee();break;case"Tab":Tt();break}},[jt,m,Ee,Tt]),et=d.useCallback(w=>{Re(w),Be(-1),Z&&A.current&&(K(!0),A.current.focus())},[Re,Z]),$n=d.useCallback((w,O)=>{var J,Fe,Nt;switch(w.stopPropagation(),w.key){case"ArrowLeft":w.preventDefault(),O>0&&Be(O-1);break;case"ArrowRight":w.preventDefault(),O<E.length-1?Be(O+1):(Be(-1),Z&&A.current?A.current.focus():(J=De.current)==null||J.focus());break;case"Backspace":case"Delete":w.preventDefault();{const Zs=E[O],Pt=O>=E.length-1?O-1:O;Re(Zs),Pt>=0?Be(Pt):(Be(-1),Z&&A.current?A.current.focus():(Fe=De.current)==null||Fe.focus())}break;case"Tab":Be(-1);break;case"Escape":w.preventDefault(),Be(-1),Z&&A.current?A.current.focus():(Nt=De.current)==null||Nt.focus();break}},[E,Z,Re]),Ji=d.useCallback(w=>{ge(w.target.value),wn(w.target.value)},[wn]),Tb=d.useCallback(w=>{switch(w.key){case"ArrowDown":if(w.preventDefault(),te.current){const O=te.current.querySelector('[role="option"]:not([data-disabled]), [data-type="new-option"]');O==null||O.focus()}break;case"Tab":Tt();break;case"Escape":w.preventDefault(),se(!1),Ee();break}},[Ee,Tt]),Nb=d.useCallback(w=>{jt(w)},[jt]),Mb=d.useCallback(w=>{switch(w.key){case"Enter":case" ":w.preventDefault(),jt(w.currentTarget.dataset.value||"");break;case"ArrowDown":w.preventDefault(),te.current&&zg(te.current);break;case"ArrowUp":w.preventDefault(),te.current&&vl(w.currentTarget,te.current,m);break;case"Escape":w.preventDefault(),se(!1),Ee();break}},[jt,m,Ee]);return d.useEffect(()=>{if(!V)return;const w=O=>{const J=O.target;Ie.current&&!Ie.current.contains(J)&&Tt()};return document.addEventListener("click",w,!0),()=>{document.removeEventListener("click",w,!0)}},[V,Tt]),d.useEffect(()=>{var J;const w=(J=Ie.current)==null?void 0:J.closest("form");if(!w)return;const O=()=>{window.setTimeout(()=>{if(Ae(ve.current),Ye([]),Ke(""),ge(""),S(null),p(""),Me.current){const Fe=c?ve.current.join(","):ve.current[0]||"";Me.current.value=Fe}},0)};return w.addEventListener("reset",O),()=>w.removeEventListener("reset",O)},[c]),d.useImperativeHandle(e,()=>({get value(){var w;return((w=Me.current)==null?void 0:w.value)??""},set value(w){const O=Array.isArray(w)?w:w?String(w).split(",").filter(Boolean):[];Pe||Ae(O),Me.current&&(Me.current.value=O.join(","))},focus(){var w,O;Z?(w=A.current)==null||w.focus():(O=De.current)==null||O.focus()},blur(){var w,O;Z?(w=A.current)==null||w.blur():(O=De.current)==null||O.blur()}}),[Pe]),{id:t,inputId:re,listboxId:Ue,values:E,inputValue:Xe,searchValue:me,options:U,filteredOptions:ci,isOpen:V,userInfoMessage:b,addValueText:_,maxIsReached:Xt,editingSingleValue:ce,inputFocus:Y,focusedTagIndex:Je,label:n,multiple:c,maxlength:h,typeahead:g,includeSearch:m,allowUserInput:f,displayValueAs:k,tagPlacement:v,searchPlaceholder:$,placeholder:N,disabled:x,required:T,fullwidth:P,hasError:D,errorMessage:j,helptext:H,helptextDropdown:X,helptextDropdownButton:fe,optionalTag:q,optionalText:M,requiredTag:z,requiredText:L,tagText:Q,useWrapper:ae,name:ee,className:ue,hasCounter:_t,inputRef:A,changeInputRef:Me,triggerRef:De,listboxRef:te,wrapperRef:Ie,handleInputChange:Zi,handleInputKeydown:ea,handleInputFocus:os,handleInputBlur:ta,handleFocusOut:sa,handleInputClick:na,handlePlaceholderClick:ia,handleSelectOnlyKeydown:B,handleOptionClick:F,handleOptionKeydown:Ge,handleTagRemove:et,handleTagKeydown:$n,handleSearchInput:Ji,handleSearchKeydown:Tb,handleNewOptionClick:Nb,handleNewOptionKeydown:Mb,onChange:le}}const yl=d.forwardRef((s,e)=>{const t=Qg(s,e),n=["pkt-combobox-component",t.fullwidth&&"pkt-combobox-component--fullwidth",t.className].filter(Boolean).join(" "),i=t.allowUserInput||t.typeahead,r=i?t.inputId:`${t.id}-combobox`;return o.jsxs("div",{className:n,ref:t.wrapperRef,children:[o.jsxs(Ms,{forId:r,hasFieldset:!i,label:t.label||"",helptext:t.helptext,helptextDropdown:t.helptextDropdown,helptextDropdownButton:t.helptextDropdownButton,hasError:t.hasError,errorMessage:t.errorMessage,disabled:t.disabled,optionalTag:t.optionalTag,optionalText:t.optionalText,requiredTag:t.requiredTag,requiredText:t.requiredText,tagText:t.tagText,useWrapper:t.useWrapper,counter:t.hasCounter,counterCurrent:t.values.length,counterMaxLength:t.maxlength,className:"pkt-combobox__wrapper",children:[o.jsxs("div",{className:"pkt-combobox",onBlur:t.handleFocusOut,children:[o.jsx(Kg,{state:t}),o.jsx(Gg,{state:t})]}),t.tagPlacement==="outside"&&t.multiple&&o.jsx(kl,{state:t,outside:!0})]}),o.jsx("input",{ref:t.changeInputRef,type:"text",name:t.name||t.id,onChange:t.onChange,tabIndex:-1,"aria-hidden":"true",className:"pkt-visually-hidden"})]})});yl.displayName="PktCombobox";const Wi=Js({tagName:"pkt-consent",elementClass:Ft,react:d,displayName:"PktConsent",events:{onToggleConsent:"toggle-consent"}});Wi.displayName="PktConsent";const _l=()=>{const s=navigator.userAgent;return!!(/iP(hone|od|ad)/.test(s)||/Macintosh/.test(s)&&"ontouchend"in document)},Zg=()=>_l()?"text":"date",Jg=s=>!s||s.length!==2?!0:kg(s[0],s[1]),Rg=(s,e,t,n,i,r)=>({"pkt-input":!0,"pkt-datepicker__input":!0,"pkt-input--fullwidth":s,"pkt-datepicker--hasrangelabels":e,"pkt-datepicker--multiple":t,"pkt-datepicker--range":n,"ios-readonly-hack":i===!1&&r==="text"}),em=()=>({"pkt-input-icon":!0,"pkt-btn":!0,"pkt-btn--icon-only":!0,"pkt-btn--tertiary":!0,"pkt-datepicker__calendar-button":!0}),tm=s=>({"pkt-input-prefix":s,"pkt-hide":!s}),sm=(s,e,t)=>!e&&!t?Array.isArray(s)?s[0]||"":s:Array.isArray(s)?s.join(","):s,nm=(s,e,t=!1)=>{var l;if(!s||!e)return;const n=((l=e.parentElement)==null?void 0:l.getBoundingClientRect())||e.getBoundingClientRect(),i=t?n.height+30:n.height,r=s.getBoundingClientRect().height;let a=t?"calc(100% - 30px)":"100%";n&&n.top+r>window.innerHeight&&n.top-r>0&&(a=`calc(100% - ${i}px - ${r}px)`),s.style.top=a},zi=(s,e,t,n,i,r)=>{const{key:a}=s;a===","&&(s.preventDefault(),r?r(s):i&&i()),(a==="Space"||a===" ")&&(s.preventDefault(),e(s)),a==="Enter"&&(s.preventDefault(),t?t():n?n():i&&i())},im=({open:s,multiple:e=!1,range:t=!1,weeknumbers:n=!1,withcontrols:i=!1,selected:r=[],earliest:a,latest:l,excludedates:c,excludeweekdays:h,maxMultiple:g,currentmonth:m,today:f,inputRef:k,hasCounter:v=!1,onDateSelected:$,onClose:N})=>{const x=d.useRef(null),T=d.useRef(!1);s&&(T.current=!0),d.useEffect(()=>{s&&nm(x.current,(k==null?void 0:k.current)??null,v)},[s,k,v]);const P=["pkt-calendar-popup",s?"show":"hide"].join(" "),D=s||T.current;return o.jsx("div",{ref:x,className:P,hidden:!s,"aria-hidden":!s,children:D&&o.jsx(qr,{multiple:e,range:t,weeknumbers:n,withcontrols:i,selected:r,earliest:a,latest:l,excludedates:c,excludeweekdays:h,maxMultiple:g,currentmonth:m,today:f,onDateSelected:$,onClose:N})})},rm=({dates:s,dateformat:e,idBase:t,strings:n,onDateRemoved:i})=>{var l;const r=vg(s),a=((l=n==null?void 0:n.calendar)==null?void 0:l.buttonAltText)??"Slett dato";return o.jsx("div",{className:"pkt-date-tags pkt-datepicker__tags","aria-live":"polite",children:r.map(c=>{const h=hg(c,e);return o.jsx(Ns,{id:`${t}${c}-tag`,closeTag:!0,ariaLabel:`${a} ${h}`,onClose:()=>i(c),children:o.jsx("time",{dateTime:c,children:h})},c)})})},am=({state:s})=>{var Ee,ye,Te,Pe;const{id:e,inputId:t,values:n,dateformat:i,multiple:r,range:a,showRangeLabels:l,disabled:c,readOnly:h,required:g,label:m,name:f,placeholder:k,hasError:v,helptext:$,minStr:N,maxStr:x,inputType:T,isIOSDevice:P,strings:D,inputClasses:j,buttonClasses:H,rangeLabelClasses:X,datepickerInputsClasses:fe,isInputDisabled:q,inputRef:M,inputRefTo:z,btnRef:L,toggleCalendar:Q,handleFocus:ae,handleSingleInputChange:ee,handleRangeFromChange:ue,handleRangeToChange:le,handleRangeBlur:be,handleMultipleBlur:ne,handleTagRemoved:re,handleSingleKeydown:Ue,handleRangeFromKeydown:Z,handleRangeToKeydown:A,handleMultipleKeydown:Me,restProps:De}=s,te=je=>{je.preventDefault(),Q()},Ie=()=>{var je,Ae;return o.jsxs("button",{ref:L,className:H,type:"button",onClick:Q,disabled:c,"aria-label":((je=D.calendar)==null?void 0:je.buttonAltText)??"Åpne kalender",children:[o.jsx(R,{name:"calendar"}),o.jsx("span",{className:"pkt-btn__text",children:((Ae=D.calendar)==null?void 0:Ae.buttonAltText)??"Åpne kalender"})]})};return r?o.jsxs(o.Fragment,{children:[o.jsx(rm,{dates:n,dateformat:i,idBase:e,strings:D,onDateRemoved:re}),o.jsx("div",{className:"pkt-datepicker__inputs",children:o.jsxs("div",{className:"pkt-input__container",children:[o.jsx("input",{...De,ref:M,className:j,type:T,id:t,name:f??e,placeholder:k,readOnly:h||P&&!h,disabled:q,"aria-describedby":$?`${e}-helptext`:void 0,"aria-invalid":v,"aria-errormessage":v?`${e}-error`:void 0,onClick:te,onKeyDown:Me,onFocus:ae,onBlur:ne}),Ie()]})})]}):a?o.jsx("div",{className:fe,children:o.jsxs("div",{className:"pkt-input__container",children:[l&&o.jsx("div",{className:"pkt-input-prefix",children:((Ee=D.generic)==null?void 0:Ee.from)??"Fra"}),o.jsx("input",{...De,ref:M,className:j,type:T,id:t,name:f?`${f}-from`:`${e}-from`,value:n[0]??"",min:N,max:x,placeholder:k,readOnly:h||P&&!h,disabled:c,required:g,"aria-label":`${m} ${((ye=D.generic)==null?void 0:ye.from)??"Fra"}`,"aria-describedby":$?`${e}-helptext`:void 0,"aria-invalid":v,"aria-errormessage":v?`${e}-error`:void 0,onClick:te,onKeyDown:Z,onFocus:ae,onBlur:be,onChange:ue}),o.jsx("div",{className:X,id:`${e}-to-label`,children:((Te=D.generic)==null?void 0:Te.to)??"Til"}),!l&&o.jsx("div",{className:"pkt-input-separator",children:"–"}),o.jsx("input",{ref:z,className:j,type:T,id:`${e}-to`,name:f?`${f}-to`:`${e}-to`,value:n[1]??"",min:N,max:x,readOnly:h||P&&!h,disabled:c,"aria-label":`${m} ${((Pe=D.generic)==null?void 0:Pe.to)??"Til"}`,"aria-invalid":v,onClick:te,onKeyDown:A,onFocus:ae,onBlur:be,onChange:le}),Ie()]})}):o.jsx("div",{className:"pkt-datepicker__inputs",children:o.jsxs("div",{className:"pkt-input__container",children:[o.jsx("input",{...De,ref:M,className:j,type:T,id:t,name:f??e,value:n[0]??"",min:N,max:x,placeholder:k,readOnly:h||P&&!h,disabled:c,required:g,"aria-describedby":$?`${e}-helptext`:void 0,"aria-invalid":v,"aria-errormessage":v?`${e}-error`:void 0,onClick:te,onKeyDown:Ue,onFocus:ae,onBlur:void 0,onChange:ee}),Ie()]})})},om={calendar:{buttonAltText:"Åpne kalender"}},lm={calendar:{buttonAltText:"Åpne kalender"},generic:{from:"Fra",to:"Til"}},wl=s=>{if(!s)return[];if(Array.isArray(s))return s.filter(Boolean);if(typeof s=="string"&&s.trimStart().startsWith("["))try{const e=JSON.parse(s);if(Array.isArray(e))return e.filter(Boolean)}catch{}return String(s).split(",").map(e=>e.trim()).filter(Boolean)};function cm(s,e){const{id:t,label:n,value:i,defaultValue:r,dateformat:a="dd.MM.yyyy",multiple:l=!1,maxlength:c,range:h=!1,showRangeLabels:g=!1,weeknumbers:m=!1,withcontrols:f=!1,excludedates:k,excludeweekdays:v,currentmonth:$,today:N,calendarOpen:x,timezone:T,fullwidth:P=!1,hasFieldset:D=!1,inline:j=!1,helptext:H,helptextDropdown:X,helptextDropdownButton:fe,hasError:q=!1,errorMessage:M,optionalTag:z=!1,optionalText:L,requiredTag:Q=!1,requiredText:ae,tagText:ee,useWrapper:ue=!0,strings:le,disabled:be=!1,readOnly:ne=!1,required:re=!1,name:Ue,min:Z,max:A,placeholder:Me,onChange:De,onValueChange:te,className:Ie,...Ee}=s,ye=d.useCallback(B=>B===void 0?[]:wl(B),[]),Te=i!==void 0,Pe=typeof r=="number"?void 0:r,[je,Ae]=d.useState(()=>ye(i??Pe)),ve=Te?ye(i):je,E=d.useRef(je);d.useEffect(()=>{Te&&Ae(ye(i))},[i,Te,ye]);const[Le,Ye]=d.useState(x??!1);d.useEffect(()=>{x!==void 0&&Ye(x)},[x]);const U=d.useRef(null),V=d.useRef(null),se=d.useRef(null),me=d.useRef(null),ge=d.useRef(null),Xe=d.useMemo(()=>Zg(),[]),Ke=d.useMemo(()=>_l(),[]),b=d.useMemo(()=>le??(h?lm:om),[le,h]),p=typeof Z=="string"?Z:Z!==void 0?String(Z):void 0,_=typeof A=="string"?A:A!==void 0?String(A):void 0,S=d.useMemo(()=>{const B=Rg(P,g,l,h,ne,Xe);return Object.entries(B).filter(([,F])=>F).map(([F])=>F).join(" ")},[P,g,l,h,ne,Xe]),Y=d.useMemo(()=>{const B=em();return Object.entries(B).filter(([,F])=>F).map(([F])=>F).join(" ")},[]),K=d.useMemo(()=>{const B=tm(g);return Object.entries(B).filter(([,F])=>F).map(([F])=>F).join(" ")},[g]),ce=d.useMemo(()=>["pkt-datepicker__inputs",h&&"pkt-input__range-inputs"].filter(Boolean).join(" "),[h,g]),nt=d.useMemo(()=>{if($)return $;if(_)return _.slice(0,7)},[$,_]),Je=be||l&&c!=null&&ve.length>=c,Be=l&&c!=null,Gt=`${t}-input`,Xt=ve.join(",");d.useEffect(()=>{se.current&&(se.current.value=Xt)},[Xt]),d.useEffect(()=>{T&&typeof window<"u"&&T!==window.pktTz&&(window.pktTz=T)},[T]);const _t=d.useCallback((B,F=!0)=>{Te||Ae(B),F&&(te==null||te(B))},[Te,te]),ci=d.useMemo(()=>{var B;return(B=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value"))==null?void 0:B.set},[]),ht=d.useCallback(B=>{const F=se.current;!F||!ci||(ci.call(F,B.join(",")),F.dispatchEvent(new Event("input",{bubbles:!0})))},[ci]),Ut=d.useCallback(()=>{be||Ye(B=>!B)},[be]),Qt=d.useCallback(()=>{Ye(!1)},[]);d.useEffect(()=>{if(!Le)return;const B=Ge=>{var $n;const et=Ge.target;ge.current&&!ge.current.contains(et)&&!(($n=et.closest)!=null&&$n.call(et,".pkt-calendar-popup"))&&Qt()},F=Ge=>{var et;Ge.key==="Escape"&&(Qt(),(et=U.current)==null||et.focus())};return document.addEventListener("click",B,!0),document.addEventListener("keydown",F),()=>{document.removeEventListener("click",B,!0),document.removeEventListener("keydown",F)}},[Le,Qt]);const as=d.useCallback(()=>{Ke&&!Le&&Ye(!0)},[Ke,Le]),Ds=d.useCallback(B=>{var et;const F=sm(B,l,h),Ge=wl(F);_t(Ge),ht(Ge),!l&&!h&&(Qt(),(et=U.current)==null||et.focus())},[l,h,_t,ht,Qt]),Re=d.useCallback(()=>{var B;Qt(),(B=U.current)==null||B.focus()},[Qt]),ui=d.useCallback(B=>{const F=B.target.value,Ge=F?[F]:[];_t(Ge),ht(Ge)},[_t,ht]),Qs=d.useCallback(B=>{const F=B.target.value,Ge=ve[1]??"",et=[F,Ge].filter(Boolean);_t(et),ht(et)},[ve,_t,ht]),di=d.useCallback(B=>{const F=ve[0]??"",Ge=B.target.value,et=[F,Ge].filter(Boolean);_t(et),ht(et)},[ve,_t,ht]),jt=d.useCallback(()=>{ve.length===2&&!Jg(ve)&&(_t([ve[0]]),ht([ve[0]]))},[ve,_t,ht]),Tt=d.useCallback(B=>{const F=ps(B),Ge=p?ps(p):null,et=_?ps(_):null;if(F&&!isNaN(F.getTime())&&(!Ge||F>=Ge)&&(!et||F<=et)){const $n=bg([...ve,B],p,_,k,v),Ji=[...new Set($n)];_t(Ji),ht(Ji)}},[ve,p,_,k,v,_t,ht]),wn=d.useCallback(B=>{const F=B.target;F.value&&(Tt(F.value.split(",")[0]),F.value="")},[Tt]),Zi=d.useCallback(B=>{const F=B.target;F.value&&(Tt(F.value.split(",")[0]),F.value="")},[Tt]),ea=d.useCallback(B=>{const F=ve.filter(Ge=>Ge!==B);_t(F),ht(F)},[ve,_t,ht]),os=d.useCallback(B=>{const F=B==null?void 0:B.closest("form");F?F.requestSubmit():B==null||B.blur()},[]),ta=d.useCallback(B=>{zi(B.nativeEvent,()=>Ut(),()=>os(U.current),void 0,()=>{var F;return(F=U.current)==null?void 0:F.blur()})},[Ut,os]),sa=d.useCallback(B=>{zi(B.nativeEvent,()=>Ut(),()=>os(U.current),()=>{var F;return(F=V.current)==null?void 0:F.focus()},()=>{var F;return(F=U.current)==null?void 0:F.blur()})},[Ut,os]),na=d.useCallback(B=>{zi(B.nativeEvent,()=>Ut(),()=>os(V.current),void 0,()=>{var F;return(F=V.current)==null?void 0:F.blur()})},[Ut,os]),ia=d.useCallback(B=>{zi(B.nativeEvent,()=>Ut(),()=>os(U.current),void 0,()=>{var F;return(F=U.current)==null?void 0:F.blur()},Zi)},[Ut,os,Zi]);return d.useEffect(()=>{var Ge;const B=(Ge=ge.current)==null?void 0:Ge.closest("form");if(!B)return;const F=()=>{window.setTimeout(()=>{Ae(E.current),Ye(!1),se.current&&(se.current.value=E.current.join(","))},0)};return B.addEventListener("reset",F),()=>B.removeEventListener("reset",F)},[]),d.useImperativeHandle(e,()=>({get value(){var B;return((B=se.current)==null?void 0:B.value)??""},set value(B){const F=B?B.split(",").filter(Boolean):[];Ae(F),se.current&&(se.current.value=B??"")},focus(){var B;(B=U.current)==null||B.focus()},blur(){var B;(B=U.current)==null||B.blur()}}),[]),{id:t,inputId:Gt,label:n,values:ve,calendarOpen:Le,dateformat:a,multiple:l,maxlength:c,range:h,showRangeLabels:g,weeknumbers:m,withcontrols:f,excludedates:k,excludeweekdays:v,disabled:be,readOnly:ne,required:re,name:Ue,placeholder:Me,fullwidth:P,hasFieldset:D,inline:j,helptext:H,helptextDropdown:X,helptextDropdownButton:fe,hasError:q,errorMessage:M,optionalTag:z,optionalText:L,requiredTag:Q,requiredText:ae,tagText:ee,useWrapper:ue,className:Ie,minStr:p,maxStr:_,effectiveCurrentMonth:nt,today:N,inputType:Xe,isIOSDevice:Ke,strings:b,inputClasses:S,buttonClasses:Y,rangeLabelClasses:K,datepickerInputsClasses:ce,isInputDisabled:Je,hasCounter:Be,inputRef:U,inputRefTo:V,changeInputRef:se,btnRef:me,wrapperRef:ge,onChange:De,toggleCalendar:Ut,hideCalendar:Qt,handleDateSelected:Ds,handleCalendarClose:Re,handleFocus:as,handleSingleInputChange:ui,handleRangeFromChange:Qs,handleRangeToChange:di,handleRangeBlur:jt,handleMultipleBlur:wn,handleTagRemoved:ea,handleSingleKeydown:ta,handleRangeFromKeydown:sa,handleRangeToKeydown:na,handleMultipleKeydown:ia,restProps:Ee}}const $l=d.forwardRef((s,e)=>{const t=cm(s,e),n=["pkt-datepicker",t.className].filter(Boolean).join(" ");return o.jsxs("div",{className:n,children:[o.jsx(Ms,{ref:t.wrapperRef,forId:t.inputId,label:t.label,hasFieldset:t.hasFieldset,inline:t.inline,helptext:t.helptext,helptextDropdown:t.helptextDropdown,helptextDropdownButton:t.helptextDropdownButton,hasError:t.hasError,errorMessage:t.errorMessage,disabled:t.disabled,optionalTag:t.optionalTag,optionalText:t.optionalText,requiredTag:t.requiredTag,requiredText:t.requiredText,tagText:t.tagText,useWrapper:t.useWrapper,counter:t.hasCounter,counterCurrent:t.values.length,counterMaxLength:t.maxlength,children:o.jsx(am,{state:t})}),o.jsx(im,{open:t.calendarOpen,multiple:t.multiple,range:t.range,weeknumbers:t.weeknumbers,withcontrols:t.withcontrols,selected:t.values,earliest:t.minStr,latest:t.maxStr,excludedates:t.excludedates,excludeweekdays:t.excludeweekdays,maxMultiple:t.maxlength,currentmonth:t.effectiveCurrentMonth,today:t.today,inputRef:t.inputRef,hasCounter:t.hasCounter,onDateSelected:t.handleDateSelected,onClose:t.handleCalendarClose}),o.jsx("input",{ref:t.changeInputRef,type:"text",name:t.name,onChange:t.onChange,tabIndex:-1,"aria-hidden":"true",className:"pkt-visually-hidden"})]})});$l.displayName="PktDatepicker";const um={dropFilesHere:"Slipp filene her ...",selectOrDragFiles:"Dra filer hit for å laste dem opp eller ",chooseFiles:"velg filer"},dm={dropFilesHere:"Slipp filen her ...",selectOrDragFiles:"Dra en fil for å laste den opp eller ",chooseFiles:"velg en fil"},hm={dropFilesHere:"Slipp bildene her ...",selectOrDragFiles:"Dra bilder hit for å laste dem opp eller ",chooseFiles:"velg fra kamerarull"},pm={dropFilesHere:"Slipp bildet her ...",selectOrDragFiles:"Dra et bilde for å laste det opp eller ",chooseFiles:"velg fra kamerarull"},xl=()=>("00000000000000000"+(Math.random()*18446744073709552e3).toString(16)).slice(-16),fm=()=>{const s=xl(),e=xl();return s.slice(0,8)+"-"+s.slice(8,12)+"-4"+s.slice(13)+"-a"+e.slice(1,4)+"-"+e.slice(4)};class Cl{constructor(e,t){tr(this,"fileId");tr(this,"file");tr(this,"attributes",{});this.fileId=t||fm(),this.file=e,this.attributes={targetFilename:e.name}}}const zr=d.createContext({}),gm=".PDF, .JPEG, .JPG, .PNG, .HEIC, .DOC, .DOCX, .ODT",mm=d.forwardRef(({id:s,multiple:e,value:t,onFilesAdded:n=()=>{},name:i,uploadStrategy:r,accept:a,isThumbnailView:l=!1,disabled:c=!1,srAnnouncementIds:h,...g},m)=>{const f=d.useRef(null),k=typeof a=="string"&&a.trim().length>0?a:void 0,v=d.useMemo(()=>k?k.split(/\s*,\s*/).map(M=>M.trim()).filter(Boolean).join(", ").toUpperCase():gm,[k]);d.useImperativeHandle(m,()=>f.current);const[$,N]=d.useState(!1),x=d.useMemo(()=>l?e?hm:pm:e?um:dm,[e,l]),T=d.useCallback(M=>{if(f.current)try{f.current.files=bm(M)}catch{}},[f.current,t]);d.useEffect(()=>{T(t)},[f,t]);const P=d.useCallback(M=>{const z=M.map(L=>new Cl(L));n(z),f.current&&(f.current.value="")},[n]),D=M=>{const z=M.target.files;if(z.length===0){e&&T(t);return}P(Array.from(z))},j=M=>{P(M)},H=M=>{if(M.preventDefault(),N(!1),c)return;const z=M.dataTransfer.files,L=Array.from(z);j(L)},X=M=>{M.preventDefault(),!c&&N(!0)},fe=()=>{N(!1)},q=d.useCallback(M=>{var L;c||M.target.closest(".pkt-fileupload__drop-zone__placeholder__title__open-file-dialog")||(L=f.current)==null||L.click()},[c]);return o.jsxs("div",{onDrop:H,onDragOver:X,onDragLeave:fe,onClick:q,className:oe("pkt-fileupload__drop-zone",{"pkt-fileupload__drop-zone--drag-active":$,"pkt-fileupload__drop-zone--disabled":c}),children:[o.jsx("input",{...g,id:s,type:"file",ref:f,multiple:e,onChange:D,accept:k,disabled:c,name:r==="form"&&i||void 0,"aria-label":e?"Velg filer":"Velg fil"}),r==="custom"&&o.jsx(o.Fragment,{children:t==null?void 0:t.map(M=>o.jsx("input",{type:"hidden",name:i,value:M.fileId},M.fileId))}),o.jsxs("div",{className:"pkt-fileupload__drop-zone__placeholder",children:[o.jsx(R,{name:"attachment",className:"pkt-fileupload__drop-zone__placeholder__icon","aria-hidden":"true"}),o.jsx("p",{className:"pkt-fileupload__drop-zone__placeholder__title",children:$?`${x.dropFilesHere} ...`:o.jsxs(o.Fragment,{children:[x.selectOrDragFiles," ",o.jsx("button",{className:"pkt-fileupload__drop-zone__placeholder__title__open-file-dialog",onClick:M=>{var z;M.preventDefault(),M.stopPropagation(),(z=f.current)==null||z.click()},type:"button",children:x.chooseFiles})]})}),o.jsxs("p",{className:"pkt-fileupload__drop-zone__placeholder__formats",children:["Format: ",v]})]})]})}),bm=s=>{const e=new DataTransfer;for(const t of s)e.items.add(t.file);return e.files},Yr=d.forwardRef(({id:s,ariaDescribedby:e,ariaLabelledby:t,counter:n,counterMaxLength:i,className:r,disabled:a,errorMessage:l,hasError:c,helptext:h,helptextDropdown:g,helptextDropdownButton:m,inline:f,fullwidth:k=!1,label:v,name:$,optionalTag:N=!1,optionalText:x,requiredTag:T=!1,requiredText:P,tagText:D=null,placeholder:j,rows:H,useWrapper:X=!0,onChange:fe,value:q,autoComplete:M="off",minLength:z,maxLength:L,readOnly:Q,skipForwardTestid:ae=!1,...ee},ue)=>{const le=[r,"pkt-textinput","pkt-textarea"].join(" "),be=`${s}-input`,ne=`${be}-label`,re=t||ne,[Ue,Z]=d.useState(0),A=Me=>{var De,te;n&&Z(((te=(De=Me.currentTarget)==null?void 0:De.value)==null?void 0:te.length)||0),fe&&fe(Me)};return d.useEffect(()=>{q!==void 0&&Z((q==null?void 0:q.length)||0)},[q]),o.jsx(Ms,{ariaDescribedby:e,className:le,disabled:a,errorMessage:l,forId:be,hasError:c,helptext:h,helptextDropdown:g,helptextDropdownButton:m,inline:f,label:v,optionalTag:N,optionalText:x,requiredTag:T,requiredText:P,tagText:D,useWrapper:X,counter:n,counterCurrent:Ue,counterMaxLength:i,children:o.jsx("textarea",{ref:ue,className:`pkt-input ${k?"pkt-input--fullwidth":""} ${i&&Ue>i?"pkt-input--counter-error":""}`,name:`${$||s}`,id:be,placeholder:j,disabled:a,rows:H,"aria-labelledby":re,"aria-invalid":c,"aria-errormessage":`${s}-error`,...ee,onChange:A,value:q,autoComplete:M,minLength:z,maxLength:L,readOnly:Q,"data-skip-forward-testid":ae?"true":void 0})})});Yr.displayName="PktTextarea";const vm=Symbol("comment"),km=s=>{const e=String(s.getDate()).padStart(2,"0"),t=String(s.getMonth()+1).padStart(2,"0"),n=s.getFullYear(),i=String(s.getHours()).padStart(2,"0"),r=String(s.getMinutes()).padStart(2,"0");return`${e}.${t}.${n} kl. ${i}:${r}`},ym=({fileItem:s,closeOperationUi:e,onAddComment:t,existingComment:n})=>{const i=d.useRef(null),r=!!n,a=()=>{var c,h;const l=(h=(c=i.current)==null?void 0:c.value)==null?void 0:h.trim();l&&t({text:l,timestamp:new Date}),e()};return d.useLayoutEffect(()=>{const l=setTimeout(()=>{var c;return(c=i.current)==null?void 0:c.focus({preventScroll:!0})},0);return()=>clearTimeout(l)},[s.fileId]),o.jsxs(o.Fragment,{children:[o.jsx(Yr,{autoFocus:!0,label:r?"Rediger kommentar":"Legg til kommentar",name:`comment-${s.fileId}`,className:"pkt-fileupload__queue-display__item__comment-input",placeholder:"Skriv inn kommentar",rows:2,id:`comment-${s.fileId}`,ref:i,defaultValue:n==null?void 0:n.text}),o.jsx(dt,{skin:"secondary",size:"small",onClick:a,children:r?"Lagre kommentar":"Legg til kommentar"}),o.jsx(dt,{skin:"tertiary",size:"small",onClick:e,children:"Avbryt"})]})},_m=({comments:s,onDeleteComment:e,onEditComment:t})=>s&&s.length>0?o.jsx("div",{className:"pkt-fileupload__queue-display__item__comments",children:s.map((n,i)=>o.jsxs("div",{className:"pkt-fileupload__queue-display__item__comment",children:[o.jsxs("div",{className:"pkt-fileupload__queue-display__item__comment__content",children:[o.jsx("span",{className:"pkt-fileupload__queue-display__item__comment__text","aria-label":"Kommentar tekst",children:n.text}),o.jsx("time",{className:"pkt-fileupload__queue-display__item__comment__time",children:km(n.timestamp)})]}),o.jsxs("div",{className:"pkt-fileupload__queue-display__item__comment__actions",children:[e&&o.jsx("button",{type:"button",className:"pkt-fileupload__queue-display__item__comment__action",onClick:()=>e(i),"aria-label":"Slett kommentar",children:o.jsx(R,{name:"trash-can"})}),t&&o.jsx("button",{type:"button",className:"pkt-fileupload__queue-display__item__comment__action",onClick:()=>t(i),"aria-label":"Rediger kommentar",children:o.jsx(R,{name:"edit"})})]})]},i))}):null,wm=s=>{const e=d.useContext(zr);return o.jsx("input",{type:"hidden",name:`${e.name}-comments`,value:s.comments?JSON.stringify(s.comments):""})},$m=s=>{const e=s("comments"),t=(i,r)=>{e.set(i,[r])},n=(i,r)=>{const l=(e.get(i)||[]).filter((c,h)=>h!==r);e.set(i,l.length>0?l:void 0)};return{title:i=>{const r=e.get(i.fileId);return r&&r.length>0?"":"Legg til kommentar"},renderExtendedUI:(i,r)=>{const a=e.get(i.fileId),l=a==null?void 0:a[0];return o.jsx(ym,{fileItem:i,closeOperationUi:r,onAddComment:c=>t(i.fileId,c),existingComment:l})},renderContent:(i,r,a)=>{if(a)return null;const l=e.get(i.fileId);return o.jsx(_m,{comments:l,onDeleteComment:c=>n(i.fileId,c),onEditComment:r?()=>r():void 0})},renderHidden:i=>o.jsx(wm,{comments:e.get(i.fileId)},`comments${i.fileId}`),symbol:vm}},xm=Symbol("deleteFile"),Cm=s=>({title:"Slett",ariaLabel:"Slett fil",onClick:e=>s(e.fileId),symbol:xm}),Sm=Symbol("renameFile"),Tm=s=>{const e=d.useRef(null),t=d.useId(),n=()=>{var i;s.onSave(((i=e.current)==null?void 0:i.value)??"")};return o.jsxs(o.Fragment,{children:[o.jsx("label",{htmlFor:t,className:"pkt-sr-only",children:"Endre filnavn"}),o.jsx("input",{id:t,ref:e,type:"text",autoFocus:!0,defaultValue:s.value,className:"pkt-fileupload__queue-display__item__rename-input",onKeyDown:i=>{i.key==="Enter"&&(i.preventDefault(),i.stopPropagation(),n()),i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),s.onCancel())}}),o.jsx(dt,{skin:"secondary",size:"small",onClick:()=>s.onSave(e.current.value),children:"Lagre"}),o.jsx(dt,{skin:"tertiary",size:"small",onClick:s.onCancel,children:"Avbryt"})]})},Nm=s=>{const e=d.useContext(zr);return o.jsx("input",{type:"hidden",name:`${e.name}-targetFilename`,value:s.targetFilename})},Mm=s=>{const e=s("targetFilename");return{title:"Rediger",ariaLabel:"Rediger filnavn",renderInlineUI:(t,n)=>o.jsx(Tm,{value:e.get(t.fileId)||void 0,onSave:i=>{e.set(t.fileId,i),n()},onCancel:n}),renderHidden:t=>o.jsx(Nm,{targetFilename:e.get(t.fileId)||t.file.name},`rename${t.fileId}`),symbol:Sm}},Dm=(s,e)=>{const t=d.useCallback((r,a,l)=>{const c=s.find(g=>g.fileId===r),h=c.attributes||{};c.attributes={...h,[a]:l},e(r,{attributes:c.attributes})},[e,s]),n=d.useCallback((r,a)=>(s.find(h=>h.fileId===r).attributes||{})[a],[s]);return{fileAttributes:d.useCallback(r=>({get:a=>n(a,r),set:(a,l)=>{t(a,r,l)}}),[n,t])}},Om=s=>{const[e,t]=d.useState(!1),[n,i]=d.useState(0),r=d.useRef(null),a=d.useCallback(h=>{var m;const g=s.findIndex(f=>f.fileId===h);g>=0&&(i(g),t(!0),(m=r.current)==null||m.showModal())},[s]),l=d.useCallback(()=>{var h;t(!1),(h=r.current)==null||h.close()},[]),c=d.useCallback(h=>{s.length!==0&&i(g=>h==="prev"?g<=0?s.length-1:g-1:g>=s.length-1?0:g+1)},[s.length]);return{isOpen:e,currentIndex:n,modalRef:r,open:a,close:l,navigate:c}},Em=s=>{const[e,t]=d.useState({}),n=d.useCallback(a=>{const l=e[a];if(l)return s.find(c=>c.symbol===l)},[e,s]),i=d.useCallback((a,l)=>{t(c=>({...c,[a]:l.symbol}))},[]),r=d.useCallback(a=>{t(l=>{const c={...l};return delete c[a],c})},[]);return{getActivated:n,activate:i,close:r}},Kr=d.forwardRef(({children:s,className:e,open:t=!1,headingText:n="",hideCloseButton:i=!1,closeOnBackdropClick:r=!1,size:a="medium",removePadding:l=!1,closeButtonSkin:c="blue",variant:h="dialog",drawerPosition:g="right",transparentBackdrop:m=!1,onClose:f,...k},v)=>{const $=d.useRef(null),N=v||$,x=d.useCallback(()=>{var H,X;(H=N.current)!=null&&H.open&&((X=N.current)==null||X.close(),f==null||f())},[N,f]);d.useEffect(()=>{const H=N.current;if(!H)return;const X=new MutationObserver(()=>{H.open?document.body.classList.add("pkt-modal--open"):document.body.classList.remove("pkt-modal--open")});return X.observe(H,{attributes:!0,attributeFilter:["open"]}),()=>X.disconnect()},[N]),d.useEffect(()=>{var H,X,fe,q;t?(H=N.current)!=null&&H.open||(X=N.current)==null||X.showModal():(fe=N.current)!=null&&fe.open&&((q=N.current)==null||q.close())},[t,N]);const T=d.useCallback(H=>{r&&H.target===N.current&&x()},[r,N,x]),P=d.useCallback(()=>{f==null||f()},[f]),D=c==="blue",j=oe({"pkt-modal":!0,"pkt-modal--removePadding":l,"pkt-modal--noHeadingText":!n,"pkt-modal--noShadow":c==="yellow-filled","pkt-modal--transparentBackdrop":m,[`pkt-modal--${a}`]:a,[`pkt-modal__${h}`]:h,[`pkt-modal__drawer--${g}`]:h==="drawer"},e);return o.jsx("dialog",{...k,className:j,ref:N,"aria-labelledby":n?"pkt-modal__headingText":void 0,"aria-describedby":"pkt-modal__content",onClick:T,onClose:P,children:o.jsxs("div",{className:"pkt-modal__wrapper",children:[(n||!i)&&o.jsxs("div",{className:"pkt-modal__header",children:[o.jsx("div",{className:"pkt-modal__header-background"}),n?o.jsx("h1",{id:"pkt-modal__headingText",className:"pkt-modal__headingText pkt-txt-24",children:n}):o.jsx("div",{className:"pkt-modal__headingText"}),i?o.jsx("div",{className:"pkt-modal__noCloseButton"}):o.jsx("div",{className:oe("pkt-modal__closeButton",{[`pkt-modal__closeButton--${c}`]:!0}),children:o.jsx(dt,{onClick:x,"aria-label":"close",iconName:"close",variant:"icon-only",size:"medium",skin:D?"tertiary":"primary",children:"Lukk"})})]}),o.jsx("div",{className:"pkt-modal__container",children:o.jsx("div",{id:"pkt-modal__content",className:"pkt-modal__content pkt-txt-18-light",children:s})})]})})});Kr.displayName="PktModal";const Sl=2,Pm=s=>{const e=window.getComputedStyle(s),t=parseFloat(e.lineHeight);if(!Number.isNaN(t)&&t>0)return t;const n=parseFloat(e.fontSize);return(!Number.isNaN(n)&&n>0?n:16)*1.2},Am=(s,e,t)=>{const n=e*t;return s.getBoundingClientRect().height>n+.5},Tl=d.createContext({tail:5}),oi=({children:s,tail:e,...t})=>{const n=s,i=d.useContext(Tl),r=e!==void 0?e:i.tail||0,a=s.length<=r+3?null:s.slice(-r),l=d.useRef(null),c=d.useRef(null),[h,g]=d.useState(!1),m=d.useCallback(()=>{const k=l.current,v=c.current;if(!k||!v)return;const $=Pm(k);g(Am(v,$,Sl))},[]),f=d.useMemo(()=>new ResizeObserver(k=>{k.some(v=>v.target===l.current)&&m()}),[m]);return d.useLayoutEffect(()=>(l.current&&f.observe(l.current),m(),()=>f.disconnect()),[s,f,m]),o.jsxs("span",{ref:l,...t,"data-pkt-truncate-part":"wrapper",style:{maxWidth:"100%",width:"100%",display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto",alignItems:"end",columnGap:"0.25rem",overflow:"hidden",position:"relative",...t.style},children:[o.jsx("span",{"data-pkt-truncate-part":"first",style:{minWidth:0,display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:Sl,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"normal",overflowWrap:"anywhere"},children:n}),r!==0&&o.jsx("span",{"data-pkt-truncate-part":"tail",style:{whiteSpace:"nowrap",display:h?"inline":"none",paddingRight:"0.5rem"},"aria-hidden":!0,children:a}),o.jsx("span",{ref:c,"aria-hidden":!0,"data-pkt-truncate-part":"measure",style:{position:"absolute",top:0,left:0,width:"100%",visibility:"hidden",pointerEvents:"none",whiteSpace:"normal",overflowWrap:"anywhere"},children:s})]})},Im=s=>{if(typeof s=="number")return s;const e=s.trim().match(/^(\d+(?:\.\d+)?)\s*(B|KB|MB|GB)$/i);if(!e)return console.warn(`PktFileUpload: Invalid maxFileSize format "${s}". Use format like "5MB", "500KB", or a number in bytes.`),0;const t=parseFloat(e[1]);switch(e[2].toUpperCase()){case"B":return t;case"KB":return t*1024;case"MB":return t*1024*1024;case"GB":return t*1024*1024*1024;default:return t}},Yi=s=>s<1024?`${s} B`:s<1024*1024?`${Math.round(s/1024)} KB`:s<1024*1024*1024?`${Math.round(s/(1024*1024))} MB`:`${Math.round(s/(1024*1024*1024))} GB`,Gr=s=>o.jsx("button",{onClick:s.onClick,className:"pkt-fileupload__queue-display__item__cancel-button","aria-label":s.ariaLabel||"Avbryt opplasting",children:s.label||"Avbryt"}),Lm=()=>{const[s,e]=d.useState(1);return d.useEffect(()=>{const t=setInterval(()=>{e(n=>n>=3?1:n+1)},400);return()=>clearInterval(t)},[]),o.jsxs("span",{className:"pkt-fileupload__queue-display__item__loading-text","aria-label":"Laster opp fil",children:["Laster opp",".".repeat(s)]})},Bm=({cancelTransfer:s,transferItem:e})=>{const t=e.showProgress??e.progress!==0;return o.jsxs(o.Fragment,{children:[o.jsx(R,{name:"document-text",className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium","aria-hidden":"true"}),o.jsx("p",{className:"pkt-fileupload__queue-display__item__title","aria-label":"Filnavn",children:o.jsx(oi,{children:e.attributes.targetFilename})}),o.jsx(Gr,{onClick:s}),t?o.jsxs(o.Fragment,{children:[o.jsx(Qi,{valueCurrent:e.progress*100,statusType:"none",valueMax:100,statusPlacement:"following",className:"pkt-fileupload__queue-display__item__progress"}),o.jsx("span",{className:"pkt-fileupload__queue-display__item__filesize",children:Yi(e.file.size)}),o.jsx("span",{className:"pkt-fileupload__queue-display__item__percentage","aria-hidden":"true",children:`${Math.round(e.progress*100)}%`})]}):o.jsx(Lm,{})]})},Fm=({transferItem:s,onRemove:e})=>{const t=(s.lastProgress??1)*100;return o.jsxs(o.Fragment,{children:[o.jsx(R,{className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium",name:"alert-error","aria-hidden":"true"}),o.jsx("p",{className:"pkt-fileupload__queue-display__item__title",children:o.jsx(oi,{children:s.attributes.targetFilename})}),o.jsx(Gr,{onClick:e,label:"Fjern",ariaLabel:"Fjern fil som feilet under opplasting"}),o.jsx(Qi,{valueCurrent:t,statusType:"none",valueMax:100,statusPlacement:"following",className:"pkt-fileupload__queue-display__item__progress pkt-fileupload__queue-display__item__progress--error"}),o.jsx("span",{className:"pkt-fileupload__queue-display__item__filesize",children:Yi(s.file.size)}),s.errorMessage&&o.jsx("span",{className:"pkt-fileupload__queue-display__item__error-message",children:s.errorMessage})]})},Vm=({transferItem:s,onRemove:e})=>o.jsxs(o.Fragment,{children:[o.jsx(R,{className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium",name:"alert-error","aria-hidden":"true"}),o.jsx("p",{className:"pkt-fileupload__queue-display__item__title",children:o.jsx(oi,{children:s.attributes.targetFilename})}),o.jsx(Gr,{onClick:e,label:"Fjern",ariaLabel:"Fjern fil som feilet under opplasting"}),s.errorMessage&&o.jsx("span",{className:"pkt-fileupload__queue-display__item__error-message",children:s.errorMessage})]}),Hm=({transferItem:s,onRemove:e})=>s.showProgress?o.jsx(Fm,{transferItem:s,onRemove:e}):o.jsx(Vm,{transferItem:s,onRemove:e}),Um=({operation:s,onActivate:e,transferItem:t})=>{const n=typeof s.title=="function"?s.title(t):s.title;if(!n)return null;const i=()=>{(s.renderInlineUI||s.renderExtendedUI)&&e(t.fileId,s),s.onClick&&s.onClick(t)};return o.jsx("button",{type:"button",className:"pkt-fileupload__queue-display__item__operation",onClick:i,"aria-label":typeof s.ariaLabel=="function"?s.ariaLabel(t):s.ariaLabel,children:n})},Nl=({transferItem:s})=>o.jsxs(o.Fragment,{children:[o.jsx(R,{name:"document-text",className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium","aria-hidden":"true"}),o.jsx("p",{className:"pkt-fileupload__queue-display__item__title",children:o.jsx(oi,{children:s.attributes.targetFilename})}),o.jsx("span",{className:"pkt-fileupload__queue-display__item__filesize",children:Yi(s.file.size)})]}),jm=({transferItem:s,onPreviewClick:e})=>{const[t,n]=d.useState(null),[i,r]=d.useState(!1),a=s.file;d.useEffect(()=>{if(r(!1),a.type.startsWith("image/")){const g=URL.createObjectURL(a);return n(g),()=>{URL.revokeObjectURL(g)}}n(null)},[a]);const l=t&&!i&&o.jsx("img",{src:t,alt:s.attributes.targetFilename,onError:()=>r(!0)})||o.jsx(R,{name:"document-text",className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium"}),c=!!e,h=!!t&&!i;return o.jsxs("div",{className:`pkt-fileupload__queue-display__item__thumbnail${h?"":" pkt-fileupload__queue-display__item__thumbnail--fallback"}`,children:[o.jsxs(dt,{className:"pkt-fileupload__queue-display__item__thumbnail__image-wrapper","aria-label":`Forhåndsvis bilde ${s.attributes.targetFilename}`,type:"button",skin:"secondary",onClick:e,children:[c&&o.jsx(R,{name:"expand",className:"pkt-fileupload__queue-display__item__thumbnail__expand-icon","aria-hidden":"true"}),l]}),o.jsx(oi,{className:"pkt-fileupload__queue-display__item__thumbnail__title",children:s.attributes.targetFilename})]})},Ml=d.forwardRef(({isOpen:s,images:e,currentIndex:t,onClose:n,onNavigate:i},r)=>{const[a,l]=d.useState(null),[c,h]=d.useState(!1),g=e[t],m=e.length>1;return d.useEffect(()=>{if(h(!1),g&&g.file.type.startsWith("image/")){const f=URL.createObjectURL(g.file);return l(f),()=>URL.revokeObjectURL(f)}l(null)},[g]),d.useEffect(()=>{if(!s)return;const f=k=>{switch(k.key){case"ArrowLeft":k.preventDefault(),i("prev");break;case"ArrowRight":k.preventDefault(),i("next");break;case"Escape":k.preventDefault(),n();break}};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[s,i,n]),g?o.jsx(Kr,{ref:r,headingText:g.attributes.targetFilename,closeOnBackdropClick:!0,className:"pkt-fileupload__image-preview-modal",children:o.jsxs("div",{className:"pkt-fileupload__image-preview",children:[m&&o.jsx(dt,{variant:"icon-only",iconName:"chevron-thin-left",skin:"secondary",size:"small",className:"pkt-fileupload__image-preview__nav pkt-fileupload__image-preview__nav--prev",onClick:()=>i("prev"),"aria-label":`Forrige bilde ${t} / ${e.length}`}),o.jsx("div",{className:"pkt-fileupload__image-preview__content",children:a&&!c?o.jsx("img",{src:a,alt:`${g.attributes.targetFilename} - ${t+1} av ${e.length}`,className:"pkt-fileupload__image-preview__image",onError:()=>h(!0)}):o.jsx(R,{name:"picture",className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium"})}),m&&o.jsxs("span",{className:"pkt-fileupload__image-preview__counter",children:[t+1," / ",e.length]}),m&&o.jsx(dt,{variant:"icon-only",iconName:"chevron-thin-right",skin:"secondary",size:"small",className:"pkt-fileupload__image-preview__nav pkt-fileupload__image-preview__nav--next",onClick:()=>i("next"),"aria-label":`Neste bilde ${t+2} / ${e.length}`})]})}):null});Ml.displayName="ImagePreviewModal";const qm=s=>{var e;return(e=s.file.type)!=null&&e.startsWith("image/")?!0:/\.(jpe?g|png|gif|webp|heic|heif|bmp|svg)$/i.test(s.file.name||"")},Xr=s=>typeof s=="number"?"in-progress":s==="error"?"error":"idle",Wm=({operations:s,activatedOperation:e,onActivate:t,transferItem:n})=>o.jsx("div",{className:"pkt-fileupload__queue-display__item__actions",children:s.filter(i=>!e||i.symbol!==e.symbol).map(i=>o.jsx(Um,{operation:i,onActivate:t,transferItem:n},i.symbol.toString()))}),zm=({operations:s,activatedOperation:e,onActivate:t,transferItem:n})=>o.jsx(o.Fragment,{children:s.filter(i=>i.renderContent).map(i=>o.jsx("div",{className:"pkt-fileupload__queue-display__item__operation-content",children:i.renderContent(n,()=>t(n.fileId,i),(e==null?void 0:e.symbol)===i.symbol)},i.symbol.toString()))}),Ym=({transferItem:s,activatedOperation:e,operations:t,ItemRenderer:n,onActivate:i,onClose:r,onPreviewClick:a})=>{const l=()=>r(s.fileId),h=(e==null?void 0:e.renderInlineUI)||(e==null?void 0:e.renderExtendedUI)?[]:t;return o.jsxs(o.Fragment,{children:[e!=null&&e.renderInlineUI?o.jsxs(o.Fragment,{children:[o.jsx(R,{name:"document-text",className:"pkt-fileupload__queue-display__item__icon"}),o.jsx("div",{className:"pkt-fileupload__queue-display__item__inline-ui",children:e.renderInlineUI(s,l)})]}):o.jsx(n,{transferItem:s,queueItemOperations:t,onPreviewClick:a}),h.length>0&&o.jsx(Wm,{operations:h,activatedOperation:e,onActivate:i,transferItem:s}),o.jsx(zm,{operations:t,activatedOperation:e,onActivate:i,transferItem:s}),(e==null?void 0:e.renderExtendedUI)&&o.jsx("div",{className:"pkt-fileupload__queue-display__item__expanded-operation-ui",children:e.renderExtendedUI(s,l)})]})},Km=({transferItem:s,activatedOperation:e,operations:t,ItemRenderer:n,enableImagePreview:i,onActivate:r,onClose:a,onCancelTransfer:l,onOpenPreview:c})=>{const h=Xr(s.progress),g=i&&s.progress==="done"&&qm(s);switch(h){case"in-progress":return o.jsx(Bm,{"aria-live":"off",transferItem:s,cancelTransfer:()=>l(s.fileId)});case"error":return o.jsx(Hm,{transferItem:s,onRemove:()=>l(s.fileId)});case"idle":return o.jsx(Ym,{transferItem:s,activatedOperation:e,operations:t,ItemRenderer:n,onActivate:r,onClose:a,onPreviewClick:g?()=>c(s.fileId):void 0})}},Gm=s=>{var e;return(e=s.file.type)!=null&&e.startsWith("image/")?!0:/\.(jpe?g|png|gif|webp|heic|heif|bmp|svg)$/i.test(s.file.name||"")},Xm=(s,e,t)=>d.useMemo(()=>{const n=s.map(r=>{const a=e.find(l=>l.fileId===r.fileId);return{...r,progress:(a==null?void 0:a.progress)??(t==="form"?"done":"queued"),errorMessage:a==null?void 0:a.errorMessage,showProgress:a==null?void 0:a.showProgress,lastProgress:a==null?void 0:a.lastProgress}}),i={"in-progress":0,error:1,idle:2};return n.sort((r,a)=>i[Xr(r.progress)]-i[Xr(a.progress)])},[s,e,t]),Qm=(s,e)=>d.useMemo(()=>e?s.filter(t=>t.progress==="done"&&Gm(t)):[],[s,e]),Zm=({files:s,cancelTransfer:e,transfers:t=[],queueItemOperations:n=[],ItemRenderer:i=Nl,truncateTail:r,enableImagePreview:a=!1,uploadStrategy:l="form"})=>{const c=Xm(s,t,l),h=Qm(c,a),g=Em(n),m=Om(h);return o.jsxs(o.Fragment,{children:[o.jsx("ul",{className:"pkt-fileupload__queue-display",children:o.jsx(Tl.Provider,{value:{tail:r},children:c.map(f=>o.jsxs("li",{className:oe("pkt-fileupload__queue-display__item",{"pkt-fileupload__queue-display__item--in-progress":typeof f.progress=="number",[`pkt-fileupload__queue-display__item--${f.progress}`]:typeof f.progress=="string"}),children:[n.filter(k=>k.renderHidden).map(k=>k.renderHidden(f)),o.jsx(Km,{transferItem:f,activatedOperation:g.getActivated(f.fileId),operations:n,ItemRenderer:i,enableImagePreview:a,onActivate:g.activate,onClose:g.close,onCancelTransfer:e,onOpenPreview:m.open})]},f.fileId))})}),a&&h.length>0&&o.jsx(Ml,{ref:m.modalRef,isOpen:m.isOpen,images:h,currentIndex:m.currentIndex,onClose:m.close,onNavigate:m.navigate})]})},Qr={filename:Nl,thumbnail:jm},Dl=d.forwardRef(({value:s,defaultValue:e,id:t="fileupload-id",multiple:n=!1,uploadStrategy:i="form",addCommentsEnabled:r=!1,renameFilesEnabled:a=!1,truncateTail:l,onFilesChanged:c,onFileUploadRequested:h,extraOperations:g=[],itemRenderer:m=Qr.filename,fullWidth:f=!1,allowedFormats:k,formatErrorMessage:v,maxFileSize:$,sizeErrorMessage:N,onFileValidation:x,errorMessage:T,hasError:P=!1,disabled:D=!1,label:j,helptext:H,optionalTag:X,requiredTag:fe,enableImagePreview:q=!1,...M},z)=>{const L="transfers"in M?M.transfers:void 0,[Q,ae]=d.useState(null),ee=P||!!Q,ue=T||Q,le=$?Im($):void 0,be=d.useCallback(V=>{var se;if(k&&k.length>0){const me=((se=V.name.split(".").pop())==null?void 0:se.toLowerCase())||"",ge=V.type.toLowerCase();if(!k.some(Ke=>{const b=Ke.toLowerCase().replace(/^\./,"");if(b.includes("/")){if(b.endsWith("/*")){const p=b.replace("/*","");return ge.startsWith(p+"/")}return ge===b}return me===b})){const Ke=k.join(", "),b=`Ugyldig filtype. Tillatte formater: ${Ke}`;return(v==null?void 0:v.replace("{formats}",Ke))||b}}if(le&&V.size>le){const me=Yi(le),ge=`Filen er for stor. Maks størrelse er ${me}.`;return(N==null?void 0:N.replace("{maxSize}",me))||ge}return x?x(V):null},[k,v,le,N,x]);s!==void 0&&e!==void 0&&console.warn("PktFileupload: Både value og defaultValue er angitt. Komponenten kan være enten 'controlled' eller 'uncontrolled', ikke begge deler. Bruk kun én av dem. Se https://react.dev/reference/react-dom/components/input#controlling-an-input-with-a-state-variable"),s!==void 0&&c===void 0&&console.warn("PktFileupload: value-prop er angitt uten onFilesChanged-callback. Når en komponent er 'controlled', må endringer håndteres via en callback. Vennligst legg til onFilesChanged-callback for å håndtere endringer i fil-listen. Se https://react.dev/reference/react-dom/components/input#controlling-an-input-with-a-state-variable");const re=s!==void 0?s:e||[],Ue=typeof m=="string"?Qr[m]:m,Z=m==="thumbnail",A=typeof M.accept=="string"?M.accept.trim():void 0,Me=d.useMemo(()=>{if(!(!k||k.length===0))return k.map(V=>V.trim()).filter(Boolean).map(V=>{const se=V.toLowerCase();return se.includes("/")||se.startsWith(".")?se:`.${se}`}).join(", ")},[k]),De=A||Me,te=a&&!Z,Ie=r&&!Z,Ee=d.useCallback(V=>{for(const me of V){const ge=be(me.file);if(ge){ae(ge);return}}ae(null);const se=n?[...re,...V]:[V[0]];c&&c(se),i==="custom"&&h&&V.forEach(me=>{h==null||h(me)})},[c,re,n,i,h,be]),ye=d.useCallback((V,se)=>{const me=re.map(ge=>ge.fileId===V?{...ge,...se}:ge);c&&c(me)},[c,re]),Te=d.useCallback(V=>{var me;const se=re.filter(ge=>ge.fileId!==V);c&&c(se),"onTransferCancelled"in M&&M.onTransferCancelled&&((me=M.onTransferCancelled)==null||me.call(M,V))},[c,re,M]),{fileAttributes:Pe}=Dm(re,ye),je=d.useMemo(()=>[{op:Mm,enabled:te},{op:V=>$m(V),enabled:Ie}].filter(({enabled:V})=>V).map(({op:V})=>V).concat(...g),[te,Ie]),Ae=d.useMemo(()=>({uploaded:`${t}-uploaded`,errors:`${t}-errors`}),[t]),{totalCount:ve,uploadedCount:E,failedCount:Le}=d.useMemo(()=>{const V=re.length;if(!L)return{totalCount:V,uploadedCount:0,failedCount:0};let se=0,me=0;for(const ge of re){const Xe=L.find(Ke=>Ke.fileId===ge.fileId);(Xe==null?void 0:Xe.progress)==="done"&&se++,(Xe==null?void 0:Xe.progress)==="error"&&me++}return{totalCount:V,uploadedCount:se,failedCount:me}},[re,L]),Ye=ve===1?"fil":"filer",U=o.jsx("div",{className:oe("pkt-fileupload",{"pkt-fileupload--full-width":f,"pkt-fileupload--error":ee,"pkt-fileupload--disabled":D}),"aria-disabled":D,...D?{inert:""}:{},children:o.jsxs(zr.Provider,{value:{name:M.name||"",multiple:!!n,id:t},children:[o.jsx("div",{id:Ae.uploaded,className:"pkt-sr-only","aria-live":"polite","aria-atomic":"true",children:ve>0&&E>0&&`${E} av ${ve} ${Ye} lastet opp`}),o.jsx("div",{id:Ae.errors,className:"pkt-sr-only","aria-live":"assertive","aria-atomic":"true",children:ve>0&&Le>0&&`Feil ved opplasting: ${Le} av ${ve} ${Ye} feilet`}),o.jsx(mm,{id:t,name:M.name||"",value:re,onFilesAdded:Ee,multiple:n,uploadStrategy:i,ref:z,accept:Z?".jpeg, .jpg, .png, .gif, .webp, .heic":De,isThumbnailView:Z,disabled:D,srAnnouncementIds:Ae}),ee&&ue&&o.jsx(Bi,{skin:"error","aria-live":"assertive",role:"alert",compact:!0,children:ue}),o.jsx(Zm,{files:re,cancelTransfer:Te,truncateTail:l,transfers:L,uploadStrategy:i,ItemRenderer:Ue,enableImagePreview:Z&&q,queueItemOperations:je.map(V=>V(Pe)).concat(Cm(Te))})]})});return j?o.jsx(Ms,{forId:t,label:j,helptext:H,disabled:D,hasError:ee,optionalTag:X,requiredTag:fe,className:oe("pkt-fileupload-wrapper",{"pkt-fileupload-wrapper--full-width":f}),children:U}):U});Dl.displayName="PktFileUpload";const Jm=({columnOne:s,columnTwo:e,socialLinks:t,className:n,openLinksInNewTab:i=!1,personvernOgInfoLink:r="https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",tilgjengelighetLink:a="https://www.oslo.kommune.no/tilgjengelighet/",includeConsent:l=!1,hotjarId:c=null,googleAnalyticsId:h=null,devMode:g=!1,cookieDomain:m=null,cookieSecure:f=null,cookieExpiryDays:k=null,onToggleConsent:v=$=>{console.log($.detail)}})=>{var N,x;const $=[n,"pkt-footer"].filter(Boolean).join(" ");return o.jsx("footer",{className:$,"data-mode":"dark",children:o.jsxs("div",{className:"pkt-footer__container",children:[o.jsxs("div",{className:"pkt-grid pkt-grid--rowgap-size-32 pkt-grid--gap-size-16",children:[o.jsxs("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[o.jsx("h2",{className:"pkt-footer__title",children:s.title}),o.jsxs("ul",{className:"pkt-footer__list",children:[s.text&&o.jsx("li",{className:"pkt-footer__text",children:s.text}),(N=s.links)==null?void 0:N.map((T,P)=>o.jsx("li",{className:"pkt-footer__list-item",children:o.jsxs("a",{className:`pkt-footer__link ${T.external?"pkt-link--external":""}`,href:T.href,target:T.openInNewTab||i?"_blank":"_self",rel:T.openInNewTab||i?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer__link-icon",name:"chevron-right"}),T.text]})},`links-${P}`))]})]}),o.jsxs("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[o.jsx("h2",{className:"pkt-footer__title",children:e.title}),o.jsxs("ul",{className:"pkt-footer__list",children:[e.text&&o.jsx("li",{className:"pkt-footer__text",children:e.text}),(x=e.links)==null?void 0:x.map((T,P)=>o.jsx("li",{className:"pkt-footer__list-item",children:o.jsxs("a",{className:`pkt-footer__link ${T.external?"pkt-link--external":""}`,href:T.href,target:T.openInNewTab||i?"_blank":"_self",rel:T.openInNewTab||i?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer__link-icon",name:"chevron-right"}),T.text]})},`links-${P}`))]})]}),o.jsxs("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[o.jsx("h2",{className:"pkt-footer__title",children:"Om nettstedet"}),o.jsxs("ul",{className:"pkt-footer__list",children:[o.jsx("li",{className:"pkt-footer__list-item",children:o.jsxs("a",{className:"pkt-footer__link",href:r,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),o.jsx("li",{className:"pkt-footer__list-item",children:o.jsxs("a",{className:"pkt-footer__link",href:a,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})}),l&&o.jsx("li",{className:"pkt-footer__list-item",children:o.jsx(Wi,{triggerType:"footerlink",hotjarId:c,googleAnalyticsId:h,devMode:g,cookieDomain:m,cookieSecure:f,cookieExpiryDays:k,onToggleConsent:v})})]})]})]}),t&&o.jsxs("div",{className:"pkt-footer__social","aria-label":"standard lenker",children:[o.jsx("div",{className:"pkt-footer__social-languages",children:t.filter(T=>T.language).map((T,P)=>o.jsx("div",{className:"pkt-footer__social-language",children:o.jsx("a",{href:T.href,"aria-label":`til ${T.language} versjon av nettsiden`,target:T.openInNewTab||i?"_blank":"_self",rel:T.openInNewTab||i?"noopener noreferrer":void 0,children:T.language})},`sociallinks-language-${P}`))}),o.jsx("div",{className:"pkt-footer__social-icons",children:t.filter(T=>T.iconName).map((T,P)=>o.jsx(d.Fragment,{children:o.jsx("a",{href:T.href,"aria-label":`til ${T.iconName}`,className:"pkt-footer__social-icon-link",target:T.openInNewTab||i?"_blank":"_self",rel:T.openInNewTab||i?"noopener noreferrer":void 0,children:o.jsx(R,{className:"pkt-footer__social-icon",name:T.iconName})})},`sociallinks-${P}`))})]})]})})},Rm=({links:s=[],openLinksInNewTab:e=!1,personvernOgInfoLink:t="https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",tilgjengelighetLink:n="https://www.oslo.kommune.no/tilgjengelighet/",includeConsent:i=!1,hotjarId:r=null,googleAnalyticsId:a=null,devMode:l=!1,cookieDomain:c=null,cookieSecure:h=null,cookieExpiryDays:g=null,onToggleConsent:m=k=>{console.log(k.detail)},className:f})=>{const k=[f,"pkt-footer-simple"].filter(Boolean).join(" ");return o.jsx("footer",{className:k,"data-mode":"dark",children:o.jsx("div",{className:"pkt-footer-simple__container",children:o.jsxs("ul",{className:"pkt-footer-simple__list",children:[s.map((v,$)=>o.jsx("li",{className:"pkt-footer-simple__list-item",children:o.jsxs("a",{className:`pkt-footer-simple__link ${v.external?" pkt-link--external":""}`,href:v.href,target:v.openInNewTab||e?"_blank":"_self",rel:v.openInNewTab||e?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),v.text]})},$)),o.jsx("li",{className:"pkt-footer-simple__list-item",children:o.jsxs("a",{className:"pkt-footer-simple__link",href:t,target:e?"_blank":"_self",rel:e?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),o.jsx("li",{className:"pkt-footer-simple__list-item",children:o.jsxs("a",{className:"pkt-footer-simple__link",href:n,target:e?"_blank":"_self",rel:e?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})}),i&&o.jsx("li",{className:"pkt-footer-simple__list-item",children:o.jsx(Wi,{triggerType:"footerlink",hotjarId:r,googleAnalyticsId:a,devMode:l,cookieDomain:c,cookieSecure:h,cookieExpiryDays:g,onToggleConsent:m})})]})})})},eb=(s,e)=>{const t=()=>typeof window>"u"?0:window.innerWidth,[n,i]=d.useState(t);return d.useEffect(()=>{const r=s.current;if(!r)return;if(i(r.offsetWidth),typeof ResizeObserver>"u"){const l=()=>{r&&i(r.offsetWidth)};return window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)}const a=new ResizeObserver(l=>{for(const c of l)c.borderBoxSize&&c.borderBoxSize.length>0?i(c.borderBoxSize[0].inlineSize):i(c.contentRect.width)});return a.observe(r),()=>{a.disconnect()}},[s]),n};function tb(s){const e=d.useRef(0);d.useEffect(()=>{const t=document.body,n=document.documentElement;if(s){e.current=window.scrollY||window.pageYOffset;const i=window.innerWidth-n.clientWidth;i>0&&(t.style.paddingRight=`${i}px`),t.style.position="fixed",t.style.top=`-${e.current}px`,t.style.left="0",t.style.right="0",t.style.width="100%",t.style.overflow="hidden",n.classList.add("is-scroll-locked")}else t.style.removeProperty("position"),t.style.removeProperty("top"),t.style.removeProperty("left"),t.style.removeProperty("right"),t.style.removeProperty("width"),t.style.removeProperty("overflow"),t.style.removeProperty("padding-right"),document.documentElement.classList.remove("is-scroll-locked"),window.scrollTo({top:e.current});return()=>{s&&(t.style.cssText="",document.documentElement.classList.remove("is-scroll-locked"),window.scrollTo({top:e.current}))}},[s])}const Ki=({href:s,iconName:e,className:t,iconPosition:n,external:i,target:r,children:a,...l})=>{const c={"pkt-link":!0,"pkt-link--icon-left":!!e&&n==="left"||!!(e&&!n),"pkt-link--icon-right":!!e&&n==="right","pkt-link--external":i};return o.jsxs("a",{...l,className:oe(c,t),href:s,target:r,rel:i?"noopener noreferrer":void 0,children:[e&&o.jsx(R,{name:e,className:"pkt-link__icon"}),a]})};Ki.displayName="PktLink";const sb=s=>typeof s.target=="string"?{title:s.title,iconName:s.iconName,href:s.target}:{title:s.title,iconName:s.iconName,onClick:s.target},Gi=({item:s,className:e})=>"href"in s?o.jsx(Ki,{iconName:s.iconName,href:s.href,"aria-hidden":"true",className:oe("pkt-user-menu__link",e),children:s.title}):o.jsxs("button",{className:oe("pkt-user-menu__link pkt-link-button pkt-link pkt-link--icon-left",e),type:"button",onClick:()=>{"onClick"in s&&typeof s.onClick=="function"?s.onClick():console.error("UserMenuButton item is missing onClick handler or onClick is not a function:",s)},children:[s.iconName&&o.jsx(R,{name:s.iconName,className:"pkt-link__icon","aria-hidden":"true"}),s.title]}),nb=({links:s})=>o.jsx("ul",{className:"pkt-user-menu__sublist",children:s.map((e,t)=>o.jsx("li",{className:"pkt-user-menu__subitem",children:o.jsx(Gi,{item:e})},t))}),Ol=d.forwardRef(({user:s,formattedLastLoggedIn:e,representing:t,userMenu:n,canChangeRepresentation:i,changeRepresentation:r,logoutOnClick:a},l)=>{const c=n==null?void 0:n.map(sb);return o.jsx("nav",{className:"pkt-user-menu",ref:l,"aria-label":"Meny for innlogget bruker",children:o.jsxs("ul",{className:"pkt-user-menu__list",children:[s&&o.jsxs("li",{className:"pkt-user-menu__item",children:[o.jsx("div",{className:"pkt-user-menu__label",children:"Pålogget som"}),o.jsx("div",{className:"pkt-user-menu__name",translate:"no",children:s.name}),e&&o.jsxs("div",{className:"pkt-user-menu__last-logged-in",children:["Sist pålogget: ",o.jsx("time",{children:e})]})]}),c&&c.length>0&&o.jsx("li",{className:"pkt-user-menu__item",children:o.jsx(nb,{links:c})}),t&&o.jsxs("li",{className:"pkt-user-menu__item",children:[o.jsx("div",{className:"pkt-user-menu__label",children:"Representerer"}),o.jsx("div",{className:"pkt-user-menu__name",translate:"no",children:t.name}),t.orgNumber&&o.jsxs("div",{className:"pkt-user-menu__org-number",children:["Org.nr. ",t.orgNumber]}),i&&r&&o.jsx("ul",{className:"pkt-user-menu__sublist mt-size-16",children:o.jsx("li",{className:"pkt-user-menu__subitem",children:o.jsx(Gi,{item:{title:"Endre organisasjon",iconName:"cogwheel",onClick:r}})})})]}),!t&&i&&r&&o.jsx("li",{className:"pkt-user-menu__item",children:o.jsx("ul",{className:"pkt-user-menu__sublist",children:o.jsx("li",{className:"pkt-user-menu__subitem",children:o.jsx(Gi,{item:{title:"Endre organisasjon",iconName:"cogwheel",onClick:r}})})})}),a&&o.jsx("li",{className:"pkt-user-menu__item",children:o.jsx(Gi,{item:{title:"Logg ut",iconName:"exit",onClick:a}})})]})})});Ol.displayName="PktHeaderUserMenu";const Xi=d.forwardRef(({id:s,ariaDescribedby:e,ariaLabelledby:t,autocomplete:n="off",counter:i,counterMaxLength:r,className:a,disabled:l=!1,errorMessage:c,hasError:h=!1,helptext:g,helptextDropdown:m,helptextDropdownButton:f,iconNameRight:k,inline:v=!1,fullwidth:$=!1,label:N,name:x,optionalTag:T=!1,optionalText:P,requiredTag:D=!1,requiredText:j,tagText:H=null,placeholder:X,prefix:fe,suffix:q,type:M="text",useWrapper:z=!0,omitSearchIcon:L=!1,value:Q,minLength:ae,maxLength:ee,min:ue,max:le,step:be,size:ne,readonly:re,required:Ue,dataTestid:Z,onChange:A,skipForwardTestid:Me=!1,...De},te)=>{const Ie=[a,"pkt-textinput"].join(" "),Ee=M==="search"&&!k&&!L,ye=M==="date"&&Q?Q.slice(0,10):Q,[Te,Pe]=d.useState((Q==null?void 0:Q.length)||0),je=`${s}`,Ae=`${je}-label`,ve=t||Ae,E=Le=>{var Ye,U;i&&Pe(((U=(Ye=Le.currentTarget)==null?void 0:Ye.value)==null?void 0:U.length)||0),A&&A(Le)};return d.useEffect(()=>{Q!==void 0&&Pe((Q==null?void 0:Q.length)||0)},[Q]),o.jsx(Ms,{ariaDescribedby:e,className:Ie,disabled:l,errorMessage:c,forId:je,hasError:h,helptext:g,helptextDropdown:m,helptextDropdownButton:f,inline:v,label:N,optionalTag:T,optionalText:P,requiredTag:D,requiredText:j,tagText:H,useWrapper:z,counter:i,counterCurrent:Te,counterMaxLength:r,children:o.jsxs("div",{className:"pkt-input__container","data-testid":Z,"data-skip-forward-testid":Me?"true":void 0,children:[fe&&o.jsx("div",{className:"pkt-input-prefix",children:fe}),o.jsx("input",{...De,ref:te,className:`pkt-input ${$?"pkt-input--fullwidth":""} ${r&&Te>r?"pkt-input--counter-error":""}`,type:M,name:`${x||s}`,value:ye,id:je,placeholder:X,autoComplete:n,disabled:l,"aria-invalid":h,"aria-errormessage":`${s}-error`,"aria-labelledby":ve,min:ue,max:le,onChange:E,step:be,minLength:ae,maxLength:ee,size:ne,readOnly:re,required:Ue}),q&&o.jsxs("p",{className:"pkt-input-suffix",children:[q,k&&o.jsx(R,{className:"pkt-input-suffix-icon",name:k}),Ee&&o.jsx(R,{className:"pkt-input-suffix-icon",name:"magnifying-glass-big"})]}),!q&&k&&o.jsx(R,{className:"pkt-input-icon",name:k}),!q&&Ee&&o.jsx(R,{className:"pkt-input-icon",name:"magnifying-glass-big"})]})})});Xi.displayName="PktTextinput";const Zr=d.forwardRef(({mobileBreakpoint:s=768,tabletBreakpoint:e=1280,children:t,className:n,compact:i=!1,"data-mode":r,logOutButtonPlacement:a="none",logOut:l,openedMenu:c,showSearch:h=!1,onSearch:g,onSearchChange:m,searchValue:f,searchPlaceholder:k="Søk",representing:v,serviceLink:$,serviceClick:N,serviceName:x,user:T,userMenu:P,userMenuFooter:D,userOptions:j,canChangeRepresentation:H=!1,changeRepresentation:X,hideLogo:fe=!1,logoLink:q,logoClick:M,position:z="fixed",scrollBehavior:L="hide",slotMenuVariant:Q="icon-only",slotMenuText:ae="Meny"},ee)=>{const ue=z==="fixed",le=L==="hide";d.useEffect(()=>{D&&console.warn('PktHeaderService: The "userMenuFooter" prop is deprecated and will be removed in a future version. Please use "userMenu" instead.')},[D]),d.useEffect(()=>{j&&console.warn('PktHeaderService: The "userOptions" prop is no longer available. Please use "userMenu" instead.')},[j]),d.useEffect(()=>{T!=null&&T.shortname&&console.warn('PktHeaderService: The "shortname" property on the user object is deprecated and will be removed in a future version.'),v!=null&&v.shortname&&console.warn('PktHeaderService: The "shortname" property on the representing object is deprecated and will be removed in a future version.')},[T==null?void 0:T.shortname,v==null?void 0:v.shortname]);const be=d.useMemo(()=>{if(T!=null&&T.lastLoggedIn)return typeof T.lastLoggedIn=="string"?T.lastLoggedIn:new Date(T.lastLoggedIn).toLocaleString("nb-NO",{year:"numeric",month:"long",day:"numeric"})},[T==null?void 0:T.lastLoggedIn]),[ne,re]=d.useState(c||"none");d.useEffect(()=>{c!==void 0&&re(c)},[c]);const[Ue,Z]=d.useState(!1),[A,Me]=d.useState(0),[De,te]=d.useState(!1),[Ie,Ee]=d.useState(!1),ye=d.useRef(null),Te=d.useRef(null),Pe=d.useRef(null),je=d.useRef(null),Ae=d.useRef(null),ve=d.useRef(null),E=d.useRef(null),Le=d.useRef(!1),Ye=eb(ye),U=Ye<s,V=Ye<e,se=d.useCallback(p=>{ye.current=p,typeof ee=="function"?ee(p):ee&&(ee.current=p)},[ee]);tb(ue&&U&&ne!=="none");const me=d.useCallback((p,_)=>{const S=p.relatedTarget;let Y;switch(_){case"user":Y=Te;break;case"slot":Y=Pe;break;case"search":Y=je;break;default:return}const K=Y.current;K&&(!S||!K.contains(S))&&re("none")},[]),ge=d.useCallback(()=>{Le.current&&E.current&&document.contains(E.current)&&E.current.focus(),E.current=null,Le.current=!1},[]);d.useEffect(()=>{const p=S=>{T&&ne==="user"&&!S.target.closest(".pkt-header-service__user-container")&&re("none"),ne==="slot"&&!S.target.closest(".pkt-header-service__slot-container")&&re("none"),ne==="search"&&!S.target.closest(".pkt-header-service__search-container")&&!S.target.closest(".pkt-header-service__search-input")&&re("none")},_=S=>{S.key==="Escape"&&ne!=="none"&&(S.preventDefault(),Le.current=!0,re("none"))};if(ne!=="none")return document.addEventListener("mousedown",p),document.addEventListener("keydown",_),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",_)};ge()},[ne,T,ge]),d.useEffect(()=>{const p=()=>{if(le){const _=window.pageYOffset||document.documentElement.scrollTop;if(_<0||Math.abs(_-A)<60)return;Z(_>A),Me(_)}};return document&&window.addEventListener("scroll",p),()=>{document&&window.removeEventListener("scroll",p)}},[le,A]);const Xe=d.useCallback(p=>{const _=p==="slot"?Pe:je,S=p==="slot"?Ae:ve;if(!_.current||!S.current||!V||U)return;const Y=_.current.getBoundingClientRect(),K=S.current.offsetWidth,ce=Y.left+K>window.innerWidth;p==="slot"?te(ce):Ee(ce)},[V,U]),Ke=d.useCallback(p=>{ne!=="none"?re("none"):(E.current=document.activeElement,re(p))},[ne]);d.useEffect(()=>{(ne==="slot"||ne==="search")&&requestAnimationFrame(()=>{Xe(ne)})},[ne,Xe]);const b=o.jsxs("header",{className:oe("pkt-header-service",i&&"pkt-header-service--compact",U&&"pkt-header-service--mobile",V&&"pkt-header-service--tablet",ue&&"pkt-header-service--fixed",le&&"pkt-header-service--scroll-to-hide",Ue&&"pkt-header-service--hidden",n),"data-mode":r,ref:se,children:[o.jsxs("div",{className:oe("pkt-header-service__logo-area",(!x||x==="")&&"pkt-header-service__logo-area--without-service"),children:[!fe&&o.jsx("span",{className:"pkt-header-service__logo",children:q?o.jsx("a",{href:q,"aria-label":"Tilbake til forside",children:o.jsx(R,{name:"oslologo","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/16.5/logos/"})}):M?o.jsx("button",{"aria-label":"Tilbake til forside",className:"pkt-link-button pkt-link pkt-header-service__logo-link",onClick:M,children:o.jsx(R,{name:"oslologo","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/16.5/logos/"})}):o.jsx(R,{name:"oslologo","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/16.5/logos/"})}),x&&o.jsx("span",{className:"pkt-header-service__service-name",children:$?o.jsx(Ki,{href:$,className:"pkt-header-service__service-link ",children:x}):N?o.jsx("button",{className:"pkt-link-button pkt-link pkt-header-service__service-link",onClick:N,children:x}):o.jsx("span",{className:"pkt-header-service__service-link",children:x})})]}),o.jsxs("div",{className:"pkt-header-service__content",children:[o.jsxs("div",{className:oe("pkt-header-service__slot-container",ne==="slot"&&"is-open"),onBlur:p=>me(p,"slot"),ref:Pe,children:[V&&t&&o.jsx(dt,{skin:"secondary",variant:Q,iconName:"menu",size:U?"small":"medium",state:ne==="slot"?"active":"normal",onClick:()=>Ke("slot"),"aria-expanded":ne==="slot","aria-controls":"mobile-slot-menu","aria-label":"Åpne meny",children:ae}),o.jsx("div",{className:oe("pkt-header-service__slot-content",De&&"align-right"),id:"mobile-slot-menu",role:V?"menu":void 0,"aria-label":V?"Meny":void 0,ref:Ae,children:o.jsx("div",{className:"pkt-contents",children:t})})]}),h&&o.jsx(o.Fragment,{children:V?o.jsxs("div",{className:oe("pkt-header-service__search-container",ne==="search"&&"is-open"),onBlur:p=>me(p,"search"),ref:je,children:[o.jsx(dt,{skin:"secondary",variant:"icon-only",iconName:"magnifying-glass-big",size:U?"small":"medium",onClick:()=>Ke("search"),state:ne==="search"?"active":"normal","aria-expanded":ne==="search","aria-controls":"mobile-search-menu","aria-label":"Åpne søkefelt",children:"Søk"}),o.jsx("div",{className:oe("pkt-header-service__mobile-menu",ne==="search"&&"is-open",Ie&&"align-right"),ref:ve,children:ne==="search"&&o.jsx(Xi,{id:"mobile-search-menu",className:"pkt-header-service__search-input",type:"search",label:"Søk",useWrapper:!1,placeholder:k,value:f,autoFocus:!0,fullwidth:!0,onChange:p=>m==null?void 0:m(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(g==null||g(p.target.value))}})})]}):o.jsx(Xi,{id:"header-service-search",className:"pkt-header-service__search-input",type:"search",label:"Søk",useWrapper:!1,placeholder:k,value:f,onChange:p=>m==null?void 0:m(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(g==null||g(p.target.value))}})}),V&&l&&(a==="header"||a==="both")&&o.jsx(dt,{skin:"secondary",size:U?"small":"medium",variant:"icon-only",iconName:"exit",onClick:l,children:"Logg ut"})]}),o.jsxs("div",{className:"pkt-header-service__user",children:[T&&o.jsxs("div",{className:"pkt-header-service__user-container",onBlur:p=>me(p,"user"),ref:Te,children:[o.jsxs(dt,{className:oe("pkt-header-service__user-button",U&&"pkt-header-service__user-button--mobile"),skin:"secondary",size:U?"small":"medium",state:ne==="user"?"active":"normal",variant:"icons-right-and-left",iconName:"user",secondIconName:ne==="user"?"chevron-thin-up":"chevron-thin-down",onClick:()=>Ke("user"),children:[o.jsx("span",{className:"pkt-sr-only",children:"Brukermeny: "}),(v==null?void 0:v.name)||T.name]}),ne==="user"&&T&&o.jsx("div",{className:oe(U?"pkt-header-service__mobile-menu":"pkt-header-service__user-menu","is-open"),children:o.jsx(Ol,{user:T,formattedLastLoggedIn:be,representing:v,userMenu:P,canChangeRepresentation:H,changeRepresentation:X,logoutOnClick:a==="userMenu"||a==="both"?l:void 0})})]}),!U&&l&&(a==="header"||a==="both")&&o.jsx(dt,{skin:"tertiary",size:"medium",variant:"icon-right",iconName:"exit",onClick:l,children:"Logg ut"})]})]});return ue?o.jsxs("div",{className:"pkt-header-service-wrapper",children:[b,o.jsx("div",{className:oe("pkt-header-service-spacer",i&&"pkt-header-service-spacer--compact",T&&"pkt-header-service-spacer--has-user",U&&"pkt-header-service-spacer--mobile",V&&"pkt-header-service-spacer--tablet")})]}):b});Zr.displayName="PktHeaderService";const El=d.forwardRef((s,e)=>o.jsx(Zr,{...s,ref:e}));El.displayName="PktHeader";const ib=Js({tagName:"pkt-heading",elementClass:_s,react:d,displayName:"PktHeading"}),Pl=d.forwardRef(({children:s,...e},t)=>o.jsx(ib,{"data-testid":"pkt-heading",...e,ref:t,children:s}));Pl.displayName="PktHeading";const rb=Js({tagName:"pkt-helptext",elementClass:$s,react:d,displayName:"PktHelptext",events:{onToggleHelpText:"toggleHelpText"}}),Al=d.forwardRef(({children:s,...e},t)=>o.jsx(rb,{...e,ref:t,children:o.jsx("div",{className:"pkt-contents",children:s})}));Al.displayName="PktHelptext";const Il=d.forwardRef(({label:s,id:e,children:t,...n},i)=>o.jsxs("div",{className:"pkt-form-group",children:[o.jsx("label",{htmlFor:e,className:"pkt-form-label",children:s}),o.jsx("input",{className:"pkt-form-input",id:e,...n,ref:i}),t]}));Il.displayName="PktInput";const Ll=({children:s,skin:e,title:t,href:n,iconName:i,openInNewTab:r,external:a,className:l,...c})=>{const h=["pkt-linkcard",e&&`pkt-linkcard--${e}`].filter(Boolean).join(" "),g=["pkt-linkcard__title",a&&"pkt-link pkt-link--external"].filter(Boolean).join(" ");return o.jsxs("a",{...c,href:n,className:oe(h,l),target:r?"_blank":"_self",rel:r?"noopener noreferrer":void 0,children:[i&&o.jsx(R,{className:"pkt-link__icon",name:i}),t&&o.jsx("div",{className:oe(g),children:t}),o.jsx("div",{className:"pkt-linkcard__text",children:s})]})};Ll.displayName="PktLinkCard";const ab=Js({tagName:"pkt-loader",elementClass:Kt,react:d,displayName:"PktLoader",events:{}}),Bl=d.forwardRef(({children:s,...e},t)=>o.jsx(ab,{...e,ref:t,children:o.jsx("div",{className:"pkt-contents",children:s})}));Bl.displayName="PktLoader";const Fl=({children:s,className:e,skin:t,title:n,compact:i,closable:r,onClose:a,...l})=>{const[c,h]=d.useState(!1),g={"pkt-messagebox":!0,"pkt-messagebox--compact":i,[`pkt-messagebox--${t}`]:t,"pkt-messagebox--closable":r,"pkt-hide":c},m=d.createRef(),f=d.useCallback(()=>{h(!0),a&&a()},[h,a]);return o.jsxs("div",{...l,className:oe(g,e),ref:m,children:[r&&o.jsx("div",{className:"pkt-messagebox__close",children:o.jsx("button",{onClick:f,className:"pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only","aria-label":"Lukk",children:o.jsx(R,{name:"close",className:"pkt-link__icon"})})}),n&&o.jsx("div",{className:"pkt-messagebox__title",children:n}),o.jsx("div",{className:"pkt-messagebox__text",children:s})]})};Fl.displayName="PktMessagebox";const ob=Js({tagName:"pkt-progressbar",elementClass:Ze,react:d,displayName:"PktProgressbar",events:{}}),Qi=d.forwardRef(({children:s,...e},t)=>o.jsx(ob,{ref:t,...e,children:o.jsx("div",{className:"pkt-contents",children:s})}));Qi.displayName="PktProgressbar";const Vl=d.forwardRef(({id:s,name:e,label:t,className:n,hasTile:i=!1,disabled:r=!1,checkHelptext:a,hasError:l=!1,defaultChecked:c,checked:h,optionalTag:g,optionalText:m,requiredTag:f,requiredText:k,tagText:v,...$},N)=>{const x=[n,"pkt-input-check"].filter(Boolean).join(" "),T=["pkt-input-check__input",i?"pkt-input-check__input--tile":"",r&&i?"pkt-input-check__input--tile-disabled":""].filter(Boolean).join(" "),P=["pkt-input-check__input-checkbox",l?"pkt-input-check__input-checkbox--error":""].filter(Boolean).join(" "),D=["pkt-input-check__input-label",r?"pkt-input-check__input-label--disabled":""].filter(Boolean).join(" "),j=["pkt-tag","pkt-tag--small","pkt-tag--thin-text"].join(" "),H=()=>o.jsxs(o.Fragment,{children:[v&&o.jsx("span",{className:j+" pkt-tag--gray",children:v}),g&&o.jsx("span",{className:j+" pkt-tag--blue-light",children:m}),f&&o.jsx("span",{className:j+" pkt-tag--beige",children:k})]});return o.jsx("div",{className:x,children:o.jsxs("div",{className:T,children:[o.jsx("input",{ref:N,id:s,type:"radio",name:e,disabled:r,className:P,...h!==void 0?{checked:h}:{defaultChecked:c},...$}),o.jsxs("label",{className:D,htmlFor:s,children:[t," ",H(),a&&o.jsx("div",{className:"pkt-input-check__input-helptext",children:a})]})]})})});Vl.displayName="PktRadioButton";const Hl=d.forwardRef(({appearance:s="local",disabled:e=!1,fullwidth:t=!1,id:n,label:i,name:r,placeholder:a="Søk…",suggestions:l,value:c="",action:h,method:g,onChange:m,onSearch:f,onSuggestionClick:k,...v},$)=>{const N=(D,j)=>{D?D():k&&k(j)},x=D=>{c=D.target.value},T=`pkt-searchinput pkt-searchinput--${s} ${t?"pkt-searchinput--fullwidth":""}`;let P;return h?P=D=>o.jsx("form",{role:"search",className:T,action:h,method:g,children:D}):P=D=>o.jsx("div",{role:"search",className:T,children:D}),P(o.jsxs(o.Fragment,{children:[i&&o.jsx("label",{htmlFor:i?n:void 0,className:i?"pkt-inputwrapper__label":"",children:i}),o.jsxs("div",{className:s==="local"?"pkt-input__container":"pkt-searchinput__field",children:[o.jsx("input",{className:`pkt-input ${t?"pkt-input--fullwidth":""}`,type:"search",name:r||n,id:n,placeholder:a,defaultValue:c,disabled:e,autoComplete:"off","aria-autocomplete":"list",ref:$,"aria-controls":`${n}-suggestions`,onChange:m||x,onKeyUp:f&&(D=>{D.key==="Enter"&&(D.preventDefault(),f(c))}),...v}),o.jsx(dt,{className:`pkt-searchinput__button ${s==="local"?"pkt-input-icon":""}`,variant:"icon-only",iconName:"magnifying-glass-big",skin:s==="local"?"tertiary":"primary",color:s==="global"?"yellow":void 0,type:"submit",disabled:e,onClick:f&&(D=>{D.preventDefault(),f(c)}),children:i||a})]}),l&&o.jsx("ul",{id:`${n}-suggestions`,className:"pkt-searchinput__suggestions","aria-live":"assertive",children:l.map((D,j)=>o.jsx("li",{children:d.createElement(D.href?"a":D.onClick?"button":"div",{href:D.href,className:`pkt-searchinput__suggestion ${D.onClick?"pkt-link-button":""} ${D.href||D.onClick?"pkt-searchinput__suggestion--has-hover":""}`,type:D.onClick?"button":void 0,onClick:()=>N(D.onClick,j),onKeyUp:H=>H.key==="Enter"&&N(D.onClick,j)},o.jsxs(o.Fragment,{children:[D.title&&o.jsx("h3",{className:"pkt-searchinput__suggestion-title",children:D.title}),D.text&&o.jsx("p",{className:"pkt-searchinput__suggestion-text",children:D.text})]}))},`search-suggestion-${j}`))})]}))});Hl.displayName="PktSearchInput";const Ul=d.forwardRef(({ariaDescribedby:s,ariaLabelledby:e,children:t,className:n,disabled:i=!1,errorMessage:r,hasError:a,helptext:l,helptextDropdown:c,helptextDropdownButton:h,id:g,inline:m=!1,fullwidth:f=!1,label:k,name:v,optionalTag:$=!1,optionalText:N,requiredTag:x=!1,requiredText:T,tagText:P,...D},j)=>{const H=[n,"pkt-select"].join(" ");return o.jsx(Ms,{className:H,forId:`${g}-input`,label:k,helptext:l,helptextDropdown:c,helptextDropdownButton:h,optionalTag:$,optionalText:N,requiredTag:x,requiredText:T,tagText:P,hasError:a,errorMessage:r,disabled:i,inline:m,ariaDescribedby:s,children:o.jsx("select",{ref:j,className:`pkt-input ${f?"pkt-input--fullwidth":""}`,"aria-invalid":a,"aria-errormessage":`${g}-error`,"aria-labelledby":e||void 0,disabled:i,id:`${g}-input`,name:v||g,...D,children:t})})});Ul.displayName="PktSelect";const lb=o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",children:o.jsx("circle",{cx:"12",cy:"12",r:"7",style:{fill:"var(--pkt-color-grays-grey-200, #CCC)"}})}),cb=o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",children:[o.jsx("circle",{opacity:".15",cx:"12",cy:"12",r:"12",fill:"#2A2859"}),o.jsx("circle",{cx:"12",cy:"12",r:"6",fill:"#2A2859"})]}),ub=o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",children:[o.jsx("path",{fill:"#2A2859",d:"M3 3h18v18H3z"}),o.jsx("path",{d:"m10.34 16-1.11-1.14L7 12.58l1.11-1.15 2.23 2.28L15.88 8 17 9.15l-5.55 5.71L10.34 16Z",fill:"#F1FDFF"})]}),db=({children:s,className:e,status:t="incomplete",title:n})=>o.jsxs("li",{className:oe("pkt-step",e,`pkt-step--${t}`),"data-testid":"pkt-step",children:[o.jsx("span",{className:"pkt-step__line pkt-step__line--1","aria-hidden":!0}),o.jsx("span",{className:"pkt-step__line pkt-step__line--2","aria-hidden":!0}),o.jsx("span",{className:oe("pkt-step__indicator"),children:t==="current"?cb:t==="completed"?ub:lb}),o.jsx("span",{className:"pkt-step__line pkt-step__line--3","aria-hidden":!0}),o.jsxs("div",{className:"pkt-step__wrapper",children:[o.jsx("div",{className:"pkt-step__title",children:n}),o.jsx("div",{className:"pkt-step__content",children:s})]})]}),jl=d.forwardRef(({activeStep:s,className:e,children:t,hideNonActiveSteps:n=!1,hideNonActiveStepsContent:i=!0,orientation:r="vertical",...a},l)=>{const c=oe(e,"pkt-stepper",r==="horizontal"?"pkt-stepper--horizontal":"pkt-stepper--vertical"),h=d.Children.map(t,(g,m)=>d.isValidElement(g)?d.cloneElement(g,{className:oe(g.props.className,{"pkt-step--hideStep":n&&m!==s,"pkt-step--hideContent":i&&m!==s})}):g);return o.jsx("ol",{"data-testid":"pkt-stepper",className:c,ref:l,...a,children:h})});jl.displayName="PktStepper";const hb=({className:s,compact:e=!1,skin:t="basic",responsiveView:n=!0,children:i,...r})=>o.jsx("table",{"data-testid":"pkt-table",className:oe(s,"pkt-table",{"pkt-table--responsive":n,"pkt-table--compact":e,"pkt-table--basic":t==="basic","pkt-table--zebra-blue":t==="zebra-blue"}),role:"table",...r,children:i}),pb=({id:s,children:e,className:t,...n})=>o.jsx("tbody",{id:s,className:oe(t,"pkt-table__body",{}),...n,role:"rowgroup",children:e}),fb=({children:s,className:e,dataLabel:t,...n})=>o.jsx("td",{className:oe(e,"pkt-table__data-cell",{}),"data-label":t,role:"cell","data-testid":"pkt-table__data-cell",...n,children:s}),gb=({className:s,children:e,...t})=>o.jsx("thead",{className:oe(s,"pkt-table__header",{}),role:"rowgroup",...t,children:e}),mb=({className:s,children:e,...t})=>o.jsx("th",{className:oe(s,"pkt-table__header-cell",{}),role:"columnheader",...t,children:e}),bb=({className:s,children:e,...t})=>o.jsx("tr",{className:oe(s,"pkt-table__row",{}),role:"row",...t,children:e}),Jr=d.forwardRef(({children:s,active:e,href:t,onClick:n,icon:i,controls:r,tag:a,tagSkin:l,index:c=0},h)=>{const{arrowNav:g,registerTabRef:m,handleKeyPress:f,selectTab:k}=vb(),$={"aria-selected":g?!!e:void 0,"aria-controls":r,role:g?"tab":void 0,onKeyUp:x=>f(c,x),onClick:x=>{k(c),n==null||n(x)},tabIndex:e||!g?void 0:-1,ref:x=>{m(c,x),typeof h=="function"?h(x):h&&(h.current=x)}},N=o.jsxs(o.Fragment,{children:[i&&o.jsx(R,{name:i,className:"pkt-icon--small"}),s,a&&o.jsx(Ns,{skin:l,size:"small",children:a})]});return t?o.jsx("a",{...$,href:t,className:`pkt-tabs__link ${e?"active":""}`,children:N}):o.jsx("button",{...$,type:"button",className:`pkt-tabs__button pkt-link-button ${e?"active":""}`,children:N})});Jr.displayName="PktTabItem";const ql=d.createContext(null),vb=()=>{const s=d.useContext(ql);if(!s)throw new Error("TabItem must be used within a Tabs component");return s},Wl=d.forwardRef(({arrowNav:s=!0,disableArrowNav:e=!1,tabs:t,onTabSelected:n,children:i},r)=>{const a=d.useRef([]),l=s&&!e,h=i&&d.Children.count(i)>0?d.Children.count(i):(t==null?void 0:t.length)||0;d.useEffect(()=>{a.current=a.current.slice(0,h)},[h]);const g=v=>{const $=t==null?void 0:t[v];$!=null&&$.action&&$.action(v),n&&n(v)},m=(v,$)=>{var N,x;l&&($.code==="ArrowLeft"&&v!==0&&((N=a.current[v-1])==null||N.focus()),$.code==="ArrowRight"&&v<h-1&&((x=a.current[v+1])==null||x.focus()),($.code==="ArrowDown"||$.code==="Space")&&g(v))},f=(v,$)=>{a.current[v]=$},k=t==null?void 0:t.map((v,$)=>{var N,x;return o.jsx(Jr,{active:v.active,href:v.href,onClick:()=>g($),icon:v.icon,controls:v.controls,tag:(N=v.tag)==null?void 0:N.text,tagSkin:(x=v.tag)==null?void 0:x.skin,index:$,children:v.text},$)});return o.jsx(ql.Provider,{value:{arrowNav:l,registerTabRef:f,handleKeyPress:m,selectTab:g},children:o.jsx("div",{className:"pkt-tabs",ref:r,children:o.jsx("div",{className:"pkt-tabs__list",role:l?"tablist":"navigation",children:i||k})})})});Wl.displayName="PktTabs";var yn=window.CustomEvent;(!yn||typeof yn=="object")&&(yn=function(s,e){e=e||{};var t=document.createEvent("CustomEvent");return t.initCustomEvent(s,!!e.bubbles,!!e.cancelable,e.detail||null),t},yn.prototype=window.Event.prototype);function zl(s,e){var t="on"+e.type.toLowerCase();return typeof s[t]=="function"&&s[t](e),s.dispatchEvent(e)}function kb(s){for(;s&&s!==document.body;){var e=window.getComputedStyle(s),t=function(n,i){return!(e[n]===void 0||e[n]===i)};if(e.opacity<1||t("zIndex","auto")||t("transform","none")||t("mixBlendMode","normal")||t("filter","none")||t("perspective","none")||e.isolation==="isolate"||e.position==="fixed"||e.webkitOverflowScrolling==="touch")return!0;s=s.parentElement}return!1}function li(s){for(;s;){if(s.localName==="dialog")return s;s.parentElement?s=s.parentElement:s.parentNode?s=s.parentNode.host:s=null}return null}function Yl(s){for(;s&&s.shadowRoot&&s.shadowRoot.activeElement;)s=s.shadowRoot.activeElement;s&&s.blur&&s!==document.body&&s.blur()}function yb(s,e){for(var t=0;t<s.length;++t)if(s[t]===e)return!0;return!1}function Rr(s){return!s||!s.hasAttribute("method")?!1:s.getAttribute("method").toLowerCase()==="dialog"}function Kl(s){var e=["button","input","keygen","select","textarea"],t=e.map(function(a){return a+":not([disabled])"});t.push('[tabindex]:not([disabled]):not([tabindex=""])');var n=s.querySelector(t.join(", "));if(!n&&"attachShadow"in Element.prototype)for(var i=s.querySelectorAll("*"),r=0;r<i.length&&!(i[r].tagName&&i[r].shadowRoot&&(n=Kl(i[r].shadowRoot),n));r++);return n}function Gl(s){return s.isConnected||document.body.contains(s)}function Xl(s){if(s.submitter)return s.submitter;var e=s.target;if(!(e instanceof HTMLFormElement))return null;var t=ke.formSubmitter;if(!t){var n=s.target,i="getRootNode"in n&&n.getRootNode()||document;t=i.activeElement}return!t||t.form!==e?null:t}function _b(s){if(!s.defaultPrevented){var e=s.target,t=ke.imagemapUseValue,n=Xl(s);t===null&&n&&(t=n.value);var i=li(e);if(i){var r=n&&n.getAttribute("formmethod")||e.getAttribute("method");r==="dialog"&&(s.preventDefault(),t!=null?i.close(t):i.close())}}}function Ql(s){if(this.dialog_=s,this.replacedStyleTop_=!1,this.openAsModal_=!1,s.hasAttribute("role")||s.setAttribute("role","dialog"),s.show=this.show.bind(this),s.showModal=this.showModal.bind(this),s.close=this.close.bind(this),s.addEventListener("submit",_b,!1),"returnValue"in s||(s.returnValue=""),"MutationObserver"in window){var e=new MutationObserver(this.maybeHideModal.bind(this));e.observe(s,{attributes:!0,attributeFilter:["open"]})}else{var t=!1,n=(function(){t?this.downgradeModal():this.maybeHideModal(),t=!1}).bind(this),i,r=function(a){if(a.target===s){var l="DOMNodeRemoved";t|=a.type.substr(0,l.length)===l,window.clearTimeout(i),i=window.setTimeout(n,0)}};["DOMAttrModified","DOMNodeRemoved","DOMNodeRemovedFromDocument"].forEach(function(a){s.addEventListener(a,r)})}Object.defineProperty(s,"open",{set:this.setOpen.bind(this),get:s.hasAttribute.bind(s,"open")}),this.backdrop_=document.createElement("div"),this.backdrop_.className="backdrop",this.backdrop_.addEventListener("mouseup",this.backdropMouseEvent_.bind(this)),this.backdrop_.addEventListener("mousedown",this.backdropMouseEvent_.bind(this)),this.backdrop_.addEventListener("click",this.backdropMouseEvent_.bind(this))}Ql.prototype={get dialog(){return this.dialog_},maybeHideModal:function(){this.dialog_.hasAttribute("open")&&Gl(this.dialog_)||this.downgradeModal()},downgradeModal:function(){this.openAsModal_&&(this.openAsModal_=!1,this.dialog_.style.zIndex="",this.replacedStyleTop_&&(this.dialog_.style.top="",this.replacedStyleTop_=!1),this.backdrop_.parentNode&&this.backdrop_.parentNode.removeChild(this.backdrop_),ke.dm.removeDialog(this))},setOpen:function(s){s?this.dialog_.hasAttribute("open")||this.dialog_.setAttribute("open",""):(this.dialog_.removeAttribute("open"),this.maybeHideModal())},backdropMouseEvent_:function(s){if(this.dialog_.hasAttribute("tabindex"))this.dialog_.focus();else{var e=document.createElement("div");this.dialog_.insertBefore(e,this.dialog_.firstChild),e.tabIndex=-1,e.focus(),this.dialog_.removeChild(e)}var t=document.createEvent("MouseEvents");t.initMouseEvent(s.type,s.bubbles,s.cancelable,window,s.detail,s.screenX,s.screenY,s.clientX,s.clientY,s.ctrlKey,s.altKey,s.shiftKey,s.metaKey,s.button,s.relatedTarget),this.dialog_.dispatchEvent(t),s.stopPropagation()},focus_:function(){var s=this.dialog_.querySelector("[autofocus]:not([disabled])");!s&&this.dialog_.tabIndex>=0&&(s=this.dialog_),s||(s=Kl(this.dialog_)),Yl(document.activeElement),s&&s.focus()},updateZIndex:function(s,e){if(s<e)throw new Error("dialogZ should never be < backdropZ");this.dialog_.style.zIndex=s,this.backdrop_.style.zIndex=e},show:function(){this.dialog_.open||(this.setOpen(!0),this.focus_())},showModal:function(){if(this.dialog_.hasAttribute("open"))throw new Error("Failed to execute 'showModal' on dialog: The element is already open, and therefore cannot be opened modally.");if(!Gl(this.dialog_))throw new Error("Failed to execute 'showModal' on dialog: The element is not in a Document.");if(!ke.dm.pushDialog(this))throw new Error("Failed to execute 'showModal' on dialog: There are too many open modal dialogs.");kb(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,ke.needsCentering(this.dialog_)?(ke.reposition(this.dialog_),this.replacedStyleTop_=!0):this.replacedStyleTop_=!1,this.dialog_.parentNode.insertBefore(this.backdrop_,this.dialog_.nextSibling),this.focus_()},close:function(s){if(!this.dialog_.hasAttribute("open"))throw new Error("Failed to execute 'close' on dialog: The element does not have an 'open' attribute, and therefore cannot be closed.");this.setOpen(!1),s!==void 0&&(this.dialog_.returnValue=s);var e=new yn("close",{bubbles:!1,cancelable:!1});zl(this.dialog_,e)}};var ke={};if(ke.reposition=function(s){var e=document.body.scrollTop||document.documentElement.scrollTop,t=e+(window.innerHeight-s.offsetHeight)/2;s.style.top=Math.max(e,t)+"px"},ke.isInlinePositionSetByStylesheet=function(s){for(var e=0;e<document.styleSheets.length;++e){var t=document.styleSheets[e],n=null;try{n=t.cssRules}catch{}if(n)for(var i=0;i<n.length;++i){var r=n[i],a=null;try{a=document.querySelectorAll(r.selectorText)}catch{}if(!(!a||!yb(a,s))){var l=r.style.getPropertyValue("top"),c=r.style.getPropertyValue("bottom");if(l&&l!=="auto"||c&&c!=="auto")return!0}}}return!1},ke.needsCentering=function(s){var e=window.getComputedStyle(s);return e.position!=="absolute"||s.style.top!=="auto"&&s.style.top!==""||s.style.bottom!=="auto"&&s.style.bottom!==""?!1:!ke.isInlinePositionSetByStylesheet(s)},ke.forceRegisterDialog=function(s){if((window.HTMLDialogElement||s.showModal)&&console.warn("This browser already supports <dialog>, the polyfill may not work correctly",s),s.localName!=="dialog")throw new Error("Failed to register dialog: The element is not a dialog.");new Ql(s)},ke.registerDialog=function(s){s.showModal||ke.forceRegisterDialog(s)},ke.DialogManager=function(){this.pendingDialogStack=[];var s=this.checkDOM_.bind(this);this.overlay=document.createElement("div"),this.overlay.className="_dialog_overlay",this.overlay.addEventListener("click",(function(e){this.forwardTab_=void 0,e.stopPropagation(),s([])}).bind(this)),this.handleKey_=this.handleKey_.bind(this),this.handleFocus_=this.handleFocus_.bind(this),this.zIndexLow_=1e5,this.zIndexHigh_=100150,this.forwardTab_=void 0,"MutationObserver"in window&&(this.mo_=new MutationObserver(function(e){var t=[];e.forEach(function(n){for(var i=0,r;r=n.removedNodes[i];++i){if(r instanceof Element)r.localName==="dialog"&&t.push(r);else continue;t=t.concat(r.querySelectorAll("dialog"))}}),t.length&&s(t)}))},ke.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})},ke.DialogManager.prototype.unblockDocument=function(){document.documentElement.removeEventListener("focus",this.handleFocus_,!0),document.removeEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.disconnect()},ke.DialogManager.prototype.updateStacking=function(){for(var s=this.zIndexHigh_,e=0,t;t=this.pendingDialogStack[e];++e)t.updateZIndex(--s,--s),e===0&&(this.overlay.style.zIndex=--s);var n=this.pendingDialogStack[0];if(n){var i=n.dialog.parentNode||document.body;i.appendChild(this.overlay)}else this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay)},ke.DialogManager.prototype.containedByTopDialog_=function(s){for(;s=li(s);){for(var e=0,t;t=this.pendingDialogStack[e];++e)if(t.dialog===s)return e===0;s=s.parentElement}return!1},ke.DialogManager.prototype.handleFocus_=function(s){var e=s.composedPath?s.composedPath()[0]:s.target;if(!this.containedByTopDialog_(e)&&document.activeElement!==document.documentElement&&(s.preventDefault(),s.stopPropagation(),Yl(e),this.forwardTab_!==void 0)){var t=this.pendingDialogStack[0],n=t.dialog,i=n.compareDocumentPosition(e);return i&Node.DOCUMENT_POSITION_PRECEDING&&(this.forwardTab_?t.focus_():e!==document.documentElement&&document.documentElement.focus()),!1}},ke.DialogManager.prototype.handleKey_=function(s){if(this.forwardTab_=void 0,s.keyCode===27){s.preventDefault(),s.stopPropagation();var e=new yn("cancel",{bubbles:!1,cancelable:!0}),t=this.pendingDialogStack[0];t&&zl(t.dialog,e)&&t.dialog.close()}else s.keyCode===9&&(this.forwardTab_=!s.shiftKey)},ke.DialogManager.prototype.checkDOM_=function(s){var e=this.pendingDialogStack.slice();e.forEach(function(t){s.indexOf(t.dialog)!==-1?t.downgradeModal():t.maybeHideModal()})},ke.DialogManager.prototype.pushDialog=function(s){var e=(this.zIndexHigh_-this.zIndexLow_)/2-1;return this.pendingDialogStack.length>=e?!1:(this.pendingDialogStack.unshift(s)===1&&this.blockDocument(),this.updateStacking(),!0)},ke.DialogManager.prototype.removeDialog=function(s){var e=this.pendingDialogStack.indexOf(s);e!==-1&&(this.pendingDialogStack.splice(e,1),this.pendingDialogStack.length===0&&this.unblockDocument(),this.updateStacking())},ke.dm=new ke.DialogManager,ke.formSubmitter=null,ke.imagemapUseValue=null,window.HTMLDialogElement===void 0){var Zl=document.createElement("form");if(Zl.setAttribute("method","dialog"),Zl.method!=="dialog"){var _n=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"method");if(_n){var wb=_n.get;_n.get=function(){return Rr(this)?"dialog":wb.call(this)};var $b=_n.set;_n.set=function(s){return typeof s=="string"&&s.toLowerCase()==="dialog"?this.setAttribute("method",s):$b.call(this,s)},Object.defineProperty(HTMLFormElement.prototype,"method",_n)}}document.addEventListener("click",function(s){if(ke.formSubmitter=null,ke.imagemapUseValue=null,!s.defaultPrevented){var e=s.target;if("composedPath"in s){var t=s.composedPath();e=t.shift()||e}if(!(!e||!Rr(e.form))){var n=e.type==="submit"&&["button","input"].indexOf(e.localName)>-1;if(!n){if(!(e.localName==="input"&&e.type==="image"))return;ke.imagemapUseValue=s.offsetX+","+s.offsetY}var i=li(e);i&&(ke.formSubmitter=e)}}},!1),document.addEventListener("submit",function(s){var e=s.target,t=li(e);if(!t){var n=Xl(s),i=n&&n.getAttribute("formmethod")||e.getAttribute("method");i==="dialog"&&s.preventDefault()}});var xb=HTMLFormElement.prototype.submit,Cb=function(){if(!Rr(this))return xb.call(this);var s=li(this);s&&s.close()};HTMLFormElement.prototype.submit=Cb}const Sb=Object.freeze(Object.defineProperty({__proto__:null,default:ke},Symbol.toStringTag,{value:"Module"}));W.FileItem=Cl,W.ItemRenderers=Qr,W.PktAccordion=oa,W.PktAccordionItem=Vo,W.PktAlert=Bi,W.PktBackLink=Uo,W.PktBreadcrumbs=jo,W.PktButton=dt,W.PktCalendar=qr,W.PktCard=pl,W.PktCheckbox=fl,W.PktCombobox=yl,W.PktConsent=Wi,W.PktDatepicker=$l,W.PktFileUpload=Dl,W.PktFooter=Jm,W.PktFooterSimple=Rm,W.PktHeader=El,W.PktHeaderService=Zr,W.PktHeading=Pl,W.PktHelptext=Al,W.PktIcon=R,W.PktInput=Il,W.PktInputWrapper=Ms,W.PktLink=Ki,W.PktLinkCard=Ll,W.PktLoader=Bl,W.PktMessagebox=Fl,W.PktModal=Kr,W.PktProgressbar=Qi,W.PktRadioButton=Vl,W.PktSearchInput=Hl,W.PktSelect=Ul,W.PktStep=db,W.PktStepper=jl,W.PktTabItem=Jr,W.PktTable=hb,W.PktTableBody=pb,W.PktTableDataCell=fb,W.PktTableHeader=gb,W.PktTableHeaderCell=mb,W.PktTableRow=bb,W.PktTabs=Wl,W.PktTag=Ns,W.PktTextarea=Yr,W.PktTextinput=Xi,Object.defineProperty(W,Symbol.toStringTag,{value:"Module"})}));
|
|
1747
|
+
*/var Ho;function ef(){return Ho||(Ho=1,(function(s){(function(){var e={}.hasOwnProperty;function t(){for(var r="",a=0;a<arguments.length;a++){var l=arguments[a];l&&(r=i(r,n(l)))}return r}function n(r){if(typeof r=="string"||typeof r=="number")return r;if(typeof r!="object")return"";if(Array.isArray(r))return t.apply(null,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var a="";for(var l in r)e.call(r,l)&&r[l]&&(a=i(a,l));return a}function i(r,a){return a?r?r+" "+a:r+a:r}s.exports?(t.default=t,s.exports=t):window.classNames=t})()})(Ir)),Ir.exports}var tf=ef();const re=Rp(tf),Bi=({children:s,closeAlert:e,compact:t,title:n,date:i,ariaLive:r,"aria-live":a="polite",role:l="status",skin:c="info",className:h,...m})=>{const[g,f]=d.useState(!1),k={"pkt-alert":!0,"pkt-alert--compact":t,[`pkt-alert--${c}`]:c,"pkt-hide":g},v={"pkt-alert__grid":!0,"pkt-alert__noTitle":!n,"pkt-alert__noDate":!i},$=d.useCallback(()=>{f(!0),m.onClose&&m.onClose(new CustomEvent("close",{detail:{origin:event},bubbles:!0,composed:!0}))},[m.onClose,f]),N=r||a;return o.jsx("div",{...m,"aria-live":N,role:l,className:re(k,h),children:o.jsxs("div",{className:re(v),children:[o.jsx(R,{className:"pkt-alert__icon","aria-hidden":"true",name:c==="info"?"alert-information":`alert-${c}`}),e&&o.jsx("div",{className:"pkt-alert__close",children:o.jsx(dt,{tabIndex:0,"aria-label":"close",size:t?"small":"medium",type:"button",skin:"tertiary",iconName:"close",variant:"icon-only",onClick:$,children:o.jsx("span",{className:"sr-only",children:"Lukk"})})}),n&&o.jsx("div",{className:"pkt-alert__title",children:n}),o.jsx("div",{className:"pkt-alert__text",children:s}),i&&o.jsxs("div",{className:"pkt-alert__date",children:["Sist oppdatert: ",i]})]})})};Bi.displayName="PktAlert";const Uo=d.forwardRef(({href:s="/",text:e="Forsiden",ariaLabel:t,renderLink:n,...i},r)=>{const a=o.jsxs(o.Fragment,{children:[o.jsx(R,{className:"pkt-back-link__icon pkt-icon pkt-link__icon",name:"chevron-thin-left","aria-hidden":"true"}),o.jsx("span",{className:"pkt-back-link__text",children:e})]}),l=n||(({href:c,className:h,children:m,props:g})=>o.jsx("a",{href:c,className:h,...g,children:m}));return o.jsx("nav",{className:"pkt-back-link","aria-label":t||"Gå tilbake til forrige side",ref:r,children:l({href:s,className:"pkt-link pkt-link--icon-left",children:a,props:i})})});Uo.displayName="PktBackLink";const jo=d.forwardRef(({breadcrumbs:s,navigationType:e,renderLink:t,className:n,...i},r)=>{const a=s,l=a[a.length-2],c=[n,"pkt-breadcrumbs"].filter(Boolean).join(" "),h=t||(e==="router"?({href:m,className:g,children:f,props:k})=>o.jsx(ic.Link,{to:m,className:g,...k,children:f}):({href:m,className:g,children:f,props:k})=>o.jsx("a",{href:m,className:g,...k,children:f}));return o.jsxs("nav",{ref:r,"aria-label":"brødsmulemeny",className:c,children:[o.jsx("ol",{className:"pkt-breadcrumbs__list pkt-breadcrumbs--desktop",children:a.map((m,g)=>o.jsx("li",{className:"pkt-breadcrumbs__item",children:g===a.length-1?o.jsx("span",{className:"pkt-breadcrumbs__label","aria-current":"true",children:o.jsx("span",{className:"pkt-breadcrumbs__text",children:m.text})}):h({href:m.href,className:"pkt-link pkt-link--icon-right pkt-breadcrumbs__label pkt-breadcrumbs__link",children:o.jsxs(o.Fragment,{children:[o.jsx(R,{className:"pkt-icon pkt-breadcrumbs__icon pkt-link__icon",name:"chevron-thin-right"}),o.jsx("span",{className:"pkt-breadcrumbs__text",children:m.text})]}),props:i})},`breadcrumb-${g}`))}),h({href:l.href,className:"pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile",children:o.jsxs(o.Fragment,{children:[o.jsx(R,{className:"pkt-back-link__icon pkt-icon pkt-link__icon",name:"chevron-thin-left"}),o.jsx("span",{className:"pkt-breadcrumbs__text",children:l.text})]}),props:i})]})});jo.displayName="PktBreadcrumbs",window.pktAnimationPath=window.pktAnimationPath||"https://punkt-cdn.oslo.kommune.no/16.6/animations/";const dt=d.forwardRef(({children:s,className:e,iconName:t="user",secondIconName:n="user",iconPath:i,secondIconPath:r,size:a="medium",fullWidth:l=!1,fullWidthOnMobile:c=!1,skin:h="primary",type:m="button",variant:g="label-only",state:f,color:k,isLoading:v=void 0,disabled:$=void 0,loadingAnimationPath:N=window.pktAnimationPath,...x},S)=>{const P=[e,"pkt-btn",a&&`pkt-btn--${a}`,l&&"pkt-btn--full",c&&"pkt-btn--full-small",h&&`pkt-btn--${h}`,g&&`pkt-btn--${g}`,k&&`pkt-btn--${k}`,f&&`pkt-btn--${f}`,v&&"pkt-btn--isLoading"].filter(Boolean).join(" ");return o.jsxs("button",{...x,"aria-busy":v||void 0,"aria-disabled":$||void 0,disabled:$,className:P,type:m,ref:S,children:[v&&o.jsx(R,{className:"pkt-btn__icon pkt-btn__spinner",name:"spinner-blue",path:N}),g!=="label-only"&&o.jsx(R,{className:"pkt-btn__icon",name:t,...i&&{path:i}}),o.jsx("span",{className:"pkt-btn__text",children:s}),g==="icons-right-and-left"&&o.jsx(R,{className:"pkt-btn__icon",name:n,...r&&{path:r}})]})});dt.displayName="PktButton";const qo=6048e5,sf=864e5,Wo=Symbol.for("constructDateFrom");function ns(s,e){return typeof s=="function"?s(e):s&&typeof s=="object"&&Wo in s?s[Wo](e):s instanceof Date?new s.constructor(e):new Date(e)}function St(s,e){return ns(e||s,s)}function zo(s,e,t){const n=St(s,t==null?void 0:t.in);return isNaN(e)?ns(s,NaN):(e&&n.setDate(n.getDate()+e),n)}let nf={};function Fi(){return nf}function ei(s,e){var l,c,h,m;const t=Fi(),n=(e==null?void 0:e.weekStartsOn)??((c=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??t.weekStartsOn??((m=(h=t.locale)==null?void 0:h.options)==null?void 0:m.weekStartsOn)??0,i=St(s,e==null?void 0:e.in),r=i.getDay(),a=(r<n?7:0)+r-n;return i.setDate(i.getDate()-a),i.setHours(0,0,0,0),i}function Vi(s,e){return ei(s,{...e,weekStartsOn:1})}function Yo(s,e){const t=St(s,e==null?void 0:e.in),n=t.getFullYear(),i=ns(t,0);i.setFullYear(n+1,0,4),i.setHours(0,0,0,0);const r=Vi(i),a=ns(t,0);a.setFullYear(n,0,4),a.setHours(0,0,0,0);const l=Vi(a);return t.getTime()>=r.getTime()?n+1:t.getTime()>=l.getTime()?n:n-1}function Ko(s){const e=St(s),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+s-+t}function Go(s,...e){const t=ns.bind(null,e.find(n=>typeof n=="object"));return e.map(t)}function Lr(s,e){const t=St(s,e==null?void 0:e.in);return t.setHours(0,0,0,0),t}function rf(s,e,t){const[n,i]=Go(t==null?void 0:t.in,s,e),r=Lr(n),a=Lr(i),l=+r-Ko(r),c=+a-Ko(a);return Math.round((l-c)/sf)}function af(s,e){const t=Yo(s,e),n=ns(s,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),Vi(n)}function of(s){return s instanceof Date||typeof s=="object"&&Object.prototype.toString.call(s)==="[object Date]"}function lf(s){return!(!of(s)&&typeof s!="number"||isNaN(+St(s)))}function cf(s,e){const t=St(s,e==null?void 0:e.in);return t.setHours(23,59,59,999),t}function uf(s,e){const[t,n]=Go(s,e.start,e.end);return{start:t,end:n}}function Xo(s,e){const{start:t,end:n}=uf(e==null?void 0:e.in,s);let i=+t>+n;const r=i?+t:+n,a=i?n:t;a.setHours(0,0,0,0);let l=1;const c=[];for(;+a<=r;)c.push(ns(t,a)),a.setDate(a.getDate()+l),a.setHours(0,0,0,0);return i?c.reverse():c}function df(s,e){const t=St(s,e==null?void 0:e.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}const hf={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"}},pf=(s,e,t)=>{let n;const i=hf[s];return typeof i=="string"?n=i:e===1?n=i.one:n=i.other.replace("{{count}}",e.toString()),t!=null&&t.addSuffix?t.comparison&&t.comparison>0?"in "+n:n+" ago":n};function Br(s){return(e={})=>{const t=e.width?String(e.width):s.defaultWidth;return s.formats[t]||s.formats[s.defaultWidth]}}const ff={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},gf={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},mf={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},bf={date:Br({formats:ff,defaultWidth:"full"}),time:Br({formats:gf,defaultWidth:"full"}),dateTime:Br({formats:mf,defaultWidth:"full"})},vf={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},kf=(s,e,t,n)=>vf[s];function ti(s){return(e,t)=>{const n=t!=null&&t.context?String(t.context):"standalone";let i;if(n==="formatting"&&s.formattingValues){const a=s.defaultFormattingWidth||s.defaultWidth,l=t!=null&&t.width?String(t.width):a;i=s.formattingValues[l]||s.formattingValues[a]}else{const a=s.defaultWidth,l=t!=null&&t.width?String(t.width):s.defaultWidth;i=s.values[l]||s.values[a]}const r=s.argumentCallback?s.argumentCallback(e):e;return i[r]}}const yf={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},_f={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},wf={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"]},$f={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"]},xf={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"}},Cf={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"}},Sf={ordinalNumber:(s,e)=>{const t=Number(s),n=t%100;if(n>20||n<10)switch(n%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},era:ti({values:yf,defaultWidth:"wide"}),quarter:ti({values:_f,defaultWidth:"wide",argumentCallback:s=>s-1}),month:ti({values:wf,defaultWidth:"wide"}),day:ti({values:$f,defaultWidth:"wide"}),dayPeriod:ti({values:xf,defaultWidth:"wide",formattingValues:Cf,defaultFormattingWidth:"wide"})};function si(s){return(e,t={})=>{const n=t.width,i=n&&s.matchPatterns[n]||s.matchPatterns[s.defaultMatchWidth],r=e.match(i);if(!r)return null;const a=r[0],l=n&&s.parsePatterns[n]||s.parsePatterns[s.defaultParseWidth],c=Array.isArray(l)?Nf(l,g=>g.test(a)):Tf(l,g=>g.test(a));let h;h=s.valueCallback?s.valueCallback(c):c,h=t.valueCallback?t.valueCallback(h):h;const m=e.slice(a.length);return{value:h,rest:m}}}function Tf(s,e){for(const t in s)if(Object.prototype.hasOwnProperty.call(s,t)&&e(s[t]))return t}function Nf(s,e){for(let t=0;t<s.length;t++)if(e(s[t]))return t}function Mf(s){return(e,t={})=>{const n=e.match(s.matchPattern);if(!n)return null;const i=n[0],r=e.match(s.parsePattern);if(!r)return null;let a=s.valueCallback?s.valueCallback(r[0]):r[0];a=t.valueCallback?t.valueCallback(a):a;const l=e.slice(i.length);return{value:a,rest:l}}}const Df=/^(\d+)(th|st|nd|rd)?/i,Of=/\d+/i,Ef={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},Pf={any:[/^b/i,/^(a|c)/i]},Af={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},If={any:[/1/i,/2/i,/3/i,/4/i]},Lf={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},Bf={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]},Ff={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},Vf={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]},Hf={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},Uf={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}},jf={ordinalNumber:Mf({matchPattern:Df,parsePattern:Of,valueCallback:s=>parseInt(s,10)}),era:si({matchPatterns:Ef,defaultMatchWidth:"wide",parsePatterns:Pf,defaultParseWidth:"any"}),quarter:si({matchPatterns:Af,defaultMatchWidth:"wide",parsePatterns:If,defaultParseWidth:"any",valueCallback:s=>s+1}),month:si({matchPatterns:Lf,defaultMatchWidth:"wide",parsePatterns:Bf,defaultParseWidth:"any"}),day:si({matchPatterns:Ff,defaultMatchWidth:"wide",parsePatterns:Vf,defaultParseWidth:"any"}),dayPeriod:si({matchPatterns:Hf,defaultMatchWidth:"any",parsePatterns:Uf,defaultParseWidth:"any"})},qf={code:"en-US",formatDistance:pf,formatLong:bf,formatRelative:kf,localize:Sf,match:jf,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Wf(s,e){const t=St(s,e==null?void 0:e.in);return rf(t,df(t))+1}function zf(s,e){const t=St(s,e==null?void 0:e.in),n=+Vi(t)-+af(t);return Math.round(n/qo)+1}function Qo(s,e){var m,g,f,k;const t=St(s,e==null?void 0:e.in),n=t.getFullYear(),i=Fi(),r=(e==null?void 0:e.firstWeekContainsDate)??((g=(m=e==null?void 0:e.locale)==null?void 0:m.options)==null?void 0:g.firstWeekContainsDate)??i.firstWeekContainsDate??((k=(f=i.locale)==null?void 0:f.options)==null?void 0:k.firstWeekContainsDate)??1,a=ns((e==null?void 0:e.in)||s,0);a.setFullYear(n+1,0,r),a.setHours(0,0,0,0);const l=ei(a,e),c=ns((e==null?void 0:e.in)||s,0);c.setFullYear(n,0,r),c.setHours(0,0,0,0);const h=ei(c,e);return+t>=+l?n+1:+t>=+h?n:n-1}function Yf(s,e){var l,c,h,m;const t=Fi(),n=(e==null?void 0:e.firstWeekContainsDate)??((c=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??t.firstWeekContainsDate??((m=(h=t.locale)==null?void 0:h.options)==null?void 0:m.firstWeekContainsDate)??1,i=Qo(s,e),r=ns((e==null?void 0:e.in)||s,0);return r.setFullYear(i,0,n),r.setHours(0,0,0,0),ei(r,e)}function Zo(s,e){const t=St(s,e==null?void 0:e.in),n=+ei(t,e)-+Yf(t,e);return Math.round(n/qo)+1}function Se(s,e){const t=s<0?"-":"",n=Math.abs(s).toString().padStart(e,"0");return t+n}const Ss={y(s,e){const t=s.getFullYear(),n=t>0?t:1-t;return Se(e==="yy"?n%100:n,e.length)},M(s,e){const t=s.getMonth();return e==="M"?String(t+1):Se(t+1,2)},d(s,e){return Se(s.getDate(),e.length)},a(s,e){const t=s.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];case"aaaa":default:return t==="am"?"a.m.":"p.m."}},h(s,e){return Se(s.getHours()%12||12,e.length)},H(s,e){return Se(s.getHours(),e.length)},m(s,e){return Se(s.getMinutes(),e.length)},s(s,e){return Se(s.getSeconds(),e.length)},S(s,e){const t=e.length,n=s.getMilliseconds(),i=Math.trunc(n*Math.pow(10,t-3));return Se(i,e.length)}},bn={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Jo={G:function(s,e,t){const n=s.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(n,{width:"abbreviated"});case"GGGGG":return t.era(n,{width:"narrow"});case"GGGG":default:return t.era(n,{width:"wide"})}},y:function(s,e,t){if(e==="yo"){const n=s.getFullYear(),i=n>0?n:1-n;return t.ordinalNumber(i,{unit:"year"})}return Ss.y(s,e)},Y:function(s,e,t,n){const i=Qo(s,n),r=i>0?i:1-i;if(e==="YY"){const a=r%100;return Se(a,2)}return e==="Yo"?t.ordinalNumber(r,{unit:"year"}):Se(r,e.length)},R:function(s,e){const t=Yo(s);return Se(t,e.length)},u:function(s,e){const t=s.getFullYear();return Se(t,e.length)},Q:function(s,e,t){const n=Math.ceil((s.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return Se(n,2);case"Qo":return t.ordinalNumber(n,{unit:"quarter"});case"QQQ":return t.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(n,{width:"wide",context:"formatting"})}},q:function(s,e,t){const n=Math.ceil((s.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return Se(n,2);case"qo":return t.ordinalNumber(n,{unit:"quarter"});case"qqq":return t.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(n,{width:"wide",context:"standalone"})}},M:function(s,e,t){const n=s.getMonth();switch(e){case"M":case"MM":return Ss.M(s,e);case"Mo":return t.ordinalNumber(n+1,{unit:"month"});case"MMM":return t.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(n,{width:"wide",context:"formatting"})}},L:function(s,e,t){const n=s.getMonth();switch(e){case"L":return String(n+1);case"LL":return Se(n+1,2);case"Lo":return t.ordinalNumber(n+1,{unit:"month"});case"LLL":return t.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(n,{width:"wide",context:"standalone"})}},w:function(s,e,t,n){const i=Zo(s,n);return e==="wo"?t.ordinalNumber(i,{unit:"week"}):Se(i,e.length)},I:function(s,e,t){const n=zf(s);return e==="Io"?t.ordinalNumber(n,{unit:"week"}):Se(n,e.length)},d:function(s,e,t){return e==="do"?t.ordinalNumber(s.getDate(),{unit:"date"}):Ss.d(s,e)},D:function(s,e,t){const n=Wf(s);return e==="Do"?t.ordinalNumber(n,{unit:"dayOfYear"}):Se(n,e.length)},E:function(s,e,t){const n=s.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(n,{width:"short",context:"formatting"});case"EEEE":default:return t.day(n,{width:"wide",context:"formatting"})}},e:function(s,e,t,n){const i=s.getDay(),r=(i-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(r);case"ee":return Se(r,2);case"eo":return t.ordinalNumber(r,{unit:"day"});case"eee":return t.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(i,{width:"short",context:"formatting"});case"eeee":default:return t.day(i,{width:"wide",context:"formatting"})}},c:function(s,e,t,n){const i=s.getDay(),r=(i-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(r);case"cc":return Se(r,e.length);case"co":return t.ordinalNumber(r,{unit:"day"});case"ccc":return t.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(i,{width:"narrow",context:"standalone"});case"cccccc":return t.day(i,{width:"short",context:"standalone"});case"cccc":default:return t.day(i,{width:"wide",context:"standalone"})}},i:function(s,e,t){const n=s.getDay(),i=n===0?7:n;switch(e){case"i":return String(i);case"ii":return Se(i,e.length);case"io":return t.ordinalNumber(i,{unit:"day"});case"iii":return t.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(n,{width:"short",context:"formatting"});case"iiii":default:return t.day(n,{width:"wide",context:"formatting"})}},a:function(s,e,t){const i=s.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(s,e,t){const n=s.getHours();let i;switch(n===12?i=bn.noon:n===0?i=bn.midnight:i=n/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(s,e,t){const n=s.getHours();let i;switch(n>=17?i=bn.evening:n>=12?i=bn.afternoon:n>=4?i=bn.morning:i=bn.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(s,e,t){if(e==="ho"){let n=s.getHours()%12;return n===0&&(n=12),t.ordinalNumber(n,{unit:"hour"})}return Ss.h(s,e)},H:function(s,e,t){return e==="Ho"?t.ordinalNumber(s.getHours(),{unit:"hour"}):Ss.H(s,e)},K:function(s,e,t){const n=s.getHours()%12;return e==="Ko"?t.ordinalNumber(n,{unit:"hour"}):Se(n,e.length)},k:function(s,e,t){let n=s.getHours();return n===0&&(n=24),e==="ko"?t.ordinalNumber(n,{unit:"hour"}):Se(n,e.length)},m:function(s,e,t){return e==="mo"?t.ordinalNumber(s.getMinutes(),{unit:"minute"}):Ss.m(s,e)},s:function(s,e,t){return e==="so"?t.ordinalNumber(s.getSeconds(),{unit:"second"}):Ss.s(s,e)},S:function(s,e){return Ss.S(s,e)},X:function(s,e,t){const n=s.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return el(n);case"XXXX":case"XX":return Ks(n);case"XXXXX":case"XXX":default:return Ks(n,":")}},x:function(s,e,t){const n=s.getTimezoneOffset();switch(e){case"x":return el(n);case"xxxx":case"xx":return Ks(n);case"xxxxx":case"xxx":default:return Ks(n,":")}},O:function(s,e,t){const n=s.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Ro(n,":");case"OOOO":default:return"GMT"+Ks(n,":")}},z:function(s,e,t){const n=s.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Ro(n,":");case"zzzz":default:return"GMT"+Ks(n,":")}},t:function(s,e,t){const n=Math.trunc(+s/1e3);return Se(n,e.length)},T:function(s,e,t){return Se(+s,e.length)}};function Ro(s,e=""){const t=s>0?"-":"+",n=Math.abs(s),i=Math.trunc(n/60),r=n%60;return r===0?t+String(i):t+String(i)+e+Se(r,2)}function el(s,e){return s%60===0?(s>0?"-":"+")+Se(Math.abs(s)/60,2):Ks(s,e)}function Ks(s,e=""){const t=s>0?"-":"+",n=Math.abs(s),i=Se(Math.trunc(n/60),2),r=Se(n%60,2);return t+i+e+r}const tl=(s,e)=>{switch(s){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},sl=(s,e)=>{switch(s){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Kf={p:sl,P:(s,e)=>{const t=s.match(/(P+)(p+)?/)||[],n=t[1],i=t[2];if(!i)return tl(s,e);let r;switch(n){case"P":r=e.dateTime({width:"short"});break;case"PP":r=e.dateTime({width:"medium"});break;case"PPP":r=e.dateTime({width:"long"});break;case"PPPP":default:r=e.dateTime({width:"full"});break}return r.replace("{{date}}",tl(n,e)).replace("{{time}}",sl(i,e))}},Gf=/^D+$/,Xf=/^Y+$/,Qf=["D","DD","YY","YYYY"];function Zf(s){return Gf.test(s)}function Jf(s){return Xf.test(s)}function Rf(s,e,t){const n=eg(s,e,t);if(console.warn(n),Qf.includes(s))throw new RangeError(n)}function eg(s,e,t){const n=s[0]==="Y"?"years":"days of the month";return`Use \`${s.toLowerCase()}\` instead of \`${s}\` (in \`${e}\`) for formatting ${n} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const tg=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,sg=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ng=/^'([^]*?)'?$/,ig=/''/g,rg=/[a-zA-Z]/;function ag(s,e,t){var m,g,f,k;const n=Fi(),i=n.locale??qf,r=n.firstWeekContainsDate??((g=(m=n.locale)==null?void 0:m.options)==null?void 0:g.firstWeekContainsDate)??1,a=n.weekStartsOn??((k=(f=n.locale)==null?void 0:f.options)==null?void 0:k.weekStartsOn)??0,l=St(s,t==null?void 0:t.in);if(!lf(l))throw new RangeError("Invalid time value");let c=e.match(sg).map(v=>{const $=v[0];if($==="p"||$==="P"){const N=Kf[$];return N(v,i.formatLong)}return v}).join("").match(tg).map(v=>{if(v==="''")return{isToken:!1,value:"'"};const $=v[0];if($==="'")return{isToken:!1,value:og(v)};if(Jo[$])return{isToken:!0,value:v};if($.match(rg))throw new RangeError("Format string contains an unescaped latin alphabet character `"+$+"`");return{isToken:!1,value:v}});i.localize.preprocessor&&(c=i.localize.preprocessor(l,c));const h={firstWeekContainsDate:r,weekStartsOn:a,locale:i};return c.map(v=>{if(!v.isToken)return v.value;const $=v.value;(Jf($)||Zf($))&&Rf($,e,String(s));const N=Jo[$[0]];return N(l,$,i.localize,h)}).join("")}function og(s){const e=s.match(ng);return e?e[1].replace(ig,"'"):s}function lg(s,e){const t=St(s,e==null?void 0:e.in).getDay();return t===0?7:t}function cg(s,e,t="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:s,timeZoneName:t}).format(e).split(/\s/g).slice(2).join(" ")}const Fr={},ni={};function Gs(s,e){try{const n=(Fr[s]||(Fr[s]=new Intl.DateTimeFormat("en-US",{timeZone:s,timeZoneName:"longOffset"}).format))(e).split("GMT")[1];return n in ni?ni[n]:nl(n,n.split(":"))}catch{if(s in ni)return ni[s];const t=s==null?void 0:s.match(ug);return t?nl(s,t.slice(1)):NaN}}const ug=/([+-]\d\d):?(\d\d)?/;function nl(s,e){const t=+(e[0]||0),n=+(e[1]||0),i=+(e[2]||0)/60;return ni[s]=t*60+n>0?t*60+n+i:t*60-n-i}class is extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(Gs(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),rl(this),Vr(this)):this.setTime(Date.now())}static tz(e,...t){return t.length?new is(...t,e):new is(Date.now(),e)}withTimeZone(e){return new is(+this,e)}getTimezoneOffset(){const e=-Gs(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),Vr(this),+this}[Symbol.for("constructDateFrom")](e){return new is(+new Date(e),this.timeZone)}}const il=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(s=>{if(!il.test(s))return;const e=s.replace(il,"$1UTC");is.prototype[e]&&(s.startsWith("get")?is.prototype[s]=function(){return this.internal[e]()}:(is.prototype[s]=function(){return Date.prototype[e].apply(this.internal,arguments),dg(this),+this},is.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),Vr(this),+this}))});function Vr(s){s.internal.setTime(+s),s.internal.setUTCSeconds(s.internal.getUTCSeconds()-Math.round(-Gs(s.timeZone,s)*60))}function dg(s){Date.prototype.setFullYear.call(s,s.internal.getUTCFullYear(),s.internal.getUTCMonth(),s.internal.getUTCDate()),Date.prototype.setHours.call(s,s.internal.getUTCHours(),s.internal.getUTCMinutes(),s.internal.getUTCSeconds(),s.internal.getUTCMilliseconds()),rl(s)}function rl(s){const e=Gs(s.timeZone,s),t=e>0?Math.floor(e):Math.ceil(e),n=new Date(+s);n.setUTCHours(n.getUTCHours()-1);const i=-new Date(+s).getTimezoneOffset(),r=-new Date(+n).getTimezoneOffset(),a=i-r,l=Date.prototype.getHours.apply(s)!==s.internal.getUTCHours();a&&l&&s.internal.setUTCMinutes(s.internal.getUTCMinutes()+a);const c=i-t;c&&Date.prototype.setUTCMinutes.call(s,Date.prototype.getUTCMinutes.call(s)+c);const h=new Date(+s);h.setUTCSeconds(0);const m=i>0?h.getSeconds():(h.getSeconds()-60)%60,g=Math.round(-(Gs(s.timeZone,s)*60))%60;(g||m)&&(s.internal.setUTCSeconds(s.internal.getUTCSeconds()+g),Date.prototype.setUTCSeconds.call(s,Date.prototype.getUTCSeconds.call(s)+g+m));const f=Gs(s.timeZone,s),k=f>0?Math.floor(f):Math.ceil(f),$=-new Date(+s).getTimezoneOffset()-k,N=k!==t,x=$-c;if(N&&x){Date.prototype.setUTCMinutes.call(s,Date.prototype.getUTCMinutes.call(s)+x);const S=Gs(s.timeZone,s),P=S>0?Math.floor(S):Math.ceil(S),D=k-P;D&&(s.internal.setUTCMinutes(s.internal.getUTCMinutes()+D),Date.prototype.setUTCMinutes.call(s,Date.prototype.getUTCMinutes.call(s)+D))}}class Ts extends is{static tz(e,...t){return t.length?new Ts(...t,e):new Ts(Date.now(),e)}toISOString(){const[e,t,n]=this.tzComponents(),i=`${e}${t}:${n}`;return this.internal.toISOString().slice(0,-1)+i}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,t,n,i]=this.internal.toUTCString().split(" ");return`${e==null?void 0:e.slice(0,-1)} ${n} ${t} ${i}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[t,n,i]=this.tzComponents();return`${e} GMT${t}${n}${i} (${cg(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:(t==null?void 0:t.timeZone)||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:(t==null?void 0:t.timeZone)||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:(t==null?void 0:t.timeZone)||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),t=e>0?"-":"+",n=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),i=String(Math.abs(e)%60).padStart(2,"0");return[t,n,i]}withTimeZone(e){return new Ts(+this,e)}[Symbol.for("constructDateFrom")](e){return new Ts(+new Date(e),this.timeZone)}}window.pktTz=window.pktTz===void 0?"Europe/Oslo":window.pktTz;const hg=(s=window.pktTz)=>{const e=new Ts(new Date().toISOString(),s);return e.setHours(0,0,0,0),isNaN(e.getTime())?new Date:new Date(e.getFullYear(),e.getMonth(),e.getDate())};function rs(s){if(!s||s==="")return new Date;if(/^\d{4}-\d{2}-\d{2}$/.test(s)){const[e,t,n]=s.split("-").map(Number);return new Date(e,t-1,n)}if(/^\d{4}-\d{2}$/.test(s)){const[e,t]=s.split("-").map(Number);return new Date(e,t-1,1)}return/^\d{4}$/.test(s)?new Date(Number(s),0,1):new Date(s)}const bt=s=>{if(!s||isNaN(s.getTime()))return"";const e=s.getFullYear(),t=String(s.getMonth()+1).padStart(2,"0"),n=String(s.getDate()).padStart(2,"0");return`${e}-${t}-${n}`},ii=s=>{if(!s)return null;const e=rs(s);return isNaN(e.getTime())?null:e},pg=(s,e)=>{const t=ps(s);return isNaN(t.getTime())?"":ag(t,e)},ps=(s="",e)=>{const t=typeof s=="string"?rs(s):s;return!t||isNaN(t.getTime())?new Date:e?e==="end"?cf(t):Lr(t):t},vn=(s,e,t=1)=>{if(typeof s!="number"||typeof e!="number"||typeof t!="number"||isNaN(s)||isNaN(e)||isNaN(t))return new Date;const n=new Date(s,e,t);return isNaN(n.getTime())?new Date:n},ri=s=>{let e;return typeof s=="number"?e=new Ts(s,window.pktTz):e=new Ts(s,window.pktTz),e.setHours(12,0,0,0),e};let Hr=null,al;const fg=s=>{if(!s||isNaN(s.getTime()))return"";const e=typeof window<"u"?window.pktTz:void 0;return(!Hr||al!==e)&&(Hr=new Intl.DateTimeFormat("no",{dateStyle:"full",timeZone:e}),al=e),Hr.format(s)},gg=(s,e,t)=>{if(!s||isNaN(s.getTime()))return!1;const n=e?ps(e):null,i=t?ps(t):null;return!(n&&s<n||i&&s>i)},mg=(s,e)=>{if(!s||isNaN(s.getTime())||!Array.isArray(e))return!1;const t=bt(s);return e.includes(t)},bg=(s,e)=>{if(!s||isNaN(s.getTime())||!Array.isArray(e))return!1;const t=s.getDay().toString();return e.includes(t)},ol=(s,e,t,n,i)=>!(!s||isNaN(s.getTime())||!gg(s,e,t)||n&&mg(s,n)||i&&bg(s,i)),vg=(s,e,t,n,i)=>s.filter(r=>{const a=ii(r);return a&&ol(a,e,t,n,i)}),kg=s=>s.slice().sort((e,t)=>{const n=ii(e),i=ii(t);return!n||!i?0:n.getTime()-i.getTime()}),yg=(s,e)=>{const t=ii(s),n=ii(e);return!t||!n?!1:t<=n};function ll(s,e){const t=(e.excludedates??[]).map(n=>typeof n=="string"?n:bt(n));return!ol(s,e.earliest,e.latest,t,e.excludeweekdays??[])}function _g(s,e,t,n){return!!(ll(s,t)||!e&&n.multiple&&n.maxMultiple>0&&n.selectedCount>=n.maxMultiple)}function wg(s,e,t){const n=vn(s,e,0);return!(t&&ps(t)>n)}function $g(s,e,t){const n=vn(e===11?s+1:s,e===11?0:e+1,1);return!(t&&ps(t)<n)}function cl(s){return typeof s=="string"&&(s=s.split(",")),s.length===1&&s[0]===""?[]:s.map(e=>rs(e))}function ul(s,e){const t=Xo({start:s,end:e}),n={};if(Array.isArray(t)&&t.length)for(let i=0;i<t.length;i++){const r=t[i],a=r>s&&r<e;n[bt(r)]=a}return n}function dl(s,e,t,n){if(e.length!==1)return!0;const i=Xo({start:e[0],end:s});if(!Array.isArray(i)||!i.length)return!0;for(let r=0;r<i.length;r++){for(const a of t??[])if(a>e[0]&&a<s)return!1;if((n??[]).includes(lg(i[r]).toString()))return!1}return!0}function Ur(s,e){const t=bt(s);return e.includes(t)?e:[...e,t]}function jr(s,e){const t=bt(s),n=e.indexOf(t);if(n===-1)return e;if(e.length===1)return[];const i=[...e];return i.splice(n,1),i}function hl(s,e,t){const n=bt(s);return e.includes(n)?jr(s,e):t>0&&e.length>=t?e:Ur(s,e)}function xg(s,e,t){const n=bt(s),i=cl(e);if(e.includes(n))return e.indexOf(n)===0?[]:jr(s,e);if(e.length>1)return[n];if(e.length===1){if(!dl(s,i,t.excludedates,t.excludeweekdays))return[n];if(i[0]>s)return[n]}return Ur(s,e)}const ai=7,Cg=6;function Sg(s,e){const t=vn(s,e,1),n=vn(s,e+1,0),i=(t.getDay()+Cg)%ai,r=n.getDate(),a=Math.ceil((r+i)/ai),c=vn(s,e,0).getDate(),h=Zo(t);return{firstDayOfMonth:t,lastDayOfMonth:n,startingDay:i,numDays:r,numRows:a,numDaysPrevMonth:c,initialWeek:h}}function Tg(s,e,t,n){const{startingDay:i,numDays:r}=n;return s===0&&e<i?"prev-month":t>r?"next-month":"current-month"}function Ng(s,e,t,n){const{startingDay:i,numDaysPrevMonth:r,numDays:a}=n;return s==="prev-month"?r-(i-e-1):s==="next-month"?t-a:t}const Mg={ArrowLeft:-1,ArrowRight:1,ArrowUp:-ai,ArrowDown:ai};function Dg(s){var t;const e=s.nodeName;return e==="INPUT"||e==="SELECT"||e==="BUTTON"&&!((t=s.dataset)!=null&&t.date)}function Og(s,e,t){let n=zo(s,e);if(!n)return null;let i=t(`button[data-date="${bt(n)}"]`);for(;i instanceof HTMLButtonElement&&i.dataset.disabled;)if(n=zo(n,e),i=t(`button[data-date="${bt(n)}"]`),!i)return null;return n}function Eg(s){return Mg[s]??null}const Pg={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 Ag(s){const{selected:e,multiple:t=!1,maxMultiple:n=0,range:i=!1,earliest:r=null,latest:a=null,excludedates:l,excludeweekdays:c=[],weeknumbers:h=!1,withcontrols:m=!1,currentmonth:g,today:f,strings:k,onDateSelected:v,onClose:$,id:N,className:x}=s,S=d.useId(),P=N??S,D=d.useMemo(()=>({...Pg,...k}),[k]),U=d.useMemo(()=>f?rs(f):hg(),[f]),V=d.useMemo(()=>l?l.map(b=>typeof b=="string"?rs(b):b):[],[l]),Y=e!==void 0,[ue,j]=d.useState([]),M=Y?e:ue,z=d.useMemo(()=>cl(M),[M]),[L,Q]=d.useState(0),[oe,ee]=d.useState(0),[de,le]=d.useState({}),[be,ne]=d.useState(null),[ae,Ue]=d.useState(null),Z=d.useRef(null),A=d.useRef([]),Me=d.useRef(0),De=d.useRef(!1),te=d.useRef(!1),Ie=d.useMemo(()=>({earliest:r,latest:a,excludedates:V,excludeweekdays:c}),[r,a,V,c]);d.useEffect(()=>{let b=null;if(g!=null&&(g instanceof Date?b=ri(g):typeof g=="string"&&(b=rs(g))),!b||isNaN(b.getTime()))if(M.length>0&&M[0]!==""){const p=rs(M[M.length-1]);b=isNaN(p.getTime())?ri(U):p}else b=ri(U);if((!b||isNaN(b.getTime()))&&(b=ri(U)),a){const p=typeof a=="string"?rs(a):a;!isNaN(p.getTime())&&b>p&&(b=p)}if(r){const p=typeof r=="string"?rs(r):r;!isNaN(p.getTime())&&b<p&&(b=p)}Q(b.getFullYear()),ee(b.getMonth()),te.current=!0},[]),d.useEffect(()=>{if(te.current&&!De.current&&M.length>0&&M[0]!==""){const b=rs(M[M.length-1]);isNaN(b.getTime())||(Q(b.getFullYear()),ee(b.getMonth()))}},[M]),d.useEffect(()=>{i&&z.length===2?le(ul(z[0],z[1])):(!i||z.length<2)&&le({})},[i,z]);const Ee=d.useCallback(b=>{Y||j(b),v==null||v(b)},[Y,v]),ye=d.useCallback(()=>{$==null||$()},[$]),Te=d.useCallback((b,p)=>{Q(typeof b=="string"?parseInt(b):b),ee(typeof p=="string"?parseInt(p):p),Me.current=0,Ue(null),A.current=[],De.current=!0},[]),Pe=d.useCallback(()=>{const b=oe===0?11:oe-1,p=oe===0?L-1:L;Te(p,b)},[L,oe,Te]),je=d.useCallback(()=>{const b=oe===11?0:oe+1,p=oe===11?L+1:L;Te(p,b)},[L,oe,Te]),Ae=d.useCallback(b=>ll(b,Ie),[Ie]),ve=d.useCallback((b,p)=>_g(b,p,Ie,{multiple:t,maxMultiple:n,selectedCount:M.length}),[Ie,t,n,M.length]),E=d.useCallback(()=>typeof M=="string"?M.split(","):M,[M]),Le=d.useCallback(b=>{if(!i||z.length!==1||!dl(b,z,V,c)||z[0]>=b){ne(null);return}ne(b),le(ul(z[0],b))},[i,z,V,c]),Ye=d.useCallback(b=>{if(!b)return;let p;if(i)p=xg(b,E(),{excludedates:V,excludeweekdays:c}),Y||j(p),p.length===2?(v==null||v(p),ye()):(p.length===1&&le({}),v==null||v(p));else if(t)p=hl(b,E(),n),Ee(p);else{const _=bt(b);M.includes(_)?p=[]:p=[_],Ee(p),ye()}},[i,t,n,E,M,V,c,Y,Ee,ye,v]),q=d.useCallback(b=>{const p=Ur(b,E());Y||j(p),i&&p.length===2&&(v==null||v(p),ye())},[E,Y,i,v,ye]),H=d.useCallback(b=>{const p=jr(b,E());Y||j(p)},[E,Y]),se=d.useCallback(b=>{const p=hl(b,E(),n);Y||j(p)},[E,n,Y]),me=d.useCallback(()=>{var T,K;const b=bt(ri(U)),p=(T=Z.current)==null?void 0:T.querySelector(`button[data-date="${b}"]`);if(p instanceof HTMLButtonElement){Ue(b),p.focus();return}const _=A.current.find(G=>!G.isDisabled);if(_){const G=(K=Z.current)==null?void 0:K.querySelector(`button[data-date="${_.currentDateISO}"]`);G instanceof HTMLButtonElement&&(Ue(_.currentDateISO),G.focus())}},[]),ge=d.useCallback((b,p)=>{const _=b.target;if(Dg(_))return;if(b.preventDefault(),!ae){me();return}const T=ps(ae),K=Og(T,p,Z.current.querySelector.bind(Z.current));if(K){const G=Z.current.querySelector(`button[data-date="${bt(K)}"]`);G instanceof HTMLButtonElement&&!G.dataset.disabled&&(Ue(bt(K)),G.focus())}},[ae,me]),Xe=d.useCallback(b=>{if(b.key==="Escape"){b.preventDefault(),ye();return}const p=Eg(b.key);p!==null&&ge(b.nativeEvent,p)},[ye,ge]),Ke=d.useCallback(b=>{Z.current&&!Z.current.contains(b.relatedTarget)&&!b.target.classList.contains("pkt-hide")&&ye()},[ye]);return{componentId:P,strings:D,todayDate:U,year:L,month:oe,activeSelected:M,_selected:z,inRange:de,rangeHovered:be,focusedDate:ae,range:i,multiple:t,weeknumbers:h,withcontrols:m,earliest:r,latest:a,excludedates:V,excludeweekdays:c,className:x,dateConstraints:Ie,calendarRef:Z,selectableDatesRef:A,tabIndexSetRef:Me,prevMonth:Pe,nextMonth:je,changeMonth:Te,handleDateSelect:Ye,addToSelected:q,removeFromSelected:H,toggleSelectedDate:se,handleRangeHover:Le,isExcluded:Ae,isDayDisabled:ve,focusOnCurrentDate:me,handleKeydown:Xe,handleFocusOut:Ke,close:ye,setFocusedDate:Ue}}const Ig=({componentId:s,strings:e,year:t,month:n,earliest:i,latest:r,withcontrols:a,prevMonth:l,nextMonth:c,changeMonth:h})=>{const m=f=>{const k=f==="prev",v=k?wg(t,n,i):$g(t,n,r),$=k?e.prevMonth:e.nextMonth,N=k?"chevron-thin-left":"chevron-thin-right",x=k?"pkt-calendar__prev-month":"pkt-calendar__next-month",S=k?l:c;return o.jsx("div",{children:o.jsxs("button",{type:"button","aria-label":$,onClick:()=>v&&S(),onKeyDown:P=>{(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),v&&S())},className:["pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only",x,!v&&"pkt-invisible"].filter(Boolean).join(" "),"data-disabled":v?void 0:"disabled","aria-disabled":!v||void 0,tabIndex:v?0:-1,children:[o.jsx(R,{className:"pkt-btn__icon",name:N}),o.jsx("span",{className:"pkt-btn__text",children:$})]})})},g=()=>a?o.jsxs("div",{className:"pkt-cal-month-picker",children:[o.jsx("label",{htmlFor:`${s}-monthnav`,className:"pkt-hide",children:e.month}),o.jsx("select",{"aria-label":e.month,className:"pkt-input pkt-input-compact",id:`${s}-monthnav`,value:n,onChange:f=>{f.stopPropagation(),h(t,parseInt(f.target.value))},children:e.months.map((f,k)=>o.jsx("option",{value:k,children:f},k))}),o.jsx("label",{htmlFor:`${s}-yearnav`,className:"pkt-hide",children:e.year}),o.jsx("input",{"aria-label":e.year,className:"pkt-input pkt-cal-input-year pkt-input-compact",id:`${s}-yearnav`,type:"number",size:4,placeholder:"0000",value:t,onChange:f=>{f.stopPropagation(),h(parseInt(f.target.value),n)}})]}):o.jsxs("div",{className:"pkt-txt-16-medium pkt-calendar__month-title","aria-live":"polite",children:[e.months[n]," ",t]});return o.jsxs("nav",{className:"pkt-cal-month-nav",children:[m("prev"),g(),m("next")]})};function Lg(s,e,t){const n=vn(t.year,t.month,s),i=bt(n),r=i===bt(e),a=t.activeSelected.includes(i),l=t.isDayDisabled(n,a);let c;return t.focusedDate?c=t.focusedDate===i&&!l?"0":"-1":!l&&t.tabIndexSetRef.current===0?(t.tabIndexSetRef.current=s,c="0"):c=t.tabIndexSetRef.current===s?"0":"-1",{currentDate:n,currentDateISO:i,isToday:r,isSelected:a,isDisabled:l,ariaLabel:fg(n),tabindex:c}}function Bg(s,e){const{currentDateISO:t,isToday:n,isSelected:i}=s,r=e.range&&(e.activeSelected.length===2||e.rangeHovered!==null)&&t===e.activeSelected[0],a=e.range&&e.activeSelected.length===2&&t===e.activeSelected[1];return re({"pkt-cal-today":n,"pkt-cal-selected":i,"pkt-cal-in-range":e.inRange[t],"pkt-cal-excluded":e.isExcluded(s.currentDate),"pkt-cal-in-range-first":r,"pkt-cal-in-range-last":a,"pkt-cal-range-hover":e.rangeHovered!==null&&t===bt(e.rangeHovered)})}function Fg(s,e){const{currentDateISO:t,isToday:n,isSelected:i,isDisabled:r}=s,a=e.range&&(e.activeSelected.length===2||e.rangeHovered!==null)&&t===e.activeSelected[0],l=e.range&&e.activeSelected.length===2&&t===e.activeSelected[1];return re({"pkt-calendar__date":!0,"pkt-calendar__date--today":n,"pkt-calendar__date--selected":i,"pkt-calendar__date--disabled":r,"pkt-calendar__date--in-range":e.inRange[t],"pkt-calendar__date--in-range-hover":e.rangeHovered!==null&&t===bt(e.rangeHovered),"pkt-calendar__date--range-start":a,"pkt-calendar__date--range-end":l})}const Vg=({state:s})=>{const{strings:e,year:t,month:n,activeSelected:i,focusedDate:r,inRange:a,rangeHovered:l,range:c,multiple:h,weeknumbers:m,selectableDatesRef:g,tabIndexSetRef:f,handleDateSelect:k,handleRangeHover:v,isExcluded:$,isDayDisabled:N,setFocusedDate:x,todayDate:S}=s,P={year:t,month:n,activeSelected:i,focusedDate:r,tabIndexSetRef:f,isDayDisabled:N},D={range:c,activeSelected:i,rangeHovered:l,inRange:a,isExcluded:$},U=()=>{const j=[];m&&j.push(o.jsx("th",{children:o.jsx("div",{className:"pkt-calendar__week-number",children:e.week})},"week-header"));for(let M=0;M<e.daysShort.length;M++)j.push(o.jsx("th",{children:o.jsx("div",{className:"pkt-calendar__day-name","aria-label":e.days[M],children:e.daysShort[M]})},`day-${M}`));return o.jsx("tr",{className:"pkt-cal-week-row",children:j})},V=(j,M)=>{const z=Lg(j,M,P),{currentDate:L,currentDateISO:Q,isSelected:oe,isDisabled:ee,ariaLabel:de,tabindex:le}=z;g.current.push({currentDateISO:Q,isDisabled:ee,tabindex:le});const be=Bg(z,D),ne=Fg(z,D);return o.jsx("td",{className:be,children:o.jsx("button",{type:"button","aria-pressed":oe?"true":"false",disabled:ee,className:`pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only ${ne}`,onMouseOver:()=>c&&!$(L)&&v(L),onFocus:()=>{c&&!$(L)&&v(L),x(Q)},"aria-label":de,tabIndex:parseInt(le),"data-disabled":ee?"disabled":void 0,"data-date":Q,onKeyDown:ae=>{(ae.key==="Enter"||ae.key===" ")&&(ae.preventDefault(),k(L))},onClick:ae=>{ee||(ae.preventDefault(),k(L))},children:o.jsx("span",{className:"pkt-btn__text pkt-txt-14-light",children:j})})},Q)},Y=(j,M)=>o.jsx("td",{className:"pkt-cal-other",children:o.jsx("div",{className:"pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only","data-disabled":"disabled",children:o.jsx("span",{className:"pkt-btn__text pkt-txt-14-light",children:j})})},M),ue=()=>{const j=S,M=Sg(t,n);g.current=[],f.current=0;let z=1,L=M.initialWeek;const Q=[];for(let oe=0;oe<M.numRows;oe++){const ee=[];m&&ee.push(o.jsx("td",{className:"pkt-cal-week",children:L},`week-${L}`)),L++;for(let de=0;de<ai;de++){const le=Tg(oe,de,z,M);if(le==="current-month")ee.push(V(z,j)),z++;else{const be=Ng(le,de,z,M);ee.push(Y(be,`${le}-${oe}-${de}`)),le==="next-month"&&z++}}Q.push(o.jsx("tr",{className:"pkt-cal-week-row",role:"row",children:ee},`row-${oe}`))}return Q};return o.jsxs("table",{className:"pkt-cal-days pkt-txt-12-medium pkt-calendar__body",role:"grid","aria-multiselectable":c||h||void 0,children:[o.jsx("thead",{children:U()}),o.jsx("tbody",{children:ue()})]})},qr=d.forwardRef((s,e)=>{const t=Ag(s);return d.useImperativeHandle(e,()=>({handleDateSelect:t.handleDateSelect,addToSelected:t.addToSelected,removeFromSelected:t.removeFromSelected,toggleSelected:t.toggleSelectedDate,focusOnCurrentDate:t.focusOnCurrentDate,close:t.close}),[t.handleDateSelect,t.addToSelected,t.removeFromSelected,t.toggleSelectedDate,t.focusOnCurrentDate,t.close]),o.jsxs("div",{ref:t.calendarRef,className:["pkt-calendar",t.weeknumbers&&"pkt-cal-weeknumbers",t.className].filter(Boolean).join(" "),onBlur:t.handleFocusOut,onKeyDown:t.handleKeydown,children:[o.jsx(Ig,{componentId:t.componentId,strings:t.strings,year:t.year,month:t.month,earliest:t.earliest,latest:t.latest,withcontrols:t.withcontrols,prevMonth:t.prevMonth,nextMonth:t.nextMonth,changeMonth:t.changeMonth}),o.jsx(Vg,{state:t})]})});qr.displayName="PktCalendar";const Ns=d.forwardRef(({children:s,skin:e,textStyle:t,size:n,closeTag:i,className:r,iconName:a,ariaLabel:l,onClose:c,type:h,"aria-description":m,...g},f)=>{const[k,v]=d.useState(!1),$=d.useCallback(()=>{v(!0),c&&c()},[c]),N=d.useRef(null),[x,S]=d.useState("");d.useEffect(()=>{var V,Y;S(((Y=(V=N.current)==null?void 0:V.textContent)==null?void 0:Y.trim())??"")},[s]);const P=d.useMemo(()=>{if(i&&!l)return x&&`Klikk for å fjerne ${x}`||m},[i,l,x,m]),D={"pkt-tag":!0,[`pkt-tag--${n}`]:!!n,[`pkt-tag--${e}`]:!!e,[`pkt-tag--${t}`]:!!t},U={"pkt-tag":!0,"pkt-btn":!0,"pkt-btn--tertiary":!0,[`pkt-tag--${t}`]:!!t,[`pkt-tag--${n}`]:!!n,[`pkt-tag--${e}`]:!!e,"pkt-btn--icons-right-and-left":i&&!!a,"pkt-hide":k};return i?o.jsxs("button",{...g,className:re(U,r),type:h,onClick:$,"aria-label":l,"aria-description":P,ref:f,children:[a&&o.jsx(R,{className:"pkt-tag__icon",name:a}),o.jsx("span",{ref:N,children:s}),o.jsx(R,{className:"pkt-tag__close-btn",name:"close"})]}):o.jsxs("span",{...g,className:re(D,r),ref:f,children:[a&&o.jsx(R,{className:"pkt-tag__icon",name:a,"aria-hidden":"true"}),o.jsx("span",{ref:N,children:s})]})});Ns.displayName="PktTag";const pl=d.forwardRef(({children:s,className:e,ariaLabel:t,metaLead:n,borderOnHover:i=!0,metaTrail:r,layout:a="vertical",heading:l="",headingLevel:c=3,image:h,imageShape:m="square",clickCardLink:g,padding:f="default",openLinkInNewTab:k=!1,skin:v="outlined",subheading:$="",tagPosition:N="top",tags:x=[],...S},P)=>{const D=re({"pkt-card":!0,[`pkt-card--${v}`]:v,[`pkt-card--${a}`]:a,[`pkt-card--padding-${f}`]:f,"pkt-card--border-on-hover":i}),U=(t==null?void 0:t.trim())||(l?`${l} lenkekort`:"lenkekort"),V=(t==null?void 0:t.trim())||l||"kort",Y=`h${c}`,ue=()=>h!=null&&h.src?o.jsx("div",{className:re("pkt-card__image",`pkt-card__image-${m}`),children:o.jsx("img",{src:h.src,alt:h.alt||""})}):null,j=()=>x.length===0?null:o.jsx("div",{className:re("pkt-card__tags",`pkt-card__tags-${N}`),role:"list","aria-label":x.length>1?"merkelapper":"merkelapp",children:x.map((ee,de)=>o.jsx(Ns,{role:"listitem",textStyle:"normal-text",size:"medium",skin:ee.skin,iconName:ee.iconName,children:o.jsx("span",{children:ee.text})},de))}),M=()=>!l||g?null:o.jsx(Y,{className:"pkt-heading pkt-heading--medium pkt-heading--fw-regular pkt-card__heading",children:l}),z=()=>g?o.jsx(Y,{className:"pkt-heading pkt-heading--medium pkt-heading--fw-regular pkt-card__link-heading pkt-card__heading",children:o.jsx("a",{className:"pkt-card__link",href:g,target:k?"_blank":"_self",rel:k?"noopener noreferrer":void 0,children:l})}):null,L=()=>$?o.jsx("p",{className:"pkt-card__subheading",children:$}):null,Q=()=>!l&&!$?null:o.jsxs("header",{className:"pkt-card__header",children:[M(),z(),L()]}),oe=()=>!n&&!r?null:o.jsxs("footer",{className:"pkt-card__metadata",children:[n&&o.jsx("span",{className:"pkt-card__metadata-lead",children:n}),r&&o.jsx("span",{className:"pkt-card__metadata-trail",children:r})]});return o.jsx("div",{ref:P,className:re("pkt-card-root",e),style:{display:"block",width:"100%"},children:o.jsxs("article",{...S,className:D,"aria-label":g?U:V,children:[ue(),o.jsxs("div",{className:"pkt-card__wrapper",children:[N==="top"&&j(),Q(),o.jsx("section",{className:"pkt-card__content",children:s}),N==="bottom"&&j(),oe()]})]})})});pl.displayName="PktCard";const fl=d.forwardRef(({id:s,hasTile:e=!1,disabled:t=!1,label:n,checkHelptext:i,hasError:r=!1,className:a,isSwitch:l=!1,hideLabel:c=!1,labelPosition:h="right",defaultChecked:m,checked:g,indeterminate:f,optionalTag:k,optionalText:v="Valgfritt",requiredTag:$,requiredText:N="Må fylles ut",tagText:x,...S},P)=>{const D=d.useRef(null);d.useEffect(()=>{D.current&&f!==void 0&&(D.current.indeterminate=f)},[f]),d.useEffect(()=>{typeof P=="function"?P(D.current):P&&(P.current=D.current)},[P]);const U=[a,"pkt-input-check"].filter(Boolean).join(" "),V=["pkt-input-check__input-label",t?"pkt-input-check__input-label--disabled":"",`pkt-input-check__input-label--${h}`,c?"pkt-sr-only":""].filter(Boolean).join(" "),Y=["pkt-input-check__input",e?"pkt-input-check__input--tile":"",t&&e?"pkt-input-check__input--tile-disabled":""].filter(Boolean).join(" "),ue=["pkt-tag","pkt-tag--small","pkt-tag--thin-text"].join(" "),j=()=>o.jsxs(o.Fragment,{children:[x&&o.jsx("span",{className:ue+" pkt-tag--gray",children:x}),k&&o.jsx("span",{className:ue+" pkt-tag--blue-light",children:v}),$&&o.jsx("span",{className:ue+" pkt-tag--beige",children:N})]});return o.jsx("div",{className:U,children:o.jsxs("div",{className:Y,children:[h==="left"&&o.jsxs("label",{className:V,htmlFor:s,children:[n," ",j(),i&&o.jsx("div",{className:"pkt-input-check__input-helptext",children:i})]}),o.jsx("input",{role:l?"switch":"checkbox",ref:D,className:`pkt-input-check__input-checkbox ${r?"pkt-input-check__input-checkbox--error":""}`,type:"checkbox",id:s,disabled:t,...g!==void 0?{checked:g}:{defaultChecked:m},...S}),h==="right"&&o.jsxs("label",{className:V,htmlFor:s,children:[n," ",j(),i&&o.jsx("div",{className:"pkt-input-check__input-helptext",children:i})]})]})})});fl.displayName="PktCheckbox";const Ms=d.forwardRef(({forId:s,label:e,helptext:t,helptextDropdown:n,helptextDropdownButton:i,counter:r,counterCurrent:a=0,counterMaxLength:l,optionalTag:c=!1,optionalText:h="Valgfritt",requiredTag:m=!1,requiredText:g="Må fylles ut",tagText:f=null,hasError:k=!1,errorMessage:v,disabled:$=!1,inline:N=!1,ariaDescribedby:x,useWrapper:S=!0,children:P,className:D="",hasFieldset:U=!1,role:V="group",counterPosition:Y="bottom"},ue)=>{const[j,M]=d.useState(!1),z=x||(t?`${s}-helptext`:void 0),L=!!r,Q=L&&Y==="top",oe=L&&Y==="bottom",ee=()=>M(A=>!A),de=["pkt-inputwrapper",D,k?"pkt-inputwrapper--error":"",$?"pkt-inputwrapper--disabled":"",N?"pkt-inputwrapper--inline":""].filter(Boolean).join(" "),le=["pkt-tag","pkt-tag--small","pkt-tag--thin-text"].join(" "),be=()=>L?o.jsxs("div",{className:"pkt-input__counter","aria-live":"polite","aria-atomic":"true",children:[a,l?`/${l}`:""]}):null,ne=()=>o.jsxs(o.Fragment,{children:[f&&o.jsx("span",{className:le+" pkt-tag--gray",children:f}),c&&o.jsx("span",{className:le+" pkt-tag--blue-light",children:h}),m&&o.jsx("span",{className:le+" pkt-tag--beige",children:g})]}),ae=()=>{const A=o.jsxs(o.Fragment,{children:[e," ",ne()]});return S?U?o.jsx("legend",{className:"pkt-inputwrapper__legend",id:`${s}-label`,children:A}):o.jsx("label",{className:"pkt-inputwrapper__label",htmlFor:s,"aria-describedby":z,id:`${s}-label`,children:A}):o.jsx("label",{htmlFor:s,className:"pkt-sr-only","aria-describedby":z,id:`${s}-label`,children:e})},Ue=()=>!t&&!n?null:o.jsxs(o.Fragment,{children:[t&&S&&o.jsx("div",{className:"pkt-inputwrapper__helptext",id:`${s}-helptext`,children:t}),n&&o.jsxs("div",{className:"pkt-inputwrapper__helptext-expandable",children:[o.jsx(dt,{skin:"tertiary",size:"small",variant:"icon-right",iconName:j?"chevron-thin-up":"chevron-thin-down",className:"pkt-link pkt-link--icon-right",onClick:ee,children:o.jsx("span",{dangerouslySetInnerHTML:{__html:i??'Les mer <span class="pkt-sr-only">om inputfeltet</span>'}})}),o.jsx("div",{className:`pkt-inputwrapper__helptext ${j?"pkt-inputwrapper__helptext-expandable-open":"pkt-inputwrapper__helptext-expandable-closed"}`,children:n})]})]}),Z=o.jsxs(o.Fragment,{children:[ae(),Ue(),Q&&o.jsx(be,{}),P,oe&&o.jsx(be,{}),k&&v&&o.jsx("div",{className:"pkt-inputwrapper__alert-wrapper",children:o.jsx(Bi,{skin:"error","aria-live":"assertive",role:"alert",id:`${s}-error`,compact:!0,children:v})})]});return o.jsx("div",{className:de,ref:ue,role:V,children:U?o.jsx("fieldset",{className:"pkt-inputwrapper__fieldset","aria-describedby":z,children:Z}):o.jsx("div",{className:"pkt-inputwrapper__fieldset",children:Z})})});Ms.displayName="PktInputWrapper";const fs=(s,e)=>e&&(s.find(t=>t.value===e)||s.find(t=>t.label===e))||null,Hg=(s,e)=>{if(!e)return-1;const t=s.findIndex(n=>n.value===e);return t>=0?t:s.findIndex(n=>n.label===e)},Ug=(s,e)=>{if(!e)return[...s];const t=e.toLowerCase();return s.filter(n=>(n.fulltext||n.value+(n.label||"")+(n.prefix||"")).toLowerCase().includes(t))},Hi=s=>s.value+(s.label||"")+(s.prefix||""),Ui=(s,e)=>e!==null&&s>=e,gl=(s,e)=>{if(!s)return"";switch(e){case"prefixAndValue":return`${s.prefix||""} ${s.value}`.trim();case"value":return s.value;case"label":default:return s.label||s.value}},Wr=(s,e)=>s?Array.isArray(s)?e?s:s.length>0?[s[0]]:[]:e?s.split(",").filter(Boolean):[s]:[],ml=(s,e)=>{if(!e)return{filtered:[...s],suggestion:null};const t=e.toLowerCase(),n=s.filter(r=>{var a;return(a=r.fulltext)==null?void 0:a.toLowerCase().includes(t)}),i=n.find(r=>{var a;return!r.selected&&((a=r.label)==null?void 0:a.toLowerCase().startsWith(t))})||null;return{filtered:n,suggestion:i}},jg=(s,e,t,n)=>{if(!s.trim())return{addValueText:null,userInfoMessage:""};const i=s.trim().toLowerCase(),r=e.find(c=>c.toLowerCase()===i),a=t.filter(c=>{var h;return((h=c.label)==null?void 0:h.toLowerCase().includes(i))||c.value.toLowerCase().includes(i)}),l=a.find(c=>{var h;return((h=c.label)==null?void 0:h.toLowerCase())===i||c.value.toLowerCase()===i});return(a.length===0||!l)&&n?{addValueText:s,userInfoMessage:""}:a.length===0&&!n?{addValueText:null,userInfoMessage:"Ingen treff i søket"}:r?{addValueText:null,userInfoMessage:"Verdien er allerede valgt"}:{addValueText:null,userInfoMessage:""}},qg=(s,e,t)=>{switch(s){case",":return t?"addValue":null;case"Enter":return"addValue";case"Tab":case"ArrowDown":return e?null:"focusListbox";case"Escape":return"closeOptions";default:return null}},Wg=(s,e,t,n,i)=>{if(!s)return{action:"none",value:null};const r=fs(t,s);return!e.includes(s)&&!r?n?{action:"addUserValue",value:s}:i?{action:"none",value:null}:{action:"removeValue",value:e[0]}:r&&!e.includes(r.value)?{action:"selectOption",value:r.value}:{action:"none",value:null}},ji=(s,e,t)=>{const n=fs(e,s);return t==="label"&&(n!=null&&n.label)?n.label:s},Xs=s=>{s.scrollIntoView({block:"nearest"}),window.setTimeout(()=>s.focus(),0)},bl=s=>Array.from(s.querySelectorAll('[role="option"]:not([data-disabled])')||[]),zg=s=>{const e=s.nextElementSibling;e&&Xs(e)},vl=(s,e,t)=>{const n=s.previousElementSibling;if(s.dataset.index==="0"&&t){const i=e.querySelector('[role="searchbox"]');i&&Xs(i)}else n&&Xs(n)},Yg=s=>{const e=bl(s);e[0]&&Xs(e[0])},qi=(s,e)=>{if(e.disabled)return;const t=bl(s);if(e.allowUserInput&&e.customUserInput){const i=s.querySelector('[data-type="new-option"]');if(i){Xs(i);return}}const n=t.find(i=>i.dataset.selected==="true");if(n){Xs(n);return}if(e.includeSearch&&!(document.activeElement instanceof HTMLInputElement)){const i=s.querySelector('[role="searchbox"]');if(i){window.setTimeout(()=>i.focus(),0);return}}t[0]&&Xs(t[0])},kl=({state:s,outside:e=!1})=>{const{values:t,options:n,disabled:i,displayValueAs:r,handleTagRemove:a,handleTagKeydown:l,focusedTagIndex:c}=s,h=d.useRef([]);if(d.useEffect(()=>{var f;!e&&c>=0&&c<t.length&&((f=h.current[c])==null||f.focus())},[e,c,t.length]),t.length===0)return null;const m=(f,k)=>{const v=fs(n,f),$=v==null?void 0:v.tagSkinColor,N=v?gl(v,r):f;return i?o.jsx("li",{role:"listitem",children:o.jsx(Ns,{skin:$||"blue-dark",children:o.jsx("span",{className:"pkt-combobox__value",children:N})})},f):e?o.jsx("li",{role:"listitem",children:o.jsx(Ns,{skin:$||"blue-dark",closeTag:!0,onClose:()=>a(f),children:o.jsx("span",{className:"pkt-combobox__value",children:N})})},f):o.jsx("li",{role:"listitem",onClick:x=>x.stopPropagation(),onMouseDown:x=>x.preventDefault(),children:o.jsx(Ns,{ref:x=>{h.current[k]=x},skin:$||"blue-dark",closeTag:!0,tabIndex:c===k?0:-1,onClose:()=>a(f),onKeyDown:x=>l(x,k),children:o.jsx("span",{className:"pkt-combobox__value",children:N})})},f)},g=t.map(m);return e?o.jsx("div",{className:"pkt-combobox__tags-outside",children:o.jsx("ul",{role:"list",className:"pkt-combobox__tag-list",children:g})}):o.jsx("ul",{role:"list",className:"pkt-combobox__tag-list",children:g})},Kg=({state:s})=>{const{values:e,options:t,editingSingleValue:n,displayValueAs:i}=s;if(n||e.length===0)return null;const r=fs(t,e[0]);if(!r)return null;const a=gl(r,i);return o.jsx("span",{className:"pkt-combobox__value",children:a})},Gg=({state:s})=>{const{id:e,inputId:t,listboxId:n,values:i,options:r,isOpen:a,multiple:l,typeahead:c,allowUserInput:h,tagPlacement:m,placeholder:g,disabled:f,fullwidth:k,hasError:v,label:$,inputFocus:N,inputRef:x,triggerRef:S,handleInputChange:P,handleInputKeydown:D,handleInputFocus:U,handleInputBlur:V,handleInputClick:Y,handlePlaceholderClick:ue,handleSelectOnlyKeydown:j,name:M}=s,z=["pkt-combobox__input",k&&"pkt-combobox__input--fullwidth",a&&"pkt-combobox__input--open",v&&"pkt-combobox__input--error",f&&"pkt-combobox__input--disabled"].filter(Boolean).join(" "),L=["pkt-combobox__arrow-icon",a&&"pkt-combobox__arrow-icon--open"].filter(Boolean).join(" "),Q=c||h,oe=!Q&&g&&(!i.length||l&&m==="outside")&&!N,ee=m!=="outside",de=i[0]&&fs(r,i[0])?`${n}-${Hg(r,i[0])}`:void 0,le=l&&i.length>0?`${i.length} valgt`:void 0,be=Q?{tabIndex:-1}:{id:`${e}-combobox`,role:"combobox","aria-expanded":a?"true":"false","aria-controls":n,"aria-haspopup":"listbox","aria-labelledby":`${e}-combobox-label`,"aria-activedescendant":de,"aria-description":le,tabIndex:f?-1:0,onKeyDown:j};return o.jsxs("div",{ref:S,className:z,onClick:Y,...be,children:[oe?o.jsx("span",{className:"pkt-combobox__placeholder",onClick:ue,children:g}):ee?l?o.jsx(kl,{state:s}):Q?null:o.jsx(Kg,{state:s}):null,Q?o.jsx("div",{className:"pkt-combobox__input-div combobox__input",children:o.jsx("input",{ref:x,type:"text",id:t,name:`${M||e}-input`,onChange:P,onKeyDown:D,onFocus:U,onBlur:V,placeholder:!i.length||l&&m==="outside"?g:void 0,autoComplete:"off",role:"combobox","aria-expanded":a?"true":"false","aria-label":$,"aria-autocomplete":c?"both":h?"list":"none","aria-controls":n,"aria-activedescendant":de,"aria-description":le,disabled:f})}):o.jsx("input",{ref:x,type:"hidden",id:t,name:`${M||e}-input`,value:i.join(","),readOnly:!0}),o.jsx(R,{className:L,name:"chevron-thin-down","aria-hidden":"true"})]})},Xg=({state:s})=>{const{listboxId:e,label:t,isOpen:n,options:i,filteredOptions:r,multiple:a,disabled:l,maxIsReached:c,maxlength:h,includeSearch:m,allowUserInput:g,addValueText:f,userInfoMessage:k,searchPlaceholder:v,searchValue:$,handleOptionClick:N,handleOptionKeydown:x,handleSearchInput:S,handleSearchKeydown:P,handleNewOptionClick:D,handleNewOptionKeydown:U,listboxRef:V}=s,Y=r.filter(L=>L.selected).length,ue=a&&Y>0&&h!=null&&h>0,j=g&&f&&!c,M=!!k,z=["pkt-listbox",n&&"pkt-listbox__open","pkt-txt-16-light"].filter(Boolean).join(" ");return o.jsxs(o.Fragment,{children:[o.jsxs("div",{ref:V,id:e,className:z,role:r.length>0?"listbox":void 0,"aria-label":r.length>0?`Liste: ${t||""}`:void 0,"aria-multiselectable":r.length>0&&a?"true":void 0,children:[o.jsxs("div",{className:"pkt-listbox__banners",children:[m&&o.jsxs("div",{className:"pkt-listbox__search",children:[o.jsx("span",{className:"pkt-listbox__search-icon",children:o.jsx(R,{name:"magnifying-glass-small"})}),o.jsx("input",{className:"pkt-txt-16-light",type:"text","aria-label":"Søk i listen",form:"",placeholder:v||"Søk...",onChange:S,onKeyDown:P,value:$,"data-type":"searchbox",disabled:l,readOnly:l,role:"searchbox"})]}),ue&&o.jsxs("div",{className:"pkt-listbox__banner pkt-listbox__banner--maximum-reached",children:[Y," av maks ",h," mulige er valgt."]}),M&&o.jsxs("div",{className:"pkt-listbox__banner pkt-listbox__banner--user-message",children:[o.jsx(R,{className:"pkt-listbox__banner-icon",name:"exclamation-mark-circle"}),k]}),j&&o.jsxs("div",{className:"pkt-listbox__banner pkt-listbox__banner--new-option pkt-listbox__option","data-type":"new-option","data-value":f,"data-selected":"false",tabIndex:0,onClick:()=>D(f),onKeyDown:U,children:[o.jsx(R,{className:"pkt-listbox__banner-icon",name:"plus-sign"}),'Legg til "',f,'"']}),i.length===0&&r.length===0&&!M&&o.jsxs("div",{className:"pkt-listbox__banner pkt-listbox__banner--empty",children:[o.jsx(R,{className:"pkt-listbox__banner-icon",name:"exclamation-mark-circle"}),"Tom liste"]})]}),o.jsx("ul",{className:"pkt-listbox__options",role:"presentation",children:r.map((L,Q)=>{const oe=["pkt-listbox__option",!a&&L.selected&&"pkt-listbox__option--selected",a&&"pkt-listbox__option--checkBox"].filter(Boolean).join(" "),ee=l||L.disabled||c&&!L.selected;return o.jsxs("li",{className:oe,onClick:()=>N(L.value),onKeyDown:de=>x(de,L.value),"aria-selected":L.selected?"true":"false",tabIndex:ee?-1:0,"data-index":Q,"data-value":L.value,"data-selected":L.selected?"true":"false","data-disabled":ee||void 0,"aria-disabled":ee?"true":"false",role:"option",id:`${e}-${Q}`,children:[a?o.jsx("input",{className:"pkt-input-check__input-checkbox",type:"checkbox",tabIndex:-1,value:L.value,checked:L.selected||!1,readOnly:!0,"aria-hidden":"true",disabled:ee}):L.selected?o.jsx(R,{name:"check-big"}):null,o.jsxs("span",{className:"pkt-listbox__option-label",id:`${e}-option-label-${Q}`,children:[L.prefix&&o.jsx("span",{className:"pkt-listbox__option-prefix",children:L.prefix}),L.label||L.value]}),L.description&&o.jsx("span",{className:"pkt-listbox__option-description pkt-txt-14-light",children:L.description})]},`${L.value}-${Q}`)})})]}),o.jsx("div",{"aria-live":"polite",className:"pkt-visually-hidden",children:k})]})};function Qg(s,e){return s.map(t=>({...t,label:t.label||t.value,fulltext:Hi(t),selected:e.includes(t.value)}))}function Zg(s,e){const{id:t="",label:n,value:i,defaultValue:r,options:a,defaultOptions:l,multiple:c=!1,maxlength:h,typeahead:m=!1,includeSearch:g=!1,allowUserInput:f=!1,displayValueAs:k="label",tagPlacement:v,searchPlaceholder:$,placeholder:N,disabled:x=!1,required:S=!1,fullwidth:P=!1,hasError:D=!1,errorMessage:U,helptext:V,helptextDropdown:Y,helptextDropdownButton:ue,optionalTag:j=!1,optionalText:M,requiredTag:z=!1,requiredText:L,tagText:Q,useWrapper:oe=!0,name:ee,className:de,onChange:le,onValueChange:be,children:ne}=s,ae=`${t}-input`,Ue=`${t}-listbox`,Z=m||f,A=d.useRef(null),Me=d.useRef(null),De=d.useRef(null),te=d.useRef(null),Ie=d.useRef(null),Ee=d.useCallback(()=>{var w,O;Z?(w=A.current)==null||w.focus():(O=De.current)==null||O.focus()},[Z]),ye=d.useMemo(()=>{const w=[];return d.Children.forEach(ne,O=>{if(d.isValidElement(O)&&O.type==="option"){const J=O.props;w.push({value:J.value??J.children??"",label:J.children??J.value??"",selected:J.selected,disabled:J.disabled})}}),w},[ne]),Te=d.useMemo(()=>l&&l.length>0?l.map(w=>({...w,fulltext:Hi(w)})):a&&a.length>0?a.map(w=>({...w,fulltext:Hi(w)})):ye.length>0?ye.map(w=>({...w,fulltext:Hi(w)})):[],[l,a,ye]),Pe=i!==void 0,[je,Ae]=d.useState(()=>Wr(i??r,c)),ve=d.useRef(je);d.useEffect(()=>{Pe&&Ae(Wr(i,c))},[i,Pe,c]);const E=Pe?Wr(i,c):je,[Le,Ye]=d.useState([]),q=d.useMemo(()=>{const w=[...Le.filter(O=>!Te.some(J=>J.value===O.value)),...Te];return Qg(w,E)},[Te,Le,E]),[H,se]=d.useState(!1),[me,ge]=d.useState(""),[Xe,Ke]=d.useState(""),[b,p]=d.useState(""),[_,T]=d.useState(null),[K,G]=d.useState(!1),[ce,nt]=d.useState(!1),[Ze,Be]=d.useState(-1),Gt=d.useRef(!1),Xt=Ui(E.length,h??null),_t=c&&h!=null,ci=d.useMemo(()=>me?m?ml(q,me).filtered:Ug(q,me):q,[q,me,m]),ht=d.useMemo(()=>{var w;return(w=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value"))==null?void 0:w.set},[]),Ut=d.useCallback(w=>{const O=Me.current;if(!O||!ht)return;const J=c?w.join(","):w[0]||"";ht.call(O,J),O.dispatchEvent(new Event("input",{bubbles:!0}))},[ht,c]),Qt=c?E.join(","):E[0]||"";d.useEffect(()=>{Me.current&&(Me.current.value=Qt)},[Qt]),d.useEffect(()=>{if(H||c||!A.current)return;const w=E[0]?ji(E[0],q,k):"";A.current.value!==w&&(A.current.value=w)},[E,q,k,c,H]);const as=d.useCallback((w,O=!0)=>{Pe||Ae(w),O&&(be==null||be(w),Ut(w))},[Pe,be,Ut]),Ds=d.useCallback(w=>{if(!w||E.includes(w))return;if(c&&Ui(E.length,h??null)){p("Maks antall valg nådd");return}const O=c?[...E,w]:[w];as(O)},[E,c,h,as]),Je=d.useCallback(w=>{if(!w)return;const O=E.filter(Fe=>Fe!==w),J=fs(q,w);J!=null&&J.userAdded&&Ye(Fe=>Fe.filter(Nt=>Nt.value!==w)),as(O)},[E,q,as]),ui=d.useCallback(()=>{Ye([]),as([])},[as]),Qs=d.useCallback(w=>{if(!w||w.trim()==="")return;let O;if(!c)O=[w];else{if(fs(q,w)||Ui(E.length,h??null))return;O=[...E,w]}const J={value:w,label:w,userAdded:!0,selected:!0};Ye(Fe=>[J,...Fe.filter(Nt=>Nt.value!==w)]),as(O)},[c,q,E,h,as]),di=d.useCallback((w=!0,O)=>{if(T(null),w&&A.current&&A.current.type!=="hidden"){ge(""),Ke("");const J=O!==void 0?O:E[0];!c&&J?A.current.value=ji(J,q,k):A.current.value="",c||(nt(!1),p(""))}},[c,E,q,k]),jt=d.useCallback(w=>{var Rl,ec;if(x)return;p(""),T(null);const O=((Rl=fs(q,w))==null?void 0:Rl.value)||null,J=E.includes(w||O||""),Fe=!!O,Nt=((ec=q.find(Ob=>Ob.value===w))==null?void 0:ec.disabled)||!1,Zs=!(w!=null&&w.trim()),Pt=!c,qt=c,Ri=Ui(E.length,h??null);let gs=!1,er=!0,hi="",ra="",$n;Nt||(!Fe&&f&&!Zs?(Qs(w),hi="Ny verdi lagt til",gs=qt,Pt&&($n=w||"")):!Fe&&!f?(Pt&&E[0]&&Je(E[0]),er=!1,gs=!0,hi="Ingen treff i søket"):J?(Je(O),gs=!0,$n="",Pt&&Z&&A.current&&A.current.type!=="hidden"&&(A.current.value="")):Zs&&Pt?(ui(),gs=!0,$n=""):Pt?(E[0]&&Je(E[0]),Ds(O),gs=!1,$n=O||""):qt&&!Ri?(Ds(O),gs=!0):qt&&Ri?(hi="Maks antall valg nådd",er=!1,ra=w||""):(Pt&&ui(),hi="Ingen gyldig verdi valgt",er=!1,gs=!0,ra=w||"",$n=""),se(gs),p(hi),ge(ra),di(er,$n),gs||(Pt&&Z&&(Gt.current=!0),window.setTimeout(()=>{Ee()},0)))},[x,q,E,c,h,f,Qs,Je,ui,Ds,di,Ee]),Tt=d.useCallback(()=>{if(G(!1),T(null),p(""),ge(""),A.current&&A.current.type!=="hidden"){const w=A.current.value;let O=E[0];if(c){if(w!==""){const{action:J,value:Fe}=Wg(w,E,q,f,c);switch(J){case"addUserValue":Qs(Fe);break;case"selectOption":Ds(Fe);break;case"removeValue":Je(Fe);break}}}else if(!w)E[0]&&Je(E[0]),O=void 0;else{const J=fs(q,w);J&&J.value!==E[0]?(E[0]&&Je(E[0]),Ds(J.value),O=J.value):!J&&f&&(E[0]&&Je(E[0]),Qs(w),O=w)}!c&&O?A.current.value=ji(O,q,k):A.current.value=""}se(!1),nt(!1)},[E,q,f,c,k,Qs,Ds,Je]),_n=d.useCallback(w=>{if(!w.trim().toLowerCase()){T(null),p(""),!c&&E[0]&&Je(E[0]);return}const J=jg(w,E,q,f);T(J.addValueText),p(J.userInfoMessage)},[E,q,f,c,Je]),Zi=d.useCallback(w=>{var J;if(x)return;const O=w.target.value;if(Ke(O),ge(O),_n(O),m&&O){const{suggestion:Fe}=ml(q,O);Fe!=null&&Fe.label&&A.current&&!((J=w.nativeEvent.inputType)!=null&&J.includes("deleteContent"))&&(A.current.value=Fe.label,window.setTimeout(()=>{var Nt;return(Nt=A.current)==null?void 0:Nt.setSelectionRange(O.length,Fe.label.length)},0))}},[x,m,q,_n]),ea=d.useCallback(w=>{var J,Fe,Nt,Zs,Pt;if(w.key==="Backspace"){const qt=!((J=A.current)!=null&&J.value);if(!me&&qt&&c&&E.length>0){w.preventDefault();const Ri=E[E.length-1];Je(Ri)}return}if(w.key==="ArrowLeft"&&c&&E.length>0&&(((Fe=A.current)==null?void 0:Fe.selectionStart)??0)===0&&!((Nt=A.current)!=null&&Nt.value)){w.preventDefault(),Be(E.length-1);return}const O=qg(w.key,w.shiftKey,c);if(O&&!(w.key==="Tab"&&!H)){if(O==="focusListbox"&&w.key==="Tab"&&!((Zs=te.current)==null?void 0:Zs.querySelector('[role="option"]:not([data-disabled]), [data-type="new-option"]'))){Tt();return}switch(w.preventDefault(),O){case"addValue":{const qt=((Pt=A.current)==null?void 0:Pt.value.trim())||"";if(ge(qt),qt&&E.includes(qt)){di(!0),p("Verdien er allerede valgt");break}jt(qt);break}case"focusListbox":te.current&&(H||se(!0),qi(te.current,{disabled:x,allowUserInput:f,customUserInput:_,includeSearch:g}));break;case"closeOptions":se(!1);break}}},[me,E,c,x,f,_,g,H,Je,jt,Ee]),os=d.useCallback(()=>{if(!x){if(Gt.current){Gt.current=!1,G(!0);return}!c&&E[0]&&A.current&&A.current.type!=="hidden"&&(nt(!0),A.current.value=ji(E[0],q,k)),G(!0),ge(""),se(!0)}},[x,c,E,q,k]),ta=d.useCallback(()=>{G(!1),nt(!1)},[]),sa=d.useCallback(w=>{if(x||!H)return;const O=w.relatedTarget,J=Ie.current;J&&O&&J.contains(O)||Tt()},[x,H,Tt]),na=d.useCallback(w=>{var O;if(x){w.preventDefault(),w.stopPropagation();return}if(Z)(O=A.current)==null||O.focus();else{w.stopPropagation(),w.preventDefault();const J=!H;se(J),J&&te.current&&qi(te.current,{disabled:x,allowUserInput:f,customUserInput:_,includeSearch:g})}},[x,Z,H,f,_,g]),ia=d.useCallback(w=>{x||(w.stopPropagation(),Z&&A.current?(A.current.focus(),G(!0)):se(O=>!O))},[x,Z]),B=d.useCallback(w=>{if(!x)switch(w.key){case"Enter":case" ":case"ArrowDown":case"ArrowUp":w.preventDefault(),H?se(!1):(se(!0),te.current&&window.setTimeout(()=>{te.current&&qi(te.current,{disabled:x,allowUserInput:f&&!Xt,customUserInput:_,includeSearch:g})},0));break;case"Escape":H&&(w.preventDefault(),se(!1));break;case"Home":case"End":w.preventDefault(),H||se(!0),te.current&&window.setTimeout(()=>{te.current&&qi(te.current,{disabled:x,allowUserInput:f&&!Xt,customUserInput:_,includeSearch:g})},0);break;case"ArrowLeft":c&&E.length>0&&(w.preventDefault(),Be(E.length-1));break;case"Backspace":case"Delete":if(c&&E.length>0){w.preventDefault();const O=E[E.length-1];Je(O)}break}},[x,H,f,Xt,_,g,c,E,Je]),F=d.useCallback(w=>{jt(w)},[jt]),Ge=d.useCallback((w,O)=>{switch(w.key){case"Enter":case" ":w.preventDefault(),jt(O);break;case"ArrowDown":w.preventDefault(),zg(w.currentTarget);break;case"ArrowUp":w.preventDefault(),te.current&&vl(w.currentTarget,te.current,g);break;case"Escape":w.preventDefault(),se(!1),Ee();break;case"Tab":Tt();break}},[jt,g,Ee,Tt]),Re=d.useCallback(w=>{Je(w),Be(-1),Z&&A.current&&(G(!0),A.current.focus())},[Je,Z]),wn=d.useCallback((w,O)=>{var J,Fe,Nt;switch(w.stopPropagation(),w.key){case"ArrowLeft":w.preventDefault(),O>0&&Be(O-1);break;case"ArrowRight":w.preventDefault(),O<E.length-1?Be(O+1):(Be(-1),Z&&A.current?A.current.focus():(J=De.current)==null||J.focus());break;case"Backspace":case"Delete":w.preventDefault();{const Zs=E[O],Pt=O>=E.length-1?O-1:O;Je(Zs),Pt>=0?Be(Pt):(Be(-1),Z&&A.current?A.current.focus():(Fe=De.current)==null||Fe.focus())}break;case"Tab":Be(-1);break;case"Escape":w.preventDefault(),Be(-1),Z&&A.current?A.current.focus():(Nt=De.current)==null||Nt.focus();break}},[E,Z,Je]),Ji=d.useCallback(w=>{ge(w.target.value),_n(w.target.value)},[_n]),Nb=d.useCallback(w=>{switch(w.key){case"ArrowDown":if(w.preventDefault(),te.current){const O=te.current.querySelector('[role="option"]:not([data-disabled]), [data-type="new-option"]');O==null||O.focus()}break;case"Tab":Tt();break;case"Escape":w.preventDefault(),se(!1),Ee();break}},[Ee,Tt]),Mb=d.useCallback(w=>{jt(w)},[jt]),Db=d.useCallback(w=>{switch(w.key){case"Enter":case" ":w.preventDefault(),jt(w.currentTarget.dataset.value||"");break;case"ArrowDown":w.preventDefault(),te.current&&Yg(te.current);break;case"ArrowUp":w.preventDefault(),te.current&&vl(w.currentTarget,te.current,g);break;case"Escape":w.preventDefault(),se(!1),Ee();break}},[jt,g,Ee]);return d.useEffect(()=>{if(!H)return;const w=O=>{const J=O.target;Ie.current&&!Ie.current.contains(J)&&Tt()};return document.addEventListener("click",w,!0),()=>{document.removeEventListener("click",w,!0)}},[H,Tt]),d.useEffect(()=>{var J;const w=(J=Ie.current)==null?void 0:J.closest("form");if(!w)return;const O=()=>{window.setTimeout(()=>{if(Ae(ve.current),Ye([]),Ke(""),ge(""),T(null),p(""),Me.current){const Fe=c?ve.current.join(","):ve.current[0]||"";Me.current.value=Fe}},0)};return w.addEventListener("reset",O),()=>w.removeEventListener("reset",O)},[c]),d.useImperativeHandle(e,()=>({get value(){var w;return((w=Me.current)==null?void 0:w.value)??""},set value(w){const O=Array.isArray(w)?w:w?String(w).split(",").filter(Boolean):[];Pe||Ae(O),Me.current&&(Me.current.value=O.join(","))},focus(){var w,O;Z?(w=A.current)==null||w.focus():(O=De.current)==null||O.focus()},blur(){var w,O;Z?(w=A.current)==null||w.blur():(O=De.current)==null||O.blur()}}),[Pe]),{id:t,inputId:ae,listboxId:Ue,values:E,inputValue:Xe,searchValue:me,options:q,filteredOptions:ci,isOpen:H,userInfoMessage:b,addValueText:_,maxIsReached:Xt,editingSingleValue:ce,inputFocus:K,focusedTagIndex:Ze,label:n,multiple:c,maxlength:h,typeahead:m,includeSearch:g,allowUserInput:f,displayValueAs:k,tagPlacement:v,searchPlaceholder:$,placeholder:N,disabled:x,required:S,fullwidth:P,hasError:D,errorMessage:U,helptext:V,helptextDropdown:Y,helptextDropdownButton:ue,optionalTag:j,optionalText:M,requiredTag:z,requiredText:L,tagText:Q,useWrapper:oe,name:ee,className:de,hasCounter:_t,inputRef:A,changeInputRef:Me,triggerRef:De,listboxRef:te,wrapperRef:Ie,handleInputChange:Zi,handleInputKeydown:ea,handleInputFocus:os,handleInputBlur:ta,handleFocusOut:sa,handleInputClick:na,handlePlaceholderClick:ia,handleSelectOnlyKeydown:B,handleOptionClick:F,handleOptionKeydown:Ge,handleTagRemove:Re,handleTagKeydown:wn,handleSearchInput:Ji,handleSearchKeydown:Nb,handleNewOptionClick:Mb,handleNewOptionKeydown:Db,onChange:le}}const yl=d.forwardRef((s,e)=>{const t=Zg(s,e),n=["pkt-combobox-component",t.fullwidth&&"pkt-combobox-component--fullwidth",t.className].filter(Boolean).join(" "),i=t.allowUserInput||t.typeahead,r=i?t.inputId:`${t.id}-combobox`;return o.jsxs("div",{className:n,ref:t.wrapperRef,children:[o.jsxs(Ms,{forId:r,hasFieldset:!i,label:t.label||"",helptext:t.helptext,helptextDropdown:t.helptextDropdown,helptextDropdownButton:t.helptextDropdownButton,hasError:t.hasError,errorMessage:t.errorMessage,disabled:t.disabled,optionalTag:t.optionalTag,optionalText:t.optionalText,requiredTag:t.requiredTag,requiredText:t.requiredText,tagText:t.tagText,useWrapper:t.useWrapper,counter:t.hasCounter,counterCurrent:t.values.length,counterMaxLength:t.maxlength,className:"pkt-combobox__wrapper",children:[o.jsxs("div",{className:"pkt-combobox",onBlur:t.handleFocusOut,children:[o.jsx(Gg,{state:t}),o.jsx(Xg,{state:t})]}),t.tagPlacement==="outside"&&t.multiple&&o.jsx(kl,{state:t,outside:!0})]}),o.jsx("input",{ref:t.changeInputRef,type:"text",name:t.name||t.id,onChange:t.onChange,tabIndex:-1,"aria-hidden":"true",className:"pkt-visually-hidden"})]})});yl.displayName="PktCombobox";const Wi=xn({tagName:"pkt-consent",elementClass:Ft,react:d,displayName:"PktConsent",events:{onToggleConsent:"toggle-consent"}});Wi.displayName="PktConsent";const _l=()=>{const s=navigator.userAgent;return!!(/iP(hone|od|ad)/.test(s)||/Macintosh/.test(s)&&"ontouchend"in document)},Jg=()=>_l()?"text":"date",Rg=s=>!s||s.length!==2?!0:yg(s[0],s[1]),em=(s,e,t,n,i,r)=>({"pkt-input":!0,"pkt-datepicker__input":!0,"pkt-input--fullwidth":s,"pkt-datepicker--hasrangelabels":e,"pkt-datepicker--multiple":t,"pkt-datepicker--range":n,"ios-readonly-hack":i===!1&&r==="text"}),tm=()=>({"pkt-input-icon":!0,"pkt-btn":!0,"pkt-btn--icon-only":!0,"pkt-btn--tertiary":!0,"pkt-datepicker__calendar-button":!0}),sm=s=>({"pkt-input-prefix":s,"pkt-hide":!s}),nm=(s,e,t)=>!e&&!t?Array.isArray(s)?s[0]||"":s:Array.isArray(s)?s.join(","):s,im=(s,e,t=!1)=>{var l;if(!s||!e)return;const n=((l=e.parentElement)==null?void 0:l.getBoundingClientRect())||e.getBoundingClientRect(),i=t?n.height+30:n.height,r=s.getBoundingClientRect().height;let a=t?"calc(100% - 30px)":"100%";n&&n.top+r>window.innerHeight&&n.top-r>0&&(a=`calc(100% - ${i}px - ${r}px)`),s.style.top=a},zi=(s,e,t,n,i,r)=>{const{key:a}=s;a===","&&(s.preventDefault(),r?r(s):i&&i()),(a==="Space"||a===" ")&&(s.preventDefault(),e(s)),a==="Enter"&&(s.preventDefault(),t?t():n?n():i&&i())},rm=({open:s,multiple:e=!1,range:t=!1,weeknumbers:n=!1,withcontrols:i=!1,selected:r=[],earliest:a,latest:l,excludedates:c,excludeweekdays:h,maxMultiple:m,currentmonth:g,today:f,inputRef:k,hasCounter:v=!1,onDateSelected:$,onClose:N})=>{const x=d.useRef(null),S=d.useRef(!1);s&&(S.current=!0),d.useEffect(()=>{s&&im(x.current,(k==null?void 0:k.current)??null,v)},[s,k,v]);const P=["pkt-calendar-popup",s?"show":"hide"].join(" "),D=s||S.current;return o.jsx("div",{ref:x,className:P,hidden:!s,"aria-hidden":!s,children:D&&o.jsx(qr,{multiple:e,range:t,weeknumbers:n,withcontrols:i,selected:r,earliest:a,latest:l,excludedates:c,excludeweekdays:h,maxMultiple:m,currentmonth:g,today:f,onDateSelected:$,onClose:N})})},am=({dates:s,dateformat:e,idBase:t,strings:n,onDateRemoved:i})=>{var l;const r=kg(s),a=((l=n==null?void 0:n.calendar)==null?void 0:l.buttonAltText)??"Slett dato";return o.jsx("div",{className:"pkt-date-tags pkt-datepicker__tags","aria-live":"polite",children:r.map(c=>{const h=pg(c,e);return o.jsx(Ns,{id:`${t}${c}-tag`,closeTag:!0,ariaLabel:`${a} ${h}`,onClose:()=>i(c),children:o.jsx("time",{dateTime:c,children:h})},c)})})},om=({state:s})=>{var Ee,ye,Te,Pe;const{id:e,inputId:t,values:n,dateformat:i,multiple:r,range:a,showRangeLabels:l,disabled:c,readOnly:h,required:m,label:g,name:f,placeholder:k,hasError:v,helptext:$,minStr:N,maxStr:x,inputType:S,isIOSDevice:P,strings:D,inputClasses:U,buttonClasses:V,rangeLabelClasses:Y,datepickerInputsClasses:ue,isInputDisabled:j,inputRef:M,inputRefTo:z,btnRef:L,toggleCalendar:Q,handleFocus:oe,handleSingleInputChange:ee,handleRangeFromChange:de,handleRangeToChange:le,handleRangeBlur:be,handleMultipleBlur:ne,handleTagRemoved:ae,handleSingleKeydown:Ue,handleRangeFromKeydown:Z,handleRangeToKeydown:A,handleMultipleKeydown:Me,restProps:De}=s,te=je=>{je.preventDefault(),Q()},Ie=()=>{var je,Ae;return o.jsxs("button",{ref:L,className:V,type:"button",onClick:Q,disabled:c,"aria-label":((je=D.calendar)==null?void 0:je.buttonAltText)??"Åpne kalender",children:[o.jsx(R,{name:"calendar"}),o.jsx("span",{className:"pkt-btn__text",children:((Ae=D.calendar)==null?void 0:Ae.buttonAltText)??"Åpne kalender"})]})};return r?o.jsxs(o.Fragment,{children:[o.jsx(am,{dates:n,dateformat:i,idBase:e,strings:D,onDateRemoved:ae}),o.jsx("div",{className:"pkt-datepicker__inputs",children:o.jsxs("div",{className:"pkt-input__container",children:[o.jsx("input",{...De,ref:M,className:U,type:S,id:t,name:f??e,placeholder:k,readOnly:h||P&&!h,disabled:j,"aria-describedby":$?`${e}-helptext`:void 0,"aria-invalid":v,"aria-errormessage":v?`${e}-error`:void 0,onClick:te,onKeyDown:Me,onFocus:oe,onBlur:ne}),Ie()]})})]}):a?o.jsx("div",{className:ue,children:o.jsxs("div",{className:"pkt-input__container",children:[l&&o.jsx("div",{className:"pkt-input-prefix",children:((Ee=D.generic)==null?void 0:Ee.from)??"Fra"}),o.jsx("input",{...De,ref:M,className:U,type:S,id:t,name:f?`${f}-from`:`${e}-from`,value:n[0]??"",min:N,max:x,placeholder:k,readOnly:h||P&&!h,disabled:c,required:m,"aria-label":`${g} ${((ye=D.generic)==null?void 0:ye.from)??"Fra"}`,"aria-describedby":$?`${e}-helptext`:void 0,"aria-invalid":v,"aria-errormessage":v?`${e}-error`:void 0,onClick:te,onKeyDown:Z,onFocus:oe,onBlur:be,onChange:de}),o.jsx("div",{className:Y,id:`${e}-to-label`,children:((Te=D.generic)==null?void 0:Te.to)??"Til"}),!l&&o.jsx("div",{className:"pkt-input-separator",children:"–"}),o.jsx("input",{ref:z,className:U,type:S,id:`${e}-to`,name:f?`${f}-to`:`${e}-to`,value:n[1]??"",min:N,max:x,readOnly:h||P&&!h,disabled:c,"aria-label":`${g} ${((Pe=D.generic)==null?void 0:Pe.to)??"Til"}`,"aria-invalid":v,onClick:te,onKeyDown:A,onFocus:oe,onBlur:be,onChange:le}),Ie()]})}):o.jsx("div",{className:"pkt-datepicker__inputs",children:o.jsxs("div",{className:"pkt-input__container",children:[o.jsx("input",{...De,ref:M,className:U,type:S,id:t,name:f??e,value:n[0]??"",min:N,max:x,placeholder:k,readOnly:h||P&&!h,disabled:c,required:m,"aria-describedby":$?`${e}-helptext`:void 0,"aria-invalid":v,"aria-errormessage":v?`${e}-error`:void 0,onClick:te,onKeyDown:Ue,onFocus:oe,onBlur:void 0,onChange:ee}),Ie()]})})},lm={calendar:{buttonAltText:"Åpne kalender"}},cm={calendar:{buttonAltText:"Åpne kalender"},generic:{from:"Fra",to:"Til"}},wl=s=>{if(!s)return[];if(Array.isArray(s))return s.filter(Boolean);if(typeof s=="string"&&s.trimStart().startsWith("["))try{const e=JSON.parse(s);if(Array.isArray(e))return e.filter(Boolean)}catch{}return String(s).split(",").map(e=>e.trim()).filter(Boolean)};function um(s,e){const{id:t,label:n,value:i,defaultValue:r,dateformat:a="dd.MM.yyyy",multiple:l=!1,maxlength:c,range:h=!1,showRangeLabels:m=!1,weeknumbers:g=!1,withcontrols:f=!1,excludedates:k,excludeweekdays:v,currentmonth:$,today:N,calendarOpen:x,timezone:S,fullwidth:P=!1,hasFieldset:D=!1,inline:U=!1,helptext:V,helptextDropdown:Y,helptextDropdownButton:ue,hasError:j=!1,errorMessage:M,optionalTag:z=!1,optionalText:L,requiredTag:Q=!1,requiredText:oe,tagText:ee,useWrapper:de=!0,strings:le,disabled:be=!1,readOnly:ne=!1,required:ae=!1,name:Ue,min:Z,max:A,placeholder:Me,onChange:De,onValueChange:te,className:Ie,...Ee}=s,ye=d.useCallback(B=>B===void 0?[]:wl(B),[]),Te=i!==void 0,Pe=typeof r=="number"?void 0:r,[je,Ae]=d.useState(()=>ye(i??Pe)),ve=Te?ye(i):je,E=d.useRef(je);d.useEffect(()=>{Te&&Ae(ye(i))},[i,Te,ye]);const[Le,Ye]=d.useState(x??!1);d.useEffect(()=>{x!==void 0&&Ye(x)},[x]);const q=d.useRef(null),H=d.useRef(null),se=d.useRef(null),me=d.useRef(null),ge=d.useRef(null),Xe=d.useMemo(()=>Jg(),[]),Ke=d.useMemo(()=>_l(),[]),b=d.useMemo(()=>le??(h?cm:lm),[le,h]),p=typeof Z=="string"?Z:Z!==void 0?String(Z):void 0,_=typeof A=="string"?A:A!==void 0?String(A):void 0,T=d.useMemo(()=>{const B=em(P,m,l,h,ne,Xe);return Object.entries(B).filter(([,F])=>F).map(([F])=>F).join(" ")},[P,m,l,h,ne,Xe]),K=d.useMemo(()=>{const B=tm();return Object.entries(B).filter(([,F])=>F).map(([F])=>F).join(" ")},[]),G=d.useMemo(()=>{const B=sm(m);return Object.entries(B).filter(([,F])=>F).map(([F])=>F).join(" ")},[m]),ce=d.useMemo(()=>["pkt-datepicker__inputs",h&&"pkt-input__range-inputs"].filter(Boolean).join(" "),[h,m]),nt=d.useMemo(()=>{if($)return $;if(_)return _.slice(0,7)},[$,_]),Ze=be||l&&c!=null&&ve.length>=c,Be=l&&c!=null,Gt=`${t}-input`,Xt=ve.join(",");d.useEffect(()=>{se.current&&(se.current.value=Xt)},[Xt]),d.useEffect(()=>{S&&typeof window<"u"&&S!==window.pktTz&&(window.pktTz=S)},[S]);const _t=d.useCallback((B,F=!0)=>{Te||Ae(B),F&&(te==null||te(B))},[Te,te]),ci=d.useMemo(()=>{var B;return(B=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value"))==null?void 0:B.set},[]),ht=d.useCallback(B=>{const F=se.current;!F||!ci||(ci.call(F,B.join(",")),F.dispatchEvent(new Event("input",{bubbles:!0})))},[ci]),Ut=d.useCallback(()=>{be||Ye(B=>!B)},[be]),Qt=d.useCallback(()=>{Ye(!1)},[]);d.useEffect(()=>{if(!Le)return;const B=Ge=>{var wn;const Re=Ge.target;ge.current&&!ge.current.contains(Re)&&!((wn=Re.closest)!=null&&wn.call(Re,".pkt-calendar-popup"))&&Qt()},F=Ge=>{var Re;Ge.key==="Escape"&&(Qt(),(Re=q.current)==null||Re.focus())};return document.addEventListener("click",B,!0),document.addEventListener("keydown",F),()=>{document.removeEventListener("click",B,!0),document.removeEventListener("keydown",F)}},[Le,Qt]);const as=d.useCallback(()=>{Ke&&!Le&&Ye(!0)},[Ke,Le]),Ds=d.useCallback(B=>{var Re;const F=nm(B,l,h),Ge=wl(F);_t(Ge),ht(Ge),!l&&!h&&(Qt(),(Re=q.current)==null||Re.focus())},[l,h,_t,ht,Qt]),Je=d.useCallback(()=>{var B;Qt(),(B=q.current)==null||B.focus()},[Qt]),ui=d.useCallback(B=>{const F=B.target.value,Ge=F?[F]:[];_t(Ge),ht(Ge)},[_t,ht]),Qs=d.useCallback(B=>{const F=B.target.value,Ge=ve[1]??"",Re=[F,Ge].filter(Boolean);_t(Re),ht(Re)},[ve,_t,ht]),di=d.useCallback(B=>{const F=ve[0]??"",Ge=B.target.value,Re=[F,Ge].filter(Boolean);_t(Re),ht(Re)},[ve,_t,ht]),jt=d.useCallback(()=>{ve.length===2&&!Rg(ve)&&(_t([ve[0]]),ht([ve[0]]))},[ve,_t,ht]),Tt=d.useCallback(B=>{const F=ps(B),Ge=p?ps(p):null,Re=_?ps(_):null;if(F&&!isNaN(F.getTime())&&(!Ge||F>=Ge)&&(!Re||F<=Re)){const wn=vg([...ve,B],p,_,k,v),Ji=[...new Set(wn)];_t(Ji),ht(Ji)}},[ve,p,_,k,v,_t,ht]),_n=d.useCallback(B=>{const F=B.target;F.value&&(Tt(F.value.split(",")[0]),F.value="")},[Tt]),Zi=d.useCallback(B=>{const F=B.target;F.value&&(Tt(F.value.split(",")[0]),F.value="")},[Tt]),ea=d.useCallback(B=>{const F=ve.filter(Ge=>Ge!==B);_t(F),ht(F)},[ve,_t,ht]),os=d.useCallback(B=>{const F=B==null?void 0:B.closest("form");F?F.requestSubmit():B==null||B.blur()},[]),ta=d.useCallback(B=>{zi(B.nativeEvent,()=>Ut(),()=>os(q.current),void 0,()=>{var F;return(F=q.current)==null?void 0:F.blur()})},[Ut,os]),sa=d.useCallback(B=>{zi(B.nativeEvent,()=>Ut(),()=>os(q.current),()=>{var F;return(F=H.current)==null?void 0:F.focus()},()=>{var F;return(F=q.current)==null?void 0:F.blur()})},[Ut,os]),na=d.useCallback(B=>{zi(B.nativeEvent,()=>Ut(),()=>os(H.current),void 0,()=>{var F;return(F=H.current)==null?void 0:F.blur()})},[Ut,os]),ia=d.useCallback(B=>{zi(B.nativeEvent,()=>Ut(),()=>os(q.current),void 0,()=>{var F;return(F=q.current)==null?void 0:F.blur()},Zi)},[Ut,os,Zi]);return d.useEffect(()=>{var Ge;const B=(Ge=ge.current)==null?void 0:Ge.closest("form");if(!B)return;const F=()=>{window.setTimeout(()=>{Ae(E.current),Ye(!1),se.current&&(se.current.value=E.current.join(","))},0)};return B.addEventListener("reset",F),()=>B.removeEventListener("reset",F)},[]),d.useImperativeHandle(e,()=>({get value(){var B;return((B=se.current)==null?void 0:B.value)??""},set value(B){const F=B?B.split(",").filter(Boolean):[];Ae(F),se.current&&(se.current.value=B??"")},focus(){var B;(B=q.current)==null||B.focus()},blur(){var B;(B=q.current)==null||B.blur()}}),[]),{id:t,inputId:Gt,label:n,values:ve,calendarOpen:Le,dateformat:a,multiple:l,maxlength:c,range:h,showRangeLabels:m,weeknumbers:g,withcontrols:f,excludedates:k,excludeweekdays:v,disabled:be,readOnly:ne,required:ae,name:Ue,placeholder:Me,fullwidth:P,hasFieldset:D,inline:U,helptext:V,helptextDropdown:Y,helptextDropdownButton:ue,hasError:j,errorMessage:M,optionalTag:z,optionalText:L,requiredTag:Q,requiredText:oe,tagText:ee,useWrapper:de,className:Ie,minStr:p,maxStr:_,effectiveCurrentMonth:nt,today:N,inputType:Xe,isIOSDevice:Ke,strings:b,inputClasses:T,buttonClasses:K,rangeLabelClasses:G,datepickerInputsClasses:ce,isInputDisabled:Ze,hasCounter:Be,inputRef:q,inputRefTo:H,changeInputRef:se,btnRef:me,wrapperRef:ge,onChange:De,toggleCalendar:Ut,hideCalendar:Qt,handleDateSelected:Ds,handleCalendarClose:Je,handleFocus:as,handleSingleInputChange:ui,handleRangeFromChange:Qs,handleRangeToChange:di,handleRangeBlur:jt,handleMultipleBlur:_n,handleTagRemoved:ea,handleSingleKeydown:ta,handleRangeFromKeydown:sa,handleRangeToKeydown:na,handleMultipleKeydown:ia,restProps:Ee}}const $l=d.forwardRef((s,e)=>{const t=um(s,e),n=["pkt-datepicker",t.className].filter(Boolean).join(" ");return o.jsxs("div",{className:n,children:[o.jsx(Ms,{ref:t.wrapperRef,forId:t.inputId,label:t.label,hasFieldset:t.hasFieldset,inline:t.inline,helptext:t.helptext,helptextDropdown:t.helptextDropdown,helptextDropdownButton:t.helptextDropdownButton,hasError:t.hasError,errorMessage:t.errorMessage,disabled:t.disabled,optionalTag:t.optionalTag,optionalText:t.optionalText,requiredTag:t.requiredTag,requiredText:t.requiredText,tagText:t.tagText,useWrapper:t.useWrapper,counter:t.hasCounter,counterCurrent:t.values.length,counterMaxLength:t.maxlength,children:o.jsx(om,{state:t})}),o.jsx(rm,{open:t.calendarOpen,multiple:t.multiple,range:t.range,weeknumbers:t.weeknumbers,withcontrols:t.withcontrols,selected:t.values,earliest:t.minStr,latest:t.maxStr,excludedates:t.excludedates,excludeweekdays:t.excludeweekdays,maxMultiple:t.maxlength,currentmonth:t.effectiveCurrentMonth,today:t.today,inputRef:t.inputRef,hasCounter:t.hasCounter,onDateSelected:t.handleDateSelected,onClose:t.handleCalendarClose}),o.jsx("input",{ref:t.changeInputRef,type:"text",name:t.name,onChange:t.onChange,tabIndex:-1,"aria-hidden":"true",className:"pkt-visually-hidden"})]})});$l.displayName="PktDatepicker";const dm={dropFilesHere:"Slipp filene her ...",selectOrDragFiles:"Dra filer hit for å laste dem opp eller ",chooseFiles:"velg filer"},hm={dropFilesHere:"Slipp filen her ...",selectOrDragFiles:"Dra en fil for å laste den opp eller ",chooseFiles:"velg en fil"},pm={dropFilesHere:"Slipp bildene her ...",selectOrDragFiles:"Dra bilder hit for å laste dem opp eller ",chooseFiles:"velg fra kamerarull"},fm={dropFilesHere:"Slipp bildet her ...",selectOrDragFiles:"Dra et bilde for å laste det opp eller ",chooseFiles:"velg fra kamerarull"},xl=()=>("00000000000000000"+(Math.random()*18446744073709552e3).toString(16)).slice(-16),gm=()=>{const s=xl(),e=xl();return s.slice(0,8)+"-"+s.slice(8,12)+"-4"+s.slice(13)+"-a"+e.slice(1,4)+"-"+e.slice(4)};class Cl{constructor(e,t){tr(this,"fileId");tr(this,"file");tr(this,"attributes",{});this.fileId=t||gm(),this.file=e,this.attributes={targetFilename:e.name}}}const zr=d.createContext({}),mm=".PDF, .JPEG, .JPG, .PNG, .HEIC, .DOC, .DOCX, .ODT",bm=d.forwardRef(({id:s,multiple:e,value:t,onFilesAdded:n=()=>{},name:i,uploadStrategy:r,accept:a,isThumbnailView:l=!1,disabled:c=!1,srAnnouncementIds:h,...m},g)=>{const f=d.useRef(null),k=typeof a=="string"&&a.trim().length>0?a:void 0,v=d.useMemo(()=>k?k.split(/\s*,\s*/).map(M=>M.trim()).filter(Boolean).join(", ").toUpperCase():mm,[k]);d.useImperativeHandle(g,()=>f.current);const[$,N]=d.useState(!1),x=d.useMemo(()=>l?e?pm:fm:e?dm:hm,[e,l]),S=d.useCallback(M=>{if(f.current)try{f.current.files=vm(M)}catch{}},[f.current,t]);d.useEffect(()=>{S(t)},[f,t]);const P=d.useCallback(M=>{const z=M.map(L=>new Cl(L));n(z),f.current&&(f.current.value="")},[n]),D=M=>{const z=M.target.files;if(z.length===0){e&&S(t);return}P(Array.from(z))},U=M=>{P(M)},V=M=>{if(M.preventDefault(),N(!1),c)return;const z=M.dataTransfer.files,L=Array.from(z);U(L)},Y=M=>{M.preventDefault(),!c&&N(!0)},ue=()=>{N(!1)},j=d.useCallback(M=>{var L;c||M.target.closest(".pkt-fileupload__drop-zone__placeholder__title__open-file-dialog")||(L=f.current)==null||L.click()},[c]);return o.jsxs("div",{onDrop:V,onDragOver:Y,onDragLeave:ue,onClick:j,className:re("pkt-fileupload__drop-zone",{"pkt-fileupload__drop-zone--drag-active":$,"pkt-fileupload__drop-zone--disabled":c}),children:[o.jsx("input",{...m,id:s,type:"file",ref:f,multiple:e,onChange:D,accept:k,disabled:c,name:r==="form"&&i||void 0,"aria-label":e?"Velg filer":"Velg fil"}),r==="custom"&&o.jsx(o.Fragment,{children:t==null?void 0:t.map(M=>o.jsx("input",{type:"hidden",name:i,value:M.fileId},M.fileId))}),o.jsxs("div",{className:"pkt-fileupload__drop-zone__placeholder",children:[o.jsx(R,{name:"attachment",className:"pkt-fileupload__drop-zone__placeholder__icon","aria-hidden":"true"}),o.jsx("p",{className:"pkt-fileupload__drop-zone__placeholder__title",children:$?`${x.dropFilesHere} ...`:o.jsxs(o.Fragment,{children:[x.selectOrDragFiles," ",o.jsx("button",{className:"pkt-fileupload__drop-zone__placeholder__title__open-file-dialog",onClick:M=>{var z;M.preventDefault(),M.stopPropagation(),(z=f.current)==null||z.click()},type:"button",children:x.chooseFiles})]})}),o.jsxs("p",{className:"pkt-fileupload__drop-zone__placeholder__formats",children:["Format: ",v]})]})]})}),vm=s=>{const e=new DataTransfer;for(const t of s)e.items.add(t.file);return e.files},Yr=d.forwardRef(({id:s,ariaDescribedby:e,ariaLabelledby:t,counter:n,counterMaxLength:i,className:r,disabled:a,errorMessage:l,hasError:c,helptext:h,helptextDropdown:m,helptextDropdownButton:g,inline:f,fullwidth:k=!1,label:v,name:$,optionalTag:N=!1,optionalText:x,requiredTag:S=!1,requiredText:P,tagText:D=null,placeholder:U,rows:V,useWrapper:Y=!0,onChange:ue,value:j,autoComplete:M="off",minLength:z,maxLength:L,readOnly:Q,skipForwardTestid:oe=!1,...ee},de)=>{const le=[r,"pkt-textinput","pkt-textarea"].join(" "),be=`${s}-input`,ne=`${be}-label`,ae=t||ne,[Ue,Z]=d.useState(0),A=Me=>{var De,te;n&&Z(((te=(De=Me.currentTarget)==null?void 0:De.value)==null?void 0:te.length)||0),ue&&ue(Me)};return d.useEffect(()=>{j!==void 0&&Z((j==null?void 0:j.length)||0)},[j]),o.jsx(Ms,{ariaDescribedby:e,className:le,disabled:a,errorMessage:l,forId:be,hasError:c,helptext:h,helptextDropdown:m,helptextDropdownButton:g,inline:f,label:v,optionalTag:N,optionalText:x,requiredTag:S,requiredText:P,tagText:D,useWrapper:Y,counter:n,counterCurrent:Ue,counterMaxLength:i,children:o.jsx("textarea",{ref:de,className:`pkt-input ${k?"pkt-input--fullwidth":""} ${i&&Ue>i?"pkt-input--counter-error":""}`,name:`${$||s}`,id:be,placeholder:U,disabled:a,rows:V,"aria-labelledby":ae,"aria-invalid":c,"aria-errormessage":`${s}-error`,...ee,onChange:A,value:j,autoComplete:M,minLength:z,maxLength:L,readOnly:Q,"data-skip-forward-testid":oe?"true":void 0})})});Yr.displayName="PktTextarea";const km=Symbol("comment"),ym=s=>{const e=String(s.getDate()).padStart(2,"0"),t=String(s.getMonth()+1).padStart(2,"0"),n=s.getFullYear(),i=String(s.getHours()).padStart(2,"0"),r=String(s.getMinutes()).padStart(2,"0");return`${e}.${t}.${n} kl. ${i}:${r}`},_m=({fileItem:s,closeOperationUi:e,onAddComment:t,existingComment:n})=>{const i=d.useRef(null),r=!!n,a=()=>{var c,h;const l=(h=(c=i.current)==null?void 0:c.value)==null?void 0:h.trim();l&&t({text:l,timestamp:new Date}),e()};return d.useLayoutEffect(()=>{const l=setTimeout(()=>{var c;return(c=i.current)==null?void 0:c.focus({preventScroll:!0})},0);return()=>clearTimeout(l)},[s.fileId]),o.jsxs(o.Fragment,{children:[o.jsx(Yr,{autoFocus:!0,label:r?"Rediger kommentar":"Legg til kommentar",name:`comment-${s.fileId}`,className:"pkt-fileupload__queue-display__item__comment-input",placeholder:"Skriv inn kommentar",rows:2,id:`comment-${s.fileId}`,ref:i,defaultValue:n==null?void 0:n.text}),o.jsx(dt,{skin:"secondary",size:"small",onClick:a,children:r?"Lagre kommentar":"Legg til kommentar"}),o.jsx(dt,{skin:"tertiary",size:"small",onClick:e,children:"Avbryt"})]})},wm=({comments:s,onDeleteComment:e,onEditComment:t})=>s&&s.length>0?o.jsx("div",{className:"pkt-fileupload__queue-display__item__comments",children:s.map((n,i)=>o.jsxs("div",{className:"pkt-fileupload__queue-display__item__comment",children:[o.jsxs("div",{className:"pkt-fileupload__queue-display__item__comment__content",children:[o.jsx("span",{className:"pkt-fileupload__queue-display__item__comment__text","aria-label":"Kommentar tekst",children:n.text}),o.jsx("time",{className:"pkt-fileupload__queue-display__item__comment__time",children:ym(n.timestamp)})]}),o.jsxs("div",{className:"pkt-fileupload__queue-display__item__comment__actions",children:[e&&o.jsx("button",{type:"button",className:"pkt-fileupload__queue-display__item__comment__action",onClick:()=>e(i),"aria-label":"Slett kommentar",children:o.jsx(R,{name:"trash-can"})}),t&&o.jsx("button",{type:"button",className:"pkt-fileupload__queue-display__item__comment__action",onClick:()=>t(i),"aria-label":"Rediger kommentar",children:o.jsx(R,{name:"edit"})})]})]},i))}):null,$m=s=>{const e=d.useContext(zr);return o.jsx("input",{type:"hidden",name:`${e.name}-comments`,value:s.comments?JSON.stringify(s.comments):""})},xm=s=>{const e=s("comments"),t=(i,r)=>{e.set(i,[r])},n=(i,r)=>{const l=(e.get(i)||[]).filter((c,h)=>h!==r);e.set(i,l.length>0?l:void 0)};return{title:i=>{const r=e.get(i.fileId);return r&&r.length>0?"":"Legg til kommentar"},renderExtendedUI:(i,r)=>{const a=e.get(i.fileId),l=a==null?void 0:a[0];return o.jsx(_m,{fileItem:i,closeOperationUi:r,onAddComment:c=>t(i.fileId,c),existingComment:l})},renderContent:(i,r,a)=>{if(a)return null;const l=e.get(i.fileId);return o.jsx(wm,{comments:l,onDeleteComment:c=>n(i.fileId,c),onEditComment:r?()=>r():void 0})},renderHidden:i=>o.jsx($m,{comments:e.get(i.fileId)},`comments${i.fileId}`),symbol:km}},Cm=Symbol("deleteFile"),Sm=s=>({title:"Slett",ariaLabel:"Slett fil",onClick:e=>s(e.fileId),symbol:Cm}),Tm=Symbol("renameFile"),Nm=s=>{const e=d.useRef(null),t=d.useId(),n=()=>{var i;s.onSave(((i=e.current)==null?void 0:i.value)??"")};return o.jsxs(o.Fragment,{children:[o.jsx("label",{htmlFor:t,className:"pkt-sr-only",children:"Endre filnavn"}),o.jsx("input",{id:t,ref:e,type:"text",autoFocus:!0,defaultValue:s.value,className:"pkt-fileupload__queue-display__item__rename-input",onKeyDown:i=>{i.key==="Enter"&&(i.preventDefault(),i.stopPropagation(),n()),i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),s.onCancel())}}),o.jsx(dt,{skin:"secondary",size:"small",onClick:()=>s.onSave(e.current.value),children:"Lagre"}),o.jsx(dt,{skin:"tertiary",size:"small",onClick:s.onCancel,children:"Avbryt"})]})},Mm=s=>{const e=d.useContext(zr);return o.jsx("input",{type:"hidden",name:`${e.name}-targetFilename`,value:s.targetFilename})},Dm=s=>{const e=s("targetFilename");return{title:"Rediger",ariaLabel:"Rediger filnavn",renderInlineUI:(t,n)=>o.jsx(Nm,{value:e.get(t.fileId)||void 0,onSave:i=>{e.set(t.fileId,i),n()},onCancel:n}),renderHidden:t=>o.jsx(Mm,{targetFilename:e.get(t.fileId)||t.file.name},`rename${t.fileId}`),symbol:Tm}},Om=(s,e)=>{const t=d.useCallback((r,a,l)=>{const c=s.find(m=>m.fileId===r),h=c.attributes||{};c.attributes={...h,[a]:l},e(r,{attributes:c.attributes})},[e,s]),n=d.useCallback((r,a)=>(s.find(h=>h.fileId===r).attributes||{})[a],[s]);return{fileAttributes:d.useCallback(r=>({get:a=>n(a,r),set:(a,l)=>{t(a,r,l)}}),[n,t])}},Em=s=>{const[e,t]=d.useState(!1),[n,i]=d.useState(0),r=d.useRef(null),a=d.useCallback(h=>{var g;const m=s.findIndex(f=>f.fileId===h);m>=0&&(i(m),t(!0),(g=r.current)==null||g.showModal())},[s]),l=d.useCallback(()=>{var h;t(!1),(h=r.current)==null||h.close()},[]),c=d.useCallback(h=>{s.length!==0&&i(m=>h==="prev"?m<=0?s.length-1:m-1:m>=s.length-1?0:m+1)},[s.length]);return{isOpen:e,currentIndex:n,modalRef:r,open:a,close:l,navigate:c}},Pm=s=>{const[e,t]=d.useState({}),n=d.useCallback(a=>{const l=e[a];if(l)return s.find(c=>c.symbol===l)},[e,s]),i=d.useCallback((a,l)=>{t(c=>({...c,[a]:l.symbol}))},[]),r=d.useCallback(a=>{t(l=>{const c={...l};return delete c[a],c})},[]);return{getActivated:n,activate:i,close:r}},Kr=d.forwardRef(({children:s,className:e,open:t=!1,headingText:n="",hideCloseButton:i=!1,closeOnBackdropClick:r=!1,size:a="medium",removePadding:l=!1,closeButtonSkin:c="blue",variant:h="dialog",drawerPosition:m="right",transparentBackdrop:g=!1,onClose:f,...k},v)=>{const $=d.useRef(null),N=v||$,x=d.useCallback(()=>{var V,Y;(V=N.current)!=null&&V.open&&((Y=N.current)==null||Y.close(),f==null||f())},[N,f]);d.useEffect(()=>{const V=N.current;if(!V)return;const Y=new MutationObserver(()=>{V.open?document.body.classList.add("pkt-modal--open"):document.body.classList.remove("pkt-modal--open")});return Y.observe(V,{attributes:!0,attributeFilter:["open"]}),()=>Y.disconnect()},[N]),d.useEffect(()=>{var V,Y,ue,j;t?(V=N.current)!=null&&V.open||(Y=N.current)==null||Y.showModal():(ue=N.current)!=null&&ue.open&&((j=N.current)==null||j.close())},[t,N]);const S=d.useCallback(V=>{r&&V.target===N.current&&x()},[r,N,x]),P=d.useCallback(()=>{f==null||f()},[f]),D=c==="blue",U=re({"pkt-modal":!0,"pkt-modal--removePadding":l,"pkt-modal--noHeadingText":!n,"pkt-modal--noShadow":c==="yellow-filled","pkt-modal--transparentBackdrop":g,[`pkt-modal--${a}`]:a,[`pkt-modal__${h}`]:h,[`pkt-modal__drawer--${m}`]:h==="drawer"},e);return o.jsx("dialog",{...k,className:U,ref:N,"aria-labelledby":n?"pkt-modal__headingText":void 0,"aria-describedby":"pkt-modal__content",onClick:S,onClose:P,children:o.jsxs("div",{className:"pkt-modal__wrapper",children:[(n||!i)&&o.jsxs("div",{className:"pkt-modal__header",children:[o.jsx("div",{className:"pkt-modal__header-background"}),n?o.jsx("h1",{id:"pkt-modal__headingText",className:"pkt-modal__headingText pkt-txt-24",children:n}):o.jsx("div",{className:"pkt-modal__headingText"}),i?o.jsx("div",{className:"pkt-modal__noCloseButton"}):o.jsx("div",{className:re("pkt-modal__closeButton",{[`pkt-modal__closeButton--${c}`]:!0}),children:o.jsx(dt,{onClick:x,"aria-label":"close",iconName:"close",variant:"icon-only",size:"medium",skin:D?"tertiary":"primary",children:"Lukk"})})]}),o.jsx("div",{className:"pkt-modal__container",children:o.jsx("div",{id:"pkt-modal__content",className:"pkt-modal__content pkt-txt-18-light",children:s})})]})})});Kr.displayName="PktModal";const Sl=2,Am=s=>{const e=window.getComputedStyle(s),t=parseFloat(e.lineHeight);if(!Number.isNaN(t)&&t>0)return t;const n=parseFloat(e.fontSize);return(!Number.isNaN(n)&&n>0?n:16)*1.2},Im=(s,e,t)=>{const n=e*t;return s.getBoundingClientRect().height>n+.5},Tl=d.createContext({tail:5}),oi=({children:s,tail:e,...t})=>{const n=s,i=d.useContext(Tl),r=e!==void 0?e:i.tail||0,a=s.length<=r+3?null:s.slice(-r),l=d.useRef(null),c=d.useRef(null),[h,m]=d.useState(!1),g=d.useCallback(()=>{const k=l.current,v=c.current;if(!k||!v)return;const $=Am(k);m(Im(v,$,Sl))},[]),f=d.useMemo(()=>new ResizeObserver(k=>{k.some(v=>v.target===l.current)&&g()}),[g]);return d.useLayoutEffect(()=>(l.current&&f.observe(l.current),g(),()=>f.disconnect()),[s,f,g]),o.jsxs("span",{ref:l,...t,"data-pkt-truncate-part":"wrapper",style:{maxWidth:"100%",width:"100%",display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto",alignItems:"end",columnGap:"0.25rem",overflow:"hidden",position:"relative",...t.style},children:[o.jsx("span",{"data-pkt-truncate-part":"first",style:{minWidth:0,display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:Sl,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"normal",overflowWrap:"anywhere"},children:n}),r!==0&&o.jsx("span",{"data-pkt-truncate-part":"tail",style:{whiteSpace:"nowrap",display:h?"inline":"none",paddingRight:"0.5rem"},"aria-hidden":!0,children:a}),o.jsx("span",{ref:c,"aria-hidden":!0,"data-pkt-truncate-part":"measure",style:{position:"absolute",top:0,left:0,width:"100%",visibility:"hidden",pointerEvents:"none",whiteSpace:"normal",overflowWrap:"anywhere"},children:s})]})},Lm=s=>{if(typeof s=="number")return s;const e=s.trim().match(/^(\d+(?:\.\d+)?)\s*(B|KB|MB|GB)$/i);if(!e)return console.warn(`PktFileUpload: Invalid maxFileSize format "${s}". Use format like "5MB", "500KB", or a number in bytes.`),0;const t=parseFloat(e[1]);switch(e[2].toUpperCase()){case"B":return t;case"KB":return t*1024;case"MB":return t*1024*1024;case"GB":return t*1024*1024*1024;default:return t}},Yi=s=>s<1024?`${s} B`:s<1024*1024?`${Math.round(s/1024)} KB`:s<1024*1024*1024?`${Math.round(s/(1024*1024))} MB`:`${Math.round(s/(1024*1024*1024))} GB`,Gr=s=>o.jsx("button",{onClick:s.onClick,className:"pkt-fileupload__queue-display__item__cancel-button","aria-label":s.ariaLabel||"Avbryt opplasting",children:s.label||"Avbryt"}),Bm=()=>{const[s,e]=d.useState(1);return d.useEffect(()=>{const t=setInterval(()=>{e(n=>n>=3?1:n+1)},400);return()=>clearInterval(t)},[]),o.jsxs("span",{className:"pkt-fileupload__queue-display__item__loading-text","aria-label":"Laster opp fil",children:["Laster opp",".".repeat(s)]})},Fm=({cancelTransfer:s,transferItem:e})=>{const t=e.showProgress??e.progress!==0;return o.jsxs(o.Fragment,{children:[o.jsx(R,{name:"document-text",className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium","aria-hidden":"true"}),o.jsx("p",{className:"pkt-fileupload__queue-display__item__title","aria-label":"Filnavn",children:o.jsx(oi,{children:e.attributes.targetFilename})}),o.jsx(Gr,{onClick:s}),t?o.jsxs(o.Fragment,{children:[o.jsx(Qi,{valueCurrent:e.progress*100,statusType:"none",valueMax:100,statusPlacement:"following",className:"pkt-fileupload__queue-display__item__progress"}),o.jsx("span",{className:"pkt-fileupload__queue-display__item__filesize",children:Yi(e.file.size)}),o.jsx("span",{className:"pkt-fileupload__queue-display__item__percentage","aria-hidden":"true",children:`${Math.round(e.progress*100)}%`})]}):o.jsx(Bm,{})]})},Vm=({transferItem:s,onRemove:e})=>{const t=(s.lastProgress??1)*100;return o.jsxs(o.Fragment,{children:[o.jsx(R,{className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium",name:"alert-error","aria-hidden":"true"}),o.jsx("p",{className:"pkt-fileupload__queue-display__item__title",children:o.jsx(oi,{children:s.attributes.targetFilename})}),o.jsx(Gr,{onClick:e,label:"Fjern",ariaLabel:"Fjern fil som feilet under opplasting"}),o.jsx(Qi,{valueCurrent:t,statusType:"none",valueMax:100,statusPlacement:"following",className:"pkt-fileupload__queue-display__item__progress pkt-fileupload__queue-display__item__progress--error"}),o.jsx("span",{className:"pkt-fileupload__queue-display__item__filesize",children:Yi(s.file.size)}),s.errorMessage&&o.jsx("span",{className:"pkt-fileupload__queue-display__item__error-message",children:s.errorMessage})]})},Hm=({transferItem:s,onRemove:e})=>o.jsxs(o.Fragment,{children:[o.jsx(R,{className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium",name:"alert-error","aria-hidden":"true"}),o.jsx("p",{className:"pkt-fileupload__queue-display__item__title",children:o.jsx(oi,{children:s.attributes.targetFilename})}),o.jsx(Gr,{onClick:e,label:"Fjern",ariaLabel:"Fjern fil som feilet under opplasting"}),s.errorMessage&&o.jsx("span",{className:"pkt-fileupload__queue-display__item__error-message",children:s.errorMessage})]}),Um=({transferItem:s,onRemove:e})=>s.showProgress?o.jsx(Vm,{transferItem:s,onRemove:e}):o.jsx(Hm,{transferItem:s,onRemove:e}),jm=({operation:s,onActivate:e,transferItem:t})=>{const n=typeof s.title=="function"?s.title(t):s.title;if(!n)return null;const i=()=>{(s.renderInlineUI||s.renderExtendedUI)&&e(t.fileId,s),s.onClick&&s.onClick(t)};return o.jsx("button",{type:"button",className:"pkt-fileupload__queue-display__item__operation",onClick:i,"aria-label":typeof s.ariaLabel=="function"?s.ariaLabel(t):s.ariaLabel,children:n})},Nl=({transferItem:s})=>o.jsxs(o.Fragment,{children:[o.jsx(R,{name:"document-text",className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium","aria-hidden":"true"}),o.jsx("p",{className:"pkt-fileupload__queue-display__item__title",children:o.jsx(oi,{children:s.attributes.targetFilename})}),o.jsx("span",{className:"pkt-fileupload__queue-display__item__filesize",children:Yi(s.file.size)})]}),qm=({transferItem:s,onPreviewClick:e})=>{const[t,n]=d.useState(null),[i,r]=d.useState(!1),a=s.file;d.useEffect(()=>{if(r(!1),a.type.startsWith("image/")){const m=URL.createObjectURL(a);return n(m),()=>{URL.revokeObjectURL(m)}}n(null)},[a]);const l=t&&!i&&o.jsx("img",{src:t,alt:s.attributes.targetFilename,onError:()=>r(!0)})||o.jsx(R,{name:"document-text",className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium"}),c=!!e,h=!!t&&!i;return o.jsxs("div",{className:`pkt-fileupload__queue-display__item__thumbnail${h?"":" pkt-fileupload__queue-display__item__thumbnail--fallback"}`,children:[o.jsxs(dt,{className:"pkt-fileupload__queue-display__item__thumbnail__image-wrapper","aria-label":`Forhåndsvis bilde ${s.attributes.targetFilename}`,type:"button",skin:"secondary",onClick:e,children:[c&&o.jsx(R,{name:"expand",className:"pkt-fileupload__queue-display__item__thumbnail__expand-icon","aria-hidden":"true"}),l]}),o.jsx(oi,{className:"pkt-fileupload__queue-display__item__thumbnail__title",children:s.attributes.targetFilename})]})},Ml=d.forwardRef(({isOpen:s,images:e,currentIndex:t,onClose:n,onNavigate:i},r)=>{const[a,l]=d.useState(null),[c,h]=d.useState(!1),m=e[t],g=e.length>1;return d.useEffect(()=>{if(h(!1),m&&m.file.type.startsWith("image/")){const f=URL.createObjectURL(m.file);return l(f),()=>URL.revokeObjectURL(f)}l(null)},[m]),d.useEffect(()=>{if(!s)return;const f=k=>{switch(k.key){case"ArrowLeft":k.preventDefault(),i("prev");break;case"ArrowRight":k.preventDefault(),i("next");break;case"Escape":k.preventDefault(),n();break}};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[s,i,n]),m?o.jsx(Kr,{ref:r,headingText:m.attributes.targetFilename,closeOnBackdropClick:!0,className:"pkt-fileupload__image-preview-modal",children:o.jsxs("div",{className:"pkt-fileupload__image-preview",children:[g&&o.jsx(dt,{variant:"icon-only",iconName:"chevron-thin-left",skin:"secondary",size:"small",className:"pkt-fileupload__image-preview__nav pkt-fileupload__image-preview__nav--prev",onClick:()=>i("prev"),"aria-label":`Forrige bilde ${t} / ${e.length}`}),o.jsx("div",{className:"pkt-fileupload__image-preview__content",children:a&&!c?o.jsx("img",{src:a,alt:`${m.attributes.targetFilename} - ${t+1} av ${e.length}`,className:"pkt-fileupload__image-preview__image",onError:()=>h(!0)}):o.jsx(R,{name:"picture",className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium"})}),g&&o.jsxs("span",{className:"pkt-fileupload__image-preview__counter",children:[t+1," / ",e.length]}),g&&o.jsx(dt,{variant:"icon-only",iconName:"chevron-thin-right",skin:"secondary",size:"small",className:"pkt-fileupload__image-preview__nav pkt-fileupload__image-preview__nav--next",onClick:()=>i("next"),"aria-label":`Neste bilde ${t+2} / ${e.length}`})]})}):null});Ml.displayName="ImagePreviewModal";const Wm=s=>{var e;return(e=s.file.type)!=null&&e.startsWith("image/")?!0:/\.(jpe?g|png|gif|webp|heic|heif|bmp|svg)$/i.test(s.file.name||"")},Xr=s=>typeof s=="number"?"in-progress":s==="error"?"error":"idle",zm=({operations:s,activatedOperation:e,onActivate:t,transferItem:n})=>o.jsx("div",{className:"pkt-fileupload__queue-display__item__actions",children:s.filter(i=>!e||i.symbol!==e.symbol).map(i=>o.jsx(jm,{operation:i,onActivate:t,transferItem:n},i.symbol.toString()))}),Ym=({operations:s,activatedOperation:e,onActivate:t,transferItem:n})=>o.jsx(o.Fragment,{children:s.filter(i=>i.renderContent).map(i=>o.jsx("div",{className:"pkt-fileupload__queue-display__item__operation-content",children:i.renderContent(n,()=>t(n.fileId,i),(e==null?void 0:e.symbol)===i.symbol)},i.symbol.toString()))}),Km=({transferItem:s,activatedOperation:e,operations:t,ItemRenderer:n,onActivate:i,onClose:r,onPreviewClick:a})=>{const l=()=>r(s.fileId),h=(e==null?void 0:e.renderInlineUI)||(e==null?void 0:e.renderExtendedUI)?[]:t;return o.jsxs(o.Fragment,{children:[e!=null&&e.renderInlineUI?o.jsxs(o.Fragment,{children:[o.jsx(R,{name:"document-text",className:"pkt-fileupload__queue-display__item__icon"}),o.jsx("div",{className:"pkt-fileupload__queue-display__item__inline-ui",children:e.renderInlineUI(s,l)})]}):o.jsx(n,{transferItem:s,queueItemOperations:t,onPreviewClick:a}),h.length>0&&o.jsx(zm,{operations:h,activatedOperation:e,onActivate:i,transferItem:s}),o.jsx(Ym,{operations:t,activatedOperation:e,onActivate:i,transferItem:s}),(e==null?void 0:e.renderExtendedUI)&&o.jsx("div",{className:"pkt-fileupload__queue-display__item__expanded-operation-ui",children:e.renderExtendedUI(s,l)})]})},Gm=({transferItem:s,activatedOperation:e,operations:t,ItemRenderer:n,enableImagePreview:i,onActivate:r,onClose:a,onCancelTransfer:l,onOpenPreview:c})=>{const h=Xr(s.progress),m=i&&s.progress==="done"&&Wm(s);switch(h){case"in-progress":return o.jsx(Fm,{"aria-live":"off",transferItem:s,cancelTransfer:()=>l(s.fileId)});case"error":return o.jsx(Um,{transferItem:s,onRemove:()=>l(s.fileId)});case"idle":return o.jsx(Km,{transferItem:s,activatedOperation:e,operations:t,ItemRenderer:n,onActivate:r,onClose:a,onPreviewClick:m?()=>c(s.fileId):void 0})}},Xm=s=>{var e;return(e=s.file.type)!=null&&e.startsWith("image/")?!0:/\.(jpe?g|png|gif|webp|heic|heif|bmp|svg)$/i.test(s.file.name||"")},Qm=(s,e,t)=>d.useMemo(()=>{const n=s.map(r=>{const a=e.find(l=>l.fileId===r.fileId);return{...r,progress:(a==null?void 0:a.progress)??(t==="form"?"done":"queued"),errorMessage:a==null?void 0:a.errorMessage,showProgress:a==null?void 0:a.showProgress,lastProgress:a==null?void 0:a.lastProgress}}),i={"in-progress":0,error:1,idle:2};return n.sort((r,a)=>i[Xr(r.progress)]-i[Xr(a.progress)])},[s,e,t]),Zm=(s,e)=>d.useMemo(()=>e?s.filter(t=>t.progress==="done"&&Xm(t)):[],[s,e]),Jm=({files:s,cancelTransfer:e,transfers:t=[],queueItemOperations:n=[],ItemRenderer:i=Nl,truncateTail:r,enableImagePreview:a=!1,uploadStrategy:l="form"})=>{const c=Qm(s,t,l),h=Zm(c,a),m=Pm(n),g=Em(h);return o.jsxs(o.Fragment,{children:[o.jsx("ul",{className:"pkt-fileupload__queue-display",children:o.jsx(Tl.Provider,{value:{tail:r},children:c.map(f=>o.jsxs("li",{className:re("pkt-fileupload__queue-display__item",{"pkt-fileupload__queue-display__item--in-progress":typeof f.progress=="number",[`pkt-fileupload__queue-display__item--${f.progress}`]:typeof f.progress=="string"}),children:[n.filter(k=>k.renderHidden).map(k=>k.renderHidden(f)),o.jsx(Gm,{transferItem:f,activatedOperation:m.getActivated(f.fileId),operations:n,ItemRenderer:i,enableImagePreview:a,onActivate:m.activate,onClose:m.close,onCancelTransfer:e,onOpenPreview:g.open})]},f.fileId))})}),a&&h.length>0&&o.jsx(Ml,{ref:g.modalRef,isOpen:g.isOpen,images:h,currentIndex:g.currentIndex,onClose:g.close,onNavigate:g.navigate})]})},Qr={filename:Nl,thumbnail:qm},Dl=d.forwardRef(({value:s,defaultValue:e,id:t="fileupload-id",multiple:n=!1,uploadStrategy:i="form",addCommentsEnabled:r=!1,renameFilesEnabled:a=!1,truncateTail:l,onFilesChanged:c,onFileUploadRequested:h,extraOperations:m=[],itemRenderer:g=Qr.filename,fullWidth:f=!1,allowedFormats:k,formatErrorMessage:v,maxFileSize:$,sizeErrorMessage:N,onFileValidation:x,errorMessage:S,hasError:P=!1,disabled:D=!1,label:U,helptext:V,optionalTag:Y,requiredTag:ue,enableImagePreview:j=!1,...M},z)=>{const L="transfers"in M?M.transfers:void 0,[Q,oe]=d.useState(null),ee=P||!!Q,de=S||Q,le=$?Lm($):void 0,be=d.useCallback(H=>{var se;if(k&&k.length>0){const me=((se=H.name.split(".").pop())==null?void 0:se.toLowerCase())||"",ge=H.type.toLowerCase();if(!k.some(Ke=>{const b=Ke.toLowerCase().replace(/^\./,"");if(b.includes("/")){if(b.endsWith("/*")){const p=b.replace("/*","");return ge.startsWith(p+"/")}return ge===b}return me===b})){const Ke=k.join(", "),b=`Ugyldig filtype. Tillatte formater: ${Ke}`;return(v==null?void 0:v.replace("{formats}",Ke))||b}}if(le&&H.size>le){const me=Yi(le),ge=`Filen er for stor. Maks størrelse er ${me}.`;return(N==null?void 0:N.replace("{maxSize}",me))||ge}return x?x(H):null},[k,v,le,N,x]);s!==void 0&&e!==void 0&&console.warn("PktFileupload: Både value og defaultValue er angitt. Komponenten kan være enten 'controlled' eller 'uncontrolled', ikke begge deler. Bruk kun én av dem. Se https://react.dev/reference/react-dom/components/input#controlling-an-input-with-a-state-variable"),s!==void 0&&c===void 0&&console.warn("PktFileupload: value-prop er angitt uten onFilesChanged-callback. Når en komponent er 'controlled', må endringer håndteres via en callback. Vennligst legg til onFilesChanged-callback for å håndtere endringer i fil-listen. Se https://react.dev/reference/react-dom/components/input#controlling-an-input-with-a-state-variable");const ae=s!==void 0?s:e||[],Ue=typeof g=="string"?Qr[g]:g,Z=g==="thumbnail",A=typeof M.accept=="string"?M.accept.trim():void 0,Me=d.useMemo(()=>{if(!(!k||k.length===0))return k.map(H=>H.trim()).filter(Boolean).map(H=>{const se=H.toLowerCase();return se.includes("/")||se.startsWith(".")?se:`.${se}`}).join(", ")},[k]),De=A||Me,te=a&&!Z,Ie=r&&!Z,Ee=d.useCallback(H=>{for(const me of H){const ge=be(me.file);if(ge){oe(ge);return}}oe(null);const se=n?[...ae,...H]:[H[0]];c&&c(se),i==="custom"&&h&&H.forEach(me=>{h==null||h(me)})},[c,ae,n,i,h,be]),ye=d.useCallback((H,se)=>{const me=ae.map(ge=>ge.fileId===H?{...ge,...se}:ge);c&&c(me)},[c,ae]),Te=d.useCallback(H=>{var me;const se=ae.filter(ge=>ge.fileId!==H);c&&c(se),"onTransferCancelled"in M&&M.onTransferCancelled&&((me=M.onTransferCancelled)==null||me.call(M,H))},[c,ae,M]),{fileAttributes:Pe}=Om(ae,ye),je=d.useMemo(()=>[{op:Dm,enabled:te},{op:H=>xm(H),enabled:Ie}].filter(({enabled:H})=>H).map(({op:H})=>H).concat(...m),[te,Ie]),Ae=d.useMemo(()=>({uploaded:`${t}-uploaded`,errors:`${t}-errors`}),[t]),{totalCount:ve,uploadedCount:E,failedCount:Le}=d.useMemo(()=>{const H=ae.length;if(!L)return{totalCount:H,uploadedCount:0,failedCount:0};let se=0,me=0;for(const ge of ae){const Xe=L.find(Ke=>Ke.fileId===ge.fileId);(Xe==null?void 0:Xe.progress)==="done"&&se++,(Xe==null?void 0:Xe.progress)==="error"&&me++}return{totalCount:H,uploadedCount:se,failedCount:me}},[ae,L]),Ye=ve===1?"fil":"filer",q=o.jsx("div",{className:re("pkt-fileupload",{"pkt-fileupload--full-width":f,"pkt-fileupload--error":ee,"pkt-fileupload--disabled":D}),"aria-disabled":D,...D?{inert:""}:{},children:o.jsxs(zr.Provider,{value:{name:M.name||"",multiple:!!n,id:t},children:[o.jsx("div",{id:Ae.uploaded,className:"pkt-sr-only","aria-live":"polite","aria-atomic":"true",children:ve>0&&E>0&&`${E} av ${ve} ${Ye} lastet opp`}),o.jsx("div",{id:Ae.errors,className:"pkt-sr-only","aria-live":"assertive","aria-atomic":"true",children:ve>0&&Le>0&&`Feil ved opplasting: ${Le} av ${ve} ${Ye} feilet`}),o.jsx(bm,{id:t,name:M.name||"",value:ae,onFilesAdded:Ee,multiple:n,uploadStrategy:i,ref:z,accept:Z?".jpeg, .jpg, .png, .gif, .webp, .heic":De,isThumbnailView:Z,disabled:D,srAnnouncementIds:Ae}),ee&&de&&o.jsx(Bi,{skin:"error","aria-live":"assertive",role:"alert",compact:!0,children:de}),o.jsx(Jm,{files:ae,cancelTransfer:Te,truncateTail:l,transfers:L,uploadStrategy:i,ItemRenderer:Ue,enableImagePreview:Z&&j,queueItemOperations:je.map(H=>H(Pe)).concat(Sm(Te))})]})});return U?o.jsx(Ms,{forId:t,label:U,helptext:V,disabled:D,hasError:ee,optionalTag:Y,requiredTag:ue,className:re("pkt-fileupload-wrapper",{"pkt-fileupload-wrapper--full-width":f}),children:q}):q});Dl.displayName="PktFileUpload";const Rm=({columnOne:s,columnTwo:e,socialLinks:t,className:n,openLinksInNewTab:i=!1,personvernOgInfoLink:r="https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",tilgjengelighetLink:a="https://www.oslo.kommune.no/tilgjengelighet/",includeConsent:l=!1,hotjarId:c=null,googleAnalyticsId:h=null,devMode:m=!1,cookieDomain:g=null,cookieSecure:f=null,cookieExpiryDays:k=null,onToggleConsent:v=$=>{console.log($.detail)}})=>{var N,x;const $=[n,"pkt-footer"].filter(Boolean).join(" ");return o.jsx("footer",{className:$,"data-mode":"dark",children:o.jsxs("div",{className:"pkt-footer__container",children:[o.jsxs("div",{className:"pkt-grid pkt-grid--rowgap-size-32 pkt-grid--gap-size-16",children:[o.jsxs("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[o.jsx("h2",{className:"pkt-footer__title",children:s.title}),o.jsxs("ul",{className:"pkt-footer__list",children:[s.text&&o.jsx("li",{className:"pkt-footer__text",children:s.text}),(N=s.links)==null?void 0:N.map((S,P)=>o.jsx("li",{className:"pkt-footer__list-item",children:o.jsxs("a",{className:`pkt-footer__link ${S.external?"pkt-link--external":""}`,href:S.href,target:S.openInNewTab||i?"_blank":"_self",rel:S.openInNewTab||i?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer__link-icon",name:"chevron-right"}),S.text]})},`links-${P}`))]})]}),o.jsxs("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[o.jsx("h2",{className:"pkt-footer__title",children:e.title}),o.jsxs("ul",{className:"pkt-footer__list",children:[e.text&&o.jsx("li",{className:"pkt-footer__text",children:e.text}),(x=e.links)==null?void 0:x.map((S,P)=>o.jsx("li",{className:"pkt-footer__list-item",children:o.jsxs("a",{className:`pkt-footer__link ${S.external?"pkt-link--external":""}`,href:S.href,target:S.openInNewTab||i?"_blank":"_self",rel:S.openInNewTab||i?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer__link-icon",name:"chevron-right"}),S.text]})},`links-${P}`))]})]}),o.jsxs("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[o.jsx("h2",{className:"pkt-footer__title",children:"Om nettstedet"}),o.jsxs("ul",{className:"pkt-footer__list",children:[o.jsx("li",{className:"pkt-footer__list-item",children:o.jsxs("a",{className:"pkt-footer__link",href:r,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),o.jsx("li",{className:"pkt-footer__list-item",children:o.jsxs("a",{className:"pkt-footer__link",href:a,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})}),l&&o.jsx("li",{className:"pkt-footer__list-item",children:o.jsx(Wi,{triggerType:"footerlink",hotjarId:c,googleAnalyticsId:h,devMode:m,cookieDomain:g,cookieSecure:f,cookieExpiryDays:k,onToggleConsent:v})})]})]})]}),t&&o.jsxs("div",{className:"pkt-footer__social","aria-label":"standard lenker",children:[o.jsx("div",{className:"pkt-footer__social-languages",children:t.filter(S=>S.language).map((S,P)=>o.jsx("div",{className:"pkt-footer__social-language",children:o.jsx("a",{href:S.href,"aria-label":`til ${S.language} versjon av nettsiden`,target:S.openInNewTab||i?"_blank":"_self",rel:S.openInNewTab||i?"noopener noreferrer":void 0,children:S.language})},`sociallinks-language-${P}`))}),o.jsx("div",{className:"pkt-footer__social-icons",children:t.filter(S=>S.iconName).map((S,P)=>o.jsx(d.Fragment,{children:o.jsx("a",{href:S.href,"aria-label":`til ${S.iconName}`,className:"pkt-footer__social-icon-link",target:S.openInNewTab||i?"_blank":"_self",rel:S.openInNewTab||i?"noopener noreferrer":void 0,children:o.jsx(R,{className:"pkt-footer__social-icon",name:S.iconName})})},`sociallinks-${P}`))})]})]})})},eb=({links:s=[],openLinksInNewTab:e=!1,personvernOgInfoLink:t="https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",tilgjengelighetLink:n="https://www.oslo.kommune.no/tilgjengelighet/",includeConsent:i=!1,hotjarId:r=null,googleAnalyticsId:a=null,devMode:l=!1,cookieDomain:c=null,cookieSecure:h=null,cookieExpiryDays:m=null,onToggleConsent:g=k=>{console.log(k.detail)},className:f})=>{const k=[f,"pkt-footer-simple"].filter(Boolean).join(" ");return o.jsx("footer",{className:k,"data-mode":"dark",children:o.jsx("div",{className:"pkt-footer-simple__container",children:o.jsxs("ul",{className:"pkt-footer-simple__list",children:[s.map((v,$)=>o.jsx("li",{className:"pkt-footer-simple__list-item",children:o.jsxs("a",{className:`pkt-footer-simple__link ${v.external?" pkt-link--external":""}`,href:v.href,target:v.openInNewTab||e?"_blank":"_self",rel:v.openInNewTab||e?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),v.text]})},$)),o.jsx("li",{className:"pkt-footer-simple__list-item",children:o.jsxs("a",{className:"pkt-footer-simple__link",href:t,target:e?"_blank":"_self",rel:e?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),o.jsx("li",{className:"pkt-footer-simple__list-item",children:o.jsxs("a",{className:"pkt-footer-simple__link",href:n,target:e?"_blank":"_self",rel:e?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})}),i&&o.jsx("li",{className:"pkt-footer-simple__list-item",children:o.jsx(Wi,{triggerType:"footerlink",hotjarId:r,googleAnalyticsId:a,devMode:l,cookieDomain:c,cookieSecure:h,cookieExpiryDays:m,onToggleConsent:g})})]})})})},tb=(s,e)=>{const t=()=>typeof window>"u"?0:window.innerWidth,[n,i]=d.useState(t);return d.useEffect(()=>{const r=s.current;if(!r)return;if(i(r.offsetWidth),typeof ResizeObserver>"u"){const l=()=>{r&&i(r.offsetWidth)};return window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)}const a=new ResizeObserver(l=>{for(const c of l)c.borderBoxSize&&c.borderBoxSize.length>0?i(c.borderBoxSize[0].inlineSize):i(c.contentRect.width)});return a.observe(r),()=>{a.disconnect()}},[s]),n};function sb(s){const e=d.useRef(0);d.useEffect(()=>{const t=document.body,n=document.documentElement;if(s){e.current=window.scrollY||window.pageYOffset;const i=window.innerWidth-n.clientWidth;i>0&&(t.style.paddingRight=`${i}px`),t.style.position="fixed",t.style.top=`-${e.current}px`,t.style.left="0",t.style.right="0",t.style.width="100%",t.style.overflow="hidden",n.classList.add("is-scroll-locked")}else t.style.removeProperty("position"),t.style.removeProperty("top"),t.style.removeProperty("left"),t.style.removeProperty("right"),t.style.removeProperty("width"),t.style.removeProperty("overflow"),t.style.removeProperty("padding-right"),document.documentElement.classList.remove("is-scroll-locked"),window.scrollTo({top:e.current});return()=>{s&&(t.style.cssText="",document.documentElement.classList.remove("is-scroll-locked"),window.scrollTo({top:e.current}))}},[s])}const Ki=({href:s,iconName:e,className:t,iconPosition:n,external:i,target:r,children:a,...l})=>{const c={"pkt-link":!0,"pkt-link--icon-left":!!e&&n==="left"||!!(e&&!n),"pkt-link--icon-right":!!e&&n==="right","pkt-link--external":i};return o.jsxs("a",{...l,className:re(c,t),href:s,target:r,rel:i?"noopener noreferrer":void 0,children:[e&&o.jsx(R,{name:e,className:"pkt-link__icon"}),a]})};Ki.displayName="PktLink";const nb=s=>typeof s.target=="string"?{title:s.title,iconName:s.iconName,href:s.target}:{title:s.title,iconName:s.iconName,onClick:s.target},Gi=({item:s,className:e})=>"href"in s?o.jsx(Ki,{iconName:s.iconName,href:s.href,"aria-hidden":"true",className:re("pkt-user-menu__link",e),children:s.title}):o.jsxs("button",{className:re("pkt-user-menu__link pkt-link-button pkt-link pkt-link--icon-left",e),type:"button",onClick:()=>{"onClick"in s&&typeof s.onClick=="function"?s.onClick():console.error("UserMenuButton item is missing onClick handler or onClick is not a function:",s)},children:[s.iconName&&o.jsx(R,{name:s.iconName,className:"pkt-link__icon","aria-hidden":"true"}),s.title]}),ib=({links:s})=>o.jsx("ul",{className:"pkt-user-menu__sublist",children:s.map((e,t)=>o.jsx("li",{className:"pkt-user-menu__subitem",children:o.jsx(Gi,{item:e})},t))}),Ol=d.forwardRef(({user:s,formattedLastLoggedIn:e,representing:t,userMenu:n,canChangeRepresentation:i,changeRepresentation:r,logoutOnClick:a},l)=>{const c=n==null?void 0:n.map(nb);return o.jsx("nav",{className:"pkt-user-menu",ref:l,"aria-label":"Meny for innlogget bruker",children:o.jsxs("ul",{className:"pkt-user-menu__list",children:[s&&o.jsxs("li",{className:"pkt-user-menu__item",children:[o.jsx("div",{className:"pkt-user-menu__label",children:"Pålogget som"}),o.jsx("div",{className:"pkt-user-menu__name",translate:"no",children:s.name}),e&&o.jsxs("div",{className:"pkt-user-menu__last-logged-in",children:["Sist pålogget: ",o.jsx("time",{children:e})]})]}),c&&c.length>0&&o.jsx("li",{className:"pkt-user-menu__item",children:o.jsx(ib,{links:c})}),t&&o.jsxs("li",{className:"pkt-user-menu__item",children:[o.jsx("div",{className:"pkt-user-menu__label",children:"Representerer"}),o.jsx("div",{className:"pkt-user-menu__name",translate:"no",children:t.name}),t.orgNumber&&o.jsxs("div",{className:"pkt-user-menu__org-number",children:["Org.nr. ",t.orgNumber]}),i&&r&&o.jsx("ul",{className:"pkt-user-menu__sublist mt-size-16",children:o.jsx("li",{className:"pkt-user-menu__subitem",children:o.jsx(Gi,{item:{title:"Endre organisasjon",iconName:"cogwheel",onClick:r}})})})]}),!t&&i&&r&&o.jsx("li",{className:"pkt-user-menu__item",children:o.jsx("ul",{className:"pkt-user-menu__sublist",children:o.jsx("li",{className:"pkt-user-menu__subitem",children:o.jsx(Gi,{item:{title:"Endre organisasjon",iconName:"cogwheel",onClick:r}})})})}),a&&o.jsx("li",{className:"pkt-user-menu__item",children:o.jsx(Gi,{item:{title:"Logg ut",iconName:"exit",onClick:a}})})]})})});Ol.displayName="PktHeaderUserMenu";const Xi=d.forwardRef(({id:s,ariaDescribedby:e,ariaLabelledby:t,autocomplete:n="off",counter:i,counterMaxLength:r,className:a,disabled:l=!1,errorMessage:c,hasError:h=!1,helptext:m,helptextDropdown:g,helptextDropdownButton:f,iconNameRight:k,inline:v=!1,fullwidth:$=!1,label:N,name:x,optionalTag:S=!1,optionalText:P,requiredTag:D=!1,requiredText:U,tagText:V=null,placeholder:Y,prefix:ue,suffix:j,type:M="text",useWrapper:z=!0,omitSearchIcon:L=!1,value:Q,minLength:oe,maxLength:ee,min:de,max:le,step:be,size:ne,readonly:ae,required:Ue,dataTestid:Z,onChange:A,skipForwardTestid:Me=!1,...De},te)=>{const Ie=[a,"pkt-textinput"].join(" "),Ee=M==="search"&&!k&&!L,ye=M==="date"&&Q?Q.slice(0,10):Q,[Te,Pe]=d.useState((Q==null?void 0:Q.length)||0),je=`${s}`,Ae=`${je}-label`,ve=t||Ae,E=Le=>{var Ye,q;i&&Pe(((q=(Ye=Le.currentTarget)==null?void 0:Ye.value)==null?void 0:q.length)||0),A&&A(Le)};return d.useEffect(()=>{Q!==void 0&&Pe((Q==null?void 0:Q.length)||0)},[Q]),o.jsx(Ms,{ariaDescribedby:e,className:Ie,disabled:l,errorMessage:c,forId:je,hasError:h,helptext:m,helptextDropdown:g,helptextDropdownButton:f,inline:v,label:N,optionalTag:S,optionalText:P,requiredTag:D,requiredText:U,tagText:V,useWrapper:z,counter:i,counterCurrent:Te,counterMaxLength:r,children:o.jsxs("div",{className:"pkt-input__container","data-testid":Z,"data-skip-forward-testid":Me?"true":void 0,children:[ue&&o.jsx("div",{className:"pkt-input-prefix",children:ue}),o.jsx("input",{...De,ref:te,className:`pkt-input ${$?"pkt-input--fullwidth":""} ${r&&Te>r?"pkt-input--counter-error":""}`,type:M,name:`${x||s}`,value:ye,id:je,placeholder:Y,autoComplete:n,disabled:l,"aria-invalid":h,"aria-errormessage":`${s}-error`,"aria-labelledby":ve,min:de,max:le,onChange:E,step:be,minLength:oe,maxLength:ee,size:ne,readOnly:ae,required:Ue}),j&&o.jsxs("p",{className:"pkt-input-suffix",children:[j,k&&o.jsx(R,{className:"pkt-input-suffix-icon",name:k}),Ee&&o.jsx(R,{className:"pkt-input-suffix-icon",name:"magnifying-glass-big"})]}),!j&&k&&o.jsx(R,{className:"pkt-input-icon",name:k}),!j&&Ee&&o.jsx(R,{className:"pkt-input-icon",name:"magnifying-glass-big"})]})})});Xi.displayName="PktTextinput";const Zr=d.forwardRef(({mobileBreakpoint:s=768,tabletBreakpoint:e=1280,children:t,className:n,compact:i=!1,"data-mode":r,logOutButtonPlacement:a="none",logOut:l,openedMenu:c,showSearch:h=!1,onSearch:m,onSearchChange:g,searchValue:f,searchPlaceholder:k="Søk",representing:v,serviceLink:$,serviceClick:N,serviceName:x,user:S,userMenu:P,userMenuFooter:D,userOptions:U,canChangeRepresentation:V=!1,changeRepresentation:Y,hideLogo:ue=!1,logoLink:j,logoClick:M,position:z="fixed",scrollBehavior:L="hide",slotMenuVariant:Q="icon-only",slotMenuText:oe="Meny"},ee)=>{const de=z==="fixed",le=L==="hide";d.useEffect(()=>{D&&console.warn('PktHeaderService: The "userMenuFooter" prop is deprecated and will be removed in a future version. Please use "userMenu" instead.')},[D]),d.useEffect(()=>{U&&console.warn('PktHeaderService: The "userOptions" prop is no longer available. Please use "userMenu" instead.')},[U]),d.useEffect(()=>{S!=null&&S.shortname&&console.warn('PktHeaderService: The "shortname" property on the user object is deprecated and will be removed in a future version.'),v!=null&&v.shortname&&console.warn('PktHeaderService: The "shortname" property on the representing object is deprecated and will be removed in a future version.')},[S==null?void 0:S.shortname,v==null?void 0:v.shortname]);const be=d.useMemo(()=>{if(S!=null&&S.lastLoggedIn)return typeof S.lastLoggedIn=="string"?S.lastLoggedIn:new Date(S.lastLoggedIn).toLocaleString("nb-NO",{year:"numeric",month:"long",day:"numeric"})},[S==null?void 0:S.lastLoggedIn]),[ne,ae]=d.useState(c||"none");d.useEffect(()=>{c!==void 0&&ae(c)},[c]);const[Ue,Z]=d.useState(!1),[A,Me]=d.useState(0),[De,te]=d.useState(!1),[Ie,Ee]=d.useState(!1),ye=d.useRef(null),Te=d.useRef(null),Pe=d.useRef(null),je=d.useRef(null),Ae=d.useRef(null),ve=d.useRef(null),E=d.useRef(null),Le=d.useRef(!1),Ye=tb(ye),q=Ye<s,H=Ye<e,se=d.useCallback(p=>{ye.current=p,typeof ee=="function"?ee(p):ee&&(ee.current=p)},[ee]);sb(de&&q&&ne!=="none");const me=d.useCallback((p,_)=>{const T=p.relatedTarget;let K;switch(_){case"user":K=Te;break;case"slot":K=Pe;break;case"search":K=je;break;default:return}const G=K.current;G&&(!T||!G.contains(T))&&ae("none")},[]),ge=d.useCallback(()=>{Le.current&&E.current&&document.contains(E.current)&&E.current.focus(),E.current=null,Le.current=!1},[]);d.useEffect(()=>{const p=T=>{S&&ne==="user"&&!T.target.closest(".pkt-header-service__user-container")&&ae("none"),ne==="slot"&&!T.target.closest(".pkt-header-service__slot-container")&&ae("none"),ne==="search"&&!T.target.closest(".pkt-header-service__search-container")&&!T.target.closest(".pkt-header-service__search-input")&&ae("none")},_=T=>{T.key==="Escape"&&ne!=="none"&&(T.preventDefault(),Le.current=!0,ae("none"))};if(ne!=="none")return document.addEventListener("mousedown",p),document.addEventListener("keydown",_),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",_)};ge()},[ne,S,ge]),d.useEffect(()=>{const p=()=>{if(le){const _=window.pageYOffset||document.documentElement.scrollTop;if(_<0||Math.abs(_-A)<60)return;Z(_>A),Me(_)}};return document&&window.addEventListener("scroll",p),()=>{document&&window.removeEventListener("scroll",p)}},[le,A]);const Xe=d.useCallback(p=>{const _=p==="slot"?Pe:je,T=p==="slot"?Ae:ve;if(!_.current||!T.current||!H||q)return;const K=_.current.getBoundingClientRect(),G=T.current.offsetWidth,ce=K.left+G>window.innerWidth;p==="slot"?te(ce):Ee(ce)},[H,q]),Ke=d.useCallback(p=>{ne!=="none"?ae("none"):(E.current=document.activeElement,ae(p))},[ne]);d.useEffect(()=>{(ne==="slot"||ne==="search")&&requestAnimationFrame(()=>{Xe(ne)})},[ne,Xe]);const b=o.jsxs("header",{className:re("pkt-header-service",i&&"pkt-header-service--compact",q&&"pkt-header-service--mobile",H&&"pkt-header-service--tablet",de&&"pkt-header-service--fixed",le&&"pkt-header-service--scroll-to-hide",Ue&&"pkt-header-service--hidden",n),"data-mode":r,ref:se,children:[o.jsxs("div",{className:re("pkt-header-service__logo-area",(!x||x==="")&&"pkt-header-service__logo-area--without-service"),children:[!ue&&o.jsx("span",{className:"pkt-header-service__logo",children:j?o.jsx("a",{href:j,"aria-label":"Tilbake til forside",children:o.jsx(R,{name:"oslologo","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/16.6/logos/"})}):M?o.jsx("button",{"aria-label":"Tilbake til forside",className:"pkt-link-button pkt-link pkt-header-service__logo-link",onClick:M,children:o.jsx(R,{name:"oslologo","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/16.6/logos/"})}):o.jsx(R,{name:"oslologo","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/16.6/logos/"})}),x&&o.jsx("span",{className:"pkt-header-service__service-name",children:$?o.jsx(Ki,{href:$,className:"pkt-header-service__service-link ",children:x}):N?o.jsx("button",{className:"pkt-link-button pkt-link pkt-header-service__service-link",onClick:N,children:x}):o.jsx("span",{className:"pkt-header-service__service-link",children:x})})]}),o.jsxs("div",{className:"pkt-header-service__content",children:[o.jsxs("div",{className:re("pkt-header-service__slot-container",ne==="slot"&&"is-open"),onBlur:p=>me(p,"slot"),ref:Pe,children:[H&&t&&o.jsx(dt,{skin:"secondary",variant:Q,iconName:"menu",size:q?"small":"medium",state:ne==="slot"?"active":"normal",onClick:()=>Ke("slot"),"aria-expanded":ne==="slot","aria-controls":"mobile-slot-menu","aria-label":"Åpne meny",children:oe}),o.jsx("div",{className:re("pkt-header-service__slot-content",De&&"align-right"),id:"mobile-slot-menu",role:H?"menu":void 0,"aria-label":H?"Meny":void 0,ref:Ae,children:o.jsx("div",{className:"pkt-contents",children:t})})]}),h&&o.jsx(o.Fragment,{children:H?o.jsxs("div",{className:re("pkt-header-service__search-container",ne==="search"&&"is-open"),onBlur:p=>me(p,"search"),ref:je,children:[o.jsx(dt,{skin:"secondary",variant:"icon-only",iconName:"magnifying-glass-big",size:q?"small":"medium",onClick:()=>Ke("search"),state:ne==="search"?"active":"normal","aria-expanded":ne==="search","aria-controls":"mobile-search-menu","aria-label":"Åpne søkefelt",children:"Søk"}),o.jsx("div",{className:re("pkt-header-service__mobile-menu",ne==="search"&&"is-open",Ie&&"align-right"),ref:ve,children:ne==="search"&&o.jsx(Xi,{id:"mobile-search-menu",className:"pkt-header-service__search-input",type:"search",label:"Søk",useWrapper:!1,placeholder:k,value:f,autoFocus:!0,fullwidth:!0,onChange:p=>g==null?void 0:g(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(m==null||m(p.target.value))}})})]}):o.jsx(Xi,{id:"header-service-search",className:"pkt-header-service__search-input",type:"search",label:"Søk",useWrapper:!1,placeholder:k,value:f,onChange:p=>g==null?void 0:g(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(m==null||m(p.target.value))}})}),H&&l&&(a==="header"||a==="both")&&o.jsx(dt,{skin:"secondary",size:q?"small":"medium",variant:"icon-only",iconName:"exit",onClick:l,children:"Logg ut"})]}),o.jsxs("div",{className:"pkt-header-service__user",children:[S&&o.jsxs("div",{className:"pkt-header-service__user-container",onBlur:p=>me(p,"user"),ref:Te,children:[o.jsxs(dt,{className:re("pkt-header-service__user-button",q&&"pkt-header-service__user-button--mobile"),skin:"secondary",size:q?"small":"medium",state:ne==="user"?"active":"normal",variant:"icons-right-and-left",iconName:"user",secondIconName:ne==="user"?"chevron-thin-up":"chevron-thin-down",onClick:()=>Ke("user"),children:[o.jsx("span",{className:"pkt-sr-only",children:"Brukermeny: "}),(v==null?void 0:v.name)||S.name]}),ne==="user"&&S&&o.jsx("div",{className:re(q?"pkt-header-service__mobile-menu":"pkt-header-service__user-menu","is-open"),children:o.jsx(Ol,{user:S,formattedLastLoggedIn:be,representing:v,userMenu:P,canChangeRepresentation:V,changeRepresentation:Y,logoutOnClick:a==="userMenu"||a==="both"?l:void 0})})]}),!q&&l&&(a==="header"||a==="both")&&o.jsx(dt,{skin:"tertiary",size:"medium",variant:"icon-right",iconName:"exit",onClick:l,children:"Logg ut"})]})]});return de?o.jsxs("div",{className:"pkt-header-service-wrapper",children:[b,o.jsx("div",{className:re("pkt-header-service-spacer",i&&"pkt-header-service-spacer--compact",S&&"pkt-header-service-spacer--has-user",q&&"pkt-header-service-spacer--mobile",H&&"pkt-header-service-spacer--tablet")})]}):b});Zr.displayName="PktHeaderService";const El=d.forwardRef((s,e)=>o.jsx(Zr,{...s,ref:e}));El.displayName="PktHeader";const rb=xn({tagName:"pkt-heading",elementClass:_s,react:d,displayName:"PktHeading"}),Pl=d.forwardRef(({children:s,...e},t)=>o.jsx(rb,{"data-testid":"pkt-heading",...e,ref:t,children:s}));Pl.displayName="PktHeading";const ab=xn({tagName:"pkt-helptext",elementClass:$s,react:d,displayName:"PktHelptext",events:{onToggleHelpText:"toggleHelpText"}}),Al=d.forwardRef(({children:s,...e},t)=>o.jsx(ab,{...e,ref:t,children:o.jsx("div",{className:"pkt-contents",children:s})}));Al.displayName="PktHelptext";const Il=d.forwardRef(({label:s,id:e,children:t,...n},i)=>o.jsxs("div",{className:"pkt-form-group",children:[o.jsx("label",{htmlFor:e,className:"pkt-form-label",children:s}),o.jsx("input",{className:"pkt-form-input",id:e,...n,ref:i}),t]}));Il.displayName="PktInput";const Ll=({children:s,skin:e,title:t,href:n,iconName:i,openInNewTab:r,external:a,className:l,...c})=>{const h=["pkt-linkcard",e&&`pkt-linkcard--${e}`].filter(Boolean).join(" "),m=["pkt-linkcard__title",a&&"pkt-link pkt-link--external"].filter(Boolean).join(" ");return o.jsxs("a",{...c,href:n,className:re(h,l),target:r?"_blank":"_self",rel:r?"noopener noreferrer":void 0,children:[i&&o.jsx(R,{className:"pkt-link__icon",name:i}),t&&o.jsx("div",{className:re(m),children:t}),o.jsx("div",{className:"pkt-linkcard__text",children:s})]})};Ll.displayName="PktLinkCard";const ob=xn({tagName:"pkt-loader",elementClass:Kt,react:d,displayName:"PktLoader",events:{}}),Bl=d.forwardRef(({children:s,...e},t)=>o.jsx(ob,{...e,ref:t,children:o.jsx("div",{className:"pkt-contents",children:s})}));Bl.displayName="PktLoader";const Fl=({children:s,className:e,skin:t,title:n,compact:i,closable:r,onClose:a,...l})=>{const[c,h]=d.useState(!1),m={"pkt-messagebox":!0,"pkt-messagebox--compact":i,[`pkt-messagebox--${t}`]:t,"pkt-messagebox--closable":r,"pkt-hide":c},g=d.createRef(),f=d.useCallback(()=>{h(!0),a&&a()},[h,a]);return o.jsxs("div",{...l,className:re(m,e),ref:g,children:[r&&o.jsx("div",{className:"pkt-messagebox__close",children:o.jsx("button",{onClick:f,className:"pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only","aria-label":"Lukk",children:o.jsx(R,{name:"close",className:"pkt-link__icon"})})}),n&&o.jsx("div",{className:"pkt-messagebox__title",children:n}),o.jsx("div",{className:"pkt-messagebox__text",children:s})]})};Fl.displayName="PktMessagebox";const Vl=()=>("00000000000000000"+(Math.random()*18446744073709552e3).toString(16)).slice(-16),lb=()=>{const s=Vl(),e=Vl();return s.slice(0,8)+"-"+s.slice(8,12)+"-4"+s.slice(13)+"-a"+e.slice(1,4)+"-"+e.slice(4)},Qi=d.forwardRef(({ariaLabel:s,ariaLabelledby:e,ariaLive:t="polite",ariaValueText:n,id:i,role:r="progressbar",skin:a="dark-blue",statusPlacement:l="following",statusType:c="none",title:h,titlePosition:m="left",valueCurrent:g=0,valueMax:f=100,valueMin:k=0,className:v,...$},N)=>{const x=d.useMemo(()=>lb(),[]),S=i||x,P=d.useRef(null),[D,U]=d.useState(0);d.useEffect(()=>{P.current&&U(P.current.getBoundingClientRect().width||0)},[g]);const V=f-k,Y=Math.round(c==="fraction"?g/V*100:(g-k)/V*100),ue=`${g} av ${V}`,j=c==="fraction"&&!n?`${g} av ${f-k}`:n||void 0,M=s?void 0:e||`${S}-title`;return o.jsx("div",{ref:N,id:S,role:r,"aria-live":t,"aria-atomic":"true","aria-valuenow":g,"aria-valuemin":k,"aria-valuemax":f,"aria-valuetext":j,"aria-label":s||void 0,"aria-labelledby":M,className:re("pkt-progressbar",v),...$,children:o.jsxs("div",{className:"pkt-progressbar__container",style:{"--pkt-progress-label-width":`${D}px`,"--pkt-progress-width":`${Y}%`},children:[h&&o.jsx("p",{id:`${S}-title`,className:re("pkt-progressbar__title",{"pkt-progressbar__title-center":m==="center"}),children:h}),o.jsx("div",{className:"pkt-progressbar__bar-wrapper",children:o.jsx("div",{className:re("pkt-progressbar__bar",`pkt-progressbar__bar--${a}`)})}),c!=="none"&&o.jsx("div",{className:re("pkt-progressbar__status",{"pkt-progressbar__status--center":l==="center"}),children:o.jsx("span",{ref:P,className:re({"pkt-progressbar__status-placement--following":l==="following","pkt-progressbar__status-placement--center":l==="center","pkt-progressbar__status-placement--left":l==="left"}),children:c==="percentage"?`${Y}%`:ue})})]})})});Qi.displayName="PktProgressbar";const Hl=d.forwardRef(({id:s,name:e,label:t,className:n,hasTile:i=!1,disabled:r=!1,checkHelptext:a,hasError:l=!1,defaultChecked:c,checked:h,optionalTag:m,optionalText:g,requiredTag:f,requiredText:k,tagText:v,...$},N)=>{const x=[n,"pkt-input-check"].filter(Boolean).join(" "),S=["pkt-input-check__input",i?"pkt-input-check__input--tile":"",r&&i?"pkt-input-check__input--tile-disabled":""].filter(Boolean).join(" "),P=["pkt-input-check__input-checkbox",l?"pkt-input-check__input-checkbox--error":""].filter(Boolean).join(" "),D=["pkt-input-check__input-label",r?"pkt-input-check__input-label--disabled":""].filter(Boolean).join(" "),U=["pkt-tag","pkt-tag--small","pkt-tag--thin-text"].join(" "),V=()=>o.jsxs(o.Fragment,{children:[v&&o.jsx("span",{className:U+" pkt-tag--gray",children:v}),m&&o.jsx("span",{className:U+" pkt-tag--blue-light",children:g}),f&&o.jsx("span",{className:U+" pkt-tag--beige",children:k})]});return o.jsx("div",{className:x,children:o.jsxs("div",{className:S,children:[o.jsx("input",{ref:N,id:s,type:"radio",name:e,disabled:r,className:P,...h!==void 0?{checked:h}:{defaultChecked:c},...$}),o.jsxs("label",{className:D,htmlFor:s,children:[t," ",V(),a&&o.jsx("div",{className:"pkt-input-check__input-helptext",children:a})]})]})})});Hl.displayName="PktRadioButton";const Ul=d.forwardRef(({appearance:s="local",disabled:e=!1,fullwidth:t=!1,id:n,label:i,name:r,placeholder:a="Søk…",suggestions:l,value:c="",action:h,method:m,onChange:g,onSearch:f,onSuggestionClick:k,...v},$)=>{const N=(D,U)=>{D?D():k&&k(U)},x=D=>{c=D.target.value},S=`pkt-searchinput pkt-searchinput--${s} ${t?"pkt-searchinput--fullwidth":""}`;let P;return h?P=D=>o.jsx("form",{role:"search",className:S,action:h,method:m,children:D}):P=D=>o.jsx("div",{role:"search",className:S,children:D}),P(o.jsxs(o.Fragment,{children:[i&&o.jsx("label",{htmlFor:i?n:void 0,className:i?"pkt-inputwrapper__label":"",children:i}),o.jsxs("div",{className:s==="local"?"pkt-input__container":"pkt-searchinput__field",children:[o.jsx("input",{className:`pkt-input ${t?"pkt-input--fullwidth":""}`,type:"search",name:r||n,id:n,placeholder:a,defaultValue:c,disabled:e,autoComplete:"off","aria-autocomplete":"list",ref:$,"aria-controls":`${n}-suggestions`,onChange:g||x,onKeyUp:f&&(D=>{D.key==="Enter"&&(D.preventDefault(),f(c))}),...v}),o.jsx(dt,{className:`pkt-searchinput__button ${s==="local"?"pkt-input-icon":""}`,variant:"icon-only",iconName:"magnifying-glass-big",skin:s==="local"?"tertiary":"primary",color:s==="global"?"yellow":void 0,type:"submit",disabled:e,onClick:f&&(D=>{D.preventDefault(),f(c)}),children:i||a})]}),l&&o.jsx("ul",{id:`${n}-suggestions`,className:"pkt-searchinput__suggestions","aria-live":"assertive",children:l.map((D,U)=>o.jsx("li",{children:d.createElement(D.href?"a":D.onClick?"button":"div",{href:D.href,className:`pkt-searchinput__suggestion ${D.onClick?"pkt-link-button":""} ${D.href||D.onClick?"pkt-searchinput__suggestion--has-hover":""}`,type:D.onClick?"button":void 0,onClick:()=>N(D.onClick,U),onKeyUp:V=>V.key==="Enter"&&N(D.onClick,U)},o.jsxs(o.Fragment,{children:[D.title&&o.jsx("h3",{className:"pkt-searchinput__suggestion-title",children:D.title}),D.text&&o.jsx("p",{className:"pkt-searchinput__suggestion-text",children:D.text})]}))},`search-suggestion-${U}`))})]}))});Ul.displayName="PktSearchInput";const jl=d.forwardRef(({ariaDescribedby:s,ariaLabelledby:e,children:t,className:n,disabled:i=!1,errorMessage:r,hasError:a,helptext:l,helptextDropdown:c,helptextDropdownButton:h,id:m,inline:g=!1,fullwidth:f=!1,label:k,name:v,optionalTag:$=!1,optionalText:N,requiredTag:x=!1,requiredText:S,tagText:P,...D},U)=>{const V=[n,"pkt-select"].join(" ");return o.jsx(Ms,{className:V,forId:`${m}-input`,label:k,helptext:l,helptextDropdown:c,helptextDropdownButton:h,optionalTag:$,optionalText:N,requiredTag:x,requiredText:S,tagText:P,hasError:a,errorMessage:r,disabled:i,inline:g,ariaDescribedby:s,children:o.jsx("select",{ref:U,className:`pkt-input ${f?"pkt-input--fullwidth":""}`,"aria-invalid":a,"aria-errormessage":`${m}-error`,"aria-labelledby":e||void 0,disabled:i,id:`${m}-input`,name:v||m,...D,children:t})})});jl.displayName="PktSelect";const cb=o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",children:o.jsx("circle",{cx:"12",cy:"12",r:"7",style:{fill:"var(--pkt-color-grays-grey-200, #CCC)"}})}),ub=o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",children:[o.jsx("circle",{opacity:".15",cx:"12",cy:"12",r:"12",fill:"#2A2859"}),o.jsx("circle",{cx:"12",cy:"12",r:"6",fill:"#2A2859"})]}),db=o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",children:[o.jsx("path",{fill:"#2A2859",d:"M3 3h18v18H3z"}),o.jsx("path",{d:"m10.34 16-1.11-1.14L7 12.58l1.11-1.15 2.23 2.28L15.88 8 17 9.15l-5.55 5.71L10.34 16Z",fill:"#F1FDFF"})]}),hb=({children:s,className:e,status:t="incomplete",title:n})=>o.jsxs("li",{className:re("pkt-step",e,`pkt-step--${t}`),"data-testid":"pkt-step",children:[o.jsx("span",{className:"pkt-step__line pkt-step__line--1","aria-hidden":!0}),o.jsx("span",{className:"pkt-step__line pkt-step__line--2","aria-hidden":!0}),o.jsx("span",{className:re("pkt-step__indicator"),children:t==="current"?ub:t==="completed"?db:cb}),o.jsx("span",{className:"pkt-step__line pkt-step__line--3","aria-hidden":!0}),o.jsxs("div",{className:"pkt-step__wrapper",children:[o.jsx("div",{className:"pkt-step__title",children:n}),o.jsx("div",{className:"pkt-step__content",children:s})]})]}),ql=d.forwardRef(({activeStep:s,className:e,children:t,hideNonActiveSteps:n=!1,hideNonActiveStepsContent:i=!0,orientation:r="vertical",...a},l)=>{const c=re(e,"pkt-stepper",r==="horizontal"?"pkt-stepper--horizontal":"pkt-stepper--vertical"),h=d.Children.map(t,(m,g)=>d.isValidElement(m)?d.cloneElement(m,{className:re(m.props.className,{"pkt-step--hideStep":n&&g!==s,"pkt-step--hideContent":i&&g!==s})}):m);return o.jsx("ol",{"data-testid":"pkt-stepper",className:c,ref:l,...a,children:h})});ql.displayName="PktStepper";const pb=({className:s,compact:e=!1,skin:t="basic",responsiveView:n=!0,children:i,...r})=>o.jsx("table",{"data-testid":"pkt-table",className:re(s,"pkt-table",{"pkt-table--responsive":n,"pkt-table--compact":e,"pkt-table--basic":t==="basic","pkt-table--zebra-blue":t==="zebra-blue"}),role:"table",...r,children:i}),fb=({id:s,children:e,className:t,...n})=>o.jsx("tbody",{id:s,className:re(t,"pkt-table__body",{}),...n,role:"rowgroup",children:e}),gb=({children:s,className:e,dataLabel:t,...n})=>o.jsx("td",{className:re(e,"pkt-table__data-cell",{}),"data-label":t,role:"cell","data-testid":"pkt-table__data-cell",...n,children:s}),mb=({className:s,children:e,...t})=>o.jsx("thead",{className:re(s,"pkt-table__header",{}),role:"rowgroup",...t,children:e}),bb=({className:s,children:e,...t})=>o.jsx("th",{className:re(s,"pkt-table__header-cell",{}),role:"columnheader",...t,children:e}),vb=({className:s,children:e,...t})=>o.jsx("tr",{className:re(s,"pkt-table__row",{}),role:"row",...t,children:e}),Jr=d.forwardRef(({children:s,active:e,href:t,onClick:n,icon:i,controls:r,tag:a,tagSkin:l,index:c=0},h)=>{const{arrowNav:m,registerTabRef:g,handleKeyPress:f,selectTab:k}=kb(),$={"aria-selected":m?!!e:void 0,"aria-controls":r,role:m?"tab":void 0,onKeyUp:x=>f(c,x),onClick:x=>{k(c),n==null||n(x)},tabIndex:e||!m?void 0:-1,ref:x=>{g(c,x),typeof h=="function"?h(x):h&&(h.current=x)}},N=o.jsxs(o.Fragment,{children:[i&&o.jsx(R,{name:i,className:"pkt-icon--small"}),s,a&&o.jsx(Ns,{skin:l,size:"small",children:a})]});return t?o.jsx("a",{...$,href:t,className:`pkt-tabs__link ${e?"active":""}`,children:N}):o.jsx("button",{...$,type:"button",className:`pkt-tabs__button pkt-link-button ${e?"active":""}`,children:N})});Jr.displayName="PktTabItem";const Wl=d.createContext(null),kb=()=>{const s=d.useContext(Wl);if(!s)throw new Error("TabItem must be used within a Tabs component");return s},zl=d.forwardRef(({arrowNav:s=!0,disableArrowNav:e=!1,tabs:t,onTabSelected:n,children:i},r)=>{const a=d.useRef([]),l=s&&!e,h=i&&d.Children.count(i)>0?d.Children.count(i):(t==null?void 0:t.length)||0;d.useEffect(()=>{a.current=a.current.slice(0,h)},[h]);const m=v=>{const $=t==null?void 0:t[v];$!=null&&$.action&&$.action(v),n&&n(v)},g=(v,$)=>{var N,x;l&&($.code==="ArrowLeft"&&v!==0&&((N=a.current[v-1])==null||N.focus()),$.code==="ArrowRight"&&v<h-1&&((x=a.current[v+1])==null||x.focus()),($.code==="ArrowDown"||$.code==="Space")&&m(v))},f=(v,$)=>{a.current[v]=$},k=t==null?void 0:t.map((v,$)=>{var N,x;return o.jsx(Jr,{active:v.active,href:v.href,onClick:()=>m($),icon:v.icon,controls:v.controls,tag:(N=v.tag)==null?void 0:N.text,tagSkin:(x=v.tag)==null?void 0:x.skin,index:$,children:v.text},$)});return o.jsx(Wl.Provider,{value:{arrowNav:l,registerTabRef:f,handleKeyPress:g,selectTab:m},children:o.jsx("div",{className:"pkt-tabs",ref:r,children:o.jsx("div",{className:"pkt-tabs__list",role:l?"tablist":"navigation",children:i||k})})})});zl.displayName="PktTabs";var kn=window.CustomEvent;(!kn||typeof kn=="object")&&(kn=function(s,e){e=e||{};var t=document.createEvent("CustomEvent");return t.initCustomEvent(s,!!e.bubbles,!!e.cancelable,e.detail||null),t},kn.prototype=window.Event.prototype);function Yl(s,e){var t="on"+e.type.toLowerCase();return typeof s[t]=="function"&&s[t](e),s.dispatchEvent(e)}function yb(s){for(;s&&s!==document.body;){var e=window.getComputedStyle(s),t=function(n,i){return!(e[n]===void 0||e[n]===i)};if(e.opacity<1||t("zIndex","auto")||t("transform","none")||t("mixBlendMode","normal")||t("filter","none")||t("perspective","none")||e.isolation==="isolate"||e.position==="fixed"||e.webkitOverflowScrolling==="touch")return!0;s=s.parentElement}return!1}function li(s){for(;s;){if(s.localName==="dialog")return s;s.parentElement?s=s.parentElement:s.parentNode?s=s.parentNode.host:s=null}return null}function Kl(s){for(;s&&s.shadowRoot&&s.shadowRoot.activeElement;)s=s.shadowRoot.activeElement;s&&s.blur&&s!==document.body&&s.blur()}function _b(s,e){for(var t=0;t<s.length;++t)if(s[t]===e)return!0;return!1}function Rr(s){return!s||!s.hasAttribute("method")?!1:s.getAttribute("method").toLowerCase()==="dialog"}function Gl(s){var e=["button","input","keygen","select","textarea"],t=e.map(function(a){return a+":not([disabled])"});t.push('[tabindex]:not([disabled]):not([tabindex=""])');var n=s.querySelector(t.join(", "));if(!n&&"attachShadow"in Element.prototype)for(var i=s.querySelectorAll("*"),r=0;r<i.length&&!(i[r].tagName&&i[r].shadowRoot&&(n=Gl(i[r].shadowRoot),n));r++);return n}function Xl(s){return s.isConnected||document.body.contains(s)}function Ql(s){if(s.submitter)return s.submitter;var e=s.target;if(!(e instanceof HTMLFormElement))return null;var t=ke.formSubmitter;if(!t){var n=s.target,i="getRootNode"in n&&n.getRootNode()||document;t=i.activeElement}return!t||t.form!==e?null:t}function wb(s){if(!s.defaultPrevented){var e=s.target,t=ke.imagemapUseValue,n=Ql(s);t===null&&n&&(t=n.value);var i=li(e);if(i){var r=n&&n.getAttribute("formmethod")||e.getAttribute("method");r==="dialog"&&(s.preventDefault(),t!=null?i.close(t):i.close())}}}function Zl(s){if(this.dialog_=s,this.replacedStyleTop_=!1,this.openAsModal_=!1,s.hasAttribute("role")||s.setAttribute("role","dialog"),s.show=this.show.bind(this),s.showModal=this.showModal.bind(this),s.close=this.close.bind(this),s.addEventListener("submit",wb,!1),"returnValue"in s||(s.returnValue=""),"MutationObserver"in window){var e=new MutationObserver(this.maybeHideModal.bind(this));e.observe(s,{attributes:!0,attributeFilter:["open"]})}else{var t=!1,n=(function(){t?this.downgradeModal():this.maybeHideModal(),t=!1}).bind(this),i,r=function(a){if(a.target===s){var l="DOMNodeRemoved";t|=a.type.substr(0,l.length)===l,window.clearTimeout(i),i=window.setTimeout(n,0)}};["DOMAttrModified","DOMNodeRemoved","DOMNodeRemovedFromDocument"].forEach(function(a){s.addEventListener(a,r)})}Object.defineProperty(s,"open",{set:this.setOpen.bind(this),get:s.hasAttribute.bind(s,"open")}),this.backdrop_=document.createElement("div"),this.backdrop_.className="backdrop",this.backdrop_.addEventListener("mouseup",this.backdropMouseEvent_.bind(this)),this.backdrop_.addEventListener("mousedown",this.backdropMouseEvent_.bind(this)),this.backdrop_.addEventListener("click",this.backdropMouseEvent_.bind(this))}Zl.prototype={get dialog(){return this.dialog_},maybeHideModal:function(){this.dialog_.hasAttribute("open")&&Xl(this.dialog_)||this.downgradeModal()},downgradeModal:function(){this.openAsModal_&&(this.openAsModal_=!1,this.dialog_.style.zIndex="",this.replacedStyleTop_&&(this.dialog_.style.top="",this.replacedStyleTop_=!1),this.backdrop_.parentNode&&this.backdrop_.parentNode.removeChild(this.backdrop_),ke.dm.removeDialog(this))},setOpen:function(s){s?this.dialog_.hasAttribute("open")||this.dialog_.setAttribute("open",""):(this.dialog_.removeAttribute("open"),this.maybeHideModal())},backdropMouseEvent_:function(s){if(this.dialog_.hasAttribute("tabindex"))this.dialog_.focus();else{var e=document.createElement("div");this.dialog_.insertBefore(e,this.dialog_.firstChild),e.tabIndex=-1,e.focus(),this.dialog_.removeChild(e)}var t=document.createEvent("MouseEvents");t.initMouseEvent(s.type,s.bubbles,s.cancelable,window,s.detail,s.screenX,s.screenY,s.clientX,s.clientY,s.ctrlKey,s.altKey,s.shiftKey,s.metaKey,s.button,s.relatedTarget),this.dialog_.dispatchEvent(t),s.stopPropagation()},focus_:function(){var s=this.dialog_.querySelector("[autofocus]:not([disabled])");!s&&this.dialog_.tabIndex>=0&&(s=this.dialog_),s||(s=Gl(this.dialog_)),Kl(document.activeElement),s&&s.focus()},updateZIndex:function(s,e){if(s<e)throw new Error("dialogZ should never be < backdropZ");this.dialog_.style.zIndex=s,this.backdrop_.style.zIndex=e},show:function(){this.dialog_.open||(this.setOpen(!0),this.focus_())},showModal:function(){if(this.dialog_.hasAttribute("open"))throw new Error("Failed to execute 'showModal' on dialog: The element is already open, and therefore cannot be opened modally.");if(!Xl(this.dialog_))throw new Error("Failed to execute 'showModal' on dialog: The element is not in a Document.");if(!ke.dm.pushDialog(this))throw new Error("Failed to execute 'showModal' on dialog: There are too many open modal dialogs.");yb(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,ke.needsCentering(this.dialog_)?(ke.reposition(this.dialog_),this.replacedStyleTop_=!0):this.replacedStyleTop_=!1,this.dialog_.parentNode.insertBefore(this.backdrop_,this.dialog_.nextSibling),this.focus_()},close:function(s){if(!this.dialog_.hasAttribute("open"))throw new Error("Failed to execute 'close' on dialog: The element does not have an 'open' attribute, and therefore cannot be closed.");this.setOpen(!1),s!==void 0&&(this.dialog_.returnValue=s);var e=new kn("close",{bubbles:!1,cancelable:!1});Yl(this.dialog_,e)}};var ke={};if(ke.reposition=function(s){var e=document.body.scrollTop||document.documentElement.scrollTop,t=e+(window.innerHeight-s.offsetHeight)/2;s.style.top=Math.max(e,t)+"px"},ke.isInlinePositionSetByStylesheet=function(s){for(var e=0;e<document.styleSheets.length;++e){var t=document.styleSheets[e],n=null;try{n=t.cssRules}catch{}if(n)for(var i=0;i<n.length;++i){var r=n[i],a=null;try{a=document.querySelectorAll(r.selectorText)}catch{}if(!(!a||!_b(a,s))){var l=r.style.getPropertyValue("top"),c=r.style.getPropertyValue("bottom");if(l&&l!=="auto"||c&&c!=="auto")return!0}}}return!1},ke.needsCentering=function(s){var e=window.getComputedStyle(s);return e.position!=="absolute"||s.style.top!=="auto"&&s.style.top!==""||s.style.bottom!=="auto"&&s.style.bottom!==""?!1:!ke.isInlinePositionSetByStylesheet(s)},ke.forceRegisterDialog=function(s){if((window.HTMLDialogElement||s.showModal)&&console.warn("This browser already supports <dialog>, the polyfill may not work correctly",s),s.localName!=="dialog")throw new Error("Failed to register dialog: The element is not a dialog.");new Zl(s)},ke.registerDialog=function(s){s.showModal||ke.forceRegisterDialog(s)},ke.DialogManager=function(){this.pendingDialogStack=[];var s=this.checkDOM_.bind(this);this.overlay=document.createElement("div"),this.overlay.className="_dialog_overlay",this.overlay.addEventListener("click",(function(e){this.forwardTab_=void 0,e.stopPropagation(),s([])}).bind(this)),this.handleKey_=this.handleKey_.bind(this),this.handleFocus_=this.handleFocus_.bind(this),this.zIndexLow_=1e5,this.zIndexHigh_=100150,this.forwardTab_=void 0,"MutationObserver"in window&&(this.mo_=new MutationObserver(function(e){var t=[];e.forEach(function(n){for(var i=0,r;r=n.removedNodes[i];++i){if(r instanceof Element)r.localName==="dialog"&&t.push(r);else continue;t=t.concat(r.querySelectorAll("dialog"))}}),t.length&&s(t)}))},ke.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})},ke.DialogManager.prototype.unblockDocument=function(){document.documentElement.removeEventListener("focus",this.handleFocus_,!0),document.removeEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.disconnect()},ke.DialogManager.prototype.updateStacking=function(){for(var s=this.zIndexHigh_,e=0,t;t=this.pendingDialogStack[e];++e)t.updateZIndex(--s,--s),e===0&&(this.overlay.style.zIndex=--s);var n=this.pendingDialogStack[0];if(n){var i=n.dialog.parentNode||document.body;i.appendChild(this.overlay)}else this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay)},ke.DialogManager.prototype.containedByTopDialog_=function(s){for(;s=li(s);){for(var e=0,t;t=this.pendingDialogStack[e];++e)if(t.dialog===s)return e===0;s=s.parentElement}return!1},ke.DialogManager.prototype.handleFocus_=function(s){var e=s.composedPath?s.composedPath()[0]:s.target;if(!this.containedByTopDialog_(e)&&document.activeElement!==document.documentElement&&(s.preventDefault(),s.stopPropagation(),Kl(e),this.forwardTab_!==void 0)){var t=this.pendingDialogStack[0],n=t.dialog,i=n.compareDocumentPosition(e);return i&Node.DOCUMENT_POSITION_PRECEDING&&(this.forwardTab_?t.focus_():e!==document.documentElement&&document.documentElement.focus()),!1}},ke.DialogManager.prototype.handleKey_=function(s){if(this.forwardTab_=void 0,s.keyCode===27){s.preventDefault(),s.stopPropagation();var e=new kn("cancel",{bubbles:!1,cancelable:!0}),t=this.pendingDialogStack[0];t&&Yl(t.dialog,e)&&t.dialog.close()}else s.keyCode===9&&(this.forwardTab_=!s.shiftKey)},ke.DialogManager.prototype.checkDOM_=function(s){var e=this.pendingDialogStack.slice();e.forEach(function(t){s.indexOf(t.dialog)!==-1?t.downgradeModal():t.maybeHideModal()})},ke.DialogManager.prototype.pushDialog=function(s){var e=(this.zIndexHigh_-this.zIndexLow_)/2-1;return this.pendingDialogStack.length>=e?!1:(this.pendingDialogStack.unshift(s)===1&&this.blockDocument(),this.updateStacking(),!0)},ke.DialogManager.prototype.removeDialog=function(s){var e=this.pendingDialogStack.indexOf(s);e!==-1&&(this.pendingDialogStack.splice(e,1),this.pendingDialogStack.length===0&&this.unblockDocument(),this.updateStacking())},ke.dm=new ke.DialogManager,ke.formSubmitter=null,ke.imagemapUseValue=null,window.HTMLDialogElement===void 0){var Jl=document.createElement("form");if(Jl.setAttribute("method","dialog"),Jl.method!=="dialog"){var yn=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"method");if(yn){var $b=yn.get;yn.get=function(){return Rr(this)?"dialog":$b.call(this)};var xb=yn.set;yn.set=function(s){return typeof s=="string"&&s.toLowerCase()==="dialog"?this.setAttribute("method",s):xb.call(this,s)},Object.defineProperty(HTMLFormElement.prototype,"method",yn)}}document.addEventListener("click",function(s){if(ke.formSubmitter=null,ke.imagemapUseValue=null,!s.defaultPrevented){var e=s.target;if("composedPath"in s){var t=s.composedPath();e=t.shift()||e}if(!(!e||!Rr(e.form))){var n=e.type==="submit"&&["button","input"].indexOf(e.localName)>-1;if(!n){if(!(e.localName==="input"&&e.type==="image"))return;ke.imagemapUseValue=s.offsetX+","+s.offsetY}var i=li(e);i&&(ke.formSubmitter=e)}}},!1),document.addEventListener("submit",function(s){var e=s.target,t=li(e);if(!t){var n=Ql(s),i=n&&n.getAttribute("formmethod")||e.getAttribute("method");i==="dialog"&&s.preventDefault()}});var Cb=HTMLFormElement.prototype.submit,Sb=function(){if(!Rr(this))return Cb.call(this);var s=li(this);s&&s.close()};HTMLFormElement.prototype.submit=Sb}const Tb=Object.freeze(Object.defineProperty({__proto__:null,default:ke},Symbol.toStringTag,{value:"Module"}));W.FileItem=Cl,W.ItemRenderers=Qr,W.PktAccordion=oa,W.PktAccordionItem=Vo,W.PktAlert=Bi,W.PktBackLink=Uo,W.PktBreadcrumbs=jo,W.PktButton=dt,W.PktCalendar=qr,W.PktCard=pl,W.PktCheckbox=fl,W.PktCombobox=yl,W.PktConsent=Wi,W.PktDatepicker=$l,W.PktFileUpload=Dl,W.PktFooter=Rm,W.PktFooterSimple=eb,W.PktHeader=El,W.PktHeaderService=Zr,W.PktHeading=Pl,W.PktHelptext=Al,W.PktIcon=R,W.PktInput=Il,W.PktInputWrapper=Ms,W.PktLink=Ki,W.PktLinkCard=Ll,W.PktLoader=Bl,W.PktMessagebox=Fl,W.PktModal=Kr,W.PktProgressbar=Qi,W.PktRadioButton=Hl,W.PktSearchInput=Ul,W.PktSelect=jl,W.PktStep=hb,W.PktStepper=ql,W.PktTabItem=Jr,W.PktTable=pb,W.PktTableBody=fb,W.PktTableDataCell=gb,W.PktTableHeader=mb,W.PktTableHeaderCell=bb,W.PktTableRow=vb,W.PktTabs=zl,W.PktTag=Ns,W.PktTextarea=Yr,W.PktTextinput=Xi,Object.defineProperty(W,Symbol.toStringTag,{value:"Module"})}));
|