scb-wc-test 0.1.302 → 0.1.304

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.
@@ -1,17 +1,17 @@
1
- import{a as v,n as s,r as c,i as h,x as p,t as _}from"../../vendor/vendor.js";(function(){try{var e=typeof globalThis<"u"?globalThis:window;if(!e.__scb_ce_guard_installed__){e.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(o,a,l){try{customElements.get(o)||t(o,a,l)}catch(d){var n=String(d||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw d}}}}catch{}})();var u=Object.defineProperty,b=Object.getOwnPropertyDescriptor,i=(e,t,o,a)=>{for(var l=a>1?void 0:a?b(t,o):t,n=e.length-1,d;n>=0;n--)(d=e[n])&&(l=(a?d(t,o,l):d(l))||l);return a&&l&&u(t,o,l),l};let r=class extends h{constructor(){super(...arguments),this.type="default",this.label="",this.supportingText="",this.metaText="",this.buttonLabel="",this.replaceButtonLabel="",this.removeButtonLabel="",this.previewEyebrow="",this.emptyPreviewTitle="",this.emptyPreviewMeta="",this.accept="",this.showPreview=!0,this.disabled=!1,this.previewSrc="",this.defaultImageSrc="",this.previewAlt="",this.previewTitle="",this.previewMeta="",this._isDragOver=!1,this._selectedPreviewKind="empty",this._selectedPreviewSrc="",this._selectedPreviewAlt="",this._selectedPreviewTitle="",this._selectedPreviewMeta="",this._dragDepth=0,this._previewSource="external",this._objectUrl=""}get _resolvedAccept(){return this.accept.trim()||(this.type==="image"?"image/*,.png,.jpg,.jpeg,.webp,.svg,.gif,.bmp,.avif":"")}get _hasExternalPreview(){return!!this._resolvedExternalPreviewSrc||!!this.previewTitle.trim()||!!this.previewMeta.trim()}get _resolvedExternalPreviewSrc(){return this.previewSrc.trim()||this.defaultImageSrc.trim()}get _resolvedPreviewKind(){return this._previewSource==="external"&&this._hasExternalPreview?this._resolvedExternalPreviewSrc?"image":"file":this._selectedPreviewKind}get _hasPreview(){return this._resolvedPreviewKind!=="empty"}get _resolvedLabel(){return this.label||(this.type==="image"?"Ladda upp bild":"Ladda upp fil")}get _resolvedSupportingText(){return this.supportingText||(this.type==="image"?"Dra och släpp en bild här, eller välj en bild från din dator.":"Dra och släpp en fil här, eller välj en fil från din dator.")}get _resolvedMetaText(){return this.metaText?this.metaText:this.type==="image"?"PNG, JPG, SVG, GIF, BMP, AVIF och WebP stöds.":"Alla filtyper stöds."}get _resolvedButtonLabel(){return this.buttonLabel||(this.type==="image"?"Välj bild":"Välj fil")}get _resolvedReplaceButtonLabel(){return this.replaceButtonLabel?this.replaceButtonLabel:this._resolvedPreviewKind==="image"?"Byt bild":"Byt fil"}get _resolvedRemoveButtonLabel(){return this.removeButtonLabel?this.removeButtonLabel:this._resolvedPreviewKind==="image"?"Ta bort bild":"Ta bort fil"}get _resolvedPreviewEyebrow(){return this.previewEyebrow?this.previewEyebrow:this._hasPreview?this._resolvedPreviewKind==="image"?"Uppladdad bild":"Uppladdad fil":"Förhandsvisning"}get _resolvedEmptyPreviewTitle(){return this.emptyPreviewTitle?this.emptyPreviewTitle:this.type==="image"?"Ingen bild uppladdad":"Ingen fil uppladdad"}get _resolvedEmptyPreviewMeta(){return this.emptyPreviewMeta?this.emptyPreviewMeta:this.type==="image"?"Förhandsvisningen visas här när du har laddat upp en bild.":"Förhandsvisningen visas här när du har laddat upp en fil."}get _resolvedPreviewSrc(){return this._previewSource==="external"&&this._hasExternalPreview?this._resolvedExternalPreviewSrc:this._selectedPreviewSrc}get _resolvedPreviewAlt(){return this._previewSource==="external"&&this._hasExternalPreview?this.previewAlt:this._selectedPreviewAlt}get _resolvedPreviewTitle(){return this._previewSource==="external"&&this._hasExternalPreview?this.previewTitle||(this._resolvedPreviewKind==="image"?"Uppladdad bild":"Uppladdad fil"):this._selectedPreviewTitle}get _resolvedPreviewMeta(){return this._previewSource==="external"&&this._hasExternalPreview?this.previewMeta:this._selectedPreviewMeta}disconnectedCallback(){this._revokeObjectUrl(),super.disconnectedCallback()}updated(e){e.has("type")&&this.type==="image"&&this._selectedPreviewKind==="file"&&this._clearSelectedFileState()}openPicker(){if(this.disabled)return;const e=this.renderRoot.querySelector('[data-role="native-input"]');if(e){try{e.value=""}catch{}e.click()}}setPreviewState(e){this.previewSrc=e?.src??"",this.previewAlt=e?.alt??"",this.previewTitle=e?.title??"",this.previewMeta=e?.meta??"",this._previewSource="external"}clearPreviewState(){this.previewSrc="",this.previewAlt="",this.previewTitle="",this.previewMeta="",this._previewSource="external",this._clearSelectedFileState(),this._clearNativeInputValue()}_dispatch(e,t={},o=!1){const a=new CustomEvent(e,{detail:t,bubbles:!0,composed:!0,cancelable:o});return this.dispatchEvent(a),a}_handleFiles(e){const t=e&&e[0]?e[0]:null;!t||!this._isAcceptedFile(t)||(this._setSelectedFileState(t),this._dispatch("file-selected",{file:t}),this._dispatch("change",{file:t}))}_onZoneClick(e){this.disabled||e.composedPath().some(a=>a instanceof HTMLElement&&a.getAttribute("data-role")==="choose-button")||this.openPicker()}_onZoneKeydown(e){this.disabled||(e.key==="Enter"||e.key===" "||e.key==="Spacebar")&&(e.preventDefault(),this.openPicker())}_preventDefaultDrag(e){e.preventDefault(),e.stopPropagation()}_onDragEnter(e){this.disabled||(this._preventDefaultDrag(e),this._dragDepth+=1,this._isDragOver=!0)}_onDragOver(e){this.disabled||(this._preventDefaultDrag(e),this._isDragOver=!0)}_onDragLeave(e){this.disabled||(this._preventDefaultDrag(e),this._dragDepth=Math.max(0,this._dragDepth-1),this._dragDepth||(this._isDragOver=!1))}_onDrop(e){this.disabled||(this._preventDefaultDrag(e),this._dragDepth=0,this._isDragOver=!1,this._handleFiles(e.dataTransfer?.files??null))}_onNativeInputChange(e){const t=e.currentTarget;this._handleFiles(t?.files??null)}_onChooseButtonClick(e){e.preventDefault(),e.stopPropagation(),this.openPicker()}_onReplaceButtonClick(e){e.preventDefault(),e.stopPropagation(),this.openPicker()}_onRemoveButtonClick(e){e.preventDefault(),e.stopPropagation(),this._dispatch("clear-request",{},!0).defaultPrevented||this.clearPreviewState()}_isAcceptedFile(e){const t=this._resolvedAccept.trim();if(!t)return!0;const o=e.name.toLowerCase(),a=(e.type||"").toLowerCase(),l=t.split(",").map(n=>n.trim().toLowerCase()).filter(Boolean);return l.length?l.some(n=>n==="*/*"?!0:n.endsWith("/*")?a.startsWith(n.slice(0,-1)):n.startsWith(".")?o.endsWith(n):a===n):!0}_setSelectedFileState(e){const t=this._getPreviewKindForFile(e),o=this._getFileTypeLabel(e),a=this._formatFileSize(e.size);this._revokeObjectUrl(),this._selectedPreviewKind=t,this._selectedPreviewTitle=e.name||(t==="image"?"Uppladdad bild":"Uppladdad fil"),this._selectedPreviewMeta=[o,a].filter(Boolean).join(" • "),this._selectedPreviewAlt=t==="image"?e.name||"Uppladdad bild":"",this._selectedPreviewSrc="",t==="image"&&(this._objectUrl=URL.createObjectURL(e),this._selectedPreviewSrc=this._objectUrl),this._previewSource="internal"}_clearSelectedFileState(){this._revokeObjectUrl(),this._selectedPreviewKind="empty",this._selectedPreviewSrc="",this._selectedPreviewAlt="",this._selectedPreviewTitle="",this._selectedPreviewMeta=""}_clearNativeInputValue(){const e=this.renderRoot.querySelector('[data-role="native-input"]');if(e)try{e.value=""}catch{}}_revokeObjectUrl(){this._objectUrl&&(URL.revokeObjectURL(this._objectUrl),this._objectUrl="")}_getPreviewKindForFile(e){const t=(e.type||"").toLowerCase(),o=this._getFileExtension(e.name).toLowerCase();return t.startsWith("image/")||["png","jpg","jpeg","webp","svg","gif","bmp","avif"].includes(o)?"image":"file"}_getFileExtension(e){return/\.([^.]+)$/.exec(e||"")?.[1]??""}_getFileExtensionLabel(e){return(this._getFileExtension(e)||(this._resolvedPreviewKind==="image"?"IMG":"FIL")).slice(0,6).toUpperCase()}_getFileTypeLabel(e){if(e.type)return e.type;const t=this._getFileExtension(e.name);return t?t.toUpperCase():"Okänd filtyp"}_formatFileSize(e){return!Number.isFinite(e)||e<0?"":e<1024?`${e} B`:e<1024*1024?`${new Intl.NumberFormat("sv-SE",{maximumFractionDigits:1}).format(e/1024)} kB`:`${new Intl.NumberFormat("sv-SE",{maximumFractionDigits:1}).format(e/(1024*1024))} MB`}_renderPreviewMedia(){return this._resolvedPreviewKind==="image"&&this._resolvedPreviewSrc?p`<img class="scb-drop-zone__preview-image" src=${this._resolvedPreviewSrc} alt=${this._resolvedPreviewAlt} />`:this._hasPreview?p`
1
+ import{a as h,n as a,r as c,i as v,x as d,t as _}from"../../vendor/vendor.js";(function(){try{var e=typeof globalThis<"u"?globalThis:window;if(!e.__scb_ce_guard_installed__){e.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(o,s,l){try{customElements.get(o)||t(o,s,l)}catch(p){var n=String(p||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw p}}}}catch{}})();var u=Object.defineProperty,m=Object.getOwnPropertyDescriptor,i=(e,t,o,s)=>{for(var l=s>1?void 0:s?m(t,o):t,n=e.length-1,p;n>=0;n--)(p=e[n])&&(l=(s?p(t,o,l):p(l))||l);return s&&l&&u(t,o,l),l};let r=class extends v{constructor(){super(),this._internals=null,this.type="default",this.name="",this.label="",this.supportingText="",this.metaText="",this.buttonLabel="",this.replaceButtonLabel="",this.removeButtonLabel="",this.previewEyebrow="",this.emptyPreviewTitle="",this.emptyPreviewMeta="",this.accept="",this.showPreview=!0,this.disabled=!1,this.previewSrc="",this.defaultImageSrc="",this.previewAlt="",this.previewTitle="",this.previewMeta="",this._isDragOver=!1,this._selectedPreviewKind="empty",this._selectedPreviewSrc="",this._selectedPreviewAlt="",this._selectedPreviewTitle="",this._selectedPreviewMeta="",this._dragDepth=0,this._previewSource="external",this._objectUrl="",this._selectedFile=null,this._form=null,this._formDataHandler=null,"attachInternals"in this&&(this._internals=this.attachInternals())}get _resolvedAccept(){return this.accept.trim()||(this.type==="image"?"image/*,.png,.jpg,.jpeg,.webp,.svg,.gif,.bmp,.avif":"")}get _hasExternalPreview(){return!!this._resolvedExternalPreviewSrc||!!this.previewTitle.trim()||!!this.previewMeta.trim()}get _resolvedExternalPreviewSrc(){return this.previewSrc.trim()||this.defaultImageSrc.trim()}get _resolvedPreviewKind(){return this._previewSource==="external"&&this._hasExternalPreview?this._resolvedExternalPreviewSrc?"image":"file":this._selectedPreviewKind}get _hasPreview(){return this._resolvedPreviewKind!=="empty"}get _resolvedLabel(){return this.label||(this.type==="image"?"Ladda upp bild":"Ladda upp fil")}get _resolvedSupportingText(){return this.supportingText||(this.type==="image"?"Dra och släpp en bild här, eller välj en bild från din dator.":"Dra och släpp en fil här, eller välj en fil från din dator.")}get _resolvedMetaText(){return this.metaText?this.metaText:this.type==="image"?"PNG, JPG, SVG, GIF, BMP, AVIF och WebP stöds.":"Alla filtyper stöds."}get _resolvedButtonLabel(){return this.buttonLabel||(this.type==="image"?"Välj bild":"Välj fil")}get _resolvedReplaceButtonLabel(){return this.replaceButtonLabel?this.replaceButtonLabel:this._resolvedPreviewKind==="image"?"Byt bild":"Byt fil"}get _resolvedRemoveButtonLabel(){return this.removeButtonLabel?this.removeButtonLabel:this._resolvedPreviewKind==="image"?"Ta bort bild":"Ta bort fil"}get _resolvedPreviewEyebrow(){return this.previewEyebrow?this.previewEyebrow:this._hasPreview?this._resolvedPreviewKind==="image"?"Uppladdad bild":"Uppladdad fil":"Förhandsvisning"}get _resolvedEmptyPreviewTitle(){return this.emptyPreviewTitle?this.emptyPreviewTitle:this.type==="image"?"Ingen bild uppladdad":"Ingen fil uppladdad"}get _resolvedEmptyPreviewMeta(){return this.emptyPreviewMeta?this.emptyPreviewMeta:this.type==="image"?"Förhandsvisningen visas här när du har laddat upp en bild.":"Förhandsvisningen visas här när du har laddat upp en fil."}get _resolvedPreviewSrc(){return this._previewSource==="external"&&this._hasExternalPreview?this._resolvedExternalPreviewSrc:this._selectedPreviewSrc}get _resolvedPreviewAlt(){return this._previewSource==="external"&&this._hasExternalPreview?this.previewAlt:this._selectedPreviewAlt}get _resolvedPreviewTitle(){return this._previewSource==="external"&&this._hasExternalPreview?this.previewTitle||(this._resolvedPreviewKind==="image"?"Uppladdad bild":"Uppladdad fil"):this._selectedPreviewTitle}get _resolvedPreviewMeta(){return this._previewSource==="external"&&this._hasExternalPreview?this.previewMeta:this._selectedPreviewMeta}disconnectedCallback(){this._form&&this._formDataHandler&&this._form.removeEventListener("formdata",this._formDataHandler),this._formDataHandler=null,this._form=null,this._revokeObjectUrl(),super.disconnectedCallback()}updated(e){e.has("type")&&this.type==="image"&&this._selectedPreviewKind==="file"&&this._clearSelectedFileState(),(e.has("disabled")||e.has("name"))&&this._syncFormValue()}connectedCallback(){super.connectedCallback(),this._syncFormValue(),this._form=this.closest("form"),this._form&&(this._formDataHandler=e=>{const t=e.formData;t&&this._appendFileToFormData(t)},this._form.addEventListener("formdata",this._formDataHandler))}formDisabledCallback(e){this.disabled=e}formResetCallback(){this.clearPreviewState()}_syncFormValue(){if(this._internals){if(this.disabled||!this.name.trim()||!this._selectedFile){this._internals.setFormValue(null);return}this._internals.setFormValue(this._selectedFile)}}_appendFileToFormData(e){const t=this.name.trim();if(this.disabled||!t||!this._selectedFile)return;e.getAll(t).some(s=>s instanceof File)||e.append(t,this._selectedFile,this._selectedFile.name)}openPicker(){if(this.disabled)return;const e=this.renderRoot.querySelector('[data-role="native-input"]');if(e){try{e.value=""}catch{}e.click()}}setPreviewState(e){this.previewSrc=e?.src??"",this.previewAlt=e?.alt??"",this.previewTitle=e?.title??"",this.previewMeta=e?.meta??"",this._previewSource="external"}clearPreviewState(){this.previewSrc="",this.previewAlt="",this.previewTitle="",this.previewMeta="",this._previewSource="external",this._clearSelectedFileState(),this._clearNativeInputValue()}_dispatch(e,t={},o=!1){const s=new CustomEvent(e,{detail:t,bubbles:!0,composed:!0,cancelable:o});return this.dispatchEvent(s),s}_handleFiles(e){const t=e&&e[0]?e[0]:null;!t||!this._isAcceptedFile(t)||(this._setSelectedFileState(t),this._dispatch("file-selected",{file:t}),this._dispatch("change",{file:t}))}_onZoneClick(e){this.disabled||e.composedPath().some(s=>s instanceof HTMLElement&&s.getAttribute("data-role")==="choose-button")||this.openPicker()}_onZoneKeydown(e){this.disabled||(e.key==="Enter"||e.key===" "||e.key==="Spacebar")&&(e.preventDefault(),this.openPicker())}_preventDefaultDrag(e){e.preventDefault(),e.stopPropagation()}_onDragEnter(e){this.disabled||(this._preventDefaultDrag(e),this._dragDepth+=1,this._isDragOver=!0)}_onDragOver(e){this.disabled||(this._preventDefaultDrag(e),this._isDragOver=!0)}_onDragLeave(e){this.disabled||(this._preventDefaultDrag(e),this._dragDepth=Math.max(0,this._dragDepth-1),this._dragDepth||(this._isDragOver=!1))}_onDrop(e){this.disabled||(this._preventDefaultDrag(e),this._dragDepth=0,this._isDragOver=!1,this._handleFiles(e.dataTransfer?.files??null))}_onNativeInputChange(e){const t=e.currentTarget;this._handleFiles(t?.files??null)}_onChooseButtonClick(e){e.preventDefault(),e.stopPropagation(),this.openPicker()}_onReplaceButtonClick(e){e.preventDefault(),e.stopPropagation(),this.openPicker()}_onRemoveButtonClick(e){e.preventDefault(),e.stopPropagation(),this._dispatch("clear-request",{},!0).defaultPrevented||this.clearPreviewState()}_isAcceptedFile(e){const t=this._resolvedAccept.trim();if(!t)return!0;const o=e.name.toLowerCase(),s=(e.type||"").toLowerCase(),l=t.split(",").map(n=>n.trim().toLowerCase()).filter(Boolean);return l.length?l.some(n=>n==="*/*"?!0:n.endsWith("/*")?s.startsWith(n.slice(0,-1)):n.startsWith(".")?o.endsWith(n):s===n):!0}_setSelectedFileState(e){const t=this._getPreviewKindForFile(e),o=this._getFileTypeLabel(e),s=this._formatFileSize(e.size);this._revokeObjectUrl(),this._selectedPreviewKind=t,this._selectedPreviewTitle=e.name||(t==="image"?"Uppladdad bild":"Uppladdad fil"),this._selectedPreviewMeta=[o,s].filter(Boolean).join(" • "),this._selectedPreviewAlt=t==="image"?e.name||"Uppladdad bild":"",this._selectedPreviewSrc="",t==="image"&&(this._objectUrl=URL.createObjectURL(e),this._selectedPreviewSrc=this._objectUrl),this._selectedFile=e,this._previewSource="internal",this._syncFormValue()}_clearSelectedFileState(){this._revokeObjectUrl(),this._selectedPreviewKind="empty",this._selectedPreviewSrc="",this._selectedPreviewAlt="",this._selectedPreviewTitle="",this._selectedPreviewMeta="",this._selectedFile=null,this._syncFormValue()}_clearNativeInputValue(){const e=this.renderRoot.querySelector('[data-role="native-input"]');if(e)try{e.value=""}catch{}}_revokeObjectUrl(){this._objectUrl&&(URL.revokeObjectURL(this._objectUrl),this._objectUrl="")}_getPreviewKindForFile(e){const t=(e.type||"").toLowerCase(),o=this._getFileExtension(e.name).toLowerCase();return t.startsWith("image/")||["png","jpg","jpeg","webp","svg","gif","bmp","avif"].includes(o)?"image":"file"}_getFileExtension(e){return/\.([^.]+)$/.exec(e||"")?.[1]??""}_getFileExtensionLabel(e){return(this._getFileExtension(e)||(this._resolvedPreviewKind==="image"?"IMG":"FIL")).slice(0,6).toUpperCase()}_getFileTypeLabel(e){if(e.type)return e.type;const t=this._getFileExtension(e.name);return t?t.toUpperCase():"Okänd filtyp"}_formatFileSize(e){return!Number.isFinite(e)||e<0?"":e<1024?`${e} B`:e<1024*1024?`${new Intl.NumberFormat("sv-SE",{maximumFractionDigits:1}).format(e/1024)} kB`:`${new Intl.NumberFormat("sv-SE",{maximumFractionDigits:1}).format(e/(1024*1024))} MB`}_renderPreviewMedia(){return this._resolvedPreviewKind==="image"&&this._resolvedPreviewSrc?d`<img class="scb-drop-zone__preview-image" src=${this._resolvedPreviewSrc} alt=${this._resolvedPreviewAlt} />`:this._hasPreview?d`
2
2
  <div class="scb-drop-zone__preview-file-card">
3
3
  <div class="scb-drop-zone__preview-file-card-inner">
4
4
  <span class="scb-drop-zone__preview-file-extension">${this._getFileExtensionLabel(this._resolvedPreviewTitle)}</span>
5
5
  <p class="scb-drop-zone__preview-file-label">Vald fil</p>
6
6
  </div>
7
7
  </div>
8
- `:p`
8
+ `:d`
9
9
  <div class="scb-drop-zone__preview-placeholder">
10
10
  <div class="scb-drop-zone__preview-placeholder-inner">
11
11
  <span class="scb-drop-zone__preview-placeholder-label">${this.type==="image"?"Bild":"Fil"}</span>
12
12
  </div>
13
13
  </div>
14
- `}_renderPreview(){if(!this.showPreview)return null;const e=this._hasPreview?this._resolvedPreviewTitle:this._resolvedEmptyPreviewTitle,t=this._hasPreview?this._resolvedPreviewMeta:this._resolvedEmptyPreviewMeta;return p`
14
+ `}_renderPreview(){if(!this.showPreview)return null;const e=this._hasPreview?this._resolvedPreviewTitle:this._resolvedEmptyPreviewTitle,t=this._hasPreview?this._resolvedPreviewMeta:this._resolvedEmptyPreviewMeta;return d`
15
15
  <div class="scb-drop-zone__preview">
16
16
  <div class="scb-drop-zone__preview-media">
17
17
  ${this._renderPreviewMedia()}
@@ -22,7 +22,7 @@ import{a as v,n as s,r as c,i as h,x as p,t as _}from"../../vendor/vendor.js";(f
22
22
  <h3 class="scb-drop-zone__preview-title">${e}</h3>
23
23
  <p class="scb-drop-zone__preview-meta">${t}</p>
24
24
 
25
- ${this._hasPreview?p`
25
+ ${this._hasPreview?d`
26
26
  <div class="scb-drop-zone__preview-actions">
27
27
  <scb-button
28
28
  data-role="replace-button"
@@ -42,7 +42,7 @@ import{a as v,n as s,r as c,i as h,x as p,t as _}from"../../vendor/vendor.js";(f
42
42
  `:null}
43
43
  </div>
44
44
  </div>
45
- `}render(){const e={"scb-drop-zone__surface":!0,"is-dragover":this._isDragOver};return p`
45
+ `}render(){const e={"scb-drop-zone__surface":!0,"is-dragover":this._isDragOver};return d`
46
46
  <div class="scb-drop-zone">
47
47
  <div class="scb-drop-zone__layout ${this.showPreview?"scb-drop-zone__layout--with-preview":""}">
48
48
  <div
@@ -62,6 +62,7 @@ import{a as v,n as s,r as c,i as h,x as p,t as _}from"../../vendor/vendor.js";(f
62
62
  class="scb-drop-zone__native-input"
63
63
  data-role="native-input"
64
64
  type="file"
65
+ .name=${this.name}
65
66
  .accept=${this._resolvedAccept}
66
67
  ?disabled=${this.disabled}
67
68
  @change=${this._onNativeInputChange}
@@ -70,7 +71,7 @@ import{a as v,n as s,r as c,i as h,x as p,t as _}from"../../vendor/vendor.js";(f
70
71
  <div class="scb-drop-zone__inner">
71
72
  <h2 class="scb-drop-zone__title">${this._resolvedLabel}</h2>
72
73
  <p class="scb-drop-zone__lead">${this._resolvedSupportingText}</p>
73
- ${this._resolvedMetaText?p`<p class="scb-drop-zone__meta">${this._resolvedMetaText}</p>`:null}
74
+ ${this._resolvedMetaText?d`<p class="scb-drop-zone__meta">${this._resolvedMetaText}</p>`:null}
74
75
 
75
76
  <div class="scb-drop-zone__actions">
76
77
  <scb-button
@@ -87,7 +88,7 @@ import{a as v,n as s,r as c,i as h,x as p,t as _}from"../../vendor/vendor.js";(f
87
88
  ${this._renderPreview()}
88
89
  </div>
89
90
  </div>
90
- `}};r.styles=v`
91
+ `}};r.formAssociated=!0;r.styles=h`
91
92
  :host {
92
93
  display: block;
93
94
  width: 100%;
@@ -324,4 +325,4 @@ import{a as v,n as s,r as c,i as h,x as p,t as _}from"../../vendor/vendor.js";(f
324
325
  grid-template-columns: 1fr;
325
326
  }
326
327
  }
327
- `;i([s({type:String,reflect:!0})],r.prototype,"type",2);i([s({type:String})],r.prototype,"label",2);i([s({type:String,attribute:"supporting-text"})],r.prototype,"supportingText",2);i([s({type:String,attribute:"meta-text"})],r.prototype,"metaText",2);i([s({type:String,attribute:"button-label"})],r.prototype,"buttonLabel",2);i([s({type:String,attribute:"replace-button-label"})],r.prototype,"replaceButtonLabel",2);i([s({type:String,attribute:"remove-button-label"})],r.prototype,"removeButtonLabel",2);i([s({type:String,attribute:"preview-eyebrow"})],r.prototype,"previewEyebrow",2);i([s({type:String,attribute:"empty-preview-title"})],r.prototype,"emptyPreviewTitle",2);i([s({type:String,attribute:"empty-preview-meta"})],r.prototype,"emptyPreviewMeta",2);i([s({type:String})],r.prototype,"accept",2);i([s({type:Boolean,attribute:"show-preview",reflect:!0})],r.prototype,"showPreview",2);i([s({type:Boolean,reflect:!0})],r.prototype,"disabled",2);i([s({type:String,attribute:!1})],r.prototype,"previewSrc",2);i([s({type:String,attribute:"default-image-src"})],r.prototype,"defaultImageSrc",2);i([s({type:String,attribute:!1})],r.prototype,"previewAlt",2);i([s({type:String,attribute:!1})],r.prototype,"previewTitle",2);i([s({type:String,attribute:!1})],r.prototype,"previewMeta",2);i([c()],r.prototype,"_isDragOver",2);i([c()],r.prototype,"_selectedPreviewKind",2);i([c()],r.prototype,"_selectedPreviewSrc",2);i([c()],r.prototype,"_selectedPreviewAlt",2);i([c()],r.prototype,"_selectedPreviewTitle",2);i([c()],r.prototype,"_selectedPreviewMeta",2);r=i([_("scb-drop-zone")],r);
328
+ `;i([a({type:String,reflect:!0})],r.prototype,"type",2);i([a({type:String})],r.prototype,"name",2);i([a({type:String})],r.prototype,"label",2);i([a({type:String,attribute:"supporting-text"})],r.prototype,"supportingText",2);i([a({type:String,attribute:"meta-text"})],r.prototype,"metaText",2);i([a({type:String,attribute:"button-label"})],r.prototype,"buttonLabel",2);i([a({type:String,attribute:"replace-button-label"})],r.prototype,"replaceButtonLabel",2);i([a({type:String,attribute:"remove-button-label"})],r.prototype,"removeButtonLabel",2);i([a({type:String,attribute:"preview-eyebrow"})],r.prototype,"previewEyebrow",2);i([a({type:String,attribute:"empty-preview-title"})],r.prototype,"emptyPreviewTitle",2);i([a({type:String,attribute:"empty-preview-meta"})],r.prototype,"emptyPreviewMeta",2);i([a({type:String})],r.prototype,"accept",2);i([a({type:Boolean,attribute:"show-preview",reflect:!0})],r.prototype,"showPreview",2);i([a({type:Boolean,reflect:!0})],r.prototype,"disabled",2);i([a({type:String,attribute:!1})],r.prototype,"previewSrc",2);i([a({type:String,attribute:"default-image-src"})],r.prototype,"defaultImageSrc",2);i([a({type:String,attribute:!1})],r.prototype,"previewAlt",2);i([a({type:String,attribute:!1})],r.prototype,"previewTitle",2);i([a({type:String,attribute:!1})],r.prototype,"previewMeta",2);i([c()],r.prototype,"_isDragOver",2);i([c()],r.prototype,"_selectedPreviewKind",2);i([c()],r.prototype,"_selectedPreviewSrc",2);i([c()],r.prototype,"_selectedPreviewAlt",2);i([c()],r.prototype,"_selectedPreviewTitle",2);i([c()],r.prototype,"_selectedPreviewMeta",2);r=i([_("scb-drop-zone")],r);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scb-wc-test",
3
- "version": "0.1.302",
3
+ "version": "0.1.304",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -386,5 +386,5 @@
386
386
  },
387
387
  "./mvc/*": "./mvc/*"
388
388
  },
389
- "buildHash": "81A7B8AEF0A7AD866812939DA5CC01A86044D04D7199E838A258C02B73BD7A1E"
389
+ "buildHash": "6C84ECF1D73ED9EB332947E12F404C6A757F395766B380C36C97B24EB3CB990D"
390
390
  }
@@ -1,8 +1,12 @@
1
1
  import { LitElement, TemplateResult } from 'lit';
2
2
  type DropZoneType = 'default' | 'image';
3
3
  export declare class ScbDropZone extends LitElement {
4
+ static formAssociated: boolean;
5
+ private _internals;
4
6
  /** Variant som styr vilka filer som får väljas som standard. */
5
7
  type: DropZoneType;
8
+ /** Namn som används när komponenten skickas i formulär. */
9
+ name: string;
6
10
  /** Rubrik i drop-zonen. */
7
11
  label: string;
8
12
  /** Förklarande text i drop-zonen. */
@@ -46,6 +50,10 @@ export declare class ScbDropZone extends LitElement {
46
50
  private _dragDepth;
47
51
  private _previewSource;
48
52
  private _objectUrl;
53
+ private _selectedFile;
54
+ private _form;
55
+ private _formDataHandler;
56
+ constructor();
49
57
  static styles: import('lit').CSSResult;
50
58
  private get _resolvedAccept();
51
59
  private get _hasExternalPreview();
@@ -67,6 +75,11 @@ export declare class ScbDropZone extends LitElement {
67
75
  private get _resolvedPreviewMeta();
68
76
  disconnectedCallback(): void;
69
77
  updated(changedProperties: Map<string, unknown>): void;
78
+ connectedCallback(): void;
79
+ formDisabledCallback(disabled: boolean): void;
80
+ formResetCallback(): void;
81
+ private _syncFormValue;
82
+ private _appendFileToFormData;
70
83
  openPicker(): void;
71
84
  setPreviewState(state: {
72
85
  src?: string;
@@ -1,13 +1,13 @@
1
- import { css as v, LitElement as h, html as p } from "lit";
2
- import { property as s, state as d, customElement as u } from "lit/decorators.js";
3
- var _ = Object.defineProperty, b = Object.getOwnPropertyDescriptor, i = (e, t, o, a) => {
4
- for (var l = a > 1 ? void 0 : a ? b(t, o) : t, n = e.length - 1, c; n >= 0; n--)
1
+ import { css as h, LitElement as v, html as p } from "lit";
2
+ import { property as s, state as d, customElement as _ } from "lit/decorators.js";
3
+ var u = Object.defineProperty, m = Object.getOwnPropertyDescriptor, i = (e, t, o, a) => {
4
+ for (var l = a > 1 ? void 0 : a ? m(t, o) : t, n = e.length - 1, c; n >= 0; n--)
5
5
  (c = e[n]) && (l = (a ? c(t, o, l) : c(l)) || l);
6
- return a && l && _(t, o, l), l;
6
+ return a && l && u(t, o, l), l;
7
7
  };
8
- let r = class extends h {
8
+ let r = class extends v {
9
9
  constructor() {
10
- super(...arguments), this.type = "default", this.label = "", this.supportingText = "", this.metaText = "", this.buttonLabel = "", this.replaceButtonLabel = "", this.removeButtonLabel = "", this.previewEyebrow = "", this.emptyPreviewTitle = "", this.emptyPreviewMeta = "", this.accept = "", this.showPreview = !0, this.disabled = !1, this.previewSrc = "", this.defaultImageSrc = "", this.previewAlt = "", this.previewTitle = "", this.previewMeta = "", this._isDragOver = !1, this._selectedPreviewKind = "empty", this._selectedPreviewSrc = "", this._selectedPreviewAlt = "", this._selectedPreviewTitle = "", this._selectedPreviewMeta = "", this._dragDepth = 0, this._previewSource = "external", this._objectUrl = "";
10
+ super(), this._internals = null, this.type = "default", this.name = "", this.label = "", this.supportingText = "", this.metaText = "", this.buttonLabel = "", this.replaceButtonLabel = "", this.removeButtonLabel = "", this.previewEyebrow = "", this.emptyPreviewTitle = "", this.emptyPreviewMeta = "", this.accept = "", this.showPreview = !0, this.disabled = !1, this.previewSrc = "", this.defaultImageSrc = "", this.previewAlt = "", this.previewTitle = "", this.previewMeta = "", this._isDragOver = !1, this._selectedPreviewKind = "empty", this._selectedPreviewSrc = "", this._selectedPreviewAlt = "", this._selectedPreviewTitle = "", this._selectedPreviewMeta = "", this._dragDepth = 0, this._previewSource = "external", this._objectUrl = "", this._selectedFile = null, this._form = null, this._formDataHandler = null, "attachInternals" in this && (this._internals = this.attachInternals());
11
11
  }
12
12
  get _resolvedAccept() {
13
13
  return this.accept.trim() || (this.type === "image" ? "image/*,.png,.jpg,.jpeg,.webp,.svg,.gif,.bmp,.avif" : "");
@@ -64,10 +64,37 @@ let r = class extends h {
64
64
  return this._previewSource === "external" && this._hasExternalPreview ? this.previewMeta : this._selectedPreviewMeta;
65
65
  }
66
66
  disconnectedCallback() {
67
- this._revokeObjectUrl(), super.disconnectedCallback();
67
+ this._form && this._formDataHandler && this._form.removeEventListener("formdata", this._formDataHandler), this._formDataHandler = null, this._form = null, this._revokeObjectUrl(), super.disconnectedCallback();
68
68
  }
69
69
  updated(e) {
70
- e.has("type") && this.type === "image" && this._selectedPreviewKind === "file" && this._clearSelectedFileState();
70
+ e.has("type") && this.type === "image" && this._selectedPreviewKind === "file" && this._clearSelectedFileState(), (e.has("disabled") || e.has("name")) && this._syncFormValue();
71
+ }
72
+ connectedCallback() {
73
+ super.connectedCallback(), this._syncFormValue(), this._form = this.closest("form"), this._form && (this._formDataHandler = (e) => {
74
+ const t = e.formData;
75
+ t && this._appendFileToFormData(t);
76
+ }, this._form.addEventListener("formdata", this._formDataHandler));
77
+ }
78
+ formDisabledCallback(e) {
79
+ this.disabled = e;
80
+ }
81
+ formResetCallback() {
82
+ this.clearPreviewState();
83
+ }
84
+ _syncFormValue() {
85
+ if (this._internals) {
86
+ if (this.disabled || !this.name.trim() || !this._selectedFile) {
87
+ this._internals.setFormValue(null);
88
+ return;
89
+ }
90
+ this._internals.setFormValue(this._selectedFile);
91
+ }
92
+ }
93
+ _appendFileToFormData(e) {
94
+ const t = this.name.trim();
95
+ if (this.disabled || !t || !this._selectedFile)
96
+ return;
97
+ e.getAll(t).some((a) => a instanceof File) || e.append(t, this._selectedFile, this._selectedFile.name);
71
98
  }
72
99
  openPicker() {
73
100
  if (this.disabled)
@@ -141,10 +168,10 @@ let r = class extends h {
141
168
  }
142
169
  _setSelectedFileState(e) {
143
170
  const t = this._getPreviewKindForFile(e), o = this._getFileTypeLabel(e), a = this._formatFileSize(e.size);
144
- this._revokeObjectUrl(), this._selectedPreviewKind = t, this._selectedPreviewTitle = e.name || (t === "image" ? "Uppladdad bild" : "Uppladdad fil"), this._selectedPreviewMeta = [o, a].filter(Boolean).join(" • "), this._selectedPreviewAlt = t === "image" ? e.name || "Uppladdad bild" : "", this._selectedPreviewSrc = "", t === "image" && (this._objectUrl = URL.createObjectURL(e), this._selectedPreviewSrc = this._objectUrl), this._previewSource = "internal";
171
+ this._revokeObjectUrl(), this._selectedPreviewKind = t, this._selectedPreviewTitle = e.name || (t === "image" ? "Uppladdad bild" : "Uppladdad fil"), this._selectedPreviewMeta = [o, a].filter(Boolean).join(" • "), this._selectedPreviewAlt = t === "image" ? e.name || "Uppladdad bild" : "", this._selectedPreviewSrc = "", t === "image" && (this._objectUrl = URL.createObjectURL(e), this._selectedPreviewSrc = this._objectUrl), this._selectedFile = e, this._previewSource = "internal", this._syncFormValue();
145
172
  }
146
173
  _clearSelectedFileState() {
147
- this._revokeObjectUrl(), this._selectedPreviewKind = "empty", this._selectedPreviewSrc = "", this._selectedPreviewAlt = "", this._selectedPreviewTitle = "", this._selectedPreviewMeta = "";
174
+ this._revokeObjectUrl(), this._selectedPreviewKind = "empty", this._selectedPreviewSrc = "", this._selectedPreviewAlt = "", this._selectedPreviewTitle = "", this._selectedPreviewMeta = "", this._selectedFile = null, this._syncFormValue();
148
175
  }
149
176
  _clearNativeInputValue() {
150
177
  const e = this.renderRoot.querySelector('[data-role="native-input"]');
@@ -255,6 +282,7 @@ let r = class extends h {
255
282
  class="scb-drop-zone__native-input"
256
283
  data-role="native-input"
257
284
  type="file"
285
+ .name=${this.name}
258
286
  .accept=${this._resolvedAccept}
259
287
  ?disabled=${this.disabled}
260
288
  @change=${this._onNativeInputChange}
@@ -283,7 +311,8 @@ let r = class extends h {
283
311
  `;
284
312
  }
285
313
  };
