import{r as t,h as a,a as e,g as r}from"./p-c18ee3cd.js";import{c}from"./p-c608c6dc.js";import{s}from"./p-bf956c1d.js";const i=class{constructor(a){t(this,a),this.readData=t=>{try{return Array.isArray(JSON.parse(t))?JSON.parse(t):[]}catch(a){return Array.isArray(t)?t:[]}}}getOpacity(t,a){return JSON.stringify(0===a?1:+t.percentage/100)}getCardStyle(){return"\n      .card:after {\n          content: '';\n          display: block;\n          background: linear-gradient(0deg, white, rgba(255,255,255, 0));\n          height: 2rem;\n          margin-top: -2rem;\n          position: relative;\n        }\n\n      .card__body: {\n        padding-bottom: 0 !important;\n      }\n  "}connectedCallback(){s({source:this.hostElement,type:"warn"})}render(){return a(e,null,a("div",{class:this.getCssClassMap()},a("scale-card",{styles:this.getCardStyle()},a("div",{class:"header"},this.heading),a("div",{class:"bar"},this.readData(this.data).sort(((t,a)=>a.percentage-t.percentage)).map(((t,e)=>{if(+t.percentage>0)return a("div",{class:"bar__item",style:{opacity:this.getOpacity(t,e),flex:JSON.stringify(+t.percentage)}})}))),a("div",{class:"legend"},this.readData(this.data).sort(((t,a)=>a.percentage-t.percentage)).map(((t,e)=>a("div",{class:"legend__row"},a("div",{class:"legend__row__item"},a("div",{class:"legend__item",style:{opacity:this.getOpacity(t,e)}}),a("div",{class:"legend__label spacer"},t.type)),a("div",{class:"legend__row__item"},a("div",{class:"spacer"},t.value),a("div",{class:"spacer"},t.percentage,"%")))))))))}getCssClassMap(){return c("chart-stack-card")}get hostElement(){return r(this)}};i.style=":host{--scl-chart-stack-card-color:var(--telekom-color-blue-600)}.chart-stack-card{color:var(--color-text);--scl-chart-stack-card-color:var(--telekom-color-blue-600)}.chart-stack-card .header{height:var(--telekom-spacing-unit-x6);font-size:var(--telekom-typography-font-size-headline-3);font-weight:var(--telekom-typography-font-weight-extra-bold);line-height:var(--telekom-typography-line-spacing-tight);margin-bottom:var(--telekom-spacing-unit-x6)}.chart-stack-card .bar{display:flex;justify-content:space-between;margin-bottom:var(--telekom-spacing-unit-x4)}.chart-stack-card .bar__item{background-color:var(--scl-chart-stack-card-color);height:var(--telekom-spacing-unit-x8);flex:1}.chart-stack-card .bar__item:first-of-type{border-top-left-radius:var(--telekom-radius-small);border-bottom-left-radius:var(--telekom-radius-small)}.chart-stack-card .bar__item:last-of-type{border-top-right-radius:var(--telekom-radius-small);border-bottom-right-radius:var(--telekom-radius-small)}.chart-stack-card .legend{display:flex;flex-direction:column;height:calc(var(--telekom-spacing-unit-x4) * 10)}.chart-stack-card .spacer{padding:0 var(--telekom-spacing-unit-x2)}.chart-stack-card .legend .legend__row__item{display:flex;line-height:var(--telekom-typography-line-spacing-standard)}.chart-stack-card .legend .legend__row{display:flex;justify-content:space-between}.chart-stack-card .legend .legend__row:last-child{padding-bottom:var(--telekom-spacing-unit-x8)}.chart-stack-card .legend .legend__item{height:10px;width:10px;background-color:var(--scl-chart-stack-card-color);border-radius:100%;align-self:center;margin-right:var(--telekom-spacing-unit-x1)}.chart-stack-card .legend .legend__label{font-weight:var(--type-weight-bold);font-size:var(--telekom-spacing-unit-x4);line-height:200%}";export{i as scale_chart_stack_card}