@skdx/web-components-charts 0.45.0 → 0.49.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.
Files changed (176) hide show
  1. package/dist/area.cjs +29 -29
  2. package/dist/area.d.cts +2 -1
  3. package/dist/area.d.ts +2 -1
  4. package/dist/area.js +31 -31
  5. package/dist/bar.cjs +29 -29
  6. package/dist/bar.d.cts +2 -1
  7. package/dist/bar.d.ts +2 -1
  8. package/dist/bar.js +33 -33
  9. package/dist/boxplot.cjs +35 -35
  10. package/dist/boxplot.d.cts +2 -1
  11. package/dist/boxplot.d.ts +2 -1
  12. package/dist/boxplot.js +38 -38
  13. package/dist/bubble.cjs +39 -39
  14. package/dist/bubble.d.cts +2 -1
  15. package/dist/bubble.d.ts +2 -1
  16. package/dist/bubble.js +38 -38
  17. package/dist/bullet.cjs +38 -38
  18. package/dist/bullet.d.cts +2 -1
  19. package/dist/bullet.d.ts +2 -1
  20. package/dist/bullet.js +40 -40
  21. package/dist/bump.cjs +37 -37
  22. package/dist/bump.d.cts +2 -1
  23. package/dist/bump.d.ts +2 -1
  24. package/dist/bump.js +37 -37
  25. package/dist/candlestick.cjs +34 -34
  26. package/dist/candlestick.d.cts +2 -1
  27. package/dist/candlestick.d.ts +2 -1
  28. package/dist/candlestick.js +35 -35
  29. package/dist/chord.cjs +37 -37
  30. package/dist/chord.d.cts +2 -1
  31. package/dist/chord.d.ts +2 -1
  32. package/dist/chord.js +39 -39
  33. package/dist/circle-packing.cjs +37 -37
  34. package/dist/circle-packing.d.cts +2 -1
  35. package/dist/circle-packing.d.ts +2 -1
  36. package/dist/circle-packing.js +37 -37
  37. package/dist/combo.cjs +29 -29
  38. package/dist/combo.d.cts +2 -1
  39. package/dist/combo.d.ts +2 -1
  40. package/dist/combo.js +33 -33
  41. package/dist/contracts.json +17886 -0
  42. package/dist/dumbbell.cjs +40 -40
  43. package/dist/dumbbell.d.cts +2 -1
  44. package/dist/dumbbell.d.ts +2 -1
  45. package/dist/dumbbell.js +39 -39
  46. package/dist/funnel.cjs +38 -38
  47. package/dist/funnel.d.cts +2 -1
  48. package/dist/funnel.d.ts +2 -1
  49. package/dist/funnel.js +38 -38
  50. package/dist/gantt.cjs +37 -37
  51. package/dist/gantt.d.cts +2 -1
  52. package/dist/gantt.d.ts +2 -1
  53. package/dist/gantt.js +40 -40
  54. package/dist/gauge.cjs +36 -36
  55. package/dist/gauge.d.cts +2 -1
  56. package/dist/gauge.d.ts +2 -1
  57. package/dist/gauge.js +35 -35
  58. package/dist/heatmap.cjs +38 -38
  59. package/dist/heatmap.d.cts +2 -1
  60. package/dist/heatmap.d.ts +2 -1
  61. package/dist/heatmap.js +39 -39
  62. package/dist/histogram.cjs +30 -30
  63. package/dist/histogram.d.cts +2 -1
  64. package/dist/histogram.d.ts +2 -1
  65. package/dist/histogram.js +34 -34
  66. package/dist/icicle.cjs +40 -40
  67. package/dist/icicle.d.cts +2 -1
  68. package/dist/icicle.d.ts +2 -1
  69. package/dist/icicle.js +40 -40
  70. package/dist/{index-H-_fLjtt.d.cts → index-BkR4iVqI.d.ts} +11 -1071
  71. package/dist/{index-H-_fLjtt.d.ts → index-DjnBT-5R.d.cts} +11 -1071
  72. package/dist/index.cjs +37 -37
  73. package/dist/index.d.cts +24 -3
  74. package/dist/index.d.ts +24 -3
  75. package/dist/index.js +38 -38
  76. package/dist/line.cjs +29 -29
  77. package/dist/line.d.cts +2 -1
  78. package/dist/line.d.ts +2 -1
  79. package/dist/line.js +31 -31
  80. package/dist/linear-gauge.cjs +33 -33
  81. package/dist/linear-gauge.d.cts +2 -1
  82. package/dist/linear-gauge.d.ts +2 -1
  83. package/dist/linear-gauge.js +40 -40
  84. package/dist/map.cjs +39 -39
  85. package/dist/map.d.cts +2 -1
  86. package/dist/map.d.ts +2 -1
  87. package/dist/map.js +37 -37
  88. package/dist/marimekko.cjs +40 -40
  89. package/dist/marimekko.d.cts +2 -1
  90. package/dist/marimekko.d.ts +2 -1
  91. package/dist/marimekko.js +38 -38
  92. package/dist/network.cjs +38 -38
  93. package/dist/network.d.cts +2 -1
  94. package/dist/network.d.ts +2 -1
  95. package/dist/network.js +39 -39
  96. package/dist/organization.cjs +38 -38
  97. package/dist/organization.d.cts +2 -1
  98. package/dist/organization.d.ts +2 -1
  99. package/dist/organization.js +38 -38
  100. package/dist/parallel.cjs +38 -38
  101. package/dist/parallel.d.cts +2 -1
  102. package/dist/parallel.d.ts +2 -1
  103. package/dist/parallel.js +40 -40
  104. package/dist/pareto.cjs +25 -25
  105. package/dist/pareto.d.cts +2 -1
  106. package/dist/pareto.d.ts +2 -1
  107. package/dist/pareto.js +24 -24
  108. package/dist/pie.cjs +38 -38
  109. package/dist/pie.d.cts +2 -1
  110. package/dist/pie.d.ts +2 -1
  111. package/dist/pie.js +38 -38
  112. package/dist/polar-area.cjs +38 -38
  113. package/dist/polar-area.d.cts +2 -1
  114. package/dist/polar-area.d.ts +2 -1
  115. package/dist/polar-area.js +40 -40
  116. package/dist/portable-runtime.js +1 -0
  117. package/dist/portable.cjs +1 -0
  118. package/dist/portable.d.cts +25 -0
  119. package/dist/portable.d.ts +25 -0
  120. package/dist/portable.js +1 -0
  121. package/dist/radar.cjs +39 -39
  122. package/dist/radar.d.cts +2 -1
  123. package/dist/radar.d.ts +2 -1
  124. package/dist/radar.js +37 -37
  125. package/dist/radial.cjs +36 -36
  126. package/dist/radial.d.cts +2 -1
  127. package/dist/radial.d.ts +2 -1
  128. package/dist/radial.js +37 -37
  129. package/dist/range.cjs +27 -27
  130. package/dist/range.d.cts +2 -1
  131. package/dist/range.d.ts +2 -1
  132. package/dist/range.js +27 -27
  133. package/dist/sankey.cjs +38 -38
  134. package/dist/sankey.d.cts +2 -1
  135. package/dist/sankey.d.ts +2 -1
  136. package/dist/sankey.js +36 -36
  137. package/dist/scatter.cjs +40 -40
  138. package/dist/scatter.d.cts +2 -1
  139. package/dist/scatter.d.ts +2 -1
  140. package/dist/scatter.js +39 -39
  141. package/dist/sparkline.cjs +36 -36
  142. package/dist/sparkline.d.cts +2 -1
  143. package/dist/sparkline.d.ts +2 -1
  144. package/dist/sparkline.js +37 -37
  145. package/dist/sunburst.cjs +37 -37
  146. package/dist/sunburst.d.cts +2 -1
  147. package/dist/sunburst.d.ts +2 -1
  148. package/dist/sunburst.js +40 -40
  149. package/dist/swarm.cjs +40 -40
  150. package/dist/swarm.d.cts +2 -1
  151. package/dist/swarm.d.ts +2 -1
  152. package/dist/swarm.js +39 -39
  153. package/dist/timeline.cjs +38 -38
  154. package/dist/timeline.d.cts +2 -1
  155. package/dist/timeline.d.ts +2 -1
  156. package/dist/timeline.js +40 -40
  157. package/dist/tree.cjs +38 -38
  158. package/dist/tree.d.cts +2 -1
  159. package/dist/tree.d.ts +2 -1
  160. package/dist/tree.js +38 -38
  161. package/dist/treemap.cjs +40 -40
  162. package/dist/treemap.d.cts +2 -1
  163. package/dist/treemap.d.ts +2 -1
  164. package/dist/treemap.js +38 -38
  165. package/dist/types-5xXhTghj.d.cts +1168 -0
  166. package/dist/types-5xXhTghj.d.ts +1168 -0
  167. package/dist/waffle.cjs +40 -40
  168. package/dist/waffle.d.cts +2 -1
  169. package/dist/waffle.d.ts +2 -1
  170. package/dist/waffle.js +39 -39
  171. package/dist/waterfall.cjs +37 -37
  172. package/dist/waterfall.d.cts +2 -1
  173. package/dist/waterfall.d.ts +2 -1
  174. package/dist/waterfall.js +38 -38
  175. package/dist/wrapper-api.json +1849 -0
  176. package/package.json +9 -5
