@glycanage/web-components 1.220.0 → 1.221.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{c as Y,S as J,i as K,f as Q,s as U,e as L,b as O,n as t,p as j,g as q,q as C,u as B,k as W,o as _,A as tt}from"./index2.js";import{g as et}from"./globals.js";import{h as N}from"./helpers.js";const{document:it}=et;function st(T){let e,f,b,s,A,o,i,g;return{c(){e=L("div"),f=L("div"),b=O(),s=L("div"),s.textContent="Chronological age",A=O(),o=L("div"),o.textContent="Biological age",i=O(),g=L("link"),t(f,"width","100%"),t(f,"height","100%"),t(s,"position","absolute"),t(s,"bottom","6px"),t(s,"left","50%"),t(s,"transform","translateX(-50%)"),t(s,"font-family","Sen, sans-serif"),t(s,"font-size","12px"),t(s,"color","#09341F"),t(s,"opacity","0.8"),t(o,"position","absolute"),t(o,"top","50%"),t(o,"right","88%"),t(o,"transform","translateY(-50%) rotate(-90deg)"),t(o,"font-family","Sen, sans-serif"),t(o,"font-size","12px"),t(o,"color","#09341F"),t(o,"opacity","0.8"),t(o,"white-space","nowrap"),t(e,"width","100%"),t(e,"height","100%"),t(e,"position","relative"),t(e,"border","1px solid #09341F33"),t(e,"border-radius","10px"),j(g,"href","https://fonts.googleapis.com/css2?family=Sen:wght@400..800&display=swap"),j(g,"rel","stylesheet")},m(n,x){q(n,e,x),C(e,f),T[2](f),C(e,b),C(e,s),C(e,A),C(e,o),q(n,i,x),C(it.head,g)},p:B,i:B,o:B,d(n){n&&(W(e),W(i)),T[2](null),W(g)}}}function ot(T,e,f){let{service:b=window.GaReportService}=e,s,A,o=[],i={},g="",n=0,x=0,p=0,S;function G(){S&&(i=echarts.init(S,null,{devicePixelRatio:4,renderer:"svg"}));const a=S.getBoundingClientRect();var d={textStyle:{fontFamily:"Sen, sans serif"},animation:!1,backgroundColor:"transparent",grid:{top:"15px",left:"50px",right:"45px",bottom:"45px"},dataset:[{source:A.data.map(r=>[r.x,r.y])}],tooltip:{show:!1},xAxis:{min:10,max:90,interval:10,nameTextStyle:{color:"#09341F",opacity:.8},axisLine:{show:!1,lineStyle:{color:"#09341F",opacity:.1},symbol:["none","arrow"],symbolSize:[5,10],symbolOffset:[8]},axisTick:{show:!1},axisLabel:{show:!0,color:"#09341F",opacity:.8,formatter(r){return r===0||r===100?"":r}},splitLine:{show:!0}},yAxis:{min:15,max:85,nameTextStyle:{color:"#09341F",opacity:.8},axisLine:{show:!1,lineStyle:{color:"#09341F",opacity:.1},symbol:["none","arrow"],symbolSize:[5,10],symbolOffset:[5]},axisTick:{show:!1},axisLabel:{show:!1,color:"#09341F",opacity:.8,formatter(r){return r===0||r===.6?"":r}},splitLine:{show:!0}},series:[{type:"scatter",tooltip:{},symbolSize:4,itemStyle:{color:"#09341F",opacity:.15,borderWidth:1,lineWidth:12}}],graphic:[]};i.setOption(d);const y=10,H=6,w=2,M=1.5,h=1.5,I=N(p);{const r=i.convertToPixel("xAxis",n),m=i.convertToPixel("yAxis",15),k=i.convertToPixel("yAxis",x),P=Math.abs(k-m),R=k<m?-1:1;let c=0;for(;c<P;){const v=Math.min(y,P-c),$=R===-1?m-c-v:m+c;d.graphic.push({type:"rect",zlevel:10,shape:{x:r-w/2-h,y:$-h,width:w+h*2,height:v+h*2,r:M+h},style:{fill:"#FFFFFF"},z:14}),d.graphic.push({type:"rect",zlevel:10,shape:{x:r-w/2,y:$,width:w,height:v,r:M},style:{fill:I},z:15}),c+=y+H}}{const r=i.convertToPixel("yAxis",x),m=i.convertToPixel("xAxis",10),k=i.convertToPixel("xAxis",n),P=Math.abs(k-m),R=k>m?1:-1;let c=0;for(;c<P;){const v=Math.min(y,P-c),$=R===1?m+c:m-c-v;d.graphic.push({type:"rect",zlevel:10,shape:{x:$-h,y:r-w/2-h,width:v+h*2,height:w+h*2,r:M+h},style:{fill:"#FFFFFF"},z:14}),d.graphic.push({type:"rect",zlevel:10,shape:{x:$,y:r-w/2,width:v,height:w,r:M},style:{fill:I},z:15}),c+=y+H}}d.graphic.push({name:"Measured result",type:"circle",zlevel:10,shape:{cx:i.convertToPixel("xAxis",n),cy:i.convertToPixel("yAxis",x),r:6},style:{fill:N(p),stroke:"#FFFFFF",lineWidth:2},z:15});const V=i.convertToPixel("xAxis",n),Z=i.convertToPixel("yAxis",x),l=document.createElementNS("http://www.w3.org/2000/svg","svg"),u=document.createElement("div");l.setAttribute("width","75"),l.setAttribute("height","36"),l.setAttribute("viewBox","-2 -2 75 36"),l.setAttribute("fill","none"),l.setAttribute("xmlns","http://www.w3.org/2000/svg");const z=document.createElementNS("http://www.w3.org/2000/svg","path");z.setAttribute("d","M7 4C7 1.79086 8.79086 0 11 0H67C69.2091 0 71 1.79086 71 4V28C71 30.2091 69.2091 32 67 32H11C8.79086 32 7 30.2091 7 28V4Z"),z.setAttribute("fill",N(p)),z.setAttribute("stroke","#FFFFFF"),z.setAttribute("stroke-width","4"),z.setAttribute("paint-order","stroke");const F=document.createElementNS("http://www.w3.org/2000/svg","path");F.setAttribute("d","M7 10L1.13333 14.4C0.0666666 15.2 0.0666666 16.8 1.13333 17.6L7 22"),F.setAttribute("fill","none"),F.setAttribute("stroke","#FFFFFF"),F.setAttribute("stroke-width","2.5"),F.setAttribute("stroke-linejoin","round"),F.setAttribute("stroke-linecap","round");const E=document.createElementNS("http://www.w3.org/2000/svg","path");E.setAttribute("d","M1.13333 17.6C0.0666666 16.8 0.0666666 15.2 1.13333 14.4L7 10L7 22L1.13333 17.6Z"),E.setAttribute("fill",N(p)),l.appendChild(F),l.appendChild(z),l.appendChild(E),l.style.position="absolute",l.style.left=`${a.left+V+8}px`,l.style.top=`${a.top+Z-17}px`,l.style.zIndex="8",u.innerText=`${Number.parseFloat(p)} pct`,u.style.position="absolute",u.style.left=`${a.left+V+26}px`,u.style.top=`${a.top+Z-10}px`,u.style.font="bold 16px sans-serif",u.style.color="white",u.style.zIndex="999",u.style.fontFamily="Sen",document.body.appendChild(u),document.body.appendChild(l),i.setOption(d)}_(async()=>{s=await b.getReport(),g=s.sex,A=await b.getAgeData(g),n=Number(s.chronologicalage),x=Number(s.glycanage),o=A.data.filter(y=>y.x>=n-5&&y.x<=n+5);let a=o.filter(y=>y.y<x).length,d=o.length;p=Math.round(a/d*100),(p===100||p===0)&&(p=p===100?99:1),G()});function X(a){tt[a?"unshift":"push"](()=>{S=a,f(0,S)})}return T.$$set=a=>{"service"in a&&f(1,b=a.service)},[S,b,X]}class D extends J{constructor(e){super(),K(this,e,ot,st,U,{service:1})}get service(){return this.$$.ctx[1]}set service(e){this.$$set({service:e}),Q()}}customElements.define("ga-biological-age-rank-scatter",Y(D,{service:{}},[],[],!1));export{D as default};
1
+ import{c as Y,S as J,i as K,f as Q,s as U,e as L,b as O,n as t,p as Z,g as j,q as z,u as B,k as G,o as _,A as tt}from"./index2.js";import{g as et}from"./globals.js";import{h as N}from"./helpers.js";const{document:it}=et;function st(T){let e,f,b,s,A,o,i,g;return{c(){e=L("div"),f=L("div"),b=O(),s=L("div"),s.textContent="Chronological age",A=O(),o=L("div"),o.textContent="Biological age",i=O(),g=L("link"),t(f,"width","100%"),t(f,"height","100%"),t(s,"position","absolute"),t(s,"bottom","6px"),t(s,"left","50%"),t(s,"transform","translateX(-50%)"),t(s,"font-family","Sen, sans-serif"),t(s,"font-size","12px"),t(s,"color","#09341F"),t(s,"opacity","0.8"),t(o,"position","absolute"),t(o,"top","50%"),t(o,"right","88%"),t(o,"transform","translateY(-50%) rotate(-90deg)"),t(o,"font-family","Sen, sans-serif"),t(o,"font-size","12px"),t(o,"color","#09341F"),t(o,"opacity","0.8"),t(o,"white-space","nowrap"),t(e,"width","100%"),t(e,"height","100%"),t(e,"position","relative"),t(e,"border","1px solid #09341F33"),t(e,"border-radius","10px"),Z(g,"href","https://fonts.googleapis.com/css2?family=Sen:wght@400..800&display=swap"),Z(g,"rel","stylesheet")},m(n,x){j(n,e,x),z(e,f),T[2](f),z(e,b),z(e,s),z(e,A),z(e,o),j(n,i,x),z(it.head,g)},p:B,i:B,o:B,d(n){n&&(G(e),G(i)),T[2](null),G(g)}}}function ot(T,e,f){let{service:b=window.GaReportService}=e,s,A,o=[],i={},g="",n=0,x=0,p=0,S;function D(){S&&(i=echarts.init(S,null,{devicePixelRatio:4,renderer:"svg"}));const a=S.getBoundingClientRect();var d={textStyle:{fontFamily:"Sen, sans serif"},animation:!1,backgroundColor:"transparent",grid:{top:"15px",left:"50px",right:"45px",bottom:"45px"},dataset:[{source:A.data.map(r=>[r.CA,r.GA])}],tooltip:{show:!1},xAxis:{min:10,max:90,interval:10,nameTextStyle:{color:"#09341F",opacity:.8},axisLine:{show:!1,lineStyle:{color:"#09341F",opacity:.1},symbol:["none","arrow"],symbolSize:[5,10],symbolOffset:[8]},axisTick:{show:!1},axisLabel:{show:!0,color:"#09341F",opacity:.8,formatter(r){return r===0||r===100?"":r}},splitLine:{show:!0}},yAxis:{min:15,max:85,nameTextStyle:{color:"#09341F",opacity:.8},axisLine:{show:!1,lineStyle:{color:"#09341F",opacity:.1},symbol:["none","arrow"],symbolSize:[5,10],symbolOffset:[5]},axisTick:{show:!1},axisLabel:{show:!1,color:"#09341F",opacity:.8,formatter(r){return r===0||r===.6?"":r}},splitLine:{show:!0}},series:[{type:"scatter",tooltip:{},symbolSize:4,itemStyle:{color:"#09341F",opacity:.15,borderWidth:1,lineWidth:12}}],graphic:[]};i.setOption(d);const y=10,W=6,w=2,M=1.5,h=1.5,H=N(p);{const r=i.convertToPixel("xAxis",n),m=i.convertToPixel("yAxis",15),k=i.convertToPixel("yAxis",x),P=Math.abs(k-m),R=k<m?-1:1;let c=0;for(;c<P;){const v=Math.min(y,P-c),$=R===-1?m-c-v:m+c;d.graphic.push({type:"rect",zlevel:10,shape:{x:r-w/2-h,y:$-h,width:w+h*2,height:v+h*2,r:M+h},style:{fill:"#FFFFFF"},z:14}),d.graphic.push({type:"rect",zlevel:10,shape:{x:r-w/2,y:$,width:w,height:v,r:M},style:{fill:H},z:15}),c+=y+W}}{const r=i.convertToPixel("yAxis",x),m=i.convertToPixel("xAxis",10),k=i.convertToPixel("xAxis",n),P=Math.abs(k-m),R=k>m?1:-1;let c=0;for(;c<P;){const v=Math.min(y,P-c),$=R===1?m+c:m-c-v;d.graphic.push({type:"rect",zlevel:10,shape:{x:$-h,y:r-w/2-h,width:v+h*2,height:w+h*2,r:M+h},style:{fill:"#FFFFFF"},z:14}),d.graphic.push({type:"rect",zlevel:10,shape:{x:$,y:r-w/2,width:v,height:w,r:M},style:{fill:H},z:15}),c+=y+W}}d.graphic.push({name:"Measured result",type:"circle",zlevel:10,shape:{cx:i.convertToPixel("xAxis",n),cy:i.convertToPixel("yAxis",x),r:6},style:{fill:N(p),stroke:"#FFFFFF",lineWidth:2},z:15});const I=i.convertToPixel("xAxis",n),V=i.convertToPixel("yAxis",x),l=document.createElementNS("http://www.w3.org/2000/svg","svg"),u=document.createElement("div");l.setAttribute("width","75"),l.setAttribute("height","36"),l.setAttribute("viewBox","-2 -2 75 36"),l.setAttribute("fill","none"),l.setAttribute("xmlns","http://www.w3.org/2000/svg");const C=document.createElementNS("http://www.w3.org/2000/svg","path");C.setAttribute("d","M7 4C7 1.79086 8.79086 0 11 0H67C69.2091 0 71 1.79086 71 4V28C71 30.2091 69.2091 32 67 32H11C8.79086 32 7 30.2091 7 28V4Z"),C.setAttribute("fill",N(p)),C.setAttribute("stroke","#FFFFFF"),C.setAttribute("stroke-width","4"),C.setAttribute("paint-order","stroke");const F=document.createElementNS("http://www.w3.org/2000/svg","path");F.setAttribute("d","M7 10L1.13333 14.4C0.0666666 15.2 0.0666666 16.8 1.13333 17.6L7 22"),F.setAttribute("fill","none"),F.setAttribute("stroke","#FFFFFF"),F.setAttribute("stroke-width","2.5"),F.setAttribute("stroke-linejoin","round"),F.setAttribute("stroke-linecap","round");const E=document.createElementNS("http://www.w3.org/2000/svg","path");E.setAttribute("d","M1.13333 17.6C0.0666666 16.8 0.0666666 15.2 1.13333 14.4L7 10L7 22L1.13333 17.6Z"),E.setAttribute("fill",N(p)),l.appendChild(F),l.appendChild(C),l.appendChild(E),l.style.position="absolute",l.style.left=`${a.left+I+8}px`,l.style.top=`${a.top+V-17}px`,l.style.zIndex="8",u.innerText=`${Number.parseFloat(p)} pct`,u.style.position="absolute",u.style.left=`${a.left+I+26}px`,u.style.top=`${a.top+V-10}px`,u.style.font="bold 16px sans-serif",u.style.color="white",u.style.zIndex="999",u.style.fontFamily="Sen",document.body.appendChild(u),document.body.appendChild(l),i.setOption(d)}_(async()=>{s=await b.getReport(),g=s.sex,A=await b.getAgeData(g),n=Number(s.chronologicalage),x=Number(s.glycanage),o=A.data.filter(y=>y.CA>=n-5&&y.CA<=n+5);let a=o.filter(y=>y.GA<x).length,d=o.length;p=Math.round(a/d*100),(p===100||p===0)&&(p=p===100?99:1),D()});function X(a){tt[a?"unshift":"push"](()=>{S=a,f(0,S)})}return T.$$set=a=>{"service"in a&&f(1,b=a.service)},[S,b,X]}class q extends J{constructor(e){super(),K(this,e,ot,st,U,{service:1})}get service(){return this.$$.ctx[1]}set service(e){this.$$set({service:e}),Q()}}customElements.define("ga-biological-age-rank-scatter",Y(q,{service:{}},[],[],!1));export{q as default};
@@ -1 +1 @@
1
- import{c as K,S as Q,i as U,f as _,s as tt,e as $,b as O,n as t,p as q,g as D,q as C,u as G,k as I,o as et,A as it}from"./index2.js";import{g as st}from"./globals.js";import{f as M}from"./helpers.js";const{document:ot}=st;function rt(k){let e,f,g,s,A,o,n,i;return{c(){e=$("div"),f=$("div"),g=O(),s=$("div"),s.textContent="Age",A=O(),o=$("div"),o.textContent="Immune resilience index",n=O(),i=$("link"),t(f,"width","100%"),t(f,"height","100%"),t(s,"position","absolute"),t(s,"bottom","6px"),t(s,"left","50%"),t(s,"transform","translateX(-50%)"),t(s,"font-family","Sen, sans-serif"),t(s,"font-size","12px"),t(s,"color","#09341F"),t(s,"opacity","0.8"),t(o,"position","absolute"),t(o,"top","50%"),t(o,"right","83%"),t(o,"transform","translateY(-50%) rotate(-90deg)"),t(o,"font-family","Sen, sans-serif"),t(o,"font-size","12px"),t(o,"color","#09341F"),t(o,"opacity","0.8"),t(o,"white-space","nowrap"),t(e,"width","100%"),t(e,"height","100%"),t(e,"position","relative"),t(e,"border","1px solid #09341F33"),t(e,"border-radius","10px"),q(i,"href","https://fonts.googleapis.com/css2?family=Sen:wght@400..800&display=swap"),q(i,"rel","stylesheet")},m(w,c){D(w,e,c),C(e,f),k[2](f),C(e,g),C(e,s),C(e,A),C(e,o),D(w,n,c),C(ot.head,i)},p:G,i:G,o:G,d(w){w&&(I(e),I(n)),k[2](null),I(i)}}}function lt(k,e,f){let{service:g=window.GaReportService}=e,s,A,o=[],n=0,i={},w="",c=0,W=0,B=0,S,h=0;function Y(){S&&(i=echarts.init(S,null,{devicePixelRatio:4,renderer:"svg"}));const a=S.getBoundingClientRect();var d={textStyle:{fontFamily:"Sen, sans serif"},animation:!1,backgroundColor:"transparent",grid:{top:"15px",left:"50px",right:"45px",bottom:"45px"},dataset:[{source:A.data.map(r=>[r.x,r.y])}],tooltip:{show:!1},xAxis:{min:15,max:95,interval:20,nameTextStyle:{color:"#09341F",opacity:.8},axisLine:{show:!1,lineStyle:{color:"#09341F",opacity:.1},symbol:["none","arrow"],symbolSize:[5,10],symbolOffset:[8]},axisTick:{show:!1},axisLabel:{show:!0,color:"#09341F",opacity:.8,formatter(r){return r===0||r===100?"":r}},splitLine:{show:!0}},yAxis:{min:0,max:w==="M"?3:3.5,interval:.5,nameTextStyle:{color:"#09341F",opacity:.8},axisLine:{show:!1,lineStyle:{color:"#09341F",opacity:.1},symbol:["none","arrow"],symbolSize:[5,10],symbolOffset:[5]},axisTick:{show:!1},axisLabel:{show:!1,color:"#09341F",opacity:.8,formatter(r){return r===0||r===.6?"":r}},splitLine:{show:!0}},series:[{type:"scatter",tooltip:{},symbolSize:4,itemStyle:{color:"#09341F",opacity:.15,borderWidth:1,lineWidth:12}},{name:"Resilience index",type:"scatter",data:[{x:c,y:n}],itemStyle:{color:M(h)}}],graphic:[]};i.setOption(d);const y=10,H=6,b=2,N=1.5,x=1.5,V=M(h);{const r=i.convertToPixel("xAxis",c),m=i.convertToPixel("yAxis",0),T=i.convertToPixel("yAxis",n),P=Math.abs(T-m),R=T<m?-1:1;let p=0;for(;p<P;){const v=Math.min(y,P-p),L=R===-1?m-p-v:m+p;d.graphic.push({type:"rect",zlevel:10,shape:{x:r-b/2-x,y:L-x,width:b+x*2,height:v+x*2,r:N+x},style:{fill:"#FFFFFF"},z:14}),d.graphic.push({type:"rect",zlevel:10,shape:{x:r-b/2,y:L,width:b,height:v,r:N},style:{fill:V},z:15}),p+=y+H}}{const r=i.convertToPixel("yAxis",n),m=i.convertToPixel("xAxis",15),T=i.convertToPixel("xAxis",c),P=Math.abs(T-m),R=T>m?1:-1;let p=0;for(;p<P;){const v=Math.min(y,P-p),L=R===1?m+p:m-p-v;d.graphic.push({type:"rect",zlevel:10,shape:{x:L-x,y:r-b/2-x,width:v+x*2,height:b+x*2,r:N+x},style:{fill:"#FFFFFF"},z:14}),d.graphic.push({type:"rect",zlevel:10,shape:{x:L,y:r-b/2,width:v,height:b,r:N},style:{fill:V},z:15}),p+=y+H}}d.graphic.push({name:"Measured result",type:"circle",zlevel:10,shape:{cx:i.convertToPixel("xAxis",c),cy:i.convertToPixel("yAxis",n),r:6},style:{fill:M(h),stroke:"#FFFFFF",lineWidth:2},z:15});const Z=i.convertToPixel("xAxis",c),j=i.convertToPixel("yAxis",n),l=document.createElementNS("http://www.w3.org/2000/svg","svg"),u=document.createElement("div");l.setAttribute("width","75"),l.setAttribute("height","36"),l.setAttribute("viewBox","-2 -2 75 36"),l.setAttribute("fill","none"),l.setAttribute("xmlns","http://www.w3.org/2000/svg");const z=document.createElementNS("http://www.w3.org/2000/svg","path");z.setAttribute("d","M7 4C7 1.79086 8.79086 0 11 0H67C69.2091 0 71 1.79086 71 4V28C71 30.2091 69.2091 32 67 32H11C8.79086 32 7 30.2091 7 28V4Z"),z.setAttribute("fill",M(h)),z.setAttribute("stroke","#FFFFFF"),z.setAttribute("stroke-width","4"),z.setAttribute("paint-order","stroke");const F=document.createElementNS("http://www.w3.org/2000/svg","path");F.setAttribute("d","M7 10L1.13333 14.4C0.0666666 15.2 0.0666666 16.8 1.13333 17.6L7 22"),F.setAttribute("fill","none"),F.setAttribute("stroke","#FFFFFF"),F.setAttribute("stroke-width","2.5"),F.setAttribute("stroke-linejoin","round"),F.setAttribute("stroke-linecap","round");const E=document.createElementNS("http://www.w3.org/2000/svg","path");E.setAttribute("d","M1.13333 17.6C0.0666666 16.8 0.0666666 15.2 1.13333 14.4L7 10L7 22L1.13333 17.6Z"),E.setAttribute("fill",M(h)),l.appendChild(F),l.appendChild(z),l.appendChild(E),l.style.position="absolute",l.style.left=`${a.left+Z+8}px`,l.style.top=`${a.top+j-17}px`,l.style.zIndex="8",u.innerText=`${Number.parseFloat(n).toFixed(3)}`,u.style.position="absolute",u.style.left=`${a.left+Z+28}px`,u.style.top=`${a.top+j-8}px`,u.style.font="bold 16px sans-serif",u.style.color="white",u.style.zIndex="999",u.style.fontFamily="Sen",document.body.appendChild(u),document.body.appendChild(l),i.setOption(d)}et(async()=>{s=await g.getReport(),w=s.sex,A=await g.getResilienceData(w),B=Number(s.G0yourscore),W=Number(s.G2yourscore),c=Number(s.chronologicalage),n=Number((W/B).toFixed(3)),o=A.data.filter(y=>y.x>=c-5&&y.x<=c+5);let a=o.filter(y=>y.y<n).length,d=o.length;h=Math.round(a/d*100),(h===100||h===0)&&(h=h===100?99:1),Y()});function J(a){it[a?"unshift":"push"](()=>{S=a,f(0,S)})}return k.$$set=a=>{"service"in a&&f(1,g=a.service)},[S,g,J]}class X extends Q{constructor(e){super(),U(this,e,lt,rt,tt,{service:1})}get service(){return this.$$.ctx[1]}set service(e){this.$$set({service:e}),_()}}customElements.define("ga-immune-resilience-index-scatter",K(X,{service:{}},[],[],!1));export{X as default};
1
+ import{c as K,S as Q,i as U,f as _,s as tt,e as $,b as O,n as t,p as q,g as D,q as C,u as G,k as I,o as et,A as it}from"./index2.js";import{g as st}from"./globals.js";import{f as M}from"./helpers.js";const{document:ot}=st;function rt(k){let e,f,g,s,A,o,n,i;return{c(){e=$("div"),f=$("div"),g=O(),s=$("div"),s.textContent="Age",A=O(),o=$("div"),o.textContent="Immune resilience index",n=O(),i=$("link"),t(f,"width","100%"),t(f,"height","100%"),t(s,"position","absolute"),t(s,"bottom","6px"),t(s,"left","50%"),t(s,"transform","translateX(-50%)"),t(s,"font-family","Sen, sans-serif"),t(s,"font-size","12px"),t(s,"color","#09341F"),t(s,"opacity","0.8"),t(o,"position","absolute"),t(o,"top","50%"),t(o,"right","83%"),t(o,"transform","translateY(-50%) rotate(-90deg)"),t(o,"font-family","Sen, sans-serif"),t(o,"font-size","12px"),t(o,"color","#09341F"),t(o,"opacity","0.8"),t(o,"white-space","nowrap"),t(e,"width","100%"),t(e,"height","100%"),t(e,"position","relative"),t(e,"border","1px solid #09341F33"),t(e,"border-radius","10px"),q(i,"href","https://fonts.googleapis.com/css2?family=Sen:wght@400..800&display=swap"),q(i,"rel","stylesheet")},m(w,c){D(w,e,c),C(e,f),k[2](f),C(e,g),C(e,s),C(e,A),C(e,o),D(w,n,c),C(ot.head,i)},p:G,i:G,o:G,d(w){w&&(I(e),I(n)),k[2](null),I(i)}}}function lt(k,e,f){let{service:g=window.GaReportService}=e,s,A,o=[],n=0,i={},w="",c=0,W=0,B=0,S,h=0;function Y(){S&&(i=echarts.init(S,null,{devicePixelRatio:4,renderer:"svg"}));const a=S.getBoundingClientRect();var d={textStyle:{fontFamily:"Sen, sans serif"},animation:!1,backgroundColor:"transparent",grid:{top:"15px",left:"50px",right:"45px",bottom:"45px"},dataset:[{source:A.data.map(r=>[r.CA,r.SS])}],tooltip:{show:!1},xAxis:{min:15,max:95,interval:20,nameTextStyle:{color:"#09341F",opacity:.8},axisLine:{show:!1,lineStyle:{color:"#09341F",opacity:.1},symbol:["none","arrow"],symbolSize:[5,10],symbolOffset:[8]},axisTick:{show:!1},axisLabel:{show:!0,color:"#09341F",opacity:.8,formatter(r){return r===0||r===100?"":r}},splitLine:{show:!0}},yAxis:{min:0,max:w==="M"?3:3.5,interval:.5,nameTextStyle:{color:"#09341F",opacity:.8},axisLine:{show:!1,lineStyle:{color:"#09341F",opacity:.1},symbol:["none","arrow"],symbolSize:[5,10],symbolOffset:[5]},axisTick:{show:!1},axisLabel:{show:!1,color:"#09341F",opacity:.8,formatter(r){return r===0||r===.6?"":r}},splitLine:{show:!0}},series:[{type:"scatter",tooltip:{},symbolSize:4,itemStyle:{color:"#09341F",opacity:.15,borderWidth:1,lineWidth:12}},{name:"Resilience index",type:"scatter",data:[{x:c,y:n}],itemStyle:{color:M(h)}}],graphic:[]};i.setOption(d);const u=10,H=6,b=2,N=1.5,x=1.5,V=M(h);{const r=i.convertToPixel("xAxis",c),m=i.convertToPixel("yAxis",0),T=i.convertToPixel("yAxis",n),P=Math.abs(T-m),R=T<m?-1:1;let p=0;for(;p<P;){const v=Math.min(u,P-p),L=R===-1?m-p-v:m+p;d.graphic.push({type:"rect",zlevel:10,shape:{x:r-b/2-x,y:L-x,width:b+x*2,height:v+x*2,r:N+x},style:{fill:"#FFFFFF"},z:14}),d.graphic.push({type:"rect",zlevel:10,shape:{x:r-b/2,y:L,width:b,height:v,r:N},style:{fill:V},z:15}),p+=u+H}}{const r=i.convertToPixel("yAxis",n),m=i.convertToPixel("xAxis",15),T=i.convertToPixel("xAxis",c),P=Math.abs(T-m),R=T>m?1:-1;let p=0;for(;p<P;){const v=Math.min(u,P-p),L=R===1?m+p:m-p-v;d.graphic.push({type:"rect",zlevel:10,shape:{x:L-x,y:r-b/2-x,width:v+x*2,height:b+x*2,r:N+x},style:{fill:"#FFFFFF"},z:14}),d.graphic.push({type:"rect",zlevel:10,shape:{x:L,y:r-b/2,width:v,height:b,r:N},style:{fill:V},z:15}),p+=u+H}}d.graphic.push({name:"Measured result",type:"circle",zlevel:10,shape:{cx:i.convertToPixel("xAxis",c),cy:i.convertToPixel("yAxis",n),r:6},style:{fill:M(h),stroke:"#FFFFFF",lineWidth:2},z:15});const Z=i.convertToPixel("xAxis",c),j=i.convertToPixel("yAxis",n),l=document.createElementNS("http://www.w3.org/2000/svg","svg"),y=document.createElement("div");l.setAttribute("width","75"),l.setAttribute("height","36"),l.setAttribute("viewBox","-2 -2 75 36"),l.setAttribute("fill","none"),l.setAttribute("xmlns","http://www.w3.org/2000/svg");const z=document.createElementNS("http://www.w3.org/2000/svg","path");z.setAttribute("d","M7 4C7 1.79086 8.79086 0 11 0H67C69.2091 0 71 1.79086 71 4V28C71 30.2091 69.2091 32 67 32H11C8.79086 32 7 30.2091 7 28V4Z"),z.setAttribute("fill",M(h)),z.setAttribute("stroke","#FFFFFF"),z.setAttribute("stroke-width","4"),z.setAttribute("paint-order","stroke");const F=document.createElementNS("http://www.w3.org/2000/svg","path");F.setAttribute("d","M7 10L1.13333 14.4C0.0666666 15.2 0.0666666 16.8 1.13333 17.6L7 22"),F.setAttribute("fill","none"),F.setAttribute("stroke","#FFFFFF"),F.setAttribute("stroke-width","2.5"),F.setAttribute("stroke-linejoin","round"),F.setAttribute("stroke-linecap","round");const E=document.createElementNS("http://www.w3.org/2000/svg","path");E.setAttribute("d","M1.13333 17.6C0.0666666 16.8 0.0666666 15.2 1.13333 14.4L7 10L7 22L1.13333 17.6Z"),E.setAttribute("fill",M(h)),l.appendChild(F),l.appendChild(z),l.appendChild(E),l.style.position="absolute",l.style.left=`${a.left+Z+8}px`,l.style.top=`${a.top+j-17}px`,l.style.zIndex="8",y.innerText=`${Number.parseFloat(n).toFixed(3)}`,y.style.position="absolute",y.style.left=`${a.left+Z+28}px`,y.style.top=`${a.top+j-8}px`,y.style.font="bold 16px sans-serif",y.style.color="white",y.style.zIndex="999",y.style.fontFamily="Sen",document.body.appendChild(y),document.body.appendChild(l),i.setOption(d)}et(async()=>{s=await g.getReport(),w=s.sex,A=await g.getResilienceData(w),B=Number(s.G0yourscore),W=Number(s.G2yourscore),c=Number(s.chronologicalage),n=Number((W/B).toFixed(3)),o=A.data.filter(u=>u.CA>=c-5&&u.CA<=c+5);let a=o.filter(u=>u.SS<n).length,d=o.length;h=Math.round(a/d*100),(h===100||h===0)&&(h=h===100?99:1),Y()});function J(a){it[a?"unshift":"push"](()=>{S=a,f(0,S)})}return k.$$set=a=>{"service"in a&&f(1,g=a.service)},[S,g,J]}class X extends Q{constructor(e){super(),U(this,e,lt,rt,tt,{service:1})}get service(){return this.$$.ctx[1]}set service(e){this.$$set({service:e}),_()}}customElements.define("ga-immune-resilience-index-scatter",K(X,{service:{}},[],[],!1));export{X as default};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@glycanage/web-components",
3
3
  "description": "A collection of web-components",
4
- "version": "1.220.0",
4
+ "version": "1.221.0",
5
5
  "type": "module",
6
6
  "main": "dist/lib/@glycanage/web-components.js",
7
7
  "scripts": {