286
- r.styles = v`
314
+ r.formAssociated = !0;
315
+ r.styles = h`
287
316
  :host {
288
317
  display: block;
289
318
  width: 100%;
@@ -524,6 +553,9 @@ r.styles = v`
524
553
  i([
525
554
  s({ type: String, reflect: !0 })
526
555
  ], r.prototype, "type", 2);
556
+ i([
557
+ s({ type: String })
558
+ ], r.prototype, "name", 2);
527
559
  i([
528
560
  s({ type: String })
529
561
  ], r.prototype, "label", 2);
@@ -594,7 +626,7 @@ i([
594
626
  d()
595
627
  ], r.prototype, "_selectedPreviewMeta", 2);
596
628
  r = i([
597
- u("scb-drop-zone")
629
+ _("scb-drop-zone")
598
630
  ], r);
599
631
  export {
600
632
  r as ScbDropZone
@@ -909,7 +909,7 @@
909
909
  * @license
910
910
  * Copyright 2023 Google LLC
911
911
  * SPDX-License-Identifier: Apache-2.0
912
- */const ja={END_START:"end-start",START_START:"start-start",START_END:"start-end"};class xb{constructor(t,i){this.host=t,this.getProperties=i,this.surfaceStylesInternal={display:"none"},this.lastValues={isOpen:!1},this.host.addController(this)}get surfaceStyles(){return this.surfaceStylesInternal}async position(){const{surfaceEl:t,anchorEl:i,anchorCorner:s,surfaceCorner:r,positioning:a,xOffset:n,yOffset:l,repositionStrategy:d}=this.getProperties(),p=s.toLowerCase().trim(),b=r.toLowerCase().trim();if(!t||!i)return;const u=window.innerWidth,v=window.innerHeight,g=document.createElement("div");g.style.opacity="0",g.style.position="fixed",g.style.display="block",g.style.inset="0",document.body.appendChild(g);const f=g.getBoundingClientRect();g.remove();const x=window.innerHeight-f.bottom,k=window.innerWidth-f.right;this.surfaceStylesInternal={display:"block",opacity:"0"},this.host.requestUpdate(),await this.host.updateComplete,t.popover&&t.isConnected&&t.showPopover();const C=t.getSurfacePositionClientRect?t.getSurfacePositionClientRect():t.getBoundingClientRect(),S=i.getSurfacePositionClientRect?i.getSurfacePositionClientRect():i.getBoundingClientRect(),[B,F]=b.split("-"),[j,Ct]=p.split("-"),de=getComputedStyle(t).direction==="ltr";let{blockInset:H,blockOutOfBoundsCorrection:Xe,surfaceBlockProperty:R}=this.calculateBlock({surfaceRect:C,anchorRect:S,anchorBlock:j,surfaceBlock:B,yOffset:l,positioning:a,windowInnerHeight:v,blockScrollbarHeight:x});if(Xe){const yi=B==="start"?"end":"start",ws=j==="start"?"end":"start",W=this.calculateBlock({surfaceRect:C,anchorRect:S,anchorBlock:ws,surfaceBlock:yi,yOffset:l,positioning:a,windowInnerHeight:v,blockScrollbarHeight:x});Xe>W.blockOutOfBoundsCorrection&&(H=W.blockInset,Xe=W.blockOutOfBoundsCorrection,R=W.surfaceBlockProperty)}let{inlineInset:ie,inlineOutOfBoundsCorrection:Je,surfaceInlineProperty:ii}=this.calculateInline({surfaceRect:C,anchorRect:S,anchorInline:Ct,surfaceInline:F,xOffset:n,positioning:a,isLTR:de,windowInnerWidth:u,inlineScrollbarWidth:k});if(Je){const yi=F==="start"?"end":"start",ws=Ct==="start"?"end":"start",W=this.calculateInline({surfaceRect:C,anchorRect:S,anchorInline:ws,surfaceInline:yi,xOffset:n,positioning:a,isLTR:de,windowInnerWidth:u,inlineScrollbarWidth:k});Math.abs(Je)>Math.abs(W.inlineOutOfBoundsCorrection)&&(ie=W.inlineInset,Je=W.inlineOutOfBoundsCorrection,ii=W.surfaceInlineProperty)}d==="move"&&(H=H-Xe,ie=ie-Je),this.surfaceStylesInternal={display:"block",opacity:"1",[R]:`${H}px`,[ii]:`${ie}px`},d==="resize"&&(Xe&&(this.surfaceStylesInternal.height=`${C.height-Xe}px`),Je&&(this.surfaceStylesInternal.width=`${C.width-Je}px`)),this.host.requestUpdate()}calculateBlock(t){const{surfaceRect:i,anchorRect:s,anchorBlock:r,surfaceBlock:a,yOffset:n,positioning:l,windowInnerHeight:d,blockScrollbarHeight:p}=t,b=l==="fixed"||l==="document"?1:0,u=l==="document"?1:0,v=a==="start"?1:0,g=a==="end"?1:0,x=(r!==a?1:0)*s.height+n,k=v*s.top+g*(d-s.bottom-p),C=v*window.scrollY-g*window.scrollY,S=Math.abs(Math.min(0,d-k-x-i.height));return{blockInset:b*k+u*C+x,blockOutOfBoundsCorrection:S,surfaceBlockProperty:a==="start"?"inset-block-start":"inset-block-end"}}calculateInline(t){const{isLTR:i,surfaceInline:s,anchorInline:r,anchorRect:a,surfaceRect:n,xOffset:l,positioning:d,windowInnerWidth:p,inlineScrollbarWidth:b}=t,u=d==="fixed"||d==="document"?1:0,v=d==="document"?1:0,g=i?1:0,f=i?0:1,x=s==="start"?1:0,k=s==="end"?1:0,S=(r!==s?1:0)*a.width+l,B=x*a.left+k*(p-a.right-b),F=x*(p-a.right-b)+k*a.left,j=g*B+f*F,Ct=x*window.scrollX-k*window.scrollX,de=k*window.scrollX-x*window.scrollX,H=g*Ct+f*de,Xe=Math.abs(Math.min(0,p-j-S-n.width)),R=u*j+S+v*H;let ie=s==="start"?"inset-inline-start":"inset-inline-end";return(d==="document"||d==="fixed")&&(s==="start"&&i||s==="end"&&!i?ie="left":ie="right"),{inlineInset:R,inlineOutOfBoundsCorrection:Xe,surfaceInlineProperty:ie}}hostUpdate(){this.onUpdate()}hostUpdated(){this.onUpdate()}async onUpdate(){const t=this.getProperties();let i=!1;for(const[n,l]of Object.entries(t))if(i=i||l!==this.lastValues[n],i)break;const s=this.lastValues.isOpen!==t.isOpen,r=!!t.anchorEl,a=!!t.surfaceEl;i&&r&&a&&(this.lastValues.isOpen=t.isOpen,t.isOpen?(this.lastValues=t,await this.position(),t.onOpen()):s&&(await t.beforeClose(),this.close(),t.onClose()))}close(){this.surfaceStylesInternal={display:"none"},this.host.requestUpdate();const t=this.getProperties().surfaceEl;t!=null&&t.popover&&(t!=null&&t.isConnected)&&t.hidePopover()}}/**
912
+ */const ja={END_START:"end-start",START_START:"start-start",START_END:"start-end"};class xb{constructor(t,i){this.host=t,this.getProperties=i,this.surfaceStylesInternal={display:"none"},this.lastValues={isOpen:!1},this.host.addController(this)}get surfaceStyles(){return this.surfaceStylesInternal}async position(){const{surfaceEl:t,anchorEl:i,anchorCorner:s,surfaceCorner:r,positioning:a,xOffset:n,yOffset:l,repositionStrategy:d}=this.getProperties(),p=s.toLowerCase().trim(),b=r.toLowerCase().trim();if(!t||!i)return;const u=window.innerWidth,v=window.innerHeight,g=document.createElement("div");g.style.opacity="0",g.style.position="fixed",g.style.display="block",g.style.inset="0",document.body.appendChild(g);const f=g.getBoundingClientRect();g.remove();const x=window.innerHeight-f.bottom,k=window.innerWidth-f.right;this.surfaceStylesInternal={display:"block",opacity:"0"},this.host.requestUpdate(),await this.host.updateComplete,t.popover&&t.isConnected&&t.showPopover();const C=t.getSurfacePositionClientRect?t.getSurfacePositionClientRect():t.getBoundingClientRect(),S=i.getSurfacePositionClientRect?i.getSurfacePositionClientRect():i.getBoundingClientRect(),[B,F]=b.split("-"),[K,Ct]=p.split("-"),de=getComputedStyle(t).direction==="ltr";let{blockInset:H,blockOutOfBoundsCorrection:Xe,surfaceBlockProperty:R}=this.calculateBlock({surfaceRect:C,anchorRect:S,anchorBlock:K,surfaceBlock:B,yOffset:l,positioning:a,windowInnerHeight:v,blockScrollbarHeight:x});if(Xe){const yi=B==="start"?"end":"start",ws=K==="start"?"end":"start",W=this.calculateBlock({surfaceRect:C,anchorRect:S,anchorBlock:ws,surfaceBlock:yi,yOffset:l,positioning:a,windowInnerHeight:v,blockScrollbarHeight:x});Xe>W.blockOutOfBoundsCorrection&&(H=W.blockInset,Xe=W.blockOutOfBoundsCorrection,R=W.surfaceBlockProperty)}let{inlineInset:ie,inlineOutOfBoundsCorrection:Je,surfaceInlineProperty:ii}=this.calculateInline({surfaceRect:C,anchorRect:S,anchorInline:Ct,surfaceInline:F,xOffset:n,positioning:a,isLTR:de,windowInnerWidth:u,inlineScrollbarWidth:k});if(Je){const yi=F==="start"?"end":"start",ws=Ct==="start"?"end":"start",W=this.calculateInline({surfaceRect:C,anchorRect:S,anchorInline:ws,surfaceInline:yi,xOffset:n,positioning:a,isLTR:de,windowInnerWidth:u,inlineScrollbarWidth:k});Math.abs(Je)>Math.abs(W.inlineOutOfBoundsCorrection)&&(ie=W.inlineInset,Je=W.inlineOutOfBoundsCorrection,ii=W.surfaceInlineProperty)}d==="move"&&(H=H-Xe,ie=ie-Je),this.surfaceStylesInternal={display:"block",opacity:"1",[R]:`${H}px`,[ii]:`${ie}px`},d==="resize"&&(Xe&&(this.surfaceStylesInternal.height=`${C.height-Xe}px`),Je&&(this.surfaceStylesInternal.width=`${C.width-Je}px`)),this.host.requestUpdate()}calculateBlock(t){const{surfaceRect:i,anchorRect:s,anchorBlock:r,surfaceBlock:a,yOffset:n,positioning:l,windowInnerHeight:d,blockScrollbarHeight:p}=t,b=l==="fixed"||l==="document"?1:0,u=l==="document"?1:0,v=a==="start"?1:0,g=a==="end"?1:0,x=(r!==a?1:0)*s.height+n,k=v*s.top+g*(d-s.bottom-p),C=v*window.scrollY-g*window.scrollY,S=Math.abs(Math.min(0,d-k-x-i.height));return{blockInset:b*k+u*C+x,blockOutOfBoundsCorrection:S,surfaceBlockProperty:a==="start"?"inset-block-start":"inset-block-end"}}calculateInline(t){const{isLTR:i,surfaceInline:s,anchorInline:r,anchorRect:a,surfaceRect:n,xOffset:l,positioning:d,windowInnerWidth:p,inlineScrollbarWidth:b}=t,u=d==="fixed"||d==="document"?1:0,v=d==="document"?1:0,g=i?1:0,f=i?0:1,x=s==="start"?1:0,k=s==="end"?1:0,S=(r!==s?1:0)*a.width+l,B=x*a.left+k*(p-a.right-b),F=x*(p-a.right-b)+k*a.left,K=g*B+f*F,Ct=x*window.scrollX-k*window.scrollX,de=k*window.scrollX-x*window.scrollX,H=g*Ct+f*de,Xe=Math.abs(Math.min(0,p-K-S-n.width)),R=u*K+S+v*H;let ie=s==="start"?"inset-inline-start":"inset-inline-end";return(d==="document"||d==="fixed")&&(s==="start"&&i||s==="end"&&!i?ie="left":ie="right"),{inlineInset:R,inlineOutOfBoundsCorrection:Xe,surfaceInlineProperty:ie}}hostUpdate(){this.onUpdate()}hostUpdated(){this.onUpdate()}async onUpdate(){const t=this.getProperties();let i=!1;for(const[n,l]of Object.entries(t))if(i=i||l!==this.lastValues[n],i)break;const s=this.lastValues.isOpen!==t.isOpen,r=!!t.anchorEl,a=!!t.surfaceEl;i&&r&&a&&(this.lastValues.isOpen=t.isOpen,t.isOpen?(this.lastValues=t,await this.position(),t.onOpen()):s&&(await t.beforeClose(),this.close(),t.onClose()))}close(){this.surfaceStylesInternal={display:"none"},this.host.requestUpdate();const t=this.getProperties().surfaceEl;t!=null&&t.popover&&(t!=null&&t.isConnected)&&t.hidePopover()}}/**
913
913
  * @license
914
914
  * Copyright 2023 Google LLC
915
915
  * SPDX-License-Identifier: Apache-2.0
@@ -935,7 +935,7 @@
935
935
  @activate-typeahead=${this.handleActivateTypeahead}
936
936
  @stay-open-on-focusout=${this.handleStayOpenOnFocusout}
937
937
  @close-on-focusout=${this.handleCloseOnFocusout}
938
- @slotchange=${this.listController.onSlotchange}></slot>`}renderElevation(){return c`<md-elevation part="elevation"></md-elevation>`}getSurfaceClasses(){return{open:this.open,fixed:this.positioning==="fixed","has-overflow":this.hasOverflow}}captureKeydown(t){t.target===this&&!t.defaultPrevented&&kd(t.code)&&(t.preventDefault(),this.close()),this.typeaheadController.onKeydown(t)}async animateOpen(){const t=this.surfaceEl,i=this.slotEl;if(!t||!i)return!0;const s=this.openDirection;this.dispatchEvent(new Event("opening")),t.classList.toggle("animating",!0);const r=this.openCloseAnimationSignal.start(),a=t.offsetHeight,n=s==="UP",l=this.items,d=500,p=50,b=250,u=(d-b)/l.length,v=t.animate([{height:"0px"},{height:`${a}px`}],{duration:d,easing:si.EMPHASIZED}),g=i.animate([{transform:n?`translateY(-${a}px)`:""},{transform:""}],{duration:d,easing:si.EMPHASIZED}),f=t.animate([{opacity:0},{opacity:1}],p),x=[];for(let S=0;S<l.length;S++){const B=n?l.length-1-S:S,F=l[B],j=F.animate([{opacity:0},{opacity:1}],{duration:b,delay:u*S});F.classList.toggle("md-menu-hidden",!0),j.addEventListener("finish",()=>{F.classList.toggle("md-menu-hidden",!1)}),x.push([F,j])}let k=S=>{};const C=new Promise(S=>{k=S});return r.addEventListener("abort",()=>{v.cancel(),g.cancel(),f.cancel(),x.forEach(([S,B])=>{S.classList.toggle("md-menu-hidden",!1),B.cancel()}),k(!0)}),v.addEventListener("finish",()=>{t.classList.toggle("animating",!1),this.openCloseAnimationSignal.finish(),k(!1)}),await C}animateClose(){let t;const i=new Promise(j=>{t=j}),s=this.surfaceEl,r=this.slotEl;if(!s||!r)return t(!1),i;const n=this.openDirection==="UP";this.dispatchEvent(new Event("closing")),s.classList.toggle("animating",!0);const l=this.openCloseAnimationSignal.start(),d=s.offsetHeight,p=this.items,b=150,u=50,v=b-u,g=50,f=50,x=.35,k=(b-f-g)/p.length,C=s.animate([{height:`${d}px`},{height:`${d*x}px`}],{duration:b,easing:si.EMPHASIZED_ACCELERATE}),S=r.animate([{transform:""},{transform:n?`translateY(-${d*(1-x)}px)`:""}],{duration:b,easing:si.EMPHASIZED_ACCELERATE}),B=s.animate([{opacity:1},{opacity:0}],{duration:u,delay:v}),F=[];for(let j=0;j<p.length;j++){const Ct=n?j:p.length-1-j,de=p[Ct],H=de.animate([{opacity:1},{opacity:0}],{duration:g,delay:f+k*j});H.addEventListener("finish",()=>{de.classList.toggle("md-menu-hidden",!0)}),F.push([de,H])}return l.addEventListener("abort",()=>{C.cancel(),S.cancel(),B.cancel(),F.forEach(([j,Ct])=>{Ct.cancel(),j.classList.toggle("md-menu-hidden",!1)}),t(!1)}),C.addEventListener("finish",()=>{s.classList.toggle("animating",!1),F.forEach(([j])=>{j.classList.toggle("md-menu-hidden",!1)}),this.openCloseAnimationSignal.finish(),this.dispatchEvent(new Event("closed")),t(!0)}),i}handleKeydown(t){this.pointerPath=[],this.listController.handleKeydown(t)}setUpGlobalEventListeners(){document.addEventListener("click",this.onDocumentClick,{capture:!0}),window.addEventListener("pointerdown",this.onWindowPointerdown),document.addEventListener("resize",this.onWindowResize,{passive:!0}),window.addEventListener("resize",this.onWindowResize,{passive:!0})}cleanUpGlobalEventListeners(){document.removeEventListener("click",this.onDocumentClick,{capture:!0}),window.removeEventListener("pointerdown",this.onWindowPointerdown),document.removeEventListener("resize",this.onWindowResize),window.removeEventListener("resize",this.onWindowResize)}onCloseMenu(){this.close()}onDeactivateItems(t){t.stopPropagation(),this.listController.onDeactivateItems()}onRequestActivation(t){t.stopPropagation(),this.listController.onRequestActivation(t)}handleDeactivateTypeahead(t){t.stopPropagation(),this.typeaheadActive=!1}handleActivateTypeahead(t){t.stopPropagation(),this.typeaheadActive=!0}handleStayOpenOnFocusout(t){t.stopPropagation(),this.stayOpenOnFocusout=!0}handleCloseOnFocusout(t){t.stopPropagation(),this.stayOpenOnFocusout=!1}close(){this.open=!1,this.slotItems.forEach(i=>{var s;(s=i.close)==null||s.call(i)})}show(){this.open=!0}activateNextItem(){return this.listController.activateNextItem()??null}activatePreviousItem(){return this.listController.activatePreviousItem()??null}reposition(){this.open&&this.menuPositionController.position()}}h([I(".menu")],ye.prototype,"surfaceEl",void 0),h([I("slot")],ye.prototype,"slotEl",void 0),h([o()],ye.prototype,"anchor",void 0),h([o()],ye.prototype,"positioning",void 0),h([o({type:Boolean})],ye.prototype,"quick",void 0),h([o({type:Boolean,attribute:"has-overflow"})],ye.prototype,"hasOverflow",void 0),h([o({type:Boolean,reflect:!0})],ye.prototype,"open",void 0),h([o({type:Number,attribute:"x-offset"})],ye.prototype,"xOffset",void 0),h([o({type:Number,attribute:"y-offset"})],ye.prototype,"yOffset",void 0),h([o({type:Number,attribute:"typeahead-delay"})],ye.prototype,"typeaheadDelay",void 0),h([o({attribute:"anchor-corner"})],ye.prototype,"anchorCorner",void 0),h([o({attribute:"menu-corner"})],ye.prototype,"menuCorner",void 0),h([o({type:Boolean,attribute:"stay-open-on-outside-click"})],ye.prototype,"stayOpenOnOutsideClick",void 0),h([o({type:Boolean,attribute:"stay-open-on-focusout"})],ye.prototype,"stayOpenOnFocusout",void 0),h([o({type:Boolean,attribute:"skip-restore-focus"})],ye.prototype,"skipRestoreFocus",void 0),h([o({attribute:"default-focus"})],ye.prototype,"defaultFocus",void 0),h([o({type:Boolean,attribute:"no-navigation-wrap"})],ye.prototype,"noNavigationWrap",void 0),h([We({flatten:!0})],ye.prototype,"slotItems",void 0),h([T()],ye.prototype,"typeaheadActive",void 0);/**
938
+ @slotchange=${this.listController.onSlotchange}></slot>`}renderElevation(){return c`<md-elevation part="elevation"></md-elevation>`}getSurfaceClasses(){return{open:this.open,fixed:this.positioning==="fixed","has-overflow":this.hasOverflow}}captureKeydown(t){t.target===this&&!t.defaultPrevented&&kd(t.code)&&(t.preventDefault(),this.close()),this.typeaheadController.onKeydown(t)}async animateOpen(){const t=this.surfaceEl,i=this.slotEl;if(!t||!i)return!0;const s=this.openDirection;this.dispatchEvent(new Event("opening")),t.classList.toggle("animating",!0);const r=this.openCloseAnimationSignal.start(),a=t.offsetHeight,n=s==="UP",l=this.items,d=500,p=50,b=250,u=(d-b)/l.length,v=t.animate([{height:"0px"},{height:`${a}px`}],{duration:d,easing:si.EMPHASIZED}),g=i.animate([{transform:n?`translateY(-${a}px)`:""},{transform:""}],{duration:d,easing:si.EMPHASIZED}),f=t.animate([{opacity:0},{opacity:1}],p),x=[];for(let S=0;S<l.length;S++){const B=n?l.length-1-S:S,F=l[B],K=F.animate([{opacity:0},{opacity:1}],{duration:b,delay:u*S});F.classList.toggle("md-menu-hidden",!0),K.addEventListener("finish",()=>{F.classList.toggle("md-menu-hidden",!1)}),x.push([F,K])}let k=S=>{};const C=new Promise(S=>{k=S});return r.addEventListener("abort",()=>{v.cancel(),g.cancel(),f.cancel(),x.forEach(([S,B])=>{S.classList.toggle("md-menu-hidden",!1),B.cancel()}),k(!0)}),v.addEventListener("finish",()=>{t.classList.toggle("animating",!1),this.openCloseAnimationSignal.finish(),k(!1)}),await C}animateClose(){let t;const i=new Promise(K=>{t=K}),s=this.surfaceEl,r=this.slotEl;if(!s||!r)return t(!1),i;const n=this.openDirection==="UP";this.dispatchEvent(new Event("closing")),s.classList.toggle("animating",!0);const l=this.openCloseAnimationSignal.start(),d=s.offsetHeight,p=this.items,b=150,u=50,v=b-u,g=50,f=50,x=.35,k=(b-f-g)/p.length,C=s.animate([{height:`${d}px`},{height:`${d*x}px`}],{duration:b,easing:si.EMPHASIZED_ACCELERATE}),S=r.animate([{transform:""},{transform:n?`translateY(-${d*(1-x)}px)`:""}],{duration:b,easing:si.EMPHASIZED_ACCELERATE}),B=s.animate([{opacity:1},{opacity:0}],{duration:u,delay:v}),F=[];for(let K=0;K<p.length;K++){const Ct=n?K:p.length-1-K,de=p[Ct],H=de.animate([{opacity:1},{opacity:0}],{duration:g,delay:f+k*K});H.addEventListener("finish",()=>{de.classList.toggle("md-menu-hidden",!0)}),F.push([de,H])}return l.addEventListener("abort",()=>{C.cancel(),S.cancel(),B.cancel(),F.forEach(([K,Ct])=>{Ct.cancel(),K.classList.toggle("md-menu-hidden",!1)}),t(!1)}),C.addEventListener("finish",()=>{s.classList.toggle("animating",!1),F.forEach(([K])=>{K.classList.toggle("md-menu-hidden",!1)}),this.openCloseAnimationSignal.finish(),this.dispatchEvent(new Event("closed")),t(!0)}),i}handleKeydown(t){this.pointerPath=[],this.listController.handleKeydown(t)}setUpGlobalEventListeners(){document.addEventListener("click",this.onDocumentClick,{capture:!0}),window.addEventListener("pointerdown",this.onWindowPointerdown),document.addEventListener("resize",this.onWindowResize,{passive:!0}),window.addEventListener("resize",this.onWindowResize,{passive:!0})}cleanUpGlobalEventListeners(){document.removeEventListener("click",this.onDocumentClick,{capture:!0}),window.removeEventListener("pointerdown",this.onWindowPointerdown),document.removeEventListener("resize",this.onWindowResize),window.removeEventListener("resize",this.onWindowResize)}onCloseMenu(){this.close()}onDeactivateItems(t){t.stopPropagation(),this.listController.onDeactivateItems()}onRequestActivation(t){t.stopPropagation(),this.listController.onRequestActivation(t)}handleDeactivateTypeahead(t){t.stopPropagation(),this.typeaheadActive=!1}handleActivateTypeahead(t){t.stopPropagation(),this.typeaheadActive=!0}handleStayOpenOnFocusout(t){t.stopPropagation(),this.stayOpenOnFocusout=!0}handleCloseOnFocusout(t){t.stopPropagation(),this.stayOpenOnFocusout=!1}close(){this.open=!1,this.slotItems.forEach(i=>{var s;(s=i.close)==null||s.call(i)})}show(){this.open=!0}activateNextItem(){return this.listController.activateNextItem()??null}activatePreviousItem(){return this.listController.activatePreviousItem()??null}reposition(){this.open&&this.menuPositionController.position()}}h([I(".menu")],ye.prototype,"surfaceEl",void 0),h([I("slot")],ye.prototype,"slotEl",void 0),h([o()],ye.prototype,"anchor",void 0),h([o()],ye.prototype,"positioning",void 0),h([o({type:Boolean})],ye.prototype,"quick",void 0),h([o({type:Boolean,attribute:"has-overflow"})],ye.prototype,"hasOverflow",void 0),h([o({type:Boolean,reflect:!0})],ye.prototype,"open",void 0),h([o({type:Number,attribute:"x-offset"})],ye.prototype,"xOffset",void 0),h([o({type:Number,attribute:"y-offset"})],ye.prototype,"yOffset",void 0),h([o({type:Number,attribute:"typeahead-delay"})],ye.prototype,"typeaheadDelay",void 0),h([o({attribute:"anchor-corner"})],ye.prototype,"anchorCorner",void 0),h([o({attribute:"menu-corner"})],ye.prototype,"menuCorner",void 0),h([o({type:Boolean,attribute:"stay-open-on-outside-click"})],ye.prototype,"stayOpenOnOutsideClick",void 0),h([o({type:Boolean,attribute:"stay-open-on-focusout"})],ye.prototype,"stayOpenOnFocusout",void 0),h([o({type:Boolean,attribute:"skip-restore-focus"})],ye.prototype,"skipRestoreFocus",void 0),h([o({attribute:"default-focus"})],ye.prototype,"defaultFocus",void 0),h([o({type:Boolean,attribute:"no-navigation-wrap"})],ye.prototype,"noNavigationWrap",void 0),h([We({flatten:!0})],ye.prototype,"slotItems",void 0),h([T()],ye.prototype,"typeaheadActive",void 0);/**
939
939
  * @license
940
940
  * Copyright 2024 Google LLC
941
941
  * SPDX-License-Identifier: Apache-2.0
@@ -1160,7 +1160,7 @@
1160
1160
  * @license
1161
1161
  * Copyright 2023 Google LLC
1162
1162
  * SPDX-License-Identifier: Apache-2.0
1163
- */var Pd;const io=Symbol("value"),Hb=Ld(Vr(Ws(ns(w))));class K extends Hb{get value(){return this[io]}set value(t){this.lastUserSetValue=t,this.select(t)}get options(){var t;return((t=this.menu)==null?void 0:t.items)??[]}get selectedIndex(){const[t,i]=(this.getSelectedOptions()??[])[0]??[];return i??-1}set selectedIndex(t){this.lastUserSetSelectedIndex=t,this.selectIndex(t)}get selectedOptions(){return(this.getSelectedOptions()??[]).map(([t])=>t)}get hasError(){return this.error||this.nativeError}constructor(){super(),this.quick=!1,this.required=!1,this.errorText="",this.label="",this.noAsterisk=!1,this.supportingText="",this.error=!1,this.menuPositioning="popover",this.clampMenuWidth=!1,this.typeaheadDelay=Sd,this.hasLeadingIcon=!1,this.displayText="",this.menuAlign="start",this[Pd]="",this.lastUserSetValue=null,this.lastUserSetSelectedIndex=null,this.lastSelectedOption=null,this.lastSelectedOptionRecords=[],this.nativeError=!1,this.nativeErrorText="",this.focused=!1,this.open=!1,this.defaultFocus=ai.NONE,this.prevOpen=this.open,this.selectWidth=0,this.addEventListener("focus",this.handleFocus.bind(this)),this.addEventListener("blur",this.handleBlur.bind(this))}select(t){const i=this.options.find(s=>s.value===t);i&&this.selectItem(i)}selectIndex(t){const i=this.options[t];i&&this.selectItem(i)}reset(){for(const t of this.options)t.selected=t.hasAttribute("selected");this.updateValueAndDisplayText(),this.nativeError=!1,this.nativeErrorText=""}[(Pd=io,Ja)](t){var s;t==null||t.preventDefault();const i=this.getErrorText();this.nativeError=!!t,this.nativeErrorText=this.validationMessage,i===this.getErrorText()&&((s=this.field)==null||s.reannounceError())}update(t){if(this.hasUpdated||this.initUserSelection(),this.prevOpen!==this.open&&this.open){const i=this.getBoundingClientRect();this.selectWidth=i.width}this.prevOpen=this.open,super.update(t)}render(){return c`
1163
+ */var Pd;const io=Symbol("value"),Hb=Ld(Vr(Ws(ns(w))));class G extends Hb{get value(){return this[io]}set value(t){this.lastUserSetValue=t,this.select(t)}get options(){var t;return((t=this.menu)==null?void 0:t.items)??[]}get selectedIndex(){const[t,i]=(this.getSelectedOptions()??[])[0]??[];return i??-1}set selectedIndex(t){this.lastUserSetSelectedIndex=t,this.selectIndex(t)}get selectedOptions(){return(this.getSelectedOptions()??[]).map(([t])=>t)}get hasError(){return this.error||this.nativeError}constructor(){super(),this.quick=!1,this.required=!1,this.errorText="",this.label="",this.noAsterisk=!1,this.supportingText="",this.error=!1,this.menuPositioning="popover",this.clampMenuWidth=!1,this.typeaheadDelay=Sd,this.hasLeadingIcon=!1,this.displayText="",this.menuAlign="start",this[Pd]="",this.lastUserSetValue=null,this.lastUserSetSelectedIndex=null,this.lastSelectedOption=null,this.lastSelectedOptionRecords=[],this.nativeError=!1,this.nativeErrorText="",this.focused=!1,this.open=!1,this.defaultFocus=ai.NONE,this.prevOpen=this.open,this.selectWidth=0,this.addEventListener("focus",this.handleFocus.bind(this)),this.addEventListener("blur",this.handleBlur.bind(this))}select(t){const i=this.options.find(s=>s.value===t);i&&this.selectItem(i)}selectIndex(t){const i=this.options[t];i&&this.selectItem(i)}reset(){for(const t of this.options)t.selected=t.hasAttribute("selected");this.updateValueAndDisplayText(),this.nativeError=!1,this.nativeErrorText=""}[(Pd=io,Ja)](t){var s;t==null||t.preventDefault();const i=this.getErrorText();this.nativeError=!!t,this.nativeErrorText=this.validationMessage,i===this.getErrorText()&&((s=this.field)==null||s.reannounceError())}update(t){if(this.hasUpdated||this.initUserSelection(),this.prevOpen!==this.open&&this.open){const i=this.getBoundingClientRect();this.selectWidth=i.width}this.prevOpen=this.open,super.update(t)}render(){return c`
1164
1164
  <span
1165
1165
  class="select ${se(this.getRenderClasses())}"
1166
1166
  @focusout=${this.handleFocusout}>
@@ -1242,11 +1242,11 @@
1242
1242
  @request-deselection=${this.handleRequestDeselection}>
1243
1243
  ${this.renderMenuContent()}
1244
1244
  </md-menu>
1245
- </div>`}renderMenuContent(){return c`<slot></slot>`}handleKeydown(t){var a,n;if(this.open||this.disabled||!this.menu)return;const i=this.menu.typeaheadController,s=t.code==="Space"||t.code==="ArrowDown"||t.code==="ArrowUp"||t.code==="End"||t.code==="Home"||t.code==="Enter";if(!i.isTypingAhead&&s){switch(t.preventDefault(),this.open=!0,t.code){case"Space":case"ArrowDown":case"Enter":this.defaultFocus=ai.NONE;break;case"End":this.defaultFocus=ai.LAST_ITEM;break;case"ArrowUp":case"Home":this.defaultFocus=ai.FIRST_ITEM;break}return}if(t.key.length===1){i.onKeydown(t),t.preventDefault();const{lastActiveRecord:l}=i;if(!l)return;(n=(a=this.labelEl)==null?void 0:a.setAttribute)==null||n.call(a,"aria-live","polite"),this.selectItem(l[Ht.ITEM])&&this.dispatchInteractionEvents()}}handleClick(){this.open=!this.open}handleFocus(){this.focused=!0}handleBlur(){this.focused=!1}handleFocusout(t){t.relatedTarget&&Wn(t.relatedTarget,this)||(this.open=!1)}getSelectedOptions(){if(!this.menu)return this.lastSelectedOptionRecords=[],null;const t=this.menu.items;return this.lastSelectedOptionRecords=Fb(t),this.lastSelectedOptionRecords}async getUpdateComplete(){var t;return await((t=this.menu)==null?void 0:t.updateComplete),super.getUpdateComplete()}updateValueAndDisplayText(){const t=this.getSelectedOptions()??[];let i=!1;if(t.length){const[s]=t[0];i=this.lastSelectedOption!==s,this.lastSelectedOption=s,this[io]=s.value,this.displayText=s.displayText}else i=this.lastSelectedOption!==null,this.lastSelectedOption=null,this[io]="",this.displayText="";return i}async handleOpening(t){var a,n,l;if((n=(a=this.labelEl)==null?void 0:a.removeAttribute)==null||n.call(a,"aria-live"),this.redispatchEvent(t),this.defaultFocus!==ai.NONE)return;const i=this.menu.items,s=(l=js(i))==null?void 0:l.item;let[r]=this.lastSelectedOptionRecords[0]??[null];s&&s!==r&&(s.tabIndex=-1),r=r??i[0],r&&(r.tabIndex=0,r.focus())}redispatchEvent(t){ls(this,t)}handleClosed(t){this.open=!1,this.redispatchEvent(t)}handleCloseMenu(t){const i=t.detail.reason,s=t.detail.itemPath[0];this.open=!1;let r=!1;i.kind==="click-selection"?r=this.selectItem(s):i.kind==="keydown"&&_b(i.key)?r=this.selectItem(s):(s.tabIndex=-1,s.blur()),r&&this.dispatchInteractionEvents()}selectItem(t){return(this.getSelectedOptions()??[]).forEach(([s])=>{t!==s&&(s.selected=!1)}),t.selected=!0,this.updateValueAndDisplayText()}handleRequestSelection(t){const i=t.target;this.lastSelectedOptionRecords.some(([s])=>s===i)||this.selectItem(i)}handleRequestDeselection(t){const i=t.target;this.lastSelectedOptionRecords.some(([s])=>s===i)&&this.updateValueAndDisplayText()}initUserSelection(){this.lastUserSetValue&&!this.lastSelectedOptionRecords.length?this.select(this.lastUserSetValue):this.lastUserSetSelectedIndex!==null&&!this.lastSelectedOptionRecords.length?this.selectIndex(this.lastUserSetSelectedIndex):this.updateValueAndDisplayText()}handleIconChange(){this.hasLeadingIcon=this.leadingIcons.length>0}dispatchInteractionEvents(){this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0}))}getErrorText(){return this.error?this.errorText:this.nativeErrorText}[Ri](){return this.value}formResetCallback(){this.reset()}formStateRestoreCallback(t){this.value=t}click(){var t;(t=this.field)==null||t.click()}[Cs](){return new Bb(()=>this)}[Es](){return this.field}}pt(K),K.shadowRootOptions={...w.shadowRootOptions,delegatesFocus:!0},h([o({type:Boolean})],K.prototype,"quick",void 0),h([o({type:Boolean})],K.prototype,"required",void 0),h([o({type:String,attribute:"error-text"})],K.prototype,"errorText",void 0),h([o()],K.prototype,"label",void 0),h([o({type:Boolean,attribute:"no-asterisk"})],K.prototype,"noAsterisk",void 0),h([o({type:String,attribute:"supporting-text"})],K.prototype,"supportingText",void 0),h([o({type:Boolean,reflect:!0})],K.prototype,"error",void 0),h([o({attribute:"menu-positioning"})],K.prototype,"menuPositioning",void 0),h([o({type:Boolean,attribute:"clamp-menu-width"})],K.prototype,"clampMenuWidth",void 0),h([o({type:Number,attribute:"typeahead-delay"})],K.prototype,"typeaheadDelay",void 0),h([o({type:Boolean,attribute:"has-leading-icon"})],K.prototype,"hasLeadingIcon",void 0),h([o({attribute:"display-text"})],K.prototype,"displayText",void 0),h([o({attribute:"menu-align"})],K.prototype,"menuAlign",void 0),h([o()],K.prototype,"value",null),h([o({type:Number,attribute:"selected-index"})],K.prototype,"selectedIndex",null),h([T()],K.prototype,"nativeError",void 0),h([T()],K.prototype,"nativeErrorText",void 0),h([T()],K.prototype,"focused",void 0),h([T()],K.prototype,"open",void 0),h([T()],K.prototype,"defaultFocus",void 0),h([I(".field")],K.prototype,"field",void 0),h([I("md-menu")],K.prototype,"menu",void 0),h([I("#label")],K.prototype,"labelEl",void 0),h([We({slot:"leading-icon",flatten:!0})],K.prototype,"leadingIcons",void 0);/**
1245
+ </div>`}renderMenuContent(){return c`<slot></slot>`}handleKeydown(t){var a,n;if(this.open||this.disabled||!this.menu)return;const i=this.menu.typeaheadController,s=t.code==="Space"||t.code==="ArrowDown"||t.code==="ArrowUp"||t.code==="End"||t.code==="Home"||t.code==="Enter";if(!i.isTypingAhead&&s){switch(t.preventDefault(),this.open=!0,t.code){case"Space":case"ArrowDown":case"Enter":this.defaultFocus=ai.NONE;break;case"End":this.defaultFocus=ai.LAST_ITEM;break;case"ArrowUp":case"Home":this.defaultFocus=ai.FIRST_ITEM;break}return}if(t.key.length===1){i.onKeydown(t),t.preventDefault();const{lastActiveRecord:l}=i;if(!l)return;(n=(a=this.labelEl)==null?void 0:a.setAttribute)==null||n.call(a,"aria-live","polite"),this.selectItem(l[Ht.ITEM])&&this.dispatchInteractionEvents()}}handleClick(){this.open=!this.open}handleFocus(){this.focused=!0}handleBlur(){this.focused=!1}handleFocusout(t){t.relatedTarget&&Wn(t.relatedTarget,this)||(this.open=!1)}getSelectedOptions(){if(!this.menu)return this.lastSelectedOptionRecords=[],null;const t=this.menu.items;return this.lastSelectedOptionRecords=Fb(t),this.lastSelectedOptionRecords}async getUpdateComplete(){var t;return await((t=this.menu)==null?void 0:t.updateComplete),super.getUpdateComplete()}updateValueAndDisplayText(){const t=this.getSelectedOptions()??[];let i=!1;if(t.length){const[s]=t[0];i=this.lastSelectedOption!==s,this.lastSelectedOption=s,this[io]=s.value,this.displayText=s.displayText}else i=this.lastSelectedOption!==null,this.lastSelectedOption=null,this[io]="",this.displayText="";return i}async handleOpening(t){var a,n,l;if((n=(a=this.labelEl)==null?void 0:a.removeAttribute)==null||n.call(a,"aria-live"),this.redispatchEvent(t),this.defaultFocus!==ai.NONE)return;const i=this.menu.items,s=(l=js(i))==null?void 0:l.item;let[r]=this.lastSelectedOptionRecords[0]??[null];s&&s!==r&&(s.tabIndex=-1),r=r??i[0],r&&(r.tabIndex=0,r.focus())}redispatchEvent(t){ls(this,t)}handleClosed(t){this.open=!1,this.redispatchEvent(t)}handleCloseMenu(t){const i=t.detail.reason,s=t.detail.itemPath[0];this.open=!1;let r=!1;i.kind==="click-selection"?r=this.selectItem(s):i.kind==="keydown"&&_b(i.key)?r=this.selectItem(s):(s.tabIndex=-1,s.blur()),r&&this.dispatchInteractionEvents()}selectItem(t){return(this.getSelectedOptions()??[]).forEach(([s])=>{t!==s&&(s.selected=!1)}),t.selected=!0,this.updateValueAndDisplayText()}handleRequestSelection(t){const i=t.target;this.lastSelectedOptionRecords.some(([s])=>s===i)||this.selectItem(i)}handleRequestDeselection(t){const i=t.target;this.lastSelectedOptionRecords.some(([s])=>s===i)&&this.updateValueAndDisplayText()}initUserSelection(){this.lastUserSetValue&&!this.lastSelectedOptionRecords.length?this.select(this.lastUserSetValue):this.lastUserSetSelectedIndex!==null&&!this.lastSelectedOptionRecords.length?this.selectIndex(this.lastUserSetSelectedIndex):this.updateValueAndDisplayText()}handleIconChange(){this.hasLeadingIcon=this.leadingIcons.length>0}dispatchInteractionEvents(){this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0}))}getErrorText(){return this.error?this.errorText:this.nativeErrorText}[Ri](){return this.value}formResetCallback(){this.reset()}formStateRestoreCallback(t){this.value=t}click(){var t;(t=this.field)==null||t.click()}[Cs](){return new Bb(()=>this)}[Es](){return this.field}}pt(G),G.shadowRootOptions={...w.shadowRootOptions,delegatesFocus:!0},h([o({type:Boolean})],G.prototype,"quick",void 0),h([o({type:Boolean})],G.prototype,"required",void 0),h([o({type:String,attribute:"error-text"})],G.prototype,"errorText",void 0),h([o()],G.prototype,"label",void 0),h([o({type:Boolean,attribute:"no-asterisk"})],G.prototype,"noAsterisk",void 0),h([o({type:String,attribute:"supporting-text"})],G.prototype,"supportingText",void 0),h([o({type:Boolean,reflect:!0})],G.prototype,"error",void 0),h([o({attribute:"menu-positioning"})],G.prototype,"menuPositioning",void 0),h([o({type:Boolean,attribute:"clamp-menu-width"})],G.prototype,"clampMenuWidth",void 0),h([o({type:Number,attribute:"typeahead-delay"})],G.prototype,"typeaheadDelay",void 0),h([o({type:Boolean,attribute:"has-leading-icon"})],G.prototype,"hasLeadingIcon",void 0),h([o({attribute:"display-text"})],G.prototype,"displayText",void 0),h([o({attribute:"menu-align"})],G.prototype,"menuAlign",void 0),h([o()],G.prototype,"value",null),h([o({type:Number,attribute:"selected-index"})],G.prototype,"selectedIndex",null),h([T()],G.prototype,"nativeError",void 0),h([T()],G.prototype,"nativeErrorText",void 0),h([T()],G.prototype,"focused",void 0),h([T()],G.prototype,"open",void 0),h([T()],G.prototype,"defaultFocus",void 0),h([I(".field")],G.prototype,"field",void 0),h([I("md-menu")],G.prototype,"menu",void 0),h([I("#label")],G.prototype,"labelEl",void 0),h([We({slot:"leading-icon",flatten:!0})],G.prototype,"leadingIcons",void 0);/**
1246
1246
  * @license
1247
1247
  * Copyright 2023 Google LLC
1248
1248
  * SPDX-License-Identifier: Apache-2.0
1249
- */class Nb extends K{constructor(){super(...arguments),this.fieldTag=ht`md-filled-field`}}/**
1249
+ */class Nb extends G{constructor(){super(...arguments),this.fieldTag=ht`md-filled-field`}}/**
1250
1250
  * @license
1251
1251
  * Copyright 2024 Google LLC
1252
1252
  * SPDX-License-Identifier: Apache-2.0
@@ -1264,7 +1264,7 @@
1264
1264
  * @license
1265
1265
  * Copyright 2023 Google LLC
1266
1266
  * SPDX-License-Identifier: Apache-2.0
1267
- */class qb extends K{constructor(){super(...arguments),this.fieldTag=ht`md-outlined-field`}}/**
1267
+ */class qb extends G{constructor(){super(...arguments),this.fieldTag=ht`md-outlined-field`}}/**
1268
1268
  * @license
1269
1269
  * Copyright 2024 Google LLC
1270
1270
  * SPDX-License-Identifier: Apache-2.0
@@ -4826,7 +4826,7 @@
4826
4826
  color: var(--md-sys-color-on-surface);
4827
4827
  font-size: var(--md-sys-typescale-body-large-size);
4828
4828
  } */