package/dist/scatter.js CHANGED
@@ -1,62 +1,62 @@
1
- var On=Object.defineProperty;var Ln=Object.getOwnPropertyDescriptor;var g=(e,n,t,r)=>{for(var i=r>1?void 0:r?Ln(n,t):n,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=(r?a(n,t,i):a(i))||i);return r&&i&&On(n,t,i),i};import{customElement as sr,property as V}from"lit/decorators.js";var _t=e=>Number(e.toPrecision(12)),Rn,Pn=e=>(Rn??(Rn=new Intl.NumberFormat)).format(_t(e)),Bn=e=>{let n=Math.round(Math.abs(e)),t=e<0?"-":"",r=Math.floor(n/3600),i=Math.floor(n%3600/60),o=a=>String(a).padStart(2,"0");return r>0?`${t}${r}h ${o(i)}m`:i>0?`${t}${i}m ${o(n%60)}s`:`${t}${n}s`};function Se(e){if(e===void 0)return Pn;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:i="",timeZone:o}=e,a=d=>i?u=>d(u)+i:d,l=d=>r===void 0?d===void 0?{}:{maximumFractionDigits:d}:{minimumFractionDigits:r,maximumFractionDigits:r},s=d=>{let u=new Intl.NumberFormat(t,d);return a(m=>u.format(_t(m)))},c=d=>{let u=new Intl.DateTimeFormat(t,o?{...d,timeZone:o}:d);return m=>u.format(m)};switch(n){case"integer":return s({maximumFractionDigits:0});case"decimal":return s(l(2));case"percent":return s({style:"percent",...l(0)});case"currency":return s({style:"currency",currency:e.currency??"USD",...l()});case"compact":return s({notation:"compact",...l(1)});case"scientific":return s({notation:"scientific",...l(2)});case"date":return c({dateStyle:"medium"});case"time":return c({timeStyle:"short"});case"datetime":return c({dateStyle:"medium",timeStyle:"short"});case"duration":return a(Bn)}}var Et=e=>{if(e instanceof Date)return e.getTime();if(typeof e=="number")return e;let n=Number(e);return Number.isFinite(n)&&e.trim()!==""?n:Date.parse(e)};function Ce([e,n],[t,r]){let i=n-e;return o=>i===0?t:t+(o-e)/i*(r-t)}function Ie(e,n,t=5){if(e===n)return[e];let r=(n-e)/Math.max(1,t),i=10**Math.floor(Math.log10(r)),o=r/i,a=(o<1.5?1:o<3.5?2:o<7.5?5:10)*i,l=Math.floor(e/a)*a,s=Math.ceil(n/a)*a,c=[];for(let d=l;d<=s+a/2;d+=a)c.push(Ht(d));return c}var Ht=e=>Number(e.toPrecision(12)),h=e=>Number(e.toFixed(2)),le=e=>typeof e=="number"&&Number.isFinite(e);function ce(e){let n=1/0,t=-1/0;for(let r of e)le(r)&&(r<n&&(n=r),r>t&&(t=r));return n===1/0?[0,0]:[n,t]}function Vt(e,n="linear"){if(e.length===0)return"";let t=e[0];if(n==="step"||n==="stepBefore"||n==="stepAfter"){let c=`M${t.x} ${t.y}`;for(let d=1;d<e.length;d++){let u=e[d-1],m=e[d];n==="stepAfter"?c+=`H${m.x}V${m.y}`:n==="stepBefore"?c+=`V${m.y}H${m.x}`:c+=`H${h((u.x+m.x)/2)}V${m.y}H${m.x}`}return c}if(n==="linear"||e.length<3)return`M${e.map(c=>`${c.x} ${c.y}`).join("L")}`;let r=e.length,i=e.slice(1).map((c,d)=>c.x-e[d].x),o=e.slice(1).map((c,d)=>c.y-e[d].y),a=i.map((c,d)=>c===0?0:o[d]/c),l=[a[0]];for(let c=1;c<r-1;c++){let d=a[c-1],u=a[c];l.push(d*u<=0?0:(d+u)/2)}l.push(a[r-2]);for(let c=0;c<r-1;c++){let d=a[c];if(d===0){l[c]=0,l[c+1]=0;continue}let u=l[c]/d,m=l[c+1]/d,y=Math.hypot(u,m);y>3&&(l[c]=3*u*d/y,l[c+1]=3*m*d/y)}let s=`M${t.x} ${t.y}`;for(let c=0;c<r-1;c++){let d=e[c],u=e[c+1],m=i[c]/3;s+=`C${h(d.x+m)} ${h(d.y+m*l[c])} ${h(u.x-m)} ${h(u.y-m*l[c+1])} ${u.x} ${u.y}`}return s}var me=1e3,be=60*me,xe=60*be,$e=24*xe,dr=[me,5*me,15*me,30*me,be,5*be,15*be,30*be,xe,3*xe,6*xe,12*xe,$e,2*$e,7*$e,14*$e];function Zt(e,n){let t=Math.floor(Math.log10(e)),r=Math.ceil(Math.log10(n)),i=r-t<=1?[1,2,5]:[1],o=[];for(let a=t;a<=r;a++)for(let l of i)o.push(Ht(l*10**a));return o.filter(a=>a>=e/1.0001&&a<=n*1.0001)}var Nn=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,Dn=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,Fn={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function Gn(e,n,t){return e.replace(Dn,(r,i,o)=>{let a=Fn[i];if(a===void 0)return i+o;let s=(o.match(Nn)??[]).map((c,d)=>{let u=Number(c);if(a===-1)return String(u+n);if(a===-2)return String(u+t);let m=d%a;return a===7?m===5?String(u+n):m===6?String(u+t):c:String(m%2===0?u+n:u+t)});return i+s.join(" ")})}var Wt=(e,n,t)=>e.map(r=>{switch(r.kind){case"rect":return{...r,x:r.x+n,y:r.y+t};case"circle":return{...r,cx:r.cx+n,cy:r.cy+t};case"line":return{...r,x1:r.x1+n,x2:r.x2+n,y1:r.y1+t,y2:r.y2+t};case"text":return{...r,x:r.x+n,y:r.y+t};case"path":return{...r,d:Gn(r.d,n,t)}}});var He=["primary","success","warning","danger","neutral"].flatMap(e=>[500,700].map(n=>`var(--skdx-color-${e}-${n})`)).sort((e,n)=>Number(e.endsWith("700)"))-Number(n.endsWith("700)"))),S={axis:"var(--skdx-color-border-strong)",grid:"var(--skdx-color-border-subtle)",label:"var(--skdx-color-text-muted)",focus:"var(--skdx-color-focus-ring)",positive:"var(--skdx-color-success-500)",negative:"var(--skdx-color-danger-500)",fontFamily:"var(--skdx-font-family)",fontSize:"var(--skdx-font-size-xs)"},Te=(e="neutral")=>e==="neutral"?S.axis:`var(--skdx-color-${e}-500)`,Ve=(e="neutral")=>e==="neutral"?S.label:e==="primary"?"var(--skdx-color-text-accent)":`var(--skdx-color-text-${e})`,Ut=(e,n)=>n??He[e%He.length];var de={top:16,right:16,bottom:32,left:48};function qt(e,n,t=de){return{x:t.left,y:t.top,width:Math.max(0,e-t.left-t.right),height:Math.max(0,n-t.top-t.bottom)}}function ge(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function Kt(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var Ae=20,jn=120,Yt=e=>{let n=ge(e);return n&&(n.position==="left"||n.position==="right")?n.width??jn:0},ze=(e,n=600,t=300)=>({width:(e.width??n)-Yt(e),height:(e.height??t)-(ge(e)?.position==="bottom"?Ae:0)}),Xt=(e,n,t)=>{let r=ge(e);return!r||!(r.position===void 0||r.position==="top")?0:(n?Math.max(1,Qt(n,t??ze(e).width,r)):1)*Ae},j=6.5;function We(e,n){let t=Array.from(e),r=Math.max(0,Math.floor(n/j));return t.length<=r?e:r===0?"":`${t.slice(0,r-1).join("")}\u2026`}var Oe=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:Ut(n)),Jt=(e,n)=>e.hiddenSeries?.includes(n)??!1;function Ze(e,n,t=[],r={},i=10,o=8,a=!1){let l=[],s=r.maxItems,c=s!==void 0&&s>=0&&e.length>s?e.slice(0,s):e,d=e.length-c.length,u=r.interactive??!0,m=o,y=i,b=(p,f,x,w)=>{let C=(f?18:4)+p.length*j;m>o&&(a||m+C>n-8)&&(m=o,y+=Ae),f&&l.push({kind:"rect",part:"legend-swatch",x:m,y:y-5,width:10,height:10,fill:f,opacity:w?.3:void 0,item:x}),l.push({kind:"text",part:"legend-label",x:m+(f?14:0),y,text:p,baseline:"middle",fill:w?S.grid:S.label,item:x}),m+=C+12};for(let p of c){let f=t.includes(p.name),x=u?{label:p.name,series:p.name,legend:!0}:void 0;b(r.formatter?.(p.name)??p.name,p.color,x,f)}return d>0&&b(`+${d} more`,void 0,void 0,!1),r.align==="end"?_n(l,n):l}function _n(e,n){let t=new Map;for(let i of e){let o=i.kind==="rect"?i.y+5:i.y;t.set(o,[...t.get(o)??[],i])}let r=[];for(let i of t.values()){let o=Math.max(...i.map(l=>l.kind==="rect"?l.x+l.width:l.x+l.text.length*j)),a=n-8-o;for(let l of i)r.push({...l,x:l.x+a})}return r}var Qt=(e,n,t={})=>new Set(Ze(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function Ue(e,n,t,r=[]){let i=ge(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,a=Kt(e),l=o?.position==="bottom",s=Yt(e),c=e.hiddenSeries??[],d=o?s?Ze(r,1/0,c,o,10,(o.position==="right"?n:0)+8,!0):Ze(r,n,c,o,l?t+10:10):[],u=l?Qt(r,n,o):0;return{width:n+s,height:l?t+Math.max(1,u)*Ae:t,legendOffset:o?.position==="left"?s:void 0,tooltip:a.enabled,tooltipFormatter:a.formatter,axisTooltipFormatter:a.axisFormatter,tooltipPortal:a.portal,tooltipPlacement:a.placement,tooltipAnchored:a.followPointer===!1?!0:void 0,description:e.description,decorative:e.decorative,animate:e.animate===!0?300:e.animate||void 0,responsive:!!e.responsive,shapes:d}}function qe(e){let n=e.legendOffset;if(!n)return e;let t=[...Wt(e.shapes.filter(s=>!s.part.startsWith("legend-")),n,0),...e.shapes.filter(s=>s.part.startsWith("legend-"))],r=s=>({...s,x:s.x+n}),i=e.hit?{...e.hit,plot:r(e.hit.plot),xs:e.hit.xs.map(s=>s+n),brush:e.hit.brush?{box:r(e.hit.brush.box),window:r(e.hit.brush.window)}:void 0}:void 0,o=e.edit,a=o?{...o,scale:s=>o.scale(s)+n,invert:s=>o.invert(s-n),bars:o.bars.map(s=>({...s,x0:s.x0+n,x1:s.x1+n}))}:void 0,l=e.map?{...e.map,plot:r(e.map.plot)}:void 0;return{...e,shapes:t,hit:i,edit:a,map:l,legendOffset:void 0}}function Le(e,n,t,r,i,o="auto"){let a=Array.isArray(t)?t:[t],l=Math.max(1,Math.floor((r-12)/j)),s=a.flatMap(f=>{let x=[],w=Array.from(f);for(;w.length>l;){let C=w.slice(0,l+1).lastIndexOf(" ");C<1&&(C=l),x.push(w.slice(0,C).join("")),w=w.slice(C),w[0]===" "&&w.shift()}return x.push(w.join("")),x}),c=Math.max(1,Math.floor((i-6)/16)),d=s.slice(0,c);s.length>c&&(d[c-1]=We(`${d[c-1]}\u2026`,r-12));let u=Math.min(r,Math.max(0,...d.map(f=>Array.from(f).length))*j+12),m=Math.min(i,6+d.length*16),y=o==="top"?{x:e-u/2,y:n-m-8}:o==="bottom"?{x:e-u/2,y:n+8}:o==="left"?{x:e-u-8,y:n-m/2}:o==="right"?{x:e+8,y:n-m/2}:{x:e+12,y:n-m-6},b=Math.max(0,Math.min(r-u,y.x)),p=Math.max(0,Math.min(i-m,y.y));return[{kind:"rect",part:"tooltip",title:a.join(`
2
- `),x:h(b),y:h(p),width:h(u),height:m,fill:"var(--skdx-color-surface-raised)",stroke:S.axis,rx:8},...d.map((f,x)=>({kind:"text",part:"tooltip-label",x:h(b+6),y:h(p+11+x*16),text:f,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:d.length>1&&x===0?"bold":void 0}))]}function Ke(e,n){let[t,r]=ce(e);return n?[Math.min(0,t),Math.max(0,r)]:[t,r]}function Ye([e,n],t,r=!1,i){let o=typeof r=="boolean"?{scale:r?"log":"linear"}:r,a=Se(o.format??i),l=o.min??e,s=o.max??n;o.reversed&&(t=[t[1],t[0]]);let c={id:o.id,position:o.position,options:o};if(o.scale==="sqrt"){let p=M=>Math.sign(M)*Math.sqrt(Math.abs(M)),f=o.nice===!1?[l,s]:Ie(l,s,o.ticks),x=o.min??f[0],w=o.max??f[f.length-1],C=Ce([p(x),p(w)],t),O=M=>C(p(M)),z=Ie(x,w,o.ticks).filter(M=>M>=x-1e-9&&M<=w+1e-9);return{...c,scale:O,domain:[x,w],format:a,ticks:(z.length>=2?z:[x,w]).map(M=>({pos:h(O(M)),label:a(M)})),zero:h(O(Math.min(Math.max(0,x),w)))}}if(o.scale==="log"){let p=Math.max(l,Number.EPSILON),f=Math.max(s,p),x=Zt(p,f),w=[Math.log10(p),Math.log10(f)],C=Ce(w,t),O=z=>C(Math.log10(Math.max(z,Number.EPSILON)));return{...c,scale:O,domain:w,format:a,ticks:x.map(z=>({pos:h(O(z)),label:a(z)})),zero:h(t[0])}}let d=Ie(l,s,o.ticks),u=[o.min??(o.nice===!1?l:d[0]),o.max??(o.nice===!1?s:d[d.length-1])],m=Ce(u,t),y=d.filter(p=>p>=u[0]-1e-9&&p<=u[1]+1e-9),b=(y.length>=2?y:[u[0],u[1]]).map(p=>({pos:h(m(p)),label:a(p)}));return{...c,scale:m,domain:u,format:a,ticks:b,zero:h(m(Math.min(Math.max(0,u[0]),u[1])))}}function en(e,n){if(e.length<2)return e;let t=e.reduce((i,o)=>Math.max(i,o.label.length),0)*j+8,r=Math.max(1,Math.ceil(e.length*t/Math.max(1,n)));return r===1?e:e.filter((i,o)=>o%r===0)}function tn(e,n,t,r){let i=e.error!==void 0?"error":e.loading?"loading":n?"empty":null;if(!i)return null;let{width:o,height:a}=ze(e,t,r),l=i==="error"?e.error:i==="loading"?"Loading\u2026":e.emptyMessage??"No data available",s=[];return i==="loading"&&s.push({kind:"rect",part:"skeleton",x:0,y:0,width:o,height:a,fill:"var(--skdx-color-surface-sunken)",rx:8}),s.push({kind:"text",part:`state-${i}`,x:h(o/2),y:h(a/2),text:l,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":S.label}),{...Ue(e,o,a),shapes:s,tooltip:!1}}var Re=(e,n,t)=>{let r=n.length*j/2;return e+r>t?"end":e-r<0?"start":"middle"};function nn(e,n={}){let{plot:t,xTicks:r,yTicks:i,baseline:o}=e,a=t.x+t.width,l=t.y+t.height,s=[],c=n.grid??!0,d=(b,p)=>p?{kind:"line",part:"grid",x1:b.pos,x2:b.pos,y1:t.y,y2:l,stroke:S.grid}:{kind:"line",part:"grid",x1:t.x,x2:a,y1:b.pos,y2:b.pos,stroke:S.grid},u=n.x?.tickRotation??0,m=(b,p,f,x)=>u?L(b,p,f,{part:x,anchor:u<0?"end":"start",baseline:"middle",rotate:u}):En(b,p,f,e.width,{part:x,anchor:Re(b,f,e.width)}),y=(b,p,f,x,w)=>{for(let C of b)s.push(p==="x"?{kind:"line",part:"tick",x1:C.pos,x2:C.pos,y1:f,y2:h(f+x*w),stroke:S.axis}:{kind:"line",part:"tick",x1:f,x2:h(f+x*w),y1:C.pos,y2:C.pos,stroke:S.axis})};if(n.categoryGrid)for(let b of r)s.push(d(b,!n.horizontal));if(n.horizontal){let b=n.axes??[{ticks:i,position:"bottom",offset:0,label:n.yLabel,...n.y}];if(c)for(let p of i)s.push(d(p,!0));b[0]?.showLine!==!1&&s.push({kind:"line",part:"axis",x1:o,x2:o,y1:t.y,y2:l,stroke:S.axis});for(let p of b){let f=p.position==="top"||p.position==="right",x=h(f?t.y-p.offset:l+p.offset),w=f||p.offset>0;p.showLine&&w&&s.push({kind:"line",part:"axis",x1:t.x,x2:a,y1:x,y2:x,stroke:S.axis}),p.showTicks&&y(p.ticks,"x",x,f?-1:1,p.tickSize??4);let C=h(f?x-8:x+20);for(let O of p.ticks)s.push(f?L(O.pos,C,O.label,{part:"x-label-top",anchor:Re(O.pos,O.label,e.width)}):m(O.pos,C,O.label,"x-label"));p.label&&s.push(w?L(4,C,p.label,{part:"axis-title",anchor:"start",baseline:f?void 0:"middle"}):L(4,t.y-6,p.label,{part:"axis-title",anchor:"start"}))}n.x?.showLine&&s.push({kind:"line",part:"axis",x1:n.rtl?a:t.x,x2:n.rtl?a:t.x,y1:t.y,y2:l,stroke:S.axis}),n.x?.showTicks&&y(r,"y",n.rtl?a:t.x,n.rtl?1:-1,n.x.tickSize??4);for(let p of r)s.push(n.rtl?L(a+8,p.pos,p.label,{part:"y-label",anchor:"start",baseline:"middle"}):L(t.x-8,p.pos,p.label,{part:"y-label",anchor:"end",baseline:"middle"}))}else{if(c)for(let p of i)s.push(d(p,!1));n.y?.showLine!==!1&&s.push({kind:"line",part:"axis",x1:t.x,x2:a,y1:o,y2:o,stroke:S.axis});let b=n.axes??[{ticks:i,position:"left",offset:0,label:n.yLabel,...n.y},...n.rightTicks?[{ticks:n.rightTicks,position:"right",offset:0,label:n.rightLabel}]:[]];for(let p of b){let f=p.position==="left",x=f?t.x-p.offset:a+p.offset,w=f?"y-label":"y-label-right";p.showLine&&s.push({kind:"line",part:"axis",x1:h(x),x2:h(x),y1:t.y,y2:l,stroke:S.axis}),p.showTicks&&y(p.ticks,"y",h(x),f?-1:1,p.tickSize??4);for(let C of p.ticks)s.push(L(h(f?x-8:x+8),C.pos,C.label,{part:w,anchor:f?"end":"start",baseline:"middle"}));p.label&&s.push(L(h(f?p.offset===0?4:Math.max(4,x-40):p.offset===0?e.width-4:Math.min(e.width-4,x+40)),t.y-6,p.label,{part:"axis-title",anchor:f?"start":"end"}))}n.x?.showTicks&&y(r,"x",l,1,n.x.tickSize??4);for(let p of r)s.push(m(p.pos,l+(u?12:20),p.label,"x-label"))}return n.xLabel&&s.push(L(h(t.x+t.width/2),e.height-4,n.xLabel,{part:"axis-title",anchor:"middle"})),n.horizontal&&n.rightLabel&&s.push(L(e.width-4,t.y-6,n.rightLabel,{part:"axis-title",anchor:"end"})),s}var L=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:S.label,...r});function En(e,n,t,r,i={}){let o=Math.max(4,Math.min(r-4,e)),a=i.anchor??"start",l=a==="middle"?2*Math.min(o-4,r-o-4):a==="end"?o-4:r-o-4,s=We(t,l);return{kind:"text",part:"label",x:o,y:n,fill:S.label,...i,text:s,title:s===t?i.title:t}}var rn=(e,n,t,r,i,o)=>({kind:"circle",part:"point",cx:e,cy:n,r:t,fill:r,title:i,item:o});function Xe(e,n){let t=[],{plot:r}=n,i=r.x+r.width,o=r.y+r.height,a=s=>Math.max(r.x,Math.min(i,s)),l=s=>Math.max(r.y,Math.min(o,s));for(let s of e??[]){let c=s.color??Te(s.variant),d=s.color??Ve(s.variant),u={part:"reference-label",fill:d},m=n.horizontal===!0;if("y"in s){let y=h(n.y(s.y,s.axis??"left"));if(m){let b=a(y);t.push(...an(b,r.y,o,c,s.label,u))}else{let b=l(y);t.push(...on(r.x,i,b,c,s.label,u))}}else if("x"in s){let y=n.x(s.x);if(y===void 0)continue;m?t.push(...on(r.x,i,l(h(y)),c,s.label,u)):t.push(...an(a(h(y)),r.y,o,c,s.label,u))}else if("y1"in s){let y=h(n.y(s.y1,s.axis??"left")),b=h(n.y(s.y2,s.axis??"left"));m?t.push(...ln(a(Math.min(y,b)),a(Math.max(y,b)),r,c,s.label,d)):t.push(...sn(l(Math.min(y,b)),l(Math.max(y,b)),r,c,s.label,d))}else{let y=n.x(s.x1),b=n.x(s.x2);if(y===void 0||b===void 0)continue;let p=h(Math.min(y,b)),f=h(Math.max(y,b));m?t.push(...sn(l(p),l(f),r,c,s.label,d)):t.push(...ln(a(p),a(f),r,c,s.label,d))}}return t}function on(e,n,t,r,i,o){let a={kind:"line",part:"reference",x1:e,x2:n,y1:t,y2:t,stroke:r,dash:"6 4",strokeWidth:1.5,title:i};return i?[a,L(n-4,t-5,i,{...o,anchor:"end"})]:[a]}function an(e,n,t,r,i,o){let a={kind:"line",part:"reference",x1:e,x2:e,y1:n,y2:t,stroke:r,dash:"6 4",strokeWidth:1.5,title:i};return i?[a,L(e+4,n+10,i,{...o,anchor:"start"})]:[a]}function sn(e,n,t,r,i,o){let a={kind:"rect",part:"reference-area",x:t.x,y:e,width:t.width,height:h(Math.max(0,n-e)),fill:r,opacity:.12,title:i};return i?[a,L(t.x+t.width-4,e+12,i,{part:"reference-label",fill:o,anchor:"end"})]:[a]}function ln(e,n,t,r,i,o){let a={kind:"rect",part:"reference-area",x:e,y:t.y,width:h(Math.max(0,n-e)),height:t.height,fill:r,opacity:.12,title:i};return i?[a,L(e+4,t.y+12,i,{part:"reference-label",fill:o,anchor:"start"})]:[a]}function cn(e,n){let t=[],{plot:r}=n,i=r.x+r.width,o=r.y+r.height;for(let a of e??[]){let l=a.color??Te(a.variant),s=a.color??Ve(a.variant),c=(b,p,f)=>{let x=n.x(b);if(x===void 0)return;let w=n.y(p,f??"left");return n.horizontal?{x:h(w),y:h(x)}:{x:h(x),y:h(w)}},d=a.id??a.label,u=b=>({label:b,id:d,name:a.label});if(a.type==="line"||a.type==="band"){let{type:b,id:p,...f}=a;t.push(...Xe([f],n));continue}if(a.type==="rect"){let b=c(a.x1,a.y1,a.axis),p=c(a.x2,a.y2,a.axis);if(!b||!p)continue;let f=Math.max(r.x,Math.min(b.x,p.x)),x=Math.max(r.y,Math.min(b.y,p.y)),w=a.label??"";t.push({kind:"rect",part:"annotation-rect",x:h(f),y:h(x),width:h(Math.max(0,Math.min(i,Math.max(b.x,p.x))-f)),height:h(Math.max(0,Math.min(o,Math.max(b.y,p.y))-x)),fill:l,opacity:.12,stroke:l,title:w||void 0,item:w?u(w):void 0}),a.label&&t.push(L(h(f+4),h(x+12),a.label,{part:"annotation-label",fill:s}));continue}let m=c(a.x,a.y,a.axis);if(!m)continue;if(a.type==="text"){t.push(L(m.x,m.y,a.text,{part:"annotation-text",fill:s,anchor:"middle",baseline:"middle",title:a.label}));continue}let y=a.label??`${String(a.x)}, ${a.y}`;if(t.push({kind:"circle",part:"annotation-point",cx:m.x,cy:m.y,r:5,fill:l,stroke:"var(--skdx-color-surface-default)",title:y,item:u(y)}),a.type==="callout"&&a.label){let[b,p]=a.offset??[16,-16],f=h(Math.max(r.x,Math.min(i,m.x+b))),x=h(Math.max(r.y,Math.min(o,m.y+p)));t.push({kind:"line",part:"annotation-leader",x1:m.x,y1:m.y,x2:f,y2:x,stroke:l},L(f,x,a.label,{part:"annotation-label",fill:s,anchor:b>=0?"start":"end",baseline:"middle"}))}}return t}var ye=e=>Math.max(0,Math.min(1,e));function dn(e){let n=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(n){let r=n[1],i=r.length===3?r.split("").map(o=>o+o).join(""):r;return[0,2,4].map(o=>parseInt(i.slice(o,o+2),16))}let t=/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)/i.exec(e.trim());return t?[Number(t[1]),Number(t[2]),Number(t[3])]:void 0}function un(e,n){if(e.length===0)return S.axis;if(e.length===1)return e[0];let t=ye(n)*(e.length-1),r=Math.min(e.length-2,Math.floor(t)),i=t-r,o=dn(e[r]),a=dn(e[r+1]);if(!o||!a)return e[Math.round(t)];let l=s=>Math.round(o[s]+(a[s]-o[s])*i);return`rgb(${l(0)}, ${l(1)}, ${l(2)})`}var hn=(e,n)=>n!==void 0&&n>=2?Math.min(n-1,Math.floor(ye(e)*n))/(n-1):ye(e);function pn(e,n,t,r=S.negative,i=String){let[o,a]=ce(n),l=e??{type:"sequential"},s=f=>h(.15+.85*f);if(l.type==="threshold"){let{thresholds:f,colors:x,labels:w}=l,C=z=>{if(typeof z!="number"||!Number.isFinite(z))return;let M=0;for(;M<f.length&&z>=f[M];)M++;return{fill:x[Math.min(M,x.length-1)]??t,opacity:1}},O=x.map((z,M)=>({fill:z,opacity:1,label:w?.[M]??(M===0?`< ${i(f[0]??0)}`:M===f.length?`\u2265 ${i(f[M-1])}`:`${i(f[M-1])} \u2013 ${i(f[M])}`)}));return{color:C,domain:[o,a],swatches:O,kind:"threshold"}}if(l.type==="ordinal"){let f=l.colors?.length?l.colors:[t];return{color:w=>typeof w=="number"&&Number.isFinite(w)?{fill:f[Math.abs(Math.round(w))%f.length],opacity:1}:void 0,domain:[o,a],swatches:f.map((w,C)=>({fill:w,opacity:1,label:String(C)})),kind:"ordinal"}}if(l.type==="diverging"){let[f,x,w]=l.domain??[-Math.max(Math.abs(o),Math.abs(a)),0,Math.max(Math.abs(o),Math.abs(a))],C=l.colors,O=F=>F<x?.5*(F-f)/Math.max(1e-12,x-f):.5+.5*(F-x)/Math.max(1e-12,w-x),z=F=>{let U=hn(l.reversed?1-ye(F):F,l.steps);if(C&&C.length>=2)return{fill:un(C,U),opacity:1};let N=U<.5?r:t,E=Math.abs(U-.5)*2;return{fill:N,opacity:s(E)}},M=F=>typeof F=="number"&&Number.isFinite(F)?z(O(F)):void 0,_=l.steps??5,X=Array.from({length:_},(F,U)=>{let N=_===1?.5:U/(_-1),E=N<.5?f+(x-f)*(N*2):x+(w-x)*((N-.5)*2);return{...z(N),label:i(E)}});return{color:M,domain:[f,w],swatches:X,kind:"diverging"}}let[c,d]=l.domain??[o,a],u=l.colors,m=f=>{let x=hn(l.reversed?1-ye(f):f,l.steps);return u&&u.length>=2?{fill:un(u,x),opacity:1}:{fill:u?.[0]??t,opacity:s(x)}},y=f=>typeof f!="number"||!Number.isFinite(f)?void 0:m(d===c?1:(f-c)/(d-c)),b=l.steps??5,p=Array.from({length:b},(f,x)=>{let w=b===1?1:x/(b-1);return{...m(w),label:i(c+(d-c)*w)}});return{color:y,domain:[c,d],swatches:p,kind:"sequential"}}var Hn=34,Vn=72;function fn(e){if(!e)return{bottom:0,right:0,options:{}};let n=e===!0?{}:e;return n.orientation==="vertical"?{bottom:0,right:Vn,options:n}:{bottom:Hn,right:0,options:n}}function mn(e,n,t){let r=typeof t=="string"?{title:t}:t??{},i=r.title,o=e.swatches;if(o.length===0||n.width<=0)return[];if(r.orientation==="vertical"){let d=Math.max(0,n.height-(i?16:0)),u=Math.min(16,d/o.length),m=n.y+(i?16:0),y=o.map((p,f)=>({kind:"rect",part:"color-legend-swatch",x:h(n.x),y:h(m+f*u),width:10,height:h(u),fill:p.fill,opacity:p.opacity,title:p.label})),b=u>=12?1:2;return o.forEach((p,f)=>{f%b!==0&&f!==o.length-1||y.push({kind:"text",part:"color-legend-label",x:h(n.x+14),y:h(m+(f+.5)*u),text:p.label,baseline:"middle",fill:S.label})}),i&&y.push({kind:"text",part:"color-legend-title",x:h(n.x),y:h(n.y+6),text:i,baseline:"middle",fill:S.label}),y}let a=Math.min(n.width/o.length,96),l=n.x+(n.width-a*o.length)/2,s=o.map((d,u)=>({kind:"rect",part:"color-legend-swatch",x:h(l+u*a),y:h(n.y),width:h(a),height:10,fill:d.fill,opacity:d.opacity,title:d.label})),c=e.kind==="threshold"?1:Math.max(1,Math.ceil(o.length*7*j/Math.max(1,a*o.length)));return o.forEach((d,u)=>{u%c!==0&&u!==o.length-1||s.push({kind:"text",part:"color-legend-label",x:h(l+(u+.5)*a),y:h(n.y+22),text:d.label,anchor:"middle",fill:S.label})}),i&&s.push({kind:"text",part:"color-legend-title",x:h(l-6),y:h(n.y+5),text:i,anchor:"end",baseline:"middle",fill:S.label}),s}var Zn=1e4,Wn=e=>Array.isArray(e)?{x:e[0],y:e[1],size:e[2],label:void 0,id:void 0,color:void 0,value:void 0}:{x:e.x,y:e.y,size:e.size,label:e.label,id:e.id,color:e.color,value:e.value};function Un(e,n,t,r,i,o,a,l){if(r==="circle")return{...rn(e,n,t,i,o,a),part:l};let s=r==="square"?`M${h(e-t)} ${h(n-t)}h${h(2*t)}v${h(2*t)}h${h(-2*t)}Z`:r==="diamond"?`M${h(e)} ${h(n-t*1.3)}L${h(e+t*1.3)} ${h(n)}L${h(e)} ${h(n+t*1.3)}L${h(e-t*1.3)} ${h(n)}Z`:`M${h(e)} ${h(n-t*1.2)}L${h(e+t*1.15)} ${h(n+t*.9)}L${h(e-t*1.15)} ${h(n+t*.9)}Z`;return{kind:"path",part:l,d:s,fill:i,title:o,item:a}}function qn(e,n){let t=[],r=e.series.map((v,P)=>({name:v.name,id:v.id,symbol:v.symbol??"circle",color:Oe(e,P,v.color),data:Jt(e,v.name)?[]:v.data.flatMap((I,G)=>{let B=Wn(I);return le(B.x)&&le(B.y)?[{...B,index:G}]:[]})})),i=e.sampling==="auto"?Zn:typeof e.sampling=="object"?e.sampling.threshold:1/0,o=r.reduce((v,P)=>v+P.data.length,0),a=o>i?Math.ceil(o/i):1;a>1&&t.push({code:"sampled",severity:"warning",message:`${o} points exceed the sampling threshold of ${i}; every ${a}th point is drawn.`});let l=a>1?r.map(v=>({...v,data:v.data.filter((P,I)=>I%a===0)})):r,s=l.flatMap(v=>v.data),c=tn(e,s.length===0);if(c)return{...c,issues:t};let{width:d,height:u}=ze(e),m=e.colorScale?fn(e.colorLegend):{bottom:0,right:0,options:{}},y=e.series.map((v,P)=>({name:v.name,color:Oe(e,P,v.color)})),b=qt(d,u,{...de,top:de.top+Xt(e,y,d)+(e.yAxis?.label?12:0),right:de.right+m.right,bottom:de.bottom+(e.xAxis?.label?14:0)+m.bottom}),p=e.markerSize??3,f=Math.max(0,e.hitRadius??0),x=Math.max(0,e.jitter??0),w=ce(s.map(v=>v.size)),C=v=>v==="diamond"?1.3:v==="triangle"?1.2:1,O=(v,P)=>Math.max(0,P?n.radius(v.size,w):p),z=0;for(let v of l){let P=v.data.some(G=>G.size!==void 0),I=C(v.symbol);for(let G of v.data)z=Math.max(z,O(G,P)*I)}let M=Math.min(1,Math.min(b.width,b.height)*.45/Math.max(1,z+x)),_=x*M,X=z*M+_,F=new Map,U=e.colorScale?pn(e.colorScale,s.map(v=>v.value),Oe(e,0),void 0,Se(e.format)):void 0,N=Ye(Ke(s.map(v=>v.x),!1),[b.x+X,b.x+b.width-X],e.xAxis??{},e.format),E=Ye(Ke(s.map(v=>v.y),!1),[b.y+b.height-X,b.y+X],e.yAxis??{},e.format),_e=Ue(e,d,u,y),fe=[],Rt=[],Ee=[],Pt=[];for(let v of l){let P=v.data.some(I=>I.size!==void 0);for(let I of v.data){let G=I.index,B=n.describe(v.name,I,N,E),Y=O(I,P)*M,H=h(N.scale(I.x)),q=h(E.scale(I.y));if(_>0){let ae=`${Math.round(H)},${Math.round(q)}`,ie=F.get(ae)??0;if(F.set(ae,ie+1),ie>0){let se=ie*2.399963;H=h(H+_*Math.cos(se)),q=h(q+_*Math.sin(se))}}let oe=U?.color(I.value),Z={label:B,id:I.id,series:v.name,seriesId:v.id??v.name,name:I.label,index:G,value:I.y},ee=I.color??oe?.fill??v.color;if(fe.push(Un(H,q,h(Y),v.symbol,ee,B,Z,P?n.part:"point")),f>0&&fe.push({kind:"circle",part:"hit",cx:H,cy:q,r:h(Y+f),fill:ee,opacity:0,title:B,item:Z}),e.labels&&I.label){let ae=I.label.length*j,ie=H-ae/2,se=q-Y-4;Pt.some(ke=>Math.abs(ke.y-se)<12&&ie<ke.x+ke.w+4&&ie+ae+4>ke.x)||(Pt.push({x:ie,y:se,w:ae}),Rt.push(L(H,h(se),I.label,{part:"point-label",anchor:"middle",fill:"var(--skdx-color-text-default)"})))}}if(e.trendline&&v.data.length>=2){let I=e.trendline===!0?"linear":e.trendline,G=Kn(v.data.map(B=>[B.x,B.y]),I);if(G){let[B,Y]=N.domain,H=`${v.name} trend${I==="linear"?"":` (${I})`}: r\xB2 ${G.r2.toFixed(2)}`,q=v.color;if(I==="linear")Ee.push({kind:"line",part:"trendline",x1:h(N.scale(B)),y1:h(E.scale(G.predict(B))),x2:h(N.scale(Y)),y2:h(E.scale(G.predict(Y))),stroke:q,dash:"5 4",strokeWidth:1.5,title:H});else{let oe=Array.from({length:40},(Z,ee)=>B+(Y-B)*ee/39).map(Z=>({v:Z,p:G.predict(Z)})).filter(({p:Z})=>Number.isFinite(Z)).map(({v:Z,p:ee})=>({x:h(N.scale(Z)),y:h(E.scale(ee))}));oe.length>1&&Ee.push({kind:"path",part:"trendline",d:Vt(oe),stroke:q,dash:"5 4",strokeWidth:1.5,title:H})}}}}let Bt=-1/0,Nt=en(N.ticks,Math.max(1,b.width-2*X)),Dt=new Set;for(let v of[...Nt].sort((P,I)=>P.pos-I.pos)){let P=v.label.length*j,I=e.xAxis?.tickRotation??0,G=I?I<0?"end":"start":Re(v.pos,v.label,d),B=-(G==="end"?P:G==="middle"?P/2:0),Y=I*Math.PI/180,H=[B,B+P].flatMap(Z=>[-7,7].map(ee=>v.pos+Z*Math.cos(Y)-ee*Math.sin(Y))),q=Math.min(...H),oe=Math.max(...H);q<Bt+4||(Bt=oe,Dt.add(v))}let Tn=Nt.filter(v=>Dt.has(v)),Ft={..._e,plot:b,xTicks:Tn,yTicks:E.ticks,baseline:E.zero},Gt={plot:b,x:v=>N.scale(Et(v)),y:v=>E.scale(v)},An=Xe(e.references,Gt),zn=U&&(m.bottom||m.right)?mn(U,m.right?{x:b.x+b.width+12,y:b.y,width:m.right,height:b.height}:{x:b.x,y:u-m.bottom+8,width:b.width,height:m.bottom},m.options):[],jt=n.opacity;return{..._e,shapes:[...nn({...Ft,height:Ft.height-m.bottom},{xLabel:e.xAxis?.label,x:e.xAxis,y:{showLine:e.yAxis?.showLine,showTicks:e.yAxis?.showTicks,tickSize:e.yAxis?.tickSize,tickRotation:e.yAxis?.tickRotation}}),...e.yAxis?.label?[L(4,b.y-14,e.yAxis.label,{part:"axis-title",anchor:"start"})]:[],...An,...jt!==void 0&&fe.some(v=>v.part===n.part)?fe.map(v=>(v.kind==="circle"||v.kind==="path")&&v.part!=="hit"?{...v,opacity:jt}:v):fe,...Ee,...Rt,...cn(e.annotations,Gt),...zn,..._e.shapes],issues:t}}function Kn(e,n="linear"){let t;if(n==="polynomial"){let s=0,c=0,d=0,u=0,m=0,y=0,b=0,p=0;for(let[M,_]of e)s+=1,c+=M,d+=M*M,u+=M**3,m+=M**4,y+=_,b+=M*_,p+=M*M*_;let f=M=>M[0]*(M[4]*M[8]-M[5]*M[7])-M[1]*(M[3]*M[8]-M[5]*M[6])+M[2]*(M[3]*M[7]-M[4]*M[6]),w=f([m,u,d,u,d,c,d,c,s]);if(Math.abs(w)<1e-12)return;let C=f([p,u,d,b,d,c,y,c,s])/w,O=f([m,p,d,u,b,c,d,y,s])/w,z=f([m,u,p,u,d,b,d,c,y])/w;t=M=>C*M*M+O*M+z}else{let s=n==="logarithmic"||n==="power"?Math.log:y=>y,c=n==="exponential"||n==="power"?Math.log:y=>y,d=e.filter(([y,b])=>Number.isFinite(s(y))&&Number.isFinite(c(b))),u=Yn(d.map(([y,b])=>[s(y),c(b)]));if(!u)return;let m=n==="exponential"||n==="power"?Math.exp:y=>y;t=y=>m(u.intercept+u.slope*s(y))}let r=t,i=e.filter(([s])=>Number.isFinite(r(s)));if(i.length===0)return;let o=i.reduce((s,[,c])=>s+c,0)/i.length,a=0,l=0;for(let[s,c]of i)a+=(c-r(s))**2,l+=(c-o)**2;return{predict:r,r2:l===0?1:Math.max(0,1-a/l)}}function Je(e){let[n,t]=e.sizeRange??[3,18];return qn(e,{part:"bubble",opacity:.7,radius:(r,[i,o])=>le(r)?o===i?(n+t)/2:n+Math.sqrt((r-i)/(o-i))*(t-n):3,describe:(r,i,o,a)=>`${r}${i.label?` ${i.label}`:""}: ${o.format(i.x)}, ${a.format(i.y)}${le(i.size)?` (${a.format(i.size)})`:""}`})}function Yn(e){let n=e.length,t=e.reduce((c,d)=>c+d[0],0)/n,r=e.reduce((c,d)=>c+d[1],0)/n,i=0,o=0,a=0;for(let[c,d]of e)i+=(c-t)**2,o+=(c-t)*(d-r),a+=(d-r)**2;if(i===0)return;let l=o/i,s=a===0?1:o*o/(i*a);return{slope:l,intercept:r-l*t,r2:s}}function Pe(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var Qe=e=>e.id??e.name??e.series,bn=e=>e.seriesId??e.series;function J(e,n){let t=!1;return n.id!==void 0&&(t=!0,Qe(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,bn(e)!==n.series&&e.series!==n.series)||n.index!==void 0&&(t=!0,e.index!==n.index)||n.category!==void 0&&(t=!0,e.category!==n.category)?!1:t}function te(e){let n={},t=Qe(e);t!==void 0&&(n.id=t);let r=bn(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var et=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function tt(e,n,t){let r=Pe(e),i=te(n),o=r.some(a=>J(n,a));return t==="single"?o?[]:[i]:o?r.filter(a=>!J(n,a)):[...r,i]}var Xn=.2;function Jn(e){let n=S.focus;switch(e.kind){case"rect":return{kind:"rect",part:"selected",x:e.x-1.5,y:e.y-1.5,width:e.width+3,height:e.height+3,fill:"none",stroke:n,rx:e.rx};case"circle":return{kind:"circle",part:"selected",cx:e.cx,cy:e.cy,r:e.r+2.5,fill:"none",stroke:n};case"path":return{kind:"path",part:"selected",d:e.d,fill:"none",stroke:n,strokeWidth:2.5};case"line":return{...e,part:"selected",stroke:n,strokeWidth:(e.strokeWidth??1)+3,title:void 0,item:void 0};case"text":return}}var Qn=(e,n)=>e.kind==="text"?{...e,fill:S.grid}:{...e,opacity:(e.opacity??1)*n};function nt(e,n){let t=Pe(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:Pe(n.highlighted),i=r[0];if(t.length===0&&!i)return e;let o={highlighted:n.highlightScope?.highlighted??"item",faded:n.highlightScope?.faded??"global"},a=[],l=d=>!i||r.some(u=>J(d,u))?!0:o.highlighted==="series"?r.some(u=>u.series!==void 0&&J(d,{series:u.series})):!1,s=d=>{if(!i||o.faded==="none"||l(d))return!1;if(o.faded==="series"){let u=i.series;return u!==void 0&&J(d,{series:u})}return!0},c=e.shapes.map(d=>{let u=d.item;if(!u||u.legend)return d;if(t.some(m=>J(u,m))){let m=Jn(d);m&&a.push(m)}return s(u)?Qn(d,Xn):d});return a.length?{...e,shapes:[...c,...a]}:{...e,shapes:c}}var xn="var(--skdx-radius-default, var(--skdx-radius-md, 0.5rem))";function Be(e){return["tooltip","skeleton","label-background","stage-label-background","brush-handle"].includes(e)?xn:void 0}function pe(e,n,t,r,i){let o=e.getBoundingClientRect();return{x:o.width?(n-o.left)*r/o.width:n,y:o.height?(t-o.top)*i/o.height:t}}var rt=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function gn(e,n){let t=0,r=1/0;return e.xs.forEach((i,o)=>{let a=Math.abs(i-n);a<r&&(r=a,t=o)}),t}function ve(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=gn(t,n),i=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(i,r)??i}}function it(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[gn(t,n)];return{kind:"line",part:"crosshair",x1:r,x2:r,y1:t.plot.y,y2:t.plot.y+t.plot.height,stroke:S.axis,dash:"3 3"}}function ot(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!rt(r.plot,n,t))return[];let i=it(e,n),{rows:o}=ve(e,n),a=e.tooltipAnchored?r.plot.y+8:t;return[i,...Le(i.x1,a,o,e.width,e.height,e.tooltipPlacement)]}function at(e,n){let t=e.hit;if(!t||t.xs.length===0)return[];let r=t.rows.findIndex(o=>o[0]===n);if(r<0)return[];let i=t.xs[r];return ot(e,i,t.plot.y+8)}function st(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:s,y:c}=pe(t,r,i,e.width,e.height);if(rt(e.hit.plot,s,c)){let d=ve(e,s),u=it(e,s);if(d&&u)return{lines:d.rows,shapes:[u]}}}let o=n?.closest?.("[data-skdx-part]"),a=e.tooltipFormatter?ne(e,n)?.item:void 0,l=a&&e.tooltipFormatter?.(a)||o&&Array.from(o.children).find(s=>s.tagName.toLowerCase()==="title")?.textContent;return l?{lines:Array.isArray(l)?l:[l],shapes:[]}:{lines:[],shapes:[]}}function yn(e,n,t,r,i,o,a){let l=e?.closest?.("[data-skdx-part]"),s=a&&a.tooltipFormatter?ne(a,e)?.item:void 0,c=s&&a?.tooltipFormatter?.(s)||l&&Array.from(l.children).find(b=>b.tagName.toLowerCase()==="title")?.textContent;if(!c)return[];let d=a?.tooltipAnchored?ne(a,e):void 0,u=d?a?.shapes[d.index]:void 0,{x:m,y}=u?we(u):pe(n,t,r,i,o);return Le(m,y,c,i,o,a?.tooltipPlacement)}function lt(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:a}=pe(t,r,i,e.width,e.height),l=ot(e,o,a);if(l.length>0)return l}return yn(n,t,r,i,e.width,e.height,e)}function ct(e,n){let t=ne(e,n);return t&&!t.item.legend?te(t.item):null}var er=(e,n)=>{let{x:t,y:r}=we(e),i=e.kind==="circle"?e.cy:e.kind==="rect"?e.y+e.height/2:r;return t>=n.x&&t<=n.x+n.width&&i>=n.y&&i<=n.y+n.height};function dt(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!er(i,n))continue;let o=te(i.item),a=JSON.stringify(o);t.has(a)||(t.add(a),r.push(o))}return r}var ut=e=>({kind:"rect",part:"selection-box",x:h(e.x),y:h(e.y),width:h(e.width),height:h(e.height),fill:S.focus,opacity:.12,stroke:S.focus}),De=(e,n,t,r)=>({x:Math.min(e,t),y:Math.min(n,r),width:Math.abs(t-e),height:Math.abs(r-n)});function vn(e,n,t){let r=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){let a=e[i],l=e[o];a.y>t!=l.y>t&&n<(l.x-a.x)*(t-a.y)/(l.y-a.y)+a.x&&(r=!r)}return r}function ht(e,n){if(n.length<3)return[];let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor")continue;let{x:o,y:a}=we(i),l=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:a;if(!vn(n,o,l))continue;let s=te(i.item),c=JSON.stringify(s);t.has(c)||(t.add(c),r.push(s))}return r}var pt=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${h(n.x)} ${h(n.y)}`).join("L")}`:"",fill:S.focus,fillOpacity:.12,stroke:S.focus,dash:"4 3"}),Ne=6;function ft(e,n,t){let r=e.edit;if(r){for(let i of r.bars)if(!(t<i.y||t>i.y+i.height||n<i.x0-Ne||n>i.x1+Ne))return Math.abs(n-i.x0)<=Ne?{bar:i,mode:"start"}:Math.abs(n-i.x1)<=Ne?{bar:i,mode:"end"}:{bar:i,mode:"move"}}}function mt(e,n,t){let r=e.edit;return wn(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function bt(e,n,t){let r=e.edit,i=t.key==="ArrowRight"?1:t.key==="ArrowLeft"?-1:0;if(!r||n===null||!i||!(t.shiftKey||t.altKey))return;let o=r.bars.find(s=>s.index===n);if(!o)return;let a=t.altKey?t.shiftKey?"start":"end":"move",l=r.snap??r.invert(o.x0+10)-r.invert(o.x0);return wn(r,{bar:o,mode:a},i*l)}function wn(e,{bar:n,mode:t},r){let i=l=>e.snap?Math.round(l/e.snap)*e.snap:l,o=n.start,a=n.end;return t==="move"?(o=i(n.start+r),a=o+(n.end-n.start)):t==="start"?o=Math.min(i(n.start+r),n.end):a=Math.max(i(n.end+r),n.start),{id:n.id,name:n.name,start:o,end:a}}function xt(e,n,t){let r=e.edit,i=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:h(Math.min(i,o)),y:h(n.bar.y),width:h(Math.max(1,Math.abs(o-i))),height:h(n.bar.height),fill:S.focus,opacity:.25,stroke:S.focus,rx:2}}var tr=64,nr=e=>Math.max(1,Math.min(tr,e));function gt(e,n,t,r){let i=n>0?.8:1.25,o=nr(e.view.zoom*i);if(o===e.view.zoom)return e.view;let{plot:a,scale:l}=e,[s,c]=e.view.center,d=(t-(a.x+a.width/2))/l,u=(r-(a.y+a.height/2))/l,m=e.view.zoom/o;return{center:[s+d*(1-m),e.fromY(e.toY(c)-u*(1-m))],zoom:o}}function yt(e,n,t,r){let{scale:i}=e;return{center:[n.center[0]-t/i,e.fromY(e.toY(n.center[1])+r/i)],zoom:n.zoom}}function ne(e,n){let t=n?.closest?.("[data-skdx-i]"),r=Number(t?.getAttribute("data-skdx-i")),i=Number.isInteger(r)?e.shapes[r]?.item:void 0;return i?{index:r,item:i}:void 0}var Fe=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function we(e){switch(e.kind){case"rect":return{x:e.x+e.width/2,y:e.y};case"circle":return{x:e.cx,y:e.cy-e.r};case"line":return{x:(e.x1+e.x2)/2,y:Math.min(e.y1,e.y2)};case"text":return{x:e.x,y:e.y};case"path":{let n=/M\s*(-?[\d.]+)[ ,](-?[\d.]+)/.exec(e.d);return n?{x:Number(n[1]),y:Number(n[2])}:{x:0,y:0}}}}function vt(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let r=S.focus,i;switch(t.kind){case"rect":i={kind:"rect",part:"focus",x:t.x-2,y:t.y-2,width:t.width+4,height:t.height+4,fill:"none",stroke:r,rx:2};break;case"circle":i={kind:"circle",part:"focus",cx:t.cx,cy:t.cy,r:t.r+3,fill:"none",stroke:r};break;case"line":i={kind:"line",part:"focus",x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:r,strokeWidth:4};break;case"text":i={kind:"rect",part:"focus",x:t.x-2,y:t.y-8,width:t.text.length*j+4,height:16,fill:"none",stroke:r,rx:2};break;case"path":i={kind:"path",part:"focus",d:t.d,stroke:r,strokeWidth:2,fill:"none"};break}let{x:o,y:a}=we(t),l=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...l?Le(h(o),h(a),l,e.width,e.height):[]]}function wt(e,n,t){let r=Fe(e);if(r.length===0)return;let i=n===null?-1:r.indexOf(n);switch(t){case"ArrowRight":case"ArrowDown":return r[Math.min(r.length-1,i+1)];case"ArrowLeft":case"ArrowUp":return r[Math.max(0,i<=0?0:i-1)];case"Home":return r[0];case"End":return r[r.length-1];case"Escape":return null;default:return}}var ue=2,he=(e,n,t)=>{let r=Math.max(ue,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},Mn=(e,n)=>!e||e.start<=0&&e.end>=n;function Mt(e,n,t){if(e.count<=ue||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,a=n>0?1.25:.8,l=Math.max(ue,Math.min(e.count,Math.round(o*a)));if(l===o)return n>0&&!Mn(e.zoom,e.count)?he(r,l,e.count):void 0;let s=Math.max(0,Math.min(1,(t-e.plot.x)/e.plot.width)),c=r+s*o;return he(c-s*l,l,e.count)}function kt(e,n,t,r){let i=n.end-n.start,o=Math.max(ue,Math.min(e.count,Math.round(i/Math.max(.05,t)))),a=Math.max(0,Math.min(1,(r-e.plot.x)/Math.max(1,e.plot.width)));return he(n.start+a*i-a*o,o,e.count)}function St(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return he(n.start-t/i,r,e.count)}function $t(e,n,t){let r=e.brush;if(!r||!rt(r.box,n,t))return;let i=r.window;if(Math.abs(n-i.x)<=6)return{grab:"left",zoom:e.zoom};if(Math.abs(n-(i.x+i.width))<=6)return{grab:"right",zoom:e.zoom};if(n>i.x&&n<i.x+i.width)return{grab:"move",zoom:e.zoom};let o=e.zoom.end-e.zoom.start,a=(n-r.box.x)/Math.max(1,r.box.width)*e.count;return{grab:"move",zoom:he(a-o/2,o,e.count)}}function Ct(e,n,t,r){let i=e.brush;if(!i)return t;let o=r/Math.max(1,i.box.width)*e.count;if(n==="move")return he(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-ue,Math.round(t.start+o))),end:t.end};let a=Math.min(e.count,Math.max(t.start+ue,Math.round(t.end+o)));return{start:t.start,end:a}}function Tt(e,n){switch(n.type){case"svg":return Promise.resolve(It(e,n.label,n.resolve));case"csv":return Promise.resolve(Cn(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=It(e,n.label,n.resolve);return $n(t,e.width,e.height,n.scale,n.background)}}}var Q=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;"),Me=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${Q(String(t))}"`).join("");function kn(e){let n=e.title?`<title>${Q(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${Me([t,["d",e.d],["fill",e.fill??"none"],["stroke",e.stroke],["stroke-width",e.strokeWidth],["stroke-linecap",e.strokeLinecap],["stroke-linejoin",e.strokeLinejoin],["stroke-dasharray",e.dash],["opacity",e.opacity],["fill-opacity",e.fillOpacity]])}>${n}</path>`;case"rect":return`<rect${Me([t,["x",e.x],["y",e.y],["width",e.width],["height",e.height],["rx",e.rx],["fill",e.fill],["stroke",e.stroke],["fill-opacity",e.opacity]])}>${n}</rect>`;case"line":return`<line${Me([t,["x1",e.x1],["y1",e.y1],["x2",e.x2],["y2",e.y2],["stroke",e.stroke],["stroke-width",e.strokeWidth],["stroke-dasharray",e.dash],["opacity",e.opacity]])}>${n}</line>`;case"circle":return`<circle${Me([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${Me([t,["aria-label",e.title],["x",e.x],["y",e.y],["text-anchor",e.anchor],["dominant-baseline",e.baseline],["fill",e.fill],["font-weight",e.weight],["transform",e.rotate?`rotate(${e.rotate} ${e.x} ${e.y})`:void 0]])}>${Q(e.text)}</text>`}}function Sn(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${Q(t.id)}" x1="0" y1="0" x2="${t.vertical===!1?1:0}" y2="${t.vertical===!1?0:1}">${t.stops.map(r=>`<stop offset="${r.offset}" stop-color="${Q(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function It(e,n,t){let r=Sn(e)+e.shapes.map(kn).join("");return t&&(r=r.replace(/var\((--[\w-]+)\)/g,(i,o)=>t(o).trim()||i)),`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${e.width} ${e.height}" width="${e.width}" height="${e.height}" role="img" aria-label="${Q(n)}" font-family="${Q(S.fontFamily)}" font-size="${Q(S.fontSize)}"><title>${Q(n)}</title>${r}</svg>`}function $n(e,n,t,r=2,i){return new Promise((o,a)=>{let l=URL.createObjectURL(new Blob([e],{type:"image/svg+xml;charset=utf-8"})),s=new Image;s.onload=()=>{URL.revokeObjectURL(l);let c=document.createElement("canvas");c.width=Math.round(n*r),c.height=Math.round(t*r);let d=c.getContext("2d");if(!d)return a(new Error("canvas 2d context unavailable"));i&&(d.fillStyle=i,d.fillRect(0,0,c.width,c.height)),d.drawImage(s,0,0,c.width,c.height),c.toBlob(u=>u?o(u):a(new Error("toBlob failed")),"image/png")},s.onerror=()=>{URL.revokeObjectURL(l),a(new Error("svg could not be decoded"))},s.src=l})}function Cn(e){let n=t=>{let r=t==null?"":String(t);return/[",\n\r]/.test(r)?`"${r.replace(/"/g,'""')}"`:r};return e.map(t=>t.map(n).join(",")).join(`\r
3
- `)}function At(e,n){if(!n)return;let t=typeof n=="object"?n.maxRows??500:500,r=e.hit;if(r&&r.rows.length>0){let l=r.rows[0];if(r.rows.length>t)return;let s=["",...l.slice(1).map(d=>d.replace(/:\s[^:]*$/,""))],c=r.rows.map(d=>[d[0],...d.slice(1).map(u=>u.slice(u.lastIndexOf(": ")+2))]);return[s,...c]}let i=e.shapes.flatMap(l=>l.item&&!l.item.legend&&!(l.part==="anchor"&&!l.title)?[l.item]:[]);if(i.length===0||i.length>t)return;let o=["series","name","category","value"].filter(l=>i.some(s=>s[l]!==void 0)),a=(l,s)=>l[s]===void 0?"":String(l[s]);return[o.map(l=>l[0]?.toUpperCase()+l.slice(1)),...i.map(l=>o.map(s=>a(l,s)))]}var zt=new Map;function Ge(e){let n=zt.get(e);if(n)return n.group;let t=new Set,r={},i={current:r,subscribe(o){return t.add(o),()=>{t.delete(o),t.size===0&&zt.delete(e)}},publish(o,a){Object.assign(r,o);for(let l of t)l(o,a)}};return zt.set(e,{group:i,listeners:t}),i}var In='[data-skdx-part]:not([data-skdx-part^="tooltip"]):not([data-skdx-part="focus"]):not([data-skdx-part="crosshair"])',Ot=`@keyframes skdx-in{from{opacity:0}to{opacity:1}}${In}{animation:skdx-in var(--skdx-chart-duration,0ms) ease-out;transition:${["x","y","width","height","cx","cy","r","opacity","fill-opacity","d"].map(e=>`${e} var(--skdx-chart-duration,0ms) ease-out`).join(",")}}@media (prefers-reduced-motion:reduce){${In}{animation:none;transition:none}}`;function Lt(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}import{css as rr,html as re,LitElement as ir,nothing as R,svg as W}from"lit";import{property as k,state as K}from"lit/decorators.js";import{ifDefined as T}from"lit/directives/if-defined.js";var or={fromAttribute:()=>!1},$=class extends ir{constructor(){super(...arguments);this.legend=!1;this.tooltip=!0;this.selectionMode="none";this.loading=!1;this.decorative=!1;this.accessibleTable=!1;this.zoomable=!1;this.editable=!1;this.crossFilter=!1;this.animated=!1;this.responsive=!1;this.tip=[];this.overlay=[];this.portal=null;this.highlightState=null;this.crossState=null;this.lastCross=null;this.pointers=new Map;this.hover=null;this.token={};this.focused=null;this.hiddenState=[];this.drag=null;this.onPointerMove=t=>{let r=this.layout;if(!r)return;this.pointers.has(t.pointerId)&&this.pointers.set(t.pointerId,this.viewBox(t,r).x);let i=this.drag;if(i?.grab==="select"){let{x:o,y:a}=this.viewBox(t,r);this.overlay=[ut(De(i.x,i.y,o,a))];return}if(i?.grab==="lasso"){let{x:o,y:a}=this.viewBox(t,r);i.points=[...i.points??[],{x:o,y:a}],this.overlay=[pt(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=mt(r,i.gantt,o-i.x),this.overlay=[xt(r,i.gantt,i.change)];return}if(i?.grab==="map"){if(!r.map||!i.view)return;let{x:o,y:a}=this.viewBox(t,r);this.setView(yt(r.map,i.view,o-i.x,a-i.y));return}if(i&&r.hit){if(i.grab==="pinch"){let[a,l]=[...this.pointers.values()];if(a===void 0||l===void 0||!i.distance)return;this.setZoom(kt(r.hit,i.zoom,Math.abs(a-l)/i.distance,(a+l)/2));return}let{x:o}=this.viewBox(t,r);this.setZoom(i.grab==="pan"?St(r.hit,i.zoom,o-i.x):Ct(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:a}=st(r,t.target,t.currentTarget,t.clientX,t.clientY);this.tip=a,this.portal=o.length?{x:t.clientX,y:t.clientY,lines:o}:null}else{let o=lt(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(ct(r,t.target)),this.syncId&&r.hit?.crosshair){let o=ve(r,this.viewBox(t,r).x);this.shareCrosshair(o?r.hit.rows[o.index]?.[0]??null:null)}};this.onPointerDown=t=>{let r=this.layout;if(!r||t.button!==0)return;let{x:i,y:o}=this.viewBox(t,r),a=ne(r,t.target)?.item.legend,l=this.canEdit(r)?ft(r,i,o):void 0;if(l){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"edit",gantt:l},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.brushing()&&!a){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:this.selectionMode==="lasso"?"lasso":"select",points:[{x:i,y:o}]},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.canPan(r)&&r.map){let c=r.map.plot;if(i<c.x||i>c.x+c.width||o<c.y||o>c.y+c.height)return;this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"map",view:r.map.view},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}let s=r.hit;if(!(!s||!this.canZoom(r))){if(this.pointers.set(t.pointerId,i),this.pointers.size===2){let[c,d]=[...this.pointers.values()];this.drag={x:(c+d)/2,y:o,zoom:s.zoom,grab:"pinch",distance:Math.abs(c-d)||1}}else{let c=$t(s,i,o);if(c)this.drag={x:i,y:o,zoom:c.zoom,grab:c.grab},c.zoom!==s.zoom&&this.setZoom(c.zoom);else if(this.zoomable&&i>=s.plot.x&&i<=s.plot.x+s.plot.width&&o>=s.plot.y&&o<=s.plot.y+s.plot.height)this.drag={x:i,y:o,zoom:s.zoom,grab:"pan"};else{this.pointers.delete(t.pointerId);return}}t.currentTarget.setPointerCapture(t.pointerId),this.clearTip()}};this.onPointerUp=t=>{this.pointers.delete(t.pointerId);let r=t.currentTarget;r.hasPointerCapture(t.pointerId)&&r.releasePointerCapture(t.pointerId);let i=this.drag,o=this.layout;if(o&&(i?.grab==="select"||i?.grab==="lasso"||i?.grab==="edit"||i?.grab==="map")){this.overlay=[];let{x:a,y:l}=this.viewBox(t,o);if(Math.abs(a-i.x)>2||Math.abs(l-i.y)>2){i.grab==="select"?this.setSelected(dt(o,De(i.x,i.y,a,l))):i.grab==="lasso"?this.setSelected(ht(o,i.points??[])):i.grab==="edit"&&i.change&&this.emit("skdx-task-change",i.change),this.drag={...i,distance:-1};return}this.drag=null;return}(this.pointers.size===0||this.drag?.grab==="pinch")&&(this.drag=null)};this.onWheel=t=>{let r=this.layout;if(!r)return;let{x:i,y:o}=this.viewBox(t,r);if(r.map&&this.canPan(r)){let s=r.map.plot;if(i<s.x||i>s.x+s.width||o<s.y||o>s.y+s.height)return;t.preventDefault(),this.setView(gt(r.map,t.deltaY,i,o));return}let a=r.hit;if(!a||!this.canZoom(r)||o<a.plot.y||o>a.plot.y+a.plot.height)return;let l=Mt(a,t.deltaY,i);l&&(t.preventDefault(),this.setZoom(l))};this.onClick=t=>{if(!this.layout)return;if(this.drag?.distance===-1){this.drag=null;return}let r=ne(this.layout,t.target);r&&(r.item.range?this.setZoom(r.item.range):r.item.legend&&r.item.series!==void 0?this.toggle(r.item.series):(this.select(r.item),this.emit("skdx-item-click",r.item)))};this.onKeyDown=t=>{if(t.key==="Escape"){t.preventDefault(),this.focused=null,this.clearTip(),this.crossState=null,this.highlight(null);return}let r=this.layout;if(!r)return;if((t.key==="Enter"||t.key===" ")&&this.focused!==null){let l=r.shapes[this.focused]?.item;l&&(t.preventDefault(),this.select(l),this.emit("skdx-item-click",l));return}let i=this.canEdit(r)?bt(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=wt(r,this.focused,t.key);if(o===void 0)return;t.preventDefault(),this.focused=o;let a=o===null?void 0:r.shapes[o]?.item;this.highlight(a?te(a):null)}}connectedCallback(){super.connectedCallback(),!(typeof ResizeObserver>"u")&&(this.observer=new ResizeObserver(([t])=>{let r=Math.floor(t?.contentRect.width??0);r>0&&(this.measured=r)}),this.observer.observe(this))}disconnectedCallback(){this.observer?.disconnect(),this.leave?.(),this.leave=void 0,this.joined=void 0,super.disconnectedCallback()}sized(){let{width:t,height:r,legend:i,tooltip:o,format:a,palette:l,loading:s,error:c,emptyMessage:d,description:u,decorative:m,animated:y,responsive:b,highlighted:p,highlightScope:f,accessibleTable:x}=this;return{...typeof b=="object"&&this.measured!==void 0&&this.measured<(b.breakpoint??480)?b.compact:void 0,width:b&&this.measured?this.measured:t,height:r,animate:y,responsive:b,legend:i,tooltip:o,format:a,palette:l,loading:s,error:c,emptyMessage:d,description:u,decorative:m,highlighted:p===void 0?this.highlightState:p,highlightScope:f,accessibleTable:x,hiddenSeries:this.hiddenSeries??this.hiddenState,zoom:this.zoom??this.zoomState,selected:this.selected??this.selectedState,view:this.view??this.viewState}}emit(t,r){this.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0}))}publish(t){this.syncId&&Ge(this.syncId).publish(t,this.token)}join(){if(this.joined===this.syncId||(this.leave?.(),this.leave=void 0,this.joined=this.syncId,!this.syncId))return;let t=Ge(this.syncId),r=i=>{"highlighted"in i&&(this.highlightState=i.highlighted??null),i.selected&&(this.selectedState=i.selected,this.crossFilter&&(this.highlightState=i.selected.length?i.selected:null)),"zoom"in i&&(this.zoomState=i.zoom),i.hiddenSeries&&(this.hiddenState=i.hiddenSeries),"crosshair"in i&&(this.crossState=i.crosshair??null)};r(t.current),this.leave=t.subscribe((i,o)=>{o!==this.token&&r(i)})}setZoom(t){this.zoomState=t,this.emit("skdx-zoom-change",t),this.publish({zoom:t})}setView(t){this.viewState=t,this.emit("skdx-view-change",t)}setSelected(t){this.selectedState=t,this.emit("skdx-selected-change",t),this.publish({selected:t})}toggle(t){let r=this.hiddenSeries??this.hiddenState,i=r.includes(t)?r.filter(o=>o!==t):[...r,t];this.hiddenState=i,this.emit("skdx-hidden-series-change",i),this.publish({hiddenSeries:i})}highlight(t){let r=this.hover;r===t||r&&t&&et(r,t)||(this.hover=t,this.emit("skdx-highlighted-change",t),this.highlightState=t,this.syncId&&this.publish({highlighted:t}))}select(t){let r=this.selectionMode;r!=="none"&&this.setSelected(tt(this.selected??this.selectedState,t,r==="single"?"single":"multiple"))}shareCrosshair(t){!this.syncId||this.lastCross===t||(this.lastCross=t,this.publish({crosshair:t}))}clearTip(){this.tip=[],this.portal=null,this.shareCrosshair(null)}canZoom(t){return!!(t.hit&&(this.zoomable||t.hit.brush))}canPan(t){return!!(t.map&&this.zoomable)}canEdit(t){return!!(this.editable&&t.edit)}brushing(){return this.selectionMode==="brush"||this.selectionMode==="lasso"}viewBox(t,r){return pe(t.currentTarget,t.clientX,t.clientY,r.width,r.height)}getSvgElement(){return this.renderRoot.querySelector("svg")}getLayout(){return this.layout}resetZoom(){this.setZoom(void 0)}zoomTo(t){this.setZoom(t)}focusItem(t){let r=this.layout;if(!r)return!1;let i=r.shapes.findIndex(o=>o.item&&!o.item.legend&&J(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?Tt(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=nt(qe(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let f of o.issues??[])this.emit("skdx-data-issue",f)}let a=this.canZoom(o),l=this.canPan(o),s=this.canEdit(o),c=this.brushing(),d=a||l||s||c,u=!o.decorative&&Fe(o).length>0,m=Lt(o),y=At(o,this.accessibleTable),b=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,p=this.portal;return re`<svg
1
+ var Bn=Object.defineProperty;var Dn=Object.getOwnPropertyDescriptor;var y=(e,n,t,r)=>{for(var i=r>1?void 0:r?Dn(n,t):n,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=(r?s(n,t,i):s(i))||i);return r&&i&&Bn(n,t,i),i};import{customElement as pr,property as H}from"lit/decorators.js";var Zt=new Set(["__proto__","constructor","prototype"]),He="skdx-chart-snapshot-request-v1";function Ze(e,n){let t=r=>{if(r.target!==e)return;let i=r.detail;if(!(!i||typeof i.receive!="function"))try{i.receive(n())}catch(o){i.receive(void 0,o instanceof Error?o.message:String(o))}};return e.addEventListener(He,t),()=>e.removeEventListener(He,t)}function Q(e){return!!e&&typeof e=="object"&&!Array.isArray(e)&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null)}function We(e,n,t){let r=[],i=0,o=new Set,s=(a,c,d=0)=>{if(++i>1e5||d>64)throw new Error("Chart snapshot exceeds bounded input size/depth");if(a===null||typeof a=="boolean"||typeof a=="string")return a;if(typeof a=="number")return Number.isFinite(a)?a:{$number:String(a)};if(a===void 0)return;if(typeof a=="function"){r.push({code:"unserializable-chart-callback",path:c,message:"Callback omitted; captured geometry retains its actual output. Do not reconstruct this configuration as a literal renderer input."});return}if(a instanceof Date)return Number.isFinite(a.getTime())?{$date:a.toISOString()}:{$date:"Invalid Date"};if(!Array.isArray(a)&&!Q(a))throw new Error(`Unsupported chart snapshot value at ${c}`);if(o.has(a))throw new Error(`Cyclic chart input at ${c}`);o.add(a);let h;if(Array.isArray(a))h=a.map((f,x)=>s(f,`${c}[${x}]`,d+1)??null);else{let f=[];for(let[x,b]of Object.entries(a)){if(Zt.has(x))throw new Error("Unsafe chart snapshot key");let u=s(b,`${c}.${x}`,d+1);u!==void 0&&f.push([x,u])}h=Object.fromEntries(f)}return o.delete(a),h},l={width:t.width,height:t.height,shapes:t.shapes,...t.defs?{defs:t.defs}:{},...t.issues?{issues:t.issues}:{},...t.table?{table:t.table}:{}};return Wt({schemaVersion:"1.0.0",kind:e,configuration:s(n,"input"),canvas:s(l,"canvas"),diagnostics:r})}function Wt(e){let n=0,t=(a,c=0)=>{if(++n>1e5||c>64)throw new Error("Chart snapshot exceeds bounded input size/depth");if(!(a===null||typeof a=="boolean"||typeof a=="string")&&!(typeof a=="number"&&Number.isFinite(a))){if(Array.isArray(a)){a.forEach(d=>t(d,c+1));return}if(!Q(a))throw new Error("Chart snapshot must contain plain JSON only");for(let[d,h]of Object.entries(a)){if(Zt.has(d))throw new Error("Unsafe chart snapshot key");t(h,c+1)}}};if(t(e),new TextEncoder().encode(JSON.stringify(e)).byteLength>8388608)throw new Error("Chart snapshot exceeds 8MB");if(!Q(e)||Object.keys(e).some(a=>!["schemaVersion","kind","configuration","canvas","diagnostics"].includes(a))||e.schemaVersion!=="1.0.0"||typeof e.kind!="string"||!/^[a-z][a-z0-9-]*$/.test(e.kind)||!Q(e.configuration)||!Q(e.canvas)||!Array.isArray(e.diagnostics))throw new Error("Unsupported chart snapshot envelope");let r=e.canvas;if(Object.keys(r).some(a=>!["width","height","shapes","defs","issues","table"].includes(a)))throw new Error("Unsupported runtime geometry field");let i=(a,c=-1e5)=>typeof a=="number"&&Number.isFinite(a)&&a>=c&&a<=1e5;if(!i(r.width,.01)||!i(r.height,.01)||!Array.isArray(r.shapes)||!r.shapes.length||r.shapes.length>2e4)throw new Error("Invalid chart snapshot viewport/geometry");let o={path:["d","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","opacity","fillOpacity","dash"],rect:["x","y","width","height","fill","stroke","opacity","rx"],line:["x1","y1","x2","y2","stroke","dash","strokeWidth","opacity"],circle:["cx","cy","r","fill","stroke","opacity"],text:["x","y","text","anchor","baseline","fill","weight","rotate"]},s={path:["d"],rect:["x","y","width","height","fill"],line:["x1","y1","x2","y2","stroke"],circle:["cx","cy","r","fill"],text:["x","y","text"]},l=new Set(["x","y","x1","y1","x2","y2","width","height","cx","cy","r","strokeWidth","opacity","fillOpacity","rx","rotate"]);for(let a of r.shapes){if(!Q(a)||typeof a.kind!="string"||!Object.hasOwn(o,a.kind)||typeof a.part!="string"||!a.part||Object.keys(a).some(c=>!["kind","part","title","item",...o[a.kind]??[]].includes(c)))throw new Error("Unsupported owner shape");for(let c of s[a.kind]??[])if(!(c in a))throw new Error("Missing owner geometry field");for(let[c,d]of Object.entries(a)){if(l.has(c)&&!i(d,["width","height","r","strokeWidth","rx","opacity","fillOpacity"].includes(c)?0:-1e5))throw new Error("Invalid owner geometry number");if(["opacity","fillOpacity"].includes(c)&&Number(d)>1)throw new Error("Invalid owner paint opacity");if(!l.has(c)&&c!=="item"&&typeof d!="string")throw new Error("Invalid owner shape field")}if(a.kind==="path"&&(typeof a.d!="string"||!/^\s*[Mm][MmLlHhVvCcSsQqTtAaZz0-9eE+.,\s-]*$/.test(a.d)||(a.d.match(/[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/g)??[]).some(c=>!i(Number(c)))))throw new Error("Invalid owner path geometry");for(let[c,d]of Object.entries({anchor:["start","middle","end"],baseline:["middle","hanging"],weight:["bold"],strokeLinecap:["round"],strokeLinejoin:["round"]}))if(a[c]!==void 0&&(typeof a[c]!="string"||!d.includes(a[c])))throw new Error("Invalid owner shape enum")}if(r.defs!==void 0){if(!Array.isArray(r.defs)||r.defs.length>1e3)throw new Error("Invalid owner gradient list");let a=new Set;for(let c of r.defs){if(!Q(c)||typeof c.id!="string"||!/^[A-Za-z][\w-]*$/.test(c.id)||a.has(c.id)||Object.keys(c).some(h=>!["id","vertical","stops"].includes(h))||c.vertical!==void 0&&typeof c.vertical!="boolean"||!Array.isArray(c.stops)||c.stops.length<2||c.stops.length>64)throw new Error("Invalid owner gradient");a.add(c.id);let d=-1;for(let h of c.stops){if(!Q(h)||Object.keys(h).some(f=>!["offset","color","opacity"].includes(f))||!i(h.offset,0)||h.offset>1||h.offset<d||typeof h.color!="string"||h.opacity!==void 0&&(!i(h.opacity,0)||h.opacity>1))throw new Error("Invalid owner gradient stop");d=h.offset}}}for(let a of e.diagnostics)if(!Q(a)||Object.keys(a).some(c=>!["code","path","message"].includes(c))||[a.code,a.path,a.message].some(c=>typeof c!="string"||!c))throw new Error("Invalid snapshot diagnostic");return e}var Ut=e=>Number(e.toPrecision(12)),jn,_n=e=>(jn??(jn=new Intl.NumberFormat)).format(Ut(e)),Fn=e=>{let n=Math.round(Math.abs(e)),t=e<0?"-":"",r=Math.floor(n/3600),i=Math.floor(n%3600/60),o=s=>String(s).padStart(2,"0");return r>0?`${t}${r}h ${o(i)}m`:i>0?`${t}${i}m ${o(n%60)}s`:`${t}${n}s`};function Ce(e){if(e===void 0)return _n;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:i="",timeZone:o}=e,s=d=>i?h=>d(h)+i:d,l=d=>r===void 0?d===void 0?{}:{maximumFractionDigits:d}:{minimumFractionDigits:r,maximumFractionDigits:r},a=d=>{let h=new Intl.NumberFormat(t,d);return s(f=>h.format(Ut(f)))},c=d=>{let h=new Intl.DateTimeFormat(t,o?{...d,timeZone:o}:d);return f=>h.format(f)};switch(n){case"integer":return a({maximumFractionDigits:0});case"decimal":return a(l(2));case"percent":return a({style:"percent",...l(0)});case"currency":return a({style:"currency",currency:e.currency??"USD",...l()});case"compact":return a({notation:"compact",...l(1)});case"scientific":return a({notation:"scientific",...l(2)});case"date":return c({dateStyle:"medium"});case"time":return c({timeStyle:"short"});case"datetime":return c({dateStyle:"medium",timeStyle:"short"});case"duration":return s(Fn)}}var qt=e=>{if(e instanceof Date)return e.getTime();if(typeof e=="number")return e;let n=Number(e);return Number.isFinite(n)&&e.trim()!==""?n:Date.parse(e)};function Ie([e,n],[t,r]){let i=n-e;return o=>i===0?t:t+(o-e)/i*(r-t)}function Te(e,n,t=5){if(e===n)return[e];let r=(n-e)/Math.max(1,t),i=10**Math.floor(Math.log10(r)),o=r/i,s=(o<1.5?1:o<3.5?2:o<7.5?5:10)*i,l=Math.floor(e/s)*s,a=Math.ceil(n/s)*s,c=[];for(let d=l;d<=a+s/2;d+=s)c.push(Kt(d));return c}var Kt=e=>Number(e.toPrecision(12)),p=e=>Number(e.toFixed(2)),ce=e=>typeof e=="number"&&Number.isFinite(e);function de(e){let n=1/0,t=-1/0;for(let r of e)ce(r)&&(r<n&&(n=r),r>t&&(t=r));return n===1/0?[0,0]:[n,t]}function Xt(e,n="linear"){if(e.length===0)return"";let t=e[0];if(n==="step"||n==="stepBefore"||n==="stepAfter"){let c=`M${t.x} ${t.y}`;for(let d=1;d<e.length;d++){let h=e[d-1],f=e[d];n==="stepAfter"?c+=`H${f.x}V${f.y}`:n==="stepBefore"?c+=`V${f.y}H${f.x}`:c+=`H${p((h.x+f.x)/2)}V${f.y}H${f.x}`}return c}if(n==="linear"||e.length<3)return`M${e.map(c=>`${c.x} ${c.y}`).join("L")}`;let r=e.length,i=e.slice(1).map((c,d)=>c.x-e[d].x),o=e.slice(1).map((c,d)=>c.y-e[d].y),s=i.map((c,d)=>c===0?0:o[d]/c),l=[s[0]];for(let c=1;c<r-1;c++){let d=s[c-1],h=s[c];l.push(d*h<=0?0:(d+h)/2)}l.push(s[r-2]);for(let c=0;c<r-1;c++){let d=s[c];if(d===0){l[c]=0,l[c+1]=0;continue}let h=l[c]/d,f=l[c+1]/d,x=Math.hypot(h,f);x>3&&(l[c]=3*h*d/x,l[c+1]=3*f*d/x)}let a=`M${t.x} ${t.y}`;for(let c=0;c<r-1;c++){let d=e[c],h=e[c+1],f=i[c]/3;a+=`C${p(d.x+f)} ${p(d.y+f*l[c])} ${p(h.x-f)} ${p(h.y-f*l[c+1])} ${h.x} ${h.y}`}return a}var be=1e3,ge=60*be,xe=60*ge,$e=24*xe,gr=[be,5*be,15*be,30*be,ge,5*ge,15*ge,30*ge,xe,3*xe,6*xe,12*xe,$e,2*$e,7*$e,14*$e];function Yt(e,n){let t=Math.floor(Math.log10(e)),r=Math.ceil(Math.log10(n)),i=r-t<=1?[1,2,5]:[1],o=[];for(let s=t;s<=r;s++)for(let l of i)o.push(Kt(l*10**s));return o.filter(s=>s>=e/1.0001&&s<=n*1.0001)}var Gn=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,Vn=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,Hn={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function Zn(e,n,t){return e.replace(Vn,(r,i,o)=>{let s=Hn[i];if(s===void 0)return i+o;let a=(o.match(Gn)??[]).map((c,d)=>{let h=Number(c);if(s===-1)return String(h+n);if(s===-2)return String(h+t);let f=d%s;return s===7?f===5?String(h+n):f===6?String(h+t):c:String(f%2===0?h+n:h+t)});return i+a.join(" ")})}var Jt=(e,n,t)=>e.map(r=>{switch(r.kind){case"rect":return{...r,x:r.x+n,y:r.y+t};case"circle":return{...r,cx:r.cx+n,cy:r.cy+t};case"line":return{...r,x1:r.x1+n,x2:r.x2+n,y1:r.y1+t,y2:r.y2+t};case"text":return{...r,x:r.x+n,y:r.y+t};case"path":return{...r,d:Zn(r.d,n,t)}}});var Ue=["primary","success","warning","danger","neutral"].flatMap(e=>[500,700].map(n=>`var(--skdx-color-${e}-${n})`)).sort((e,n)=>Number(e.endsWith("700)"))-Number(n.endsWith("700)"))),M={axis:"var(--skdx-color-border-strong)",grid:"var(--skdx-color-border-subtle)",label:"var(--skdx-color-text-muted)",focus:"var(--skdx-color-focus-ring)",positive:"var(--skdx-color-success-500)",negative:"var(--skdx-color-danger-500)",fontFamily:"var(--skdx-font-family)",fontSize:"var(--skdx-font-size-xs)"},Ae=(e="neutral")=>e==="neutral"?M.axis:`var(--skdx-color-${e}-500)`,qe=(e="neutral")=>e==="neutral"?M.label:e==="primary"?"var(--skdx-color-text-accent)":`var(--skdx-color-text-${e})`,Qt=(e,n)=>n??Ue[e%Ue.length];var he={top:16,right:16,bottom:32,left:48};function en(e,n,t=he){return{x:t.left,y:t.top,width:Math.max(0,e-t.left-t.right),height:Math.max(0,n-t.top-t.bottom)}}function ye(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function tn(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var Oe=20,Wn=120,nn=e=>{let n=ye(e);return n&&(n.position==="left"||n.position==="right")?n.width??Wn:0},ze=(e,n=600,t=300)=>({width:(e.width??n)-nn(e),height:(e.height??t)-(ye(e)?.position==="bottom"?Oe:0)}),rn=(e,n,t)=>{let r=ye(e);return!r||!(r.position===void 0||r.position==="top")?0:(n?Math.max(1,sn(n,t??ze(e).width,r)):1)*Oe},_=6.5;function Xe(e,n){let t=Array.from(e),r=Math.max(0,Math.floor(n/_));return t.length<=r?e:r===0?"":`${t.slice(0,r-1).join("")}\u2026`}var Le=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:Qt(n)),on=(e,n)=>e.hiddenSeries?.includes(n)??!1;function Ke(e,n,t=[],r={},i=10,o=8,s=!1){let l=[],a=r.maxItems,c=a!==void 0&&a>=0&&e.length>a?e.slice(0,a):e,d=e.length-c.length,h=r.interactive??!0,f=o,x=i,b=(u,m,g,v)=>{let $=(m?18:4)+u.length*_;f>o&&(s||f+$>n-8)&&(f=o,x+=Oe),m&&l.push({kind:"rect",part:"legend-swatch",x:f,y:x-5,width:10,height:10,fill:m,opacity:v?.3:void 0,item:g}),l.push({kind:"text",part:"legend-label",x:f+(m?14:0),y:x,text:u,baseline:"middle",fill:v?M.grid:M.label,item:g}),f+=$+12};for(let u of c){let m=t.includes(u.name),g=h?{label:u.name,series:u.name,legend:!0}:void 0;b(r.formatter?.(u.name)??u.name,u.color,g,m)}return d>0&&b(`+${d} more`,void 0,void 0,!1),r.align==="end"?Un(l,n):l}function Un(e,n){let t=new Map;for(let i of e){let o=i.kind==="rect"?i.y+5:i.y;t.set(o,[...t.get(o)??[],i])}let r=[];for(let i of t.values()){let o=Math.max(...i.map(l=>l.kind==="rect"?l.x+l.width:l.x+l.text.length*_)),s=n-8-o;for(let l of i)r.push({...l,x:l.x+s})}return r}var sn=(e,n,t={})=>new Set(Ke(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function Ye(e,n,t,r=[]){let i=ye(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,s=tn(e),l=o?.position==="bottom",a=nn(e),c=e.hiddenSeries??[],d=o?a?Ke(r,1/0,c,o,10,(o.position==="right"?n:0)+8,!0):Ke(r,n,c,o,l?t+10:10):[],h=l?sn(r,n,o):0;return{width:n+a,height:l?t+Math.max(1,h)*Oe:t,legendOffset:o?.position==="left"?a:void 0,tooltip:s.enabled,tooltipFormatter:s.formatter,axisTooltipFormatter:s.axisFormatter,tooltipPortal:s.portal,tooltipPlacement:s.placement,tooltipAnchored:s.followPointer===!1?!0:void 0,description:e.description,decorative:e.decorative,animate:e.animate===!0?300:e.animate||void 0,responsive:!!e.responsive,shapes:d}}function Je(e){let n=e.legendOffset;if(!n)return e;let t=[...Jt(e.shapes.filter(a=>!a.part.startsWith("legend-")),n,0),...e.shapes.filter(a=>a.part.startsWith("legend-"))],r=a=>({...a,x:a.x+n}),i=e.hit?{...e.hit,plot:r(e.hit.plot),xs:e.hit.xs.map(a=>a+n),brush:e.hit.brush?{box:r(e.hit.brush.box),window:r(e.hit.brush.window)}:void 0}:void 0,o=e.edit,s=o?{...o,scale:a=>o.scale(a)+n,invert:a=>o.invert(a-n),bars:o.bars.map(a=>({...a,x0:a.x0+n,x1:a.x1+n}))}:void 0,l=e.map?{...e.map,plot:r(e.map.plot)}:void 0;return{...e,shapes:t,hit:i,edit:s,map:l,legendOffset:void 0}}function Re(e,n,t,r,i,o="auto"){let s=Array.isArray(t)?t:[t],l=Math.max(1,Math.floor((r-12)/_)),a=s.flatMap(m=>{let g=[],v=Array.from(m);for(;v.length>l;){let $=v.slice(0,l+1).lastIndexOf(" ");$<1&&($=l),g.push(v.slice(0,$).join("")),v=v.slice($),v[0]===" "&&v.shift()}return g.push(v.join("")),g}),c=Math.max(1,Math.floor((i-6)/16)),d=a.slice(0,c);a.length>c&&(d[c-1]=Xe(`${d[c-1]}\u2026`,r-12));let h=Math.min(r,Math.max(0,...d.map(m=>Array.from(m).length))*_+12),f=Math.min(i,6+d.length*16),x=o==="top"?{x:e-h/2,y:n-f-8}:o==="bottom"?{x:e-h/2,y:n+8}:o==="left"?{x:e-h-8,y:n-f/2}:o==="right"?{x:e+8,y:n-f/2}:{x:e+12,y:n-f-6},b=Math.max(0,Math.min(r-h,x.x)),u=Math.max(0,Math.min(i-f,x.y));return[{kind:"rect",part:"tooltip",title:s.join(`
2
+ `),x:p(b),y:p(u),width:p(h),height:f,fill:"var(--skdx-color-surface-raised)",stroke:M.axis,rx:8},...d.map((m,g)=>({kind:"text",part:"tooltip-label",x:p(b+6),y:p(u+11+g*16),text:m,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:d.length>1&&g===0?"bold":void 0}))]}function Qe(e,n){let[t,r]=de(e);return n?[Math.min(0,t),Math.max(0,r)]:[t,r]}function et([e,n],t,r=!1,i){let o=typeof r=="boolean"?{scale:r?"log":"linear"}:r,s=Ce(o.format??i),l=o.min??e,a=o.max??n;o.reversed&&(t=[t[1],t[0]]);let c={id:o.id,position:o.position,options:o};if(o.scale==="sqrt"){let u=S=>Math.sign(S)*Math.sqrt(Math.abs(S)),m=o.nice===!1?[l,a]:Te(l,a,o.ticks),g=o.min??m[0],v=o.max??m[m.length-1],$=Ie([u(g),u(v)],t),z=S=>$(u(S)),O=Te(g,v,o.ticks).filter(S=>S>=g-1e-9&&S<=v+1e-9);return{...c,scale:z,domain:[g,v],format:s,ticks:(O.length>=2?O:[g,v]).map(S=>({pos:p(z(S)),label:s(S)})),zero:p(z(Math.min(Math.max(0,g),v)))}}if(o.scale==="log"){let u=Math.max(l,Number.EPSILON),m=Math.max(a,u),g=Yt(u,m),v=[Math.log10(u),Math.log10(m)],$=Ie(v,t),z=O=>$(Math.log10(Math.max(O,Number.EPSILON)));return{...c,scale:z,domain:v,format:s,ticks:g.map(O=>({pos:p(z(O)),label:s(O)})),zero:p(t[0])}}let d=Te(l,a,o.ticks),h=[o.min??(o.nice===!1?l:d[0]),o.max??(o.nice===!1?a:d[d.length-1])],f=Ie(h,t),x=d.filter(u=>u>=h[0]-1e-9&&u<=h[1]+1e-9),b=(x.length>=2?x:[h[0],h[1]]).map(u=>({pos:p(f(u)),label:s(u)}));return{...c,scale:f,domain:h,format:s,ticks:b,zero:p(f(Math.min(Math.max(0,h[0]),h[1])))}}function an(e,n){if(e.length<2)return e;let t=e.reduce((i,o)=>Math.max(i,o.label.length),0)*_+8,r=Math.max(1,Math.ceil(e.length*t/Math.max(1,n)));return r===1?e:e.filter((i,o)=>o%r===0)}function ln(e,n,t,r){let i=e.error!==void 0?"error":e.loading?"loading":n?"empty":null;if(!i)return null;let{width:o,height:s}=ze(e,t,r),l=i==="error"?e.error:i==="loading"?"Loading\u2026":e.emptyMessage??"No data available",a=[];return i==="loading"&&a.push({kind:"rect",part:"skeleton",x:0,y:0,width:o,height:s,fill:"var(--skdx-color-surface-sunken)",rx:8}),a.push({kind:"text",part:`state-${i}`,x:p(o/2),y:p(s/2),text:l,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":M.label}),{...Ye(e,o,s),shapes:a,tooltip:!1}}var Ee=(e,n,t)=>{let r=n.length*_/2;return e+r>t?"end":e-r<0?"start":"middle"};function cn(e,n={}){let{plot:t,xTicks:r,yTicks:i,baseline:o}=e,s=t.x+t.width,l=t.y+t.height,a=[],c=n.grid??!0,d=(b,u)=>u?{kind:"line",part:"grid",x1:b.pos,x2:b.pos,y1:t.y,y2:l,stroke:M.grid}:{kind:"line",part:"grid",x1:t.x,x2:s,y1:b.pos,y2:b.pos,stroke:M.grid},h=n.x?.tickRotation??0,f=(b,u,m,g)=>h?L(b,u,m,{part:g,anchor:h<0?"end":"start",baseline:"middle",rotate:h}):qn(b,u,m,e.width,{part:g,anchor:Ee(b,m,e.width)}),x=(b,u,m,g,v)=>{for(let $ of b)a.push(u==="x"?{kind:"line",part:"tick",x1:$.pos,x2:$.pos,y1:m,y2:p(m+g*v),stroke:M.axis}:{kind:"line",part:"tick",x1:m,x2:p(m+g*v),y1:$.pos,y2:$.pos,stroke:M.axis})};if(n.categoryGrid)for(let b of r)a.push(d(b,!n.horizontal));if(n.horizontal){let b=n.axes??[{ticks:i,position:"bottom",offset:0,label:n.yLabel,...n.y}];if(c)for(let u of i)a.push(d(u,!0));b[0]?.showLine!==!1&&a.push({kind:"line",part:"axis",x1:o,x2:o,y1:t.y,y2:l,stroke:M.axis});for(let u of b){let m=u.position==="top"||u.position==="right",g=p(m?t.y-u.offset:l+u.offset),v=m||u.offset>0;u.showLine&&v&&a.push({kind:"line",part:"axis",x1:t.x,x2:s,y1:g,y2:g,stroke:M.axis}),u.showTicks&&x(u.ticks,"x",g,m?-1:1,u.tickSize??4);let $=p(m?g-8:g+20);for(let z of u.ticks)a.push(m?L(z.pos,$,z.label,{part:"x-label-top",anchor:Ee(z.pos,z.label,e.width)}):f(z.pos,$,z.label,"x-label"));u.label&&a.push(v?L(4,$,u.label,{part:"axis-title",anchor:"start",baseline:m?void 0:"middle"}):L(4,t.y-6,u.label,{part:"axis-title",anchor:"start"}))}n.x?.showLine&&a.push({kind:"line",part:"axis",x1:n.rtl?s:t.x,x2:n.rtl?s:t.x,y1:t.y,y2:l,stroke:M.axis}),n.x?.showTicks&&x(r,"y",n.rtl?s:t.x,n.rtl?1:-1,n.x.tickSize??4);for(let u of r)a.push(n.rtl?L(s+8,u.pos,u.label,{part:"y-label",anchor:"start",baseline:"middle"}):L(t.x-8,u.pos,u.label,{part:"y-label",anchor:"end",baseline:"middle"}))}else{if(c)for(let u of i)a.push(d(u,!1));n.y?.showLine!==!1&&a.push({kind:"line",part:"axis",x1:t.x,x2:s,y1:o,y2:o,stroke:M.axis});let b=n.axes??[{ticks:i,position:"left",offset:0,label:n.yLabel,...n.y},...n.rightTicks?[{ticks:n.rightTicks,position:"right",offset:0,label:n.rightLabel}]:[]];for(let u of b){let m=u.position==="left",g=m?t.x-u.offset:s+u.offset,v=m?"y-label":"y-label-right";u.showLine&&a.push({kind:"line",part:"axis",x1:p(g),x2:p(g),y1:t.y,y2:l,stroke:M.axis}),u.showTicks&&x(u.ticks,"y",p(g),m?-1:1,u.tickSize??4);for(let $ of u.ticks)a.push(L(p(m?g-8:g+8),$.pos,$.label,{part:v,anchor:m?"end":"start",baseline:"middle"}));u.label&&a.push(L(p(m?u.offset===0?4:Math.max(4,g-40):u.offset===0?e.width-4:Math.min(e.width-4,g+40)),t.y-6,u.label,{part:"axis-title",anchor:m?"start":"end"}))}n.x?.showTicks&&x(r,"x",l,1,n.x.tickSize??4);for(let u of r)a.push(f(u.pos,l+(h?12:20),u.label,"x-label"))}return n.xLabel&&a.push(L(p(t.x+t.width/2),e.height-4,n.xLabel,{part:"axis-title",anchor:"middle"})),n.horizontal&&n.rightLabel&&a.push(L(e.width-4,t.y-6,n.rightLabel,{part:"axis-title",anchor:"end"})),a}var L=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:M.label,...r});function qn(e,n,t,r,i={}){let o=Math.max(4,Math.min(r-4,e)),s=i.anchor??"start",l=s==="middle"?2*Math.min(o-4,r-o-4):s==="end"?o-4:r-o-4,a=Xe(t,l);return{kind:"text",part:"label",x:o,y:n,fill:M.label,...i,text:a,title:a===t?i.title:t}}var dn=(e,n,t,r,i,o)=>({kind:"circle",part:"point",cx:e,cy:n,r:t,fill:r,title:i,item:o});function tt(e,n){let t=[],{plot:r}=n,i=r.x+r.width,o=r.y+r.height,s=a=>Math.max(r.x,Math.min(i,a)),l=a=>Math.max(r.y,Math.min(o,a));for(let a of e??[]){let c=a.color??Ae(a.variant),d=a.color??qe(a.variant),h={part:"reference-label",fill:d},f=n.horizontal===!0;if("y"in a){let x=p(n.y(a.y,a.axis??"left"));if(f){let b=s(x);t.push(...un(b,r.y,o,c,a.label,h))}else{let b=l(x);t.push(...hn(r.x,i,b,c,a.label,h))}}else if("x"in a){let x=n.x(a.x);if(x===void 0)continue;f?t.push(...hn(r.x,i,l(p(x)),c,a.label,h)):t.push(...un(s(p(x)),r.y,o,c,a.label,h))}else if("y1"in a){let x=p(n.y(a.y1,a.axis??"left")),b=p(n.y(a.y2,a.axis??"left"));f?t.push(...fn(s(Math.min(x,b)),s(Math.max(x,b)),r,c,a.label,d)):t.push(...pn(l(Math.min(x,b)),l(Math.max(x,b)),r,c,a.label,d))}else{let x=n.x(a.x1),b=n.x(a.x2);if(x===void 0||b===void 0)continue;let u=p(Math.min(x,b)),m=p(Math.max(x,b));f?t.push(...pn(l(u),l(m),r,c,a.label,d)):t.push(...fn(s(u),s(m),r,c,a.label,d))}}return t}function hn(e,n,t,r,i,o){let s={kind:"line",part:"reference",x1:e,x2:n,y1:t,y2:t,stroke:r,dash:"6 4",strokeWidth:1.5,title:i};return i?[s,L(n-4,t-5,i,{...o,anchor:"end"})]:[s]}function un(e,n,t,r,i,o){let s={kind:"line",part:"reference",x1:e,x2:e,y1:n,y2:t,stroke:r,dash:"6 4",strokeWidth:1.5,title:i};return i?[s,L(e+4,n+10,i,{...o,anchor:"start"})]:[s]}function pn(e,n,t,r,i,o){let s={kind:"rect",part:"reference-area",x:t.x,y:e,width:t.width,height:p(Math.max(0,n-e)),fill:r,opacity:.12,title:i};return i?[s,L(t.x+t.width-4,e+12,i,{part:"reference-label",fill:o,anchor:"end"})]:[s]}function fn(e,n,t,r,i,o){let s={kind:"rect",part:"reference-area",x:e,y:t.y,width:p(Math.max(0,n-e)),height:t.height,fill:r,opacity:.12,title:i};return i?[s,L(e+4,t.y+12,i,{part:"reference-label",fill:o,anchor:"start"})]:[s]}function mn(e,n){let t=[],{plot:r}=n,i=r.x+r.width,o=r.y+r.height;for(let s of e??[]){let l=s.color??Ae(s.variant),a=s.color??qe(s.variant),c=(b,u,m)=>{let g=n.x(b);if(g===void 0)return;let v=n.y(u,m??"left");return n.horizontal?{x:p(v),y:p(g)}:{x:p(g),y:p(v)}},d=s.id??s.label,h=b=>({label:b,id:d,name:s.label});if(s.type==="line"||s.type==="band"){let{type:b,id:u,...m}=s;t.push(...tt([m],n));continue}if(s.type==="rect"){let b=c(s.x1,s.y1,s.axis),u=c(s.x2,s.y2,s.axis);if(!b||!u)continue;let m=Math.max(r.x,Math.min(b.x,u.x)),g=Math.max(r.y,Math.min(b.y,u.y)),v=s.label??"";t.push({kind:"rect",part:"annotation-rect",x:p(m),y:p(g),width:p(Math.max(0,Math.min(i,Math.max(b.x,u.x))-m)),height:p(Math.max(0,Math.min(o,Math.max(b.y,u.y))-g)),fill:l,opacity:.12,stroke:l,title:v||void 0,item:v?h(v):void 0}),s.label&&t.push(L(p(m+4),p(g+12),s.label,{part:"annotation-label",fill:a}));continue}let f=c(s.x,s.y,s.axis);if(!f)continue;if(s.type==="text"){t.push(L(f.x,f.y,s.text,{part:"annotation-text",fill:a,anchor:"middle",baseline:"middle",title:s.label}));continue}let x=s.label??`${String(s.x)}, ${s.y}`;if(t.push({kind:"circle",part:"annotation-point",cx:f.x,cy:f.y,r:5,fill:l,stroke:"var(--skdx-color-surface-default)",title:x,item:h(x)}),s.type==="callout"&&s.label){let[b,u]=s.offset??[16,-16],m=p(Math.max(r.x,Math.min(i,f.x+b))),g=p(Math.max(r.y,Math.min(o,f.y+u)));t.push({kind:"line",part:"annotation-leader",x1:f.x,y1:f.y,x2:m,y2:g,stroke:l},L(m,g,s.label,{part:"annotation-label",fill:a,anchor:b>=0?"start":"end",baseline:"middle"}))}}return t}var we=e=>Math.max(0,Math.min(1,e));function bn(e){let n=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(n){let r=n[1],i=r.length===3?r.split("").map(o=>o+o).join(""):r;return[0,2,4].map(o=>parseInt(i.slice(o,o+2),16))}let t=/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)/i.exec(e.trim());return t?[Number(t[1]),Number(t[2]),Number(t[3])]:void 0}function gn(e,n){if(e.length===0)return M.axis;if(e.length===1)return e[0];let t=we(n)*(e.length-1),r=Math.min(e.length-2,Math.floor(t)),i=t-r,o=bn(e[r]),s=bn(e[r+1]);if(!o||!s)return e[Math.round(t)];let l=a=>Math.round(o[a]+(s[a]-o[a])*i);return`rgb(${l(0)}, ${l(1)}, ${l(2)})`}var xn=(e,n)=>n!==void 0&&n>=2?Math.min(n-1,Math.floor(we(e)*n))/(n-1):we(e);function yn(e,n,t,r=M.negative,i=String){let[o,s]=de(n),l=e??{type:"sequential"},a=m=>p(.15+.85*m);if(l.type==="threshold"){let{thresholds:m,colors:g,labels:v}=l,$=O=>{if(typeof O!="number"||!Number.isFinite(O))return;let S=0;for(;S<m.length&&O>=m[S];)S++;return{fill:g[Math.min(S,g.length-1)]??t,opacity:1}},z=g.map((O,S)=>({fill:O,opacity:1,label:v?.[S]??(S===0?`< ${i(m[0]??0)}`:S===m.length?`\u2265 ${i(m[S-1])}`:`${i(m[S-1])} \u2013 ${i(m[S])}`)}));return{color:$,domain:[o,s],swatches:z,kind:"threshold"}}if(l.type==="ordinal"){let m=l.colors?.length?l.colors:[t];return{color:v=>typeof v=="number"&&Number.isFinite(v)?{fill:m[Math.abs(Math.round(v))%m.length],opacity:1}:void 0,domain:[o,s],swatches:m.map((v,$)=>({fill:v,opacity:1,label:String($)})),kind:"ordinal"}}if(l.type==="diverging"){let[m,g,v]=l.domain??[-Math.max(Math.abs(o),Math.abs(s)),0,Math.max(Math.abs(o),Math.abs(s))],$=l.colors,z=D=>D<g?.5*(D-m)/Math.max(1e-12,g-m):.5+.5*(D-g)/Math.max(1e-12,v-g),O=D=>{let U=xn(l.reversed?1-we(D):D,l.steps);if($&&$.length>=2)return{fill:gn($,U),opacity:1};let N=U<.5?r:t,G=Math.abs(U-.5)*2;return{fill:N,opacity:a(G)}},S=D=>typeof D=="number"&&Number.isFinite(D)?O(z(D)):void 0,F=l.steps??5,J=Array.from({length:F},(D,U)=>{let N=F===1?.5:U/(F-1),G=N<.5?m+(g-m)*(N*2):g+(v-g)*((N-.5)*2);return{...O(N),label:i(G)}});return{color:S,domain:[m,v],swatches:J,kind:"diverging"}}let[c,d]=l.domain??[o,s],h=l.colors,f=m=>{let g=xn(l.reversed?1-we(m):m,l.steps);return h&&h.length>=2?{fill:gn(h,g),opacity:1}:{fill:h?.[0]??t,opacity:a(g)}},x=m=>typeof m!="number"||!Number.isFinite(m)?void 0:f(d===c?1:(m-c)/(d-c)),b=l.steps??5,u=Array.from({length:b},(m,g)=>{let v=b===1?1:g/(b-1);return{...f(v),label:i(c+(d-c)*v)}});return{color:x,domain:[c,d],swatches:u,kind:"sequential"}}var Kn=34,Xn=72;function wn(e){if(!e)return{bottom:0,right:0,options:{}};let n=e===!0?{}:e;return n.orientation==="vertical"?{bottom:0,right:Xn,options:n}:{bottom:Kn,right:0,options:n}}function vn(e,n,t){let r=typeof t=="string"?{title:t}:t??{},i=r.title,o=e.swatches;if(o.length===0||n.width<=0)return[];if(r.orientation==="vertical"){let d=Math.max(0,n.height-(i?16:0)),h=Math.min(16,d/o.length),f=n.y+(i?16:0),x=o.map((u,m)=>({kind:"rect",part:"color-legend-swatch",x:p(n.x),y:p(f+m*h),width:10,height:p(h),fill:u.fill,opacity:u.opacity,title:u.label})),b=h>=12?1:2;return o.forEach((u,m)=>{m%b!==0&&m!==o.length-1||x.push({kind:"text",part:"color-legend-label",x:p(n.x+14),y:p(f+(m+.5)*h),text:u.label,baseline:"middle",fill:M.label})}),i&&x.push({kind:"text",part:"color-legend-title",x:p(n.x),y:p(n.y+6),text:i,baseline:"middle",fill:M.label}),x}let s=Math.min(n.width/o.length,96),l=n.x+(n.width-s*o.length)/2,a=o.map((d,h)=>({kind:"rect",part:"color-legend-swatch",x:p(l+h*s),y:p(n.y),width:p(s),height:10,fill:d.fill,opacity:d.opacity,title:d.label})),c=e.kind==="threshold"?1:Math.max(1,Math.ceil(o.length*7*_/Math.max(1,s*o.length)));return o.forEach((d,h)=>{h%c!==0&&h!==o.length-1||a.push({kind:"text",part:"color-legend-label",x:p(l+(h+.5)*s),y:p(n.y+22),text:d.label,anchor:"middle",fill:M.label})}),i&&a.push({kind:"text",part:"color-legend-title",x:p(l-6),y:p(n.y+5),text:i,anchor:"end",baseline:"middle",fill:M.label}),a}var Yn=1e4,Jn=e=>Array.isArray(e)?{x:e[0],y:e[1],size:e[2],label:void 0,id:void 0,color:void 0,value:void 0}:{x:e.x,y:e.y,size:e.size,label:e.label,id:e.id,color:e.color,value:e.value};function Qn(e,n,t,r,i,o,s,l){if(r==="circle")return{...dn(e,n,t,i,o,s),part:l};let a=r==="square"?`M${p(e-t)} ${p(n-t)}h${p(2*t)}v${p(2*t)}h${p(-2*t)}Z`:r==="diamond"?`M${p(e)} ${p(n-t*1.3)}L${p(e+t*1.3)} ${p(n)}L${p(e)} ${p(n+t*1.3)}L${p(e-t*1.3)} ${p(n)}Z`:`M${p(e)} ${p(n-t*1.2)}L${p(e+t*1.15)} ${p(n+t*.9)}L${p(e-t*1.15)} ${p(n+t*.9)}Z`;return{kind:"path",part:l,d:a,fill:i,title:o,item:s}}function er(e,n){let t=[],r=e.series.map((w,E)=>({name:w.name,id:w.id,symbol:w.symbol??"circle",color:Le(e,E,w.color),data:on(e,w.name)?[]:w.data.flatMap((I,j)=>{let P=Jn(I);return ce(P.x)&&ce(P.y)?[{...P,index:j}]:[]})})),i=e.sampling==="auto"?Yn:typeof e.sampling=="object"?e.sampling.threshold:1/0,o=r.reduce((w,E)=>w+E.data.length,0),s=o>i?Math.ceil(o/i):1;s>1&&t.push({code:"sampled",severity:"warning",message:`${o} points exceed the sampling threshold of ${i}; every ${s}th point is drawn.`});let l=s>1?r.map(w=>({...w,data:w.data.filter((E,I)=>I%s===0)})):r,a=l.flatMap(w=>w.data),c=ln(e,a.length===0);if(c)return{...c,issues:t};let{width:d,height:h}=ze(e),f=e.colorScale?wn(e.colorLegend):{bottom:0,right:0,options:{}},x=e.series.map((w,E)=>({name:w.name,color:Le(e,E,w.color)})),b=en(d,h,{...he,top:he.top+rn(e,x,d)+(e.yAxis?.label?12:0),right:he.right+f.right,bottom:he.bottom+(e.xAxis?.label?14:0)+f.bottom}),u=e.markerSize??3,m=Math.max(0,e.hitRadius??0),g=Math.max(0,e.jitter??0),v=de(a.map(w=>w.size)),$=w=>w==="diamond"?1.3:w==="triangle"?1.2:1,z=(w,E)=>Math.max(0,E?n.radius(w.size,v):u),O=0;for(let w of l){let E=w.data.some(j=>j.size!==void 0),I=$(w.symbol);for(let j of w.data)O=Math.max(O,z(j,E)*I)}let S=Math.min(1,Math.min(b.width,b.height)*.45/Math.max(1,O+g)),F=g*S,J=O*S+F,D=new Map,U=e.colorScale?yn(e.colorScale,a.map(w=>w.value),Le(e,0),void 0,Ce(e.format)):void 0,N=et(Qe(a.map(w=>w.x),!1),[b.x+J,b.x+b.width-J],e.xAxis??{},e.format),G=et(Qe(a.map(w=>w.y),!1),[b.y+b.height-J,b.y+J],e.yAxis??{},e.format),Ge=Ye(e,d,h,x),me=[],Bt=[],Ve=[],Dt=[];for(let w of l){let E=w.data.some(I=>I.size!==void 0);for(let I of w.data){let j=I.index,P=n.describe(w.name,I,N,G),X=z(I,E)*S,V=p(N.scale(I.x)),q=p(G.scale(I.y));if(F>0){let ae=`${Math.round(V)},${Math.round(q)}`,oe=D.get(ae)??0;if(D.set(ae,oe+1),oe>0){let le=oe*2.399963;V=p(V+F*Math.cos(le)),q=p(q+F*Math.sin(le))}}let se=U?.color(I.value),Z={label:P,id:I.id,series:w.name,seriesId:w.id??w.name,name:I.label,index:j,value:I.y},te=I.color??se?.fill??w.color;if(me.push(Qn(V,q,p(X),w.symbol,te,P,Z,E?n.part:"point")),m>0&&me.push({kind:"circle",part:"hit",cx:V,cy:q,r:p(X+m),fill:te,opacity:0,title:P,item:Z}),e.labels&&I.label){let ae=I.label.length*_,oe=V-ae/2,le=q-X-4;Dt.some(Me=>Math.abs(Me.y-le)<12&&oe<Me.x+Me.w+4&&oe+ae+4>Me.x)||(Dt.push({x:oe,y:le,w:ae}),Bt.push(L(V,p(le),I.label,{part:"point-label",anchor:"middle",fill:"var(--skdx-color-text-default)"})))}}if(e.trendline&&w.data.length>=2){let I=e.trendline===!0?"linear":e.trendline,j=tr(w.data.map(P=>[P.x,P.y]),I);if(j){let[P,X]=N.domain,V=`${w.name} trend${I==="linear"?"":` (${I})`}: r\xB2 ${j.r2.toFixed(2)}`,q=w.color;if(I==="linear")Ve.push({kind:"line",part:"trendline",x1:p(N.scale(P)),y1:p(G.scale(j.predict(P))),x2:p(N.scale(X)),y2:p(G.scale(j.predict(X))),stroke:q,dash:"5 4",strokeWidth:1.5,title:V});else{let se=Array.from({length:40},(Z,te)=>P+(X-P)*te/39).map(Z=>({v:Z,p:j.predict(Z)})).filter(({p:Z})=>Number.isFinite(Z)).map(({v:Z,p:te})=>({x:p(N.scale(Z)),y:p(G.scale(te))}));se.length>1&&Ve.push({kind:"path",part:"trendline",d:Xt(se),stroke:q,dash:"5 4",strokeWidth:1.5,title:V})}}}}let jt=-1/0,_t=an(N.ticks,Math.max(1,b.width-2*J)),Ft=new Set;for(let w of[..._t].sort((E,I)=>E.pos-I.pos)){let E=w.label.length*_,I=e.xAxis?.tickRotation??0,j=I?I<0?"end":"start":Ee(w.pos,w.label,d),P=-(j==="end"?E:j==="middle"?E/2:0),X=I*Math.PI/180,V=[P,P+E].flatMap(Z=>[-7,7].map(te=>w.pos+Z*Math.cos(X)-te*Math.sin(X))),q=Math.min(...V),se=Math.max(...V);q<jt+4||(jt=se,Ft.add(w))}let En=_t.filter(w=>Ft.has(w)),Gt={...Ge,plot:b,xTicks:En,yTicks:G.ticks,baseline:G.zero},Vt={plot:b,x:w=>N.scale(qt(w)),y:w=>G.scale(w)},Pn=tt(e.references,Vt),Nn=U&&(f.bottom||f.right)?vn(U,f.right?{x:b.x+b.width+12,y:b.y,width:f.right,height:b.height}:{x:b.x,y:h-f.bottom+8,width:b.width,height:f.bottom},f.options):[],Ht=n.opacity;return{...Ge,shapes:[...cn({...Gt,height:Gt.height-f.bottom},{xLabel:e.xAxis?.label,x:e.xAxis,y:{showLine:e.yAxis?.showLine,showTicks:e.yAxis?.showTicks,tickSize:e.yAxis?.tickSize,tickRotation:e.yAxis?.tickRotation}}),...e.yAxis?.label?[L(4,b.y-14,e.yAxis.label,{part:"axis-title",anchor:"start"})]:[],...Pn,...Ht!==void 0&&me.some(w=>w.part===n.part)?me.map(w=>(w.kind==="circle"||w.kind==="path")&&w.part!=="hit"?{...w,opacity:Ht}:w):me,...Ve,...Bt,...mn(e.annotations,Vt),...Nn,...Ge.shapes],issues:t}}function tr(e,n="linear"){let t;if(n==="polynomial"){let a=0,c=0,d=0,h=0,f=0,x=0,b=0,u=0;for(let[S,F]of e)a+=1,c+=S,d+=S*S,h+=S**3,f+=S**4,x+=F,b+=S*F,u+=S*S*F;let m=S=>S[0]*(S[4]*S[8]-S[5]*S[7])-S[1]*(S[3]*S[8]-S[5]*S[6])+S[2]*(S[3]*S[7]-S[4]*S[6]),v=m([f,h,d,h,d,c,d,c,a]);if(Math.abs(v)<1e-12)return;let $=m([u,h,d,b,d,c,x,c,a])/v,z=m([f,u,d,h,b,c,d,x,a])/v,O=m([f,h,u,h,d,b,d,c,x])/v;t=S=>$*S*S+z*S+O}else{let a=n==="logarithmic"||n==="power"?Math.log:x=>x,c=n==="exponential"||n==="power"?Math.log:x=>x,d=e.filter(([x,b])=>Number.isFinite(a(x))&&Number.isFinite(c(b))),h=nr(d.map(([x,b])=>[a(x),c(b)]));if(!h)return;let f=n==="exponential"||n==="power"?Math.exp:x=>x;t=x=>f(h.intercept+h.slope*a(x))}let r=t,i=e.filter(([a])=>Number.isFinite(r(a)));if(i.length===0)return;let o=i.reduce((a,[,c])=>a+c,0)/i.length,s=0,l=0;for(let[a,c]of i)s+=(c-r(a))**2,l+=(c-o)**2;return{predict:r,r2:l===0?1:Math.max(0,1-s/l)}}function nt(e){let[n,t]=e.sizeRange??[3,18];return er(e,{part:"bubble",opacity:.7,radius:(r,[i,o])=>ce(r)?o===i?(n+t)/2:n+Math.sqrt((r-i)/(o-i))*(t-n):3,describe:(r,i,o,s)=>`${r}${i.label?` ${i.label}`:""}: ${o.format(i.x)}, ${s.format(i.y)}${ce(i.size)?` (${s.format(i.size)})`:""}`})}function nr(e){let n=e.length,t=e.reduce((c,d)=>c+d[0],0)/n,r=e.reduce((c,d)=>c+d[1],0)/n,i=0,o=0,s=0;for(let[c,d]of e)i+=(c-t)**2,o+=(c-t)*(d-r),s+=(d-r)**2;if(i===0)return;let l=o/i,a=s===0?1:o*o/(i*s);return{slope:l,intercept:r-l*t,r2:a}}function Pe(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var rt=e=>e.id??e.name??e.series,Sn=e=>e.seriesId??e.series;function ee(e,n){let t=!1;return n.id!==void 0&&(t=!0,rt(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,Sn(e)!==n.series&&e.series!==n.series)||n.index!==void 0&&(t=!0,e.index!==n.index)||n.category!==void 0&&(t=!0,e.category!==n.category)?!1:t}function ne(e){let n={},t=rt(e);t!==void 0&&(n.id=t);let r=Sn(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var it=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function ot(e,n,t){let r=Pe(e),i=ne(n),o=r.some(s=>ee(n,s));return t==="single"?o?[]:[i]:o?r.filter(s=>!ee(n,s)):[...r,i]}var rr=.2;function ir(e){let n=M.focus;switch(e.kind){case"rect":return{kind:"rect",part:"selected",x:e.x-1.5,y:e.y-1.5,width:e.width+3,height:e.height+3,fill:"none",stroke:n,rx:e.rx};case"circle":return{kind:"circle",part:"selected",cx:e.cx,cy:e.cy,r:e.r+2.5,fill:"none",stroke:n};case"path":return{kind:"path",part:"selected",d:e.d,fill:"none",stroke:n,strokeWidth:2.5};case"line":return{...e,part:"selected",stroke:n,strokeWidth:(e.strokeWidth??1)+3,title:void 0,item:void 0};case"text":return}}var or=(e,n)=>e.kind==="text"?{...e,fill:M.grid}:{...e,opacity:(e.opacity??1)*n};function st(e,n){let t=Pe(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:Pe(n.highlighted),i=r[0];if(t.length===0&&!i)return e;let o={highlighted:n.highlightScope?.highlighted??"item",faded:n.highlightScope?.faded??"global"},s=[],l=d=>!i||r.some(h=>ee(d,h))?!0:o.highlighted==="series"?r.some(h=>h.series!==void 0&&ee(d,{series:h.series})):!1,a=d=>{if(!i||o.faded==="none"||l(d))return!1;if(o.faded==="series"){let h=i.series;return h!==void 0&&ee(d,{series:h})}return!0},c=e.shapes.map(d=>{let h=d.item;if(!h||h.legend)return d;if(t.some(f=>ee(h,f))){let f=ir(d);f&&s.push(f)}return a(h)?or(d,rr):d});return s.length?{...e,shapes:[...c,...s]}:{...e,shapes:c}}var kn="var(--skdx-radius-default, var(--skdx-radius-md, 0.5rem))";function Ne(e){return["tooltip","skeleton","label-background","stage-label-background","brush-handle"].includes(e)?kn:void 0}function fe(e,n,t,r,i){let o=e.getBoundingClientRect();return{x:o.width?(n-o.left)*r/o.width:n,y:o.height?(t-o.top)*i/o.height:t}}var at=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function Mn(e,n){let t=0,r=1/0;return e.xs.forEach((i,o)=>{let s=Math.abs(i-n);s<r&&(r=s,t=o)}),t}function ve(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=Mn(t,n),i=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(i,r)??i}}function lt(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[Mn(t,n)];return{kind:"line",part:"crosshair",x1:r,x2:r,y1:t.plot.y,y2:t.plot.y+t.plot.height,stroke:M.axis,dash:"3 3"}}function ct(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!at(r.plot,n,t))return[];let i=lt(e,n),{rows:o}=ve(e,n),s=e.tooltipAnchored?r.plot.y+8:t;return[i,...Re(i.x1,s,o,e.width,e.height,e.tooltipPlacement)]}function dt(e,n){let t=e.hit;if(!t||t.xs.length===0)return[];let r=t.rows.findIndex(o=>o[0]===n);if(r<0)return[];let i=t.xs[r];return ct(e,i,t.plot.y+8)}function ht(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:a,y:c}=fe(t,r,i,e.width,e.height);if(at(e.hit.plot,a,c)){let d=ve(e,a),h=lt(e,a);if(d&&h)return{lines:d.rows,shapes:[h]}}}let o=n?.closest?.("[data-skdx-part]"),s=e.tooltipFormatter?re(e,n)?.item:void 0,l=s&&e.tooltipFormatter?.(s)||o&&Array.from(o.children).find(a=>a.tagName.toLowerCase()==="title")?.textContent;return l?{lines:Array.isArray(l)?l:[l],shapes:[]}:{lines:[],shapes:[]}}function Cn(e,n,t,r,i,o,s){let l=e?.closest?.("[data-skdx-part]"),a=s&&s.tooltipFormatter?re(s,e)?.item:void 0,c=a&&s?.tooltipFormatter?.(a)||l&&Array.from(l.children).find(b=>b.tagName.toLowerCase()==="title")?.textContent;if(!c)return[];let d=s?.tooltipAnchored?re(s,e):void 0,h=d?s?.shapes[d.index]:void 0,{x:f,y:x}=h?Se(h):fe(n,t,r,i,o);return Re(f,x,c,i,o,s?.tooltipPlacement)}function ut(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:s}=fe(t,r,i,e.width,e.height),l=ct(e,o,s);if(l.length>0)return l}return Cn(n,t,r,i,e.width,e.height,e)}function pt(e,n){let t=re(e,n);return t&&!t.item.legend?ne(t.item):null}var sr=(e,n)=>{let{x:t,y:r}=Se(e),i=e.kind==="circle"?e.cy:e.kind==="rect"?e.y+e.height/2:r;return t>=n.x&&t<=n.x+n.width&&i>=n.y&&i<=n.y+n.height};function ft(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!sr(i,n))continue;let o=ne(i.item),s=JSON.stringify(o);t.has(s)||(t.add(s),r.push(o))}return r}var mt=e=>({kind:"rect",part:"selection-box",x:p(e.x),y:p(e.y),width:p(e.width),height:p(e.height),fill:M.focus,opacity:.12,stroke:M.focus}),De=(e,n,t,r)=>({x:Math.min(e,t),y:Math.min(n,r),width:Math.abs(t-e),height:Math.abs(r-n)});function $n(e,n,t){let r=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){let s=e[i],l=e[o];s.y>t!=l.y>t&&n<(l.x-s.x)*(t-s.y)/(l.y-s.y)+s.x&&(r=!r)}return r}function bt(e,n){if(n.length<3)return[];let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor")continue;let{x:o,y:s}=Se(i),l=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:s;if(!$n(n,o,l))continue;let a=ne(i.item),c=JSON.stringify(a);t.has(c)||(t.add(c),r.push(a))}return r}var gt=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${p(n.x)} ${p(n.y)}`).join("L")}`:"",fill:M.focus,fillOpacity:.12,stroke:M.focus,dash:"4 3"}),Be=6;function xt(e,n,t){let r=e.edit;if(r){for(let i of r.bars)if(!(t<i.y||t>i.y+i.height||n<i.x0-Be||n>i.x1+Be))return Math.abs(n-i.x0)<=Be?{bar:i,mode:"start"}:Math.abs(n-i.x1)<=Be?{bar:i,mode:"end"}:{bar:i,mode:"move"}}}function yt(e,n,t){let r=e.edit;return In(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function wt(e,n,t){let r=e.edit,i=t.key==="ArrowRight"?1:t.key==="ArrowLeft"?-1:0;if(!r||n===null||!i||!(t.shiftKey||t.altKey))return;let o=r.bars.find(a=>a.index===n);if(!o)return;let s=t.altKey?t.shiftKey?"start":"end":"move",l=r.snap??r.invert(o.x0+10)-r.invert(o.x0);return In(r,{bar:o,mode:s},i*l)}function In(e,{bar:n,mode:t},r){let i=l=>e.snap?Math.round(l/e.snap)*e.snap:l,o=n.start,s=n.end;return t==="move"?(o=i(n.start+r),s=o+(n.end-n.start)):t==="start"?o=Math.min(i(n.start+r),n.end):s=Math.max(i(n.end+r),n.start),{id:n.id,name:n.name,start:o,end:s}}function vt(e,n,t){let r=e.edit,i=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:p(Math.min(i,o)),y:p(n.bar.y),width:p(Math.max(1,Math.abs(o-i))),height:p(n.bar.height),fill:M.focus,opacity:.25,stroke:M.focus,rx:2}}var ar=64,lr=e=>Math.max(1,Math.min(ar,e));function St(e,n,t,r){let i=n>0?.8:1.25,o=lr(e.view.zoom*i);if(o===e.view.zoom)return e.view;let{plot:s,scale:l}=e,[a,c]=e.view.center,d=(t-(s.x+s.width/2))/l,h=(r-(s.y+s.height/2))/l,f=e.view.zoom/o;return{center:[a+d*(1-f),e.fromY(e.toY(c)-h*(1-f))],zoom:o}}function kt(e,n,t,r){let{scale:i}=e;return{center:[n.center[0]-t/i,e.fromY(e.toY(n.center[1])+r/i)],zoom:n.zoom}}function re(e,n){let t=n?.closest?.("[data-skdx-i]"),r=Number(t?.getAttribute("data-skdx-i")),i=Number.isInteger(r)?e.shapes[r]?.item:void 0;return i?{index:r,item:i}:void 0}var je=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function Se(e){switch(e.kind){case"rect":return{x:e.x+e.width/2,y:e.y};case"circle":return{x:e.cx,y:e.cy-e.r};case"line":return{x:(e.x1+e.x2)/2,y:Math.min(e.y1,e.y2)};case"text":return{x:e.x,y:e.y};case"path":{let n=/M\s*(-?[\d.]+)[ ,](-?[\d.]+)/.exec(e.d);return n?{x:Number(n[1]),y:Number(n[2])}:{x:0,y:0}}}}function Mt(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let r=M.focus,i;switch(t.kind){case"rect":i={kind:"rect",part:"focus",x:t.x-2,y:t.y-2,width:t.width+4,height:t.height+4,fill:"none",stroke:r,rx:2};break;case"circle":i={kind:"circle",part:"focus",cx:t.cx,cy:t.cy,r:t.r+3,fill:"none",stroke:r};break;case"line":i={kind:"line",part:"focus",x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:r,strokeWidth:4};break;case"text":i={kind:"rect",part:"focus",x:t.x-2,y:t.y-8,width:t.text.length*_+4,height:16,fill:"none",stroke:r,rx:2};break;case"path":i={kind:"path",part:"focus",d:t.d,stroke:r,strokeWidth:2,fill:"none"};break}let{x:o,y:s}=Se(t),l=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...l?Re(p(o),p(s),l,e.width,e.height):[]]}function Ct(e,n,t){let r=je(e);if(r.length===0)return;let i=n===null?-1:r.indexOf(n);switch(t){case"ArrowRight":case"ArrowDown":return r[Math.min(r.length-1,i+1)];case"ArrowLeft":case"ArrowUp":return r[Math.max(0,i<=0?0:i-1)];case"Home":return r[0];case"End":return r[r.length-1];case"Escape":return null;default:return}}var ue=2,pe=(e,n,t)=>{let r=Math.max(ue,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},Tn=(e,n)=>!e||e.start<=0&&e.end>=n;function $t(e,n,t){if(e.count<=ue||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,s=n>0?1.25:.8,l=Math.max(ue,Math.min(e.count,Math.round(o*s)));if(l===o)return n>0&&!Tn(e.zoom,e.count)?pe(r,l,e.count):void 0;let a=Math.max(0,Math.min(1,(t-e.plot.x)/e.plot.width)),c=r+a*o;return pe(c-a*l,l,e.count)}function It(e,n,t,r){let i=n.end-n.start,o=Math.max(ue,Math.min(e.count,Math.round(i/Math.max(.05,t)))),s=Math.max(0,Math.min(1,(r-e.plot.x)/Math.max(1,e.plot.width)));return pe(n.start+s*i-s*o,o,e.count)}function Tt(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return pe(n.start-t/i,r,e.count)}function At(e,n,t){let r=e.brush;if(!r||!at(r.box,n,t))return;let i=r.window;if(Math.abs(n-i.x)<=6)return{grab:"left",zoom:e.zoom};if(Math.abs(n-(i.x+i.width))<=6)return{grab:"right",zoom:e.zoom};if(n>i.x&&n<i.x+i.width)return{grab:"move",zoom:e.zoom};let o=e.zoom.end-e.zoom.start,s=(n-r.box.x)/Math.max(1,r.box.width)*e.count;return{grab:"move",zoom:pe(s-o/2,o,e.count)}}function Ot(e,n,t,r){let i=e.brush;if(!i)return t;let o=r/Math.max(1,i.box.width)*e.count;if(n==="move")return pe(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-ue,Math.round(t.start+o))),end:t.end};let s=Math.min(e.count,Math.max(t.start+ue,Math.round(t.end+o)));return{start:t.start,end:s}}function Lt(e,n){switch(n.type){case"svg":return Promise.resolve(zt(e,n.label,n.resolve));case"csv":return Promise.resolve(Ln(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=zt(e,n.label,n.resolve);return zn(t,e.width,e.height,n.scale,n.background)}}}var Y=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;"),ke=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${Y(String(t))}"`).join("");function An(e){let n=e.title?`<title>${Y(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${ke([t,["d",e.d],["fill",e.fill??"none"],["stroke",e.stroke],["stroke-width",e.strokeWidth],["stroke-linecap",e.strokeLinecap],["stroke-linejoin",e.strokeLinejoin],["stroke-dasharray",e.dash],["opacity",e.opacity],["fill-opacity",e.fillOpacity]])}>${n}</path>`;case"rect":return`<rect${ke([t,["x",e.x],["y",e.y],["width",e.width],["height",e.height],["rx",e.rx],["fill",e.fill],["stroke",e.stroke],["fill-opacity",e.opacity]])}>${n}</rect>`;case"line":return`<line${ke([t,["x1",e.x1],["y1",e.y1],["x2",e.x2],["y2",e.y2],["stroke",e.stroke],["stroke-width",e.strokeWidth],["stroke-dasharray",e.dash],["opacity",e.opacity]])}>${n}</line>`;case"circle":return`<circle${ke([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${ke([t,["aria-label",e.title],["x",e.x],["y",e.y],["text-anchor",e.anchor],["dominant-baseline",e.baseline],["fill",e.fill],["font-weight",e.weight],["transform",e.rotate?`rotate(${e.rotate} ${e.x} ${e.y})`:void 0]])}>${Y(e.text)}</text>`}}function On(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${Y(t.id)}" x1="0" y1="0" x2="${t.vertical===!1?1:0}" y2="${t.vertical===!1?0:1}">${t.stops.map(r=>`<stop offset="${r.offset}" stop-color="${Y(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function zt(e,n,t){let r=On(e)+e.shapes.map(An).join("");t&&(r=r.replace(/var\((--[\w-]+)\)/g,(s,l)=>t(l).trim()||s));let i=e.decorative?'aria-hidden="true"':`role="img" aria-label="${Y(n)}"`,o=e.description?`<desc>${Y(e.description)}</desc>`:"";return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${e.width} ${e.height}" width="${e.width}" height="${e.height}" ${i} font-family="${Y(M.fontFamily)}" font-size="${Y(M.fontSize)}"><title>${Y(n)}</title>${o}${r}</svg>`}function zn(e,n,t,r=2,i){return new Promise((o,s)=>{let l=URL.createObjectURL(new Blob([e],{type:"image/svg+xml;charset=utf-8"})),a=new Image;a.onload=()=>{URL.revokeObjectURL(l);let c=document.createElement("canvas");c.width=Math.round(n*r),c.height=Math.round(t*r);let d=c.getContext("2d");if(!d)return s(new Error("canvas 2d context unavailable"));i&&(d.fillStyle=i,d.fillRect(0,0,c.width,c.height)),d.drawImage(a,0,0,c.width,c.height),c.toBlob(h=>h?o(h):s(new Error("toBlob failed")),"image/png")},a.onerror=()=>{URL.revokeObjectURL(l),s(new Error("svg could not be decoded"))},a.src=l})}function Ln(e){let n=t=>{let r=t==null?"":String(t);return/[",\n\r]/.test(r)?`"${r.replace(/"/g,'""')}"`:r};return e.map(t=>t.map(n).join(",")).join(`\r
3
+ `)}function Rt(e,n){if(!n)return;let t=typeof n=="object"?n.maxRows??500:500,r=e.hit;if(r&&r.rows.length>0){let l=r.rows[0];if(r.rows.length>t)return;let a=["",...l.slice(1).map(d=>d.replace(/:\s[^:]*$/,""))],c=r.rows.map(d=>[d[0],...d.slice(1).map(h=>h.slice(h.lastIndexOf(": ")+2))]);return[a,...c]}let i=e.shapes.flatMap(l=>l.item&&!l.item.legend&&!(l.part==="anchor"&&!l.title)?[l.item]:[]);if(i.length===0||i.length>t)return;let o=["series","name","category","value"].filter(l=>i.some(a=>a[l]!==void 0)),s=(l,a)=>l[a]===void 0?"":String(l[a]);return[o.map(l=>l[0]?.toUpperCase()+l.slice(1)),...i.map(l=>o.map(a=>s(l,a)))]}var Et=new Map;function _e(e){let n=Et.get(e);if(n)return n.group;let t=new Set,r={},i={current:r,subscribe(o){return t.add(o),()=>{t.delete(o),t.size===0&&Et.delete(e)}},publish(o,s){Object.assign(r,o);for(let l of t)l(o,s)}};return Et.set(e,{group:i,listeners:t}),i}var Rn='[data-skdx-part]:not([data-skdx-part^="tooltip"]):not([data-skdx-part="focus"]):not([data-skdx-part="crosshair"])',Pt=`@keyframes skdx-in{from{opacity:0}to{opacity:1}}${Rn}{animation:skdx-in var(--skdx-chart-duration,0ms) ease-out;transition:${["x","y","width","height","cx","cy","r","opacity","fill-opacity","d"].map(e=>`${e} var(--skdx-chart-duration,0ms) ease-out`).join(",")}}@media (prefers-reduced-motion:reduce){${Rn}{animation:none;transition:none}}`;function Nt(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}import{css as cr,html as ie,LitElement as dr,nothing as R,svg as W}from"lit";import{property as k,state as K}from"lit/decorators.js";import{ifDefined as T}from"lit/directives/if-defined.js";var hr={fromAttribute:()=>!1},C=class extends dr{constructor(){super(...arguments);this.legend=!1;this.tooltip=!0;this.selectionMode="none";this.loading=!1;this.decorative=!1;this.accessibleTable=!1;this.zoomable=!1;this.editable=!1;this.crossFilter=!1;this.animated=!1;this.responsive=!1;this.tip=[];this.overlay=[];this.portal=null;this.highlightState=null;this.crossState=null;this.lastCross=null;this.pointers=new Map;this.hover=null;this.token={};this.snapshotKind="";this.focused=null;this.hiddenState=[];this.drag=null;this.onPointerMove=t=>{let r=this.layout;if(!r)return;this.pointers.has(t.pointerId)&&this.pointers.set(t.pointerId,this.viewBox(t,r).x);let i=this.drag;if(i?.grab==="select"){let{x:o,y:s}=this.viewBox(t,r);this.overlay=[mt(De(i.x,i.y,o,s))];return}if(i?.grab==="lasso"){let{x:o,y:s}=this.viewBox(t,r);i.points=[...i.points??[],{x:o,y:s}],this.overlay=[gt(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=yt(r,i.gantt,o-i.x),this.overlay=[vt(r,i.gantt,i.change)];return}if(i?.grab==="map"){if(!r.map||!i.view)return;let{x:o,y:s}=this.viewBox(t,r);this.setView(kt(r.map,i.view,o-i.x,s-i.y));return}if(i&&r.hit){if(i.grab==="pinch"){let[s,l]=[...this.pointers.values()];if(s===void 0||l===void 0||!i.distance)return;this.setZoom(It(r.hit,i.zoom,Math.abs(s-l)/i.distance,(s+l)/2));return}let{x:o}=this.viewBox(t,r);this.setZoom(i.grab==="pan"?Tt(r.hit,i.zoom,o-i.x):Ot(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:s}=ht(r,t.target,t.currentTarget,t.clientX,t.clientY);this.tip=s,this.portal=o.length?{x:t.clientX,y:t.clientY,lines:o}:null}else{let o=ut(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(pt(r,t.target)),this.syncId&&r.hit?.crosshair){let o=ve(r,this.viewBox(t,r).x);this.shareCrosshair(o?r.hit.rows[o.index]?.[0]??null:null)}};this.onPointerDown=t=>{let r=this.layout;if(!r||t.button!==0)return;let{x:i,y:o}=this.viewBox(t,r),s=re(r,t.target)?.item.legend,l=this.canEdit(r)?xt(r,i,o):void 0;if(l){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"edit",gantt:l},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.brushing()&&!s){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:this.selectionMode==="lasso"?"lasso":"select",points:[{x:i,y:o}]},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.canPan(r)&&r.map){let c=r.map.plot;if(i<c.x||i>c.x+c.width||o<c.y||o>c.y+c.height)return;this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"map",view:r.map.view},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}let a=r.hit;if(!(!a||!this.canZoom(r))){if(this.pointers.set(t.pointerId,i),this.pointers.size===2){let[c,d]=[...this.pointers.values()];this.drag={x:(c+d)/2,y:o,zoom:a.zoom,grab:"pinch",distance:Math.abs(c-d)||1}}else{let c=At(a,i,o);if(c)this.drag={x:i,y:o,zoom:c.zoom,grab:c.grab},c.zoom!==a.zoom&&this.setZoom(c.zoom);else if(this.zoomable&&i>=a.plot.x&&i<=a.plot.x+a.plot.width&&o>=a.plot.y&&o<=a.plot.y+a.plot.height)this.drag={x:i,y:o,zoom:a.zoom,grab:"pan"};else{this.pointers.delete(t.pointerId);return}}t.currentTarget.setPointerCapture(t.pointerId),this.clearTip()}};this.onPointerUp=t=>{this.pointers.delete(t.pointerId);let r=t.currentTarget;r.hasPointerCapture(t.pointerId)&&r.releasePointerCapture(t.pointerId);let i=this.drag,o=this.layout;if(o&&(i?.grab==="select"||i?.grab==="lasso"||i?.grab==="edit"||i?.grab==="map")){this.overlay=[];let{x:s,y:l}=this.viewBox(t,o);if(Math.abs(s-i.x)>2||Math.abs(l-i.y)>2){i.grab==="select"?this.setSelected(ft(o,De(i.x,i.y,s,l))):i.grab==="lasso"?this.setSelected(bt(o,i.points??[])):i.grab==="edit"&&i.change&&this.emit("skdx-task-change",i.change),this.drag={...i,distance:-1};return}this.drag=null;return}(this.pointers.size===0||this.drag?.grab==="pinch")&&(this.drag=null)};this.onWheel=t=>{let r=this.layout;if(!r)return;let{x:i,y:o}=this.viewBox(t,r);if(r.map&&this.canPan(r)){let a=r.map.plot;if(i<a.x||i>a.x+a.width||o<a.y||o>a.y+a.height)return;t.preventDefault(),this.setView(St(r.map,t.deltaY,i,o));return}let s=r.hit;if(!s||!this.canZoom(r)||o<s.plot.y||o>s.plot.y+s.plot.height)return;let l=$t(s,t.deltaY,i);l&&(t.preventDefault(),this.setZoom(l))};this.onClick=t=>{if(!this.layout)return;if(this.drag?.distance===-1){this.drag=null;return}let r=re(this.layout,t.target);r&&(r.item.range?this.setZoom(r.item.range):r.item.legend&&r.item.series!==void 0?this.toggle(r.item.series):(this.select(r.item),this.emit("skdx-item-click",r.item)))};this.onKeyDown=t=>{if(t.key==="Escape"){t.preventDefault(),this.focused=null,this.clearTip(),this.crossState=null,this.highlight(null);return}let r=this.layout;if(!r)return;if((t.key==="Enter"||t.key===" ")&&this.focused!==null){let l=r.shapes[this.focused]?.item;l&&(t.preventDefault(),this.select(l),this.emit("skdx-item-click",l));return}let i=this.canEdit(r)?wt(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=Ct(r,this.focused,t.key);if(o===void 0)return;t.preventDefault(),this.focused=o;let s=o===null?void 0:r.shapes[o]?.item;this.highlight(s?ne(s):null)}}updated(){let t=this.renderRoot.querySelector("svg")??void 0;t===this.snapshotSvg&&this.removeSnapshot||(this.removeSnapshot?.(),this.snapshotSvg=t,this.removeSnapshot=t?Ze(t,()=>{if(!this.snapshotConfiguration||!this.layout)throw new Error("Actual owner chart configuration unavailable");return We(this.snapshotKind,this.snapshotConfiguration,this.layout)}):void 0)}connectedCallback(){super.connectedCallback(),this.requestUpdate(),!(typeof ResizeObserver>"u")&&(this.observer=new ResizeObserver(([t])=>{let r=Math.floor(t?.contentRect.width??0);r>0&&(this.measured=r)}),this.observer.observe(this))}disconnectedCallback(){this.removeSnapshot?.(),this.removeSnapshot=void 0,this.snapshotSvg=void 0,this.observer?.disconnect(),this.leave?.(),this.leave=void 0,this.joined=void 0,super.disconnectedCallback()}sized(){let{width:t,height:r,legend:i,tooltip:o,format:s,palette:l,loading:a,error:c,emptyMessage:d,description:h,decorative:f,animated:x,responsive:b,highlighted:u,highlightScope:m,accessibleTable:g}=this;return{width:b&&this.measured?this.measured:t,height:r,animate:x,responsive:b,legend:i,tooltip:o,format:s,palette:l,loading:a,error:c,emptyMessage:d,description:h,decorative:f,highlighted:u===void 0?this.highlightState:u,highlightScope:m,accessibleTable:g,hiddenSeries:this.hiddenSeries??this.hiddenState,zoom:this.zoom??this.zoomState,selected:this.selected??this.selectedState,view:this.view??this.viewState}}compactOverrides(){let t=this.responsive;return typeof t=="object"&&this.measured!==void 0&&this.measured<(t.breakpoint??480)?{...t.compact,width:this.measured}:void 0}emit(t,r){this.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0}))}publish(t){this.syncId&&_e(this.syncId).publish(t,this.token)}join(){if(this.joined===this.syncId||(this.leave?.(),this.leave=void 0,this.joined=this.syncId,!this.syncId))return;let t=_e(this.syncId),r=i=>{"highlighted"in i&&(this.highlightState=i.highlighted??null),i.selected&&(this.selectedState=i.selected,this.crossFilter&&(this.highlightState=i.selected.length?i.selected:null)),"zoom"in i&&(this.zoomState=i.zoom),i.hiddenSeries&&(this.hiddenState=i.hiddenSeries),"crosshair"in i&&(this.crossState=i.crosshair??null)};r(t.current),this.leave=t.subscribe((i,o)=>{o!==this.token&&r(i)})}setZoom(t){this.zoomState=t,this.emit("skdx-zoom-change",t),this.publish({zoom:t})}setView(t){this.viewState=t,this.emit("skdx-view-change",t)}setSelected(t){this.selectedState=t,this.emit("skdx-selected-change",t),this.publish({selected:t})}toggle(t){let r=this.hiddenSeries??this.hiddenState,i=r.includes(t)?r.filter(o=>o!==t):[...r,t];this.hiddenState=i,this.emit("skdx-hidden-series-change",i),this.publish({hiddenSeries:i})}highlight(t){let r=this.hover;r===t||r&&t&&it(r,t)||(this.hover=t,this.emit("skdx-highlighted-change",t),this.highlightState=t,this.syncId&&this.publish({highlighted:t}))}select(t){let r=this.selectionMode;r!=="none"&&this.setSelected(ot(this.selected??this.selectedState,t,r==="single"?"single":"multiple"))}shareCrosshair(t){!this.syncId||this.lastCross===t||(this.lastCross=t,this.publish({crosshair:t}))}clearTip(){this.tip=[],this.portal=null,this.shareCrosshair(null)}canZoom(t){return!!(t.hit&&(this.zoomable||t.hit.brush))}canPan(t){return!!(t.map&&this.zoomable)}canEdit(t){return!!(this.editable&&t.edit)}brushing(){return this.selectionMode==="brush"||this.selectionMode==="lasso"}viewBox(t,r){return fe(t.currentTarget,t.clientX,t.clientY,r.width,r.height)}getSvgElement(){return this.renderRoot.querySelector("svg")}getLayout(){return this.layout}resetZoom(){this.setZoom(void 0)}zoomTo(t){this.setZoom(t)}focusItem(t){let r=this.layout;if(!r)return!1;let i=r.shapes.findIndex(o=>o.item&&!o.item.legend&&ee(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?Lt(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i,o){this.join();let s=st(Je(t),this.sized());if(this.layout=s,this.snapshotKind=r,this.snapshotConfiguration=o,s.issues!==this.reported){this.reported=s.issues;for(let g of s.issues??[])this.emit("skdx-data-issue",g)}let l=this.canZoom(s),a=this.canPan(s),c=this.canEdit(s),d=this.brushing(),h=l||a||c||d,f=!s.decorative&&je(s).length>0,x=Nt(s),b=Rt(s,this.accessibleTable),u=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,m=this.portal;return ie`<svg
4
4
  xmlns="http://www.w3.org/2000/svg"
5
- viewBox="0 0 ${o.width} ${o.height}"
6
- width=${o.width}
7
- height=${o.height}
8
- role=${o.decorative?"presentation":"img"}
9
- aria-hidden=${o.decorative?"true":R}
10
- aria-label=${o.decorative?R:i}
11
- aria-description=${T(o.description)}
12
- tabindex=${u?0:R}
5
+ viewBox="0 0 ${s.width} ${s.height}"
6
+ width=${s.width}
7
+ height=${s.height}
8
+ role=${s.decorative?"presentation":"img"}
9
+ aria-hidden=${s.decorative?"true":R}
10
+ aria-label=${s.decorative?R:i}
11
+ aria-description=${T(s.description)}
12
+ tabindex=${f?0:R}
13
13
  data-skdx-chart=${r}
14
- data-zoomable=${a||l?"":R}
15
- data-brushing=${c&&!(a||l)?"":R}
16
- data-editable=${s?"":R}
17
- style=${m?`--skdx-chart-duration:${m}`:R}
18
- font-family=${S.fontFamily}
19
- font-size=${S.fontSize}
20
- @pointermove=${o.tooltip||d?this.onPointerMove:R}
14
+ data-zoomable=${l||a?"":R}
15
+ data-brushing=${d&&!(l||a)?"":R}
16
+ data-editable=${c?"":R}
17
+ style=${x?`--skdx-chart-duration:${x}`:R}
18
+ font-family=${M.fontFamily}
19
+ font-size=${M.fontSize}
20
+ @pointermove=${s.tooltip||h?this.onPointerMove:R}
21
21
  @pointerleave=${()=>{this.clearTip(),this.highlight(null)}}
22
- @pointerdown=${d?this.onPointerDown:R}
23
- @pointerup=${d?this.onPointerUp:R}
24
- @pointercancel=${d?this.onPointerUp:R}
25
- @wheel=${a||l?this.onWheel:R}
26
- @dblclick=${a||l?()=>l?this.setView(void 0):this.setZoom(void 0):R}
22
+ @pointerdown=${h?this.onPointerDown:R}
23
+ @pointerup=${h?this.onPointerUp:R}
24
+ @pointercancel=${h?this.onPointerUp:R}
25
+ @wheel=${l||a?this.onWheel:R}
26
+ @dblclick=${l||a?()=>a?this.setView(void 0):this.setZoom(void 0):R}
27
27
  @click=${this.onClick}
28
- @keydown=${u?this.onKeyDown:R}
28
+ @keydown=${f?this.onKeyDown:R}
29
29
  @blur=${()=>{this.focused=null,this.highlight(null)}}
30
30
  >
31
31
  <title>${i}</title>
32
- ${o.description?W`<desc>${o.description}</desc>`:R}
33
- ${m?W`<style>${Ot}</style>`:R} ${ar(o)}
34
- ${je(o.shapes)}
35
- ${je(this.tip.length||!this.crossState?this.tip:at(o,this.crossState))}
36
- ${je(vt(o,this.focused))} ${je(this.overlay)}
32
+ ${s.description?W`<desc>${s.description}</desc>`:R}
33
+ ${x?W`<style>${Pt}</style>`:R} ${ur(s)}
34
+ ${Fe(s.shapes)}
35
+ ${Fe(this.tip.length||!this.crossState?this.tip:dt(s,this.crossState))}
36
+ ${Fe(Mt(s,this.focused))} ${Fe(this.overlay)}
37
37
  </svg>
38
- ${p?re`<div
38
+ ${m?ie`<div
39
39
  role="tooltip"
40
40
  data-skdx-tooltip=${r}
41
- style="left:${p.x+12}px;top:${p.y+12}px"
41
+ style="left:${m.x+12}px;top:${m.y+12}px"
42
42
  >
43
- ${p.lines.map(f=>re`<div>${f}</div>`)}
43
+ ${m.lines.map(g=>ie`<div>${g}</div>`)}
44
44
  </div>`:R}
45
- ${y?re`<table data-skdx-table=${r}>
45
+ ${b?ie`<table data-skdx-table=${r}>
46
46
  <caption>
47
- ${b}
47
+ ${u}
48
48
  </caption>
49
49
  <thead>
50
50
  <tr>
51
- ${(y[0]??[]).map(f=>re`<th scope="col">${f}</th>`)}
51
+ ${(b[0]??[]).map(g=>ie`<th scope="col">${g}</th>`)}
52
52
  </tr>
53
53
  </thead>
54
54
  <tbody>
55
- ${y.slice(1).map(f=>re`<tr>
56
- ${f.map((x,w)=>w===0?re`<th scope="row">${x}</th>`:re`<td>${x}</td>`)}
55
+ ${b.slice(1).map(g=>ie`<tr>
56
+ ${g.map((v,$)=>$===0?ie`<th scope="row">${v}</th>`:ie`<td>${v}</td>`)}
57
57
  </tr>`)}
58
58
  </tbody>
59
- </table>`:R}`}};$.styles=rr`
59
+ </table>`:R}`}};C.styles=cr`
60
60
  :host {
61
61
  display: inline-block;
62
62
  }
@@ -109,4 +109,4 @@ var On=Object.defineProperty;var Ln=Object.getOwnPropertyDescriptor;var g=(e,n,t
109
109
  [role='tooltip'] > :first-child:not(:only-child) {
110
110
  font-weight: bold;
111
111
  }
112
- `,g([k({type:Number})],$.prototype,"width",2),g([k({type:Number})],$.prototype,"height",2),g([k()],$.prototype,"label",2),g([k({type:Boolean,reflect:!0})],$.prototype,"legend",2),g([k({type:Boolean,attribute:"no-tooltip",converter:or})],$.prototype,"tooltip",2),g([k({attribute:!1})],$.prototype,"format",2),g([k({attribute:!1})],$.prototype,"palette",2),g([k({attribute:!1})],$.prototype,"hiddenSeries",2),g([k({attribute:!1})],$.prototype,"selected",2),g([k({attribute:"selection-mode"})],$.prototype,"selectionMode",2),g([k({attribute:!1})],$.prototype,"highlighted",2),g([k({attribute:!1})],$.prototype,"highlightScope",2),g([k({type:Boolean,reflect:!0})],$.prototype,"loading",2),g([k()],$.prototype,"error",2),g([k({attribute:"empty-message"})],$.prototype,"emptyMessage",2),g([k()],$.prototype,"description",2),g([k({type:Boolean,reflect:!0})],$.prototype,"decorative",2),g([k({type:Boolean,attribute:"accessible-table"})],$.prototype,"accessibleTable",2),g([k({attribute:!1})],$.prototype,"zoom",2),g([k({attribute:!1})],$.prototype,"view",2),g([k({type:Boolean,reflect:!0})],$.prototype,"zoomable",2),g([k({type:Boolean,reflect:!0})],$.prototype,"editable",2),g([k({attribute:"sync-id"})],$.prototype,"syncId",2),g([k({type:Boolean,attribute:"cross-filter"})],$.prototype,"crossFilter",2),g([k({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],$.prototype,"animated",2),g([k({type:Boolean,reflect:!0})],$.prototype,"responsive",2),g([K()],$.prototype,"tip",2),g([K()],$.prototype,"overlay",2),g([K()],$.prototype,"portal",2),g([K()],$.prototype,"measured",2),g([K()],$.prototype,"viewState",2),g([K()],$.prototype,"highlightState",2),g([K()],$.prototype,"crossState",2),g([K()],$.prototype,"focused",2),g([K()],$.prototype,"hiddenState",2),g([K()],$.prototype,"zoomState",2),g([K()],$.prototype,"selectedState",2);var A=class extends ${constructor(){super(...arguments);this.series=[];this.labels=!1;this.connectNulls=!1;this.stacked=!1;this.brush=!1;this.crosshair=!1}input(){let{series:t,categories:r,xAxis:i,yAxis:o,rightAxis:a,references:l,annotations:s,labels:c,curve:d,connectNulls:u,nulls:m,stacked:y,stackOffset:b,orientation:p,radius:f,barGap:x,barWidth:w,sort:C,transform:O,transforms:z,bins:M,binWidth:_,binDomain:X,binMode:F,sampling:U,brush:N,crosshair:E}=this;return{...this.sized(),series:t,categories:r,xAxis:i,yAxis:o,rightAxis:a,references:l,annotations:s,labels:c,curve:d,connectNulls:u,nulls:m,stacked:y,stackOffset:b,orientation:p,radius:f,barGap:x,barWidth:w,sort:C,transform:O,transforms:z,bins:M,binWidth:_,binDomain:X,binMode:F,sampling:U,brush:N,crosshair:E}}};g([k({attribute:!1})],A.prototype,"series",2),g([k({attribute:!1})],A.prototype,"categories",2),g([k({attribute:!1})],A.prototype,"xAxis",2),g([k({attribute:!1})],A.prototype,"yAxis",2),g([k({attribute:!1})],A.prototype,"rightAxis",2),g([k({attribute:!1})],A.prototype,"references",2),g([k({attribute:!1})],A.prototype,"annotations",2),g([k({type:Boolean,reflect:!0})],A.prototype,"labels",2),g([k()],A.prototype,"curve",2),g([k({type:Boolean,attribute:"connect-nulls"})],A.prototype,"connectNulls",2),g([k()],A.prototype,"nulls",2),g([k({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],A.prototype,"stacked",2),g([k({attribute:"stack-offset"})],A.prototype,"stackOffset",2),g([k()],A.prototype,"orientation",2),g([k({type:Number})],A.prototype,"radius",2),g([k({type:Number,attribute:"bar-gap"})],A.prototype,"barGap",2),g([k({type:Number,attribute:"bar-width"})],A.prototype,"barWidth",2),g([k()],A.prototype,"sort",2),g([k()],A.prototype,"transform",2),g([k({attribute:!1})],A.prototype,"transforms",2),g([k({type:Number})],A.prototype,"bins",2),g([k({type:Number,attribute:"bin-width"})],A.prototype,"binWidth",2),g([k({attribute:!1})],A.prototype,"binDomain",2),g([k({attribute:"bin-mode"})],A.prototype,"binMode",2),g([k({attribute:!1})],A.prototype,"sampling",2),g([k({type:Boolean,reflect:!0})],A.prototype,"brush",2),g([k({type:Boolean,reflect:!0})],A.prototype,"crosshair",2);var ar=e=>e.defs&&e.defs.length?W`<defs>${e.defs.map(n=>W`<linearGradient id=${n.id} x1="0" y1="0" x2=${n.vertical===!1?1:0} y2=${n.vertical===!1?0:1}>${n.stops.map(t=>W`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${T(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:R,je=e=>W`${e.map((n,t)=>{let r=n.title?W`<title>${n.title}</title>`:R,i=n.item?t:void 0;switch(n.kind){case"path":return W`<path data-skdx-part=${n.part} data-skdx-i=${T(i)} d=${n.d} fill=${n.fill??"none"} stroke=${T(n.stroke)} stroke-width=${T(n.strokeWidth)} stroke-linecap=${T(n.strokeLinecap)} stroke-linejoin=${T(n.strokeLinejoin)} stroke-dasharray=${T(n.dash)} opacity=${T(n.opacity)} fill-opacity=${T(n.fillOpacity)}>${r}</path>`;case"rect":return W`<rect data-skdx-part=${n.part} data-skdx-i=${T(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${T(n.rx)} style=${T(Be(n.part)?`rx:${Be(n.part)}`:void 0)} fill=${n.fill} stroke=${T(n.stroke)} fill-opacity=${T(n.opacity)} pointer-events=${T(n.part==="stage-label-background"||n.part==="label-background"?"none":void 0)}>${r}</rect>`;case"line":return W`<line data-skdx-part=${n.part} data-skdx-i=${T(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${T(n.strokeWidth)} stroke-dasharray=${T(n.dash)} opacity=${T(n.opacity)}>${r}</line>`;case"circle":return W`<circle data-skdx-part=${n.part} data-skdx-i=${T(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${T(n.stroke)} opacity=${T(n.opacity)}>${r}</circle>`;case"text":return W`<text aria-label=${T(n.title)} data-skdx-part=${n.part} data-skdx-i=${T(i)} x=${n.x} y=${n.y} text-anchor=${T(n.anchor)} dominant-baseline=${T(n.baseline)} fill=${T(n.fill)} font-weight=${T(n.weight)} pointer-events=${T(i===void 0?"none":void 0)} transform=${T(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var D=class extends ${constructor(){super(...arguments);this.series=[];this.labels=!1}render(){let{series:t,sizeRange:r,labels:i,xAxis:o,yAxis:a,references:l,annotations:s,colorScale:c,colorLegend:d,hitRadius:u,jitter:m,trendline:y,sampling:b}=this;return this.root(Je({...this.sized(),series:t,sizeRange:r,labels:i,xAxis:o,yAxis:a,references:l,annotations:s,colorScale:c,colorLegend:d,hitRadius:u,jitter:m,trendline:y,sampling:b}),"scatter",this.label??"Scatter chart")}};g([V({attribute:!1})],D.prototype,"series",2),g([V({attribute:!1})],D.prototype,"sizeRange",2),g([V({type:Boolean,reflect:!0})],D.prototype,"labels",2),g([V({attribute:!1})],D.prototype,"xAxis",2),g([V({attribute:!1})],D.prototype,"yAxis",2),g([V({attribute:!1})],D.prototype,"references",2),g([V({attribute:!1})],D.prototype,"annotations",2),g([V({attribute:!1})],D.prototype,"colorScale",2),g([V({attribute:!1})],D.prototype,"colorLegend",2),g([V({type:Number,attribute:"hit-radius"})],D.prototype,"hitRadius",2),g([V({type:Number})],D.prototype,"jitter",2),g([V({attribute:!1})],D.prototype,"trendline",2),g([V({attribute:!1})],D.prototype,"sampling",2),D=g([sr("skdx-scatter-chart")],D);export{D as SkdxScatterChart};
112
+ `,y([k({type:Number})],C.prototype,"width",2),y([k({type:Number})],C.prototype,"height",2),y([k()],C.prototype,"label",2),y([k({type:Boolean,reflect:!0})],C.prototype,"legend",2),y([k({type:Boolean,attribute:"no-tooltip",converter:hr})],C.prototype,"tooltip",2),y([k({attribute:!1})],C.prototype,"format",2),y([k({attribute:!1})],C.prototype,"palette",2),y([k({attribute:!1})],C.prototype,"hiddenSeries",2),y([k({attribute:!1})],C.prototype,"selected",2),y([k({attribute:"selection-mode"})],C.prototype,"selectionMode",2),y([k({attribute:!1})],C.prototype,"highlighted",2),y([k({attribute:!1})],C.prototype,"highlightScope",2),y([k({type:Boolean,reflect:!0})],C.prototype,"loading",2),y([k()],C.prototype,"error",2),y([k({attribute:"empty-message"})],C.prototype,"emptyMessage",2),y([k()],C.prototype,"description",2),y([k({type:Boolean,reflect:!0})],C.prototype,"decorative",2),y([k({type:Boolean,attribute:"accessible-table"})],C.prototype,"accessibleTable",2),y([k({attribute:!1})],C.prototype,"zoom",2),y([k({attribute:!1})],C.prototype,"view",2),y([k({type:Boolean,reflect:!0})],C.prototype,"zoomable",2),y([k({type:Boolean,reflect:!0})],C.prototype,"editable",2),y([k({attribute:"sync-id"})],C.prototype,"syncId",2),y([k({type:Boolean,attribute:"cross-filter"})],C.prototype,"crossFilter",2),y([k({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],C.prototype,"animated",2),y([k({type:Boolean,reflect:!0})],C.prototype,"responsive",2),y([K()],C.prototype,"tip",2),y([K()],C.prototype,"overlay",2),y([K()],C.prototype,"portal",2),y([K()],C.prototype,"measured",2),y([K()],C.prototype,"viewState",2),y([K()],C.prototype,"highlightState",2),y([K()],C.prototype,"crossState",2),y([K()],C.prototype,"focused",2),y([K()],C.prototype,"hiddenState",2),y([K()],C.prototype,"zoomState",2),y([K()],C.prototype,"selectedState",2);var A=class extends C{constructor(){super(...arguments);this.series=[];this.labels=!1;this.connectNulls=!1;this.stacked=!1;this.brush=!1;this.crosshair=!1}input(){let{series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:l,annotations:a,labels:c,curve:d,connectNulls:h,nulls:f,stacked:x,stackOffset:b,orientation:u,radius:m,barGap:g,barWidth:v,sort:$,transform:z,transforms:O,bins:S,binWidth:F,binDomain:J,binMode:D,sampling:U,brush:N,crosshair:G}=this;return{...this.sized(),series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:l,annotations:a,labels:c,curve:d,connectNulls:h,nulls:f,stacked:x,stackOffset:b,orientation:u,radius:m,barGap:g,barWidth:v,sort:$,transform:z,transforms:O,bins:S,binWidth:F,binDomain:J,binMode:D,sampling:U,brush:N,crosshair:G,...this.compactOverrides()}}};y([k({attribute:!1})],A.prototype,"series",2),y([k({attribute:!1})],A.prototype,"categories",2),y([k({attribute:!1})],A.prototype,"xAxis",2),y([k({attribute:!1})],A.prototype,"yAxis",2),y([k({attribute:!1})],A.prototype,"rightAxis",2),y([k({attribute:!1})],A.prototype,"references",2),y([k({attribute:!1})],A.prototype,"annotations",2),y([k({type:Boolean,reflect:!0})],A.prototype,"labels",2),y([k()],A.prototype,"curve",2),y([k({type:Boolean,attribute:"connect-nulls"})],A.prototype,"connectNulls",2),y([k()],A.prototype,"nulls",2),y([k({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],A.prototype,"stacked",2),y([k({attribute:"stack-offset"})],A.prototype,"stackOffset",2),y([k()],A.prototype,"orientation",2),y([k({type:Number})],A.prototype,"radius",2),y([k({type:Number,attribute:"bar-gap"})],A.prototype,"barGap",2),y([k({type:Number,attribute:"bar-width"})],A.prototype,"barWidth",2),y([k()],A.prototype,"sort",2),y([k()],A.prototype,"transform",2),y([k({attribute:!1})],A.prototype,"transforms",2),y([k({type:Number})],A.prototype,"bins",2),y([k({type:Number,attribute:"bin-width"})],A.prototype,"binWidth",2),y([k({attribute:!1})],A.prototype,"binDomain",2),y([k({attribute:"bin-mode"})],A.prototype,"binMode",2),y([k({attribute:!1})],A.prototype,"sampling",2),y([k({type:Boolean,reflect:!0})],A.prototype,"brush",2),y([k({type:Boolean,reflect:!0})],A.prototype,"crosshair",2);var ur=e=>e.defs&&e.defs.length?W`<defs>${e.defs.map(n=>W`<linearGradient id=${n.id} x1="0" y1="0" x2=${n.vertical===!1?1:0} y2=${n.vertical===!1?0:1}>${n.stops.map(t=>W`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${T(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:R,Fe=e=>W`${e.map((n,t)=>{let r=n.title?W`<title>${n.title}</title>`:R,i=n.item?t:void 0;switch(n.kind){case"path":return W`<path data-skdx-part=${n.part} data-skdx-i=${T(i)} d=${n.d} fill=${n.fill??"none"} stroke=${T(n.stroke)} stroke-width=${T(n.strokeWidth)} stroke-linecap=${T(n.strokeLinecap)} stroke-linejoin=${T(n.strokeLinejoin)} stroke-dasharray=${T(n.dash)} opacity=${T(n.opacity)} fill-opacity=${T(n.fillOpacity)}>${r}</path>`;case"rect":return W`<rect data-skdx-part=${n.part} data-skdx-i=${T(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${T(n.rx)} style=${T(Ne(n.part)?`rx:${Ne(n.part)}`:void 0)} fill=${n.fill} stroke=${T(n.stroke)} fill-opacity=${T(n.opacity)} pointer-events=${T(n.part==="stage-label-background"||n.part==="label-background"?"none":void 0)}>${r}</rect>`;case"line":return W`<line data-skdx-part=${n.part} data-skdx-i=${T(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${T(n.strokeWidth)} stroke-dasharray=${T(n.dash)} opacity=${T(n.opacity)}>${r}</line>`;case"circle":return W`<circle data-skdx-part=${n.part} data-skdx-i=${T(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${T(n.stroke)} opacity=${T(n.opacity)}>${r}</circle>`;case"text":return W`<text aria-label=${T(n.title)} data-skdx-part=${n.part} data-skdx-i=${T(i)} x=${n.x} y=${n.y} text-anchor=${T(n.anchor)} dominant-baseline=${T(n.baseline)} fill=${T(n.fill)} font-weight=${T(n.weight)} pointer-events=${T(i===void 0?"none":void 0)} transform=${T(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var B=class extends C{constructor(){super(...arguments);this.series=[];this.labels=!1}render(){let{series:t,sizeRange:r,labels:i,xAxis:o,yAxis:s,references:l,annotations:a,colorScale:c,colorLegend:d,hitRadius:h,jitter:f,trendline:x,sampling:b}=this,u={...this.sized(),series:t,sizeRange:r,labels:i,xAxis:o,yAxis:s,references:l,annotations:a,colorScale:c,colorLegend:d,hitRadius:h,jitter:f,trendline:x,sampling:b,...this.compactOverrides()};return this.root(nt(u),"scatter",this.label??"Scatter chart",u)}};y([H({attribute:!1})],B.prototype,"series",2),y([H({attribute:!1})],B.prototype,"sizeRange",2),y([H({type:Boolean,reflect:!0})],B.prototype,"labels",2),y([H({attribute:!1})],B.prototype,"xAxis",2),y([H({attribute:!1})],B.prototype,"yAxis",2),y([H({attribute:!1})],B.prototype,"references",2),y([H({attribute:!1})],B.prototype,"annotations",2),y([H({attribute:!1})],B.prototype,"colorScale",2),y([H({attribute:!1})],B.prototype,"colorLegend",2),y([H({type:Number,attribute:"hit-radius"})],B.prototype,"hitRadius",2),y([H({type:Number})],B.prototype,"jitter",2),y([H({attribute:!1})],B.prototype,"trendline",2),y([H({attribute:!1})],B.prototype,"sampling",2),B=y([pr("skdx-scatter-chart")],B);export{B as SkdxScatterChart};