scb-wc 0.1.49 → 0.1.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/icons.json +178 -178
- package/mvc/components/scb-header/scb-header.js +3 -2
- package/mvc/components/scb-segmented-button/scb-segmented-button.js +2 -2
- package/mvc/components/scb-segmented-button/scb-segmented-item.js +2 -2
- package/mvc/components/scb-table/scb-table.js +1 -1
- package/mvc/components/scb-viz/scb-viz.js +41 -155
- package/mvc/scb-logo.svg +20 -20
- package/mvc/scb.svg +13 -13
- package/package.json +2 -2
- package/scb-components/scb-viz/scb-viz.d.ts +1 -0
- package/scb-header/scb-header.js +3 -4
- package/scb-segmented-button/scb-segmented-button.js +9 -4
- package/scb-segmented-button/scb-segmented-item.js +2 -2
- package/scb-table/scb-table.js +4 -8
- package/scb-viz/scb-viz.js +19 -127
- package/scb-wc.bundle.js +15 -128
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as
|
|
1
|
+
import{_ as U,b as J,g as Y,h as b,m as F,o as X,r as Z,y as u}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as m}from"../../vendor/decorate.js";import{n as Q,t as h}from"../../vendor/assertClassBrand.js";import"../scb-accordion/scb-accordion.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-divider/scb-divider.js";import"../scb-chip/scb-chip.js";import"../scb-horizontal-scroller/scb-horizontal-scroller.js";import"../scb-segmented-button/scb-segmented-item.js";import"../scb-segmented-button/scb-segmented-button.js";import"../scb-table/scb-table.js";import{buildScbVizExportFileName as tt,createScbVizCsvBlob as et,createScbVizRasterBlobFromElement as it,createScbVizRasterDataUrlFromElement as st,downloadScbVizBlob as O,getScbVizCurrentFullscreenElement as at,isScbVizFullscreenSupported as rt,openScbVizPrintFrame as nt,runWithScbVizForcedPrintLightMode as ot,toggleScbVizFullscreen as lt}from"./scb-viz-actions-runtime.js";import{buildScbVizPrintDocumentHtml as ct,buildScbVizPrintableFooterHtml as ht,buildScbVizPrintableTableHtml as dt}from"./scb-viz-print-runtime.js";import{getScbVizSeriesDifferentiationPatternKinds as pt}from"./scb-viz-series-differentiation-registry.js";import{clearScbVizSeriesDifferentiationColorClass as ut,clearScbVizSeriesDifferentiationMetadata as ft,ensureScbVizStyledModeSeriesPattern as gt,getScbVizGroupedSeriesDifferentiationVariant as mt,getScbVizHighchartsColorClassName as bt,getScbVizHighchartsSvgRoot as vt,getScbVizLegendSeriesDifferentiationTargets as _t,getScbVizSeriesDifferentiationVariantByIndex as yt,isScbVizGroupedSeriesDifferentiationChart as St,isScbVizHighchartsStyledMode as zt,setScbVizSeriesDifferentiationColorClass as wt,setScbVizSeriesDifferentiationMetadata as Ct,shouldShowScbVizSeriesDifferentiationAction as xt,usesScbVizGroupedPointDifferentiation as Dt}from"./scb-viz-series-differentiation-runtime.js";import{buildScbVizResolvedTableView as Mt,createScbVizCsvRows as $t,inferScbVizTableAlignments as Lt,normalizeScbVizRenderableCell as Tt,readScbVizTableDataFromSlot as Vt}from"./scb-viz-table-runtime.js";(function(){try{var n=typeof globalThis<"u"?globalThis:window;if(!n.__scb_ce_guard_installed__){n.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(e,i,s){try{customElements.get(e)||t(e,i,s)}catch(r){var a=String(r||"");if(a.indexOf("already been used")===-1&&a.indexOf("NotSupportedError")===-1)throw r}}}}catch{}})();var c,A,j=`<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"
|
|
2
2
|
viewBox="0 0 727.3 87.3" style="enable-background:new 0 0 727.3 87.3;" xml:space="preserve" fill="currentColor">
|
|
3
3
|
<style type="text/css">
|
|
4
4
|
.st0{clip-path:url(#SVGID_00000118375311472882578510000008414848687067442345_);}
|
|
@@ -113,7 +113,7 @@ import{_ as J,b as Y,g as X,h as v,m as F,o as E,r as Z,y as p}from"../../vendor
|
|
|
113
113
|
<path d="M688.2,24.4h5.8v6h-5.8V24.4z M688.2,36.6h5.8v30.1h-5.8V36.6z"/>
|
|
114
114
|
<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"/>
|
|
115
115
|
</svg>
|
|
116
|
-
`,Ft=0,g=(l=new WeakSet,A=class extends J{constructor(...t){super(...t),Q(this,l),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._isFullscreen=!1,this._seriesDifferentiationSnapshots=new WeakMap,this._diagramReflowFrame=0,this._chartConfigSyncFrame=0,this._fullscreenDiagramSizingFrame=0,this._fullscreenDiagramHeight="",this._instanceId=`scb-viz-${++Ft}`,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this._onDocumentFullscreenChange=()=>{this._syncFullscreenState()},this._onWindowResize=()=>{this._isFullscreen&&c(l,this,L).call(this)},this._onToggleFullscreenClick=async()=>{this._closeActionsMenu(),await this._toggleFullscreen()},this._onDocumentPointerDown=e=>{if(!this._actionsMenuOpen)return;const i=e.composedPath(),s=this.shadowRoot?.querySelector(".actions-menu");s&&i.includes(s)||this._closeActionsMenu()},this._onDocumentKeyDown=e=>{this._actionsMenuOpen&&e.key==="Escape"&&(e.preventDefault(),this._closeActionsMenu(),this._focusMenuButton())},this._onPrintClick=async()=>{this._closeActionsMenu(),await c(l,this,Ot).call(this)},this._onDownloadPngClick=async()=>{this._canExportRaster()&&(this._closeActionsMenu(),await c(l,this,I).call(this,"png"))},this._onDownloadJpgClick=async()=>{this._canExportRaster()&&(this._closeActionsMenu(),await c(l,this,I).call(this,"jpeg"))},this._onDownloadCsvClick=()=>{this._canExportCsv()&&(this._closeActionsMenu(),c(l,this,jt).call(this))},this._onToggleSeriesDifferentiationClick=()=>{this._seriesDifferentiationEnabled=!this._seriesDifferentiationEnabled,this._closeActionsMenu(),c(l,this,V).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"}get enterFullscreenLabel(){return this.lang==="en"?"View fullscreen":"Visa i helskärm"}get exitFullscreenLabel(){return this.lang==="en"?"Exit fullscreen":"Avsluta helskärm"}_getImageAltText(){return this.lang==="en"?"Chart image":"Diagrambild"}_getTitleId(){return this.title?`${this._instanceId}-title`:void 0}_getSubtitleId(){return this.subtitle?`${this._instanceId}-subtitle`:void 0}_getDescriptionId(){return this.description?`${this._instanceId}-description`:void 0}_getContentAriaLabelledBy(){const t=[this._getTitleId(),this._getSubtitleId()].filter(Boolean);return t.length?t.join(" "):void 0}_getContentAriaDescribedBy(){const t=[this._getDescriptionId()].filter(Boolean);return t.length?t.join(" "):void 0}connectedCallback(){super.connectedCallback(),document.addEventListener("pointerdown",this._onDocumentPointerDown,!0),document.addEventListener("keydown",this._onDocumentKeyDown),document.addEventListener("fullscreenchange",this._onDocumentFullscreenChange),document.addEventListener("webkitfullscreenchange",this._onDocumentFullscreenChange),window.addEventListener("resize",this._onWindowResize),window.visualViewport?.addEventListener("resize",this._onWindowResize)}firstUpdated(t){this._readTableDataFromSlot(),c(l,this,N).call(this),c(l,this,O).call(this),c(l,this,T).call(this),this._syncChipClass(),c(l,this,H).call(this),c(l,this,C).call(this),this._syncFullscreenState(),c(l,this,L).call(this)}updated(t){super.updated(t),(t.has("selectedChip")||t.has("variant"))&&(this._syncChipClass(),this._closeActionsMenu()),t.has("selectedChip")&&this._dispatchSelectedChipChanged(),(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom")||t.has("spacingLeft")||t.has("spacingRight"))&&c(l,this,N).call(this),t.has("containerMaxWidth")&&c(l,this,O).call(this),t.has("variant")&&c(l,this,H).call(this),(t.has("contentMaxWidth")||t.has("contentHeight")||t.has("toggleHeightMode")||t.has("variant"))&&c(l,this,T).call(this),(t.has("selectedChip")||t.has("variant")||t.has("contentMaxWidth")||t.has("contentHeight")||t.has("toggleHeightMode")||t.has("_isFullscreen"))&&c(l,this,C).call(this),(t.has("selectedChip")||t.has("variant"))&&this._seriesDifferentiationEnabled&&requestAnimationFrame(()=>{c(l,this,V).call(this)}),(t.has("valueFormat")||t.has("timeFormat")||t.has("yAxisSettings")||t.has("selectedChip")||t.has("variant"))&&c(l,this,P).call(this),(t.has("title")||t.has("subtitle")||t.has("description")||t.has("comment")||t.has("source")||t.has("footnote")||t.has("officialStatistics")||t.has("selectedChip")||t.has("variant")||t.has("_isFullscreen"))&&c(l,this,L).call(this)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("pointerdown",this._onDocumentPointerDown,!0),document.removeEventListener("keydown",this._onDocumentKeyDown),document.removeEventListener("fullscreenchange",this._onDocumentFullscreenChange),document.removeEventListener("webkitfullscreenchange",this._onDocumentFullscreenChange),window.removeEventListener("resize",this._onWindowResize),window.visualViewport?.removeEventListener("resize",this._onWindowResize),c(l,this,q).call(this),c(l,this,B).call(this),c(l,this,U).call(this),c(l,this,K).call(this)}_onTableSlotChange(t){const e=t.target;e&&(this._readTableDataFromSlot(e),this.requestUpdate())}_onDiagramSlotChange(){c(l,this,T).call(this),c(l,this,C).call(this),c(l,this,P).call(this),this._seriesDifferentiationEnabled&&requestAnimationFrame(()=>{c(l,this,V).call(this)}),this.requestUpdate()}_normalizeRenderableCell(t){return Tt(t)}_readTableDataFromSlot(t){const e=t||this.shadowRoot?.querySelector('slot[name="table"]');this._slottedTableData=Vt(e)}_inferTableAlignments(t){return Lt(t,e=>this._parseTableNumericValue(e))}_parseTableNumericValue(t){if(t==null)return null;if(typeof t=="number")return Number.isFinite(t)?t:null;let e=String(t).replace(/[ \s]+/g,"").trim();if(!e)return null;e.endsWith("%")&&(e=e.slice(0,-1));const i=e.lastIndexOf(","),s=e.lastIndexOf(".");if(i>-1&&s>-1?i>s?e=e.replace(/\./g,"").replace(",","."):e=e.replace(/,/g,""):i>-1&&(e=e.replace(",",".")),!/^-?\d+(?:\.\d+)?$/.test(e))return null;const a=Number(e);return Number.isFinite(a)?a:null}_formatTableCell(t,e,i){const s=this._normalizeRenderableCell(t);if(s.html)return s;const a=s.text;if(!a)return s;if(e===0){const d=this._normalizeTimeFormat(this.timeFormat),u=this._formatCategoryTimeLabel(a,d);return u!==null?{html:"",text:u}:s}if(i[e]!=="right")return s;if(this._shouldPreserveSourceValueFormatting(this.valueFormat)){const d=this._localizeAutomaticNumericText(a);return d!==null?{html:"",text:d}:s}const r=this._parseTableNumericValue(a);if(r===null)return s;const n=this._normalizeValueFormat(this.valueFormat),h=this._formatValueForDisplay(r,n,!0);return h===null?s:{html:"",text:h}}_getViewportHeight(){return Math.round(window.visualViewport?.height||window.innerHeight||document.documentElement.clientHeight||0)}_readCssLength(t){const e=Number.parseFloat(t||"0");return Number.isFinite(e)?e:0}_getElementOuterHeight(t){const e=this.shadowRoot?.querySelector(t);if(!e)return 0;const i=getComputedStyle(e);return e.getBoundingClientRect().height+this._readCssLength(i.marginTop)+this._readCssLength(i.marginBottom)}_getFullscreenDiagramHeight(){if(!this._isFullscreen||this.variant!=="Standard"||this.selectedChip!=="Diagram")return"";const t=this._getViewportHeight();if(!t)return"";const e=getComputedStyle(this),i=this._readCssLength(e.paddingTop)+this._readCssLength(e.paddingBottom)+this._getElementOuterHeight(".header")+this._getElementOuterHeight(".actions-row")+this._getElementOuterHeight(".footer")+16,s=Math.floor(t-i);return!Number.isFinite(s)||s<=0?"":`${Math.max(320,s)}px`}_getResolvedContentMaxWidth(){return this.contentMaxWidth?.trim()||""}_getResolvedDiagramHeight(){return this._fullscreenDiagramHeight||this.contentHeight?.trim()||""}_getResolvedDiagramScrollerWidth(){return this._getResolvedContentMaxWidth()}_getResolvedToggleHeightMode(){return this.toggleHeightMode==="auto"?"auto":"stable"}_getResolvedStandardContentHeight(){return this._getResolvedDiagramHeight()||"600px"}_getResolvedTableData(){return this.tableData??this._slottedTableData}_getResolvedTableView(t){return Mt(t,{inferAlignments:e=>this._inferTableAlignments(e),normalizeCell:e=>this._normalizeRenderableCell(e),formatCell:(e,i,s)=>this._formatTableCell(e,i,s)})}_getDiagramAssignedElements(){const t=this.shadowRoot?.querySelector('slot[name="diagram"]');return t?t.assignedElements({flatten:!0}):[]}_findExportableVisualElement(t){for(const e of t){if(e instanceof SVGSVGElement||e instanceof HTMLCanvasElement||e instanceof HTMLImageElement)return e;const i=e.querySelector("svg, canvas, img");if(i instanceof SVGSVGElement||i instanceof HTMLCanvasElement||i instanceof HTMLImageElement)return i}return null}_getExportableVisualElement(){if(this.variant==="Table")return null;if(this.variant==="Image"){const t=this.shadowRoot?.querySelector(".image-content img");return t instanceof HTMLImageElement?t:null}return this._findExportableVisualElement(this._getDiagramAssignedElements())}_getDefaultValueFormat(){return{type:"number",scale:"auto",decimals:0,decimalSeparator:this.lang==="en"?".":","}}_normalizeValueFormat(t){const e=this._getDefaultValueFormat(),i=t&&typeof t=="object"?t:{};return{type:["number","currency","percent"].includes(String(i.type))?String(i.type):e.type,scale:["auto","raw","thousands","millions","billions"].includes(String(i.scale))?String(i.scale):e.scale,decimals:Number.isFinite(Number(i.decimals))?Math.max(0,Math.min(20,Number(i.decimals))):e.decimals,decimalSeparator:String(i.decimalSeparator)==="."?".":String(i.decimalSeparator)===","?",":e.decimalSeparator}}_shouldPreserveSourceValueFormatting(t){const e=this._normalizeValueFormat(t);return e.type==="number"&&e.scale==="auto"}_normalizeTimeFormat(t){const e={mode:"raw",display:"raw"},i=t&&typeof t=="object"?t:{},s=["raw","year","monthCode","quarterCode","weekCode","tertialCode"];let a=typeof i.mode=="string"?i.mode:e.mode,r=typeof i.display=="string"?i.display:e.display;s.includes(a)||(a=e.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[a].includes(r)||(r=n[a][0]),a==="raw"&&(r="raw"),{mode:a,display:r}}_normalizeYAxisSettings(t){const e=t&&typeof t=="object"?t:{},i=Number.isFinite(Number(e.referenceLineValue))?Number(e.referenceLineValue):null;return{startAtZero:!!e.startAtZero,referenceLineEnabled:!!e.referenceLineEnabled&&Number.isFinite(i),referenceLineValue:i,referenceLineLabel:typeof e.referenceLineLabel=="string"?e.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(t,e){if(!t||e.mode==="raw"||e.display==="raw")return null;if(e.mode==="year"){const i=/^\s*(\d{4})\s*$/.exec(t);return i?i[1]:null}if(e.mode==="monthCode"){const i=/^\s*(\d{4})M(0?[1-9]|1[0-2])\s*$/i.exec(t);if(!i)return null;const s=Number(i[2])-1,a=i[1],r=String(s+1).padStart(2,"0");return e.display==="iso-month"?`${a}-${r}`:e.display==="short-month"?`${this._getShortMonthNames()[s]} ${a}`:e.display==="long-month"?`${this._getLongMonthNames()[s]} ${a}`:t}if(e.mode==="quarterCode"){const i=/^\s*(\d{4})(?:K(V)?|Q)(0?[1-4])\s*$/i.exec(t);if(!i)return null;const s=Number(i[3]),a=i[1],r=["första","andra","tredje","fjärde"];return e.display==="quarter-compact"?`${a} K${s}`:e.display==="quarter-short"?`kv ${s} ${a}`:e.display==="quarter-long"?`${r[s-1]} kvartalet ${a}`:t}if(e.mode==="weekCode"){const i=/^\s*(\d{4})(?:V|W)(0?[1-9]|[1-4][0-9]|5[0-3])\s*$/i.exec(t);if(!i)return null;const s=Number(i[2]),a=i[1];return e.display==="week-compact"?`${a} v. ${s}`:e.display==="week-long"?`vecka ${s} ${a}`:t}if(e.mode==="tertialCode"){const i=/^\s*(\d{4})T(0?[1-3])\s*$/i.exec(t);if(!i)return null;const s=Number(i[2]),a=i[1],r=["första","andra","tredje"];return e.display==="tertial-compact"?`${a} T${s}`:e.display==="tertial-short"?`tertial ${s} ${a}`:e.display==="tertial-long"?`${r[s-1]} tertialet ${a}`:t}return null}_localizeAutomaticNumericText(t){const e=this._normalizeValueFormat(this.valueFormat),i=String(t??"").trim();if(!i||i===".."||i==="...")return null;const s=i.replace(/[ \s]/g,"");if(!/^-?\d+(?:[.,]\d+)?$/.test(s))return null;const a=e.decimalSeparator==="."?".":",";return a==="."&&s.indexOf(",")!==-1?s.replace(",","."):a===","&&s.indexOf(".")!==-1?s.replace(".",","):s}_inferAutomaticValueDecimals(t){if(!Number.isFinite(t))return 0;let e=String(t);/e/i.test(e)&&(e=t.toFixed(6).replace(/0+$/,"").replace(/\.$/,""));const i=e.replace(/^-/,"").split(".");return i.length>1?Math.min(i[1].length,6):0}_formatAutomaticValueForDisplay(t,e){if(!Number.isFinite(t))return null;const i=this._localizeAutomaticNumericText(e);if(i!==null)return i;const s=this._normalizeValueFormat(this.valueFormat),a=this._inferAutomaticValueDecimals(t);return this._formatLocalizedNumber(t,a,s.decimalSeparator)}_formatLocalizedNumber(t,e,i){const s=new Intl.NumberFormat(this.lang==="en"?"en-GB":"sv-SE",{minimumFractionDigits:e,maximumFractionDigits:e}),a=i==="."||i===","?i:this.lang==="en"?".":",";return s.formatToParts(t).map(r=>r.type==="decimal"?a:r.value).join("")}_formatValueForDisplay(t,e,i){if(!Number.isFinite(t))return null;const s={raw:1,thousands:1e3,millions:1e6,billions:1e9},a={raw:"",thousands:this.lang==="en"?"k":"t",millions:this.lang==="en"?"M":"mn",billions:this.lang==="en"?"B":"md"};let r=e.scale;if(r==="auto"){const u=Math.abs(t);u>=1e9?r="billions":u>=1e6?r="millions":u>=1e3?r="thousands":r="raw"}const n=t/(s[r]||1);let h=this._formatLocalizedNumber(n,e.decimals,e.decimalSeparator);e.type==="percent"?h=`${h} %`:e.type==="currency"&&(h=i?`${h} kr`:h);const d=a[r]||"";return d&&(h=`${h} ${d}`),h}_isCategoryAxis(t){return t?.categories?.length>0||t?.options?.type==="category"}_isTooltipNumericLikeText(t){if(typeof t!="string")return!1;const e=t.trim();return e?/^-?\d+(?:[.,]\d+)?$/.test(e):!1}_getTooltipPointRowIndex(t){const e=t?.point||t;return Number.isFinite(e?.x)?Number(e.x):Number.isFinite(t?.x)?Number(t.x):Number.isFinite(e?.index)?Number(e.index):Number.isFinite(t?.index)?Number(t.index):null}_getTooltipTableCategoryValue(t){const e=this._getResolvedTableData();if(!e?.rows?.length)return"";const i=this._getTooltipPointRowIndex(t);if(i===null||i<0||i>=e.rows.length)return"";const s=e.rows[i];return!Array.isArray(s)||s.length===0?"":this._normalizeRenderableCell(s[0]).text}_getTooltipSeriesDataCategoryValue(t){const e=t?.point||t,i=e?.series||t?.series,s=this._getTooltipPointRowIndex(t);if(!i||s===null)return"";const a=[i?.options?.data,i?.userOptions?.data];for(const h of a){if(!Array.isArray(h)||s<0||s>=h.length)continue;const d=h[s];if(!d||typeof d!="object")continue;const u=typeof d.category<"u"&&d.category!==null?String(d.category):typeof d.name=="string"?d.name:"";if(u&&!this._isTooltipNumericLikeText(u))return u}const r=typeof e?.options?.category<"u"&&e.options.category!==null?String(e.options.category):"";if(r&&!this._isTooltipNumericLikeText(r))return r;const n=typeof e?.name=="string"?e.name.trim():"";return n&&!this._isTooltipNumericLikeText(n)?n:""}_getTooltipXAxisLabel(t,e){const i=t?.point||t,s=i?.series?.xAxis||t?.series?.xAxis,a=this._getTooltipPointRowIndex(t),r=[];if(s&&Array.isArray(s.categories)&&a!==null){const b=s.categories[a];typeof b<"u"&&b!==null&&r.push(String(b))}typeof i?.category=="string"&&i.category.trim()&&r.push(i.category),typeof t?.key=="string"&&t.key.trim()&&r.push(t.key),typeof t?.x=="string"&&t.x.trim()&&r.push(t.x);const n=this._getTooltipSeriesDataCategoryValue(t);n&&r.push(n);const h=this._getTooltipTableCategoryValue(t);h&&r.push(h);for(const b of r){const _=String(b).trim();if(!(!_||this._isTooltipNumericLikeText(_)))return this._formatCategoryTimeLabel(_,e)??_}const d=r.find(b=>String(b).trim());if(!d)return"";const u=String(d).trim();return this._formatCategoryTimeLabel(u,e)??u}_getTooltipPointLabel(t){const e=t?.point||t,i=e?.series||t?.series,s=String(e?.series?.type||i?.type||e?.series?.options?.type||i?.options?.type||e?.series?.chart?.options?.chart?.type||"").trim().toLowerCase();return["pie","variablepie"].includes(s)?e?.name||i?.name||"":i?.name||e?.name||""}_applyTimeFormatToLiveChart(t){const e=this._normalizeTimeFormat(this.timeFormat);if(e.mode==="raw"||e.display==="raw")return;const i=this._formatCategoryTimeLabel.bind(this);[...t?.xAxis||[],...t?.yAxis||[]].forEach(s=>{if(!this._isCategoryAxis(s))return;const a=s.options?.labels&&typeof s.options.labels=="object"?{...s.options.labels}:{},r=typeof a.formatter=="function"?a.formatter:null;a.formatter=function(){let n="";if(this?.axis&&Array.isArray(this.axis.categories)&&typeof this.pos=="number"){const d=this.axis.categories[this.pos];typeof d<"u"&&d!==null&&(n=String(d))}else typeof this?.value<"u"&&this.value!==null&&(n=String(this.value));const h=i(n,e);return h!==null?h:r?r.call(this):n},delete a.format,s.update({labels:a},!1)})}_applyValueFormatToLiveChart(t){const e=this._normalizeValueFormat(this.valueFormat),i=this._normalizeTimeFormat(this.timeFormat),s=this._formatValueForDisplay.bind(this),a=this._formatAutomaticValueForDisplay.bind(this),r=this._getTooltipXAxisLabel.bind(this),n=this._getTooltipPointLabel.bind(this);if(this._shouldPreserveSourceValueFormatting(this.valueFormat)){const h=t?.options?.tooltip&&typeof t.options.tooltip=="object"?{...t.options.tooltip}:{},d=t?.options?.plotOptions&&typeof t.options.plotOptions=="object"?{...t.options.plotOptions}:{},u=d.series&&typeof d.series=="object"?{...d.series}:{},b=u.dataLabels&&typeof u.dataLabels=="object"?{...u.dataLabels}:{},_=t?.options?.lang&&typeof t.options.lang=="object"?{...t.options.lang}:{};delete b.format,delete b.formatter,_.decimalPoint=e.decimalSeparator==="."?".":",",_.thousandsSep=" ",h.valueDecimals=void 0,h.formatter=function(){const y=Array.isArray(this.points)&&this.points.length?this.points:[this.point||this],S=r(this,i),D=[];return y.forEach(f=>{const z=f?.point||f,w=Number.isFinite(f?.y)?f.y:z?.y,x=n(f),M=a(w,z?.options&&typeof z.options.y<"u"&&z.options.y!==null?String(z.options.y):z&&typeof z.y<"u"&&z.y!==null?String(z.y):"");!Number.isFinite(w)||M===null||M===void 0||D.push(`${x?`${String(x)}: `:""}<b>${String(M)}</b><br/>`)}),`${S?`<span>${String(S)}</span><br/>`:""}${D.join("")}`}.bind(this),t.update({lang:_,tooltip:h,plotOptions:{...d,series:{...u,dataLabels:b}}},!1,!1,!1),(t?.yAxis||[]).forEach(y=>{const S=y.options?.labels&&typeof y.options.labels=="object"?{...y.options.labels}:{};delete S.format,delete S.formatter,y.update({labels:S},!1)});return}t.update({tooltip:{...t.options?.tooltip||{},valueDecimals:e.decimals,formatter:function(){const h=Array.isArray(this.points)&&this.points.length?this.points:[this.point||this],d=r(this,i),u=[];return h.forEach(b=>{const _=b?.point||b,y=s(Number.isFinite(b?.y)?b.y:_?.y,e,!0);if(y===null)return;const S=n(b);u.push(`${S?`${String(S)}: `:""}<b>${y}</b><br/>`)}),`${d?`<span>${String(d)}</span><br/>`:""}${u.join("")}`}},plotOptions:{...t.options?.plotOptions||{},series:{...t.options?.plotOptions?.series||{},dataLabels:{...t.options?.plotOptions?.series?.dataLabels||{},formatter:function(){return s(Number.isFinite(this?.y)?this.y:this?.point?.y,e,e.type==="percent")??null}}}}},!1,!1,!1),(t?.yAxis||[]).forEach(h=>{const d=h.options?.labels&&typeof h.options.labels=="object"?{...h.options.labels}:{},u=typeof d.formatter=="function"?d.formatter:null,b=!(h.options?.title&&typeof h.options.title.text=="string"&&h.options.title.text.trim());d.formatter=function(){const _=s(this?.value,e,b);return _!==null?_:u?u.call(this):this?.value},(e.type==="percent"||e.scale!=="auto")&&delete d.format,h.update({labels:d},!1)})}_applyYAxisSettingsToLiveChart(t){const e=this._normalizeYAxisSettings(this.yAxisSettings),i=t?.yAxis||[];i.length&&i.forEach((s,a)=>{const r=s.options&&typeof s.options=="object"?s.options:{},n={},h=typeof r.min<"u"&&r.min!==null&&r.min!=="";a===0&&e.startAtZero&&!h&&(n.min=0);const d=Array.isArray(r.plotLines)?r.plotLines.filter(u=>u?.id!=="scb-viz-reference-line"):[];a===0&&e.referenceLineEnabled&&Number.isFinite(e.referenceLineValue)&&d.push({id:"scb-viz-reference-line",className:"scb-axis-plotline scb-viz-reference-line",value:e.referenceLineValue}),d.length?n.plotLines=d:Array.isArray(r.plotLines)&&(n.plotLines=[]),s.update(n,!1)})}_getCurrentHighchartsChart(){if(this._getCurrentPrintableView()!=="diagram")return;const t=c(l,this,W).call(this,this._getDiagramAssignedElements());if(t!==void 0)return window.Highcharts?.charts?.[t]}_getSeriesDifferentiationGroup(t,e){const i=String(t?.type||t?.options?.type||e?.options?.chart?.type||"").trim().toLowerCase();return["line","spline","scatter"].includes(i)?"line":["area","areaspline"].includes(i)?"area":["column","bar"].includes(i)?this._isGroupedSeriesDifferentiationChart(t,e)?"grouped-fill":"fill":["pie","variablepie"].includes(i)?"point-fill":null}_getSeriesDifferentiationVariantByIndex(t){return _t(t)}_isGroupedSeriesDifferentiationChart(t,e){return St(t,e)}_usesGroupedPointDifferentiation(t){return Dt(t)}_getGroupedSeriesDifferentiationVariant(t,e,i){const s=mt(t,e,i);return{...s,variantIndex:typeof s.variantIndex=="number"?s.variantIndex:i}}_applyGroupedLegendSeriesDifferentiation(t){(Array.isArray(t?.legend?.allItems)?t.legend.allItems:[]).forEach((e,i)=>{const s=e&&e.series?e.series:e;if(!this._isGroupedSeriesDifferentiationChart(s,t))return;const{variantIndex:a,patternKind:r}=this._getGroupedSeriesDifferentiationVariant(e,t,i),n=this._getHighchartsColorClassName(e?.legendSymbol??e?.legendItem?.symbol??e?.legendItem?.group,a);this._getLegendSeriesDifferentiationTargets(e).fillTargets.forEach(h=>{this._setSeriesDifferentiationMetadata(h,{role:"legend-fill",patternKind:r}),this._setSeriesDifferentiationColorClass(h,n)}),this._ensureStyledModeSeriesPattern(t,n,r)})}_clearGroupedLegendSeriesDifferentiation(t){(Array.isArray(t?.legend?.allItems)?t.legend.allItems:[]).forEach(e=>{const i=e&&e.series?e.series:e;if(!this._isGroupedSeriesDifferentiationChart(i,t))return;const s=this._getLegendSeriesDifferentiationTargets(e);s.graphTargets.forEach(a=>{this._clearSeriesDifferentiationMetadata(a)}),s.fillTargets.forEach(a=>{this._clearSeriesDifferentiationMetadata(a),this._clearSeriesDifferentiationColorClass(a)})})}_shouldShowSeriesDifferentiationAction(){return Ct({chart:this._getCurrentHighchartsChart(),getCurrentPrintableView:()=>this._getCurrentPrintableView(),getSeriesDifferentiationGroup:(t,e)=>this._getSeriesDifferentiationGroup(t,e),isHighchartsStyledMode:t=>this._isHighchartsStyledMode(t)})}_getSeriesDifferentiationSnapshotStore(t){let e=this._seriesDifferentiationSnapshots.get(t);return e||(e=new Map,this._seriesDifferentiationSnapshots.set(t,e)),e}_cloneSeriesOptionValue(t){return Array.isArray(t)?t.map(e=>this._cloneSeriesOptionValue(e)):t&&typeof t=="object"?Object.fromEntries(Object.entries(t).map(([e,i])=>[e,this._cloneSeriesOptionValue(i)])):t}_captureSeriesDifferentiationSnapshot(t){const e=this._cloneSeriesOptionValue(t?.options?.marker),i=this._cloneSeriesOptionValue(t?.resetA11yMarkerOptions),s=this._cloneSeriesOptionValue(t?.userOptions?.marker),a=e?.states,r=t?.a11yMarkersForced===!0&&i&&Object.keys(i).length>0||a?.normal?.opacity===0&&i&&Object.keys(i).length>0?i:s;return{marker:r&&Object.keys(r).length>0?r:e&&Object.keys(e).length>0?e:{enabled:!1}}}_isHighchartsStyledMode(t){return zt(t)}_getHighchartsSvgRoot(t){return vt(t)}_getHighchartsColorClassName(t,e){return bt(t,e)}_setSeriesDifferentiationMetadata(t,e){xt(t,e)}_clearSeriesDifferentiationMetadata(t){ft(t)}_setSeriesDifferentiationColorClass(t,e){wt(t,e)}_clearSeriesDifferentiationColorClass(t){ut(t)}_getLegendSeriesDifferentiationTargets(t){return yt(t)}_ensureStyledModeSeriesPattern(t,e,i){gt(t,e,i)}_applyStyledModeSeriesDifferentiation(t){const e=this._getHighchartsSvgRoot(t);if(!e)return;e.classList.add("scb-viz-series-differentiation-enabled");const i=pt(),s=this._getSeriesDifferentiationSnapshotStore(t);t.series?.forEach((a,r)=>{const n=this._getSeriesDifferentiationGroup(a,t);if(!n)return;const h=String(a?.index??r);s.has(h)||s.set(h,this._captureSeriesDifferentiationSnapshot(a));const d=n==="grouped-fill"&&this._usesGroupedPointDifferentiation(a),u=n==="grouped-fill"?this._getGroupedSeriesDifferentiationVariant(a,t,r):{variantIndex:r,...this._getSeriesDifferentiationVariantByIndex(r)},{dashStyle:b,markerSymbol:_,patternKind:y}=u,S=this._getHighchartsColorClassName(a?.graph??a?.area??a?.group,u.variantIndex),D=this._getLegendSeriesDifferentiationTargets(a);this._setSeriesDifferentiationMetadata(a?.graph,{role:"graph",dashStyle:b}),n==="area"&&(this._setSeriesDifferentiationMetadata(a?.area,{role:"area",patternKind:y}),this._setSeriesDifferentiationColorClass(a?.area,S),this._ensureStyledModeSeriesPattern(t,S,y)),n==="fill"&&(a.points?.forEach(f=>{this._setSeriesDifferentiationMetadata(f?.graphic,{role:"fill",patternKind:y}),this._setSeriesDifferentiationColorClass(f?.graphic,S)}),this._ensureStyledModeSeriesPattern(t,S,y)),n==="grouped-fill"&&(d?a.points?.forEach((f,z)=>{const w=this._getGroupedSeriesDifferentiationVariant(f,t,z),x=this._getHighchartsColorClassName(f?.graphic??f?.legendSymbol??f?.legendItem?.symbol??f?.legendItem?.group,w.variantIndex);this._setSeriesDifferentiationMetadata(f?.graphic,{role:"fill",patternKind:w.patternKind}),this._setSeriesDifferentiationColorClass(f?.graphic,x),this._ensureStyledModeSeriesPattern(t,x,w.patternKind)}):(a.points?.forEach(f=>{this._setSeriesDifferentiationMetadata(f?.graphic,{role:"fill",patternKind:y}),this._setSeriesDifferentiationColorClass(f?.graphic,S)}),this._ensureStyledModeSeriesPattern(t,S,y))),n==="point-fill"&&a.points?.forEach((f,z)=>{const w=i[z%i.length],x=this._getHighchartsColorClassName(f?.graphic??f?.legendSymbol??f?.legendItem?.symbol??f?.legendItem?.group,z),M=this._getLegendSeriesDifferentiationTargets(f);this._setSeriesDifferentiationMetadata(f?.graphic,{role:"fill",patternKind:w}),this._setSeriesDifferentiationColorClass(f?.graphic,x),this._ensureStyledModeSeriesPattern(t,x,w),M.fillTargets.forEach(k=>{this._setSeriesDifferentiationMetadata(k,{role:"legend-fill",patternKind:w}),this._setSeriesDifferentiationColorClass(k,x)})}),(n==="line"||n==="area")&&D.graphTargets.forEach(f=>{this._setSeriesDifferentiationMetadata(f,{role:"legend-symbol",dashStyle:b})}),(n==="area"||n==="fill"||n==="grouped-fill"&&!d)&&D.fillTargets.forEach(f=>{this._setSeriesDifferentiationMetadata(f,{role:"legend-fill",patternKind:y}),this._setSeriesDifferentiationColorClass(f,S)}),(n==="line"||n==="area")&&a.update({marker:{enabled:!0,symbol:_}},!1)}),this._applyGroupedLegendSeriesDifferentiation(t),t.redraw(!1)}_restoreStyledModeSeriesDifferentiation(t){this._getHighchartsSvgRoot(t)?.classList.remove("scb-viz-series-differentiation-enabled");const e=this._getSeriesDifferentiationSnapshotStore(t);t.series?.forEach((i,s)=>{const a=this._getSeriesDifferentiationGroup(i,t);if(!a)return;const r=this._getLegendSeriesDifferentiationTargets(i);if(this._clearSeriesDifferentiationMetadata(i?.graph),this._clearSeriesDifferentiationMetadata(i?.area),this._clearSeriesDifferentiationColorClass(i?.area),i.points?.forEach(n=>{const h=this._getLegendSeriesDifferentiationTargets(n);this._clearSeriesDifferentiationMetadata(n?.graphic),this._clearSeriesDifferentiationColorClass(n?.graphic),h.graphTargets.forEach(d=>{this._clearSeriesDifferentiationMetadata(d)}),h.fillTargets.forEach(d=>{this._clearSeriesDifferentiationMetadata(d),this._clearSeriesDifferentiationColorClass(d)})}),r.graphTargets.forEach(n=>{this._clearSeriesDifferentiationMetadata(n)}),r.fillTargets.forEach(n=>{this._clearSeriesDifferentiationMetadata(n),this._clearSeriesDifferentiationColorClass(n)}),a==="line"||a==="area"){const n=e.get(String(i?.index??s));i.update({marker:this._cloneSeriesOptionValue(n?.marker)},!1)}}),this._clearGroupedLegendSeriesDifferentiation(t),t.redraw(!1),this._seriesDifferentiationSnapshots.delete(t)}_canExportRaster(){return this._getExportableVisualElement()!==null}_canExportCsv(){return!!this._getResolvedTableData()?.rows?.length}_buildExportFileName(t){return tt({lang:this.lang,title:this.title},t)}_getFullscreenTarget(){return this}_getCurrentFullscreenElement(){return at()}_isFullscreenSupported(){return rt(this._getFullscreenTarget())}_syncFullscreenState(){const t=this._getCurrentFullscreenElement()===this._getFullscreenTarget();this._isFullscreen=t,this.toggleAttribute("data-scb-viz-fullscreen",t),c(l,this,L).call(this),c(l,this,C).call(this)}async _toggleFullscreen(){await lt(this._getFullscreenTarget())}_renderActionsMenu(){const t=this._getCurrentPrintableView(),e=this._canExportRaster(),i=this._canExportCsv(),s=e&&(t==="diagram"||t==="image"),a=i&&t==="table",r=this._shouldShowSeriesDifferentiationAction();return p`
|
|
116
|
+
`,Ft=0,g=(c=new WeakSet,A=class extends U{constructor(...t){super(...t),Q(this,c),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._isFullscreen=!1,this._seriesDifferentiationSnapshots=new WeakMap,this._diagramReflowFrame=0,this._chartConfigSyncFrame=0,this._fullscreenDiagramSizingFrame=0,this._fullscreenDiagramHeight="",this._instanceId=`scb-viz-${++Ft}`,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this._onDocumentFullscreenChange=()=>{this._syncFullscreenState()},this._onWindowResize=()=>{this._isFullscreen&&h(c,this,L).call(this)},this._onToggleFullscreenClick=async()=>{this._closeActionsMenu(),await this._toggleFullscreen()},this._onDocumentPointerDown=e=>{if(!this._actionsMenuOpen)return;const i=e.composedPath(),s=this.shadowRoot?.querySelector(".actions-menu");s&&i.includes(s)||this._closeActionsMenu()},this._onDocumentKeyDown=e=>{this._actionsMenuOpen&&e.key==="Escape"&&(e.preventDefault(),this._closeActionsMenu(),this._focusMenuButton())},this._onPrintClick=async()=>{this._closeActionsMenu(),await h(c,this,Ot).call(this)},this._onDownloadPngClick=async()=>{this._canExportRaster()&&(this._closeActionsMenu(),await h(c,this,P).call(this,"png"))},this._onDownloadJpgClick=async()=>{this._canExportRaster()&&(this._closeActionsMenu(),await h(c,this,P).call(this,"jpeg"))},this._onDownloadCsvClick=()=>{this._canExportCsv()&&(this._closeActionsMenu(),h(c,this,jt).call(this))},this._onToggleSeriesDifferentiationClick=()=>{this._seriesDifferentiationEnabled=!this._seriesDifferentiationEnabled,this._closeActionsMenu(),h(c,this,V).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"}get enterFullscreenLabel(){return this.lang==="en"?"View fullscreen":"Visa i helskärm"}get exitFullscreenLabel(){return this.lang==="en"?"Exit fullscreen":"Avsluta helskärm"}_getImageAltText(){return this.lang==="en"?"Chart image":"Diagrambild"}_getTitleId(){return this.title?`${this._instanceId}-title`:void 0}_getSubtitleId(){return this.subtitle?`${this._instanceId}-subtitle`:void 0}_getDescriptionId(){return this.description?`${this._instanceId}-description`:void 0}_getContentAriaLabelledBy(){const t=[this._getTitleId(),this._getSubtitleId()].filter(Boolean);return t.length?t.join(" "):void 0}_getContentAriaDescribedBy(){const t=[this._getDescriptionId()].filter(Boolean);return t.length?t.join(" "):void 0}connectedCallback(){super.connectedCallback(),document.addEventListener("pointerdown",this._onDocumentPointerDown,!0),document.addEventListener("keydown",this._onDocumentKeyDown),document.addEventListener("fullscreenchange",this._onDocumentFullscreenChange),document.addEventListener("webkitfullscreenchange",this._onDocumentFullscreenChange),window.addEventListener("resize",this._onWindowResize),window.visualViewport?.addEventListener("resize",this._onWindowResize)}firstUpdated(t){this._readTableDataFromSlot(),h(c,this,N).call(this),h(c,this,I).call(this),h(c,this,T).call(this),this._syncChipClass(),h(c,this,E).call(this),h(c,this,x).call(this),this._syncFullscreenState(),h(c,this,L).call(this)}updated(t){super.updated(t),(t.has("selectedChip")||t.has("variant"))&&(this._syncChipClass(),this._closeActionsMenu()),t.has("selectedChip")&&this._dispatchSelectedChipChanged(),(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom")||t.has("spacingLeft")||t.has("spacingRight"))&&h(c,this,N).call(this),t.has("containerMaxWidth")&&h(c,this,I).call(this),t.has("variant")&&h(c,this,E).call(this),(t.has("contentMaxWidth")||t.has("contentHeight")||t.has("toggleHeightMode")||t.has("variant"))&&h(c,this,T).call(this),(t.has("selectedChip")||t.has("variant")||t.has("contentMaxWidth")||t.has("contentHeight")||t.has("toggleHeightMode")||t.has("_isFullscreen"))&&h(c,this,x).call(this),(t.has("selectedChip")||t.has("variant"))&&this._seriesDifferentiationEnabled&&requestAnimationFrame(()=>{h(c,this,V).call(this)}),(t.has("valueFormat")||t.has("timeFormat")||t.has("yAxisSettings")||t.has("selectedChip")||t.has("variant"))&&h(c,this,R).call(this),(t.has("title")||t.has("subtitle")||t.has("description")||t.has("comment")||t.has("source")||t.has("footnote")||t.has("officialStatistics")||t.has("selectedChip")||t.has("variant")||t.has("_isFullscreen"))&&h(c,this,L).call(this)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("pointerdown",this._onDocumentPointerDown,!0),document.removeEventListener("keydown",this._onDocumentKeyDown),document.removeEventListener("fullscreenchange",this._onDocumentFullscreenChange),document.removeEventListener("webkitfullscreenchange",this._onDocumentFullscreenChange),window.removeEventListener("resize",this._onWindowResize),window.visualViewport?.removeEventListener("resize",this._onWindowResize),h(c,this,G).call(this),h(c,this,q).call(this),h(c,this,K).call(this),h(c,this,W).call(this)}_refreshTableDataFromSlot(t){this._readTableDataFromSlot(t||void 0),this.requestUpdate()}_onTableSlotChange(t){const e=t.target;e&&(this._refreshTableDataFromSlot(e),requestAnimationFrame(()=>{this._refreshTableDataFromSlot(e)}))}_onDiagramSlotChange(){h(c,this,T).call(this),h(c,this,x).call(this),h(c,this,R).call(this),this._seriesDifferentiationEnabled&&requestAnimationFrame(()=>{h(c,this,V).call(this)}),this.requestUpdate()}_normalizeRenderableCell(t){return Tt(t)}_readTableDataFromSlot(t){const e=t||this.shadowRoot?.querySelector('slot[name="table"]');this._slottedTableData=Vt(e)}_inferTableAlignments(t){return Lt(t,e=>this._parseTableNumericValue(e))}_parseTableNumericValue(t){if(t==null)return null;if(typeof t=="number")return Number.isFinite(t)?t:null;let e=String(t).replace(/[ \s]+/g,"").trim();if(!e)return null;e.endsWith("%")&&(e=e.slice(0,-1));const i=e.lastIndexOf(","),s=e.lastIndexOf(".");if(i>-1&&s>-1?i>s?e=e.replace(/\./g,"").replace(",","."):e=e.replace(/,/g,""):i>-1&&(e=e.replace(",",".")),!/^-?\d+(?:\.\d+)?$/.test(e))return null;const a=Number(e);return Number.isFinite(a)?a:null}_formatTableCell(t,e,i){const s=this._normalizeRenderableCell(t);if(s.html)return s;const a=s.text;if(!a)return s;if(e===0){const d=this._normalizeTimeFormat(this.timeFormat),f=this._formatCategoryTimeLabel(a,d);return f!==null?{html:"",text:f}:s}if(i[e]!=="right")return s;if(this._shouldPreserveSourceValueFormatting(this.valueFormat)){const d=this._localizeAutomaticNumericText(a);return d!==null?{html:"",text:d}:s}const r=this._parseTableNumericValue(a);if(r===null)return s;const o=this._normalizeValueFormat(this.valueFormat),l=this._formatValueForDisplay(r,o,!0);return l===null?s:{html:"",text:l}}_getViewportHeight(){return Math.round(window.visualViewport?.height||window.innerHeight||document.documentElement.clientHeight||0)}_readCssLength(t){const e=Number.parseFloat(t||"0");return Number.isFinite(e)?e:0}_getElementOuterHeight(t){const e=this.shadowRoot?.querySelector(t);if(!e)return 0;const i=getComputedStyle(e);return e.getBoundingClientRect().height+this._readCssLength(i.marginTop)+this._readCssLength(i.marginBottom)}_getFullscreenDiagramHeight(){if(!this._isFullscreen||this.variant!=="Standard"||this.selectedChip!=="Diagram")return"";const t=this._getViewportHeight();if(!t)return"";const e=getComputedStyle(this),i=this._readCssLength(e.paddingTop)+this._readCssLength(e.paddingBottom)+this._getElementOuterHeight(".header")+this._getElementOuterHeight(".actions-row")+this._getElementOuterHeight(".footer")+16,s=Math.floor(t-i);return!Number.isFinite(s)||s<=0?"":`${Math.max(320,s)}px`}_getResolvedContentMaxWidth(){return this.contentMaxWidth?.trim()||""}_getResolvedDiagramHeight(){return this._fullscreenDiagramHeight||this.contentHeight?.trim()||""}_getResolvedDiagramScrollerWidth(){return this._getResolvedContentMaxWidth()}_getResolvedToggleHeightMode(){return this.toggleHeightMode==="auto"?"auto":"stable"}_getResolvedStandardContentHeight(){return this._getResolvedDiagramHeight()||"600px"}_getResolvedTableData(){return this.tableData??this._slottedTableData}_getResolvedTableView(t){return Mt(t,{inferAlignments:e=>this._inferTableAlignments(e),normalizeCell:e=>this._normalizeRenderableCell(e),formatCell:(e,i,s)=>this._formatTableCell(e,i,s)})}_getDiagramAssignedElements(){const t=this.shadowRoot?.querySelector('slot[name="diagram"]');return t?t.assignedElements({flatten:!0}):[]}_findExportableVisualElement(t){for(const e of t){if(e instanceof SVGSVGElement||e instanceof HTMLCanvasElement||e instanceof HTMLImageElement)return e;const i=e.querySelector("svg, canvas, img");if(i instanceof SVGSVGElement||i instanceof HTMLCanvasElement||i instanceof HTMLImageElement)return i}return null}_getExportableVisualElement(){if(this.variant==="Table")return null;if(this.variant==="Image"){const t=this.shadowRoot?.querySelector(".image-content img");return t instanceof HTMLImageElement?t:null}return this._findExportableVisualElement(this._getDiagramAssignedElements())}_getDefaultValueFormat(){return{type:"number",scale:"auto",decimals:0,decimalSeparator:this.lang==="en"?".":","}}_normalizeValueFormat(t){const e=this._getDefaultValueFormat(),i=t&&typeof t=="object"?t:{};return{type:["number","currency","percent"].includes(String(i.type))?String(i.type):e.type,scale:["auto","raw","thousands","millions","billions"].includes(String(i.scale))?String(i.scale):e.scale,decimals:Number.isFinite(Number(i.decimals))?Math.max(0,Math.min(20,Number(i.decimals))):e.decimals,decimalSeparator:String(i.decimalSeparator)==="."?".":String(i.decimalSeparator)===","?",":e.decimalSeparator}}_shouldPreserveSourceValueFormatting(t){const e=this._normalizeValueFormat(t);return e.type==="number"&&e.scale==="auto"}_normalizeTimeFormat(t){const e={mode:"raw",display:"raw"},i=t&&typeof t=="object"?t:{},s=["raw","year","monthCode","quarterCode","weekCode","tertialCode"];let a=typeof i.mode=="string"?i.mode:e.mode,r=typeof i.display=="string"?i.display:e.display;s.includes(a)||(a=e.mode);const o={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 o[a].includes(r)||(r=o[a][0]),a==="raw"&&(r="raw"),{mode:a,display:r}}_normalizeYAxisSettings(t){const e=t&&typeof t=="object"?t:{},i=Number.isFinite(Number(e.referenceLineValue))?Number(e.referenceLineValue):null;return{startAtZero:!!e.startAtZero,referenceLineEnabled:!!e.referenceLineEnabled&&Number.isFinite(i),referenceLineValue:i,referenceLineLabel:typeof e.referenceLineLabel=="string"?e.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(t,e){if(!t||e.mode==="raw"||e.display==="raw")return null;if(e.mode==="year"){const i=/^\s*(\d{4})\s*$/.exec(t);return i?i[1]:null}if(e.mode==="monthCode"){const i=/^\s*(\d{4})M(0?[1-9]|1[0-2])\s*$/i.exec(t);if(!i)return null;const s=Number(i[2])-1,a=i[1],r=String(s+1).padStart(2,"0");return e.display==="iso-month"?`${a}-${r}`:e.display==="short-month"?`${this._getShortMonthNames()[s]} ${a}`:e.display==="long-month"?`${this._getLongMonthNames()[s]} ${a}`:t}if(e.mode==="quarterCode"){const i=/^\s*(\d{4})(?:K(V)?|Q)(0?[1-4])\s*$/i.exec(t);if(!i)return null;const s=Number(i[3]),a=i[1],r=["första","andra","tredje","fjärde"];return e.display==="quarter-compact"?`${a} K${s}`:e.display==="quarter-short"?`kv ${s} ${a}`:e.display==="quarter-long"?`${r[s-1]} kvartalet ${a}`:t}if(e.mode==="weekCode"){const i=/^\s*(\d{4})(?:V|W)(0?[1-9]|[1-4][0-9]|5[0-3])\s*$/i.exec(t);if(!i)return null;const s=Number(i[2]),a=i[1];return e.display==="week-compact"?`${a} v. ${s}`:e.display==="week-long"?`vecka ${s} ${a}`:t}if(e.mode==="tertialCode"){const i=/^\s*(\d{4})T(0?[1-3])\s*$/i.exec(t);if(!i)return null;const s=Number(i[2]),a=i[1],r=["första","andra","tredje"];return e.display==="tertial-compact"?`${a} T${s}`:e.display==="tertial-short"?`tertial ${s} ${a}`:e.display==="tertial-long"?`${r[s-1]} tertialet ${a}`:t}return null}_localizeAutomaticNumericText(t){const e=this._normalizeValueFormat(this.valueFormat),i=String(t??"").trim();if(!i||i===".."||i==="...")return null;const s=i.replace(/[ \s]/g,"");if(!/^-?\d+(?:[.,]\d+)?$/.test(s))return null;const a=e.decimalSeparator==="."?".":",";return a==="."&&s.indexOf(",")!==-1?s.replace(",","."):a===","&&s.indexOf(".")!==-1?s.replace(".",","):s}_inferAutomaticValueDecimals(t){if(!Number.isFinite(t))return 0;let e=String(t);/e/i.test(e)&&(e=t.toFixed(6).replace(/0+$/,"").replace(/\.$/,""));const i=e.replace(/^-/,"").split(".");return i.length>1?Math.min(i[1].length,6):0}_formatAutomaticValueForDisplay(t,e){if(!Number.isFinite(t))return null;const i=this._localizeAutomaticNumericText(e);if(i!==null)return i;const s=this._normalizeValueFormat(this.valueFormat),a=this._inferAutomaticValueDecimals(t);return this._formatLocalizedNumber(t,a,s.decimalSeparator)}_formatLocalizedNumber(t,e,i){const s=new Intl.NumberFormat(this.lang==="en"?"en-GB":"sv-SE",{minimumFractionDigits:e,maximumFractionDigits:e}),a=i==="."||i===","?i:this.lang==="en"?".":",";return s.formatToParts(t).map(r=>r.type==="decimal"?a:r.value).join("")}_formatValueForDisplay(t,e,i){if(!Number.isFinite(t))return null;const s={raw:1,thousands:1e3,millions:1e6,billions:1e9},a={raw:"",thousands:this.lang==="en"?"k":"t",millions:this.lang==="en"?"M":"mn",billions:this.lang==="en"?"B":"md"};let r=e.scale;if(r==="auto"){const f=Math.abs(t);f>=1e9?r="billions":f>=1e6?r="millions":f>=1e3?r="thousands":r="raw"}const o=t/(s[r]||1);let l=this._formatLocalizedNumber(o,e.decimals,e.decimalSeparator);e.type==="percent"?l=`${l} %`:e.type==="currency"&&(l=i?`${l} kr`:l);const d=a[r]||"";return d&&(l=`${l} ${d}`),l}_isCategoryAxis(t){return t?.categories?.length>0||t?.options?.type==="category"}_isTooltipNumericLikeText(t){if(typeof t!="string")return!1;const e=t.trim();return e?/^-?\d+(?:[.,]\d+)?$/.test(e):!1}_getTooltipPointRowIndex(t){const e=t?.point||t;return Number.isFinite(e?.x)?Number(e.x):Number.isFinite(t?.x)?Number(t.x):Number.isFinite(e?.index)?Number(e.index):Number.isFinite(t?.index)?Number(t.index):null}_getTooltipTableCategoryValue(t){const e=this._getResolvedTableData();if(!e?.rows?.length)return"";const i=this._getTooltipPointRowIndex(t);if(i===null||i<0||i>=e.rows.length)return"";const s=e.rows[i];return!Array.isArray(s)||s.length===0?"":this._normalizeRenderableCell(s[0]).text}_getTooltipSeriesDataCategoryValue(t){const e=t?.point||t,i=e?.series||t?.series,s=this._getTooltipPointRowIndex(t);if(!i||s===null)return"";const a=[i?.options?.data,i?.userOptions?.data];for(const l of a){if(!Array.isArray(l)||s<0||s>=l.length)continue;const d=l[s];if(!d||typeof d!="object")continue;const f=typeof d.category<"u"&&d.category!==null?String(d.category):typeof d.name=="string"?d.name:"";if(f&&!this._isTooltipNumericLikeText(f))return f}const r=typeof e?.options?.category<"u"&&e.options.category!==null?String(e.options.category):"";if(r&&!this._isTooltipNumericLikeText(r))return r;const o=typeof e?.name=="string"?e.name.trim():"";return o&&!this._isTooltipNumericLikeText(o)?o:""}_getTooltipXAxisLabel(t,e){const i=t?.point||t,s=i?.series?.xAxis||t?.series?.xAxis,a=this._getTooltipPointRowIndex(t),r=[];if(s&&Array.isArray(s.categories)&&a!==null){const v=s.categories[a];typeof v<"u"&&v!==null&&r.push(String(v))}typeof i?.category=="string"&&i.category.trim()&&r.push(i.category),typeof t?.key=="string"&&t.key.trim()&&r.push(t.key),typeof t?.x=="string"&&t.x.trim()&&r.push(t.x);const o=this._getTooltipSeriesDataCategoryValue(t);o&&r.push(o);const l=this._getTooltipTableCategoryValue(t);l&&r.push(l);for(const v of r){const S=String(v).trim();if(!(!S||this._isTooltipNumericLikeText(S)))return this._formatCategoryTimeLabel(S,e)??S}const d=r.find(v=>String(v).trim());if(!d)return"";const f=String(d).trim();return this._formatCategoryTimeLabel(f,e)??f}_getTooltipPointLabel(t){const e=t?.point||t,i=e?.series||t?.series,s=String(e?.series?.type||i?.type||e?.series?.options?.type||i?.options?.type||e?.series?.chart?.options?.chart?.type||"").trim().toLowerCase();return["pie","variablepie"].includes(s)?e?.name||i?.name||"":i?.name||e?.name||""}_applyTimeFormatToLiveChart(t){const e=this._normalizeTimeFormat(this.timeFormat);if(e.mode==="raw"||e.display==="raw")return;const i=this._formatCategoryTimeLabel.bind(this);[...t?.xAxis||[],...t?.yAxis||[]].forEach(s=>{if(!this._isCategoryAxis(s))return;const a=s.options?.labels&&typeof s.options.labels=="object"?{...s.options.labels}:{},r=typeof a.formatter=="function"?a.formatter:null;a.formatter=function(){let o="";if(this?.axis&&Array.isArray(this.axis.categories)&&typeof this.pos=="number"){const d=this.axis.categories[this.pos];typeof d<"u"&&d!==null&&(o=String(d))}else typeof this?.value<"u"&&this.value!==null&&(o=String(this.value));const l=i(o,e);return l!==null?l:r?r.call(this):o},delete a.format,s.update({labels:a},!1)})}_applyValueFormatToLiveChart(t){const e=this._normalizeValueFormat(this.valueFormat),i=this._normalizeTimeFormat(this.timeFormat),s=this._formatValueForDisplay.bind(this),a=this._formatAutomaticValueForDisplay.bind(this),r=this._getTooltipXAxisLabel.bind(this),o=this._getTooltipPointLabel.bind(this);if(this._shouldPreserveSourceValueFormatting(this.valueFormat)){const l=t?.options?.tooltip&&typeof t.options.tooltip=="object"?{...t.options.tooltip}:{},d=t?.options?.plotOptions&&typeof t.options.plotOptions=="object"?{...t.options.plotOptions}:{},f=d.series&&typeof d.series=="object"?{...d.series}:{},v=f.dataLabels&&typeof f.dataLabels=="object"?{...f.dataLabels}:{},S=t?.options?.lang&&typeof t.options.lang=="object"?{...t.options.lang}:{};delete v.format,delete v.formatter,S.decimalPoint=e.decimalSeparator==="."?".":",",S.thousandsSep=" ",l.valueDecimals=void 0,l.formatter=function(){const _=Array.isArray(this.points)&&this.points.length?this.points:[this.point||this],y=r(this,i),D=[];return _.forEach(p=>{const z=p?.point||p,w=Number.isFinite(p?.y)?p.y:z?.y,C=o(p),M=a(w,z?.options&&typeof z.options.y<"u"&&z.options.y!==null?String(z.options.y):z&&typeof z.y<"u"&&z.y!==null?String(z.y):"");!Number.isFinite(w)||M===null||M===void 0||D.push(`${C?`${String(C)}: `:""}<b>${String(M)}</b><br/>`)}),`${y?`<span>${String(y)}</span><br/>`:""}${D.join("")}`}.bind(this),t.update({lang:S,tooltip:l,plotOptions:{...d,series:{...f,dataLabels:v}}},!1,!1,!1),(t?.yAxis||[]).forEach(_=>{const y=_.options?.labels&&typeof _.options.labels=="object"?{..._.options.labels}:{};delete y.format,delete y.formatter,_.update({labels:y},!1)});return}t.update({tooltip:{...t.options?.tooltip||{},valueDecimals:e.decimals,formatter:function(){const l=Array.isArray(this.points)&&this.points.length?this.points:[this.point||this],d=r(this,i),f=[];return l.forEach(v=>{const S=v?.point||v,_=s(Number.isFinite(v?.y)?v.y:S?.y,e,!0);if(_===null)return;const y=o(v);f.push(`${y?`${String(y)}: `:""}<b>${_}</b><br/>`)}),`${d?`<span>${String(d)}</span><br/>`:""}${f.join("")}`}},plotOptions:{...t.options?.plotOptions||{},series:{...t.options?.plotOptions?.series||{},dataLabels:{...t.options?.plotOptions?.series?.dataLabels||{},formatter:function(){return s(Number.isFinite(this?.y)?this.y:this?.point?.y,e,e.type==="percent")??null}}}}},!1,!1,!1),(t?.yAxis||[]).forEach(l=>{const d=l.options?.labels&&typeof l.options.labels=="object"?{...l.options.labels}:{},f=typeof d.formatter=="function"?d.formatter:null,v=!(l.options?.title&&typeof l.options.title.text=="string"&&l.options.title.text.trim());d.formatter=function(){const S=s(this?.value,e,v);return S!==null?S:f?f.call(this):this?.value},(e.type==="percent"||e.scale!=="auto")&&delete d.format,l.update({labels:d},!1)})}_applyYAxisSettingsToLiveChart(t){const e=this._normalizeYAxisSettings(this.yAxisSettings),i=t?.yAxis||[];i.length&&i.forEach((s,a)=>{const r=s.options&&typeof s.options=="object"?s.options:{},o={},l=typeof r.min<"u"&&r.min!==null&&r.min!=="";a===0&&e.startAtZero&&!l&&(o.min=0);const d=Array.isArray(r.plotLines)?r.plotLines.filter(f=>f?.id!=="scb-viz-reference-line"):[];a===0&&e.referenceLineEnabled&&Number.isFinite(e.referenceLineValue)&&d.push({id:"scb-viz-reference-line",className:"scb-axis-plotline scb-viz-reference-line",value:e.referenceLineValue}),d.length?o.plotLines=d:Array.isArray(r.plotLines)&&(o.plotLines=[]),s.update(o,!1)})}_getCurrentHighchartsChart(){if(this._getCurrentPrintableView()!=="diagram")return;const t=h(c,this,B).call(this,this._getDiagramAssignedElements());if(t!==void 0)return window.Highcharts?.charts?.[t]}_getSeriesDifferentiationGroup(t,e){const i=String(t?.type||t?.options?.type||e?.options?.chart?.type||"").trim().toLowerCase();return["line","spline","scatter"].includes(i)?"line":["area","areaspline"].includes(i)?"area":["column","bar"].includes(i)?this._isGroupedSeriesDifferentiationChart(t,e)?"grouped-fill":"fill":["pie","variablepie"].includes(i)?"point-fill":null}_getSeriesDifferentiationVariantByIndex(t){return yt(t)}_isGroupedSeriesDifferentiationChart(t,e){return St(t,e)}_usesGroupedPointDifferentiation(t){return Dt(t)}_getGroupedSeriesDifferentiationVariant(t,e,i){const s=mt(t,e,i);return{...s,variantIndex:typeof s.variantIndex=="number"?s.variantIndex:i}}_applyGroupedLegendSeriesDifferentiation(t){(Array.isArray(t?.legend?.allItems)?t.legend.allItems:[]).forEach((e,i)=>{const s=e&&e.series?e.series:e;if(!this._isGroupedSeriesDifferentiationChart(s,t))return;const{variantIndex:a,patternKind:r}=this._getGroupedSeriesDifferentiationVariant(e,t,i),o=this._getHighchartsColorClassName(e?.legendSymbol??e?.legendItem?.symbol??e?.legendItem?.group,a);this._getLegendSeriesDifferentiationTargets(e).fillTargets.forEach(l=>{this._setSeriesDifferentiationMetadata(l,{role:"legend-fill",patternKind:r}),this._setSeriesDifferentiationColorClass(l,o)}),this._ensureStyledModeSeriesPattern(t,o,r)})}_clearGroupedLegendSeriesDifferentiation(t){(Array.isArray(t?.legend?.allItems)?t.legend.allItems:[]).forEach(e=>{const i=e&&e.series?e.series:e;if(!this._isGroupedSeriesDifferentiationChart(i,t))return;const s=this._getLegendSeriesDifferentiationTargets(e);s.graphTargets.forEach(a=>{this._clearSeriesDifferentiationMetadata(a)}),s.fillTargets.forEach(a=>{this._clearSeriesDifferentiationMetadata(a),this._clearSeriesDifferentiationColorClass(a)})})}_shouldShowSeriesDifferentiationAction(){return xt({chart:this._getCurrentHighchartsChart(),getCurrentPrintableView:()=>this._getCurrentPrintableView(),getSeriesDifferentiationGroup:(t,e)=>this._getSeriesDifferentiationGroup(t,e),isHighchartsStyledMode:t=>this._isHighchartsStyledMode(t)})}_getSeriesDifferentiationSnapshotStore(t){let e=this._seriesDifferentiationSnapshots.get(t);return e||(e=new Map,this._seriesDifferentiationSnapshots.set(t,e)),e}_cloneSeriesOptionValue(t){return Array.isArray(t)?t.map(e=>this._cloneSeriesOptionValue(e)):t&&typeof t=="object"?Object.fromEntries(Object.entries(t).map(([e,i])=>[e,this._cloneSeriesOptionValue(i)])):t}_captureSeriesDifferentiationSnapshot(t){const e=this._cloneSeriesOptionValue(t?.options?.marker),i=this._cloneSeriesOptionValue(t?.resetA11yMarkerOptions),s=this._cloneSeriesOptionValue(t?.userOptions?.marker),a=e?.states,r=t?.a11yMarkersForced===!0&&i&&Object.keys(i).length>0||a?.normal?.opacity===0&&i&&Object.keys(i).length>0?i:s;return{marker:r&&Object.keys(r).length>0?r:e&&Object.keys(e).length>0?e:{enabled:!1}}}_isHighchartsStyledMode(t){return zt(t)}_getHighchartsSvgRoot(t){return vt(t)}_getHighchartsColorClassName(t,e){return bt(t,e)}_setSeriesDifferentiationMetadata(t,e){Ct(t,e)}_clearSeriesDifferentiationMetadata(t){ft(t)}_setSeriesDifferentiationColorClass(t,e){wt(t,e)}_clearSeriesDifferentiationColorClass(t){ut(t)}_getLegendSeriesDifferentiationTargets(t){return _t(t)}_ensureStyledModeSeriesPattern(t,e,i){gt(t,e,i)}_applyStyledModeSeriesDifferentiation(t){const e=this._getHighchartsSvgRoot(t);if(!e)return;e.classList.add("scb-viz-series-differentiation-enabled");const i=pt(),s=this._getSeriesDifferentiationSnapshotStore(t);t.series?.forEach((a,r)=>{const o=this._getSeriesDifferentiationGroup(a,t);if(!o)return;const l=String(a?.index??r);s.has(l)||s.set(l,this._captureSeriesDifferentiationSnapshot(a));const d=o==="grouped-fill"&&this._usesGroupedPointDifferentiation(a),f=o==="grouped-fill"?this._getGroupedSeriesDifferentiationVariant(a,t,r):{variantIndex:r,...this._getSeriesDifferentiationVariantByIndex(r)},{dashStyle:v,markerSymbol:S,patternKind:_}=f,y=this._getHighchartsColorClassName(a?.graph??a?.area??a?.group,f.variantIndex),D=this._getLegendSeriesDifferentiationTargets(a);this._setSeriesDifferentiationMetadata(a?.graph,{role:"graph",dashStyle:v}),o==="area"&&(this._setSeriesDifferentiationMetadata(a?.area,{role:"area",patternKind:_}),this._setSeriesDifferentiationColorClass(a?.area,y),this._ensureStyledModeSeriesPattern(t,y,_)),o==="fill"&&(a.points?.forEach(p=>{this._setSeriesDifferentiationMetadata(p?.graphic,{role:"fill",patternKind:_}),this._setSeriesDifferentiationColorClass(p?.graphic,y)}),this._ensureStyledModeSeriesPattern(t,y,_)),o==="grouped-fill"&&(d?a.points?.forEach((p,z)=>{const w=this._getGroupedSeriesDifferentiationVariant(p,t,z),C=this._getHighchartsColorClassName(p?.graphic??p?.legendSymbol??p?.legendItem?.symbol??p?.legendItem?.group,w.variantIndex);this._setSeriesDifferentiationMetadata(p?.graphic,{role:"fill",patternKind:w.patternKind}),this._setSeriesDifferentiationColorClass(p?.graphic,C),this._ensureStyledModeSeriesPattern(t,C,w.patternKind)}):(a.points?.forEach(p=>{this._setSeriesDifferentiationMetadata(p?.graphic,{role:"fill",patternKind:_}),this._setSeriesDifferentiationColorClass(p?.graphic,y)}),this._ensureStyledModeSeriesPattern(t,y,_))),o==="point-fill"&&a.points?.forEach((p,z)=>{const w=i[z%i.length],C=this._getHighchartsColorClassName(p?.graphic??p?.legendSymbol??p?.legendItem?.symbol??p?.legendItem?.group,z),M=this._getLegendSeriesDifferentiationTargets(p);this._setSeriesDifferentiationMetadata(p?.graphic,{role:"fill",patternKind:w}),this._setSeriesDifferentiationColorClass(p?.graphic,C),this._ensureStyledModeSeriesPattern(t,C,w),M.fillTargets.forEach(k=>{this._setSeriesDifferentiationMetadata(k,{role:"legend-fill",patternKind:w}),this._setSeriesDifferentiationColorClass(k,C)})}),(o==="line"||o==="area")&&D.graphTargets.forEach(p=>{this._setSeriesDifferentiationMetadata(p,{role:"legend-symbol",dashStyle:v})}),(o==="area"||o==="fill"||o==="grouped-fill"&&!d)&&D.fillTargets.forEach(p=>{this._setSeriesDifferentiationMetadata(p,{role:"legend-fill",patternKind:_}),this._setSeriesDifferentiationColorClass(p,y)}),(o==="line"||o==="area")&&a.update({marker:{enabled:!0,symbol:S}},!1)}),this._applyGroupedLegendSeriesDifferentiation(t),t.redraw(!1)}_restoreStyledModeSeriesDifferentiation(t){this._getHighchartsSvgRoot(t)?.classList.remove("scb-viz-series-differentiation-enabled");const e=this._getSeriesDifferentiationSnapshotStore(t);t.series?.forEach((i,s)=>{const a=this._getSeriesDifferentiationGroup(i,t);if(!a)return;const r=this._getLegendSeriesDifferentiationTargets(i);if(this._clearSeriesDifferentiationMetadata(i?.graph),this._clearSeriesDifferentiationMetadata(i?.area),this._clearSeriesDifferentiationColorClass(i?.area),i.points?.forEach(o=>{const l=this._getLegendSeriesDifferentiationTargets(o);this._clearSeriesDifferentiationMetadata(o?.graphic),this._clearSeriesDifferentiationColorClass(o?.graphic),l.graphTargets.forEach(d=>{this._clearSeriesDifferentiationMetadata(d)}),l.fillTargets.forEach(d=>{this._clearSeriesDifferentiationMetadata(d),this._clearSeriesDifferentiationColorClass(d)})}),r.graphTargets.forEach(o=>{this._clearSeriesDifferentiationMetadata(o)}),r.fillTargets.forEach(o=>{this._clearSeriesDifferentiationMetadata(o),this._clearSeriesDifferentiationColorClass(o)}),a==="line"||a==="area"){const o=e.get(String(i?.index??s));i.update({marker:this._cloneSeriesOptionValue(o?.marker)},!1)}}),this._clearGroupedLegendSeriesDifferentiation(t),t.redraw(!1),this._seriesDifferentiationSnapshots.delete(t)}_canExportRaster(){return this._getExportableVisualElement()!==null}_canExportCsv(){return!!this._getResolvedTableData()?.rows?.length}_buildExportFileName(t){return tt({lang:this.lang,title:this.title},t)}_getFullscreenTarget(){return this}_getCurrentFullscreenElement(){return at()}_isFullscreenSupported(){return rt(this._getFullscreenTarget())}_syncFullscreenState(){const t=this._getCurrentFullscreenElement()===this._getFullscreenTarget();this._isFullscreen=t,this.toggleAttribute("data-scb-viz-fullscreen",t),h(c,this,L).call(this),h(c,this,x).call(this)}async _toggleFullscreen(){await lt(this._getFullscreenTarget())}_renderActionsMenu(){const t=this._getCurrentPrintableView(),e=this._canExportRaster(),i=this._canExportCsv(),s=e&&(t==="diagram"||t==="image"),a=i&&t==="table",r=this._shouldShowSeriesDifferentiationAction();return u`
|
|
117
117
|
<div class="actions-menu">
|
|
118
118
|
<scb-icon-button
|
|
119
119
|
icon="more_vert"
|
|
@@ -125,7 +125,7 @@ import{_ as J,b as Y,g as X,h as v,m as F,o as E,r as Z,y as p}from"../../vendor
|
|
|
125
125
|
aria-label=${this.actionsMenuLabel}
|
|
126
126
|
aria-haspopup="menu"
|
|
127
127
|
aria-expanded=${this._actionsMenuOpen?"true":"false"}
|
|
128
|
-
@click=${
|
|
128
|
+
@click=${o=>this._toggleActionsMenu(o)}
|
|
129
129
|
></scb-icon-button>
|
|
130
130
|
<div
|
|
131
131
|
class=${`actions-menu-panel ${this._actionsMenuOpen?"actions-menu-panel--open":""}`}
|
|
@@ -144,7 +144,7 @@ import{_ as J,b as Y,g as X,h as v,m as F,o as E,r as Z,y as p}from"../../vendor
|
|
|
144
144
|
<span class="actions-menu-item-label">${this.printLabel}</span>
|
|
145
145
|
</button>
|
|
146
146
|
</li>
|
|
147
|
-
${s?
|
|
147
|
+
${s?u`
|
|
148
148
|
<li>
|
|
149
149
|
<button
|
|
150
150
|
type="button"
|
|
@@ -168,7 +168,7 @@ import{_ as J,b as Y,g as X,h as v,m as F,o as E,r as Z,y as p}from"../../vendor
|
|
|
168
168
|
</button>
|
|
169
169
|
</li>
|
|
170
170
|
`:""}
|
|
171
|
-
${a?
|
|
171
|
+
${a?u`
|
|
172
172
|
<li>
|
|
173
173
|
<button
|
|
174
174
|
type="button"
|
|
@@ -181,7 +181,7 @@ import{_ as J,b as Y,g as X,h as v,m as F,o as E,r as Z,y as p}from"../../vendor
|
|
|
181
181
|
</button>
|
|
182
182
|
</li>
|
|
183
183
|
`:""}
|
|
184
|
-
${r?
|
|
184
|
+
${r?u`
|
|
185
185
|
<li>
|
|
186
186
|
<button
|
|
187
187
|
type="button"
|
|
@@ -197,7 +197,7 @@ import{_ as J,b as Y,g as X,h as v,m as F,o as E,r as Z,y as p}from"../../vendor
|
|
|
197
197
|
</button>
|
|
198
198
|
</li>
|
|
199
199
|
`:""}
|
|
200
|
-
${this._isFullscreenSupported()?
|
|
200
|
+
${this._isFullscreenSupported()?u`
|
|
201
201
|
<li>
|
|
202
202
|
<button
|
|
203
203
|
type="button"
|
|
@@ -215,9 +215,9 @@ import{_ as J,b as Y,g as X,h as v,m as F,o as E,r as Z,y as p}from"../../vendor
|
|
|
215
215
|
</ul>
|
|
216
216
|
</div>
|
|
217
217
|
</div>
|
|
218
|
-
`}_renderActions(){return
|
|
218
|
+
`}_renderActions(){return u`
|
|
219
219
|
<div class="actions-row">
|
|
220
|
-
${this.variant==="Standard"&&!this.disableToggle?
|
|
220
|
+
${this.variant==="Standard"&&!this.disableToggle?u`
|
|
221
221
|
<div class="flipp-wrapper">
|
|
222
222
|
<scb-segmented-button
|
|
223
223
|
.value=${this.selectedChip||""}
|
|
@@ -235,62 +235,48 @@ import{_ as J,b as Y,g as X,h as v,m as F,o as E,r as Z,y as p}from"../../vendor
|
|
|
235
235
|
></scb-segmented-item>
|
|
236
236
|
</scb-segmented-button>
|
|
237
237
|
</div>
|
|
238
|
-
`:
|
|
238
|
+
`:u`<div></div>`}
|
|
239
239
|
${this._renderActionsMenu()}
|
|
240
240
|
</div>
|
|
241
|
-
`}_renderHeader(t=!1){const e=
|
|
241
|
+
`}_renderHeader(t=!1){const e=u`
|
|
242
242
|
<div class="header">
|
|
243
|
-
${this.title?
|
|
244
|
-
${this.subtitle?
|
|
243
|
+
${this.title?u` <div id=${this._getTitleId()} class="label">${this.title}</div> `:""}
|
|
244
|
+
${this.subtitle?u` <div id=${this._getSubtitleId()} class="sub-label">${this.subtitle}</div> `:""}
|
|
245
245
|
</div>
|
|
246
|
-
`;return t?
|
|
246
|
+
`;return t?u`
|
|
247
247
|
<div class="header-row">
|
|
248
248
|
${e}
|
|
249
249
|
${this._renderActionsMenu()}
|
|
250
250
|
</div>
|
|
251
|
-
`:e}_renderTable(){const t=this._getResolvedTableData();if(!t||!t.rows||t.rows.length===0)return null;const{alignments:e,headers:i,rows:s,rowHeaderRows:a}=this._getResolvedTableView(t),r=[this.title,this.subtitle].map(
|
|
252
|
-
<
|
|
253
|
-
${r
|
|
254
|
-
|
|
255
|
-
<thead>
|
|
256
|
-
<tr>
|
|
257
|
-
${i.map((n,h)=>p`<th scope="col" class=${e[h]==="right"?"align-right":"align-left"}><span class="scb-viz-table-heading-text">${n.html?E(n.html):n.text}</span></th>`)}
|
|
258
|
-
</tr>
|
|
259
|
-
</thead>
|
|
260
|
-
`:""}
|
|
261
|
-
<tbody>
|
|
262
|
-
${s.map((n,h)=>{const d=a[h]===!0;return p`
|
|
263
|
-
<tr>
|
|
264
|
-
${n.map((u,b)=>{const _=e[b]==="right"?"align-right":"align-left",y=u.html?E(u.html):u.text;return b===0&&d?p`<th scope="row" class=${_}>${y}</th>`:p`<td class=${_}>${y}</td>`})}
|
|
265
|
-
</tr>
|
|
266
|
-
`})}
|
|
267
|
-
</tbody>
|
|
268
|
-
</table>
|
|
251
|
+
`:e}_renderTable(){const t=this._getResolvedTableData();if(!t||!t.rows||t.rows.length===0)return null;const{alignments:e,headers:i,rows:s,rowHeaderRows:a}=this._getResolvedTableView(t),r=[this.title,this.subtitle].map(l=>typeof l=="string"?l.trim():"").filter(Boolean).join(". "),o=l=>l.html?l.html:this._escapeHtml(l.text);return u`
|
|
252
|
+
<scb-table part="table">
|
|
253
|
+
${X(`<table class="scb-viz-table">${r?`<caption class="visually-hidden">${this._escapeHtml(r)}</caption>`:""}${i.length>0?`<thead><tr>${i.map((l,d)=>`<th scope="col" class="${e[d]==="right"?"align-right":"align-left"}">${o(l)}</th>`).join("")}</tr></thead>`:""}<tbody>${s.map((l,d)=>{const f=a[d]===!0;return`<tr>${l.map((v,S)=>{const _=e[S]==="right"?"align-right":"align-left",y=o(v);return S===0&&f?`<th scope="row" class="${_}">${y}</th>`:`<td class="${_}">${y}</td>`}).join("")}</tr>`}).join("")}</tbody></table>`)}
|
|
254
|
+
</scb-table>
|
|
269
255
|
`}_renderRichText(t){const e=typeof t=="string"?t.replace(/\r\n?/g,`
|
|
270
|
-
`):"",i=e.split(/\n{2,}/).filter(s=>s!=="");return i.length?
|
|
271
|
-
`).map((a,r)=>
|
|
256
|
+
`):"",i=e.split(/\n{2,}/).filter(s=>s!=="");return i.length?u`${i.map(s=>u`<p class="body-text-paragraph">${s.split(`
|
|
257
|
+
`).map((a,r)=>u`${r>0?u`<br />`:""}${a}`)}</p>`)}`:e}_escapeHtml(t){return String(t??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}_renderRichTextHtml(t){const e=typeof t=="string"?t.replace(/\r\n?/g,`
|
|
272
258
|
`):"",i=e.split(/\n{2,}/).filter(s=>s!=="");return i.length?i.map(s=>`<p class="body-text-paragraph">${s.split(`
|
|
273
|
-
`).map(a=>this._escapeHtml(a)).join("<br>")}</p>`).join(""):this._escapeHtml(e)}_hasMoreAboutStats(){return!!(this.comment||this.source||this.footnote||this.officialStatistics)}_renderMoreAboutStatsContent(){return
|
|
259
|
+
`).map(a=>this._escapeHtml(a)).join("<br>")}</p>`).join(""):this._escapeHtml(e)}_hasMoreAboutStats(){return!!(this.comment||this.source||this.footnote||this.officialStatistics)}_renderMoreAboutStatsContent(){return u`
|
|
274
260
|
<div class="more-about-stats-content">
|
|
275
|
-
${this.comment?
|
|
261
|
+
${this.comment?u`
|
|
276
262
|
<div class="section">
|
|
277
263
|
<div class="secondary-label">${this.commentLabel}</div>
|
|
278
264
|
<div class="body-text body-text-rich">${this._renderRichText(this.comment)}</div>
|
|
279
265
|
</div>
|
|
280
266
|
`:""}
|
|
281
|
-
${this.source?
|
|
267
|
+
${this.source?u`
|
|
282
268
|
<div class="section">
|
|
283
269
|
<div class="secondary-label">${this.sourceLabel}</div>
|
|
284
270
|
<div class="body-text">${this.source}</div>
|
|
285
271
|
</div>
|
|
286
272
|
`:""}
|
|
287
|
-
${this.footnote?
|
|
273
|
+
${this.footnote?u`
|
|
288
274
|
<div class="section">
|
|
289
275
|
<div class="secondary-label">${this.footnoteLabel}</div>
|
|
290
276
|
<div class="body-text body-text-rich">${this._renderRichText(this.footnote)}</div>
|
|
291
277
|
</div>
|
|
292
278
|
`:""}
|
|
293
|
-
${this.officialStatistics?
|
|
279
|
+
${this.officialStatistics?u`
|
|
294
280
|
<a
|
|
295
281
|
class="sos-logotype-link"
|
|
296
282
|
href="https://www.scb.se/sos"
|
|
@@ -300,12 +286,12 @@ import{_ as J,b as Y,g as X,h as v,m as F,o as E,r as Z,y as p}from"../../vendor
|
|
|
300
286
|
aria-label="${this.officialStatisticsAlt}"
|
|
301
287
|
>
|
|
302
288
|
<span class="sos-logotype-small" aria-hidden="true">
|
|
303
|
-
${Z(
|
|
289
|
+
${Z(j)}
|
|
304
290
|
</span>
|
|
305
291
|
</a>
|
|
306
292
|
`:""}
|
|
307
293
|
</div>
|
|
308
|
-
`}_renderMoreAboutStatsScreen(){return this._hasMoreAboutStats()?
|
|
294
|
+
`}_renderMoreAboutStatsScreen(){return this._hasMoreAboutStats()?u`
|
|
309
295
|
<div class="footer-statistics-screen">
|
|
310
296
|
<scb-divider></scb-divider>
|
|
311
297
|
<scb-accordion>
|
|
@@ -314,16 +300,16 @@ import{_ as J,b as Y,g as X,h as v,m as F,o as E,r as Z,y as p}from"../../vendor
|
|
|
314
300
|
</scb-accordion-item>
|
|
315
301
|
</scb-accordion>
|
|
316
302
|
</div>
|
|
317
|
-
`:""}_renderMoreAboutStatsPrint(){return this._hasMoreAboutStats()?
|
|
303
|
+
`:""}_renderMoreAboutStatsPrint(){return this._hasMoreAboutStats()?u`
|
|
318
304
|
<div class="footer-statistics-print print-more-about-stats">
|
|
319
305
|
<div class="secondary-label print-more-about-stats-heading">
|
|
320
306
|
${this.moreAboutStatsLabel}
|
|
321
307
|
</div>
|
|
322
308
|
${this._renderMoreAboutStatsContent()}
|
|
323
309
|
</div>
|
|
324
|
-
`:""}_renderFooter(){return
|
|
310
|
+
`:""}_renderFooter(){return u`
|
|
325
311
|
<div class="footer">
|
|
326
|
-
${this.description?
|
|
312
|
+
${this.description?u`
|
|
327
313
|
<div id=${this._getDescriptionId()} class="description section">
|
|
328
314
|
<div class="secondary-label">${this.descriptionLabel}</div>
|
|
329
315
|
<div class="body-text body-text-rich">${this._renderRichText(this.description)}</div>
|
|
@@ -332,7 +318,7 @@ import{_ as J,b as Y,g as X,h as v,m as F,o as E,r as Z,y as p}from"../../vendor
|
|
|
332
318
|
${this._renderMoreAboutStatsScreen()}
|
|
333
319
|
${this._renderMoreAboutStatsPrint()}
|
|
334
320
|
</div>
|
|
335
|
-
`}render(){switch(this.variant){case"Table":return
|
|
321
|
+
`}render(){switch(this.variant){case"Table":return u`
|
|
336
322
|
<div part="container" class="viz-container">
|
|
337
323
|
${this._renderHeader(!0)}
|
|
338
324
|
<div
|
|
@@ -341,14 +327,7 @@ import{_ as J,b as Y,g as X,h as v,m as F,o as E,r as Z,y as p}from"../../vendor
|
|
|
341
327
|
aria-labelledby=${this._getContentAriaLabelledBy()}
|
|
342
328
|
aria-describedby=${this._getContentAriaDescribedBy()}
|
|
343
329
|
>
|
|
344
|
-
|
|
345
|
-
width="100%"
|
|
346
|
-
class="table-scroller"
|
|
347
|
-
variant="inline"
|
|
348
|
-
show-scrollbar
|
|
349
|
-
>
|
|
350
|
-
${this._renderTable()}
|
|
351
|
-
</scb-horizontal-scroller>
|
|
330
|
+
${this._renderTable()}
|
|
352
331
|
</div>
|
|
353
332
|
${this._renderFooter()}
|
|
354
333
|
<slot
|
|
@@ -358,7 +337,7 @@ import{_ as J,b as Y,g as X,h as v,m as F,o as E,r as Z,y as p}from"../../vendor
|
|
|
358
337
|
></slot>
|
|
359
338
|
<slot></slot>
|
|
360
339
|
</div>
|
|
361
|
-
`;case"Image":return
|
|
340
|
+
`;case"Image":return u`
|
|
362
341
|
<div part="container" class="viz-container">
|
|
363
342
|
${this._renderHeader(!0)}
|
|
364
343
|
<div
|
|
@@ -378,14 +357,14 @@ import{_ as J,b as Y,g as X,h as v,m as F,o as E,r as Z,y as p}from"../../vendor
|
|
|
378
357
|
></slot>
|
|
379
358
|
<slot></slot>
|
|
380
359
|
</div>
|
|
381
|
-
`;default:{const t=this._getResolvedContentMaxWidth(),e=
|
|
360
|
+
`;default:{const t=this._getResolvedContentMaxWidth(),e=u`
|
|
382
361
|
<div
|
|
383
362
|
class="diagram-content"
|
|
384
363
|
style=${t?`--scb-viz-content-max-width: ${t};`:""}
|
|
385
364
|
>
|
|
386
365
|
<slot name="diagram" @slotchange=${this._onDiagramSlotChange}></slot>
|
|
387
366
|
</div>
|
|
388
|
-
`;return
|
|
367
|
+
`;return u`
|
|
389
368
|
<div part="container" class="viz-container">
|
|
390
369
|
${this._renderHeader()}
|
|
391
370
|
${this._renderActions()}
|
|
@@ -401,7 +380,7 @@ import{_ as J,b as Y,g as X,h as v,m as F,o as E,r as Z,y as p}from"../../vendor
|
|
|
401
380
|
<div
|
|
402
381
|
class=${`standard-content-panel standard-content-panel--diagram ${this.selectedChip==="Diagram"?"standard-content-panel--active":""}`}
|
|
403
382
|
>
|
|
404
|
-
${t?
|
|
383
|
+
${t?u`
|
|
405
384
|
<scb-horizontal-scroller
|
|
406
385
|
width=${this._getResolvedDiagramScrollerWidth()}
|
|
407
386
|
class="standard-diagram-scroller"
|
|
@@ -410,20 +389,13 @@ import{_ as J,b as Y,g as X,h as v,m as F,o as E,r as Z,y as p}from"../../vendor
|
|
|
410
389
|
>
|
|
411
390
|
${e}
|
|
412
391
|
</scb-horizontal-scroller>
|
|
413
|
-
`:
|
|
392
|
+
`:u`<div class="standard-diagram-scroller">${e}</div>`}
|
|
414
393
|
</div>
|
|
415
394
|
<div
|
|
416
395
|
class=${`standard-content-panel standard-content-panel--table ${this.selectedChip==="Table"?"standard-content-panel--active":""}`}
|
|
417
396
|
>
|
|
418
397
|
<div class="table-panel-scroll">
|
|
419
|
-
|
|
420
|
-
width="100%"
|
|
421
|
-
class="standard-table-scroller"
|
|
422
|
-
variant="inline"
|
|
423
|
-
show-scrollbar
|
|
424
|
-
>
|
|
425
|
-
${this._renderTable()}
|
|
426
|
-
</scb-horizontal-scroller>
|
|
398
|
+
${this._renderTable()}
|
|
427
399
|
</div>
|
|
428
400
|
</div>
|
|
429
401
|
</div>
|
|
@@ -436,7 +408,7 @@ import{_ as J,b as Y,g as X,h as v,m as F,o as E,r as Z,y as p}from"../../vendor
|
|
|
436
408
|
></slot>
|
|
437
409
|
<slot></slot>
|
|
438
410
|
</div>
|
|
439
|
-
`}}}_syncChipClass(){const t=this.variant==="Standard";this.classList.toggle("chip-diagram",t&&this.selectedChip==="Diagram"),this.classList.toggle("chip-table",t&&this.selectedChip==="Table")}_dispatchSelectedChipChanged(){const t={selectedChip:this.selectedChip};this.dispatchEvent(new CustomEvent("selected-chip-changed",{detail:t,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("selectedchipchanged",{detail:t,bubbles:!0,composed:!0}))}_onSegmentedChange(t){const e=t.detail?.value;this.selectedChip===e?this.selectedChip=null:this.selectedChip=e}_toggleActionsMenu(t){t.stopPropagation(),this._actionsMenuOpen=!this._actionsMenuOpen,this._actionsMenuOpen&&requestAnimationFrame(()=>{this._focusFirstMenuItem()})}_closeActionsMenu(){this._actionsMenuOpen=!1}_focusMenuButton(){this.shadowRoot?.querySelector(".actions-menu scb-icon-button")?.focus()}_focusFirstMenuItem(){this.shadowRoot?.querySelector(".actions-menu-item")?.focus()}_getExportSurfaceTarget(){return this.shadowRoot?.querySelector(".viz-container")??this}_getCurrentPrintableView(){return this.variant==="Table"?"table":this.variant==="Image"?"image":this.selectedChip==="Table"?"table":"diagram"}},A.styles=
|
|
411
|
+
`}}}_syncChipClass(){const t=this.variant==="Standard";this.classList.toggle("chip-diagram",t&&this.selectedChip==="Diagram"),this.classList.toggle("chip-table",t&&this.selectedChip==="Table")}_dispatchSelectedChipChanged(){const t={selectedChip:this.selectedChip};this.dispatchEvent(new CustomEvent("selected-chip-changed",{detail:t,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("selectedchipchanged",{detail:t,bubbles:!0,composed:!0}))}_onSegmentedChange(t){const e=t.detail?.value;this.selectedChip===e?this.selectedChip=null:this.selectedChip=e}_toggleActionsMenu(t){t.stopPropagation(),this._actionsMenuOpen=!this._actionsMenuOpen,this._actionsMenuOpen&&requestAnimationFrame(()=>{this._focusFirstMenuItem()})}_closeActionsMenu(){this._actionsMenuOpen=!1}_focusMenuButton(){this.shadowRoot?.querySelector(".actions-menu scb-icon-button")?.focus()}_focusFirstMenuItem(){this.shadowRoot?.querySelector(".actions-menu-item")?.focus()}_getExportSurfaceTarget(){return this.shadowRoot?.querySelector(".viz-container")??this}_getCurrentPrintableView(){return this.variant==="Table"?"table":this.variant==="Image"?"image":this.selectedChip==="Table"?"table":"diagram"}},A.styles=J`
|
|
440
412
|
:host {
|
|
441
413
|
display: block;
|
|
442
414
|
box-sizing: border-box;
|
|
@@ -803,7 +775,6 @@ import{_ as J,b as Y,g as X,h as v,m as F,o as E,r as Z,y as p}from"../../vendor
|
|
|
803
775
|
max-width: 600px;
|
|
804
776
|
}
|
|
805
777
|
|
|
806
|
-
.table-scroller,
|
|
807
778
|
.diagram-scroller {
|
|
808
779
|
display: none;
|
|
809
780
|
}
|
|
@@ -853,8 +824,7 @@ import{_ as J,b as Y,g as X,h as v,m as F,o as E,r as Z,y as p}from"../../vendor
|
|
|
853
824
|
flex-direction: column;
|
|
854
825
|
}
|
|
855
826
|
|
|
856
|
-
.standard-diagram-scroller
|
|
857
|
-
.standard-table-scroller {
|
|
827
|
+
.standard-diagram-scroller {
|
|
858
828
|
display: flex;
|
|
859
829
|
width: 100%;
|
|
860
830
|
min-width: 0;
|
|
@@ -871,22 +841,12 @@ import{_ as J,b as Y,g as X,h as v,m as F,o as E,r as Z,y as p}from"../../vendor
|
|
|
871
841
|
overflow: hidden;
|
|
872
842
|
}
|
|
873
843
|
|
|
874
|
-
.standard-content-shell--stable .standard-content-panel--table.standard-content-panel--active .standard-table-scroller {
|
|
875
|
-
flex: 1 1 auto;
|
|
876
|
-
min-height: 0;
|
|
877
|
-
height: 100%;
|
|
878
|
-
}
|
|
879
|
-
|
|
880
844
|
.standard-content-shell--stable .standard-content-panel--table.standard-content-panel--active .table-panel-scroll {
|
|
881
845
|
flex: 1 1 auto;
|
|
882
846
|
min-height: 0;
|
|
883
847
|
overflow: auto;
|
|
884
848
|
}
|
|
885
849
|
|
|
886
|
-
:host([variant='Table']) .table-scroller {
|
|
887
|
-
display: flex;
|
|
888
|
-
}
|
|
889
|
-
|
|
890
850
|
:host([variant='Image']) .image-content {
|
|
891
851
|
display: block;
|
|
892
852
|
}
|
|
@@ -900,86 +860,14 @@ import{_ as J,b as Y,g as X,h as v,m as F,o as E,r as Z,y as p}from"../../vendor
|
|
|
900
860
|
display: none;
|
|
901
861
|
}
|
|
902
862
|
|
|
903
|
-
:host([variant='Image']) .table-scroller {
|
|
904
|
-
display: none;
|
|
905
|
-
}
|
|
906
|
-
|
|
907
863
|
:host([variant='Standard'].chip-diagram) .diagram-scroller {
|
|
908
864
|
display: flex;
|
|
909
865
|
}
|
|
910
866
|
|
|
911
|
-
:host([variant='Standard'].chip-table) .table-scroller {
|
|
912
|
-
display: flex;
|
|
913
|
-
}
|
|
914
|
-
|
|
915
867
|
.table-source {
|
|
916
868
|
display: none;
|
|
917
869
|
}
|
|
918
870
|
|
|
919
|
-
.scb-viz-table {
|
|
920
|
-
border-collapse: collapse;
|
|
921
|
-
width: max-content;
|
|
922
|
-
max-width: none;
|
|
923
|
-
font-family: var(--_scb-viz-font-family);
|
|
924
|
-
font-size: var(--_scb-viz-body-font-size);
|
|
925
|
-
font-weight: var(--_scb-viz-body-font-weight);
|
|
926
|
-
line-height: var(--_scb-viz-body-line-height);
|
|
927
|
-
letter-spacing: var(--_scb-viz-body-letter-spacing);
|
|
928
|
-
}
|
|
929
|
-
|
|
930
|
-
.scb-viz-table th,
|
|
931
|
-
.scb-viz-table td {
|
|
932
|
-
border: 1px solid var(--scb-viz-outline-color, var(--md-sys-color-outline-variant, #c5c7d0));
|
|
933
|
-
padding-block: var(--spacing-2, 8px);
|
|
934
|
-
padding-inline: var(--spacing-3, 12px);
|
|
935
|
-
background-color: inherit;
|
|
936
|
-
text-align: start;
|
|
937
|
-
}
|
|
938
|
-
|
|
939
|
-
.scb-viz-table thead th {
|
|
940
|
-
font-weight: var(--weight-bold, 700);
|
|
941
|
-
vertical-align: top;
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
.scb-viz-table-heading-text {
|
|
945
|
-
display: block;
|
|
946
|
-
max-inline-size: var(--scb-viz-table-header-max-width, 12rem);
|
|
947
|
-
min-inline-size: 0;
|
|
948
|
-
white-space: normal;
|
|
949
|
-
word-break: normal;
|
|
950
|
-
overflow-wrap: break-word;
|
|
951
|
-
hyphens: auto;
|
|
952
|
-
text-wrap: pretty;
|
|
953
|
-
}
|
|
954
|
-
|
|
955
|
-
.scb-viz-table tbody th {
|
|
956
|
-
font-weight: var(--weight-regular, 400);
|
|
957
|
-
white-space: normal;
|
|
958
|
-
overflow-wrap: break-word;
|
|
959
|
-
word-break: normal;
|
|
960
|
-
hyphens: auto;
|
|
961
|
-
}
|
|
962
|
-
|
|
963
|
-
.scb-viz-table tbody tr:nth-child(odd) {
|
|
964
|
-
background: var(--md-sys-color-surface-container, #f5f5f5);
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
.scb-viz-table tbody tr:nth-child(even) {
|
|
968
|
-
background: var(--md-sys-color-surface, #fff);
|
|
969
|
-
}
|
|
970
|
-
|
|
971
|
-
.scb-viz-table .align-left {
|
|
972
|
-
text-align: left;
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
.scb-viz-table .align-right {
|
|
976
|
-
text-align: right;
|
|
977
|
-
}
|
|
978
|
-
|
|
979
|
-
.scb-viz-table tbody td.align-right {
|
|
980
|
-
white-space: nowrap;
|
|
981
|
-
}
|
|
982
|
-
|
|
983
871
|
:host([data-scb-viz-fullscreen]) {
|
|
984
872
|
width: 100%;
|
|
985
873
|
height: 100%;
|
|
@@ -1029,7 +917,6 @@ import{_ as J,b as Y,g as X,h as v,m as F,o as E,r as Z,y as p}from"../../vendor
|
|
|
1029
917
|
:host([data-scb-viz-print-preview]) .standard-content-shell--stable,
|
|
1030
918
|
:host([data-scb-viz-print-preview]) .standard-content-shell--stable .standard-content-panel--active,
|
|
1031
919
|
:host([data-scb-viz-print-preview]) .standard-content-shell--stable .standard-diagram-scroller,
|
|
1032
|
-
:host([data-scb-viz-print-preview]) .standard-content-shell--stable .standard-table-scroller,
|
|
1033
920
|
:host([data-scb-viz-print-preview]) .standard-content-shell--stable .table-panel-scroll,
|
|
1034
921
|
:host([data-scb-viz-print-preview]) .standard-content-shell--stable .diagram-content,
|
|
1035
922
|
:host([data-scb-viz-print-preview]) .standard-content-shell--stable ::slotted([slot='diagram']) {
|
|
@@ -1099,7 +986,6 @@ import{_ as J,b as Y,g as X,h as v,m as F,o as E,r as Z,y as p}from"../../vendor
|
|
|
1099
986
|
.standard-content-shell--stable,
|
|
1100
987
|
.standard-content-shell--stable .standard-content-panel--active,
|
|
1101
988
|
.standard-content-shell--stable .standard-diagram-scroller,
|
|
1102
|
-
.standard-content-shell--stable .standard-table-scroller,
|
|
1103
989
|
.standard-content-shell--stable .table-panel-scroll,
|
|
1104
990
|
.standard-content-shell--stable .diagram-content,
|
|
1105
991
|
.standard-content-shell--stable ::slotted([slot='diagram']) {
|
|
@@ -1137,4 +1023,4 @@ import{_ as J,b as Y,g as X,h as v,m as F,o as E,r as Z,y as p}from"../../vendor
|
|
|
1137
1023
|
width: calc(100% / var(--scb-viz-print-scale, 1));
|
|
1138
1024
|
}
|
|
1139
1025
|
}
|
|
1140
|
-
`,A);function
|
|
1026
|
+
`,A);function E(){if(h(c,this,G).call(this),typeof ResizeObserver>"u")return;const n=this.shadowRoot?.querySelector(".diagram-content");n&&(this._diagramResizeObserver=new ResizeObserver(()=>{h(c,this,x).call(this)}),this._diagramResizeObserver.observe(this),this._diagramResizeObserver.observe(n))}function G(){this._diagramResizeObserver?.disconnect(),this._diagramResizeObserver=void 0}function q(){this._diagramReflowFrame&&(cancelAnimationFrame(this._diagramReflowFrame),this._diagramReflowFrame=0)}function x(){this.variant!=="Standard"||this.selectedChip!=="Diagram"||(h(c,this,q).call(this),this._diagramReflowFrame=requestAnimationFrame(()=>{this._diagramReflowFrame=requestAnimationFrame(()=>{this._diagramReflowFrame=0,h(c,this,At).call(this)})}))}function H(n){const t=n?.getAttribute("data-highcharts-chart");if(!t)return;const e=Number.parseInt(t,10);return Number.isNaN(e)?void 0:e}function B(n){for(const t of n){const e=h(c,this,H).call(this,t);if(e!==void 0)return e;const i=t.querySelector("[data-highcharts-chart]"),s=h(c,this,H).call(this,i);if(s!==void 0)return s}}function At(){if(this.variant!=="Standard"||this.selectedChip!=="Diagram")return;const n=this.shadowRoot?.querySelector('slot[name="diagram"]');if(!n)return;const t=n.assignedElements({flatten:!0});if(t.length===0)return;const e=h(c,this,B).call(this,t);if(e===void 0)return;const i=window.Highcharts?.charts?.[e];i&&(i.setSize?.(null,null,!1),i.reflow?.(),this._seriesDifferentiationEnabled&&h(c,this,V).call(this))}function W(){this._fullscreenDiagramSizingFrame&&(cancelAnimationFrame(this._fullscreenDiagramSizingFrame),this._fullscreenDiagramSizingFrame=0)}function L(){h(c,this,W).call(this),this._fullscreenDiagramSizingFrame=requestAnimationFrame(()=>{this._fullscreenDiagramSizingFrame=requestAnimationFrame(()=>{this._fullscreenDiagramSizingFrame=0,h(c,this,kt).call(this)})})}function kt(){const n=this._getFullscreenDiagramHeight();this._fullscreenDiagramHeight!==n&&(this._fullscreenDiagramHeight=n,h(c,this,T).call(this),h(c,this,x).call(this))}function T(){const n=this.variant==="Standard"?this._getResolvedDiagramHeight():"",t=this.variant==="Standard"&&this._getResolvedToggleHeightMode()==="stable"?this._getResolvedStandardContentHeight():"";this.variant==="Standard"?this.style.setProperty("--scb-viz-diagram-min-height",n||"600px"):this.style.removeProperty("--scb-viz-diagram-min-height"),n?(this.style.setProperty("--scb-viz-diagram-height",n),this.style.setProperty("--scb-viz-diagram-overflow","hidden")):(this.style.removeProperty("--scb-viz-diagram-height"),this.style.removeProperty("--scb-viz-diagram-overflow")),t?this.style.setProperty("--scb-viz-standard-content-height",t):this.style.removeProperty("--scb-viz-standard-content-height")}function K(){this._chartConfigSyncFrame&&(cancelAnimationFrame(this._chartConfigSyncFrame),this._chartConfigSyncFrame=0)}function R(){h(c,this,K).call(this),this._chartConfigSyncFrame=requestAnimationFrame(()=>{this._chartConfigSyncFrame=requestAnimationFrame(()=>{this._chartConfigSyncFrame=0,h(c,this,Et).call(this)})})}function Et(){const n=this._getCurrentHighchartsChart();if(!n)return;let t=!1;typeof this.timeFormat<"u"&&(this._applyTimeFormatToLiveChart(n),t=!0),typeof this.valueFormat<"u"&&(this._applyValueFormatToLiveChart(n),t=!0),typeof this.yAxisSettings<"u"&&(this._applyYAxisSettingsToLiveChart(n),t=!0),t&&n.redraw(!1)}function Ht(n){this._isHighchartsStyledMode(n)&&this._applyStyledModeSeriesDifferentiation(n)}function Rt(n){this._isHighchartsStyledMode(n)&&this._restoreStyledModeSeriesDifferentiation(n)}function V(){const n=this._getCurrentHighchartsChart();if(n){if(this._seriesDifferentiationEnabled){h(c,this,Ht).call(this,n);return}h(c,this,Rt).call(this,n)}}async function P(n){const t=this._getExportableVisualElement();if(!t)return;const e=await it(t,this._getExportSurfaceTarget(),n);e&&O(e,this._buildExportFileName(n==="jpeg"?"jpg":"png"))}function Pt(n){return dt(this._getResolvedTableView(n),t=>this._escapeHtml(t))}function Nt(){return ht({comment:this.comment,commentLabel:this.commentLabel,description:this.description,descriptionLabel:this.descriptionLabel,escapeHtml:n=>this._escapeHtml(n),footnote:this.footnote,footnoteLabel:this.footnoteLabel,moreAboutStatsLabel:this.moreAboutStatsLabel,officialStatistics:this.officialStatistics,renderRichTextHtml:n=>this._renderRichTextHtml(n),sosLogotypeSvg:j,source:this.source,sourceLabel:this.sourceLabel})}function It(n){return ct({contentHtml:n,escapeHtml:t=>this._escapeHtml(t),footerHtml:h(c,this,Nt).call(this),lang:this.lang,subtitle:this.subtitle,title:this.title})}async function Ot(){await ot(this,async()=>{const n=this._getCurrentPrintableView();let t="";if(n==="table"){const e=this._getResolvedTableData();if(!e?.rows?.length)return;t=h(c,this,Pt).call(this,e)}else if(n==="image"){const e=this.shadowRoot?.querySelector(".image-content img"),i=e?.currentSrc||e?.src||this.imageHref;if(!i)return;t=`<img class="viz-image" src="${this._escapeHtml(i)}" alt="${this._escapeHtml(this._getImageAltText())}">`}else{const e=this._getExportableVisualElement();if(!e)return;const i=await st(e,this._getExportSurfaceTarget(),"png");if(!i)return;t=`<img class="viz-chart-image" src="${i}" alt="${this._escapeHtml(this._getImageAltText())}">`}await nt(h(c,this,It).call(this,t))})}function jt(){const n=this._getResolvedTableData();n?.rows?.length&&O(et($t(n,t=>this._normalizeRenderableCell(t)),this.lang),this._buildExportFileName("csv"))}function N(){const n=h(c,this,$).call(this,this.spacing),t=h(c,this,$).call(this,this.spacingTop)??n,e=h(c,this,$).call(this,this.spacingBottom)??n,i=h(c,this,$).call(this,this.spacingLeft),s=h(c,this,$).call(this,this.spacingRight);t?this.style.setProperty("--scb-viz-spacing-block-start",t):this.style.removeProperty("--scb-viz-spacing-block-start"),e?this.style.setProperty("--scb-viz-spacing-block-end",e):this.style.removeProperty("--scb-viz-spacing-block-end"),i?this.style.setProperty("--scb-viz-spacing-inline-start",i):this.style.removeProperty("--scb-viz-spacing-inline-start"),s?this.style.setProperty("--scb-viz-spacing-inline-end",s):this.style.removeProperty("--scb-viz-spacing-inline-end")}function $(n){if(!n)return;const t=String(n).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}function I(){const n=this.containerMaxWidth?.trim();n?this.style.setProperty("--scb-viz-container-max-width",n):this.style.removeProperty("--scb-viz-container-max-width")}m([b({type:String,reflect:!0})],g.prototype,"variant",void 0);m([b({type:String,reflect:!0,attribute:"selected-chip"})],g.prototype,"selectedChip",void 0);m([b({type:String,reflect:!0})],g.prototype,"title",void 0);m([b({type:String,reflect:!0})],g.prototype,"subtitle",void 0);m([b({type:String,reflect:!0})],g.prototype,"description",void 0);m([b({type:String,reflect:!0})],g.prototype,"comment",void 0);m([b({type:String,reflect:!0})],g.prototype,"source",void 0);m([b({type:String,reflect:!0})],g.prototype,"footnote",void 0);m([b({type:String,reflect:!0,attribute:"lang"})],g.prototype,"lang",void 0);m([b({type:String,reflect:!0,attribute:"image-href"})],g.prototype,"imageHref",void 0);m([b({type:Boolean,reflect:!0,attribute:"official-statistics"})],g.prototype,"officialStatistics",void 0);m([b({type:Boolean,reflect:!0,attribute:"disable-toggle"})],g.prototype,"disableToggle",void 0);m([b({type:String,attribute:"content-max-width"})],g.prototype,"contentMaxWidth",void 0);m([b({type:String,attribute:"container-max-width"})],g.prototype,"containerMaxWidth",void 0);m([b({type:String,attribute:"content-height"})],g.prototype,"contentHeight",void 0);m([b({type:String,reflect:!0,attribute:"toggle-height-mode"})],g.prototype,"toggleHeightMode",void 0);m([b({attribute:!1})],g.prototype,"tableData",void 0);m([b({attribute:!1})],g.prototype,"valueFormat",void 0);m([b({attribute:!1})],g.prototype,"timeFormat",void 0);m([b({attribute:!1})],g.prototype,"yAxisSettings",void 0);m([F()],g.prototype,"_slottedTableData",void 0);m([F()],g.prototype,"_actionsMenuOpen",void 0);m([F()],g.prototype,"_seriesDifferentiationEnabled",void 0);m([F()],g.prototype,"_isFullscreen",void 0);m([b({type:String,reflect:!0})],g.prototype,"spacing",void 0);m([b({type:String,attribute:"spacing-top",reflect:!0})],g.prototype,"spacingTop",void 0);m([b({type:String,attribute:"spacing-bottom",reflect:!0})],g.prototype,"spacingBottom",void 0);m([b({type:String,attribute:"spacing-left",reflect:!0})],g.prototype,"spacingLeft",void 0);m([b({type:String,attribute:"spacing-right",reflect:!0})],g.prototype,"spacingRight",void 0);g=m([Y("scb-viz")],g);
|