4829
- `,Re([o({type:String,reflect:!0})],fe.prototype,"variant",2),Re([o({type:String})],fe.prototype,"label",2),Re([o({type:String})],fe.prototype,"icon",2),Re([o({type:Boolean,reflect:!0})],fe.prototype,"disabled",2),Re([o({type:Boolean,reflect:!0})],fe.prototype,"elevated",2),Re([o({type:Boolean,reflect:!0})],fe.prototype,"removable",2),Re([o({type:Boolean,reflect:!0})],fe.prototype,"selected",2),Re([o({type:String})],fe.prototype,"href",2),Re([o({type:String})],fe.prototype,"target",2),Re([o({type:String})],fe.prototype,"name",2),Re([o({type:String})],fe.prototype,"value",2),Re([o({type:String,reflect:!0})],fe.prototype,"spacing",2),Re([o({type:String,reflect:!0,attribute:"spacing-top"})],fe.prototype,"spacingTop",2),Re([o({type:String,reflect:!0,attribute:"spacing-bottom"})],fe.prototype,"spacingBottom",2),Re([o({type:String,reflect:!0,attribute:"spacing-left"})],fe.prototype,"spacingLeft",2),Re([o({type:String,reflect:!0,attribute:"spacing-right"})],fe.prototype,"spacingRight",2),Re([o({type:String,reflect:!0})],fe.prototype,"size",2),fe=Re([_("scb-chip")],fe);var qv=Object.defineProperty,Wv=Object.getOwnPropertyDescriptor,Z=(e,t,i,s)=>{for(var r=s>1?void 0:s?Wv(t,i):t,a=e.length-1,n;a>=0;a--)(n=e[a])&&(r=(s?n(t,i,r):n(r))||r);return s&&r&&qv(t,i,r),r};let G=class extends w{constructor(){super(...arguments),this.open=!1,this.inSb=!1,this.scrimClose=!0,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this.variant="basic",this.label="",this.icon="",this.supportingText="",this.okButton="OK",this.cancelButton="Avbryt",this.deleteButton="Delete",this.confirmButton="Ta bort",this.denyButton="Avbryt",this.resetButton="Återställ",this.submitButton="Spara",this.formId="",this.formAction="",this.formMethod="",this.__lastTriggerEl=null,this.__onDocumentClick=e=>{this.__getActionFromEvent(e)==="toggle"&&(this.__setOpen(!this.open),e.stopPropagation())},this.__onDocumentKeydown=e=>{this.open&&e.key==="Escape"&&(this.__fire("esc"),this.__setOpen(!1))},this.__onScrimClick=()=>{this.scrimClose&&(this.__fire("scrim"),this.__setOpen(!1))},this.__onOk=()=>{this.__fire("ok"),this.__setOpen(!1)},this.__onCancel=()=>{this.__fire("cancel"),this.__setOpen(!1)},this.__onConfirm=()=>{this.__fire("confirm"),this.__setOpen(!1)},this.__onDeny=()=>{this.__fire("deny"),this.__setOpen(!1)},this.__onReset=()=>{var i,s,r;const e=(i=this.shadowRoot)==null?void 0:i.querySelector("form");e instanceof HTMLFormElement&&(this.__clearGeneratedFormValues(e),e.reset()),(((r=(s=this.shadowRoot)==null?void 0:s.querySelector("slot"))==null?void 0:r.assignedElements({flatten:!0}))??[]).forEach(a=>{const n=a.tagName;n==="SCB-TEXTFIELD"&&(a.value=""),n==="SCB-CHECKBOX"&&(a.checked=!1),n==="SCB-RADIO-BUTTON"&&(a.checked=!1),n==="SCB-SWITCH"&&(a.selected=!1),n==="SCB-CHIP"&&(a.selected=!1)}),this.__fire("reset")},this.__onSubmit=()=>{var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector("form");if(e instanceof HTMLFormElement){if(this.__syncSlottedFormValues(e),!this.__validateFormAndSlottedFields(e))return;e.requestSubmit()}this.__fire("submit"),this.__setOpen(!1)},this.__onKeydownTrap=e=>{if(!this.open||e.key!=="Tab")return;const t=Array.from(this.shadowRoot.querySelectorAll('button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])')).filter(r=>!r.hasAttribute("disabled"));if(!t.length)return;const i=t[0],s=t[t.length-1];e.shiftKey&&document.activeElement===i?(s.focus(),e.preventDefault()):!e.shiftKey&&document.activeElement===s&&(i.focus(),e.preventDefault())}}__getActionFromEvent(e){if(!this.id)return null;for(const t of e.composedPath())if(t instanceof Element){if(t.getAttribute("data-dialog-toggle")===this.id)return this.__lastTriggerEl=t,"toggle";if(t.getAttribute("aria-controls")===this.id)return this.__lastTriggerEl=t,"toggle"}return null}connectedCallback(){super.connectedCallback(),this.__applyZIndex(),this.__applyMaxSize(),document.addEventListener("click",this.__onDocumentClick,!1),document.addEventListener("keydown",this.__onDocumentKeydown,!0),this.addEventListener("keydown",this.__onKeydownTrap)}disconnectedCallback(){document.removeEventListener("click",this.__onDocumentClick,!1),document.removeEventListener("keydown",this.__onDocumentKeydown,!0),this.removeEventListener("keydown",this.__onKeydownTrap),super.disconnectedCallback()}__applyZIndex(){const e=typeof this.zIndex=="number"&&Number.isFinite(this.zIndex)?this.zIndex:void 0;if(e===void 0){this.style.removeProperty("--z-dialog-scrim"),this.style.removeProperty("--z-dialog");return}this.style.setProperty("--z-dialog-scrim",String(e)),this.style.setProperty("--z-dialog",String(e+1))}__applyMaxSize(){const e=(this.maxW??"").trim(),t=(this.maxH??"").trim();e?(this.style.setProperty("--scb-dialog-max-w",e),this.style.setProperty("--scb-dialog-width",`min(${e}, 90vw)`)):(this.style.removeProperty("--scb-dialog-max-w"),this.style.removeProperty("--scb-dialog-width")),t?this.style.setProperty("--scb-dialog-max-h",t):this.style.removeProperty("--scb-dialog-max-h")}updated(e){var t,i;if(e.has("zIndex")&&this.__applyZIndex(),(e.has("maxW")||e.has("maxH"))&&this.__applyMaxSize(),e.has("open")){const s=e.get("open");this.__updateTriggersExpanded(),this.open&&!s?this.updateComplete.then(()=>{var a,n,l;const r=(a=this.shadowRoot)==null?void 0:a.querySelector('button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])');r?r.focus():(l=(n=this.shadowRoot)==null?void 0:n.querySelector(".container"))==null||l.focus()}):!this.open&&s&&((i=(t=this.__lastTriggerEl)==null?void 0:t.focus)==null||i.call(t)),this.__toggleScrollLock(this.open)}(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&this.__applySpacing()}__updateTriggersExpanded(){this.id&&document.querySelectorAll(`[aria-controls="${this.id}"], [data-dialog-toggle="${this.id}"]`).forEach(e=>{e.hasAttribute("aria-controls")&&e.setAttribute("aria-expanded",String(this.open))})}__toggleScrollLock(e){if(this.inSb)return;const t=document.documentElement,i=document.body;if(e){const s=window.innerWidth-t.clientWidth;t.style.overflow="hidden",i.style.paddingRight=s>0?`${s}px`:"";return}t.style.overflow="",i.style.paddingRight=""}mapSpacingToken(e){if(!e)return;const t=String(e).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}__applySpacing(){const e=this.mapSpacingToken(this.spacing),t=this.mapSpacingToken(this.spacingTop)??e,i=this.mapSpacingToken(this.spacingBottom)??e,s=this.mapSpacingToken(this.spacingLeft),r=this.mapSpacingToken(this.spacingRight);t?this.style.setProperty("--scb-dialog-spacing-block-start",t):this.style.removeProperty("--scb-dialog-spacing-block-start"),i?this.style.setProperty("--scb-dialog-spacing-block-end",i):this.style.removeProperty("--scb-dialog-spacing-block-end"),s?this.style.setProperty("--scb-dialog-spacing-inline-start",s):this.style.removeProperty("--scb-dialog-spacing-inline-start"),r?this.style.setProperty("--scb-dialog-spacing-inline-end",r):this.style.removeProperty("--scb-dialog-spacing-inline-end")}__setOpen(e){this.open=e,this.__fire(e?"open":"close")}__fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}__getSlottedElements(){var s;const e=(s=this.shadowRoot)==null?void 0:s.querySelector("slot");if(!(e instanceof HTMLSlotElement))return[];const t=e.assignedElements({flatten:!0}),i=[];for(const r of t)i.push(r,...Array.from(r.querySelectorAll("*")));return i}__appendHiddenFormValue(e,t,i){const s=document.createElement("input");s.type="hidden",s.name=t,s.value=i,s.setAttribute("data-scb-dialog-generated","true"),e.append(s)}__clearGeneratedFormValues(e){e.querySelectorAll('input[data-scb-dialog-generated="true"]').forEach(t=>t.remove())}__syncSlottedFormValues(e){this.__clearGeneratedFormValues(e),this.__getSlottedElements().forEach(i=>{if(!(i instanceof HTMLElement))return;const s=(i.getAttribute("name")??"").trim();if(!(!s||i.disabled===!0||i.hasAttribute("disabled"))){if(i instanceof HTMLInputElement){if(i.form===e)return;const a=(i.type||"").toLowerCase();if(a==="checkbox"||a==="radio"){i.checked&&this.__appendHiddenFormValue(e,s,i.value||"on");return}this.__appendHiddenFormValue(e,s,i.value??"");return}if(i instanceof HTMLTextAreaElement){if(i.form===e)return;this.__appendHiddenFormValue(e,s,i.value??"");return}if(i instanceof HTMLSelectElement){if(i.form===e)return;if(i.multiple){Array.from(i.selectedOptions).forEach(a=>{this.__appendHiddenFormValue(e,s,a.value)});return}this.__appendHiddenFormValue(e,s,i.value??"");return}switch(i.tagName){case"SCB-TEXTFIELD":this.__appendHiddenFormValue(e,s,String(i.value??""));return;case"SCB-CHECKBOX":i.checked&&this.__appendHiddenFormValue(e,s,String(i.value??i.getAttribute("value")??"on"));return;case"SCB-RADIO-BUTTON":i.checked&&this.__appendHiddenFormValue(e,s,String(i.value??i.getAttribute("value")??"on"));return;case"SCB-SWITCH":(i.selected||i.checked)&&this.__appendHiddenFormValue(e,s,String(i.value??i.getAttribute("value")??"on"));return;case"SCB-CHIP":i.selected&&this.__appendHiddenFormValue(e,s,String(i.value??i.getAttribute("value")??"on"));return;default:"value"in i&&this.__appendHiddenFormValue(e,s,String(i.value??""))}}})}__validateFormAndSlottedFields(e){const t=n=>n.disabled===!0||n.hasAttribute("disabled");let i=e.reportValidity(),s=null;const r=new Set;return this.__getSlottedElements().forEach(n=>{if(!(n instanceof HTMLElement)||r.has(n)||t(n))return;r.add(n);const l=n;if(typeof l.reportValidity=="function"){const d=!!l.reportValidity();!d&&!s&&(s=n),i=i&&d}}),!i&&s&&s.focus(),i}__slotIsEmpty(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector("slot");return e?e.assignedElements({flatten:!0}).length===0:!0}renderHeader(e){const t=this.variant==="form"||this.variant==="floating"||this.variant==="iframe";return c`
4829
+ `,Re([o({type:String,reflect:!0})],fe.prototype,"variant",2),Re([o({type:String})],fe.prototype,"label",2),Re([o({type:String})],fe.prototype,"icon",2),Re([o({type:Boolean,reflect:!0})],fe.prototype,"disabled",2),Re([o({type:Boolean,reflect:!0})],fe.prototype,"elevated",2),Re([o({type:Boolean,reflect:!0})],fe.prototype,"removable",2),Re([o({type:Boolean,reflect:!0})],fe.prototype,"selected",2),Re([o({type:String})],fe.prototype,"href",2),Re([o({type:String})],fe.prototype,"target",2),Re([o({type:String})],fe.prototype,"name",2),Re([o({type:String})],fe.prototype,"value",2),Re([o({type:String,reflect:!0})],fe.prototype,"spacing",2),Re([o({type:String,reflect:!0,attribute:"spacing-top"})],fe.prototype,"spacingTop",2),Re([o({type:String,reflect:!0,attribute:"spacing-bottom"})],fe.prototype,"spacingBottom",2),Re([o({type:String,reflect:!0,attribute:"spacing-left"})],fe.prototype,"spacingLeft",2),Re([o({type:String,reflect:!0,attribute:"spacing-right"})],fe.prototype,"spacingRight",2),Re([o({type:String,reflect:!0})],fe.prototype,"size",2),fe=Re([_("scb-chip")],fe);var qv=Object.defineProperty,Wv=Object.getOwnPropertyDescriptor,Z=(e,t,i,s)=>{for(var r=s>1?void 0:s?Wv(t,i):t,a=e.length-1,n;a>=0;a--)(n=e[a])&&(r=(s?n(t,i,r):n(r))||r);return s&&r&&qv(t,i,r),r};let Y=class extends w{constructor(){super(...arguments),this.open=!1,this.inSb=!1,this.scrimClose=!0,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this.variant="basic",this.label="",this.icon="",this.supportingText="",this.okButton="OK",this.cancelButton="Avbryt",this.deleteButton="Delete",this.confirmButton="Ta bort",this.denyButton="Avbryt",this.resetButton="Återställ",this.submitButton="Spara",this.formId="",this.formAction="",this.formMethod="",this.__lastTriggerEl=null,this.__onDocumentClick=e=>{this.__getActionFromEvent(e)==="toggle"&&(this.__setOpen(!this.open),e.stopPropagation())},this.__onDocumentKeydown=e=>{this.open&&e.key==="Escape"&&(this.__fire("esc"),this.__setOpen(!1))},this.__onScrimClick=()=>{this.scrimClose&&(this.__fire("scrim"),this.__setOpen(!1))},this.__onOk=()=>{this.__fire("ok"),this.__setOpen(!1)},this.__onCancel=()=>{this.__fire("cancel"),this.__setOpen(!1)},this.__onConfirm=()=>{this.__fire("confirm"),this.__setOpen(!1)},this.__onDeny=()=>{this.__fire("deny"),this.__setOpen(!1)},this.__onReset=()=>{var i,s,r;const e=(i=this.shadowRoot)==null?void 0:i.querySelector("form");e instanceof HTMLFormElement&&(this.__clearGeneratedFormValues(e),e.reset()),(((r=(s=this.shadowRoot)==null?void 0:s.querySelector("slot"))==null?void 0:r.assignedElements({flatten:!0}))??[]).forEach(a=>{const n=a.tagName;n==="SCB-TEXTFIELD"&&(a.value=""),n==="SCB-CHECKBOX"&&(a.checked=!1),n==="SCB-RADIO-BUTTON"&&(a.checked=!1),n==="SCB-SWITCH"&&(a.selected=!1),n==="SCB-CHIP"&&(a.selected=!1)}),this.__fire("reset")},this.__onSubmit=()=>{var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector("form");if(e instanceof HTMLFormElement){if(this.__syncSlottedFormValues(e),!this.__validateFormAndSlottedFields(e))return;e.requestSubmit()}this.__fire("submit"),this.__setOpen(!1)},this.__onKeydownTrap=e=>{if(!this.open||e.key!=="Tab")return;const t=Array.from(this.shadowRoot.querySelectorAll('button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])')).filter(r=>!r.hasAttribute("disabled"));if(!t.length)return;const i=t[0],s=t[t.length-1];e.shiftKey&&document.activeElement===i?(s.focus(),e.preventDefault()):!e.shiftKey&&document.activeElement===s&&(i.focus(),e.preventDefault())}}__getActionFromEvent(e){if(!this.id)return null;for(const t of e.composedPath())if(t instanceof Element){if(t.getAttribute("data-dialog-toggle")===this.id)return this.__lastTriggerEl=t,"toggle";if(t.getAttribute("aria-controls")===this.id)return this.__lastTriggerEl=t,"toggle"}return null}connectedCallback(){super.connectedCallback(),this.__applyZIndex(),this.__applyMaxSize(),document.addEventListener("click",this.__onDocumentClick,!1),document.addEventListener("keydown",this.__onDocumentKeydown,!0),this.addEventListener("keydown",this.__onKeydownTrap)}disconnectedCallback(){document.removeEventListener("click",this.__onDocumentClick,!1),document.removeEventListener("keydown",this.__onDocumentKeydown,!0),this.removeEventListener("keydown",this.__onKeydownTrap),super.disconnectedCallback()}__applyZIndex(){const e=typeof this.zIndex=="number"&&Number.isFinite(this.zIndex)?this.zIndex:void 0;if(e===void 0){this.style.removeProperty("--z-dialog-scrim"),this.style.removeProperty("--z-dialog");return}this.style.setProperty("--z-dialog-scrim",String(e)),this.style.setProperty("--z-dialog",String(e+1))}__applyMaxSize(){const e=(this.maxW??"").trim(),t=(this.maxH??"").trim();e?(this.style.setProperty("--scb-dialog-max-w",e),this.style.setProperty("--scb-dialog-width",`min(${e}, 90vw)`)):(this.style.removeProperty("--scb-dialog-max-w"),this.style.removeProperty("--scb-dialog-width")),t?this.style.setProperty("--scb-dialog-max-h",t):this.style.removeProperty("--scb-dialog-max-h")}updated(e){var t,i;if(e.has("zIndex")&&this.__applyZIndex(),(e.has("maxW")||e.has("maxH"))&&this.__applyMaxSize(),e.has("open")){const s=e.get("open");this.__updateTriggersExpanded(),this.open&&!s?this.updateComplete.then(()=>{var a,n,l;const r=(a=this.shadowRoot)==null?void 0:a.querySelector('button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])');r?r.focus():(l=(n=this.shadowRoot)==null?void 0:n.querySelector(".container"))==null||l.focus()}):!this.open&&s&&((i=(t=this.__lastTriggerEl)==null?void 0:t.focus)==null||i.call(t)),this.__toggleScrollLock(this.open)}(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&this.__applySpacing()}__updateTriggersExpanded(){this.id&&document.querySelectorAll(`[aria-controls="${this.id}"], [data-dialog-toggle="${this.id}"]`).forEach(e=>{e.hasAttribute("aria-controls")&&e.setAttribute("aria-expanded",String(this.open))})}__toggleScrollLock(e){if(this.inSb)return;const t=document.documentElement,i=document.body;if(e){const s=window.innerWidth-t.clientWidth;t.style.overflow="hidden",i.style.paddingRight=s>0?`${s}px`:"";return}t.style.overflow="",i.style.paddingRight=""}mapSpacingToken(e){if(!e)return;const t=String(e).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}__applySpacing(){const e=this.mapSpacingToken(this.spacing),t=this.mapSpacingToken(this.spacingTop)??e,i=this.mapSpacingToken(this.spacingBottom)??e,s=this.mapSpacingToken(this.spacingLeft),r=this.mapSpacingToken(this.spacingRight);t?this.style.setProperty("--scb-dialog-spacing-block-start",t):this.style.removeProperty("--scb-dialog-spacing-block-start"),i?this.style.setProperty("--scb-dialog-spacing-block-end",i):this.style.removeProperty("--scb-dialog-spacing-block-end"),s?this.style.setProperty("--scb-dialog-spacing-inline-start",s):this.style.removeProperty("--scb-dialog-spacing-inline-start"),r?this.style.setProperty("--scb-dialog-spacing-inline-end",r):this.style.removeProperty("--scb-dialog-spacing-inline-end")}__setOpen(e){this.open=e,this.__fire(e?"open":"close")}__fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}__getSlottedElements(){var s;const e=(s=this.shadowRoot)==null?void 0:s.querySelector("slot");if(!(e instanceof HTMLSlotElement))return[];const t=e.assignedElements({flatten:!0}),i=[];for(const r of t)i.push(r,...Array.from(r.querySelectorAll("*")));return i}__appendHiddenFormValue(e,t,i){const s=document.createElement("input");s.type="hidden",s.name=t,s.value=i,s.setAttribute("data-scb-dialog-generated","true"),e.append(s)}__clearGeneratedFormValues(e){e.querySelectorAll('input[data-scb-dialog-generated="true"]').forEach(t=>t.remove())}__syncSlottedFormValues(e){this.__clearGeneratedFormValues(e),this.__getSlottedElements().forEach(i=>{if(!(i instanceof HTMLElement))return;const s=(i.getAttribute("name")??"").trim();if(!(!s||i.disabled===!0||i.hasAttribute("disabled"))){if(i instanceof HTMLInputElement){if(i.form===e)return;const a=(i.type||"").toLowerCase();if(a==="checkbox"||a==="radio"){i.checked&&this.__appendHiddenFormValue(e,s,i.value||"on");return}this.__appendHiddenFormValue(e,s,i.value??"");return}if(i instanceof HTMLTextAreaElement){if(i.form===e)return;this.__appendHiddenFormValue(e,s,i.value??"");return}if(i instanceof HTMLSelectElement){if(i.form===e)return;if(i.multiple){Array.from(i.selectedOptions).forEach(a=>{this.__appendHiddenFormValue(e,s,a.value)});return}this.__appendHiddenFormValue(e,s,i.value??"");return}switch(i.tagName){case"SCB-TEXTFIELD":this.__appendHiddenFormValue(e,s,String(i.value??""));return;case"SCB-CHECKBOX":i.checked&&this.__appendHiddenFormValue(e,s,String(i.value??i.getAttribute("value")??"on"));return;case"SCB-RADIO-BUTTON":i.checked&&this.__appendHiddenFormValue(e,s,String(i.value??i.getAttribute("value")??"on"));return;case"SCB-SWITCH":(i.selected||i.checked)&&this.__appendHiddenFormValue(e,s,String(i.value??i.getAttribute("value")??"on"));return;case"SCB-CHIP":i.selected&&this.__appendHiddenFormValue(e,s,String(i.value??i.getAttribute("value")??"on"));return;default:"value"in i&&this.__appendHiddenFormValue(e,s,String(i.value??""))}}})}__validateFormAndSlottedFields(e){const t=n=>n.disabled===!0||n.hasAttribute("disabled");let i=e.reportValidity(),s=null;const r=new Set;return this.__getSlottedElements().forEach(n=>{if(!(n instanceof HTMLElement)||r.has(n)||t(n))return;r.add(n);const l=n;if(typeof l.reportValidity=="function"){const d=!!l.reportValidity();!d&&!s&&(s=n),i=i&&d}}),!i&&s&&s.focus(),i}__slotIsEmpty(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector("slot");return e?e.assignedElements({flatten:!0}).length===0:!0}renderHeader(e){const t=this.variant==="form"||this.variant==="floating"||this.variant==="iframe";return c`
4830
4830
  <div class="header">
