PageSourceSearch

https://interactive.houseoffinance.se/_next/static/chunks/498-332c7b285f0e0791.js

js houseoffinance.se collected 2026-10-01 14:54:23 UTC 86,259 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[498],{74642:function(e,t,i){i.d(t,{n:function(){return m}});var n=i(34287);i(70040);var r=i(62260),s=i(72087),l=i(65257),a=i(80534),o=i(51879),d=i(9126),c=i(38601),u=i(81958);let h=[{label:"SOM-institutets startsida",href:"http://www.gu.se/som-institutet"},{label:"Resultat och publikationer",href:"https://www.gu.se/som-institutet/resultat-och-publikationer"},{label:"G\xf6teborgs universitets startsida",href:"http://www.gu.se/"},{label:"Arbeta med data fr\xe5n SOM-unders\xf6kningen",href:"/dataanalys"},{label:"S\xf6k bland SOM-institutets publikationer",href:"/publikationssok"},{label:"Best\xe4ll dataset fr\xe5n SOM-unders\xf6kningen",href:"http://www.snd.gu.se/"}],m=()=>(0,n.jsx)(l.Ug,{width:"100%",justifyContent:"center",py:["sm","md"],bg:r.O9.darkBlue,color:"white",children:(0,n.jsxs)(l.Kq,{direction:["column","row"],w:"100%",maxW:"1200px",justifyContent:"space-between",alignItems:"flex-start",px:["md","md",null,null],py:["lg"],gap:["md","md","2xl"],children:[(0,n.jsxs)(l.Kq,{direction:["row","column","column"],gap:"md",w:["80%","auto","auto"],justifyContent:"space-between",children:[(0,n.jsx)(a.r,{href:"https://www.gu.se/",target:"_blank",children:(0,n.jsx)(o.E,{src:"/images/custom-blocks/som/gu-logo.svg",alt:"logo",width:"127",height:"101"})}),(0,n.jsx)(a.r,{href:"https://www.gu.se/en/som-institute",target:"_blank",children:(0,n.jsx)(o.E,{src:"/images/custom-blocks/som/som-logo-square.svg",alt:"logo",width:"126",height:"87"})}),(0,n.jsx)(l.xu,{display:["none","inline","none"],children:(0,n.jsx)(s.J,{white:!0})})]}),(0,n.jsxs)(d.r,{templateColumns:["repeat(1, 1fr)","repeat(2, 1fr)","repeat(2, 1fr)","repeat(2, 1fr)"],gap:["md","lg",null],px:"0",color:"white",wrap:"wrap",w:"100%",children:[(0,n.jsxs)(l.gC,{gap:"md",alignItems:"flex-start",children:[(0,n.jsxs)(l.xu,{children:[(0,n.jsx)(c.h_,{fontWeight:"900",fontSize:"md",lineHeight:"24px",letterSpacing:"1px",children:"Kontakt"}),(0,n.jsxs)(l.gC,{alignItems:"flex-start",gap:"sm",mt:"xs",children:[(0,n.jsxs)(c.xv,{fontWeight:"400",fontSize:["sm","md"],children:["Telefon",(0,n.jsx)("br",{}),"031 786 3300"]}),(0,n.jsxs)(c.xv,{fontWeight:"400",fontSize:["sm","md"],children:["E-post",(0,n.jsx)("br",{}),"[email protected]"]})]})]}),(0,n.jsxs)(l.xu,{children:[(0,n.jsx)(c.h_,{fontWeight:"900",fontSize:"md",lineHeight:"24px",letterSpacing:"1px",children:"Sociala medier"}),(0,n.jsxs)(l.Ug,{mt:"xs",spacing:"sm",children:[(0,n.jsx)(a.r,{href:"https://twitter.com/sominstitutet?lang=en",_hover:{transform:"translateY(-2px)"},isExternal:!0,children:(0,n.jsx)(u.nv_,{w:"24px",h:"24px",color:"white"})}),(0,n.jsx)(a.r,{href:"https://www.facebook.com/SOMinstitutet/",_hover:{transform:"translateY(-2px)"},isExternal:!0,children:(0,n.jsx)(u.VqK,{w:"24px",h:"24px",color:"white"})}),(0,n.jsx)(a.r,{href:"https://www.linkedin.com/company/som-institutet",_hover:{transform:"translateY(-2px)"},isExternal:!0,children:(0,n.jsx)(u.nIU,{w:"24px",h:"24px",color:"white"})})]})]})]}),(0,n.jsxs)(l.gC,{gap:"md",justifyContent:"space-between",alignItems:"flex-start",children:[(0,n.jsxs)(l.xu,{children:[(0,n.jsx)(c.h_,{fontWeight:"900",fontSize:"md",lineHeight:"24px",letterSpacing:"1px",children:"Bes\xf6ksadress"}),(0,n.jsxs)(c.xv,{fontWeight:"400",fontSize:["sm","md"],mt:"xs",children:["Seminariegatan 1B ",(0,n.jsx)("br",{}),"413 13 G\xf6teborg"]})]}),(0,n.jsxs)(l.xu,{children:[(0,n.jsx)(c.h_,{fontWeight:"900",fontSize:"md",lineHeight:"24px",letterSpacing:"1px",children:"Postadress"}),(0,n.jsxs)(c.xv,{fontWeight:"400",fontSize:["sm","md"],children:["SOM-institutet",(0,n.jsx)("br",{}),"G\xf6teborgs universitet",(0,n.jsx)("br",{}),"Box 710 ",(0,n.jsx)("br",{})," 405 30 G\xf6teborg"]})]})]}),(0,n.jsxs)(l.gC,{gridColumn:["1","1 / -1","1 / -1","none"],justifyContent:"space-between",alignItems:"flex-start",children:[(0,n.jsxs)(l.gC,{alignItems:"flex-start",children:[(0,n.jsx)(c.h_,{fontWeight:"900",fontSize:"md",lineHeight:"24px",letterSpacing:"1px",children:"Genv\xe4gar"}),(0,n.jsx)(l.QI,{listStyleType:"none",children:h.map(e=>(0,n.jsx)(l.HC,{children:(0,n.jsx)(a.r,{href:e.href,target:"_blank",children:(0,n.jsxs)(c.xv,{fontWeight:"400",fontSize:["sm","md"],color:"white",as:"span",children:[e.label,(0,n.jsx)(u.Pfi,{w:"12px",h:"12px",ml:"1",transform:"translateY(-1px)"})]})})},e.href))})]}),(0,n.jsx)(l.xu,{display:["none","none","inline"],children:(0,n.jsx)(s.J,{white:!0})})]}),(0,n.jsx)(l.xu,{display:["inline","none","none"],children:(0,n.jsx)(s.J,{white:!0})})]})]})})},25689:function(e,t,i){i.d(t,{H:function(){return p}});var n=i(34287),r=i(70040),s=i(41227),l=i(69570),a=i.n(l),o=i(80534),d=i(85713),c=i(81958),u=i(65257),h=i(51879),m=i(1948);let g=a()(()=>i.e(9719).then(i.bind(i,39719)).then(e=>e.ReadSpeaker),{loadableGenerated:{webpack:()=>[39719]},ssr:!1}),x=()=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(g,{}),(0,n.jsx)(o.r,{href:"https://www.gu.se/som-institutet",isExternal:!0,children:(0,n.jsx)(d.zx,{rightIcon:(0,n.jsx)(c.Pfi,{}),colorScheme:"red",children:"SOM Startsida"})})]}),p=()=>{let[e,t]=(0,r.useState)(!1);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(s.xB,{styles:{".rsbtn.mega_toggle.rsexpanded":{minWidth:"285px !important"},".rsbtn.mega_toggle .rsbtn_tooltoggle":{display:"none !important"},".rsbtn.mega_toggle.rsexpanded .rsbtn_tooltoggle":{display:"block !important"},".rsbtn_play":{border:"none !important",background:"none !important",height:"auto !important"},".rsbtn.mega_toggle.rsexpanded .rsbtn_play":{display:"block !important",paddingLeft:"22px !important",height:"28px !important"},".rsbtn.mega_toggle.rsexpanded .custom-readspeaker-button":{display:"none !important"},".rsbtn_play span":{background:"none !important",fontFamily:"inherit !important",fontSize:"14px !important",fontWeight:"600 !important"}}}),(0,n.jsx)(u.Ug,{width:"100%",justifyContent:"center",pt:["sm"],bg:"gray.50",top:"0",zIndex:"99",left:"0",children:(0,n.jsxs)(u.Ug,{width:"100%",maxW:"1440px",justifyContent:"space-between",px:["sm","md"],position:"relative",children:[(0,n.jsx)(u.xu,{maxW:["141px","294px"],children:(0,n.jsx)(h.E,{src:"/images/custom-blocks/som/som-log-rectangle.svg",alt:"SOM-institutet",width:294,height:56})}),(0,n.jsx)(u.Ug,{justifyContent:"center",alignItems:"center",alignContent:"center",gap:"0",display:["none",null,"flex"],children:(0,n.jsx)(x,{})}),(0,n.jsx)(u.Ug,{justifyContent:"center",alignItems:"center",gap:"0",display:["inline",null,"none"],"aria-hidden":"true",className:"rs_skip",children:(0,n.jsx)(d.zx,{leftIcon:e?(0,n.jsx)(c.HQX,{}):(0,n.jsx)(c.Oqj,{}),variant:"ghost",onClick:()=>t(!e),_focus:{bg:"white"},_active:{bg:"white"},children:"Meny"})}),(0,n.jsx)(u.xu,{sx:{margin:"0 !important"},position:"absolute",left:"0",top:"56px",bg:"white",w:"100%",className:"rs_skip","aria-hidden":"true",children:(0,n.jsx)(m.UO,{in:e,children:(0,n.jsx)(u.Ug,{alignItems:"center",justifyContent:"space-between",p:"sm",px:"md",children:(0,n.jsx)(x,{})})})})]})})]})}},20498:function(e,t,i){i.d(t,{s:function(){return e$}});var n=i(34287),r=i(83865),s=i.n(r),l=i(74642),a=i(25689),o=i(70040),d=i(8842),c=i(18248),u=i.n(c),h=i(62260),m=i(48634),g=i(31922),x=i(
155800),p=i(59577),f=i(24128),v=i(87683),b=i(31973),w=i(66052),j=i(61938),y=i(77486);i(60748);var C=i(37679);let k=(e,t)=>"year"===t?e.getFullYear():e.getTime(),D=(e,t)=>new Date(Date.UTC(e,0,1)),S=(e,t)=>({type:"group",left:0,bottom:0,children:[{type:"text",style:{text:Array.isArray(e)?e.join("\n"):e,width:t,overflow:"break",lineHeight:16,fill:"#222",opacity:.7}}]}),F=(e,t,i)=>{let[n,r]=(0,o.useState)(0);return(0,o.useEffect)(()=>{if(e.current&&t.footer){var i,n,s,l;let t=null===(s=e.current.getEchartsInstance().getOption())||void 0===s?void 0:null===(n=s.graphic)||void 0===n?void 0:null===(i=n[0])||void 0===i?void 0:i.elements;if(t&&2===t.length){let e=null===(l=t[1])||void 0===l?void 0:l.style;r(new C.ZP({style:e}).getBoundingRect().height)}}},[e,t.footer,i]),n};w.D([f.N,v.N,p.N,b.N,y.N]);let A={grid:{left:40,right:8,top:8,bottom:70,containLabel:!1},tooltip:{trigger:"axis",axisPointer:{type:"shadow"}},yAxis:{axisLabel:{overflow:"break",interval:0,margin:12}},xAxis:{axisLabel:{overflow:"break"}}},_=(e,t)=>(0,m.Dq)((0,n.jsxs)("div",{style:{maxWidth:300,minWidth:200,whiteSpace:"normal"},children:[(0,n.jsx)("div",{style:{marginBottom:4,fontWeight:"bold"},children:e[0].axisValueLabel}),e.map((e,i)=>(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,n.jsx)("div",{style:{height:12,width:12,background:e.color,borderRadius:6}}),t.y.format?t.y.format(e.value):e.value]},"series_".concat(i)))]})),M=e=>{var t,i,n,r,s,l,a,o,d,c,u;let h;let{configuration:m,width:g,footerHeight:x=0,latestData:p}=e,f=m.seriesOrder?m.seriesOrder:m.series?Object.keys(m.series):[],v=Array.from(new Set(p.map(e=>String(e[m.split]))));if(v.length>0&&f.length>0){let e=new Set(v);h=f.filter(t=>e.has(t))}else h=v.length>0?v:f;let b=p.reduce((e,t)=>{let i=String(t[m.split]),n=Number(t[m.y.accessor]);return e[i]=Number.isFinite(n)?n:0,e},{}),w=h.map(e=>{var t,i,n,r;return{name:(null===(i=m.series)||void 0===i?void 0:null===(t=i[e])||void 0===t?void 0:t.name)||e,value:null!==(r=b[e])&&void 0!==r?r:0,itemStyle:{color:m.series?null===(n=m.series[e])||void 0===n?void 0:n.color:void 0}}}),j=(null==m?void 0:null===(t=m.barchart)||void 0===t?void 0:t.orientation)==="vertical",y=j?23:30,C=Math.max(...w.map(e=>e.name.length))>15;function k(e){return t=>t.length<=e?t:t.slice(0,e-3)+"..."}return{...A,graphic:m.footer?[S(m.footer,g)]:[],grid:{...A.grid,left:j?C?130:100:A.grid.left,bottom:j?24+(x?x+12:0):A.grid.bottom+(x?x+12:0),right:j?32:A.grid.right},yAxis:{axisLabel:{...null!==(o=null==A?void 0:null===(i=A.yAxis)||void 0===i?void 0:i.axisLabel)&&void 0!==o?o:{},formatter:j?k(y):null===(n=m.y)||void 0===n?void 0:n.format,width:j?C?122:92:65},type:j?"category":"value",data:j?w.map(e=>e.name):void 0,min:null===(r=m.y.domain)||void 0===r?void 0:r[0],max:null===(s=m.y.domain)||void 0===s?void 0:s[1]},xAxis:{...null!==(d=null==A?void 0:A.xAxis)&&void 0!==d?d:{},axisLabel:{...null!==(c=null==A?void 0:null===(l=A.xAxis)||void 0===l?void 0:l.axisLabel)&&void 0!==c?c:{},formatter:j?null===(a=m.y)||void 0===a?void 0:a.format:k(y),rotate:j?0:45,width:j?C?130:100:65,margin:j?8:16},type:j?"value":"category",data:j?void 0:w.map(e=>e.name)},tooltip:{...null!==(u=null==A?void 0:A.tooltip)&&void 0!==u?u:{},formatter:e=>_(e,m)},series:[{type:"bar",data:w,universalTransition:!0,animationDurationUpdate:400,animationEasingUpdate:"cubicOut",emphasis:{focus:"series"}}],animation:m.animation}},I=e=>{let{data:t,configuration:i,width:r}=e,s=(0,o.useRef)(null),l=F(s,i,r),a=(0,o.useMemo)(()=>{if(!t.length)return[];let e=Math.max(...t.map(e=>Number(e[i.x.accessor])));return t.filter(t=>Number(t[i.x.accessor])===e)},[t,i.x.accessor]),d=(0,o.useMemo)(()=>M({configuration:i,width:r,footerHeight:l,latestData:a}),[a,i,r,l]);return(0,n.jsx)(x.Z,{ref:s,echarts:j,option:d,notMerge:!1,lazyUpdate:!0,opts:{renderer:"canvas"},style:{height:"100%",width:"100%",zIndex:"0"}})},z=e=>(0,n.jsx)(g.Z,{style:{height:"100%",display:"flex"},children:t=>0===t.height&&0===t.width?null:(0,n.jsx)(I,{...e,width:t.width})});var T=i(59499),L=i(14313),N=i(57289),E=i(65257);function Q(){let e=(0,T._)(["\n  ","\n\n  thead {\n    position: sticky;\n    top: 0;\n    background-color: white;\n    z-index: 1;\n  }\n\n  thead th {\n    padding: 10px !important;\n    font-weight: 600;\n  }\n\n  td,\n  th {\n    white-space: nowrap;\n  }\n\n  .ant-table-body {\n    overflow-x: scroll !important;\n  }\n"]);return Q=function(){return e},e}let B=(0,L.Z)(N.i)(Q(),e=>{let{rowOddColor:t}=e;return t&&" .dt-row-odd {\n          background: ".concat(t,";\n      }\n\n      td.ant-table-column-sort {\n        background: none;\n      }\n    ")}),O=e=>{var t,i;let{data:r,configuration:s}=e,l=null===(t=s.table)||void 0===t?void 0:t.style,a=null===(i=s.table)||void 0===i?void 0:i.columns;return a?(0,n.jsxs)(E.xu,{flexDirection:"column",display:"flex",width:"100%",children:[(0,n.jsx)(E.xu,{flexGrow:1,overflow:"auto",children:(0,n.jsx)(B,{tableLayout:"auto",rowClassName:(e,t)=>
1t%2==0?"dt-row-even":"dt-row-odd",style:{width:"100%"},rowOddColor:null==l?void 0:l.rowOddBG,dataSource:r,columns:a,pagination:!1,size:"small"})}),s.footer&&(0,n.jsx)(E.xu,{fontWeight:400,fontFamily:"sans-serif",color:"rgba(0,0,0,0.7)",marginTop:3,fontSize:12,lineHeight:"16px",children:Array.isArray(s.footer)?s.footer.map((e,t)=>(0,n.jsx)(E.xu,{children:e},t)):s.footer})]}):(0,n.jsx)("div",{children:"Missing column settings"})};var q=i(50760),U=i(62750),R=i(75593),W=i(21652),V=i(14923),H=i(75412);w.D([V.N,f.N,v.N,R.N,b.N,y.N,W.N]);let Z=(e,t,i,n,r)=>[...Object.entries(t).map(t=>{var s,l,a,o;let[d,c]=t,u=new Map;c.forEach(t=>{let i=t[e.x.accessor],n=r.length>0&&"number"==typeof r[0],s=(()=>{if(n){if(i instanceof Date)return i.getUTCFullYear();let e=Number(i);return Number.isFinite(e)?e:new Date(i).getUTCFullYear()}return i instanceof Date?new Date(i).toISOString():String(i)})();u.set(s,t[e.y.accessor])});let h=r.map(e=>{var t;return null!==(t=u.get(e))&&void 0!==t?t:null}),m=[],g=[],x=[],p=null;h.forEach((e,t)=>{if(null!==e){let i=[t,e];p&&0===x.length&&g.push([p[0],p[1],i[0],i[1]]),x.push(i),p=i}else x.length>0&&(m.push([...x]),x=[])}),x.length>0&&m.push(x);let f={itemStyle:{color:null===(l=e.series)||void 0===l?void 0:null===(s=l[d])||void 0===s?void 0:s.color},avoidLabelOverlap:!0,labelLayout:e=>({...e,dx:5,moveOverlap:"shiftY"})},v={padding:[100,0],minMargin:6,distance:12,show:!0,width:(i?130:n.grid.right)-16,overflow:"break",fontWeight:"bold",color:(null===(o=e.series)||void 0===o?void 0:null===(a=o[d])||void 0===a?void 0:a.color)||"#242731",formatter:t=>{var i,n;return(null===(n=e.series)||void 0===n?void 0:null===(i=n[t.seriesName])||void 0===i?void 0:i.name)||t.seriesName}},b=[];return m.forEach((e,t)=>{let i=t===m.length-1;b.push({name:d,type:"line",data:e,lineStyle:{width:3,opacity:.8,type:"solid"},symbolSize:6,...f,endLabel:i?v:{show:!1},legendHoverLink:0===t})}),g.forEach(e=>{let[t,i,n,r]=e;b.push({name:d,type:"line",data:[[t,i],[n,r]],lineStyle:{width:3,opacity:.5,type:[5,5]},...f,endLabel:{show:!1},legendHoverLink:!1,symbol:"none",tooltip:{show:!1}})}),b}).flat()],Y=(e,t)=>{let i=e=>{let t=e.value;return Array.isArray(t)?Number(t[1]):Number(t)};return e.sort((e,t)=>{let n=i(e),r=i(t);return(Number.isFinite(r)?r:-1/0)-(Number.isFinite(n)?n:-1/0)}),(0,m.Dq)((0,n.jsxs)("div",{style:{maxWidth:300,minWidth:200,whiteSpace:"normal"},children:[(0,n.jsx)("div",{style:{marginBottom:8,fontWeight:"bold",fontSize:14},children:t.x.format?t.x.format(e[0].axisValueLabel):e[0].axisValueLabel}),(0,n.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:e.map((e,r)=>{var s,l;return(0,n.jsxs)("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:10,fontSize:12,lineHeight:1.21},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:4},children:[(0,n.jsx)("div",{style:{height:12,width:12,background:e.color,borderRadius:6,position:"relative",top:2}}),(null===(l=t.series)||void 0===l?void 0:null===(s=l[e.seriesName])||void 0===s?void 0:s.name)||e.seriesName]}),(()=>{let n=i(e);return Number.isFinite(n)?t.y.format?t.y.format(n):n:"—"})()]},r)})})]}))},G=(e,t,i,n)=>{var r,s,l,a;let o;let d=null===(r=i.y.domain)||void 0===r?void 0:r[0],c=null===(s=i.y.domain)||void 0===s?void 0:s[1];if(void 0!==d&&void 0!==c){let e=c-d;e>0&&e<=10?o=1:e>10&&e<=50?o=5:e>50&&(o=10)}return{aria:{show:!0},graphic:i.footer?[S(i.footer,t)]:[],grid:{left:8,right:n?130:105,top:18,bottom:e?e+12:0,containLabel:!0},xAxis:{type:"temporal"===i.x.scale||"categorical"===i.x.scale?"category":"value",axisLabel:{formatter:null===(l=i.x)||void 0===l?void 0:l.format},axisTick:{alignWithLabel:!0},boundaryGap:!1},yAxis:{type:"value",min:d,max:c,minInterval:o,axisLabel:{formatter:null===(a=i.y)||void 0===a?void 0:a.format}}}},P=e=>{let t;let{configuration:i,data:n,width:r,footerHeight:s=0,isMobile:l=!1}=e,a=(0,q.Z)(e=>e[i.split],n),o=((0,U.Z)(Object.keys(a).map(e=>e.length))||0)>19,d=G(s,r,i,o),c=l?{...d.xAxis,axisLabel:{...d.xAxis.axisLabel,rotate:45,margin:12}}:d.xAxis,u=n.map(e=>e[i.x.accessor]).filter(e=>null!=e),h=u.map(e=>{if(e instanceof Date)return e.getUTCFullYear();if("number"==typeof e){if(e>=1e3&&e<=3e3)return e;let t=new Date(e).getUTCFullYear();return Number.isFinite(t)?t:null}let t=Number(e);if(Number.isFinite(t)&&t>=1e3&&t<=3e3)return t;let i=new Date(e).getUTCFullYear();return Number.isFinite(i)?i:null}).filter(e=>null!==e);if(h.length>0){let e=Math.min(...h),i=Math.max(...h)-e+1;t=Number.isFinite(i)&&i>0&&i<5e3?Array.from({length:i},(t,i)=>e+i):Array.from(new Set(h)).sort((e,t)=>
1e-t)}else t=Array.from(new Set(u.map(e=>String(e))));let m=Z(i,a,o,d,t),g=Math.max(1,Math.ceil(t.length/(l?4:8)));return{...d,series:m,xAxis:{...c,axisLabel:{...c.axisLabel,hideOverlap:!0,interval:e=>e%g==0},axisTick:c.axisTick,boundaryGap:!1,data:t,dataZoom:[]},tooltip:{trigger:"axis",confine:!0,formatter:e=>Y(e,i)},animation:i.animation}},K=e=>(0,n.jsx)(g.Z,{style:{height:"100%",display:"flex"},children:t=>t.width?(0,n.jsx)($,{...e,width:t.width}):null}),$=e=>{let{data:t,configuration:i,width:r}=e,s=(0,o.useRef)(null),[l]=(0,H.ac)("(max-width: 500px)"),a=F(s,i,r),d=(0,o.useMemo)(()=>P({configuration:i,data:t,width:r,footerHeight:a,isMobile:l}),[t,r,l,a,i]);return(0,n.jsx)(E.xu,{flexGrow:1,display:"flex",overflow:"hidden",children:(0,n.jsx)(x.Z,{ref:s,echarts:j,option:d,notMerge:!0,lazyUpdate:!0,style:{height:"100%",width:r},opts:{renderer:"canvas"}})})};var J=i(74598);function X(){let e=(0,T._)(["\n  .ant-slider-handle {\n    &:hover:after,\n    &:active:after,\n    &:focus:after {\n      inset: 0;\n    }\n\n    &:after {\n      box-shadow: none !important;\n      outline: none !important;\n      box-sizing: content-box;\n      background: ",";\n      border: 2px solid #fff;\n      height: 16px !important;\n      width: 16px !important;\n      transform: translate(-25%, calc(-25% - 1px)) !important;\n      box-shadow: none !important;\n      inset: 0;\n    }\n  }\n"]);return X=function(){return e},e}function ee(){let e=(0,T._)(["\n  border-color: ",";\n  border-width: 1px;\n  border-radius: 4px;\n  padding: 4px;\n  height: calc(1.5em + 8px);\n  width: 56px;\n  min-width: 56px;\n  text-align: center;\n  user-select: none;\n"]);return ee=function(){return e},e}let et=(0,L.Z)(J.Z)(X(),e=>{let{handleColor:t}=e;return null!=t?t:"#222"}),ei=(0,L.Z)(E.xu,{shouldForwardProp:e=>"boxBorderColor"!==e})(ee(),e=>{let{boxBorderColor:t}=e;return null!=t?t:"#222"}),en=e=>{let{extent:t,value:i,onChange:r,color:s,boxBorderColor:l,interval:a="year",type:d="range",marks:c,step:u}=e,[h,m]=(0,o.useState)(i||t),[g,x]=(0,o.useState)(null),p=(0,o.useMemo)(()=>{if(!c)return;if("point"!==d)return c;let e=Object.keys(c).map(e=>Number(e)).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t);if(e.length<=8)return c;let t=new Set;for(let i=0;i<8;i++){let n=Math.round(i*(e.length-1)/7);t.add(n)}let i={};return e.forEach((e,n)=>{var r;let s=c[e],l="object"==typeof s&&s?null!==(r=s.label)&&void 0!==r?r:"":s;i[e]=t.has(n)?{label:String(l)}:{label:String(l),style:{visibility:"hidden"}}}),i},[c,d]);(0,o.useEffect)(()=>{m(i||t),x(null)},[t,i,d]),(0,o.useEffect)(()=>{let[e,n]=t,[r,s]=h;(r<e||s>n||r>n||s<e)&&m(i||t)},[t,h,i]);let f=k(t[0],a),v=k(t[1],a);return(0,n.jsxs)(E.kC,{gap:4,children:["range"===d&&(0,n.jsx)(ei,{boxBorderColor:l,children:k(h[0],a)}),"range"===d&&(0,n.jsx)(et,{range:!0,"aria-labelledby":"time-filter","aria-valuemin":f,"aria-valuemax":v,"aria-valuenow":"".concat(k(h[0],a)," to ").concat(k(h[1],a)),"aria-orientation":"horizontal",value:(Array.isArray(g)?g:null)||[k(h[0],a),k(h[1],a)],min:k(t[0],a),max:k(t[1],a),step:null===u?null:null!=u?u:1,style:{width:"100%",marginLeft:-1},marks:p,onChange:e=>{x(e)},onAfterChange:e=>{x(null);let t=[D(e[0],a),D(e[1],a)];m(t),r(t)},styles:{track:{backgroundColor:null!=s?s:"#222",height:"2px"},rail:{height:"2px"}},tooltip:{formatter:e=>null==e?void 0:e.toString(),placement:"top",autoAdjustOverflow:!1},handleColor:s},"".concat(k(t[0],a),"-").concat(k(t[1],a))),"point"===d&&(0,n.jsx)(et,{"aria-labelledby":"time-filter","aria-valuemin":f,"aria-valuemax":v,"aria-valuenow":k(h[1],a),"aria-orientation":"horizontal",value:("number"==typeof g?g:null)||k(h[1],a),min:k(t[0],a),max:k(t[1],a),step:null===u?null:null!=u?u:1,style:{width:"100%",marginLeft:-1},marks:p,onChange:e=>{x(e)},onAfterChange:e=>{x(null);let t=[D(e,a),D(e,a)];m(t),r(t)},styles:{track:{backgroundColor:null!=s?s:"#222",height:"2px"},rail:{height:"2px",backgroundColor:null!=s?s:"#222"}},tooltip:{formatter:e=>null==e?void 0:e.toString(),placement:"top",autoAdjustOverflow:!1},handleColor:s},"".concat(k(t[0],a),"-").concat(k(t[1],a))),(0,n.jsx)(ei,{boxBorderColor:l,children:k(h[1],a)})]})};var er=i(38601),es=i(22616);let el=e=>{var t;
1let{configuration:i,styling:r,chartImageDataCb:s,onTimeFilterChange:l,loading:a}=e,{data:d,chartType:c,header:u,subheader:h}=null!=i?i:{},[m,g]=(0,o.useState)(),[x,p]=(0,o.useState)(),[f,v]=(0,o.useState)(!1),b=o.useMemo(()=>{var e;return(i.availableYears&&i.availableYears.length>0?i.availableYears:Array.from(new Set((null!==(e=null==i?void 0:i.data)&&void 0!==e?e:[]).map(e=>e[i.x.accessor]).map(e=>"number"==typeof e?e:"string"==typeof e?Number(e):new Date(e).getUTCFullYear()).filter(e=>!Number.isNaN(e)))).sort((e,t)=>e-t)).reduce((e,t)=>(e[t]=String(t),e),{})},[i.availableYears,i.data,i.x.accessor]);(0,o.useEffect)(()=>{if(null==d?void 0:d.length){let e,t;if(i.timeExtent)e=i.timeExtent;else{let t=d.map(e=>e[i.x.accessor]).map(e=>"number"==typeof e?e:"string"==typeof e?Number(e):new Date(e).getUTCFullYear()).filter(e=>!Number.isNaN(e));e=[new Date(Date.UTC(Math.min(...t),0,1)),new Date(Date.UTC(Math.max(...t),0,1))]}p(e),t=i.currentTimeSelection?i.currentTimeSelection:"bar"===c?[e[1],e[1]]:[e[0],e[1]],v(!1),g(t)}},[d,null==d?void 0:d.length,null==i?void 0:i.x.accessor,null==i?void 0:i.timeExtent,null==i?void 0:i.currentTimeSelection,c]),(0,o.useEffect)(()=>{if(l&&m&&f){let e=e=>String(e.getUTCFullYear()),t=e(m[0]),i=e(m[1]);t===i?l([i]):l([t,i])}},[m,l,f]);let w=e=>{v(!0),g(e)};return(0,n.jsxs)(E.kC,{flexDir:"column",gap:4,height:"100%",flexGrow:"1",alignItems:"stretch","min-width":"0",position:"relative",children:[(0,n.jsxs)(E.xu,{children:[(0,n.jsx)(er.X6,{as:"h1",style:{color:null==r?void 0:r.color,fontFamily:null==r?void 0:r.fontFamily,fontSize:22,fontWeight:700,margin:0,lineHeight:"30px"},children:u}),h&&(0,n.jsx)(E.xu,{children:(0,n.jsx)(er.xv,{style:{color:null==r?void 0:r.color,fontFamily:null==r?void 0:r.fontFamily,fontSize:16,fontWeight:400,lineHeight:"20px"},children:h})})]}),a&&(0,n.jsx)(E.xu,{position:"absolute",top:"0",left:"0",right:"0",bottom:"0",zIndex:9,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255, 255, 255, 0.75)",children:(0,n.jsx)(es.$,{color:"gray.500"})}),!a&&(!d||0===d.length)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(E.xu,{display:"flex",height:"100%",children:null!==(t=i.noData)&&void 0!==t?t:(0,n.jsx)(n.Fragment,{children:" No data"})}),(0,n.jsx)(E.LZ,{})]}),d&&d.length>0&&(0,n.jsxs)(n.Fragment,{children:["line"===c&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(K,{data:(()=>{if(!x||!m)return d;let[e,t]=[m[0].getUTCFullYear(),m[1].getUTCFullYear()];return d.filter(n=>{let r=n[i.x.accessor],s="number"==typeof r?r:"string"==typeof r?Number(r):new Date(r).getUTCFullYear();return s>=e&&s<=t})})(),configuration:i,chartImageDataCb:s}),!i.hideSlider&&x&&m&&(0,n.jsx)(en,{interval:"year",onChange:w,extent:x,value:m,color:null==r?void 0:r.sliderColor,boxBorderColor:null==r?void 0:r.sliderBoxBorderColor,step:1},"line-".concat(x[0].getTime(),"-").concat(x[1].getTime()))]}),"line"===c&&"temporal"===i.x.scale&&x&&m&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(K,{data:d.filter(e=>{let t=new Date(e[i.x.accessor]).getTime();return t>=m[0].getTime()&&t<=m[1].getTime()}
1),configuration:i,chartImageDataCb:s}),!i.hideSlider&&(0,n.jsx)(en,{interval:"year",onChange:w,extent:x,value:m,color:null==r?void 0:r.sliderColor,boxBorderColor:null==r?void 0:r.sliderBoxBorderColor},"line-".concat(x[0].getTime(),"-").concat(x[1].getTime()))]}),"bar"===c&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(z,{data:(()=>{if(!x||!m)return d;let e=m[1].getUTCFullYear();return d.filter(t=>{let n=t[i.x.accessor];return("number"==typeof n?n:"string"==typeof n?Number(n):new Date(n).getUTCFullYear())===e})})(),configuration:i,chartImageDataCb:s}),!i.hideSlider&&x&&m&&(0,n.jsx)(en,{type:"point",interval:"year",onChange:w,extent:x,value:m,color:null==r?void 0:r.sliderColor,boxBorderColor:null==r?void 0:r.sliderBoxBorderColor,step:null,marks:b},"bar-".concat(x[0].getTime(),"-").concat(x[1].getTime()))]}),"bar"===c&&"temporal"===i.x.scale&&x&&m&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(z,{data:d.filter(e=>{let t=new Date(e[i.x.accessor]).getTime();return t>=m[0].getTime()&&t<=m[1].getTime()}),configuration:i,chartImageDataCb:s}),!i.hideSlider&&(0,n.jsx)(en,{type:"point",interval:"year",onChange:w,extent:x,value:m,color:null==r?void 0:r.sliderColor,boxBorderColor:null==r?void 0:r.sliderBoxBorderColor},"bar-".concat(x[0].getTime(),"-").concat(x[1].getTime()))]}),"table"===c&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(E.kC,{alignContent:"stretch",flexGrow:1,height:1,children:(0,n.jsx)(O,{data:(()=>{if(!x||!m)return d;let[e,t]=[m[0].getUTCFullYear(),m[1].getUTCFullYear()];return d.filter(n=>{let r=n[i.x.accessor],s="number"==typeof r?r:"string"==typeof r?Number(r):new Date(r).getUTCFullYear();return s>=e&&s<=t})})(),configuration:i})}),!i.hideSlider&&x&&m&&(0,n.jsx)(en,{interval:"year",onChange:w,extent:x,value:m,color:null==r?void 0:r.sliderColor,boxBorderColor:null==r?void 0:r.sliderBoxBorderColor,step:1},"table-".concat(x[0].getTime(),"-").concat(x[1].getTime()))]}),"table"===c&&"temporal"===i.x.scale&&x&&m&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(E.kC,{alignContent:"stretch",flexGrow:1,height:1,children:(0,n.jsx)(O,{data:d.filter(e=>{let t=new Date(e[i.x.accessor]).getTime();return t>=m[0].getTime()&&t<=m[1].getTime()}
1),configuration:i})}),!i.hideSlider&&(0,n.jsx)(en,{interval:"year",onChange:w,extent:x,value:m,color:null==r?void 0:r.sliderColor,boxBorderColor:null==r?void 0:r.sliderBoxBorderColor},"table-".concat(x[0].getTime(),"-").concat(x[1].getTime()))]})]})]})},ea=e=>{let{loading:t,height:i,visualisationConfiguration:r,top:s,left:l,right:a,visualisationHeader:o,visualisationFooter:d,styling:c,chartImageDataCb:u,onTimeFilterChange:h}=e,{borderColor:m,borderRadius:g,padding:x}=(null==c?void 0:c.visualisation)||{},p=!!m,{borderColor:f,borderRadius:v,padding:b,background:w}=(null==c?void 0:c.right)||{},{borderColor:j,borderRadius:y,padding:C,background:k}=(null==c?void 0:c.left)||{},{borderColor:D,borderRadius:S,padding:F,background:A}=(null==c?void 0:c.top)||{};return(0,n.jsxs)(E.kC,{gap:"24px",flexDirection:["column","column","row"],order:1,children:[l&&(0,n.jsx)(E.xu,{maxHeight:null!=i?i:300,backgroundColor:k,padding:C,borderColor:j,borderWidth:j?1:void 0,borderRadius:y,flexShrink:0,width:"320px",children:l}),(0,n.jsxs)(E.kC,{height:null!=i?i:300,gap:"24px",flexDir:"column",flexGrow:"1",order:[3,3,2],minWidth:"0",children:[s&&(0,n.jsx)(E.xu,{backgroundColor:A,padding:F,borderColor:D,borderWidth:D?1:void 0,borderRadius:S,children:s}),(0,n.jsxs)(E.kC,{flexDir:"column",flexGrow:"1",minWidth:"0",children:[o&&(0,n.jsx)(E.xu,{borderTopWidth:1,padding:null!=x?x:"0 0 8px 0",borderColor:m,borderWidth:p?1:void 0,borderBottomWidth:p?0:1,borderTopRadius:g,borderBottomColor:null!=g?g:"rgba(0,0,0,0.1)",children:o}),(0,n.jsx)(E.xu,{flexGrow:1,padding:null!=x?x:"0 0 14px 0",borderColor:m,borderWidth:m?1:void 0,borderTopRadius:g&&!o?g:void 0,borderBottomRadius:g&&!d?g:void 0,borderBottomWidth:m&&d?0:1,borderTopWidth:m&&o?0:1,children:(0,n.jsx)(el,{onTimeFilterChange:h,configuration:r,styling:null==c?void 0:c.visualisation,chartImageDataCb:u,loading:t})}),d&&(0,n.jsx)(E.xu,{borderTopWidth:1,padding:null!=x?x:"8px 0 0 0",borderColor:m,borderWidth:m?1:void 0,borderBottomRadius:g,borderTopColor:null!=g?g:"rgba(0,0,0,0.1)",children:d})]})]}),a&&(0,n.jsx)(E.xu,{maxHeight:null!=i?i:300,backgroundColor:w,padding:b,borderColor:f,borderWidth:f?1:void 0,borderRadius:v,order:[2,2,3],children:a})]})},eo=()=>(0,n.jsxs)("svg",{width:"100%",viewBox:"0 0 340 206",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,n.jsx)("path",{d:"M308.523 152.58L323.171 132.574C333.476 118.501 337.736 100.896 335.006 83.6675C330.632 56.0629 309.21 34.2825 281.682 29.4504L252.64 24.3527L204.702 12.3189C172.769 4.30267 139.138 6.35292 108.415 18.1889L70.9426 32.6247C62.5444 35.8601 54.8809 40.7477 48.4056 46.9981C21.959 72.5264 20.8995 114.556 46.0262 141.385L71.3533 168.427C90.2994 188.656 116.482 200.564 144.181 201.549L203.239 203.648C244.627 205.119 284.056 185.994 308.523 152.58Z",fill:"#F8F8F8"}),(0,n.jsx)("path",{d:"M133.001 135L124.094 145.688C123.745 146.106 123.571 146.316 123.568 146.492C123.566 146.646 123.635 146.792 123.754 146.889C123.892 147 124.164 147 124.709 147H132.001L131.001 155L139.907 144.312C140.256 143.894 140.431 143.684 140.433 143.508C140.436 143.354 140.367 143.208 140.248 143.111C140.11 143 139.838 143 139.293 143H132.001L133.001 135Z",stroke:"#E2005E","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.jsx)("path",{d:"M216 157V149.6C216 149.04 216 148.76 216.109 148.546C216.205 148.358 216.358 148.205 216.546 148.109C216.76 148 217.04 148 217.6 148H220.4C220.96 148 221.24 148 221.454 148.109C221.642 148.205 221.795 148.358 221.891 148.546C222 148.76 222 149.04 222 149.6V157M209 145.5L218.04 138.72C218.384 138.462 218.556 138.333 218.745 138.283C218.912 138.239 219.088 138.239 219.255 138.283C219.444 138.333 219.616 138.462 219.96 138.72L229 145.5M211 144V153.8C211 154.92 211 155.48 211.218 155.908C211.41 156.284 211.716 156.59 212.092 156.782C212.52 157 213.08 157 214.2 157H223.8C224.92 157 225.48 157 225.908 156.782C226.284 156.59 226.59 156.284 226.782 155.908C227 155.48 227 154.92 227 153.8V144L220.92 139.44C220.231 138.924 219.887 138.665 219.509 138.566C219.175 138.478 218.825 138.478 218.491 138.566C218.113 138.665 217.769 138.924 217.08 139.44L211 144Z",stroke:"#E2005E","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.jsx)("path",{d:"M91 89C93.5013 91.7384 94.9228 95.292 95 99C94.9228 102.708 93.5013 106.262 91 109M91 89C88.4987 91.7384 87.0772 95.292 87 99C87.0772 102.708 88.4987 106.262 91 109M91 89C85.4772 89 81 93.4772 81 99C81 104.523 85.4772 109 91 109M91 89C96.5228 89 101 93.4772 101 99C101 104.523 96.5228 109 91 109M81.5 96H100.5M81.5 102H100.5",stroke:"#E2005E","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.jsx)("path",{d:"M180.5 103.5H179.5L178 106.5L176 100.5L174.5 103.5H173.5M176.993 97.1358C174.994 94.7984 171.66 94.1696 169.155 96.31C166.65 98.4504 166.297 102.029 168.264 104.56C169.75 106.472 173.971 110.311 175.948 112.075C176.311 112.399 176.493 112.561 176.706 112.625C176.891 112.681 177.096 112.681 177.28 112.625C177.493 112.561 177.675 112.399 178.038 112.075C180.015 110.311 184.236 106.472 185.722 104.56C187.689 102.029 187.38 98.4279 184.832 96.31C182.283 94.1922 178.993 94.7984 176.993 97.1358Z",stroke:"#E2005E","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.jsx)("path",{d:"M139 62.5H139.01M149.806 51.7008C146.96 49.092 143.166 47.5 139 47.5C134.834 47.5 131.04 49.092 128.193 51.7008M131.732 55.243C133.67 53.5357 136.214 52.5 139 52.5C141.786 52.5 144.33 53.5357 146.268 55.243M142.698 58.7751C141.679 57.9763 140.395 57.5 139 57.5C137.583 57.5 136.282 57.9908 135.255 58.8116",stroke:"#E2005E","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.jsx)("path",{d:"M258 95H259.306C259.552 95 259.675 95 259.774 95.0452C259.861 95.0851 259.935 95.1492 259.987 95.2299C260.046 95.3215 260.063 95.4433 260.098 95.6869L260.571 99M260.571 99L261.623 106.731C261.757 107.713 261.824 108.203 262.058 108.572C262.265 108.898 262.561 109.156 262.911 109.317C263.309 109.5 263.804 109.5 264.794 109.5H273.352C274.295 109.5 274.766 109.5 275.151 109.33
1C275.491 109.181 275.782 108.94 275.992 108.634C276.231 108.288 276.319 107.825 276.495 106.899L277.819 99.9497C277.881 99.6238 277.912 99.4609 277.867 99.3335C277.828 99.2218 277.75 99.1277 277.648 99.068C277.531 99 277.365 99 277.033 99H260.571ZM266 114C266 114.552 265.552 115 265 115C264.448 115 264 114.552 264 114C264 113.448 264.448 113 265 113C265.552 113 266 113.448 266 114ZM274 114C274 114.552 273.552 115 273 115C272.448 115 272 114.552 272 114C272 113.448 272.448 113 273 113C273.552 113 274 113.448 274 114Z",stroke:"#E2005E","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.jsx)("path",{d:"M210 57C210 62.5228 214.477 67 220 67C221.657 67 223 65.6569 223 64V63.5C223 63.0356 223 62.8034 223.026 62.6084C223.203 61.2622 224.262 60.2029 225.608 60.0257C225.803 60 226.036 60 226.5 60H227C228.657 60 230 58.6569 230 57C230 51.4772 225.523 47 220 47C214.477 47 210 51.4772 210 57Z",stroke:"#E2005E","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.jsx)("path",{d:"M215 58C215.552 58 216 57.5523 216 57C216 56.4477 215.552 56 215 56C214.448 56 214 56.4477 214 57C214 57.5523 214.448 58 215 58Z",stroke:"#E2005E","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.jsx)("path",{d:"M224 54C224.552 54 225 53.5523 225 53C225 52.4477 224.552 52 224 52C223.448 52 223 52.4477 223 53C223 53.5523 223.448 54 224 54Z",stroke:"#E2005E","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.jsx)("path",{d:"M218 53C218.552 53 219 52.5523 219 52C219 51.4477 218.552 51 218 51C217.448 51 217 51.4477 217 52C217 52.5523 217.448 53 218 53Z",stroke:"#E2005E","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]});var ed=i(81958),ec=i(85713),eu=e=>{let{type:t,isDownloading:i,handleDownload:r,title:s,description:l}=e,a="png"===t?(0,n.jsx)(ed.zS0,{boxSize:4}):(0,n.jsx)(ed.$eq,{boxSize:4});return(0,n.jsxs)(E.xu,{maxW:"200px",children:[(0,n.jsx)(er.xv,{fontSize:"xs",color:"gray.600",mb:2,children:l}),(0,n.jsx)(ec.zx,{variant:"outline",leftIcon:i===t?(0,n.jsx)(es.$,{size:"sm"}):a,rightIcon:(0,n.jsx)(ed._8t,{boxSize:3}),onClick:()=>r(t),size:"sm",justifyContent:"space-between",width:"full",disabled:!!i,children:s})]})},eh=i(72378),em=i(88002);let eg=function(){let{title:e,onExported:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{exportToImg:(0,o.useCallback)(async(i,n)=>{try{let r=await fetch("/api/workspace/workspace_qgvkVcUsilRzBA/export-png".concat(i));if(!r.ok)throw Error("Export failed: ".concat(r.statusText));let s=await r.blob(),l=document.createElement("a");l.download="".concat(e||"chart",".").concat(n),l.href=URL.createObjectURL(s),l.click(),URL.revokeObjectURL(l.href),null==t||t()}catch(e){throw console.error("Export failed:",e),e}},[e,t])}},ex=e=>{let{question:t,csvData:i=[]}=e,[r,s]=(0,o.useState)(!1),[l,a]=(0,o.useState)(!1),[d,c]=(0,o.useState)(!1),[u,h]=(0,o.useState)(null),[m,g]=(0,o.useState)(!1),{exportToImg:x}=eg({title:"som-insitutet",onExported:()=>{h(null),s(!1)}}),[p,f]=(0,o.useState)(null),v=e=>{let t=window.location.href,i=encodeURIComponent(t);switch(e){case"linkedin":window.open("https://www.linkedin.com/sharing/share-offsite/?url=".concat(i),"_blank");break;case"x":window.open("https://twitter.com/intent/tweet?url=".concat(i),"_blank");break;case"facebook":window.open("https://www.facebook.com/sharer/sharer.php?u=".concat(i),"_blank");break;default:var n,r;(null===(r=navigator)||void 0===r?void 0:null===(n=r.clipboard)||void 0===n?void 0:n.writeText)&&navigator.clipboard.writeText(t)}},b=e=>{if(!e||!e.length)return"";let t=new Set;e.forEach(e=>Object.keys(e).forEach(e=>t.add(e)));let i=new Set(["survey_year","answerName","value","count"]),n=new Set(["answer","answerType","dimension1","dimension2","seriesName","series_id","sum_count"]),r=["survey_year",...Array.from(t).filter(e=>!i.has(e)&&!n.has(e)).sort(),"answerName","value","count"],s=e=>{if(null==e)return"";let t=String(e).replace(/"/g,'""');return t.search(/("|,|\n)/g)>=0?'"'.concat(t,'"'):t};return[r.map(e=>"survey_year"===e?"\xc5r":"answerName"===e?"Svarsalternativ":"value"===e?"Procent":"count"===e?"Antal svar":e).map(s).join(","),...e.map(e=>r.map(t=>s(e[t])).join(","))].join("\n")},w=async e=>{if(h(e),f(null),"csv"===e){if(!i||0===i.length){f("Ingen data att ladda ner."),h(null);return}let e=new Blob([b(i)],{type:"text/csv;charset=utf-8;"}),t=URL.createObjectURL(e),n=document.createElement("a");n.href=t,n.setAttribute("download","data.csv"),document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t),h(null),s(!1)}else try{await x(location.search,e),h(null),s(!1)}catch(e){console.error("Error exporting image:",e),f("N\xe5got gick fel. F\xf6rs\xf6k igen sen
1are."),h(null)}};return(0,n.jsxs)(E.kC,{alignItems:"center",justifyContent:"space-between",flexWrap:["wrap","wrap","nowrap"],children:[(0,n.jsx)(E.xu,{children:(0,n.jsx)(ec.zx,{variant:"standalone",onClick:()=>c(!0),children:(0,n.jsxs)(E.kC,{alignItems:"center",gap:2,py:0,children:[(0,n.jsx)(ed.uMt,{size:"sm",style:{marginBottom:3}}),(0,n.jsx)(er.xv,{fontSize:"14px",children:"Fr\xe5geformulering och kommentar"})]})})}),(0,n.jsxs)(E.kC,{children:[(0,n.jsx)(ec.zx,{bg:"gray.50",borderRadius:"4",leftIcon:(0,n.jsx)(ed._8t,{}),size:"sm",onClick:()=>s(!0),mr:2,children:"Ladda ner"}),(0,n.jsx)(ec.zx,{bg:"gray.50",borderRadius:"4",leftIcon:(0,n.jsx)(ed.GwX,{}),size:"sm",onClick:()=>a(!0),children:"Dela"})]}),(0,n.jsxs)(eh.u_,{onClose:()=>c(!1),isOpen:d,isCentered:!0,size:"xl",scrollBehavior:"inside",children:[(0,n.jsx)(eh.ZA,{}),(0,n.jsxs)(eh.hz,{children:[(0,n.jsx)(eh.xB,{children:"Fr\xe5geformulering och kommentar"}),(0,n.jsx)(eh.ol,{}),(0,n.jsx)(eh.fe,{maxHeight:"80vh",children:(0,n.jsxs)(E.Kq,{children:[(0,n.jsx)(er.h_,{children:"Fr\xe5gan lyder"}),(0,n.jsx)(er.xv,{children:(null==t?void 0:t.question_detail)||"Ingen fr\xe5getext tillg\xe4nglig"}),(0,n.jsx)(er.h_,{children:"Kommentar"}),(0,n.jsx)(er.xv,{children:(null==t?void 0:t.som_comment)||"Ingen kommentar tillg\xe4nglig"})]})})]})]}),(0,n.jsxs)(eh.u_,{onClose:()=>s(!1),isOpen:r,size:"md",children:[(0,n.jsx)(eh.ZA,{}),(0,n.jsxs)(eh.hz,{mx:["sm","0"],children:[(0,n.jsx)(eh.xB,{children:"Nedladdningsalternativ"}),(0,n.jsx)(eh.ol,{}),(0,n.jsx)(eh.fe,{pb:6,children:(0,n.jsxs)(E.Ug,{spacing:6,align:"stretch",children:[(0,n.jsxs)(E.xu,{w:"50%",children:[(0,n.jsx)(er.xv,{fontSize:"sm",fontWeight:"medium",children:"Diagram"}),(0,n.jsx)(eu,{type:"png",isDownloading:u,handleDownload:w,title:"PNG",description:"Standardformat f\xf6r bilder"})]}),(0,n.jsxs)(E.xu,{w:"50%",children:[(0,n.jsx)(er.xv,{fontSize:"sm",fontWeight:"medium",children:"Data"}),(0,n.jsx)(eu,{type:"csv",isDownloading:u,handleDownload:w,title:"CSV",description:"Tabelldata i kommaseparerat format"})]}),p&&(0,n.jsx)(er.xv,{color:"red.500",fontSize:"sm",children:p})]})})]})]}),(0,n.jsxs)(eh.u_,{onClose:()=>{a(!1),g(!1)},isOpen:l,size:"md",children:[(0,n.jsx)(eh.ZA,{}),(0,n.jsxs)(eh.hz,{mx:["sm","0"],children:[(0,n.jsx)(eh.xB,{children:"Delningsalternativ"}),(0,n.jsx)(eh.ol,{}),(0,n.jsx)(eh.fe,{pb:6,children:(0,n.jsxs)(E.gC,{spacing:6,align:"stretch",children:[(0,n.jsxs)(E.xu,{children:[(0,n.jsx)(er.xv,{fontSize:"sm",mb:3,children:"Dela i sociala medier"}),(0,n.jsxs)(E.Ug,{spacing:2,align:"stretch",children:[(0,n.jsx)(ec.zx,{variant:"outline",leftIcon:(0,n.jsx)(ed.nIU,{boxSize:4}),onClick:()=>v("linkedin"),size:"sm",justifyContent:"flex-start",width:"33%",children:"LinkedIn"}),(0,n.jsx)(ec.zx,{variant:"outline",leftIcon:(0,n.jsx)(ed.nv_,{boxSize:4}),onClick:()=>v("x"),size:"sm",justifyContent:"flex-start",width:"33%",children:"X"}),(0,n.jsx)(ec.zx,{variant:"outline",leftIcon:(0,n.jsx)(ed.VqK,{boxSize:4}),onClick:()=>v("facebook"),size:"sm",justifyContent:"flex-start",width:"33%",children:"Facebook"})]})]}),(0,n.jsxs)(E.xu,{children:[(0,n.jsx)(er.xv,{fontSize:"sm",children:"Kopiera l\xe4nk"}),(0,n.jsx)(em.m,{size:"small",items:[{key:"exact",label:"Med exakta inst\xe4llningar",children:(0,n.jsxs)(E.gC,{spacing:2,align:"stretch",children:[(0,n.jsx)(er.xv,{fontSize:"xs",children:"Om du gjort specifika inst\xe4llningar kring vyer, tid och svarsalternativ."}),(0,n.jsx)(E.xu,{bg:"gray.50",p:3,borderRadius:"md",border:"1px solid",borderColor:"gray.200",fontSize:"xs",wordBreak:"break-all",lineHeight:"1.5",children:window.location.href}),(0,n.jsx)(ec.zx,{leftIcon:m?(0,n.jsx)(ed.nQG,{}):(0,n.jsx)(ed.TIy,{}),colorScheme:m?"green":"red",onClick:()=>{navigator.clipboard.writeText(window.location.href),g(!0),setTimeout(()=>g(!1),2e3)},size:"sm",children:m?"Kopierad":"Kopiera"})]})},{key:"base",label:"Generell l\xe4nk",children:(0,n.jsxs)(E.gC,{spacing:2,align:"stretch",children:[(0,n.jsxs)(er.xv,{fontSize:"xs",color:"gray.600",lineHeight:"1.3",children:["Till startvyn f\xf6r ",(null==t?void 0:t.name)||"fr\xe5gan"," utan specifika inst\xe4llningar (alltid senaste data)."]}),(0,n.jsx)(E.xu,{bg:"gray.50",p:3,borderRadius:"md",border:"1px solid",borderColor:"gray.200",fontSize:"xs",wordBreak:"break-all",lineHeight:"1.5",children:window.location.origin+window.location.pathname+((null==t?void 0:t.id)?"?m=".concat(t.id):"")}),(0,n.jsx)(ec.zx,{leftIcon:m?(0,n.jsx)(ed.nQG,{}):(0,n.jsx)(ed.TIy,{}),colorScheme:m?"green":"red",onClick:()=>{{let e=window.location.origin+window.location.pathname+((null==t?void 0:t.id)?"?m=".concat(t.id):"");navigator.clipboard.writeText(e),g(!0),setTimeout(()=>g(!1),2e3)}},size:"sm",children:m?"Kopierad":"Kopiera"})]})}]})]})]})})]})]})]})};var ep=i(84913),ef=i(4431),ev=i(1436),eb=i(96797);let{Option:ew}=ep.default,ej=e=>{let{selectedDimensions:t,selectedDimensionValues:i,backgroundQuestions:r,answers:s,dimensionGroups:l=[],onAllRespondents:a,onDimensionChange:o,onDimensionValueChange:d,getCategoryDimensionLabel:c}=e,u=e=>r.find(t=>
1t.id===e),h=e=>s.filter(t=>t.answer_set===e.uses_answer_set);return(0,n.jsxs)(E.kC,{alignContent:"center",flexWrap:"wrap",children:[(0,n.jsxs)(ef.J2,{placement:"top-start",children:[(0,n.jsx)(ef.xo,{children:(0,n.jsx)(ec.zx,{borderWidth:"1px",size:"sm",colorScheme:"red",variant:"outline",width:["100%","100%","auto"],mb:[3,3,0],mr:[0,0,3],leftIcon:(0,n.jsx)(ed.n72,{}),children:c()})}),(0,n.jsxs)(ef.yk,{width:"400px",children:[(0,n.jsx)(ef.QH,{}),(0,n.jsx)(ef.us,{}),(0,n.jsx)(ef.Yt,{children:(0,n.jsx)(er.$Q,{children:"V\xe4lj kategori:"})}),(0,n.jsx)(ef.b,{height:"400px",overflow:"scroll",children:(0,n.jsx)(E.kC,{children:(0,n.jsx)(ev.Ee,{colorScheme:"red",value:0===t.length?"all":t[0],onChange:e=>{"all"===e?a({target:{checked:!0,value:"all"}}):o({target:{checked:!0,value:e}})},children:(0,n.jsxs)(E.gC,{align:"start",spacing:4,width:"100%",p:3,children:[(0,n.jsx)(eb.Y8,{value:"all",children:"Alla respondenter"}),(0,n.jsx)(E.iz,{}),0===l.length&&(0,n.jsx)(E.xu,{children:(0,n.jsx)(er.$2,{color:"gray.500",children:"Laddar bakgrundsfr\xe5gor..."})}),l.map(e=>(0,n.jsxs)(E.xu,{width:"100%",children:[(0,n.jsx)(er.$2,{fontWeight:"semibold",mb:2,children:e.name}),(0,n.jsxs)(E.gC,{align:"start",spacing:1,children:[0===e.ids.length&&(0,n.jsx)(er.$2,{color:"gray.500",fontSize:"sm",children:"Inga fr\xe5gor i denna kategori"}),e.ids.map(e=>{let t=u(e);return t?(0,n.jsx)(E.xu,{width:"100%",children:(0,n.jsx)(eb.Y8,{value:e,children:t.name})},e):(0,n.jsx)(E.xu,{width:"100%",children:(0,n.jsxs)(er.$2,{color:"red.500",fontSize:"sm",children:["Fr\xe5ga ",e," saknas"]})},e)})]})]},e.name))]})})})})]})]}),t.map(e=>{let t=u(e);if(!t)return null;let r=h(t).filter((e,t,i)=>t===i.findIndex(t=>t.id===e.id));return(0,n.jsx)(E.xu,{mr:[0,0,3],width:["100%","100%","auto"],mb:[3,3,0],children:(0,n.jsx)(ep.default,{style:{width:"100%"},dropdownStyle:{zIndex:2e3},placeholder:"Select ".concat(t.name),value:i[e]?"".concat(e,"-").concat(i[e]):void 0,onChange:t=>{let i=t.replace("".concat(e,"-"),"");d(e,i)},popupMatchSelectWidth:!1,children:r.map(t=>(0,n.jsx)(ew,{value:"".concat(e,"-").concat(t.id),children:t.name},"".concat(e,"-").concat(t.id)))})},e)})]})};var ey=i(52011);let eC={chartTypes:[{icon:ed.lD$,value:"line",label:"Linjediagram"},{icon:ed.tvd,value:"bar",label:"Stapeldiagram"},{icon:ed.$eq,value:"table",label:"Tabell"}]},ek=e=>{let{questionMetaData:t,selectedDimensions:i,selectedDimensionValues:r,backgroundQuestions:s,answers:l,dimensionGroups:a,selectedAnswers:o,selectedCombinedAnswers:d,visualisationFilter:c,onAllRespondents:u,onDimensionChange:h,onDimensionValueChange:m,onAnswerChange:g,onCombinedAnswerChange:x,onVisualisationFilterChange:p,getCategoryDimensionLabel:f}=e,v=t.answers.length>0&&t.answers.every(e=>o.includes(e.id)),b=t.combinedAnswers.length>0&&t.combinedAnswers.every(e=>d.includes(e.id));return(0,n.jsxs)(E.kC,{alignContent:"center",flexWrap:"wrap",children:[(0,n.jsx)(ej,{selectedDimensions:i,selectedDimensionValues:r,backgroundQuestions:s,answers:l,dimensionGroups:a,onAllRespondents:u,onDimensionChange:h,onDimensionValueChange:m,getCategoryDimensionLabel:f}),(0,n.jsx)(E.LZ,{}),(0,n.jsxs)(ef.J2,{children:[(0,n.jsx)(ef.xo,{children:(0,n.jsx)(ec.zx,{borderWidth:"1px",size:"sm",colorScheme:"red",variant:"outline",leftIcon:(0,n.jsx)(ed.JZr,{}),width:["100%","100%","auto"],mt:[3,3,0],mr:[0,0,3],children:"Svarsalternativ"})}),(0,n.jsxs)(ef.yk,{width:"400px",children:[(0,n.jsx)(ef.QH,{}),(0,n.jsx)(ef.us,{}),(0,n.jsx)(ef.b,{children:(0,n.jsxs)(E.gC,{align:"start",spacing:2,children:[(0,n.jsx)(E.xu,{children:(0,n.jsx)(ey.XZ,{colorScheme:"red",isChecked:v,onChange:e=>{let i=e.target.checked;t.answers.forEach(e=>{g({target:{checked:i,value:e.id}})})},fontWeight:"bold",children:(0,n.jsx)(er.Yw,{muted:!0,children:"Svar"})})}),t.answers.map(e=>(0,n.jsx)(E.xu,{pl:3,children:(0,n.jsx)(ey.XZ,{colorScheme:"red",value:e.id,isChecked:o.includes(e.id),onChange:g,children:e.name||e.id})},e.id)),t.combinedAnswers.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(E.xu,{mt:4,children:(0,n.jsx)(ey.XZ,{colorScheme:"red",isChecked:b,onChange:e=>{let i=e.target.checked;
1t.combinedAnswers.forEach(e=>{x({target:{checked:i,value:e.id}})})},fontWeight:"bold",children:(0,n.jsx)(er.Yw,{muted:!0,children:"Svarskombinationer"})})}),t.combinedAnswers.map(e=>(0,n.jsx)(E.xu,{pl:3,children:(0,n.jsx)(ey.XZ,{colorScheme:"red",value:e.id,isChecked:d.includes(e.id),onChange:x,children:e.name||e.id})},e.id))]})]})})]})]}),(0,n.jsx)(E.xu,{width:["100%","100%","auto"],mt:[3,3,0],mr:[0,0,3],children:(0,n.jsx)(ep.default,{options:eC.chartTypes.map(e=>e),style:{width:"100%",borderRadius:4},dropdownStyle:{zIndex:2e3},labelRender:e=>{let t=eC.chartTypes.map(e=>e).find(t=>t.value===e.key).icon;return(0,n.jsxs)(E.kC,{overflow:"hidden",whiteSpace:"nowrap",gap:"2",alignItems:"center",children:[t?(0,n.jsx)(t,{style:{marginTop:"-2px",width:"20px",height:"20px"}}):"",e.label]})},popupMatchSelectWidth:!1,onChange:e=>p(e),value:c,optionRender:e=>{let t=e.data.icon;return(0,n.jsxs)(E.kC,{gap:"2",alignItems:"center",children:[t?(0,n.jsx)(t,{style:{marginTop:"-2px",width:"20px",height:"20px"}}):"",e.label]})}})})]})};var eD=i(88782),eS=i(4359),eF=i(73696),eA=i(47249);let{Search:e_}=eD.default,eM=e=>{let{error:t,loading:i,searchQuery:r,filteredQuestions:s,treeData:l,onSearchChange:a,onSelectMeasure:d,selectedMeasureId:c}=e,u=(0,eF.pm)();return o.useEffect(()=>{t&&(console.error("Error in QuestionSelectionPanel:",t),u({title:"Felmeddelande",description:t.message||"N\xe5got gick fel. V\xe4nligen kontakta [email protected] om felet kvarst\xe5r.",status:"error",duration:5e3,isClosable:!0}))},[t,u]),(0,n.jsxs)(E.kC,{flexDir:"column",gap:"2",width:"100%",children:[(0,n.jsxs)(E.xu,{px:5,pt:5,pb:3,children:[(0,n.jsx)(er.$Q,{children:"V\xe4lj fr\xe5ga"}),(0,n.jsx)(e_,{placeholder:"S\xf6k fr\xe5gor ...",allowClear:!0,enterButton:"S\xf6k",size:"middle",onSearch:a,onChange:e=>a(e.target.value)})]}),(0,n.jsx)(E.xu,{maxHeight:670,overflowY:"scroll",children:i?(0,n.jsx)(er.$2,{children:"Laddar fr\xe5gor..."}):r.trim()?(0,n.jsx)(E.QI,{spacing:.5,styleType:"none",pl:0,pr:2,children:s.length>0?s.map(e=>(0,n.jsx)(E.HC,{onClick:()=>d(e.id),cursor:"pointer",p:"4px 8px",bg:e.id===c?h.O9.gray[100]:"transparent",_hover:{bg:h.O9.gray[100]},borderRadius:"md",children:(0,n.jsx)(E.kC,{align:"center",children:(0,n.jsx)(er.OM,{children:e.name||e.id||"Unnamed Question"})})},e.id)):(0,n.jsx)(er.$2,{children:"Inga fr\xe5gor hittades"})}):l&&l.length>0?(0,n.jsx)(eA.UQ,{allowToggle:!0,children:l.map(e=>{var t;let i=eS[e.icon]||eS.FaQuestionCircle;return(0,n.jsxs)(eA.Qd,{borderColor:"#eee",children:[(0,n.jsxs)(eA.KF,{children:[(0,n.jsxs)(E.kC,{flex:"1",textAlign:"left",alignItems:"center",cursor:"pointer",children:[(0,n.jsx)(i,{style:{color:"#E2005E",fontSize:"16px",cursor:"default"}}),(0,n.jsx)(er.OM,{ml:2,children:e.title})]}),(0,n.jsx)(eA.XE,{})]}),(0,n.jsx)(eA.Hk,{pb:4,children:(0,n.jsx)(E.QI,{ml:0,spacing:.5,styleType:"none",pl:0,children:null===(t=e.children)||void 0===t?void 0:t.map(e=>(0,n.jsx)(E.HC,{onClick:()=>
1d(e.key),cursor:"pointer",p:"4px 8px",bg:e.key===c?h.O9.gray[100]:"transparent",_hover:{bg:h.O9.gray[100]},borderRadius:"md",children:(0,n.jsx)(E.kC,{align:"center",children:(0,n.jsx)(er.OM,{children:e.title})})},e.key))})})]},e.key)})}):(0,n.jsx)(er.$2,{px:5,pt:5,pb:3,children:"Laddar kategorier"})})]})},eI=e=>{let{isQuestionModalOpen:t,isSettingsModalOpen:i,onQuestionModalClose:r,onSettingsModalClose:s,error:l,loading:a,searchQuery:o,filteredQuestions:d,treeData:c,onSearchChange:u,onSelectMeasure:h,selectedMeasureId:m,questionMetaData:g,selectedDimensions:x,selectedDimensionValues:p,backgroundQuestions:f,answers:v,dimensionGroups:b,selectedAnswers:w,selectedCombinedAnswers:j,visualisationFilter:y,onAllRespondents:C,onDimensionChange:k,onDimensionValueChange:D,onAnswerChange:S,onCombinedAnswerChange:F,onVisualisationFilterChange:A,getCategoryDimensionLabel:_}=e;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(eh.u_,{isOpen:t,onClose:r,size:"full",children:[(0,n.jsx)(eh.ZA,{}),(0,n.jsxs)(eh.hz,{children:[(0,n.jsx)(eh.xB,{children:"V\xe4lj fr\xe5ga"}),(0,n.jsx)(eh.ol,{}),(0,n.jsx)(eh.fe,{children:(0,n.jsx)(eM,{error:l,loading:a,searchQuery:o,filteredQuestions:d,treeData:c,onSearchChange:u,onSelectMeasure:e=>{h(e),r()},selectedMeasureId:m})})]})]}),(0,n.jsxs)(eh.u_,{isOpen:i,onClose:s,size:"full",children:[(0,n.jsx)(eh.ZA,{}),(0,n.jsxs)(eh.hz,{children:[(0,n.jsx)(eh.xB,{children:"Diagraminst\xe4llningar"}),(0,n.jsx)(eh.ol,{}),(0,n.jsx)(eh.fe,{children:(0,n.jsx)(ek,{questionMetaData:g,selectedDimensions:x,selectedDimensionValues:p,backgroundQuestions:f,answers:v,dimensionGroups:b,selectedAnswers:w,selectedCombinedAnswers:j,visualisationFilter:y,onAllRespondents:C,onDimensionChange:k,onDimensionValueChange:D,onAnswerChange:S,onCombinedAnswerChange:F,onVisualisationFilterChange:A,getCategoryDimensionLabel:_})})]})]})]})};var ez=i(33022),eT=i(84672),eL=i(213);let eN="workspace_qgvkVcUsilRzBA";function eE(e,t){try{return String((0,eT.ZA)(e,t)||"")}catch(i){return String(e[t]||"")}}function eQ(e,t){try{let i=(0,eT.PK)(e,t);if(!i)return[];return Array.isArray(i)?i:[i]}catch(e){return[]}}async function eB(){try{let[e,t]=await Promise.all([(0,eL.kk)({filter:{class_id:{_eq:"SomValueQuestionCategory"},workspace_id:{_eq:eN}},language:"sv",properties:[{id:"name"},{id:"icon"},{id:"position"},{id:"question",properties:[{id:"name"},{id:"question_detail"},{id:"comment"},{id:"som_variable_id"},{id:"position"},{id:"uses_answer_set"}]}],order_by:{position:"asc"},limit:100}),(0,eL.kk)({filter:{class_id:{_eq:"SomBackgroundQuestionCategory"},workspace_id:{_eq:eN}},language:"sv",properties:[{id:"name"},{id:"position"},{id:"question",properties:[{id:"name"},{id:"som_variable_id"},{id:"position"},{id:"uses_answer_set",properties:[{id:"name"},{id:"answer",properties:[{id:"name"},{id:"position"}]}]}]}],order_by:{position:"asc"},limit:100})]),i=[],n=[];e.forEach(e=>{n.push({id:e.id,name:eE(e,"name"),icon:eE(e,"icon")}),eQ(e,"question").forEach(t=>{if(null==t?void 0:t.data_value){let n=t.data_value;if(!n.id){console.warn("Value question missing ID in category ".concat(e.id));return}let r=(0,eT.ZA)(t,"question_detail"),s=(0,eT.ZA)(t,"comment"),l=(0,eT.ZA)(t,"som_variable_id"),a=(0,eT.ZA)(t,"position"),o=(0,eT.ZA)(t,"uses_answer_set");i.push({id:String(n.id),name:String(n.name||""),question_detail:(null==r?void 0:r.sv)||(null==r?void 0:r.en)||"",som_variable_id:String(l||""),position:Number(a||0),question_category:e.id,som_comment:(null==s?void 0:s.sv)||(null==s?void 0:s.en)||"",uses_answer_set:String((null==o?void 0:o.id)||"")})}})});let r=[],s=[],l=[],a=new Map,o=new Set;return t.forEach(e=>{let t=eE(e,"name"),i=[];eQ(e,"question").forEach(t=>{if(null==t?void 0:t.data_value){var n,l;let d=t.data_value,c=String(d.id||"");if(!c){console.warn("Background question missing ID in category ".concat(e.id));return}let u=Number(d.position||0);i.push(c),a.set(c,u);let h="",m=eQ(t,"uses_answer_set");m.length>0&&(null===(l=m[0])||void 0===l?void 0:null===(n=l.data_value)||void 0===n?void 0:n.id)&&(h=String(m[0].data_value.id),o.has(h)||(o.add(h),eQ(m[0],"answer").forEach(e
1=>{var t;if(null==e?void 0:null===(t=e.data_value)||void 0===t?void 0:t.id){let t=e.data_value;s.push({id:String(t.id),name:String(t.name||""),answer_set:h,position:Number(t.position||0)})}}))),r.push({id:c,name:String(d.name||""),som_variable_id:String(d.som_variable_id||""),position:u,question_category:e.id,uses_answer_set:h})}}),i.length>0&&l.push({name:t,ids:i.sort((e,t)=>(a.get(e)||0)-(a.get(t)||0))})}),i.sort((e,t)=>e.position-t.position),r.sort((e,t)=>e.position-t.position),s.sort((e,t)=>(e.position||0)-(t.position||0)),{valueQuestions:i,valueQuestionCategories:n,backgroundQuestions:r,answers:s,combinedAnswers:[],dimensionGroups:l}}catch(e){throw console.error("Failed to load SOM data:",e),e}}async function eO(e,t){let i=await fetch("/api/workspace/workspace_qgvkVcUsilRzBA/surveys/responses",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({questionId:e,backgroundQuestionIds:t})});if(!i.ok)throw Error((await i.json()).message||"Failed to fetch survey responses");return i.json()}let eq="workspace_qgvkVcUsilRzBA";async function eU(e,t){try{if(!(null==e?void 0:e.id))throw Error("Valid value question object with id is required.");let i=e.uses_answer_set,[n,r]=await Promise.all([(0,eL.kk)({filter:{class_id:{_eq:"SomAnswer"},workspace_id:{_eq:eq}},language:"sv",properties:[{id:"name"},{id:"answer_set"},{id:"combined_answer"},{id:"position"}],limit:2e3}),(0,eL.kk)({filter:{class_id:{_eq:"SomCombinedAnswer"},workspace_id:{_eq:eq}},language:"sv",properties:[{id:"name"},{id:"position"}],limit:500})]),s=e=>e.map(e=>{var t,i;let n=(0,eT.ZA)(e,"name"),r=n?String(n).replace(/\s*\([^()]*\)$/,""):"",s=(0,eT.PK)(e,"answer_set"),l=(0,eT.ZA)(e,"combined_answer"),a=(0,eT.ZA)(e,"position");return{id:String(e.id),name:r,answer_set:null!==(t=null==s?void 0:s.id)&&void 0!==t?t:"",combined_answer:null!==(i=null==l?void 0:l.id)&&void 0!==i?i:"",position:null!=a?a:0}}),l=s(n).filter(e=>e.id),a=[];i?(a=l.filter(e=>e.answer_set===i).sort((e,t)=>e.position-t.position),0===a.length&&i&&console.error('No answers found for answer_set "'.concat(i,'"'))):(console.warn('Question "'.concat(e.name,'" has no answer_set configured, attempting fallback lookup')),t&&t.length>0?(a=l.filter(e=>t.includes(e.id)).sort((e,t)=>e.position-t.position),0===a.length&&console.error("No answers found even with ClickHouse fallback!")):console.warn("No ClickHouse answer IDs provided for fallback lookup"));let o=s(r).filter(e=>e.id).sort((e,t)=>e.position-t.position).filter(e=>a.some(t=>t.combined_answer===e.id));return 0===a.length&&console.warn('No answers found for answer_set "'.concat(i,'" in question "').concat(e.name,'"')),{answers:a,combinedAnswers:o}}catch(t){throw console.error("Error fetching metadata for question ID ".concat(e.id,":"),t),t}}let eR=e=>{if(1===e.length)return e;let t=parseInt(e[0],10),i=parseInt(e[1],10),n=[];for(let e=t;e<=i;e++)n.push(e.toString());return n},eW=e=>{let t=e.map(Number).sort((e,t)=>e-t),i=[],n=t[0],r=n;for(let e=1;e<=t.length;e++)t[e]===r+1?r=t[e]:(n===r?i.push("".concat(n)):i.push("".concat(n,"-").concat(r)),r=n=t[e]);return i.join(", ")},eV=new Intl.NumberFormat("sv-SE",{style:"percent",maximumFractionDigits:0});class eH{updateUrl(e){if(!this.didInitFromUrl)return;let t={...e.query};this.selectedMeasureId?t.m=this.selectedMeasureId:delete t.m,this.selectedDimensions.length?t.d=this.selectedDimensions.join(","):delete t.d,this.userSetTimeFilter&&this.timeFilter.length?t.t=this.timeFilter.join(","):delete t.t,Object.keys(this.selectedDimensionValues).length?t.sdv=JSON.stringify(this.selectedDimensionValues):delete t.sdv,this.selectedAnswers.length?t.sa=this.selectedAnswers.join(","):delete t.sa,this.selectedCombinedAnswers.length?t.sca=this.selectedCombinedAnswers.join(","):delete t.sca,this.visualisationFilter?t.vf=this.visualisationFilter:delete t.vf;let i=e.asPath.split("?")[0];e.replace({pathname:i,query:t},void 0,{shallow:!0,scroll:!1})}async bootstrap(){(0,ez.z)(()=>{this.isLoading=!0,this.error=null});try{let e=await eB();(0,ez.z)(()=>{this.valueQuestions=e.valueQuestions,this.valueQuestionCategories=e.valueQuestionCategories,this.backgroundQuestions=e.backgroundQuestions,this.dimensionGroups=e.dimensionGroups,this.answers=e.answers,this.combinedAnswers=e.comb
1inedAnswers})}catch(e){console.error("Bootstrap failed:",e),(0,ez.z)(()=>{this.error=e})}finally{(0,ez.z)(()=>{this.isLoading=!1})}}initFromUrl(e){if(this.didInitFromUrl||this.isLoading)return;this.didInitFromUrl=!0;let{m:t,d:i,t:n,sdv:r,sa:s,sca:l,vf:a}=e.query;if("string"==typeof t&&t&&this.valueQuestions.some(e=>e.id===t)&&(this.selectedMeasureId=t),"string"==typeof i&&i&&(this.selectedDimensions=i.split(",")),"string"==typeof n&&n){let e=n.split(",");1===e.length?this.timeFilter=[parseInt(e[0],10)]:2===e.length&&(this.timeFilter=[parseInt(e[0],10),parseInt(e[1],10)]),this.userSetTimeFilter=!0}if("string"==typeof r&&r)try{this.selectedDimensionValues=JSON.parse(r)}catch(e){console.error("Could not parse selectedDimensionValues:",e)}"string"==typeof s&&s&&(this.selectedAnswers=s.split(",")),"string"==typeof l&&l&&(this.selectedCombinedAnswers=l.split(",")),"string"==typeof a&&a&&(this.visualisationFilter=a),this.selectedMeasureId&&this.openQuestion(this.selectedMeasureId,!0)}async openQuestion(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];(0,ez.z)(()=>{this.isLoadingQuestionData=!0,this.error=null});try{let{metaData:i,surveyData:n}=await eO(e,this.selectedDimensions);(0,ez.z)(()=>
1{if(this.selectedMeasureId=e,t||(this.selectedAnswers=[],this.selectedCombinedAnswers=[]),t||(this.timeFilter=[],this.userSetTimeFilter=!1),this.questionMetaData=i,this.groupedData=n,!0===window.DEBUG_SOM&&console.log(i.combinedAnswers.length>0?"\uD83D\uDD17 Has combined answers":"\uD83D\uDCDD No combined answers",{questionId:e,combinedAnswersCount:i.combinedAnswers.length}),!t){if(i.combinedAnswers.length>0)this.selectedAnswers=[],this.selectedCombinedAnswers=i.combinedAnswers.map(e=>e.id);else{let e="item_JVI97MT3kq";i.answers.some(t=>t.id===e)?this.selectedAnswers=[e]:this.selectedAnswers=[],this.selectedCombinedAnswers=[]}}})}catch(e){(0,ez.z)(()=>{this.error=e})}finally{(0,ez.z)(()=>{this.isLoadingQuestionData=!1})}}async refreshData(){if(this.selectedMeasureId){(0,ez.z)(()=>{this.isLoadingQuestionData=!0});try{let{metaData:e,surveyData:t}=await eO(this.selectedMeasureId,this.selectedDimensions);(0,ez.z)(()=>{if(this.questionMetaData=e,this.groupedData=t,this.groupedData.length>0){let e=Math.min(...this.groupedData.map(e=>e.survey_year)),t=Math.max(...this.groupedData.map(e=>e.survey_year));if(1===this.timeFilter.length){let i=this.timeFilter[0],n=Math.max(e,Math.min(t,i));n!==i&&(this.timeFilter=[n],this.userSetTimeFilter=!0)}else if(2===this.timeFilter.length){let[i,n]=this.timeFilter,r=Math.max(e,Math.min(t,i)),s=Math.max(e,Math.min(t,n)),l=[Math.min(r,s),Math.max(r,s)];(l[0]!==i||l[1]!==n)&&(this.timeFilter=l,this.userSetTimeFilter=!0)}}})}catch(e){(0,ez.z)(()=>{this.error=e})}finally{(0,ez.z)(()=>{this.isLoadingQuestionData=!1})}}}async setDimensionsAllRespondents(e){if(e&&this.selectedMeasureId){(0,ez.z)(()=>{this.isLoadingQuestionData=!0});try{let{metaData:e,surveyData:t}=await eO(this.selectedMeasureId,[]);(0,ez.z)(()=>{this.selectedDimensions=[],this.selectedDimensionValues={},this.questionMetaData=e,this.groupedData=t})}catch(e){(0,ez.z)(()=>{this.error=e})}finally{(0,ez.z)(()=>{this.isLoadingQuestionData=!1})}}}async changeDimension(e,t){if(t){let t=[e],i={},n=this.backgroundQuestions.find(t=>t.id===e);if(n){let t=this.answers.filter(e=>e.answer_set===n.uses_answer_set);t.length>0&&(i[e]=t[0].id)}if(this.selectedMeasureId){(0,ez.z)(()=>{this.isLoadingQuestionData=!0});try{let{metaData:e,surveyData:n}=await eO(this.selectedMeasureId,t);(0,ez.z)(()=>{this.selectedDimensions=t,this.selectedDimensionValues=i,this.questionMetaData=e,this.groupedData=n})}catch(e){(0,ez.z)(()=>{this.error=e})}finally{(0,ez.z)(()=>{this.isLoadingQuestionData=!1})}}}else if(!t){let t=this.selectedDimensions.filter(t=>t!==e),i={...this.selectedDimensionValues};if(delete i[e],this.selectedMeasureId){(0,ez.z)(()=>{this.isLoadingQuestionData=!0});try{let{metaData:e,surveyData:n}=await eO(this.selectedMeasureId,t);(0,ez.z)(()=>{this.selectedDimensions=t,this.selectedDimensionValues=i,this.questionMetaData=e,this.groupedData=n})}catch(e){(0,ez.z)(()=>{this.error=e})}finally{(0,ez.z)(()=>{this.isLoadingQuestionData=!1})}}}}setDimensionValue(e,t){this.selectedDimensionValues[e]=t,this.refreshData()}async setAnswers(e,t){t?this.selectedAnswers.push(e):this.selectedAnswers=this.selectedAnswers.filter(t=>t!==e)}async setCombinedAnswers(e,t){t?this.selectedCombinedAnswers.push(e):this.selectedCombinedAnswers=this.selectedCombinedAnswers.filter(t=>t!==e)}setSearchQuery(e){this.searchQuery=e}setVisualisationFilter(e){this.timeFilter=[],this.userSetTimeFilter=!1,this.visualisationFilter=e}setTimeFilter(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=e=>{let t="string"==typeof e?parseInt(e,10):e;return Number.isFinite(t)?t:null},n=[];if(Array.isArray(e)){if(1===e.length){let t=i(e[0]);n=null!=t?[t]:[]}else if(2===e.length){let t=i(e[0]),r=i(e[1]);n=null!=t&&null!=r?[t,r]:[]}}JSON.stringify(this.timeFilter)!==JSON.stringify(n)&&(this.timeFilter=n,this.userSetTimeFilter=t)}setChartImageData(e){this.chartImageData=e}get hasAnswerData(){return this.questionMetaData.answers.length>0}get availableAnswers(){var e;return null!==(e=this.questionMetaData.answers)&&void 0!==e?e:[]}get availableCombinedAnswers(){var e;return null!==(e=this.questionMetaData.combinedAnswers)&&void 0!==e?e:[]}getAnswerById(e){return this.questionMetaData.answers.find(t=>
1t.id===e)}getCombinedAnswerById(e){return this.questionMetaData.combinedAnswers.find(t=>t.id===e)}isAnswerSelected(e){return this.selectedAnswers.includes(e)}isCombinedAnswerSelected(e){return this.selectedCombinedAnswers.includes(e)}get currentAnswerSetId(){var e;if(!this.selectedMeasureId)return null;let t=this.valueQuestions.find(e=>e.id===this.selectedMeasureId);return null!==(e=null==t?void 0:t.uses_answer_set)&&void 0!==e?e:null}async refreshAnswerData(){if(!this.selectedMeasureId)return;let e=this.valueQuestions.find(e=>e.id===this.selectedMeasureId);if(e){(0,ez.z)(()=>{this.isLoadingQuestionData=!0});try{let t=await eU(e);(0,ez.z)(()=>{this.questionMetaData=t})}catch(e){(0,ez.z)(()=>{this.error=e})}finally{(0,ez.z)(()=>{this.isLoadingQuestionData=!1})}}}get filteredQuestions(){let e=this.searchQuery.trim();if(!e)return[];let t=e.toLowerCase();return this.valueQuestions.filter(e=>{var i,n;return(null!==(i=e.name)&&void 0!==i?i:"").toLowerCase().includes(t)||(null!==(n=e.id)&&void 0!==n?n:"").toLowerCase().includes(t)})}get treeData(){return[...this.valueQuestionCategories].sort((e,t)=>e.name.localeCompare(t.name,"sv-SE")).filter(e=>this.valueQuestions.some(t=>{var i;return(null!==(i=t.question_category)&&void 0!==i?i:"")===e.id})).map(e=>{var t,i;let n=this.valueQuestions.filter(t=>{var i;return(null!==(i=t.question_category)&&void 0!==i?i:"")===e.id});return{title:"".concat((i=e.name)?i.toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):""," (").concat(n.length,")"),key:e.id,icon:null!==(t=e.icon)&&void 0!==t?t:"FaQuestionCircle",children:n.map(e=>{var t;return{title:null!==(t=e.name)&&void 0!==t?t:"Unnamed Question",key:e.id,isLeaf:!0}})}})}get filteredData(){if(!this.groupedData||0===this.groupedData.length)return[];let e=this.groupedData;return(this.selectedDimensions.length>0||Object.keys(this.selectedDimensionValues).length>0)&&(e=e.filter(e=>this.selectedDimensions.every((t,i)=>{let n=this.selectedDimensionValues[t];return!n||e["dimension".concat(i+1)]===n}))),(this.selectedAnswers.length>0||this.selectedCombinedAnswers.length>0)&&(e=e.filter(e=>this.selectedAnswers.includes(e.answer)||this.selectedCombinedAnswers.includes(e.answer))),this.questionMetaData.answers.length>0&&(e=[...e].sort((e,t)=>this.questionMetaData.answers.findIndex(t=>t.id===e.answer)-this.questionMetaData.answers.findIndex(e=>e.id===t.answer))),e}get enrichedFilteredData(){if(0===this.filteredData.length||0===this.questionMetaData.answers.length&&0===this.questionMetaData.combinedAnswers.length)return this.filteredData;let e=new Map;this.questionMetaData.answers.forEach(t=>{var i;return e.set(t.id,null!==(i=t.name)&&void 0!==i?i:t.id)}),this.questionMetaData.combinedAnswers.forEach(t=>{var i;return e.set(t.id,null!==(i=t.name)&&void 0!==i?i:t.id)});let t=new Map;return this.answers.forEach(e=>{var i;return t.set(e.id,null!==(i=e.name)&&void 0!==i?i:e.id)}),this.filteredData.map(i=>{var n,r;let s={...i,answerName:null!==(r=null!==(n=e.get(i.answer))&&void 0!==n?n:i.answerName)&&void 0!==r?r:i.answer};return this.selectedDimensions.forEach((e,n)=>{var r,l,a,o;let d=String(null!==(l=i["dimension".concat(n+1)])&&void 0!==l?l:""),c=null!==(a=null===(r=this.backgroundQuestions.find(t=>t.id===e))||void 0===r?void 0:r.name)&&void 0!==a?a:"Dimension ".concat(n+1),u=null!==(o=t.get(d))&&void 0!==o?o:d;s[c]=u}),s})}get categoryDimensionLabel(){var e,t,i,n,r,s;if(0===this.selectedDimensions.length)return"Alla respondenter";if(1===this.selectedDimensions.length)return null!==(t=null===(e=this.backgroundQuestions.find(e=>e.id===this.selectedDimensions[0]))||void 0===e?void 0:e.name)&&void 0!==t?t:"Dimension";if(2===this.selectedDimensions.length){let[e,t]=this.selectedDimensions,l=null!==(r=null===(i=this.backgroundQuestions.find(t=>t.id===e))||void 0===i?void 0:i.name)&&void 0!==r?r:"Dimension 1",a=null!==(s=null===(n=this.backgroundQuestions.find(e=>e.id===t))||void 0===n?void 0:n.name)&&void 0!==s?s:"Dimension 2";return"".concat(l,", ").concat(a)}return"V\xe4lj kategorier"}getDimensionName(e){var t,i;return null!==(i=null===(t=this.backgroundQuestions.find(t=>
1t.id===e.slice(0,e.indexOf("-name"))))||void 0===t?void 0:t.name)&&void 0!==i?i:e}get visualisationConfiguration(){var e,t;let i=(()=>{let e="";if(this.selectedMeasureId&&0===this.selectedDimensions.length?e="Alla respondenter":this.selectedDimensions.length>0&&(e=this.selectedDimensions.map(e=>{var t,i;let n=this.selectedDimensionValues[e];if(!n)return"N/A";let r=this.backgroundQuestions.find(t=>t.id===e),s=(null!==(t=null==r?void 0:r.name)&&void 0!==t?t:e).trim(),l=this.answers.find(e=>e.id===n),a=(null!==(i=null==l?void 0:l.name)&&void 0!==i?i:n).trim();return"".concat(s,": ").concat(a)}).join(", ")),this.timeFilter.length){let t=this.timeFilter.filter(e=>Number.isFinite(e));1===t.length?e+=", ".concat(t[0]):2===t.length&&(e+=", ".concat(t[0],"-").concat(t[1]))}return e})(),n=this.groupedData,r=n&&n.length>0?[Math.min(...n.map(e=>e.survey_year)),Math.max(...n.map(e=>e.survey_year))]:[new Date().getFullYear(),new Date().getFullYear()],s=this.timeFilter.length>0?this.enrichedFilteredData.filter(e=>{let t=e.survey_year;return 1===this.timeFilter.length?t===this.timeFilter[0]:2!==this.timeFilter.length||t>=this.timeFilter[0]&&t<=this.timeFilter[1]}):this.enrichedFilteredData,l=Array.from(s.filter(e=>e.sum_count<100).map(e=>e.survey_year.toString()).reduce((e,t)=>e.add(t),new Set)).sort(),a=this.timeFilter.length>0?eR(this.timeFilter.map(String)):[],o=l.filter(e=>a.includes(e)),d=o.length>0,c=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],u={},h=[];this.questionMetaData.answers.forEach((e,t)=>{let i=e.name||e.id,n="answer-".concat(i);u[n]={name:i,color:c[t%c.length]},h.push(n)}),this.questionMetaData.combinedAnswers.forEach((e,t)=>{let i=e.name||e.id,n="compound-".concat(i),r=this.questionMetaData.answers.length+t;u[n]={name:i,color:c[r%c.length]},h.push(n)});let m={chartType:this.visualisationFilter,noData:null,subheader:i+(d?"*":""),timeExtent:[new Date(Date.UTC(r[0],0,1)),new Date(Date.UTC(r[1],0,1))],currentTimeSelection:this.userSetTimeFilter&&this.timeFilter.length>0?1===this.timeFilter.length&&this.timeFilter[0]?[new Date(Date.UTC(this.timeFilter[0],0,1)),new Date(Date.UTC(this.timeFilter[0],0,1))]:2===this.timeFilter.length&&this.timeFilter[0]&&this.timeFilter[1]?[new Date(Date.UTC(this.timeFilter[0],0,1)),new Date(Date.UTC(this.timeFilter[1],0,1))]:void 0:void 0,x:{accessor:"year",scale:"categorical",format:e=>"".concat(e)+(o.includes(String(e))?"*":"")},y:{accessor:"value",format:e=>eV.format(e/100),domain:[0,s.length>0?10*Math.ceil(Math.max(...s.map(e=>e.value))/10):100]},split:"answerName",series:u,seriesOrder:h,data:s.map(e=>{let t=e.answerName;return{...e,year:e.survey_year,answerDisplayName:t,answerName:"".concat(e.answerType,"-").concat(t)}}),availableYears:Array.from(new Set(this.groupedData.map(e=>e.survey_year))).sort((e,t)=>e-t),header:this.selectedMeasureId&&null!==(t=null===(e=this.valueQuestions.find(e=>e.id===this.selectedMeasureId))||void 0===e?void 0:e.name)&&void 0!==t?t:"",footer:[(()=>{let e=this.timeFilter.filter(e=>Number.isFinite(e));return 1===e.length?"K\xe4lla: Den nationella SOM-unders\xf6kningen ".concat(e[0]):2===e.length?"K\xe4lla: Den nationella SOM-unders\xf6kningen ".concat(e[0],"-").concat(e[1]):"K\xe4lla: Den nationella SOM-unders\xf6kningen"})(),d?"* F\xf6r ".concat(eW(o)," \xe4r antalet respondenter f\xf6r l\xe5gt (<").concat(100,") f\xf6r att s\xe4kerst\xe4lla s\xe4kert resultat"):" "].filter(Boolean),table:{style:{rowOddBG:"#F1F6FA"},columns:s&&s.length>0?[{key:"survey_year",title:"\xc5r",dataIndex:"survey_year",sorter:!0},{key:"answerDisplayName",title:"Svarsalternativ",dataIndex:"answerDisplayName",sorter:!0},{key:"value",title:"Procent",dataIndex:"value",sorter:!0},{key:"count",title:"Antal svar",dataIndex:"count",sorter:!0},...Object.keys(s[0]).filter(e=>e.startsWith("property_")&&e.endsWith("-name")).map(e=>({key:e,title:this.getDimensionName(e),dataIndex:e,sorter:!0}))]:[]},animation:!0};return"bar"===this.visualisationFilter&&(m.barchart={orientation:"horizontal"}),m}constructor(){this.valueQuestions=[],this.valueQuestionCategories=[],this.backgroundQuestions=[],this.dimensionGroups=[],this.answers=[],this.combinedAnswers=[],this.questionMetaData={answers:[],combinedAnswers:[]},this.selectedMeasureId=null,this.selectedDimensions=[],this.selectedDimensionValues={},this.selectedAnswers=[],this.selectedCombinedAnswers=[],this.searchQuery="",this.timeFilter=[],this.userSetTimeFilter=!1,this.visualisationFilter="line",this.groupedData=[],this.chartImageData=void 0,this.isLoading=!1,this.isLoadingQuestionData=!1,this.error=null,this.didInitFromUrl=!1,(0,ez.ky)(this)}}var eZ=i(41285);let eY=new eH;var eG=i(20544);let eP=()=>(0,n.jsx)(E.xu,{alignItems:"center",justifyContent:"center",display:"flex",children:(0,n.jsxs)(E.xu,{textAlign:"center",maxWidth:"75%",children:[(0,n.jsx)(E.xu,{maxWidth:"90%",display:"flex",alignItems:"center",position:"relative",transform:"translateX(-50%)",left:"50%",marginBottom:6,children:(0,n.jsx)(eo,{})}),(0,n.jsx)(er.lB,{children:"Ingen fr\xe5ga vald"}),(0,n.jsx)(er.xv,{children:"V\xe4lj en fr\xe5ga ur listan f\xf6r att visualisera den som ett linjediagram, stapeldiagram eller tabell"})]})}),eK=((0,d.Pi)(e=>{var t,i,r,s;let{store:l,visualisationConfig:a}=e,o=(null==a?void 0:a.chartType)||"unknown",d=(null==a?void 0:a.data)||[],c=d.slice(0,3);return(0,n.jsxs)(E.xu,{bg:"gray.50",mt:10,p:4,mb:4,borderRadius:"md",border:"1px solid",borderColor:"gray.200",fontFamily:"monospace",fontSize:"xs",children:[(0,n.jsx)(er.xv,{fontWeight:"bold",mb:2,children:"Store State & Visualization Debug"}),(0,n.jsxs)(er.xv,{children:[(0,n.jsx)("b",{children:"Selected Measure:"})," ",l.selectedMeasureId||"None"]}),(0,n.jsxs)(er.xv,{children:[(0,n.jsx)("b",{children:"Selected Dimensions:"})," ",l.selectedDimensions.join(", ")||"None"]}),(0,n.jsxs)(er.xv,{children:[(0,n.jsx)("b",{children:"Time Filter:"})," ",l.timeFilter.join(" - ")||"None"]}),(0,n.jsxs)(er.xv,{children:[(0,n.jsx)("b",{children:"Answers:"})," ",l.questionMetaData.answers.length]}),(0,n.jsxs)(er.xv,{children:[(0,n.jsx)("b",{children:"Grouped Data Rows:"})," ",l.groupedData.length]}),(0,n.jsxs)(er.xv,{children:[(0,n.jsx)("b",{children:"Filtered Data Rows:"})," ",l.filteredData.length]}),(0,n.jsxs)(er.xv,{children:[(0,n.jsx)("b",{children:"Enriched Data Rows:"})," ",l.enrichedFilteredData.length]}),(0,n.jsxs)(E.xu,{mt:3,pt:3,borderTop:"1px solid",borderColor:"gray.300",children:[(0,n.jsx)(er.xv,{fontWeight:"bold",mb:2,children:"Current Visualization"}),(0,n.jsxs)(er.xv,{children:[(0,n.jsx)("b",{children:"Current Selected View:"})," [",o,"]"]}),(0,n.jsxs)(er.xv,{children:[(0,n.jsx)("b",{children:"Chart Data Points:"})," ",d.length]}),c.length>0&&(0,n.jsxs)(E.xu,{mt:2,children:[(0,n.jsxs)(er.xv,{fontWeight:"bold",mb:1,children:["Data Structure Sample (first ",c.length," items):"]}),(0,n.jsx)(E.xu,{as:"pre",fontSize:"10px",bg:"gray.100",p:2,borderRadius:"sm",overflow:"auto",maxHeight:"200px",whiteSpace:"pre-wrap",children:JSON.stringify(c,null,2)}),(0,n.jsxs)(E.xu,{mt:2,p:2,bg:"yellow.50",borderRadius:"sm",children:[(0,n.jsx)(er.xv,{fontWeight:"bold",fontSize:"xs",mb:1,children:"\uD83D\uDD0D Chart Debug Info:"}),(0,n.jsxs)(er.xv,{fontSize:"10px",children:[(0,n.jsx)("b",{children:"Chart Type:"})," ",o,(0,n.jsx)("br",{}),(0,n.jsx)("b",{children:"X Accessor:"})," ",null==a?void 0:null===(t=a.x)||void 0===t?void 0:t.accessor,(0,n.jsx)("br",{}),(0,n.jsx)("b",{children:"X Scale:"})," ",null==a?void 0:null===(i=a.x)||void 0===i?void 0:i.scale,(0,n.jsx)("br",{}),(0,n.jsx)("b",{children:"Split Field:"})," ",null==a?void 0:a.split,(0,n.jsx)("br",{}),(0,n.jsx)("b",{children:"Data Length:"})," ",d.length,(0,n.jsx)("br",{}),(0,n.jsx)("b",{children:"Series Count:"})," ",Object.keys((null==a?void 0:a.series)||{}).length,(0,n.jsx)("br",{}),(0,n.jsx)("b",{children:"Sample X Values:"})," ",(null==a?void 0:null===(r=a.x)||void 0===r?void 0:r.accessor)?d.slice(0,3).map(e=>"".concat(e[a.x.accessor]," (").concat(typeof e[a.x.accessor],")")).join(", "):"N/A",(0,n.jsx)("br",{}),(0,n.jsx)("b",{children:"Sample Y Values:"})," ",(null==a?void 0:null===(s=a.y)||void 0===s?void 0:s.accessor)?d.slice(0,3).map(e=>"".concat(e[a.y.accessor]," (").concat(typeof e[a.y.accessor],")")).join(", "):"N/A",(0,n.jsx)("br",{}),(0,n.jsx)("b",{children:"Sample Split Values:"})," ",(null==a?void 0:a.split)?d.slice(0,3).map(e=>'"'.concat(e[a.split],'"')).join(", "):"N/A"]})]})]}),d.length>0&&(0,n.jsxs)(E.xu,{mt:2,children:[(0,n.jsx)(er.xv,{fontWeight:"bold",mb:1,children:"Data Keys Available:"}),(0,n.jsx)(er.xv,{fontSize:"10px",color:"gray.600",children:Object.keys(d[0]||{}).join(", ")})]})]})]})}),(0,d.Pi)(e=>{let{embedMode:t=!1}=e,{store:i}=((0,o.useEffect)(()=>{eY.valueQuestions.length||eY.isLoading||eY.bootstrap()},[]),function(e){let t=(0,eZ.useRouter)(),i=(0,o.useRef)(!1);(0,o.useEffect)(()=>{!t.isReady||e.isLoading||i.current||(i.current=!0,e.initFromUrl(t))},[t.isReady,e.isLoading,t,e]),(0,o.useEffect)(()=>
1{if(t.isReady)return(0,ez.U5)(()=>({m:e.selectedMeasureId,d:e.selectedDimensions.join(","),t:e.timeFilter.map(e=>Number.isFinite(e)?String(e):"").filter(Boolean).join(","),u:e.userSetTimeFilter,sdv:JSON.stringify(e.selectedDimensionValues),sa:e.selectedAnswers.join(","),sca:e.selectedCombinedAnswers.join(","),vf:e.visualisationFilter,init:i.current}),()=>{i.current&&e.updateUrl(t)},{fireImmediately:!1,equals:(e,t)=>e.m===t.m&&e.d===t.d&&e.t===t.t&&e.u===t.u&&e.sdv===t.sdv&&e.sa===t.sa&&e.sca===t.sca&&e.vf===t.vf&&e.init===t.init})},[t.isReady,t,e])}(eY),{store:eY}),r={...i.visualisationConfiguration,noData:(0,n.jsx)(eP,{})},{isOpen:s,onOpen:l,onClose:a}=(0,eG.qY)(),{isOpen:d,onOpen:c,onClose:m}=(0,eG.qY)(),g={chartTypes:[{icon:ed.lD$,value:"line",label:"Linjediagram"},{icon:ed.tvd,value:"bar",label:"Stapeldiagram"},{icon:ed.$eq,value:"table",label:"Tabell"}],explorerHeight:t?600:770},x=i.valueQuestions.find(e=>e.id===i.selectedMeasureId);if(t){let e={...r,hideSlider:!0,footer:void 0,animation:!1};return(0,n.jsxs)(E.xu,{fontFamily:u().style.fontFamily,position:"relative",className:i.isLoadingQuestionData?"":"chart-ready",children:[(0,n.jsx)("img",{src:"/images/custom-blocks/som/som-log-rectangle.svg",alt:"SOM-institutet",style:{position:"absolute",top:"0",right:"0",width:"283px",height:"54px",zIndex:10}}),(0,n.jsx)(E.xu,{children:(0,n.jsx)(ea,{visualisationConfiguration:e,height:g.explorerHeight,loading:i.isLoadingQuestionData,styling:{visualisation:{borderColor:"transparent",padding:"0px",borderRadius:"0px",sliderColor:h.O9.red[500],sliderBoxBorderColor:h.O9.gray[100],fontFamily:u().style.fontFamily,color:h.O9.textDark}}})}),x&&(0,n.jsxs)(E.xu,{mt:2,children:[(0,n.jsxs)(er.OM,{color:"gray.800",children:["K\xe4lla: Den nationella SOM-unders\xf6kningen"," ",r.availableYears&&r.availableYears.length>0?"".concat(Math.min(...r.availableYears),"-").concat(Math.max(...r.availableYears)):""]}),x.question_detail&&(0,n.jsxs)(er.OM,{color:"gray.800",children:["Fr\xe5gan lyder: ",x.question_detail||""]}),x.som_comment&&(0,n.jsxs)(er.OM,{color:"gray.800",children:["Kommentar: $",x.som_comment||""]})]})]})}return(0,n.jsx)(E.kC,{justifyContent:"center",children:(0,n.jsx)(E.xu,{maxWidth:"1248px",width:"100%",children:(0,n.jsxs)(E.xu,{w:"100%",padding:4,fontFamily:u().style.fontFamily,children:[(0,n.jsx)(ea,{onTimeFilterChange:e=>{let t=e.map(e=>parseInt(e.replace("*",""),10));i.setTimeFilter(t)},chartImageDataCb:e=>i.setChartImageData(e),visualisationConfiguration:r,height:g.explorerHeight,loading:i.isLoadingQuestionData,top:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(E.xu,{mb:4,display:["block","block","none"],children:[(0,n.jsx)(ec.zx,{width:"100%",onClick:l,colorScheme:"red",leftIcon:(0,n.jsx)(ed.JZr,{}),flex:"1",children:"V\xe4lj fr\xe5gest\xe4llning"}),(0,n.jsx)(ec.zx,{borderWidth:"1px",width:"100%",variant:"outline",onClick:c,colorScheme:"red",leftIcon:(0,n.jsx)(ed.ewm,{}),flex:"1",mt:3,children:"Diagraminst\xe4llningar"})]}),(0,n.jsx)(E.xu,{display:["none","none","block"],children:(0,n.jsx)(ek,{questionMetaData:i.questionMetaData,selectedDimensions:i.selectedDimensions,selectedDimensionValues:i.selectedDimensionValues,backgroundQuestions:i.backgroundQuestions,answers:i.answers,dimensionGroups:i.dimensionGroups,selectedAnswers:i.selectedAnswers,selectedCombinedAnswers:i.selectedCombinedAnswers,visualisationFilter:i.visualisationFilter,onAllRespondents:e=>i.setDimensionsAllRespondents(e.target.checked),onDimensionChange:e=>i.changeDimension(e.target.value,e.target.checked),onDimensionValueChange:(e,t)=>
1i.setDimensionValue(e,t),onAnswerChange:e=>i.setAnswers(e.target.value,e.target.checked),onCombinedAnswerChange:e=>i.setCombinedAnswers(e.target.value,e.target.checked),onVisualisationFilterChange:e=>i.setVisualisationFilter(e),getCategoryDimensionLabel:()=>i.categoryDimensionLabel})})]}),left:(0,n.jsx)(E.xu,{display:["none","none","block"],children:(0,n.jsx)(eM,{error:i.error,loading:!1,searchQuery:i.searchQuery,filteredQuestions:i.filteredQuestions,treeData:i.treeData,onSearchChange:e=>i.setSearchQuery(e),onSelectMeasure:e=>i.openQuestion(e,!1),selectedMeasureId:i.selectedMeasureId})}),visualisationFooter:i.selectedMeasureId&&(0,n.jsx)(ex,{question:i.valueQuestions.find(e=>e.id===i.selectedMeasureId),theme:{chart:{borderColor:h.O9.border}},csvData:i.enrichedFilteredData}),styling:{top:{background:h.O9.gray[50],padding:"16px",borderRadius:"8px"},left:{background:h.O9.gray[50],padding:"0px",borderRadius:"8px"},visualisation:{borderColor:h.O9.border,padding:"16px",borderRadius:"8px",sliderColor:h.O9.red[500],sliderBoxBorderColor:h.O9.gray[100],fontFamily:u().style.fontFamily,color:h.O9.textDark}}}),!1,(0,n.jsx)(eI,{isQuestionModalOpen:s,isSettingsModalOpen:d,onQuestionModalClose:a,onSettingsModalClose:m,error:i.error,loading:!1,searchQuery:i.searchQuery,filteredQuestions:i.filteredQuestions,treeData:i.treeData,onSearchChange:e=>i.setSearchQuery(e),onSelectMeasure:e=>i.openQuestion(e,!1),selectedMeasureId:i.selectedMeasureId,questionMetaData:i.questionMetaData,selectedDimensions:i.selectedDimensions,selectedDimensionValues:i.selectedDimensionValues,backgroundQuestions:i.backgroundQuestions,answers:i.answers,dimensionGroups:i.dimensionGroups,selectedAnswers:i.selectedAnswers,selectedCombinedAnswers:i.selectedCombinedAnswers,visualisationFilter:i.visualisationFilter,onAllRespondents:e=>i.setDimensionsAllRespondents(e.target.checked),onDimensionChange:e=>i.changeDimension(e.target.value,e.target.checked),onDimensionValueChange:(e,t)=>
1i.setDimensionValue(e,t),onAnswerChange:e=>i.setAnswers(e.target.value,e.target.checked),onCombinedAnswerChange:e=>i.setCombinedAnswers(e.target.value,e.target.checked),onVisualisationFilterChange:e=>i.setVisualisationFilter(e),getCategoryDimensionLabel:()=>i.categoryDimensionLabel})]})})})})),e$=e=>{let{embedMode:t=!1}=e;return t?(0,n.jsx)(h.f6,{children:(0,n.jsx)(E.xu,{id:"som-chart-container",w:"1180px",bg:"white",p:4,children:(0,n.jsx)(eK,{embedMode:!0})})}):(0,n.jsxs)(h.f6,{children:[(0,n.jsxs)(E.xu,{w:"100%",id:"readspeaker-container",children:[(0,n.jsx)(a.H,{}),(0,n.jsx)(E.Ug,{w:"100%",textAlign:"center",justifyContent:"center",bg:"gray.50",children:(0,n.jsxs)(E.gC,{maxW:"container.md",px:["sm","md"],pt:["md","lg"],pb:["lg","lg"],children:[(0,n.jsx)(er.lB,{fontWeight:"700",fontSize:["32px","56px","64px"],lineHeight:["140%"],children:"Analysverktyg"}),(0,n.jsx)(er.xv,{fontWeight:"400",fontSize:["16px","18px","20px"],lineHeight:["140%"],children:"Visualisera 600 variabler som linjediagram, stapeldiagram eller tabell. Filtrera p\xe5 ett stort antal relevanta bakgrundsfaktorer, redigera svarsalternativ f\xf6r att d\xf6lja vissa svar eller kombinera liknande svar f\xf6r att tydligg\xf6ra intressanta m\xf6nster."})]})}),(0,n.jsx)(eK,{}),(0,n.jsx)(l.n,{})]}),(0,n.jsx)(s(),{src:"https://cdn-eu.readspeaker.com/script/9467/webReader/webReader.js?pids=wr",id:"rs_req_Init"}),(0,n.jsx)(s(),{id:"readspeaker-config",children:"window.rsConf = { general: {usePost: true}}"})]})}},62260:function(e,t,i){i.d(t,{O9:function(){return h},f6:function(){return x}});var n=i(34287),r=i(18248),s=i.n(r),l=i(51014),a=i.n(l),o=i(43081),d=i(12009),c=i(91350),u=i(89853);let h={somBlue:"#004B89",darkBlue:"#24273A",red:{50:"#ffe5ef",100:"#ffb3cf",200:"#ff80af",300:"#ff4d8f",400:"#ff1a70",500:"#E2005E",600:"#c40452",700:"#a10046",800:"#8B0939",900:"#4f001e"},gray:{50:"#F8F8F8",100:"#E8E8EA",200:"#D2D1D6",300:"#BBBAC1",400:"#A5A3AD",500:"#8E8B98",600:"#787484",700:"#625D70",800:"#4B465B",900:"#352F47"},dark:"#322f37",text:"#242731",textDark:"#1E1832",textLight:"#A5A3AD",border:"#E8E8EA",textChart:"#242731",chart:{categorical:["#00325B","#004B89","#00D5FF","#419DDA","#532600","#5C7AFB","#94D3FF","#984807","#DA6300","#FAC090","#FF912B","#FFBD00"]}},m={...o.rS,colors:{...o.rS.colors,red:h.red,primary:h.red},fonts:{body:s().style.fontFamily,heading:a().style.fontFamily,mono:"IBM Plex Mono, Menlo, monospace"}},g={...d.P,token:{...d.P.token,fontFamily:s().style.fontFamily,colorPrimary:h.red[500]},components:{Table:{borderRadius:0,headerBorderRadius:0,headerColor:"#242731",headerBg:"#F1F6FA",colorText:"#000000"}}},x=e=>{let{children:t}=e;return(0,n.jsx)(c.xjn,{theme:m,children:(0,n.jsx)(u.ZP,{theme:g,children:t})})}},72087:function(e,t,i){i.d(t,{J:function(){return o}});var n=i(34287),r={src:"/_next/static/media/datastory-powered-by.f96916db.svg",height:35,width:93,blurWidth:0,blurHeight:0},s={src:"/_next/static/media/datastory-powered-by-white.5c151028.svg",height:37,width:102,blurWidth:0,blurHeight:0},l=i(80534),a=i(51879);let o=e=>{let{white:t,...i}=e;return(0,n.jsx)(l.r,{href:"https://datastory.tech/",target:"_blank",rel:"noopener",children:(0,n.jsx)(a.E,{src:t?s:r,alt:"Powered by Datastory",width:93,height:34,...i})})}},1436:function(e,t,i){i.d(t,{Ee:function(){return l}});var n=i(34287);i(70040);var r=i(86076),s=i(96797);let l=(0,r.Gp)((e,t)=>{let{...i}=e,{customComponents:{radioGroup:l}}=(0,r.Fg)(),{colorScheme:a}=l;return(0,n.jsx)(s.Ee,{colorScheme:a,ref:t,...i})})},57289:function(e,t,i){i.d(t,{i:function(){return d}});var n=i(34287),r=i(65254),s=i(70040),l=i(43536);let a=e=>(t,i)=>{let n=t[e],r=i[e];return null==n?1:null==r?-1:n instanceof Date&&r instanceof Date?n.getTime()-r.getTime():"string"==typeof n&&"string"==typeof r?n.localeCompare(r):"number"==typeof n&&"number"==typeof r?n-r:String(n).localeCompare(String(r))},o={showSorterTooltip:!1,column:{sortDirections:["ascend","descend",null]},pagination:{position:["bottomCenter"],defaultPageSize:25}},d=(0,s.forwardRef)((e,t)=>{let{columns:i,...s}=e,d=(0,l.Z)(o,s),c=i;return void 0===s.loading&&(c=null==i?void 0:i.map(e=>(!0===e.sorter&&"dataIndex"in e&&(e.sorter=a(e.dataIndex)),e))),(0,n.jsx)(r.Z,{ref:t,columns:c,...d})});d.displayName="Table"},88002:function(e,t,i){i.d(t,{m:function(){return o}});var n=i(59499),r=i(34287),s=i(23928),l=i(41227);function a(){let e=(0,n._)(["\n            @media (min-width: 62em) {\n              .ant-tabs-nav-wrap {\n                justify-content: center;\n              }\n            }\n          "]);return a=function(){return e},e}let o=e=>{let{centered:t,...i}=e;return(0,r.jsxs)(r.Fragment,{children:[t&&(0,r.jsx)(l.xB,{styles:(0,l.iv)(a())}),(0,r.jsx)(s.Z,{...i})]})}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.