4831
4831
  <div class="title">
4832
4832
  ${this.icon?c`<md-icon class="dialog-icon">${this.icon}</md-icon>`:m}
@@ -4879,7 +4879,7 @@
4879
4879
  >
4880
4880
  ${this.renderBody(e,t)}
4881
4881
  </div>
4882
- `}};G.styles=y`
4882
+ `}};Y.styles=y`
4883
4883
  :host {
4884
4884
  display:block;
4885
4885
  position:relative;
@@ -5090,11 +5090,11 @@
5090
5090
  to { opacity: 0; }
5091
5091
  }
5092
5092
 
5093
- `,Z([o({type:Boolean,reflect:!0})],G.prototype,"open",2),Z([o({type:String,attribute:"max-w",reflect:!0})],G.prototype,"maxW",2),Z([o({type:String,attribute:"max-h",reflect:!0})],G.prototype,"maxH",2),Z([o({type:Number,attribute:"z-index",reflect:!0})],G.prototype,"zIndex",2),Z([o({type:Boolean,attribute:!1})],G.prototype,"inSb",2),Z([o({type:Boolean,attribute:"scrim-close"})],G.prototype,"scrimClose",2),Z([o({type:String,reflect:!0})],G.prototype,"spacing",2),Z([o({type:String,attribute:"spacing-top",reflect:!0})],G.prototype,"spacingTop",2),Z([o({type:String,attribute:"spacing-bottom",reflect:!0})],G.prototype,"spacingBottom",2),Z([o({type:String,attribute:"spacing-left",reflect:!0})],G.prototype,"spacingLeft",2),Z([o({type:String,attribute:"spacing-right",reflect:!0})],G.prototype,"spacingRight",2),Z([o({type:String})],G.prototype,"variant",2),Z([o({type:String})],G.prototype,"label",2),Z([o({type:String})],G.prototype,"icon",2),Z([o({type:String,attribute:"supporting-text"})],G.prototype,"supportingText",2),Z([o({type:String,attribute:"ok-button"})],G.prototype,"okButton",2),Z([o({type:String,attribute:"cancel-button"})],G.prototype,"cancelButton",2),Z([o({type:String,attribute:"delete-button"})],G.prototype,"deleteButton",2),Z([o({type:String,attribute:"confirm-button"})],G.prototype,"confirmButton",2),Z([o({type:String,attribute:"deny-button"})],G.prototype,"denyButton",2),Z([o({type:String,attribute:"reset-button"})],G.prototype,"resetButton",2),Z([o({type:String,attribute:"submit-button"})],G.prototype,"submitButton",2),Z([o({type:String,attribute:"form-id"})],G.prototype,"formId",2),Z([o({type:String,attribute:"form-action"})],G.prototype,"formAction",2),Z([o({type:String,attribute:"form-method"})],G.prototype,"formMethod",2),G=Z([_("scb-dialog")],G);var Uv=Object.defineProperty,jv=Object.getOwnPropertyDescriptor,Tp=e=>{throw TypeError(e)},yt=(e,t,i,s)=>{for(var r=s>1?void 0:s?jv(t,i):t,a=e.length-1,n;a>=0;a--)(n=e[a])&&(r=(s?n(t,i,r):n(r))||r);return s&&r&&Uv(t,i,r),r},Kv=(e,t,i)=>t.has(e)||Tp("Cannot "+i),Gv=(e,t,i)=>t.has(e)?Tp("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),Ap=(e,t,i)=>(Kv(e,t,"access private method"),i),Lo,Fl;let Ge=class extends w{constructor(){super(...arguments),Gv(this,Lo),this._lastActiveDay=null,this.lang="sv",this.disableWeekend=!1,this.publicHolidays=!0,this.displayYear=new Date().getFullYear(),this.displayMonth=new Date().getMonth()+1,this.selectedDate="",this.eventsJson=void 0,this._eventsFromJson=null,this._eventsJsonLast=void 0,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this._mutationObserver=null,this._syncingDisplay=!1,this._onCalendarKeyDown=e=>{var d,p;const i=Array.from(((d=this.shadowRoot)==null?void 0:d.querySelectorAll(".calendar-day.has-event"))??[]),s=(p=this.shadowRoot)==null?void 0:p.activeElement,r=s&&i.includes(s)?s:document.activeElement,a=i.indexOf(r);if(a===-1)return;let n=a;const l=this.disableWeekend?5:7;switch(e.key){case"ArrowRight":n=a+1<i.length?a+1:a;break;case"ArrowLeft":n=a-1>=0?a-1:a;break;case"ArrowDown":n=a+l<i.length?a+l:a;break;case"ArrowUp":n=a-l>=0?a-l:a;break;default:return}n!==a&&(e.preventDefault(),i[n].focus())},this._onEventChanged=()=>{this.requestUpdate()},this._today=new Date,this._current=new Date,this._popupEvent=null,this._handleDialogClose=()=>{this._popupEvent=null,this.requestUpdate(),this._restoreDayFocus()},this._restoreDayFocus=()=>{this._lastActiveDay&&setTimeout(()=>{var e;(e=this._lastActiveDay)==null||e.focus(),this._lastActiveDay=null},0)},this._easterDateCalculated={}}get value(){return this.selectedDate}set value(e){const t=(e??"")+"";t!==this.selectedDate&&(this.selectedDate=t)}static get observedAttributes(){return[...super.observedAttributes??[],"value"]}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e==="value"&&(this.value=i??"")}connectedCallback(){super.connectedCallback(),Ap(this,Lo,Fl).call(this);const e=Number(this.displayYear),t=Number(this.displayMonth);!Number.isNaN(e)&&!Number.isNaN(t)&&t>=1&&t<=12&&(this._current=new Date(e,t-1,1)),this._syncDisplayFromCurrent(!1),this.addEventListener("change",this._onEventChanged),this._mutationObserver=new MutationObserver(()=>{this.requestUpdate()}),this._mutationObserver.observe(this,{childList:!0}),this.addEventListener("keydown",this._onCalendarKeyDown)}disconnectedCallback(){this.removeEventListener("change",this._onEventChanged),super.disconnectedCallback(),this._mutationObserver&&(this._mutationObserver.disconnect(),this._mutationObserver=null),this.removeEventListener("keydown",this._onCalendarKeyDown)}mapSpacingToken(e){if(!e)return;const t=String(e).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}updated(e){var t;if((t=super.updated)==null||t.call(this,e),e.has("eventsJson")&&(this._eventsJsonLast=void 0,this._eventsFromJson=null),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&Ap(this,Lo,Fl).call(this),!this._syncingDisplay&&(e.has("displayYear")||e.has("displayMonth"))){const i=Number(this.displayYear),s=Number(this.displayMonth);if(!Number.isNaN(i)&&!Number.isNaN(s)&&s>=1&&s<=12){const r=this._current.getFullYear(),a=this._current.getMonth()+1;(r!==i||a!==s)&&(this._current=new Date(i,s-1,1),this._dispatchMonthChange(i,s),this.requestUpdate())}}}_ensureEventsFromJson(){const e=(this.eventsJson??"").trim();if(!e){this._eventsFromJson=null,this._eventsJsonLast=e;return}if(!(this._eventsJsonLast===e&&this._eventsFromJson!==null)){this._eventsJsonLast=e;try{const t=JSON.parse(e);Array.isArray(t)?this._eventsFromJson=t:this._eventsFromJson=[]}catch{this._eventsFromJson=[]}}}_getEventInputs(){return Array.isArray(this.events)?this.events:(this._ensureEventsFromJson(),this._eventsFromJson!==null?this._eventsFromJson:null)}_normalizeEventInput(e){const t=e.title??"",i=e.description??"",s=e.href??"",r=e.startDate??e["start-date"]??e.start??e.date??"",a=e.endDate??e["end-date"]??e.end??"";return{title:t+"",description:i?i+"":void 0,href:s?s+"":void 0,start:r?r+"":void 0,end:a?a+"":void 0}}_buildEventMapFromInputs(e){const t=new Map;for(const i of e){const s=this._normalizeEventInput(i),r=s.start||"",a=s.end||"";if(!(!r||!s.title))if(r&&a){const n=new Date(r),l=new Date(a);for(let d=new Date(n);d<=l;d.setDate(d.getDate()+1)){const p=d.toISOString().split("T")[0],b=t.get(p)||[];b.push({title:s.title,description:s.description,href:s.href,start:r,end:a}),t.set(p,b)}}else{const n=r.split("T")[0],l=t.get(n)||[];l.push({title:s.title,description:s.description,href:s.href,start:r}),t.set(n,l)}}return t}_buildEventMapFromChildren(){const e=Array.from(this.querySelectorAll("scb-calendar-event")),t=new Map;for(const i of e){const s=i,r=(s.startDate??s.date??"")+""||i.getAttribute("start-date")||i.getAttribute("date")||"",a=(s.endDate??"")+""||i.getAttribute("end-date")||"";if(r&&a){const n=new Date(r),l=new Date(a);for(let d=new Date(n);d<=l;d.setDate(d.getDate()+1)){const p=d.toISOString().split("T")[0],b=t.get(p)||[];b.push({title:i.title??"",description:i.description,href:s.href||i.getAttribute("href")||void 0,start:r,end:a}),t.set(p,b)}}else if(r&&i.title){const n=r.split("T")[0],l=t.get(n)||[];l.push({title:i.title,description:i.description,href:s.href||i.getAttribute("href")||void 0,start:r}),t.set(n,l)}}return t}_syncDisplayFromCurrent(e=!0){const t=this._current.getFullYear(),i=this._current.getMonth()+1;this._syncingDisplay=!0;try{this.displayYear=t,this.displayMonth=i}finally{this._syncingDisplay=!1}e&&this._dispatchMonthChange(t,i)}_dispatchMonthChange(e,t){const i={displayYear:e,displayMonth:t};this.dispatchEvent(new CustomEvent("scb-calendar-month-change",{bubbles:!0,composed:!0,detail:i})),this.dispatchEvent(new CustomEvent("scbcalendarmonthchange",{bubbles:!0,composed:!0,detail:i}))}_dispatchSelect(e){const t={selectedDate:e};this.dispatchEvent(new CustomEvent("scb-calendar-select",{bubbles:!0,composed:!0,detail:t})),this.dispatchEvent(new CustomEvent("scbcalendarselect",{bubbles:!0,composed:!0,detail:t}))}_daysInMonth(e,t){return new Date(e,t+1,0).getDate()}_firstDayOfWeek(e,t){const i=new Date(e,t,1).getDay();return i===0?6:i-1}_prevMonth(){this._current=new Date(this._current.getFullYear(),this._current.getMonth()-1,1),this.selectedDate="",this._popupEvent=null,this._syncDisplayFromCurrent(),this.requestUpdate()}_nextMonth(){this._current=new Date(this._current.getFullYear(),this._current.getMonth()+1,1),this.selectedDate="",this._popupEvent=null,this._syncDisplayFromCurrent(),this.requestUpdate()}_showEventPopup(e){var t;this._popupEvent=e,this.selectedDate=e.date,this._dispatchSelect(e.date),this._lastActiveDay=((t=this.shadowRoot)==null?void 0:t.activeElement)||document.activeElement,this.requestUpdate(),this.updateComplete.then(()=>{var s;const i=(s=this.shadowRoot)==null?void 0:s.querySelector("scb-dialog");i&&(document.activeElement&&(i.__lastTriggerEl=document.activeElement),requestAnimationFrame(()=>{requestAnimationFrame(()=>{i.open=!0})}),i.addEventListener("close",this._handleDialogClose,{once:!0}))})}_addDays(e,t){const i=new Date(e.valueOf());return i.setDate(i.getDate()+t),i}_easterDay(e){if(typeof this._easterDateCalculated["Ar"+e]<"u")return new Date(this._easterDateCalculated["Ar"+e]);let t=e;t<100&&(t=t+1900),t<1950&&(t=t+100);const i=t%19,s=t%4,r=t%7,a=(19*i+24)%30,n=(2*s+4*r+6*a+5)%7;let l=22+a+n,d=0;l==57&&(l-=7),l==56&&a==28&&n==6&&i>10&&(l-=7),l>31?(l-=31,d=4):d=3;const p=new Date(t,d-1,l);return this._easterDateCalculated["Ar"+e]=p,new Date(this._easterDateCalculated["Ar"+e])}_swedishHolidayName(e){const t=e.getMonth();if(t===1||t===6||t===7||t===8)return null;const i=e.getMonth()+1,s=e.getDate(),r=e.getFullYear(),a=this._easterDay(r),n=this.lang==="en",l=[["Nyårsdagen","New Year's Day",i===1&&s===1],["Trettondedag jul","Epiphany",i===1&&s===6],["Långfredag","Good Friday",+e==+this._addDays(a,-2)],["Påskdagen","Easter Sunday",+e==+a],["Annandag påsk","Easter Monday",+e==+this._addDays(a,1)],["Kristi himmelsfärdsdag","Ascension Day",+e==+this._addDays(a,39)],["Pingstdagen","Pentecost",+e==+this._addDays(a,50)&&r<2005],["Första maj","May Day",i===5&&s===1],["Nationaldagen","National Day",i===6&&s===6&&r>=2005],["Midsommarafton","Midsummer's Eve",i===6&&s>=19&&s<=25&&e.getDay()===5],["Midsommardagen","Midsummer's Day",i===6&&s>=20&&s<=26&&e.getDay()===6],["Julafton","Christmas Eve",i===12&&s===24],["Juldagen","Christmas Day",i===12&&s===25],["Annandag jul","Boxing Day",i===12&&s===26],["Alla helgons dag","All Saints' Day",i===10&&s>=31&&e.getDay()===6||i===11&&s<=6&&e.getDay()===6]];for(const d of l){const[p,b,u]=d;if(u)return n?b:p}return null}render(){const e=this._current.getFullYear(),t=this._current.getMonth(),i=this._daysInMonth(e,t),s=this._firstDayOfWeek(e,t),r=this._today,a=this.lang==="en",n=a?["January","February","March","April","May","June","July","August","September","October","November","December"]:["Januari","Februari","Mars","April","Maj","Juni","Juli","Augusti","September","Oktober","November","December"];let l=a?["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]:["Mån","Tis","Ons","Tor","Fre","Lör","Sön"];this.disableWeekend&&(l=l.slice(0,5));const d=this._getEventInputs(),p=d?this._buildEventMapFromInputs(d):this._buildEventMapFromChildren(),b=[];let u=1;for(let v=0;v<6;v++){const g=[],f=this.disableWeekend?[0,1,2,3,4]:[0,1,2,3,4,5,6];let x=u;for(let k=0;k<f.length;k++){const C=f[k];if(v===0&&C<s){if(!this.disableWeekend||C<5){const S=t===0?11:t-1,B=t===0?e-1:e,j=this._daysInMonth(B,S)-(s-C-1);g.push(c`
5093
+ `,Z([o({type:Boolean,reflect:!0})],Y.prototype,"open",2),Z([o({type:String,attribute:"max-w",reflect:!0})],Y.prototype,"maxW",2),Z([o({type:String,attribute:"max-h",reflect:!0})],Y.prototype,"maxH",2),Z([o({type:Number,attribute:"z-index",reflect:!0})],Y.prototype,"zIndex",2),Z([o({type:Boolean,attribute:!1})],Y.prototype,"inSb",2),Z([o({type:Boolean,attribute:"scrim-close"})],Y.prototype,"scrimClose",2),Z([o({type:String,reflect:!0})],Y.prototype,"spacing",2),Z([o({type:String,attribute:"spacing-top",reflect:!0})],Y.prototype,"spacingTop",2),Z([o({type:String,attribute:"spacing-bottom",reflect:!0})],Y.prototype,"spacingBottom",2),Z([o({type:String,attribute:"spacing-left",reflect:!0})],Y.prototype,"spacingLeft",2),Z([o({type:String,attribute:"spacing-right",reflect:!0})],Y.prototype,"spacingRight",2),Z([o({type:String})],Y.prototype,"variant",2),Z([o({type:String})],Y.prototype,"label",2),Z([o({type:String})],Y.prototype,"icon",2),Z([o({type:String,attribute:"supporting-text"})],Y.prototype,"supportingText",2),Z([o({type:String,attribute:"ok-button"})],Y.prototype,"okButton",2),Z([o({type:String,attribute:"cancel-button"})],Y.prototype,"cancelButton",2),Z([o({type:String,attribute:"delete-button"})],Y.prototype,"deleteButton",2),Z([o({type:String,attribute:"confirm-button"})],Y.prototype,"confirmButton",2),Z([o({type:String,attribute:"deny-button"})],Y.prototype,"denyButton",2),Z([o({type:String,attribute:"reset-button"})],Y.prototype,"resetButton",2),Z([o({type:String,attribute:"submit-button"})],Y.prototype,"submitButton",2),Z([o({type:String,attribute:"form-id"})],Y.prototype,"formId",2),Z([o({type:String,attribute:"form-action"})],Y.prototype,"formAction",2),Z([o({type:String,attribute:"form-method"})],Y.prototype,"formMethod",2),Y=Z([_("scb-dialog")],Y);var Uv=Object.defineProperty,jv=Object.getOwnPropertyDescriptor,Tp=e=>{throw TypeError(e)},yt=(e,t,i,s)=>{for(var r=s>1?void 0:s?jv(t,i):t,a=e.length-1,n;a>=0;a--)(n=e[a])&&(r=(s?n(t,i,r):n(r))||r);return s&&r&&Uv(t,i,r),r},Kv=(e,t,i)=>t.has(e)||Tp("Cannot "+i),Gv=(e,t,i)=>t.has(e)?Tp("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),Ap=(e,t,i)=>(Kv(e,t,"access private method"),i),Lo,Fl;let Ge=class extends w{constructor(){super(...arguments),Gv(this,Lo),this._lastActiveDay=null,this.lang="sv",this.disableWeekend=!1,this.publicHolidays=!0,this.displayYear=new Date().getFullYear(),this.displayMonth=new Date().getMonth()+1,this.selectedDate="",this.eventsJson=void 0,this._eventsFromJson=null,this._eventsJsonLast=void 0,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this._mutationObserver=null,this._syncingDisplay=!1,this._onCalendarKeyDown=e=>{var d,p;const i=Array.from(((d=this.shadowRoot)==null?void 0:d.querySelectorAll(".calendar-day.has-event"))??[]),s=(p=this.shadowRoot)==null?void 0:p.activeElement,r=s&&i.includes(s)?s:document.activeElement,a=i.indexOf(r);if(a===-1)return;let n=a;const l=this.disableWeekend?5:7;switch(e.key){case"ArrowRight":n=a+1<i.length?a+1:a;break;case"ArrowLeft":n=a-1>=0?a-1:a;break;case"ArrowDown":n=a+l<i.length?a+l:a;break;case"ArrowUp":n=a-l>=0?a-l:a;break;default:return}n!==a&&(e.preventDefault(),i[n].focus())},this._onEventChanged=()=>{this.requestUpdate()},this._today=new Date,this._current=new Date,this._popupEvent=null,this._handleDialogClose=()=>{this._popupEvent=null,this.requestUpdate(),this._restoreDayFocus()},this._restoreDayFocus=()=>{this._lastActiveDay&&setTimeout(()=>{var e;(e=this._lastActiveDay)==null||e.focus(),this._lastActiveDay=null},0)},this._easterDateCalculated={}}get value(){return this.selectedDate}set value(e){const t=(e??"")+"";t!==this.selectedDate&&(this.selectedDate=t)}static get observedAttributes(){return[...super.observedAttributes??[],"value"]}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e==="value"&&(this.value=i??"")}connectedCallback(){super.connectedCallback(),Ap(this,Lo,Fl).call(this);const e=Number(this.displayYear),t=Number(this.displayMonth);!Number.isNaN(e)&&!Number.isNaN(t)&&t>=1&&t<=12&&(this._current=new Date(e,t-1,1)),this._syncDisplayFromCurrent(!1),this.addEventListener("change",this._onEventChanged),this._mutationObserver=new MutationObserver(()=>{this.requestUpdate()}),this._mutationObserver.observe(this,{childList:!0}),this.addEventListener("keydown",this._onCalendarKeyDown)}disconnectedCallback(){this.removeEventListener("change",this._onEventChanged),super.disconnectedCallback(),this._mutationObserver&&(this._mutationObserver.disconnect(),this._mutationObserver=null),this.removeEventListener("keydown",this._onCalendarKeyDown)}mapSpacingToken(e){if(!e)return;const t=String(e).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}updated(e){var t;if((t=super.updated)==null||t.call(this,e),e.has("eventsJson")&&(this._eventsJsonLast=void 0,this._eventsFromJson=null),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&Ap(this,Lo,Fl).call(this),!this._syncingDisplay&&(e.has("displayYear")||e.has("displayMonth"))){const i=Number(this.displayYear),s=Number(this.displayMonth);if(!Number.isNaN(i)&&!Number.isNaN(s)&&s>=1&&s<=12){const r=this._current.getFullYear(),a=this._current.getMonth()+1;(r!==i||a!==s)&&(this._current=new Date(i,s-1,1),this._dispatchMonthChange(i,s),this.requestUpdate())}}}_ensureEventsFromJson(){const e=(this.eventsJson??"").trim();if(!e){this._eventsFromJson=null,this._eventsJsonLast=e;return}if(!(this._eventsJsonLast===e&&this._eventsFromJson!==null)){this._eventsJsonLast=e;try{const t=JSON.parse(e);Array.isArray(t)?this._eventsFromJson=t:this._eventsFromJson=[]}catch{this._eventsFromJson=[]}}}_getEventInputs(){return Array.isArray(this.events)?this.events:(this._ensureEventsFromJson(),this._eventsFromJson!==null?this._eventsFromJson:null)}_normalizeEventInput(e){const t=e.title??"",i=e.description??"",s=e.href??"",r=e.startDate??e["start-date"]??e.start??e.date??"",a=e.endDate??e["end-date"]??e.end??"";return{title:t+"",description:i?i+"":void 0,href:s?s+"":void 0,start:r?r+"":void 0,end:a?a+"":void 0}}_buildEventMapFromInputs(e){const t=new Map;for(const i of e){const s=this._normalizeEventInput(i),r=s.start||"",a=s.end||"";if(!(!r||!s.title))if(r&&a){const n=new Date(r),l=new Date(a);for(let d=new Date(n);d<=l;d.setDate(d.getDate()+1)){const p=d.toISOString().split("T")[0],b=t.get(p)||[];b.push({title:s.title,description:s.description,href:s.href,start:r,end:a}),t.set(p,b)}}else{const n=r.split("T")[0],l=t.get(n)||[];l.push({title:s.title,description:s.description,href:s.href,start:r}),t.set(n,l)}}return t}_buildEventMapFromChildren(){const e=Array.from(this.querySelectorAll("scb-calendar-event")),t=new Map;for(const i of e){const s=i,r=(s.startDate??s.date??"")+""||i.getAttribute("start-date")||i.getAttribute("date")||"",a=(s.endDate??"")+""||i.getAttribute("end-date")||"";if(r&&a){const n=new Date(r),l=new Date(a);for(let d=new Date(n);d<=l;d.setDate(d.getDate()+1)){const p=d.toISOString().split("T")[0],b=t.get(p)||[];b.push({title:i.title??"",description:i.description,href:s.href||i.getAttribute("href")||void 0,start:r,end:a}),t.set(p,b)}}else if(r&&i.title){const n=r.split("T")[0],l=t.get(n)||[];l.push({title:i.title,description:i.description,href:s.href||i.getAttribute("href")||void 0,start:r}),t.set(n,l)}}return t}_syncDisplayFromCurrent(e=!0){const t=this._current.getFullYear(),i=this._current.getMonth()+1;this._syncingDisplay=!0;try{this.displayYear=t,this.displayMonth=i}finally{this._syncingDisplay=!1}e&&this._dispatchMonthChange(t,i)}_dispatchMonthChange(e,t){const i={displayYear:e,displayMonth:t};this.dispatchEvent(new CustomEvent("scb-calendar-month-change",{bubbles:!0,composed:!0,detail:i})),this.dispatchEvent(new CustomEvent("scbcalendarmonthchange",{bubbles:!0,composed:!0,detail:i}))}_dispatchSelect(e){const t={selectedDate:e};this.dispatchEvent(new CustomEvent("scb-calendar-select",{bubbles:!0,composed:!0,detail:t})),this.dispatchEvent(new CustomEvent("scbcalendarselect",{bubbles:!0,composed:!0,detail:t}))}_daysInMonth(e,t){return new Date(e,t+1,0).getDate()}_firstDayOfWeek(e,t){const i=new Date(e,t,1).getDay();return i===0?6:i-1}_prevMonth(){this._current=new Date(this._current.getFullYear(),this._current.getMonth()-1,1),this.selectedDate="",this._popupEvent=null,this._syncDisplayFromCurrent(),this.requestUpdate()}_nextMonth(){this._current=new Date(this._current.getFullYear(),this._current.getMonth()+1,1),this.selectedDate="",this._popupEvent=null,this._syncDisplayFromCurrent(),this.requestUpdate()}_showEventPopup(e){var t;this._popupEvent=e,this.selectedDate=e.date,this._dispatchSelect(e.date),this._lastActiveDay=((t=this.shadowRoot)==null?void 0:t.activeElement)||document.activeElement,this.requestUpdate(),this.updateComplete.then(()=>{var s;const i=(s=this.shadowRoot)==null?void 0:s.querySelector("scb-dialog");i&&(document.activeElement&&(i.__lastTriggerEl=document.activeElement),requestAnimationFrame(()=>{requestAnimationFrame(()=>{i.open=!0})}),i.addEventListener("close",this._handleDialogClose,{once:!0}))})}_addDays(e,t){const i=new Date(e.valueOf());return i.setDate(i.getDate()+t),i}_easterDay(e){if(typeof this._easterDateCalculated["Ar"+e]<"u")return new Date(this._easterDateCalculated["Ar"+e]);let t=e;t<100&&(t=t+1900),t<1950&&(t=t+100);const i=t%19,s=t%4,r=t%7,a=(19*i+24)%30,n=(2*s+4*r+6*a+5)%7;let l=22+a+n,d=0;l==57&&(l-=7),l==56&&a==28&&n==6&&i>10&&(l-=7),l>31?(l-=31,d=4):d=3;const p=new Date(t,d-1,l);return this._easterDateCalculated["Ar"+e]=p,new Date(this._easterDateCalculated["Ar"+e])}_swedishHolidayName(e){const t=e.getMonth();if(t===1||t===6||t===7||t===8)return null;const i=e.getMonth()+1,s=e.getDate(),r=e.getFullYear(),a=this._easterDay(r),n=this.lang==="en",l=[["Nyårsdagen","New Year's Day",i===1&&s===1],["Trettondedag jul","Epiphany",i===1&&s===6],["Långfredag","Good Friday",+e==+this._addDays(a,-2)],["Påskdagen","Easter Sunday",+e==+a],["Annandag påsk","Easter Monday",+e==+this._addDays(a,1)],["Kristi himmelsfärdsdag","Ascension Day",+e==+this._addDays(a,39)],["Pingstdagen","Pentecost",+e==+this._addDays(a,50)&&r<2005],["Första maj","May Day",i===5&&s===1],["Nationaldagen","National Day",i===6&&s===6&&r>=2005],["Midsommarafton","Midsummer's Eve",i===6&&s>=19&&s<=25&&e.getDay()===5],["Midsommardagen","Midsummer's Day",i===6&&s>=20&&s<=26&&e.getDay()===6],["Julafton","Christmas Eve",i===12&&s===24],["Juldagen","Christmas Day",i===12&&s===25],["Annandag jul","Boxing Day",i===12&&s===26],["Alla helgons dag","All Saints' Day",i===10&&s>=31&&e.getDay()===6||i===11&&s<=6&&e.getDay()===6]];for(const d of l){const[p,b,u]=d;if(u)return n?b:p}return null}render(){const e=this._current.getFullYear(),t=this._current.getMonth(),i=this._daysInMonth(e,t),s=this._firstDayOfWeek(e,t),r=this._today,a=this.lang==="en",n=a?["January","February","March","April","May","June","July","August","September","October","November","December"]:["Januari","Februari","Mars","April","Maj","Juni","Juli","Augusti","September","Oktober","November","December"];let l=a?["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]:["Mån","Tis","Ons","Tor","Fre","Lör","Sön"];this.disableWeekend&&(l=l.slice(0,5));const d=this._getEventInputs(),p=d?this._buildEventMapFromInputs(d):this._buildEventMapFromChildren(),b=[];let u=1;for(let v=0;v<6;v++){const g=[],f=this.disableWeekend?[0,1,2,3,4]:[0,1,2,3,4,5,6];let x=u;for(let k=0;k<f.length;k++){const C=f[k];if(v===0&&C<s){if(!this.disableWeekend||C<5){const S=t===0?11:t-1,B=t===0?e-1:e,K=this._daysInMonth(B,S)-(s-C-1);g.push(c`
5094
5094
  <div class="calendar-day calendar-day--other">
5095
- <span class="calendar-day-number">${j}</span>
5095
+ <span class="calendar-day-number">${K}</span>
5096
5096
  </div>
5097
- `)}}else if(x>i)g.push(c`<div></div>`);else{let S=new Date(e,t,x);if(this.disableWeekend)for(;S.getDay()===0||S.getDay()===6;)x++,S=new Date(e,t,x);if(x>i){g.push(c`<div></div>`);continue}const B=r.getFullYear()===e&&r.getMonth()===t&&r.getDate()===x,F=`${e}-${String(t+1).padStart(2,"0")}-${String(x).padStart(2,"0")}`,j=new Date(e,t,x);let Ct=!1,de=null;this.publicHolidays&&(de=this._swedishHolidayName(j),Ct=!!de);let H=p.get(F)||[];H=[...H].sort((R,ie)=>{const Je=R.start&&F===R.start.split("T")[0]?R.start:R.end&&F===R.end.split("T")[0]?R.end:"",ii=ie.start&&F===ie.start.split("T")[0]?ie.start:ie.end&&ie.end.split("T")[0]?ie.end:"",yi=Je&&Je.includes("T"),ws=ii&&ii.includes("T");return yi&&ws?Je.localeCompare(ii):yi?-1:ws?1:R.title.localeCompare(ie.title)});const Xe=[...H].map(R=>{let ie="",Je="";if(R.start&&R.end){const ii=R.start.split("T")[0],yi=R.end.split("T")[0];F===ii&&F===yi&&R.start.includes("T")&&R.end.includes("T")?ie=R.start.split("T")[1].substring(0,5)+"–"+R.end.split("T")[1].substring(0,5):F===ii&&R.start.includes("T")?ie=R.start.split("T")[1].substring(0,5):F===yi&&R.end.includes("T")?(ie=R.end.split("T")[1].substring(0,5),Je=a?"cont. ":"fort. "):F!==ii&&(ie="",Je=a?"cont. ":"fort. ")}else R.start&&R.start.includes("T")&&(ie=R.start.split("T")[1].substring(0,5));return{...R,time:ie,prefix:Je}});g.push(c`
5097
+ `)}}else if(x>i)g.push(c`<div></div>`);else{let S=new Date(e,t,x);if(this.disableWeekend)for(;S.getDay()===0||S.getDay()===6;)x++,S=new Date(e,t,x);if(x>i){g.push(c`<div></div>`);continue}const B=r.getFullYear()===e&&r.getMonth()===t&&r.getDate()===x,F=`${e}-${String(t+1).padStart(2,"0")}-${String(x).padStart(2,"0")}`,K=new Date(e,t,x);let Ct=!1,de=null;this.publicHolidays&&(de=this._swedishHolidayName(K),Ct=!!de);let H=p.get(F)||[];H=[...H].sort((R,ie)=>{const Je=R.start&&F===R.start.split("T")[0]?R.start:R.end&&F===R.end.split("T")[0]?R.end:"",ii=ie.start&&F===ie.start.split("T")[0]?ie.start:ie.end&&ie.end.split("T")[0]?ie.end:"",yi=Je&&Je.includes("T"),ws=ii&&ii.includes("T");return yi&&ws?Je.localeCompare(ii):yi?-1:ws?1:R.title.localeCompare(ie.title)});const Xe=[...H].map(R=>{let ie="",Je="";if(R.start&&R.end){const ii=R.start.split("T")[0],yi=R.end.split("T")[0];F===ii&&F===yi&&R.start.includes("T")&&R.end.includes("T")?ie=R.start.split("T")[1].substring(0,5)+"–"+R.end.split("T")[1].substring(0,5):F===ii&&R.start.includes("T")?ie=R.start.split("T")[1].substring(0,5):F===yi&&R.end.includes("T")?(ie=R.end.split("T")[1].substring(0,5),Je=a?"cont. ":"fort. "):F!==ii&&(ie="",Je=a?"cont. ":"fort. ")}else R.start&&R.start.includes("T")&&(ie=R.start.split("T")[1].substring(0,5));return{...R,time:ie,prefix:Je}});g.push(c`
5098
5098
  <div
5099
5099
  class="calendar-day${B?" today":""}${H.length?" has-event":""}${Ct?" calendar-day--holiday":""}"
5100
5100
  tabindex=${H.length?"0":void 0}
@@ -6785,7 +6785,7 @@
6785
6785
  overflow-y: scroll;
6786
6786
  }
6787
6787
  }
6788
- `,ji([o({type:Boolean,reflect:!0})],P.prototype,"floating",2),ji([o({type:Boolean,reflect:!0})],P.prototype,"left",2),ji([o({type:Boolean,reflect:!0})],P.prototype,"right",2),ji([o({type:Boolean,reflect:!0})],P.prototype,"open",2),ji([o({type:Boolean,reflect:!0})],P.prototype,"overlay",2),ji([o({type:Boolean,reflect:!0,attribute:"lock-scroll"})],P.prototype,"lockScroll",2),ji([o({type:Boolean,reflect:!0,attribute:"close-on-overlay"})],P.prototype,"closeOnOverlay",2),ji([o({type:Boolean,reflect:!0})],P.prototype,"modal",2),P=ji([_("scb-drawer")],P);var mf=Object.defineProperty,vf=Object.getOwnPropertyDescriptor,ee=(e,t,i,s)=>{for(var r=s>1?void 0:s?vf(t,i):t,a=e.length-1,n;a>=0;a--)(n=e[a])&&(r=(s?n(t,i,r):n(r))||r);return s&&r&&mf(t,i,r),r};let Y=class extends w{constructor(){super(...arguments),this.type="default",this.label="",this.supportingText="",this.metaText="",this.buttonLabel="",this.replaceButtonLabel="",this.removeButtonLabel="",this.previewEyebrow="",this.emptyPreviewTitle="",this.emptyPreviewMeta="",this.accept="",this.showPreview=!0,this.disabled=!1,this.previewSrc="",this.defaultImageSrc="",this.previewAlt="",this.previewTitle="",this.previewMeta="",this._isDragOver=!1,this._selectedPreviewKind="empty",this._selectedPreviewSrc="",this._selectedPreviewAlt="",this._selectedPreviewTitle="",this._selectedPreviewMeta="",this._dragDepth=0,this._previewSource="external",this._objectUrl=""}get _resolvedAccept(){return this.accept.trim()||(this.type==="image"?"image/*,.png,.jpg,.jpeg,.webp,.svg,.gif,.bmp,.avif":"")}get _hasExternalPreview(){return!!this._resolvedExternalPreviewSrc||!!this.previewTitle.trim()||!!this.previewMeta.trim()}get _resolvedExternalPreviewSrc(){return this.previewSrc.trim()||this.defaultImageSrc.trim()}get _resolvedPreviewKind(){return this._previewSource==="external"&&this._hasExternalPreview?this._resolvedExternalPreviewSrc?"image":"file":this._selectedPreviewKind}get _hasPreview(){return this._resolvedPreviewKind!=="empty"}get _resolvedLabel(){return this.label||(this.type==="image"?"Ladda upp bild":"Ladda upp fil")}get _resolvedSupportingText(){return this.supportingText||(this.type==="image"?"Dra och släpp en bild här, eller välj en bild från din dator.":"Dra och släpp en fil här, eller välj en fil från din dator.")}get _resolvedMetaText(){return this.metaText?this.metaText:this.type==="image"?"PNG, JPG, SVG, GIF, BMP, AVIF och WebP stöds.":"Alla filtyper stöds."}get _resolvedButtonLabel(){return this.buttonLabel||(this.type==="image"?"Välj bild":"Välj fil")}get _resolvedReplaceButtonLabel(){return this.replaceButtonLabel?this.replaceButtonLabel:this._resolvedPreviewKind==="image"?"Byt bild":"Byt fil"}get _resolvedRemoveButtonLabel(){return this.removeButtonLabel?this.removeButtonLabel:this._resolvedPreviewKind==="image"?"Ta bort bild":"Ta bort fil"}get _resolvedPreviewEyebrow(){return this.previewEyebrow?this.previewEyebrow:this._hasPreview?this._resolvedPreviewKind==="image"?"Uppladdad bild":"Uppladdad fil":"Förhandsvisning"}get _resolvedEmptyPreviewTitle(){return this.emptyPreviewTitle?this.emptyPreviewTitle:this.type==="image"?"Ingen bild uppladdad":"Ingen fil uppladdad"}get _resolvedEmptyPreviewMeta(){return this.emptyPreviewMeta?this.emptyPreviewMeta:this.type==="image"?"Förhandsvisningen visas här när du har laddat upp en bild.":"Förhandsvisningen visas här när du har laddat upp en fil."}get _resolvedPreviewSrc(){return this._previewSource==="external"&&this._hasExternalPreview?this._resolvedExternalPreviewSrc:this._selectedPreviewSrc}get _resolvedPreviewAlt(){return this._previewSource==="external"&&this._hasExternalPreview?this.previewAlt:this._selectedPreviewAlt}get _resolvedPreviewTitle(){return this._previewSource==="external"&&this._hasExternalPreview?this.previewTitle||(this._resolvedPreviewKind==="image"?"Uppladdad bild":"Uppladdad fil"):this._selectedPreviewTitle}get _resolvedPreviewMeta(){return this._previewSource==="external"&&this._hasExternalPreview?this.previewMeta:this._selectedPreviewMeta}disconnectedCallback(){this._revokeObjectUrl(),super.disconnectedCallback()}updated(e){e.has("type")&&this.type==="image"&&this._selectedPreviewKind==="file"&&this._clearSelectedFileState()}openPicker(){if(this.disabled)return;const e=this.renderRoot.querySelector('[data-role="native-input"]');if(e){try{e.value=""}catch{}e.click()}}setPreviewState(e){this.previewSrc=(e==null?void 0:e.src)??"",this.previewAlt=(e==null?void 0:e.alt)??"",this.previewTitle=(e==null?void 0:e.title)??"",this.previewMeta=(e==null?void 0:e.meta)??"",this._previewSource="external"}clearPreviewState(){this.previewSrc="",this.previewAlt="",this.previewTitle="",this.previewMeta="",this._previewSource="external",this._clearSelectedFileState(),this._clearNativeInputValue()}_dispatch(e,t={},i=!1){const s=new CustomEvent(e,{detail:t,bubbles:!0,composed:!0,cancelable:i});return this.dispatchEvent(s),s}_handleFiles(e){const t=e&&e[0]?e[0]:null;!t||!this._isAcceptedFile(t)||(this._setSelectedFileState(t),this._dispatch("file-selected",{file:t}),this._dispatch("change",{file:t}))}_onZoneClick(e){this.disabled||e.composedPath().some(s=>s instanceof HTMLElement&&s.getAttribute("data-role")==="choose-button")||this.openPicker()}_onZoneKeydown(e){this.disabled||(e.key==="Enter"||e.key===" "||e.key==="Spacebar")&&(e.preventDefault(),this.openPicker())}_preventDefaultDrag(e){e.preventDefault(),e.stopPropagation()}_onDragEnter(e){this.disabled||(this._preventDefaultDrag(e),this._dragDepth+=1,this._isDragOver=!0)}_onDragOver(e){this.disabled||(this._preventDefaultDrag(e),this._isDragOver=!0)}_onDragLeave(e){this.disabled||(this._preventDefaultDrag(e),this._dragDepth=Math.max(0,this._dragDepth-1),this._dragDepth||(this._isDragOver=!1))}_onDrop(e){var t;this.disabled||(this._preventDefaultDrag(e),this._dragDepth=0,this._isDragOver=!1,this._handleFiles(((t=e.dataTransfer)==null?void 0:t.files)??null))}_onNativeInputChange(e){const t=e.currentTarget;this._handleFiles((t==null?void 0:t.files)??null)}_onChooseButtonClick(e){e.preventDefault(),e.stopPropagation(),this.openPicker()}_onReplaceButtonClick(e){e.preventDefault(),e.stopPropagation(),this.openPicker()}_onRemoveButtonClick(e){e.preventDefault(),e.stopPropagation(),this._dispatch("clear-request",{},!0).defaultPrevented||this.clearPreviewState()}_isAcceptedFile(e){const t=this._resolvedAccept.trim();if(!t)return!0;const i=e.name.toLowerCase(),s=(e.type||"").toLowerCase(),r=t.split(",").map(a=>a.trim().toLowerCase()).filter(Boolean);return r.length?r.some(a=>a==="*/*"?!0:a.endsWith("/*")?s.startsWith(a.slice(0,-1)):a.startsWith(".")?i.endsWith(a):s===a):!0}_setSelectedFileState(e){const t=this._getPreviewKindForFile(e),i=this._getFileTypeLabel(e),s=this._formatFileSize(e.size);this._revokeObjectUrl(),this._selectedPreviewKind=t,this._selectedPreviewTitle=e.name||(t==="image"?"Uppladdad bild":"Uppladdad fil"),this._selectedPreviewMeta=[i,s].filter(Boolean).join(" • "),this._selectedPreviewAlt=t==="image"?e.name||"Uppladdad bild":"",this._selectedPreviewSrc="",t==="image"&&(this._objectUrl=URL.createObjectURL(e),this._selectedPreviewSrc=this._objectUrl),this._previewSource="internal"}_clearSelectedFileState(){this._revokeObjectUrl(),this._selectedPreviewKind="empty",this._selectedPreviewSrc="",this._selectedPreviewAlt="",this._selectedPreviewTitle="",this._selectedPreviewMeta=""}_clearNativeInputValue(){const e=this.renderRoot.querySelector('[data-role="native-input"]');if(e)try{e.value=""}catch{}}_revokeObjectUrl(){this._objectUrl&&(URL.revokeObjectURL(this._objectUrl),this._objectUrl="")}_getPreviewKindForFile(e){const t=(e.type||"").toLowerCase(),i=this._getFileExtension(e.name).toLowerCase();return t.startsWith("image/")||["png","jpg","jpeg","webp","svg","gif","bmp","avif"].includes(i)?"image":"file"}_getFileExtension(e){const t=/\.([^.]+)$/.exec(e||"");return(t==null?void 0:t[1])??""}_getFileExtensionLabel(e){return(this._getFileExtension(e)||(this._resolvedPreviewKind==="image"?"IMG":"FIL")).slice(0,6).toUpperCase()}_getFileTypeLabel(e){if(e.type)return e.type;const t=this._getFileExtension(e.name);return t?t.toUpperCase():"Okänd filtyp"}_formatFileSize(e){return!Number.isFinite(e)||e<0?"":e<1024?`${e} B`:e<1024*1024?`${new Intl.NumberFormat("sv-SE",{maximumFractionDigits:1}).format(e/1024)} kB`:`${new Intl.NumberFormat("sv-SE",{maximumFractionDigits:1}).format(e/(1024*1024))} MB`}_renderPreviewMedia(){return this._resolvedPreviewKind==="image"&&this._resolvedPreviewSrc?c`<img class="scb-drop-zone__preview-image" src=${this._resolvedPreviewSrc} alt=${this._resolvedPreviewAlt} />`:this._hasPreview?c`
6788
+ `,ji([o({type:Boolean,reflect:!0})],P.prototype,"floating",2),ji([o({type:Boolean,reflect:!0})],P.prototype,"left",2),ji([o({type:Boolean,reflect:!0})],P.prototype,"right",2),ji([o({type:Boolean,reflect:!0})],P.prototype,"open",2),ji([o({type:Boolean,reflect:!0})],P.prototype,"overlay",2),ji([o({type:Boolean,reflect:!0,attribute:"lock-scroll"})],P.prototype,"lockScroll",2),ji([o({type:Boolean,reflect:!0,attribute:"close-on-overlay"})],P.prototype,"closeOnOverlay",2),ji([o({type:Boolean,reflect:!0})],P.prototype,"modal",2),P=ji([_("scb-drawer")],P);var mf=Object.defineProperty,vf=Object.getOwnPropertyDescriptor,ee=(e,t,i,s)=>{for(var r=s>1?void 0:s?vf(t,i):t,a=e.length-1,n;a>=0;a--)(n=e[a])&&(r=(s?n(t,i,r):n(r))||r);return s&&r&&mf(t,i,r),r};let U=class extends w{constructor(){super(),this._internals=null,this.type="default",this.name="",this.label="",this.supportingText="",this.metaText="",this.buttonLabel="",this.replaceButtonLabel="",this.removeButtonLabel="",this.previewEyebrow="",this.emptyPreviewTitle="",this.emptyPreviewMeta="",this.accept="",this.showPreview=!0,this.disabled=!1,this.previewSrc="",this.defaultImageSrc="",this.previewAlt="",this.previewTitle="",this.previewMeta="",this._isDragOver=!1,this._selectedPreviewKind="empty",this._selectedPreviewSrc="",this._selectedPreviewAlt="",this._selectedPreviewTitle="",this._selectedPreviewMeta="",this._dragDepth=0,this._previewSource="external",this._objectUrl="",this._selectedFile=null,this._form=null,this._formDataHandler=null,"attachInternals"in this&&(this._internals=this.attachInternals())}get _resolvedAccept(){return this.accept.trim()||(this.type==="image"?"image/*,.png,.jpg,.jpeg,.webp,.svg,.gif,.bmp,.avif":"")}get _hasExternalPreview(){return!!this._resolvedExternalPreviewSrc||!!this.previewTitle.trim()||!!this.previewMeta.trim()}get _resolvedExternalPreviewSrc(){return this.previewSrc.trim()||this.defaultImageSrc.trim()}get _resolvedPreviewKind(){return this._previewSource==="external"&&this._hasExternalPreview?this._resolvedExternalPreviewSrc?"image":"file":this._selectedPreviewKind}get _hasPreview(){return this._resolvedPreviewKind!=="empty"}get _resolvedLabel(){return this.label||(this.type==="image"?"Ladda upp bild":"Ladda upp fil")}get _resolvedSupportingText(){return this.supportingText||(this.type==="image"?"Dra och släpp en bild här, eller välj en bild från din dator.":"Dra och släpp en fil här, eller välj en fil från din dator.")}get _resolvedMetaText(){return this.metaText?this.metaText:this.type==="image"?"PNG, JPG, SVG, GIF, BMP, AVIF och WebP stöds.":"Alla filtyper stöds."}get _resolvedButtonLabel(){return this.buttonLabel||(this.type==="image"?"Välj bild":"Välj fil")}get _resolvedReplaceButtonLabel(){return this.replaceButtonLabel?this.replaceButtonLabel:this._resolvedPreviewKind==="image"?"Byt bild":"Byt fil"}get _resolvedRemoveButtonLabel(){return this.removeButtonLabel?this.removeButtonLabel:this._resolvedPreviewKind==="image"?"Ta bort bild":"Ta bort fil"}get _resolvedPreviewEyebrow(){return this.previewEyebrow?this.previewEyebrow:this._hasPreview?this._resolvedPreviewKind==="image"?"Uppladdad bild":"Uppladdad fil":"Förhandsvisning"}get _resolvedEmptyPreviewTitle(){return this.emptyPreviewTitle?this.emptyPreviewTitle:this.type==="image"?"Ingen bild uppladdad":"Ingen fil uppladdad"}get _resolvedEmptyPreviewMeta(){return this.emptyPreviewMeta?this.emptyPreviewMeta:this.type==="image"?"Förhandsvisningen visas här när du har laddat upp en bild.":"Förhandsvisningen visas här när du har laddat upp en fil."}get _resolvedPreviewSrc(){return this._previewSource==="external"&&this._hasExternalPreview?this._resolvedExternalPreviewSrc:this._selectedPreviewSrc}get _resolvedPreviewAlt(){return this._previewSource==="external"&&this._hasExternalPreview?this.previewAlt:this._selectedPreviewAlt}get _resolvedPreviewTitle(){return this._previewSource==="external"&&this._hasExternalPreview?this.previewTitle||(this._resolvedPreviewKind==="image"?"Uppladdad bild":"Uppladdad fil"):this._selectedPreviewTitle}get _resolvedPreviewMeta(){return this._previewSource==="external"&&this._hasExternalPreview?this.previewMeta:this._selectedPreviewMeta}disconnectedCallback(){this._form&&this._formDataHandler&&this._form.removeEventListener("formdata",this._formDataHandler),this._formDataHandler=null,this._form=null,this._revokeObjectUrl(),super.disconnectedCallback()}updated(e){e.has("type")&&this.type==="image"&&this._selectedPreviewKind==="file"&&this._clearSelectedFileState(),(e.has("disabled")||e.has("name"))&&this._syncFormValue()}connectedCallback(){super.connectedCallback(),this._syncFormValue(),this._form=this.closest("form"),this._form&&(this._formDataHandler=e=>{const t=e.formData;t&&this._appendFileToFormData(t)},this._form.addEventListener("formdata",this._formDataHandler))}formDisabledCallback(e){this.disabled=e}formResetCallback(){this.clearPreviewState()}_syncFormValue(){if(this._internals){if(this.disabled||!this.name.trim()||!this._selectedFile){this._internals.setFormValue(null);return}this._internals.setFormValue(this._selectedFile)}}_appendFileToFormData(e){const t=this.name.trim();if(this.disabled||!t||!this._selectedFile)return;e.getAll(t).some(s=>s instanceof File)||e.append(t,this._selectedFile,this._selectedFile.name)}openPicker(){if(this.disabled)return;const e=this.renderRoot.querySelector('[data-role="native-input"]');if(e){try{e.value=""}catch{}e.click()}}setPreviewState(e){this.previewSrc=(e==null?void 0:e.src)??"",this.previewAlt=(e==null?void 0:e.alt)??"",this.previewTitle=(e==null?void 0:e.title)??"",this.previewMeta=(e==null?void 0:e.meta)??"",this._previewSource="external"}clearPreviewState(){this.previewSrc="",this.previewAlt="",this.previewTitle="",this.previewMeta="",this._previewSource="external",this._clearSelectedFileState(),this._clearNativeInputValue()}_dispatch(e,t={},i=!1){const s=new CustomEvent(e,{detail:t,bubbles:!0,composed:!0,cancelable:i});return this.dispatchEvent(s),s}_handleFiles(e){const t=e&&e[0]?e[0]:null;!t||!this._isAcceptedFile(t)||(this._setSelectedFileState(t),this._dispatch("file-selected",{file:t}),this._dispatch("change",{file:t}))}_onZoneClick(e){this.disabled||e.composedPath().some(s=>s instanceof HTMLElement&&s.getAttribute("data-role")==="choose-button")||this.openPicker()}_onZoneKeydown(e){this.disabled||(e.key==="Enter"||e.key===" "||e.key==="Spacebar")&&(e.preventDefault(),this.openPicker())}_preventDefaultDrag(e){e.preventDefault(),e.stopPropagation()}_onDragEnter(e){this.disabled||(this._preventDefaultDrag(e),this._dragDepth+=1,this._isDragOver=!0)}_onDragOver(e){this.disabled||(this._preventDefaultDrag(e),this._isDragOver=!0)}_onDragLeave(e){this.disabled||(this._preventDefaultDrag(e),this._dragDepth=Math.max(0,this._dragDepth-1),this._dragDepth||(this._isDragOver=!1))}_onDrop(e){var t;this.disabled||(this._preventDefaultDrag(e),this._dragDepth=0,this._isDragOver=!1,this._handleFiles(((t=e.dataTransfer)==null?void 0:t.files)??null))}_onNativeInputChange(e){const t=e.currentTarget;this._handleFiles((t==null?void 0:t.files)??null)}_onChooseButtonClick(e){e.preventDefault(),e.stopPropagation(),this.openPicker()}_onReplaceButtonClick(e){e.preventDefault(),e.stopPropagation(),this.openPicker()}_onRemoveButtonClick(e){e.preventDefault(),e.stopPropagation(),this._dispatch("clear-request",{},!0).defaultPrevented||this.clearPreviewState()}_isAcceptedFile(e){const t=this._resolvedAccept.trim();if(!t)return!0;const i=e.name.toLowerCase(),s=(e.type||"").toLowerCase(),r=t.split(",").map(a=>a.trim().toLowerCase()).filter(Boolean);return r.length?r.some(a=>a==="*/*"?!0:a.endsWith("/*")?s.startsWith(a.slice(0,-1)):a.startsWith(".")?i.endsWith(a):s===a):!0}_setSelectedFileState(e){const t=this._getPreviewKindForFile(e),i=this._getFileTypeLabel(e),s=this._formatFileSize(e.size);this._revokeObjectUrl(),this._selectedPreviewKind=t,this._selectedPreviewTitle=e.name||(t==="image"?"Uppladdad bild":"Uppladdad fil"),this._selectedPreviewMeta=[i,s].filter(Boolean).join(" • "),this._selectedPreviewAlt=t==="image"?e.name||"Uppladdad bild":"",this._selectedPreviewSrc="",t==="image"&&(this._objectUrl=URL.createObjectURL(e),this._selectedPreviewSrc=this._objectUrl),this._selectedFile=e,this._previewSource="internal",this._syncFormValue()}_clearSelectedFileState(){this._revokeObjectUrl(),this._selectedPreviewKind="empty",this._selectedPreviewSrc="",this._selectedPreviewAlt="",this._selectedPreviewTitle="",this._selectedPreviewMeta="",this._selectedFile=null,this._syncFormValue()}_clearNativeInputValue(){const e=this.renderRoot.querySelector('[data-role="native-input"]');if(e)try{e.value=""}catch{}}_revokeObjectUrl(){this._objectUrl&&(URL.revokeObjectURL(this._objectUrl),this._objectUrl="")}_getPreviewKindForFile(e){const t=(e.type||"").toLowerCase(),i=this._getFileExtension(e.name).toLowerCase();return t.startsWith("image/")||["png","jpg","jpeg","webp","svg","gif","bmp","avif"].includes(i)?"image":"file"}_getFileExtension(e){const t=/\.([^.]+)$/.exec(e||"");return(t==null?void 0:t[1])??""}_getFileExtensionLabel(e){return(this._getFileExtension(e)||(this._resolvedPreviewKind==="image"?"IMG":"FIL")).slice(0,6).toUpperCase()}_getFileTypeLabel(e){if(e.type)return e.type;const t=this._getFileExtension(e.name);return t?t.toUpperCase():"Okänd filtyp"}_formatFileSize(e){return!Number.isFinite(e)||e<0?"":e<1024?`${e} B`:e<1024*1024?`${new Intl.NumberFormat("sv-SE",{maximumFractionDigits:1}).format(e/1024)} kB`:`${new Intl.NumberFormat("sv-SE",{maximumFractionDigits:1}).format(e/(1024*1024))} MB`}_renderPreviewMedia(){return this._resolvedPreviewKind==="image"&&this._resolvedPreviewSrc?c`<img class="scb-drop-zone__preview-image" src=${this._resolvedPreviewSrc} alt=${this._resolvedPreviewAlt} />`:this._hasPreview?c`
6789
6789
  <div class="scb-drop-zone__preview-file-card">
6790
6790
  <div class="scb-drop-zone__preview-file-card-inner">
6791
6791
  <span class="scb-drop-zone__preview-file-extension">${this._getFileExtensionLabel(this._resolvedPreviewTitle)}</span>
@@ -6849,6 +6849,7 @@
6849
6849
  class="scb-drop-zone__native-input"
6850
6850
  data-role="native-input"
6851
6851
  type="file"
6852
+ .name=${this.name}
6852
6853
  .accept=${this._resolvedAccept}
6853
6854
  ?disabled=${this.disabled}
6854
6855
  @change=${this._onNativeInputChange}
@@ -6874,7 +6875,7 @@
6874
6875
  ${this._renderPreview()}
6875
6876
  </div>
6876
6877
  </div>
6877
- `}};Y.styles=y`
6878
+ `}};U.formAssociated=!0,U.styles=y`
6878
6879
  :host {
6879
6880
  display: block;
6880
6881
  width: 100%;
@@ -7111,7 +7112,7 @@
7111
7112
  grid-template-columns: 1fr;
7112
7113
  }
7113
7114
  }
7114
- `,ee([o({type:String,reflect:!0})],Y.prototype,"type",2),ee([o({type:String})],Y.prototype,"label",2),ee([o({type:String,attribute:"supporting-text"})],Y.prototype,"supportingText",2),ee([o({type:String,attribute:"meta-text"})],Y.prototype,"metaText",2),ee([o({type:String,attribute:"button-label"})],Y.prototype,"buttonLabel",2),ee([o({type:String,attribute:"replace-button-label"})],Y.prototype,"replaceButtonLabel",2),ee([o({type:String,attribute:"remove-button-label"})],Y.prototype,"removeButtonLabel",2),ee([o({type:String,attribute:"preview-eyebrow"})],Y.prototype,"previewEyebrow",2),ee([o({type:String,attribute:"empty-preview-title"})],Y.prototype,"emptyPreviewTitle",2),ee([o({type:String,attribute:"empty-preview-meta"})],Y.prototype,"emptyPreviewMeta",2),ee([o({type:String})],Y.prototype,"accept",2),ee([o({type:Boolean,attribute:"show-preview",reflect:!0})],Y.prototype,"showPreview",2),ee([o({type:Boolean,reflect:!0})],Y.prototype,"disabled",2),ee([o({type:String,attribute:!1})],Y.prototype,"previewSrc",2),ee([o({type:String,attribute:"default-image-src"})],Y.prototype,"defaultImageSrc",2),ee([o({type:String,attribute:!1})],Y.prototype,"previewAlt",2),ee([o({type:String,attribute:!1})],Y.prototype,"previewTitle",2),ee([o({type:String,attribute:!1})],Y.prototype,"previewMeta",2),ee([T()],Y.prototype,"_isDragOver",2),ee([T()],Y.prototype,"_selectedPreviewKind",2),ee([T()],Y.prototype,"_selectedPreviewSrc",2),ee([T()],Y.prototype,"_selectedPreviewAlt",2),ee([T()],Y.prototype,"_selectedPreviewTitle",2),ee([T()],Y.prototype,"_selectedPreviewMeta",2),Y=ee([_("scb-drop-zone")],Y);var ff=Object.defineProperty,gf=Object.getOwnPropertyDescriptor,Ki=(e,t,i,s)=>{for(var r=s>1?void 0:s?gf(t,i):t,a=e.length-1,n;a>=0;a--)(n=e[a])&&(r=(s?n(t,i,r):n(r))||r);return s&&r&&ff(t,i,r),r};let hi=class extends w{constructor(){super(...arguments),this.label="",this.hasSubMenu=!1,this.openLeft=!1,this.divider=!1,this.leadingIcon="",this.trailingIcon="",this.itemHref="",this.href="",this._observedSubMenu=null,this._syncSubMenuFlags=()=>{var r;const e=this.nextElementSibling,t=!!(e&&e.tagName==="SCB-OPTIONS-SUB-MENU"),i=!!(t&&e.hasAttribute("open-left"));t!==this.hasSubMenu&&(this.hasSubMenu=t),i!==this.openLeft&&(this.openLeft=i);const s=t?e:null;s!==this._observedSubMenu&&((r=this._subMenuAttrObserver)==null||r.disconnect(),this._subMenuAttrObserver=void 0,this._observedSubMenu=s,s&&(this._subMenuAttrObserver=new MutationObserver(()=>this._syncSubMenuFlags()),this._subMenuAttrObserver.observe(s,{attributes:!0,attributeFilter:["open-left"]})))},this.handleClick=e=>{this._effectiveHref?this._navigateToHref(e):this._toggleSubMenu()},this._onBlur=e=>{const t=this.closest("scb-options-sub-menu");if(t&&t.open){const i=e.relatedTarget;(!i||!t.contains(i))&&(t.dispatchEvent(new CustomEvent("hide-submenu",{bubbles:!0,composed:!0})),t.dispatchEvent(new CustomEvent("hidesubmenu",{bubbles:!0,composed:!0})))}},this._onFocus=()=>{const e=this.nextElementSibling;this.classList.contains("open-submenu")&&(e&&e.tagName==="SCB-OPTIONS-SUB-MENU"&&e.hasAttribute("open")||this.classList.remove("open-submenu"))},this._onKeyDown=e=>{var t,i,s,r,a,n;if(e.key==="Enter"||e.key===" "){e.preventDefault(),this.handleClick(e);return}if(e.key==="ArrowDown"){e.preventDefault();let l=this.nextElementSibling;for(;l&&l.tagName!=="SCB-OPTIONS-MENU-ITEM";)l=l.nextElementSibling;l&&((i=(t=l.shadowRoot)==null?void 0:t.querySelector("li"))==null||i.focus());return}if(e.key==="ArrowUp"){e.preventDefault();let l=this.previousElementSibling;for(;l&&l.tagName!=="SCB-OPTIONS-MENU-ITEM";)l=l.previousElementSibling;l&&((r=(s=l.shadowRoot)==null?void 0:s.querySelector("li"))==null||r.focus());return}if(e.key==="ArrowRight"){e.preventDefault();const l=this.nextElementSibling;l&&l.tagName==="SCB-OPTIONS-SUB-MENU"&&(l.hasAttribute("open")||(this._toggleSubMenu(),l.dispatchEvent(new CustomEvent("show-submenu",{bubbles:!0,composed:!0})),l.dispatchEvent(new CustomEvent("showsubmenu",{bubbles:!0,composed:!0}))),setTimeout(()=>{var p,b;const d=l.querySelector("scb-options-menu-item");d&&((b=(p=d.shadowRoot)==null?void 0:p.querySelector("li"))==null||b.focus())},0));return}if(e.key==="ArrowLeft"){e.preventDefault();const l=this.nextElementSibling;if(l&&l.tagName==="SCB-OPTIONS-SUB-MENU"&&l.hasAttribute("open")){this._toggleSubMenu(),l.dispatchEvent(new CustomEvent("hide-submenu",{bubbles:!0,composed:!0})),l.dispatchEvent(new CustomEvent("hidesubmenu",{bubbles:!0,composed:!0}));return}const d=this.closest("scb-options-sub-menu");if(d){const p=d.previousElementSibling;p&&p.tagName==="SCB-OPTIONS-MENU-ITEM"&&((n=(a=p.shadowRoot)==null?void 0:a.querySelector("li"))==null||n.focus())}return}}}get _effectiveHref(){return this.itemHref||this.href}connectedCallback(){super.connectedCallback(),this._syncSubMenuFlags(),this._subMenuChildObserver??(this._subMenuChildObserver=new MutationObserver(()=>this._syncSubMenuFlags())),this._subMenuChildObserver.disconnect();const e=this.parentElement;e&&this._subMenuChildObserver.observe(e,{childList:!0})}disconnectedCallback(){var e,t;(e=this._subMenuChildObserver)==null||e.disconnect(),(t=this._subMenuAttrObserver)==null||t.disconnect(),this._subMenuChildObserver=void 0,this._subMenuAttrObserver=void 0,this._observedSubMenu=null,super.disconnectedCallback()}render(){return c`
7115
+ `,ee([o({type:String,reflect:!0})],U.prototype,"type",2),ee([o({type:String})],U.prototype,"name",2),ee([o({type:String})],U.prototype,"label",2),ee([o({type:String,attribute:"supporting-text"})],U.prototype,"supportingText",2),ee([o({type:String,attribute:"meta-text"})],U.prototype,"metaText",2),ee([o({type:String,attribute:"button-label"})],U.prototype,"buttonLabel",2),ee([o({type:String,attribute:"replace-button-label"})],U.prototype,"replaceButtonLabel",2),ee([o({type:String,attribute:"remove-button-label"})],U.prototype,"removeButtonLabel",2),ee([o({type:String,attribute:"preview-eyebrow"})],U.prototype,"previewEyebrow",2),ee([o({type:String,attribute:"empty-preview-title"})],U.prototype,"emptyPreviewTitle",2),ee([o({type:String,attribute:"empty-preview-meta"})],U.prototype,"emptyPreviewMeta",2),ee([o({type:String})],U.prototype,"accept",2),ee([o({type:Boolean,attribute:"show-preview",reflect:!0})],U.prototype,"showPreview",2),ee([o({type:Boolean,reflect:!0})],U.prototype,"disabled",2),ee([o({type:String,attribute:!1})],U.prototype,"previewSrc",2),ee([o({type:String,attribute:"default-image-src"})],U.prototype,"defaultImageSrc",2),ee([o({type:String,attribute:!1})],U.prototype,"previewAlt",2),ee([o({type:String,attribute:!1})],U.prototype,"previewTitle",2),ee([o({type:String,attribute:!1})],U.prototype,"previewMeta",2),ee([T()],U.prototype,"_isDragOver",2),ee([T()],U.prototype,"_selectedPreviewKind",2),ee([T()],U.prototype,"_selectedPreviewSrc",2),ee([T()],U.prototype,"_selectedPreviewAlt",2),ee([T()],U.prototype,"_selectedPreviewTitle",2),ee([T()],U.prototype,"_selectedPreviewMeta",2),U=ee([_("scb-drop-zone")],U);var ff=Object.defineProperty,gf=Object.getOwnPropertyDescriptor,Ki=(e,t,i,s)=>{for(var r=s>1?void 0:s?gf(t,i):t,a=e.length-1,n;a>=0;a--)(n=e[a])&&(r=(s?n(t,i,r):n(r))||r);return s&&r&&ff(t,i,r),r};let hi=class extends w{constructor(){super(...arguments),this.label="",this.hasSubMenu=!1,this.openLeft=!1,this.divider=!1,this.leadingIcon="",this.trailingIcon="",this.itemHref="",this.href="",this._observedSubMenu=null,this._syncSubMenuFlags=()=>{var r;const e=this.nextElementSibling,t=!!(e&&e.tagName==="SCB-OPTIONS-SUB-MENU"),i=!!(t&&e.hasAttribute("open-left"));t!==this.hasSubMenu&&(this.hasSubMenu=t),i!==this.openLeft&&(this.openLeft=i);const s=t?e:null;s!==this._observedSubMenu&&((r=this._subMenuAttrObserver)==null||r.disconnect(),this._subMenuAttrObserver=void 0,this._observedSubMenu=s,s&&(this._subMenuAttrObserver=new MutationObserver(()=>this._syncSubMenuFlags()),this._subMenuAttrObserver.observe(s,{attributes:!0,attributeFilter:["open-left"]})))},this.handleClick=e=>{this._effectiveHref?this._navigateToHref(e):this._toggleSubMenu()},this._onBlur=e=>{const t=this.closest("scb-options-sub-menu");if(t&&t.open){const i=e.relatedTarget;(!i||!t.contains(i))&&(t.dispatchEvent(new CustomEvent("hide-submenu",{bubbles:!0,composed:!0})),t.dispatchEvent(new CustomEvent("hidesubmenu",{bubbles:!0,composed:!0})))}},this._onFocus=()=>{const e=this.nextElementSibling;this.classList.contains("open-submenu")&&(e&&e.tagName==="SCB-OPTIONS-SUB-MENU"&&e.hasAttribute("open")||this.classList.remove("open-submenu"))},this._onKeyDown=e=>{var t,i,s,r,a,n;if(e.key==="Enter"||e.key===" "){e.preventDefault(),this.handleClick(e);return}if(e.key==="ArrowDown"){e.preventDefault();let l=this.nextElementSibling;for(;l&&l.tagName!=="SCB-OPTIONS-MENU-ITEM";)l=l.nextElementSibling;l&&((i=(t=l.shadowRoot)==null?void 0:t.querySelector("li"))==null||i.focus());return}if(e.key==="ArrowUp"){e.preventDefault();let l=this.previousElementSibling;for(;l&&l.tagName!=="SCB-OPTIONS-MENU-ITEM";)l=l.previousElementSibling;l&&((r=(s=l.shadowRoot)==null?void 0:s.querySelector("li"))==null||r.focus());return}if(e.key==="ArrowRight"){e.preventDefault();const l=this.nextElementSibling;l&&l.tagName==="SCB-OPTIONS-SUB-MENU"&&(l.hasAttribute("open")||(this._toggleSubMenu(),l.dispatchEvent(new CustomEvent("show-submenu",{bubbles:!0,composed:!0})),l.dispatchEvent(new CustomEvent("showsubmenu",{bubbles:!0,composed:!0}))),setTimeout(()=>{var p,b;const d=l.querySelector("scb-options-menu-item");d&&((b=(p=d.shadowRoot)==null?void 0:p.querySelector("li"))==null||b.focus())},0));return}if(e.key==="ArrowLeft"){e.preventDefault();const l=this.nextElementSibling;if(l&&l.tagName==="SCB-OPTIONS-SUB-MENU"&&l.hasAttribute("open")){this._toggleSubMenu(),l.dispatchEvent(new CustomEvent("hide-submenu",{bubbles:!0,composed:!0})),l.dispatchEvent(new CustomEvent("hidesubmenu",{bubbles:!0,composed:!0}));return}const d=this.closest("scb-options-sub-menu");if(d){const p=d.previousElementSibling;p&&p.tagName==="SCB-OPTIONS-MENU-ITEM"&&((n=(a=p.shadowRoot)==null?void 0:a.querySelector("li"))==null||n.focus())}return}}}get _effectiveHref(){return this.itemHref||this.href}connectedCallback(){super.connectedCallback(),this._syncSubMenuFlags(),this._subMenuChildObserver??(this._subMenuChildObserver=new MutationObserver(()=>this._syncSubMenuFlags())),this._subMenuChildObserver.disconnect();const e=this.parentElement;e&&this._subMenuChildObserver.observe(e,{childList:!0})}disconnectedCallback(){var e,t;(e=this._subMenuChildObserver)==null||e.disconnect(),(t=this._subMenuAttrObserver)==null||t.disconnect(),this._subMenuChildObserver=void 0,this._subMenuAttrObserver=void 0,this._observedSubMenu=null,super.disconnectedCallback()}render(){return c`
7115
7116
  ${this.divider?c`<scb-divider></scb-divider>`:""}
7116
7117
  <li @click=${this.handleClick} @keydown=${this._onKeyDown} @blur=${this._onBlur} @focus=${this._onFocus} role="menuitem" tabindex="0">
7117
7118
 
@@ -12261,7 +12262,7 @@
12261
12262
  * @license
12262
12263
  * Copyright 2017 Google LLC
12263
12264
  * SPDX-License-Identifier: BSD-3-Clause
12264
- */class vc extends Po{}vc.directiveName="unsafeSVG",vc.resultType=2;const Sy=Br(vc);var $y=Object.defineProperty,zy=Object.getOwnPropertyDescriptor,ph=e=>{throw TypeError(e)},U=(e,t,i,s)=>{for(var r=s>1?void 0:s?zy(t,i):t,a=e.length-1,n;a>=0;a--)(n=e[a])&&(r=(s?n(t,i,r):n(r))||r);return s&&r&&$y(t,i,r),r},Cy=(e,t,i)=>t.has(e)||ph("Cannot "+i),Ey=(e,t,i)=>t.has(e)?ph("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),z=(e,t,i)=>(Cy(e,t,"access private method"),i),$,fc,gc,yc,va,_c,xc,hh,sn,wc,kc,uh,bh,mh,fa,Sc,Te,vh,fh,gh,yh,_h,xh,wh,kh,$c,Sh,zc,Cc,$h,zh,Ec,Tc,Ac,Er,Lc;const Ch=`<svg version="1.1" id="Lager_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
12265
+ */class vc extends Po{}vc.directiveName="unsafeSVG",vc.resultType=2;const Sy=Br(vc);var $y=Object.defineProperty,zy=Object.getOwnPropertyDescriptor,ph=e=>{throw TypeError(e)},j=(e,t,i,s)=>{for(var r=s>1?void 0:s?zy(t,i):t,a=e.length-1,n;a>=0;a--)(n=e[a])&&(r=(s?n(t,i,r):n(r))||r);return s&&r&&$y(t,i,r),r},Cy=(e,t,i)=>t.has(e)||ph("Cannot "+i),Ey=(e,t,i)=>t.has(e)?ph("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),z=(e,t,i)=>(Cy(e,t,"access private method"),i),$,fc,gc,yc,va,_c,xc,hh,sn,wc,kc,uh,bh,mh,fa,Sc,Te,vh,fh,gh,yh,_h,xh,wh,kh,$c,Sh,zc,Cc,$h,zh,Ec,Tc,Ac,Er,Lc;const Ch=`<svg version="1.1" id="Lager_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
12265
12266
  viewBox="0 0 727.3 87.3" style="enable-background:new 0 0 727.3 87.3;" xml:space="preserve" fill="currentColor">
12266
12267
  <style type="text/css">
12267
12268
  .st0{clip-path:url(#SVGID_00000118375311472882578510000008414848687067442345_);}
@@ -12376,7 +12377,7 @@
12376
12377
  <path d="M688.2,24.4h5.8v6h-5.8V24.4z M688.2,36.6h5.8v30.1h-5.8V36.6z"/>
12377
12378
  <path d="M701.8,24.4h5.8v26.3h0.1l11.2-14.1h7l-10,11.7l11.4,18.3H720l-7.7-14l-4.6,5.4v8.7h-5.8V24.4H701.8z"/>
12378
12379
  </svg>
12379
- `;let q=class extends w{constructor(){super(...arguments),Ey(this,$),this.variant="Standard",this.selectedChip="Diagram",this.title="",this.subtitle="",this.description="",this.comment="",this.source="",this.footnote="",this.lang="sv",this.imageHref="",this.officialStatistics=!1,this.disableToggle=!1,this.contentMaxWidth="",this.containerMaxWidth="",this.contentHeight="",this.toggleHeightMode="stable",this._actionsMenuOpen=!1,this._seriesDifferentiationEnabled=!1,this._seriesDifferentiationSnapshots=new WeakMap,this._diagramReflowFrame=0,this._chartConfigSyncFrame=0,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this._onDocumentPointerDown=e=>{var s;if(!this._actionsMenuOpen)return;const t=e.composedPath(),i=(s=this.shadowRoot)==null?void 0:s.querySelector(".actions-menu");i&&t.includes(i)||this._closeActionsMenu()},this._onDocumentKeyDown=e=>{this._actionsMenuOpen&&e.key==="Escape"&&(e.preventDefault(),this._closeActionsMenu(),this._focusMenuButton())},this._onPrintClick=async()=>{this._closeActionsMenu(),await z(this,$,_h).call(this)},this._onDownloadPngClick=async()=>{this._canExportRaster()&&(this._closeActionsMenu(),await z(this,$,Sc).call(this,"png"))},this._onDownloadJpgClick=async()=>{this._canExportRaster()&&(this._closeActionsMenu(),await z(this,$,Sc).call(this,"jpeg"))},this._onDownloadCsvClick=()=>{this._canExportCsv()&&(this._closeActionsMenu(),z(this,$,xh).call(this))},this._onToggleSeriesDifferentiationClick=()=>{this._seriesDifferentiationEnabled=!this._seriesDifferentiationEnabled,this._closeActionsMenu(),z(this,$,fa).call(this)}}get descriptionLabel(){return this.lang==="en"?"Description of the chart":"Beskrivning av diagrammet"}get moreAboutStatsLabel(){return this.lang==="en"?"More about the statistics":"Mer om statistiken"}get commentLabel(){return this.lang==="en"?"Comments":"Kommentar"}get sourceLabel(){return this.lang==="en"?"Source":"Källa"}get footnoteLabel(){return this.lang==="en"?"Footnotes":"Fotnot"}get officialStatisticsLabel(){return this.lang==="en"?"Official statistics of Sweden":"Sveriges officiella statistik"}get officialStatisticsTitle(){return this.lang==="en"?"Part of Official statistics of Sweden":"Tillhör Sveriges officiella statistik"}get officialStatisticsAlt(){return this.lang==="en"?"Read more about Official statistics of Sweden":"Läs mer om Sveriges officiella statistik"}get actionsMenuLabel(){return this.lang==="en"?"Open menu":"Öppna meny"}get printLabel(){return this.lang==="en"?"Print":"Skriv ut"}get downloadPngLabel(){return this.lang==="en"?"Download PNG":"Ladda ner PNG"}get downloadJpgLabel(){return this.lang==="en"?"Download JPG":"Ladda ner JPG"}get downloadCsvLabel(){return this.lang==="en"?"Download CSV":"Ladda ner CSV"}get enableSeriesDifferentiationLabel(){return this.lang==="en"?"Show symbols and patterns":"Visa symboler och mönster"}get disableSeriesDifferentiationLabel(){return this.lang==="en"?"Hide symbols and patterns":"Dölj symboler och mönster"}_getImageAltText(){return[this.title,this.subtitle,this.description].map(t=>typeof t=="string"?t.trim():"").filter(Boolean).join(". ")||(this.lang==="en"?"Image figure":"Bildfigur")}connectedCallback(){super.connectedCallback(),document.addEventListener("pointerdown",this._onDocumentPointerDown,!0),document.addEventListener("keydown",this._onDocumentKeyDown)}firstUpdated(e){this._readTableDataFromSlot(),z(this,$,Ac).call(this),z(this,$,Lc).call(this),z(this,$,sn).call(this),this._syncChipClass(),z(this,$,fc).call(this),z(this,$,va).call(this)}updated(e){super.updated(e),(e.has("selectedChip")||e.has("variant"))&&(this._syncChipClass(),this._closeActionsMenu()),e.has("selectedChip")&&this._dispatchSelectedChipChanged(),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&z(this,$,Ac).call(this),e.has("containerMaxWidth")&&z(this,$,Lc).call(this),e.has("variant")&&z(this,$,fc).call(this),(e.has("contentMaxWidth")||e.has("contentHeight")||e.has("toggleHeightMode")||e.has("variant"))&&z(this,$,sn).call(this),(e.has("selectedChip")||e.has("variant")||e.has("contentMaxWidth")||e.has("contentHeight")||e.has("toggleHeightMode"))&&z(this,$,va).call(this),(e.has("selectedChip")||e.has("variant"))&&this._seriesDifferentiationEnabled&&requestAnimationFrame(()=>{z(this,$,fa).call(this)}),(e.has("valueFormat")||e.has("timeFormat")||e.has("yAxisSettings")||e.has("selectedChip")||e.has("variant"))&&z(this,$,kc).call(this)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("pointerdown",this._onDocumentPointerDown,!0),document.removeEventListener("keydown",this._onDocumentKeyDown),z(this,$,gc).call(this),z(this,$,yc).call(this),z(this,$,wc).call(this)}_onTableSlotChange(e){const t=e.target;t&&(this._readTableDataFromSlot(t),this.requestUpdate())}_onDiagramSlotChange(){z(this,$,sn).call(this),z(this,$,va).call(this),z(this,$,kc).call(this),this._seriesDifferentiationEnabled&&requestAnimationFrame(()=>{z(this,$,fa).call(this)}),this.requestUpdate()}_normalizeRenderableCell(e){return e&&typeof e=="object"&&"html"in e&&"text"in e?{html:typeof e.html=="string"?e.html:"",text:typeof e.text=="string"?e.text:""}:{html:"",text:e==null?"":String(e)}}_readTableDataFromSlot(e){var g;const t=e||((g=this.shadowRoot)==null?void 0:g.querySelector('slot[name="table"]'));if(!t)return;const i=t.assignedElements({flatten:!0}),s=[];i.forEach(f=>{if(f.tagName==="TABLE"){s.push(f);return}f.querySelectorAll("table").forEach(x=>s.push(x))});const r=s[0];if(!r){this._slottedTableData=void 0;return}const a=[],n=[],l=[],d=f=>f?(f.textContent??"").replace(/\s+/g," ").trim():"",p=f=>f?{html:(f.innerHTML??"").trim(),text:d(f)}:{html:"",text:""},b=r.querySelector("thead tr");b&&Array.from(b.querySelectorAll("th, td")).forEach(x=>a.push(p(x)));const u=Array.from(r.querySelectorAll("tbody tr")),v=u.length>0?u:Array.from(r.querySelectorAll("tr")).filter(f=>f.closest("thead")===null);if(v.forEach(f=>{const x=Array.from(f.querySelectorAll("th, td"));if(x.length===0)return;const k=x[0].tagName==="TH"&&f.closest("thead")===null&&f.closest("tfoot")===null;l.push(k);const C=[];x.forEach(S=>C.push(p(S))),n.push(C)}),!b&&n.length>0){const f=n[0],x=v[0],k=Array.from((x==null?void 0:x.querySelectorAll("th, td"))??[]);k.length>0&&k.every(S=>S.tagName==="TH")&&(x==null?void 0:x.closest("tbody"))===null&&(a.splice(0,a.length,...f),n.shift(),l.shift())}this._slottedTableData={headers:a.length>0?a:void 0,rows:n,rowHeaderRows:l.length>0?l:void 0}}_inferTableAlignments(e){var r;const t=Math.max(((r=e.headers)==null?void 0:r.length)??0,...e.rows.map(a=>a.length)),i=a=>{if(a==null)return!1;if(typeof a=="number")return!0;const n=String(a).replace(/[\u00A0\u202F\s]+/g,"").trim();return n?/^-?\d+(?:[.,]\d+)?$/.test(n):!1},s=[];for(let a=0;a<t;a+=1){if(a===0){s.push("left");continue}const n=e.rows.map(d=>this._normalizeRenderableCell(d[a]).text).filter(d=>d!==""&&d!==null&&d!==void 0),l=n.length>0&&n.every(i);s.push(l?"right":"left")}return s}_getResolvedContentMaxWidth(){var e;return((e=this.contentMaxWidth)==null?void 0:e.trim())||""}_getResolvedDiagramHeight(){var e;return((e=this.contentHeight)==null?void 0:e.trim())||""}_getResolvedToggleHeightMode(){return this.toggleHeightMode==="auto"?"auto":"stable"}_getResolvedStandardContentHeight(){return this._getResolvedDiagramHeight()||"420px"}_getResolvedTableData(){return this.tableData??this._slottedTableData}_getDiagramAssignedElements(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector('slot[name="diagram"]');return e?e.assignedElements({flatten:!0}):[]}_findExportableVisualElement(e){for(const t of e){if(t instanceof SVGSVGElement||t instanceof HTMLCanvasElement||t instanceof HTMLImageElement)return t;const i=t.querySelector("svg, canvas, img");if(i instanceof SVGSVGElement||i instanceof HTMLCanvasElement||i instanceof HTMLImageElement)return i}return null}_getExportableVisualElement(){var e;if(this.variant==="Table")return null;if(this.variant==="Image"){const t=(e=this.shadowRoot)==null?void 0:e.querySelector(".image-content img");return t instanceof HTMLImageElement?t:null}return this._findExportableVisualElement(this._getDiagramAssignedElements())}_getDefaultValueFormat(){return{type:"number",scale:"auto",decimals:0}}_normalizeValueFormat(e){const t=this._getDefaultValueFormat(),i=e&&typeof e=="object"?e:{},s=["number","currency","percent"].includes(String(i.type))?String(i.type):t.type,r=["auto","raw","thousands","millions","billions"].includes(String(i.scale))?String(i.scale):t.scale,a=Number.isFinite(Number(i.decimals))?Math.max(0,Math.min(20,Number(i.decimals))):t.decimals;return{type:s,scale:r,decimals:a}}_normalizeTimeFormat(e){const t={mode:"raw",display:"raw"},i=e&&typeof e=="object"?e:{},s=["raw","year","monthCode","quarterCode","weekCode","tertialCode"];let r=typeof i.mode=="string"?i.mode:t.mode,a=typeof i.display=="string"?i.display:t.display;s.includes(r)||(r=t.mode);const n={raw:["raw"],year:["raw","year"],monthCode:["raw","iso-month","short-month","long-month"],quarterCode:["raw","quarter-compact","quarter-short","quarter-long"],weekCode:["raw","week-compact","week-long"],tertialCode:["raw","tertial-compact","tertial-short","tertial-long"]};return n[r].includes(a)||(a=n[r][0]),r==="raw"&&(a="raw"),{mode:r,display:a}}_normalizeYAxisSettings(e){const t=e&&typeof e=="object"?e:{},i=Number.isFinite(Number(t.referenceLineValue))?Number(t.referenceLineValue):null;return{startAtZero:!!t.startAtZero,referenceLineEnabled:!!t.referenceLineEnabled&&Number.isFinite(i),referenceLineValue:i,referenceLineLabel:typeof t.referenceLineLabel=="string"?t.referenceLineLabel:""}}_getShortMonthNames(){return["jan","feb","mar","apr","maj","jun","jul","aug","sep","okt","nov","dec"]}_getLongMonthNames(){return["januari","februari","mars","april","maj","juni","juli","augusti","september","oktober","november","december"]}_formatCategoryTimeLabel(e,t){if(!e||t.mode==="raw"||t.display==="raw")return null;if(t.mode==="year"){const i=/^\s*(\d{4})\s*$/.exec(e);return i?i[1]:null}if(t.mode==="monthCode"){const i=/^\s*(\d{4})M(0?[1-9]|1[0-2])\s*$/i.exec(e);if(!i)return null;const s=Number(i[2])-1,r=i[1],a=String(s+1).padStart(2,"0");return t.display==="iso-month"?`${r}-${a}`:t.display==="short-month"?`${this._getShortMonthNames()[s]} ${r}`:t.display==="long-month"?`${this._getLongMonthNames()[s]} ${r}`:e}if(t.mode==="quarterCode"){const i=/^\s*(\d{4})(?:K(V)?|Q)(0?[1-4])\s*$/i.exec(e);if(!i)return null;const s=Number(i[3]),r=i[1],a=["första","andra","tredje","fjärde"];return t.display==="quarter-compact"?`${r} K${s}`:t.display==="quarter-short"?`kv ${s} ${r}`:t.display==="quarter-long"?`${a[s-1]} kvartalet ${r}`:e}if(t.mode==="weekCode"){const i=/^\s*(\d{4})(?:V|W)(0?[1-9]|[1-4][0-9]|5[0-3])\s*$/i.exec(e);if(!i)return null;const s=Number(i[2]),r=i[1];return t.display==="week-compact"?`${r} v. ${s}`:t.display==="week-long"?`vecka ${s} ${r}`:e}if(t.mode==="tertialCode"){const i=/^\s*(\d{4})T(0?[1-3])\s*$/i.exec(e);if(!i)return null;const s=Number(i[2]),r=i[1],a=["första","andra","tredje"];return t.display==="tertial-compact"?`${r} T${s}`:t.display==="tertial-short"?`tertial ${s} ${r}`:t.display==="tertial-long"?`${a[s-1]} tertialet ${r}`:e}return null}_formatLocalizedNumber(e,t){return new Intl.NumberFormat(this.lang==="en"?"en-GB":"sv-SE",{minimumFractionDigits:t,maximumFractionDigits:t}).format(e)}_formatValueForDisplay(e,t,i){if(!Number.isFinite(e))return null;const s={raw:1,thousands:1e3,millions:1e6,billions:1e9},r={raw:"",thousands:this.lang==="en"?"k":"t",millions:this.lang==="en"?"M":"mn",billions:this.lang==="en"?"B":"md"};let a=t.scale;if(a==="auto"){const p=Math.abs(e);p>=1e9?a="billions":p>=1e6?a="millions":p>=1e3?a="thousands":a="raw"}const n=e/(s[a]||1);let l=this._formatLocalizedNumber(n,t.decimals);t.type==="percent"?l=`${l} %`:t.type==="currency"&&(l=i?`${l} kr`:l);const d=r[a]||"";return d&&(l=`${l} ${d}`),l}_isCategoryAxis(e){var t,i;return((t=e==null?void 0:e.categories)==null?void 0:t.length)>0||((i=e==null?void 0:e.options)==null?void 0:i.type)==="category"}_applyTimeFormatToLiveChart(e){const t=this._normalizeTimeFormat(this.timeFormat);if(t.mode==="raw"||t.display==="raw")return;const i=this._formatCategoryTimeLabel.bind(this);[...(e==null?void 0:e.xAxis)||[],...(e==null?void 0:e.yAxis)||[]].forEach(s=>{var n;if(!this._isCategoryAxis(s))return;const r=(n=s.options)!=null&&n.labels&&typeof s.options.labels=="object"?{...s.options.labels}:{},a=typeof r.formatter=="function"?r.formatter:null;r.formatter=function(){let l="";if(this!=null&&this.axis&&Array.isArray(this.axis.categories)&&typeof this.pos=="number"){const p=this.axis.categories[this.pos];typeof p<"u"&&p!==null&&(l=String(p))}else typeof(this==null?void 0:this.value)<"u"&&this.value!==null&&(l=String(this.value));const d=i(l,t);return d!==null?d:a?a.call(this):l},delete r.format,s.update({labels:r},!1)})}_applyValueFormatToLiveChart(e){var s,r,a,n,l,d,p;const t=this._normalizeValueFormat(this.valueFormat),i=this._formatValueForDisplay.bind(this);e.update({tooltip:{...((s=e.options)==null?void 0:s.tooltip)||{},valueDecimals:t.decimals,formatter:function(){const b=Array.isArray(this.points)&&this.points.length?this.points:[this.point||this];let u="";const v=[];return typeof this.x<"u"&&this.x!==null?u=`<span>${String(this.x)}</span><br/>`:typeof this.key<"u"&&this.key!==null&&(u=`<span>${String(this.key)}</span><br/>`),b.forEach(g=>{var S;const f=(g==null?void 0:g.point)||g,x=Number.isFinite(g==null?void 0:g.y)?g.y:f==null?void 0:f.y,k=i(x,t,!0);if(k===null)return;const C=(f==null?void 0:f.name)||((S=f==null?void 0:f.series)==null?void 0:S.name)||"";v.push(`${C?`${String(C)}: `:""}<b>${k}</b><br/>`)}),u+v.join("")}},plotOptions:{...((r=e.options)==null?void 0:r.plotOptions)||{},series:{...((n=(a=e.options)==null?void 0:a.plotOptions)==null?void 0:n.series)||{},dataLabels:{...((p=(d=(l=e.options)==null?void 0:l.plotOptions)==null?void 0:d.series)==null?void 0:p.dataLabels)||{},formatter:function(){var u;const b=Number.isFinite(this==null?void 0:this.y)?this.y:(u=this==null?void 0:this.point)==null?void 0:u.y;return i(b,t,t.type==="percent")??null}}}}},!1,!1,!1),((e==null?void 0:e.yAxis)||[]).forEach(b=>{var f,x;const u=(f=b.options)!=null&&f.labels&&typeof b.options.labels=="object"?{...b.options.labels}:{},v=typeof u.formatter=="function"?u.formatter:null,g=!((x=b.options)!=null&&x.title&&typeof b.options.title.text=="string"&&b.options.title.text.trim());u.formatter=function(){const k=i(this==null?void 0:this.value,t,g);return k!==null?k:v?v.call(this):this==null?void 0:this.value},(t.type==="percent"||t.scale!=="auto")&&delete u.format,b.update({labels:u},!1)})}_applyYAxisSettingsToLiveChart(e){const t=this._normalizeYAxisSettings(this.yAxisSettings),i=(e==null?void 0:e.yAxis)||[];i.length&&i.forEach((s,r)=>{const a=s.options&&typeof s.options=="object"?s.options:{},n={},l=typeof a.min<"u"&&a.min!==null&&a.min!=="";r===0&&t.startAtZero&&!l&&(n.min=0);const d=Array.isArray(a.plotLines)?a.plotLines.filter(p=>(p==null?void 0:p.id)!=="scb-viz-reference-line"):[];r===0&&t.referenceLineEnabled&&Number.isFinite(t.referenceLineValue)&&d.push({id:"scb-viz-reference-line",className:"scb-axis-plotline scb-viz-reference-line",value:t.referenceLineValue,label:t.referenceLineLabel?{text:t.referenceLineLabel,className:"scb-viz-reference-line-label"}:void 0}),d.length?n.plotLines=d:Array.isArray(a.plotLines)&&(n.plotLines=[]),s.update(n,!1)})}_getCurrentHighchartsChart(){var i;if(this._getCurrentPrintableView()!=="diagram")return;const e=z(this,$,xc).call(this,this._getDiagramAssignedElements());if(e===void 0)return;const t=window.Highcharts;return(i=t==null?void 0:t.charts)==null?void 0:i[e]}_getSeriesDifferentiationGroup(e,t){var s,r,a;const i=String((e==null?void 0:e.type)||((s=e==null?void 0:e.options)==null?void 0:s.type)||((a=(r=t==null?void 0:t.options)==null?void 0:r.chart)==null?void 0:a.type)||"").trim().toLowerCase();return["line","spline","scatter"].includes(i)?"line":["area","areaspline"].includes(i)?"area":["column","bar"].includes(i)?"fill":["pie","variablepie"].includes(i)?"point-fill":null}_shouldShowSeriesDifferentiationAction(){var t;if(this._getCurrentPrintableView()!=="diagram")return!1;const e=this._getCurrentHighchartsChart();return!((t=e==null?void 0:e.series)!=null&&t.length)||!this._isHighchartsStyledMode(e)?!1:e.series.some(i=>this._getSeriesDifferentiationGroup(i,e)!==null)}_getSeriesDifferentiationSnapshotStore(e){let t=this._seriesDifferentiationSnapshots.get(e);return t||(t=new Map,this._seriesDifferentiationSnapshots.set(e,t)),t}_cloneSeriesOptionValue(e){return Array.isArray(e)?e.map(t=>this._cloneSeriesOptionValue(t)):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([t,i])=>[t,this._cloneSeriesOptionValue(i)])):e}_captureSeriesDifferentiationSnapshot(e){var i;const t=this._cloneSeriesOptionValue((i=e==null?void 0:e.options)==null?void 0:i.marker);return{marker:t&&Object.keys(t).length>0?t:{enabled:!1}}}_getHighchartsSvgElement(e){const t=(e==null?void 0:e.element)??e;return t instanceof SVGElement?t:null}_isHighchartsStyledMode(e){var t,i,s;return!!(e!=null&&e.styledMode||(t=e==null?void 0:e.renderer)!=null&&t.styledMode||(s=(i=e==null?void 0:e.options)==null?void 0:i.chart)!=null&&s.styledMode)}_getHighchartsSvgRoot(e){var i,s,r;if((e==null?void 0:e.container)instanceof SVGSVGElement)return e.container;const t=((i=e==null?void 0:e.renderTo)==null?void 0:i.querySelector("svg"))??((r=(s=e==null?void 0:e.container)==null?void 0:s.querySelector)==null?void 0:r.call(s,"svg"));return t instanceof SVGSVGElement?t:null}_getHighchartsColorClassName(e,t){const i=this._getHighchartsSvgElement(e);return Array.from((i==null?void 0:i.classList)??[]).find(r=>/^highcharts-color-\d+$/.test(r))??`highcharts-color-${t}`}_setSeriesDifferentiationMetadata(e,t){const i=this._getHighchartsSvgElement(e);i&&(i.setAttribute("data-scb-viz-role",t.role),t.dashStyle?i.setAttribute("data-scb-viz-dash-style",t.dashStyle):i.removeAttribute("data-scb-viz-dash-style"),t.patternKind?i.setAttribute("data-scb-viz-pattern-kind",t.patternKind):i.removeAttribute("data-scb-viz-pattern-kind"))}_clearSeriesDifferentiationMetadata(e){const t=this._getHighchartsSvgElement(e);t&&(t.removeAttribute("data-scb-viz-role"),t.removeAttribute("data-scb-viz-dash-style"),t.removeAttribute("data-scb-viz-pattern-kind"))}_getSeriesDifferentiationDashStyles(){return["Solid","ShortDash","ShortDot","ShortDashDot","ShortDashDotDot","Dot","LongDash","LongDashDot","Dash","DashDot"]}_getSeriesDifferentiationMarkerSymbols(){return["circle","diamond","square","triangle","triangle-down"]}_getSeriesDifferentiationPatternKinds(){return["diagonal","dots","cross","vertical","horizontal","grid","diagonal-reverse","dots-dense","checker","zigzag"]}_setSeriesDifferentiationColorClass(e,t){const i=this._getHighchartsSvgElement(e);if(!i||!t)return;const s=Array.from(i.classList).find(r=>/^highcharts-color-\d+$/.test(r));s!==t&&(s&&(i.classList.remove(s),i.setAttribute("data-scb-viz-prev-color-class",s)),i.classList.add(t),i.setAttribute("data-scb-viz-added-color-class",t))}_clearSeriesDifferentiationColorClass(e){const t=this._getHighchartsSvgElement(e);if(!t)return;const i=t.getAttribute("data-scb-viz-added-color-class"),s=t.getAttribute("data-scb-viz-prev-color-class");i&&(t.classList.remove(i),t.removeAttribute("data-scb-viz-added-color-class")),s&&(t.classList.add(s),t.removeAttribute("data-scb-viz-prev-color-class"))}_getLegendSeriesDifferentiationTargets(e){var n,l,d,p;const t=[],i=[],s=this._getHighchartsSvgElement((n=e==null?void 0:e.legendItem)==null?void 0:n.group),r=(b,u)=>{const v=this._getHighchartsSvgElement(u);!v||b.includes(v)||b.push(v)};if(r(t,e==null?void 0:e.legendLine),r(t,(l=e==null?void 0:e.legendItem)==null?void 0:l.line),r(i,e==null?void 0:e.legendSymbol),r(i,(d=e==null?void 0:e.legendItem)==null?void 0:d.symbol),r(i,e==null?void 0:e.legendArea),r(i,(p=e==null?void 0:e.legendItem)==null?void 0:p.area),s){const b=s.querySelector(".highcharts-graph, .highcharts-legend-graph, line, path");b&&r(t,b),s.querySelectorAll("rect, circle, .highcharts-point, .highcharts-area, .highcharts-legend-symbol, path").forEach(u=>{r(i,u)})}const a=i.filter(b=>!t.includes(b));return{graphTargets:t,fillTargets:a}}_ensureStyledModeSeriesPattern(e,t,i){const s=this._getHighchartsSvgRoot(e);if(!s)return;const r="http://www.w3.org/2000/svg";let a=s.querySelector("defs");a instanceof SVGDefsElement||(a=document.createElementNS(r,"defs"),s.insertBefore(a,s.firstChild));const n=`scb-viz-pattern-${t}-${i}`;if(a.querySelector(`#${n}`))return;const l=document.createElementNS(r,"pattern");l.setAttribute("id",n),l.setAttribute("patternUnits","userSpaceOnUse"),l.setAttribute("width","10"),l.setAttribute("height","10"),l.classList.add(t);const d=document.createElementNS(r,"rect");d.setAttribute("x","0"),d.setAttribute("y","0"),d.setAttribute("width","10"),d.setAttribute("height","10"),d.setAttribute("class","scb-viz-highcharts-pattern__background"),l.appendChild(d);const p=(v,g="1.25")=>{const f=document.createElementNS(r,"path");return f.setAttribute("d",v),f.setAttribute("class","scb-viz-highcharts-pattern__mark"),f.setAttribute("stroke-width",g),f.setAttribute("stroke-linecap","square"),f},b=(v,g,f)=>{const x=document.createElementNS(r,"circle");return x.setAttribute("cx",v),x.setAttribute("cy",g),x.setAttribute("r",f),x.setAttribute("class","scb-viz-highcharts-pattern__mark--dot"),x},u=(v,g,f,x)=>{const k=document.createElementNS(r,"rect");return k.setAttribute("x",v),k.setAttribute("y",g),k.setAttribute("width",f),k.setAttribute("height",x),k.setAttribute("class","scb-viz-highcharts-pattern__mark--square"),k};switch(i){case"diagonal":l.appendChild(p("M-2,8 l10,-10 M0,10 l10,-10 M8,12 l4,-4"));break;case"dots":l.appendChild(b("2","2","1.2")),l.appendChild(b("7","7","1.2"));break;case"cross":l.appendChild(p("M0,0 L10,10 M10,0 L0,10"));break;case"vertical":l.appendChild(p("M2,0 L2,10 M7,0 L7,10"));break;case"horizontal":l.appendChild(p("M0,2 L10,2 M0,7 L10,7"));break;case"diagonal-reverse":l.appendChild(p("M0,0 L10,10 M-2,2 L8,12 M2,-2 L12,8"));break;case"dots-dense":l.appendChild(b("2","2","1")),l.appendChild(b("7","2","1")),l.appendChild(b("2","7","1")),l.appendChild(b("7","7","1"));break;case"checker":l.appendChild(u("0","0","4","4")),l.appendChild(u("5","5","4","4"));break;case"zigzag":l.appendChild(p("M-2,8 L2,4 L6,8 L10,4 L14,8 M-2,3 L2,-1 L6,3 L10,-1 L14,3"));break;default:l.appendChild(p("M0,0 L10,0 M0,5 L10,5 M0,10 L10,10","1"));break}a.appendChild(l)}_applyStyledModeSeriesDifferentiation(e){var n;const t=this._getHighchartsSvgRoot(e);if(!t)return;t.classList.add("scb-viz-series-differentiation-enabled");const i=this._getSeriesDifferentiationDashStyles(),s=this._getSeriesDifferentiationMarkerSymbols(),r=this._getSeriesDifferentiationPatternKinds(),a=this._getSeriesDifferentiationSnapshotStore(e);(n=e.series)==null||n.forEach((l,d)=>{var k,C;const p=this._getSeriesDifferentiationGroup(l,e);if(!p)return;const b=String((l==null?void 0:l.index)??d);a.has(b)||a.set(b,this._captureSeriesDifferentiationSnapshot(l));const u=i[d%i.length],v=r[d%r.length],g=s[d%s.length],f=this._getHighchartsColorClassName((l==null?void 0:l.graph)??(l==null?void 0:l.area)??(l==null?void 0:l.group),d),x=this._getLegendSeriesDifferentiationTargets(l);this._setSeriesDifferentiationMetadata(l==null?void 0:l.graph,{role:"graph",dashStyle:u}),p==="area"&&(this._setSeriesDifferentiationMetadata(l==null?void 0:l.area,{role:"area",patternKind:v}),this._setSeriesDifferentiationColorClass(l==null?void 0:l.area,f),this._ensureStyledModeSeriesPattern(e,f,v)),p==="fill"&&((k=l.points)==null||k.forEach(S=>{this._setSeriesDifferentiationMetadata(S==null?void 0:S.graphic,{role:"fill",patternKind:v}),this._setSeriesDifferentiationColorClass(S==null?void 0:S.graphic,f)}),this._ensureStyledModeSeriesPattern(e,f,v)),p==="point-fill"&&((C=l.points)==null||C.forEach((S,B)=>{var de,H;const F=r[B%r.length],j=this._getHighchartsColorClassName((S==null?void 0:S.graphic)??(S==null?void 0:S.legendSymbol)??((de=S==null?void 0:S.legendItem)==null?void 0:de.symbol)??((H=S==null?void 0:S.legendItem)==null?void 0:H.group),B),Ct=this._getLegendSeriesDifferentiationTargets(S);this._setSeriesDifferentiationMetadata(S==null?void 0:S.graphic,{role:"fill",patternKind:F}),this._setSeriesDifferentiationColorClass(S==null?void 0:S.graphic,j),this._ensureStyledModeSeriesPattern(e,j,F),Ct.fillTargets.forEach(Xe=>{this._setSeriesDifferentiationMetadata(Xe,{role:"legend-fill",patternKind:F}),this._setSeriesDifferentiationColorClass(Xe,j)})})),(p==="line"||p==="area")&&x.graphTargets.forEach(S=>{this._setSeriesDifferentiationMetadata(S,{role:"legend-symbol",dashStyle:u})}),(p==="area"||p==="fill")&&x.fillTargets.forEach(S=>{this._setSeriesDifferentiationMetadata(S,{role:"legend-fill",patternKind:v}),this._setSeriesDifferentiationColorClass(S,f)}),(p==="line"||p==="area")&&l.update({marker:{enabled:!0,symbol:g}},!1)}),e.redraw(!1)}_restoreStyledModeSeriesDifferentiation(e){var s;const t=this._getHighchartsSvgRoot(e);t==null||t.classList.remove("scb-viz-series-differentiation-enabled");const i=this._getSeriesDifferentiationSnapshotStore(e);(s=e.series)==null||s.forEach((r,a)=>{var d;const n=this._getSeriesDifferentiationGroup(r,e);if(!n)return;const l=this._getLegendSeriesDifferentiationTargets(r);if(this._clearSeriesDifferentiationMetadata(r==null?void 0:r.graph),this._clearSeriesDifferentiationMetadata(r==null?void 0:r.area),this._clearSeriesDifferentiationColorClass(r==null?void 0:r.area),(d=r.points)==null||d.forEach(p=>{const b=this._getLegendSeriesDifferentiationTargets(p);this._clearSeriesDifferentiationMetadata(p==null?void 0:p.graphic),this._clearSeriesDifferentiationColorClass(p==null?void 0:p.graphic),b.graphTargets.forEach(u=>{this._clearSeriesDifferentiationMetadata(u)}),b.fillTargets.forEach(u=>{this._clearSeriesDifferentiationMetadata(u),this._clearSeriesDifferentiationColorClass(u)})}),l.graphTargets.forEach(p=>{this._clearSeriesDifferentiationMetadata(p)}),l.fillTargets.forEach(p=>{this._clearSeriesDifferentiationMetadata(p),this._clearSeriesDifferentiationColorClass(p)}),n==="line"||n==="area"){const p=i.get(String((r==null?void 0:r.index)??a));r.update({marker:this._cloneSeriesOptionValue(p==null?void 0:p.marker)},!1)}}),e.redraw(!1)}_canExportRaster(){return this._getExportableVisualElement()!==null}_canExportCsv(){var t;const e=this._getResolvedTableData();return!!((t=e==null?void 0:e.rows)!=null&&t.length)}_getExportBaseFileName(){const e=this.lang==="en"?"visualization":"visualisering";return(this.title||e).normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||e}_buildExportFileName(e){const t=e==="csv"?this.lang==="en"?"-table":"-tabell":"";return`${this._getExportBaseFileName()}${t}.${e}`}_renderActionsMenu(){const e=this._getCurrentPrintableView(),t=this._canExportRaster(),i=this._canExportCsv(),s=t&&(e==="diagram"||e==="image"),r=i&&e==="table",a=this._shouldShowSeriesDifferentiationAction();return c`
12380
+ `;let q=class extends w{constructor(){super(...arguments),Ey(this,$),this.variant="Standard",this.selectedChip="Diagram",this.title="",this.subtitle="",this.description="",this.comment="",this.source="",this.footnote="",this.lang="sv",this.imageHref="",this.officialStatistics=!1,this.disableToggle=!1,this.contentMaxWidth="",this.containerMaxWidth="",this.contentHeight="",this.toggleHeightMode="stable",this._actionsMenuOpen=!1,this._seriesDifferentiationEnabled=!1,this._seriesDifferentiationSnapshots=new WeakMap,this._diagramReflowFrame=0,this._chartConfigSyncFrame=0,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this._onDocumentPointerDown=e=>{var s;if(!this._actionsMenuOpen)return;const t=e.composedPath(),i=(s=this.shadowRoot)==null?void 0:s.querySelector(".actions-menu");i&&t.includes(i)||this._closeActionsMenu()},this._onDocumentKeyDown=e=>{this._actionsMenuOpen&&e.key==="Escape"&&(e.preventDefault(),this._closeActionsMenu(),this._focusMenuButton())},this._onPrintClick=async()=>{this._closeActionsMenu(),await z(this,$,_h).call(this)},this._onDownloadPngClick=async()=>{this._canExportRaster()&&(this._closeActionsMenu(),await z(this,$,Sc).call(this,"png"))},this._onDownloadJpgClick=async()=>{this._canExportRaster()&&(this._closeActionsMenu(),await z(this,$,Sc).call(this,"jpeg"))},this._onDownloadCsvClick=()=>{this._canExportCsv()&&(this._closeActionsMenu(),z(this,$,xh).call(this))},this._onToggleSeriesDifferentiationClick=()=>{this._seriesDifferentiationEnabled=!this._seriesDifferentiationEnabled,this._closeActionsMenu(),z(this,$,fa).call(this)}}get descriptionLabel(){return this.lang==="en"?"Description of the chart":"Beskrivning av diagrammet"}get moreAboutStatsLabel(){return this.lang==="en"?"More about the statistics":"Mer om statistiken"}get commentLabel(){return this.lang==="en"?"Comments":"Kommentar"}get sourceLabel(){return this.lang==="en"?"Source":"Källa"}get footnoteLabel(){return this.lang==="en"?"Footnotes":"Fotnot"}get officialStatisticsLabel(){return this.lang==="en"?"Official statistics of Sweden":"Sveriges officiella statistik"}get officialStatisticsTitle(){return this.lang==="en"?"Part of Official statistics of Sweden":"Tillhör Sveriges officiella statistik"}get officialStatisticsAlt(){return this.lang==="en"?"Read more about Official statistics of Sweden":"Läs mer om Sveriges officiella statistik"}get actionsMenuLabel(){return this.lang==="en"?"Open menu":"Öppna meny"}get printLabel(){return this.lang==="en"?"Print":"Skriv ut"}get downloadPngLabel(){return this.lang==="en"?"Download PNG":"Ladda ner PNG"}get downloadJpgLabel(){return this.lang==="en"?"Download JPG":"Ladda ner JPG"}get downloadCsvLabel(){return this.lang==="en"?"Download CSV":"Ladda ner CSV"}get enableSeriesDifferentiationLabel(){return this.lang==="en"?"Show symbols and patterns":"Visa symboler och mönster"}get disableSeriesDifferentiationLabel(){return this.lang==="en"?"Hide symbols and patterns":"Dölj symboler och mönster"}_getImageAltText(){return[this.title,this.subtitle,this.description].map(t=>typeof t=="string"?t.trim():"").filter(Boolean).join(". ")||(this.lang==="en"?"Image figure":"Bildfigur")}connectedCallback(){super.connectedCallback(),document.addEventListener("pointerdown",this._onDocumentPointerDown,!0),document.addEventListener("keydown",this._onDocumentKeyDown)}firstUpdated(e){this._readTableDataFromSlot(),z(this,$,Ac).call(this),z(this,$,Lc).call(this),z(this,$,sn).call(this),this._syncChipClass(),z(this,$,fc).call(this),z(this,$,va).call(this)}updated(e){super.updated(e),(e.has("selectedChip")||e.has("variant"))&&(this._syncChipClass(),this._closeActionsMenu()),e.has("selectedChip")&&this._dispatchSelectedChipChanged(),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&z(this,$,Ac).call(this),e.has("containerMaxWidth")&&z(this,$,Lc).call(this),e.has("variant")&&z(this,$,fc).call(this),(e.has("contentMaxWidth")||e.has("contentHeight")||e.has("toggleHeightMode")||e.has("variant"))&&z(this,$,sn).call(this),(e.has("selectedChip")||e.has("variant")||e.has("contentMaxWidth")||e.has("contentHeight")||e.has("toggleHeightMode"))&&z(this,$,va).call(this),(e.has("selectedChip")||e.has("variant"))&&this._seriesDifferentiationEnabled&&requestAnimationFrame(()=>{z(this,$,fa).call(this)}),(e.has("valueFormat")||e.has("timeFormat")||e.has("yAxisSettings")||e.has("selectedChip")||e.has("variant"))&&z(this,$,kc).call(this)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("pointerdown",this._onDocumentPointerDown,!0),document.removeEventListener("keydown",this._onDocumentKeyDown),z(this,$,gc).call(this),z(this,$,yc).call(this),z(this,$,wc).call(this)}_onTableSlotChange(e){const t=e.target;t&&(this._readTableDataFromSlot(t),this.requestUpdate())}_onDiagramSlotChange(){z(this,$,sn).call(this),z(this,$,va).call(this),z(this,$,kc).call(this),this._seriesDifferentiationEnabled&&requestAnimationFrame(()=>{z(this,$,fa).call(this)}),this.requestUpdate()}_normalizeRenderableCell(e){return e&&typeof e=="object"&&"html"in e&&"text"in e?{html:typeof e.html=="string"?e.html:"",text:typeof e.text=="string"?e.text:""}:{html:"",text:e==null?"":String(e)}}_readTableDataFromSlot(e){var g;const t=e||((g=this.shadowRoot)==null?void 0:g.querySelector('slot[name="table"]'));if(!t)return;const i=t.assignedElements({flatten:!0}),s=[];i.forEach(f=>{if(f.tagName==="TABLE"){s.push(f);return}f.querySelectorAll("table").forEach(x=>s.push(x))});const r=s[0];if(!r){this._slottedTableData=void 0;return}const a=[],n=[],l=[],d=f=>f?(f.textContent??"").replace(/\s+/g," ").trim():"",p=f=>f?{html:(f.innerHTML??"").trim(),text:d(f)}:{html:"",text:""},b=r.querySelector("thead tr");b&&Array.from(b.querySelectorAll("th, td")).forEach(x=>a.push(p(x)));const u=Array.from(r.querySelectorAll("tbody tr")),v=u.length>0?u:Array.from(r.querySelectorAll("tr")).filter(f=>f.closest("thead")===null);if(v.forEach(f=>{const x=Array.from(f.querySelectorAll("th, td"));if(x.length===0)return;const k=x[0].tagName==="TH"&&f.closest("thead")===null&&f.closest("tfoot")===null;l.push(k);const C=[];x.forEach(S=>C.push(p(S))),n.push(C)}),!b&&n.length>0){const f=n[0],x=v[0],k=Array.from((x==null?void 0:x.querySelectorAll("th, td"))??[]);k.length>0&&k.every(S=>S.tagName==="TH")&&(x==null?void 0:x.closest("tbody"))===null&&(a.splice(0,a.length,...f),n.shift(),l.shift())}this._slottedTableData={headers:a.length>0?a:void 0,rows:n,rowHeaderRows:l.length>0?l:void 0}}_inferTableAlignments(e){var r;const t=Math.max(((r=e.headers)==null?void 0:r.length)??0,...e.rows.map(a=>a.length)),i=a=>{if(a==null)return!1;if(typeof a=="number")return!0;const n=String(a).replace(/[\u00A0\u202F\s]+/g,"").trim();return n?/^-?\d+(?:[.,]\d+)?$/.test(n):!1},s=[];for(let a=0;a<t;a+=1){if(a===0){s.push("left");continue}const n=e.rows.map(d=>this._normalizeRenderableCell(d[a]).text).filter(d=>d!==""&&d!==null&&d!==void 0),l=n.length>0&&n.every(i);s.push(l?"right":"left")}return s}_getResolvedContentMaxWidth(){var e;return((e=this.contentMaxWidth)==null?void 0:e.trim())||""}_getResolvedDiagramHeight(){var e;return((e=this.contentHeight)==null?void 0:e.trim())||""}_getResolvedToggleHeightMode(){return this.toggleHeightMode==="auto"?"auto":"stable"}_getResolvedStandardContentHeight(){return this._getResolvedDiagramHeight()||"420px"}_getResolvedTableData(){return this.tableData??this._slottedTableData}_getDiagramAssignedElements(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector('slot[name="diagram"]');return e?e.assignedElements({flatten:!0}):[]}_findExportableVisualElement(e){for(const t of e){if(t instanceof SVGSVGElement||t instanceof HTMLCanvasElement||t instanceof HTMLImageElement)return t;const i=t.querySelector("svg, canvas, img");if(i instanceof SVGSVGElement||i instanceof HTMLCanvasElement||i instanceof HTMLImageElement)return i}return null}_getExportableVisualElement(){var e;if(this.variant==="Table")return null;if(this.variant==="Image"){const t=(e=this.shadowRoot)==null?void 0:e.querySelector(".image-content img");return t instanceof HTMLImageElement?t:null}return this._findExportableVisualElement(this._getDiagramAssignedElements())}_getDefaultValueFormat(){return{type:"number",scale:"auto",decimals:0}}_normalizeValueFormat(e){const t=this._getDefaultValueFormat(),i=e&&typeof e=="object"?e:{},s=["number","currency","percent"].includes(String(i.type))?String(i.type):t.type,r=["auto","raw","thousands","millions","billions"].includes(String(i.scale))?String(i.scale):t.scale,a=Number.isFinite(Number(i.decimals))?Math.max(0,Math.min(20,Number(i.decimals))):t.decimals;return{type:s,scale:r,decimals:a}}_normalizeTimeFormat(e){const t={mode:"raw",display:"raw"},i=e&&typeof e=="object"?e:{},s=["raw","year","monthCode","quarterCode","weekCode","tertialCode"];let r=typeof i.mode=="string"?i.mode:t.mode,a=typeof i.display=="string"?i.display:t.display;s.includes(r)||(r=t.mode);const n={raw:["raw"],year:["raw","year"],monthCode:["raw","iso-month","short-month","long-month"],quarterCode:["raw","quarter-compact","quarter-short","quarter-long"],weekCode:["raw","week-compact","week-long"],tertialCode:["raw","tertial-compact","tertial-short","tertial-long"]};return n[r].includes(a)||(a=n[r][0]),r==="raw"&&(a="raw"),{mode:r,display:a}}_normalizeYAxisSettings(e){const t=e&&typeof e=="object"?e:{},i=Number.isFinite(Number(t.referenceLineValue))?Number(t.referenceLineValue):null;return{startAtZero:!!t.startAtZero,referenceLineEnabled:!!t.referenceLineEnabled&&Number.isFinite(i),referenceLineValue:i,referenceLineLabel:typeof t.referenceLineLabel=="string"?t.referenceLineLabel:""}}_getShortMonthNames(){return["jan","feb","mar","apr","maj","jun","jul","aug","sep","okt","nov","dec"]}_getLongMonthNames(){return["januari","februari","mars","april","maj","juni","juli","augusti","september","oktober","november","december"]}_formatCategoryTimeLabel(e,t){if(!e||t.mode==="raw"||t.display==="raw")return null;if(t.mode==="year"){const i=/^\s*(\d{4})\s*$/.exec(e);return i?i[1]:null}if(t.mode==="monthCode"){const i=/^\s*(\d{4})M(0?[1-9]|1[0-2])\s*$/i.exec(e);if(!i)return null;const s=Number(i[2])-1,r=i[1],a=String(s+1).padStart(2,"0");return t.display==="iso-month"?`${r}-${a}`:t.display==="short-month"?`${this._getShortMonthNames()[s]} ${r}`:t.display==="long-month"?`${this._getLongMonthNames()[s]} ${r}`:e}if(t.mode==="quarterCode"){const i=/^\s*(\d{4})(?:K(V)?|Q)(0?[1-4])\s*$/i.exec(e);if(!i)return null;const s=Number(i[3]),r=i[1],a=["första","andra","tredje","fjärde"];return t.display==="quarter-compact"?`${r} K${s}`:t.display==="quarter-short"?`kv ${s} ${r}`:t.display==="quarter-long"?`${a[s-1]} kvartalet ${r}`:e}if(t.mode==="weekCode"){const i=/^\s*(\d{4})(?:V|W)(0?[1-9]|[1-4][0-9]|5[0-3])\s*$/i.exec(e);if(!i)return null;const s=Number(i[2]),r=i[1];return t.display==="week-compact"?`${r} v. ${s}`:t.display==="week-long"?`vecka ${s} ${r}`:e}if(t.mode==="tertialCode"){const i=/^\s*(\d{4})T(0?[1-3])\s*$/i.exec(e);if(!i)return null;const s=Number(i[2]),r=i[1],a=["första","andra","tredje"];return t.display==="tertial-compact"?`${r} T${s}`:t.display==="tertial-short"?`tertial ${s} ${r}`:t.display==="tertial-long"?`${a[s-1]} tertialet ${r}`:e}return null}_formatLocalizedNumber(e,t){return new Intl.NumberFormat(this.lang==="en"?"en-GB":"sv-SE",{minimumFractionDigits:t,maximumFractionDigits:t}).format(e)}_formatValueForDisplay(e,t,i){if(!Number.isFinite(e))return null;const s={raw:1,thousands:1e3,millions:1e6,billions:1e9},r={raw:"",thousands:this.lang==="en"?"k":"t",millions:this.lang==="en"?"M":"mn",billions:this.lang==="en"?"B":"md"};let a=t.scale;if(a==="auto"){const p=Math.abs(e);p>=1e9?a="billions":p>=1e6?a="millions":p>=1e3?a="thousands":a="raw"}const n=e/(s[a]||1);let l=this._formatLocalizedNumber(n,t.decimals);t.type==="percent"?l=`${l} %`:t.type==="currency"&&(l=i?`${l} kr`:l);const d=r[a]||"";return d&&(l=`${l} ${d}`),l}_isCategoryAxis(e){var t,i;return((t=e==null?void 0:e.categories)==null?void 0:t.length)>0||((i=e==null?void 0:e.options)==null?void 0:i.type)==="category"}_applyTimeFormatToLiveChart(e){const t=this._normalizeTimeFormat(this.timeFormat);if(t.mode==="raw"||t.display==="raw")return;const i=this._formatCategoryTimeLabel.bind(this);[...(e==null?void 0:e.xAxis)||[],...(e==null?void 0:e.yAxis)||[]].forEach(s=>{var n;if(!this._isCategoryAxis(s))return;const r=(n=s.options)!=null&&n.labels&&typeof s.options.labels=="object"?{...s.options.labels}:{},a=typeof r.formatter=="function"?r.formatter:null;r.formatter=function(){let l="";if(this!=null&&this.axis&&Array.isArray(this.axis.categories)&&typeof this.pos=="number"){const p=this.axis.categories[this.pos];typeof p<"u"&&p!==null&&(l=String(p))}else typeof(this==null?void 0:this.value)<"u"&&this.value!==null&&(l=String(this.value));const d=i(l,t);return d!==null?d:a?a.call(this):l},delete r.format,s.update({labels:r},!1)})}_applyValueFormatToLiveChart(e){var s,r,a,n,l,d,p;const t=this._normalizeValueFormat(this.valueFormat),i=this._formatValueForDisplay.bind(this);e.update({tooltip:{...((s=e.options)==null?void 0:s.tooltip)||{},valueDecimals:t.decimals,formatter:function(){const b=Array.isArray(this.points)&&this.points.length?this.points:[this.point||this];let u="";const v=[];return typeof this.x<"u"&&this.x!==null?u=`<span>${String(this.x)}</span><br/>`:typeof this.key<"u"&&this.key!==null&&(u=`<span>${String(this.key)}</span><br/>`),b.forEach(g=>{var S;const f=(g==null?void 0:g.point)||g,x=Number.isFinite(g==null?void 0:g.y)?g.y:f==null?void 0:f.y,k=i(x,t,!0);if(k===null)return;const C=(f==null?void 0:f.name)||((S=f==null?void 0:f.series)==null?void 0:S.name)||"";v.push(`${C?`${String(C)}: `:""}<b>${k}</b><br/>`)}),u+v.join("")}},plotOptions:{...((r=e.options)==null?void 0:r.plotOptions)||{},series:{...((n=(a=e.options)==null?void 0:a.plotOptions)==null?void 0:n.series)||{},dataLabels:{...((p=(d=(l=e.options)==null?void 0:l.plotOptions)==null?void 0:d.series)==null?void 0:p.dataLabels)||{},formatter:function(){var u;const b=Number.isFinite(this==null?void 0:this.y)?this.y:(u=this==null?void 0:this.point)==null?void 0:u.y;return i(b,t,t.type==="percent")??null}}}}},!1,!1,!1),((e==null?void 0:e.yAxis)||[]).forEach(b=>{var f,x;const u=(f=b.options)!=null&&f.labels&&typeof b.options.labels=="object"?{...b.options.labels}:{},v=typeof u.formatter=="function"?u.formatter:null,g=!((x=b.options)!=null&&x.title&&typeof b.options.title.text=="string"&&b.options.title.text.trim());u.formatter=function(){const k=i(this==null?void 0:this.value,t,g);return k!==null?k:v?v.call(this):this==null?void 0:this.value},(t.type==="percent"||t.scale!=="auto")&&delete u.format,b.update({labels:u},!1)})}_applyYAxisSettingsToLiveChart(e){const t=this._normalizeYAxisSettings(this.yAxisSettings),i=(e==null?void 0:e.yAxis)||[];i.length&&i.forEach((s,r)=>{const a=s.options&&typeof s.options=="object"?s.options:{},n={},l=typeof a.min<"u"&&a.min!==null&&a.min!=="";r===0&&t.startAtZero&&!l&&(n.min=0);const d=Array.isArray(a.plotLines)?a.plotLines.filter(p=>(p==null?void 0:p.id)!=="scb-viz-reference-line"):[];r===0&&t.referenceLineEnabled&&Number.isFinite(t.referenceLineValue)&&d.push({id:"scb-viz-reference-line",className:"scb-axis-plotline scb-viz-reference-line",value:t.referenceLineValue,label:t.referenceLineLabel?{text:t.referenceLineLabel,className:"scb-viz-reference-line-label"}:void 0}),d.length?n.plotLines=d:Array.isArray(a.plotLines)&&(n.plotLines=[]),s.update(n,!1)})}_getCurrentHighchartsChart(){var i;if(this._getCurrentPrintableView()!=="diagram")return;const e=z(this,$,xc).call(this,this._getDiagramAssignedElements());if(e===void 0)return;const t=window.Highcharts;return(i=t==null?void 0:t.charts)==null?void 0:i[e]}_getSeriesDifferentiationGroup(e,t){var s,r,a;const i=String((e==null?void 0:e.type)||((s=e==null?void 0:e.options)==null?void 0:s.type)||((a=(r=t==null?void 0:t.options)==null?void 0:r.chart)==null?void 0:a.type)||"").trim().toLowerCase();return["line","spline","scatter"].includes(i)?"line":["area","areaspline"].includes(i)?"area":["column","bar"].includes(i)?"fill":["pie","variablepie"].includes(i)?"point-fill":null}_shouldShowSeriesDifferentiationAction(){var t;if(this._getCurrentPrintableView()!=="diagram")return!1;const e=this._getCurrentHighchartsChart();return!((t=e==null?void 0:e.series)!=null&&t.length)||!this._isHighchartsStyledMode(e)?!1:e.series.some(i=>this._getSeriesDifferentiationGroup(i,e)!==null)}_getSeriesDifferentiationSnapshotStore(e){let t=this._seriesDifferentiationSnapshots.get(e);return t||(t=new Map,this._seriesDifferentiationSnapshots.set(e,t)),t}_cloneSeriesOptionValue(e){return Array.isArray(e)?e.map(t=>this._cloneSeriesOptionValue(t)):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([t,i])=>[t,this._cloneSeriesOptionValue(i)])):e}_captureSeriesDifferentiationSnapshot(e){var i;const t=this._cloneSeriesOptionValue((i=e==null?void 0:e.options)==null?void 0:i.marker);return{marker:t&&Object.keys(t).length>0?t:{enabled:!1}}}_getHighchartsSvgElement(e){const t=(e==null?void 0:e.element)??e;return t instanceof SVGElement?t:null}_isHighchartsStyledMode(e){var t,i,s;return!!(e!=null&&e.styledMode||(t=e==null?void 0:e.renderer)!=null&&t.styledMode||(s=(i=e==null?void 0:e.options)==null?void 0:i.chart)!=null&&s.styledMode)}_getHighchartsSvgRoot(e){var i,s,r;if((e==null?void 0:e.container)instanceof SVGSVGElement)return e.container;const t=((i=e==null?void 0:e.renderTo)==null?void 0:i.querySelector("svg"))??((r=(s=e==null?void 0:e.container)==null?void 0:s.querySelector)==null?void 0:r.call(s,"svg"));return t instanceof SVGSVGElement?t:null}_getHighchartsColorClassName(e,t){const i=this._getHighchartsSvgElement(e);return Array.from((i==null?void 0:i.classList)??[]).find(r=>/^highcharts-color-\d+$/.test(r))??`highcharts-color-${t}`}_setSeriesDifferentiationMetadata(e,t){const i=this._getHighchartsSvgElement(e);i&&(i.setAttribute("data-scb-viz-role",t.role),t.dashStyle?i.setAttribute("data-scb-viz-dash-style",t.dashStyle):i.removeAttribute("data-scb-viz-dash-style"),t.patternKind?i.setAttribute("data-scb-viz-pattern-kind",t.patternKind):i.removeAttribute("data-scb-viz-pattern-kind"))}_clearSeriesDifferentiationMetadata(e){const t=this._getHighchartsSvgElement(e);t&&(t.removeAttribute("data-scb-viz-role"),t.removeAttribute("data-scb-viz-dash-style"),t.removeAttribute("data-scb-viz-pattern-kind"))}_getSeriesDifferentiationDashStyles(){return["Solid","ShortDash","ShortDot","ShortDashDot","ShortDashDotDot","Dot","LongDash","LongDashDot","Dash","DashDot"]}_getSeriesDifferentiationMarkerSymbols(){return["circle","diamond","square","triangle","triangle-down"]}_getSeriesDifferentiationPatternKinds(){return["diagonal","dots","cross","vertical","horizontal","grid","diagonal-reverse","dots-dense","checker","zigzag"]}_setSeriesDifferentiationColorClass(e,t){const i=this._getHighchartsSvgElement(e);if(!i||!t)return;const s=Array.from(i.classList).find(r=>/^highcharts-color-\d+$/.test(r));s!==t&&(s&&(i.classList.remove(s),i.setAttribute("data-scb-viz-prev-color-class",s)),i.classList.add(t),i.setAttribute("data-scb-viz-added-color-class",t))}_clearSeriesDifferentiationColorClass(e){const t=this._getHighchartsSvgElement(e);if(!t)return;const i=t.getAttribute("data-scb-viz-added-color-class"),s=t.getAttribute("data-scb-viz-prev-color-class");i&&(t.classList.remove(i),t.removeAttribute("data-scb-viz-added-color-class")),s&&(t.classList.add(s),t.removeAttribute("data-scb-viz-prev-color-class"))}_getLegendSeriesDifferentiationTargets(e){var n,l,d,p;const t=[],i=[],s=this._getHighchartsSvgElement((n=e==null?void 0:e.legendItem)==null?void 0:n.group),r=(b,u)=>{const v=this._getHighchartsSvgElement(u);!v||b.includes(v)||b.push(v)};if(r(t,e==null?void 0:e.legendLine),r(t,(l=e==null?void 0:e.legendItem)==null?void 0:l.line),r(i,e==null?void 0:e.legendSymbol),r(i,(d=e==null?void 0:e.legendItem)==null?void 0:d.symbol),r(i,e==null?void 0:e.legendArea),r(i,(p=e==null?void 0:e.legendItem)==null?void 0:p.area),s){const b=s.querySelector(".highcharts-graph, .highcharts-legend-graph, line, path");b&&r(t,b),s.querySelectorAll("rect, circle, .highcharts-point, .highcharts-area, .highcharts-legend-symbol, path").forEach(u=>{r(i,u)})}const a=i.filter(b=>!t.includes(b));return{graphTargets:t,fillTargets:a}}_ensureStyledModeSeriesPattern(e,t,i){const s=this._getHighchartsSvgRoot(e);if(!s)return;const r="http://www.w3.org/2000/svg";let a=s.querySelector("defs");a instanceof SVGDefsElement||(a=document.createElementNS(r,"defs"),s.insertBefore(a,s.firstChild));const n=`scb-viz-pattern-${t}-${i}`;if(a.querySelector(`#${n}`))return;const l=document.createElementNS(r,"pattern");l.setAttribute("id",n),l.setAttribute("patternUnits","userSpaceOnUse"),l.setAttribute("width","10"),l.setAttribute("height","10"),l.classList.add(t);const d=document.createElementNS(r,"rect");d.setAttribute("x","0"),d.setAttribute("y","0"),d.setAttribute("width","10"),d.setAttribute("height","10"),d.setAttribute("class","scb-viz-highcharts-pattern__background"),l.appendChild(d);const p=(v,g="1.25")=>{const f=document.createElementNS(r,"path");return f.setAttribute("d",v),f.setAttribute("class","scb-viz-highcharts-pattern__mark"),f.setAttribute("stroke-width",g),f.setAttribute("stroke-linecap","square"),f},b=(v,g,f)=>{const x=document.createElementNS(r,"circle");return x.setAttribute("cx",v),x.setAttribute("cy",g),x.setAttribute("r",f),x.setAttribute("class","scb-viz-highcharts-pattern__mark--dot"),x},u=(v,g,f,x)=>{const k=document.createElementNS(r,"rect");return k.setAttribute("x",v),k.setAttribute("y",g),k.setAttribute("width",f),k.setAttribute("height",x),k.setAttribute("class","scb-viz-highcharts-pattern__mark--square"),k};switch(i){case"diagonal":l.appendChild(p("M-2,8 l10,-10 M0,10 l10,-10 M8,12 l4,-4"));break;case"dots":l.appendChild(b("2","2","1.2")),l.appendChild(b("7","7","1.2"));break;case"cross":l.appendChild(p("M0,0 L10,10 M10,0 L0,10"));break;case"vertical":l.appendChild(p("M2,0 L2,10 M7,0 L7,10"));break;case"horizontal":l.appendChild(p("M0,2 L10,2 M0,7 L10,7"));break;case"diagonal-reverse":l.appendChild(p("M0,0 L10,10 M-2,2 L8,12 M2,-2 L12,8"));break;case"dots-dense":l.appendChild(b("2","2","1")),l.appendChild(b("7","2","1")),l.appendChild(b("2","7","1")),l.appendChild(b("7","7","1"));break;case"checker":l.appendChild(u("0","0","4","4")),l.appendChild(u("5","5","4","4"));break;case"zigzag":l.appendChild(p("M-2,8 L2,4 L6,8 L10,4 L14,8 M-2,3 L2,-1 L6,3 L10,-1 L14,3"));break;default:l.appendChild(p("M0,0 L10,0 M0,5 L10,5 M0,10 L10,10","1"));break}a.appendChild(l)}_applyStyledModeSeriesDifferentiation(e){var n;const t=this._getHighchartsSvgRoot(e);if(!t)return;t.classList.add("scb-viz-series-differentiation-enabled");const i=this._getSeriesDifferentiationDashStyles(),s=this._getSeriesDifferentiationMarkerSymbols(),r=this._getSeriesDifferentiationPatternKinds(),a=this._getSeriesDifferentiationSnapshotStore(e);(n=e.series)==null||n.forEach((l,d)=>{var k,C;const p=this._getSeriesDifferentiationGroup(l,e);if(!p)return;const b=String((l==null?void 0:l.index)??d);a.has(b)||a.set(b,this._captureSeriesDifferentiationSnapshot(l));const u=i[d%i.length],v=r[d%r.length],g=s[d%s.length],f=this._getHighchartsColorClassName((l==null?void 0:l.graph)??(l==null?void 0:l.area)??(l==null?void 0:l.group),d),x=this._getLegendSeriesDifferentiationTargets(l);this._setSeriesDifferentiationMetadata(l==null?void 0:l.graph,{role:"graph",dashStyle:u}),p==="area"&&(this._setSeriesDifferentiationMetadata(l==null?void 0:l.area,{role:"area",patternKind:v}),this._setSeriesDifferentiationColorClass(l==null?void 0:l.area,f),this._ensureStyledModeSeriesPattern(e,f,v)),p==="fill"&&((k=l.points)==null||k.forEach(S=>{this._setSeriesDifferentiationMetadata(S==null?void 0:S.graphic,{role:"fill",patternKind:v}),this._setSeriesDifferentiationColorClass(S==null?void 0:S.graphic,f)}),this._ensureStyledModeSeriesPattern(e,f,v)),p==="point-fill"&&((C=l.points)==null||C.forEach((S,B)=>{var de,H;const F=r[B%r.length],K=this._getHighchartsColorClassName((S==null?void 0:S.graphic)??(S==null?void 0:S.legendSymbol)??((de=S==null?void 0:S.legendItem)==null?void 0:de.symbol)??((H=S==null?void 0:S.legendItem)==null?void 0:H.group),B),Ct=this._getLegendSeriesDifferentiationTargets(S);this._setSeriesDifferentiationMetadata(S==null?void 0:S.graphic,{role:"fill",patternKind:F}),this._setSeriesDifferentiationColorClass(S==null?void 0:S.graphic,K),this._ensureStyledModeSeriesPattern(e,K,F),Ct.fillTargets.forEach(Xe=>{this._setSeriesDifferentiationMetadata(Xe,{role:"legend-fill",patternKind:F}),this._setSeriesDifferentiationColorClass(Xe,K)})})),(p==="line"||p==="area")&&x.graphTargets.forEach(S=>{this._setSeriesDifferentiationMetadata(S,{role:"legend-symbol",dashStyle:u})}),(p==="area"||p==="fill")&&x.fillTargets.forEach(S=>{this._setSeriesDifferentiationMetadata(S,{role:"legend-fill",patternKind:v}),this._setSeriesDifferentiationColorClass(S,f)}),(p==="line"||p==="area")&&l.update({marker:{enabled:!0,symbol:g}},!1)}),e.redraw(!1)}_restoreStyledModeSeriesDifferentiation(e){var s;const t=this._getHighchartsSvgRoot(e);t==null||t.classList.remove("scb-viz-series-differentiation-enabled");const i=this._getSeriesDifferentiationSnapshotStore(e);(s=e.series)==null||s.forEach((r,a)=>{var d;const n=this._getSeriesDifferentiationGroup(r,e);if(!n)return;const l=this._getLegendSeriesDifferentiationTargets(r);if(this._clearSeriesDifferentiationMetadata(r==null?void 0:r.graph),this._clearSeriesDifferentiationMetadata(r==null?void 0:r.area),this._clearSeriesDifferentiationColorClass(r==null?void 0:r.area),(d=r.points)==null||d.forEach(p=>{const b=this._getLegendSeriesDifferentiationTargets(p);this._clearSeriesDifferentiationMetadata(p==null?void 0:p.graphic),this._clearSeriesDifferentiationColorClass(p==null?void 0:p.graphic),b.graphTargets.forEach(u=>{this._clearSeriesDifferentiationMetadata(u)}),b.fillTargets.forEach(u=>{this._clearSeriesDifferentiationMetadata(u),this._clearSeriesDifferentiationColorClass(u)})}),l.graphTargets.forEach(p=>{this._clearSeriesDifferentiationMetadata(p)}),l.fillTargets.forEach(p=>{this._clearSeriesDifferentiationMetadata(p),this._clearSeriesDifferentiationColorClass(p)}),n==="line"||n==="area"){const p=i.get(String((r==null?void 0:r.index)??a));r.update({marker:this._cloneSeriesOptionValue(p==null?void 0:p.marker)},!1)}}),e.redraw(!1)}_canExportRaster(){return this._getExportableVisualElement()!==null}_canExportCsv(){var t;const e=this._getResolvedTableData();return!!((t=e==null?void 0:e.rows)!=null&&t.length)}_getExportBaseFileName(){const e=this.lang==="en"?"visualization":"visualisering";return(this.title||e).normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||e}_buildExportFileName(e){const t=e==="csv"?this.lang==="en"?"-table":"-tabell":"";return`${this._getExportBaseFileName()}${t}.${e}`}_renderActionsMenu(){const e=this._getCurrentPrintableView(),t=this._canExportRaster(),i=this._canExportCsv(),s=t&&(e==="diagram"||e==="image"),r=i&&e==="table",a=this._shouldShowSeriesDifferentiationAction();return c`
12380
12381
  <div class="actions-menu">
12381
12382
  <scb-icon-button
12382
12383
  icon="more_vert"
@@ -13379,4 +13380,4 @@
13379
13380
  width: calc(100% / var(--scb-viz-print-scale, 1));
13380
13381
  }
13381
13382
  }
13382
- `,U([o({type:String,reflect:!0})],q.prototype,"variant",2),U([o({type:String,reflect:!0,attribute:"selected-chip"})],q.prototype,"selectedChip",2),U([o({type:String,reflect:!0})],q.prototype,"title",2),U([o({type:String,reflect:!0})],q.prototype,"subtitle",2),U([o({type:String,reflect:!0})],q.prototype,"description",2),U([o({type:String,reflect:!0})],q.prototype,"comment",2),U([o({type:String,reflect:!0})],q.prototype,"source",2),U([o({type:String,reflect:!0})],q.prototype,"footnote",2),U([o({type:String,reflect:!0,attribute:"lang"})],q.prototype,"lang",2),U([o({type:String,reflect:!0,attribute:"image-href"})],q.prototype,"imageHref",2),U([o({type:Boolean,reflect:!0,attribute:"official-statistics"})],q.prototype,"officialStatistics",2),U([o({type:Boolean,reflect:!0,attribute:"disable-toggle"})],q.prototype,"disableToggle",2),U([o({type:String,attribute:"content-max-width"})],q.prototype,"contentMaxWidth",2),U([o({type:String,attribute:"container-max-width"})],q.prototype,"containerMaxWidth",2),U([o({type:String,attribute:"content-height"})],q.prototype,"contentHeight",2),U([o({type:String,reflect:!0,attribute:"toggle-height-mode"})],q.prototype,"toggleHeightMode",2),U([o({attribute:!1})],q.prototype,"tableData",2),U([o({attribute:!1})],q.prototype,"valueFormat",2),U([o({attribute:!1})],q.prototype,"timeFormat",2),U([o({attribute:!1})],q.prototype,"yAxisSettings",2),U([T()],q.prototype,"_slottedTableData",2),U([T()],q.prototype,"_actionsMenuOpen",2),U([T()],q.prototype,"_seriesDifferentiationEnabled",2),U([o({type:String,reflect:!0})],q.prototype,"spacing",2),U([o({type:String,attribute:"spacing-top",reflect:!0})],q.prototype,"spacingTop",2),U([o({type:String,attribute:"spacing-bottom",reflect:!0})],q.prototype,"spacingBottom",2),U([o({type:String,attribute:"spacing-left",reflect:!0})],q.prototype,"spacingLeft",2),U([o({type:String,attribute:"spacing-right",reflect:!0})],q.prototype,"spacingRight",2),q=U([_("scb-viz")],q)})();
13383
+ `,j([o({type:String,reflect:!0})],q.prototype,"variant",2),j([o({type:String,reflect:!0,attribute:"selected-chip"})],q.prototype,"selectedChip",2),j([o({type:String,reflect:!0})],q.prototype,"title",2),j([o({type:String,reflect:!0})],q.prototype,"subtitle",2),j([o({type:String,reflect:!0})],q.prototype,"description",2),j([o({type:String,reflect:!0})],q.prototype,"comment",2),j([o({type:String,reflect:!0})],q.prototype,"source",2),j([o({type:String,reflect:!0})],q.prototype,"footnote",2),j([o({type:String,reflect:!0,attribute:"lang"})],q.prototype,"lang",2),j([o({type:String,reflect:!0,attribute:"image-href"})],q.prototype,"imageHref",2),j([o({type:Boolean,reflect:!0,attribute:"official-statistics"})],q.prototype,"officialStatistics",2),j([o({type:Boolean,reflect:!0,attribute:"disable-toggle"})],q.prototype,"disableToggle",2),j([o({type:String,attribute:"content-max-width"})],q.prototype,"contentMaxWidth",2),j([o({type:String,attribute:"container-max-width"})],q.prototype,"containerMaxWidth",2),j([o({type:String,attribute:"content-height"})],q.prototype,"contentHeight",2),j([o({type:String,reflect:!0,attribute:"toggle-height-mode"})],q.prototype,"toggleHeightMode",2),j([o({attribute:!1})],q.prototype,"tableData",2),j([o({attribute:!1})],q.prototype,"valueFormat",2),j([o({attribute:!1})],q.prototype,"timeFormat",2),j([o({attribute:!1})],q.prototype,"yAxisSettings",2),j([T()],q.prototype,"_slottedTableData",2),j([T()],q.prototype,"_actionsMenuOpen",2),j([T()],q.prototype,"_seriesDifferentiationEnabled",2),j([o({type:String,reflect:!0})],q.prototype,"spacing",2),j([o({type:String,attribute:"spacing-top",reflect:!0})],q.prototype,"spacingTop",2),j([o({type:String,attribute:"spacing-bottom",reflect:!0})],q.prototype,"spacingBottom",2),j([o({type:String,attribute:"spacing-left",reflect:!0})],q.prototype,"spacingLeft",2),j([o({type:String,attribute:"spacing-right",reflect:!0})],q.prototype,"spacingRight",2),q=j([_("scb-viz")],q)})();