@skdx/web-components-charts 0.38.0 → 0.39.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 (81) hide show
  1. package/dist/area.cjs +31 -31
  2. package/dist/area.js +11 -11
  3. package/dist/bar.cjs +31 -31
  4. package/dist/bar.js +11 -11
  5. package/dist/boxplot.cjs +8 -8
  6. package/dist/boxplot.js +9 -9
  7. package/dist/bubble.cjs +9 -9
  8. package/dist/bubble.js +10 -10
  9. package/dist/bullet.cjs +12 -12
  10. package/dist/bullet.js +13 -13
  11. package/dist/bump.cjs +7 -7
  12. package/dist/bump.js +8 -8
  13. package/dist/candlestick.cjs +34 -34
  14. package/dist/candlestick.js +34 -34
  15. package/dist/chord.cjs +35 -35
  16. package/dist/chord.js +21 -21
  17. package/dist/circle-packing.cjs +16 -16
  18. package/dist/circle-packing.js +30 -30
  19. package/dist/combo.cjs +31 -31
  20. package/dist/combo.js +11 -11
  21. package/dist/dumbbell.cjs +21 -21
  22. package/dist/dumbbell.js +24 -24
  23. package/dist/funnel.cjs +7 -7
  24. package/dist/funnel.js +7 -7
  25. package/dist/gantt.cjs +7 -7
  26. package/dist/gantt.js +8 -8
  27. package/dist/gauge.cjs +6 -6
  28. package/dist/gauge.js +6 -6
  29. package/dist/heatmap.cjs +9 -9
  30. package/dist/heatmap.js +10 -10
  31. package/dist/histogram.cjs +30 -30
  32. package/dist/histogram.js +11 -11
  33. package/dist/icicle.cjs +16 -16
  34. package/dist/icicle.js +16 -16
  35. package/dist/index.cjs +33 -33
  36. package/dist/index.js +17 -17
  37. package/dist/line.cjs +31 -31
  38. package/dist/line.js +11 -11
  39. package/dist/linear-gauge.cjs +12 -12
  40. package/dist/linear-gauge.js +13 -13
  41. package/dist/map.cjs +6 -6
  42. package/dist/map.js +6 -6
  43. package/dist/marimekko.cjs +17 -17
  44. package/dist/marimekko.js +20 -20
  45. package/dist/network.cjs +14 -14
  46. package/dist/network.js +13 -13
  47. package/dist/organization.cjs +10 -10
  48. package/dist/organization.js +14 -14
  49. package/dist/parallel.cjs +6 -6
  50. package/dist/parallel.js +6 -6
  51. package/dist/pareto.cjs +30 -30
  52. package/dist/pareto.js +12 -12
  53. package/dist/pie.cjs +6 -6
  54. package/dist/pie.js +6 -6
  55. package/dist/polar-area.cjs +7 -7
  56. package/dist/polar-area.js +7 -7
  57. package/dist/radar.cjs +7 -7
  58. package/dist/radar.js +6 -6
  59. package/dist/radial.cjs +6 -6
  60. package/dist/radial.js +6 -6
  61. package/dist/range.cjs +31 -31
  62. package/dist/range.js +15 -15
  63. package/dist/sankey.cjs +10 -10
  64. package/dist/sankey.js +15 -15
  65. package/dist/scatter.cjs +31 -31
  66. package/dist/scatter.js +12 -12
  67. package/dist/sunburst.cjs +28 -28
  68. package/dist/sunburst.js +8 -8
  69. package/dist/swarm.cjs +16 -16
  70. package/dist/swarm.js +17 -17
  71. package/dist/timeline.cjs +6 -6
  72. package/dist/timeline.js +6 -6
  73. package/dist/tree.cjs +10 -10
  74. package/dist/tree.js +13 -13
  75. package/dist/treemap.cjs +7 -7
  76. package/dist/treemap.js +7 -7
  77. package/dist/waffle.cjs +31 -31
  78. package/dist/waffle.js +31 -31
  79. package/dist/waterfall.cjs +14 -14
  80. package/dist/waterfall.js +18 -18
  81. package/package.json +3 -3
package/dist/swarm.js CHANGED
@@ -1,5 +1,5 @@
1
- var Et=Object.defineProperty;var Wt=Object.getOwnPropertyDescriptor;var p=(e,n,t,r)=>{for(var i=r>1?void 0:r?Wt(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&&Et(n,t,i),i};import{customElement as fn,property as ee}from"lit/decorators.js";var lt=e=>Number(e.toPrecision(12)),Ut,Kt=e=>(Ut??(Ut=new Intl.NumberFormat)).format(lt(e)),Yt=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 ie(e){if(e===void 0)return Kt;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:i="",timeZone:o}=e,s=d=>i?u=>d(u)+i:d,c=d=>r===void 0?d===void 0?{}:{maximumFractionDigits:d}:{minimumFractionDigits:r,maximumFractionDigits:r},a=d=>{let u=new Intl.NumberFormat(t,d);return s(x=>u.format(lt(x)))},l=d=>{let u=new Intl.DateTimeFormat(t,o?{...d,timeZone:o}:d);return x=>u.format(x)};switch(n){case"integer":return a({maximumFractionDigits:0});case"decimal":return a(c(2));case"percent":return a({style:"percent",...c(0)});case"currency":return a({style:"currency",currency:e.currency??"USD",...c()});case"compact":return a({notation:"compact",...c(1)});case"scientific":return a({notation:"scientific",...c(2)});case"date":return l({dateStyle:"medium"});case"time":return l({timeStyle:"short"});case"datetime":return l({dateStyle:"medium",timeStyle:"short"});case"duration":return s(Yt)}}function se([e,n],[t,r]){let i=n-e;return o=>i===0?t:t+(o-e)/i*(r-t)}function ae(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,c=Math.floor(e/s)*s,a=Math.ceil(n/s)*s,l=[];for(let d=c;d<=a+s/2;d+=s)l.push(ht(d));return l}function dt(e,[n,t],r=.2){let i=e===0?0:(t-n)/e,o=i*(1-Math.max(0,Math.min(.9,r)));return{step:i,bandwidth:o,start:s=>n+s*i+(i-o)/2,center:s=>n+(s+.5)*i}}var ht=e=>Number(e.toPrecision(12)),b=e=>Number(e.toFixed(2)),ce=e=>typeof e=="number"&&Number.isFinite(e),ut=e=>e.filter(ce);function pt(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]}var U=1e3,K=60*U,Y=60*K,oe=24*Y,xn=[U,5*U,15*U,30*U,K,5*K,15*K,30*K,Y,3*Y,6*Y,12*Y,oe,2*oe,7*oe,14*oe];function ft(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 c of i)o.push(ht(c*10**s));return o.filter(s=>s>=e/1.0001&&s<=n*1.0001)}var qt=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,Xt=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,Qt={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function Jt(e,n,t){return e.replace(Xt,(r,i,o)=>{let s=Qt[i];if(s===void 0)return i+o;let a=(o.match(qt)??[]).map((l,d)=>{let u=Number(l);if(s===-1)return String(u+n);if(s===-2)return String(u+t);let x=d%s;return s===7?x===5?String(u+n):x===6?String(u+t):l:String(x%2===0?u+n:u+t)});return i+a.join(" ")})}var mt=(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:Jt(r.d,n,t)}}});var ge=["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)"},ye=(e="neutral")=>e==="neutral"?S.axis:`var(--skdx-color-${e}-500)`,bt=(e="neutral")=>e==="neutral"?S.label:e==="primary"?"var(--skdx-color-text-accent)":`var(--skdx-color-text-${e})`,xt=(e,n)=>n??ge[e%ge.length];var _={top:16,right:16,bottom:32,left:48};function gt(e,n,t=_){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 q(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function yt(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var le=20,en=120,vt=e=>{let n=q(e);return n&&(n.position==="left"||n.position==="right")?n.width??en:0},we=(e,n=600,t=300)=>({width:(e.width??n)-vt(e),height:(e.height??t)-(q(e)?.position==="bottom"?le:0)}),wt=e=>{let n=q(e);return n&&(n.position===void 0||n.position==="top")?le:0},G=6.5,ke=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:xt(n)),Me=(e,n)=>e.hiddenSeries?.includes(n)??!1;function ve(e,n,t=[],r={},i=10,o=8,s=!1){let c=[],a=r.maxItems,l=a!==void 0&&a>=0&&e.length>a?e.slice(0,a):e,d=e.length-l.length,u=r.interactive??!0,x=o,w=i,g=(h,y,v,f)=>{let M=(y?18:4)+h.length*G;x>o&&(s||x+M>n-8)&&(x=o,w+=le),y&&c.push({kind:"rect",part:"legend-swatch",x,y:w-5,width:10,height:10,fill:y,opacity:f?.3:void 0,item:v}),c.push({kind:"text",part:"legend-label",x:x+(y?14:0),y:w,text:h,baseline:"middle",fill:f?S.grid:S.label,item:v}),x+=M+12};for(let h of l){let y=t.includes(h.name),v=u?{label:h.name,series:h.name,legend:!0}:void 0;g(r.formatter?.(h.name)??h.name,h.color,v,y)}return d>0&&g(`+${d} more`,void 0,void 0,!1),r.align==="end"?tn(c,n):c}function tn(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(c=>c.kind==="rect"?c.x+c.width:c.x+c.text.length*G)),s=n-8-o;for(let c of i)r.push({...c,x:c.x+s})}return r}var nn=(e,n,t={})=>new Set(ve(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function Se(e,n,t,r=[]){let i=q(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,s=yt(e),c=o?.position==="bottom",a=vt(e),l=e.hiddenSeries??[],d=o?a?ve(r,1/0,l,o,10,(o.position==="right"?n:0)+8,!0):ve(r,n,l,o,c?t+10:10):[],u=c?nn(r,n,o):0;return{width:n+a,height:c?t+Math.max(1,u)*le: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 Ce(e){let n=e.legendOffset;if(!n)return e;let t=[...mt(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,c=e.map?{...e.map,plot:r(e.map.plot)}:void 0;return{...e,shapes:t,hit:i,edit:s,map:c,legendOffset:void 0}}function de(e,n,t,r,i,o="auto"){let s=Array.isArray(t)?t:[t],c=Math.max(...s.map(x=>x.length))*G+12,a=6+s.length*16,l=o==="top"?{x:e-c/2,y:n-a-8}:o==="bottom"?{x:e-c/2,y:n+8}:o==="left"?{x:e-c-8,y:n-a/2}:o==="right"?{x:e+8,y:n-a/2}:{x:e+12,y:n-a-6},d=Math.max(0,Math.min(r-c,l.x)),u=Math.max(0,Math.min(i-a,l.y));return[{kind:"rect",part:"tooltip",x:b(d),y:b(u),width:b(c),height:a,fill:"var(--skdx-color-surface-raised)",stroke:S.axis,rx:3},...s.map((x,w)=>({kind:"text",part:"tooltip-label",x:b(d+6),y:b(u+11+w*16),text:x,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:s.length>1&&w===0?"bold":void 0}))]}function kt(e,n){let[t,r]=pt(e);return n?[Math.min(0,t),Math.max(0,r)]:[t,r]}function Mt([e,n],t,r=!1,i){let o=typeof r=="boolean"?{scale:r?"log":"linear"}:r,s=ie(o.format??i),c=o.min??e,a=o.max??n;o.reversed&&(t=[t[1],t[0]]);let l={id:o.id,position:o.position,options:o};if(o.scale==="sqrt"){let h=z=>Math.sign(z)*Math.sqrt(Math.abs(z)),y=o.nice===!1?[c,a]:ae(c,a,o.ticks),v=o.min??y[0],f=o.max??y[y.length-1],M=se([h(v),h(f)],t),I=z=>M(h(z)),L=ae(v,f,o.ticks).filter(z=>z>=v-1e-9&&z<=f+1e-9);return{...l,scale:I,domain:[v,f],format:s,ticks:(L.length>=2?L:[v,f]).map(z=>({pos:b(I(z)),label:s(z)})),zero:b(I(Math.min(Math.max(0,v),f)))}}if(o.scale==="log"){let h=Math.max(c,Number.EPSILON),y=Math.max(a,h),v=ft(h,y),f=[Math.log10(h),Math.log10(y)],M=se(f,t),I=L=>M(Math.log10(Math.max(L,Number.EPSILON)));return{...l,scale:I,domain:f,format:s,ticks:v.map(L=>({pos:b(I(L)),label:s(L)})),zero:b(t[0])}}let d=ae(c,a,o.ticks),u=[o.min??(o.nice===!1?c:d[0]),o.max??(o.nice===!1?a:d[d.length-1])],x=se(u,t),w=d.filter(h=>h>=u[0]-1e-9&&h<=u[1]+1e-9),g=(w.length>=2?w:[u[0],u[1]]).map(h=>({pos:b(x(h)),label:s(h)}));return{...l,scale:x,domain:u,format:s,ticks:g,zero:b(x(Math.min(Math.max(0,u[0]),u[1])))}}var St=e=>e?.grid!==!1;function $e(e,n){if(e.length<2)return e;let t=e.reduce((i,o)=>Math.max(i,o.label.length),0)*G+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 Ct(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}=we(e,t,r),c=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:4}),a.push({kind:"text",part:`state-${i}`,x:b(o/2),y:b(s/2),text:c,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":S.label}),{...Se(e,o,s),shapes:a,tooltip:!1}}function $t(e,n={}){let{plot:t,xTicks:r,yTicks:i,baseline:o}=e,s=t.x+t.width,c=t.y+t.height,a=[],l=n.grid??!0,d=(g,h)=>h?{kind:"line",part:"grid",x1:g.pos,x2:g.pos,y1:t.y,y2:c,stroke:S.grid}:{kind:"line",part:"grid",x1:t.x,x2:s,y1:g.pos,y2:g.pos,stroke:S.grid},u=n.x?.tickRotation??0,x=(g,h,y,v)=>u?A(g,h,y,{part:v,anchor:u<0?"end":"start",baseline:"middle",rotate:u}):A(g,h,y,{part:v,anchor:"middle"}),w=(g,h,y,v,f)=>{for(let M of g)a.push(h==="x"?{kind:"line",part:"tick",x1:M.pos,x2:M.pos,y1:y,y2:b(y+v*f),stroke:S.axis}:{kind:"line",part:"tick",x1:y,x2:b(y+v*f),y1:M.pos,y2:M.pos,stroke:S.axis})};if(n.categoryGrid)for(let g of r)a.push(d(g,!n.horizontal));if(n.horizontal){let g=n.axes??[{ticks:i,position:"bottom",offset:0,label:n.yLabel,...n.y}];if(l)for(let h of i)a.push(d(h,!0));g[0]?.showLine!==!1&&a.push({kind:"line",part:"axis",x1:o,x2:o,y1:t.y,y2:c,stroke:S.axis});for(let h of g){let y=h.position==="top"||h.position==="right",v=b(y?t.y-h.offset:c+h.offset),f=y||h.offset>0;h.showLine&&f&&a.push({kind:"line",part:"axis",x1:t.x,x2:s,y1:v,y2:v,stroke:S.axis}),h.showTicks&&w(h.ticks,"x",v,y?-1:1,h.tickSize??4);let M=b(y?v-8:v+20);for(let I of h.ticks)a.push(y?A(I.pos,M,I.label,{part:"x-label-top",anchor:"middle"}):x(I.pos,M,I.label,"x-label"));h.label&&a.push(f?A(4,M,h.label,{part:"axis-title",anchor:"start",baseline:y?void 0:"middle"}):A(4,t.y-6,h.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:c,stroke:S.axis}),n.x?.showTicks&&w(r,"y",n.rtl?s:t.x,n.rtl?1:-1,n.x.tickSize??4);for(let h of r)a.push(n.rtl?A(s+8,h.pos,h.label,{part:"y-label",anchor:"start",baseline:"middle"}):A(t.x-8,h.pos,h.label,{part:"y-label",anchor:"end",baseline:"middle"}))}else{if(l)for(let h of i)a.push(d(h,!1));n.y?.showLine!==!1&&a.push({kind:"line",part:"axis",x1:t.x,x2:s,y1:o,y2:o,stroke:S.axis});let g=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 h of g){let y=h.position==="left",v=y?t.x-h.offset:s+h.offset,f=y?"y-label":"y-label-right";h.showLine&&a.push({kind:"line",part:"axis",x1:b(v),x2:b(v),y1:t.y,y2:c,stroke:S.axis}),h.showTicks&&w(h.ticks,"y",b(v),y?-1:1,h.tickSize??4);for(let M of h.ticks)a.push(A(b(y?v-8:v+8),M.pos,M.label,{part:f,anchor:y?"end":"start",baseline:"middle"}));h.label&&a.push(A(b(y?h.offset===0?4:Math.max(4,v-40):h.offset===0?e.width-4:Math.min(e.width-4,v+40)),t.y-6,h.label,{part:"axis-title",anchor:y?"start":"end"}))}n.x?.showTicks&&w(r,"x",c,1,n.x.tickSize??4);for(let h of r)a.push(x(h.pos,c+(u?12:20),h.label,"x-label"))}return n.xLabel&&a.push(A(b(t.x+t.width/2),e.height-4,n.xLabel,{part:"axis-title",anchor:"middle"})),n.horizontal&&n.rightLabel&&a.push(A(e.width-4,t.y-6,n.rightLabel,{part:"axis-title",anchor:"end"})),a}var A=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:S.label,...r});function Ot(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)),c=a=>Math.max(r.y,Math.min(o,a));for(let a of e??[]){let l=a.color??ye(a.variant),d=a.color??bt(a.variant),u={part:"reference-label",fill:d},x=n.horizontal===!0;if("y"in a){let w=b(n.y(a.y,a.axis??"left"));if(x){let g=s(w);t.push(...Tt(g,r.y,o,l,a.label,u))}else{let g=c(w);t.push(...It(r.x,i,g,l,a.label,u))}}else if("x"in a){let w=n.x(a.x);if(w===void 0)continue;x?t.push(...It(r.x,i,c(b(w)),l,a.label,u)):t.push(...Tt(s(b(w)),r.y,o,l,a.label,u))}else if("y1"in a){let w=b(n.y(a.y1,a.axis??"left")),g=b(n.y(a.y2,a.axis??"left"));x?t.push(...At(s(Math.min(w,g)),s(Math.max(w,g)),r,l,a.label,d)):t.push(...zt(c(Math.min(w,g)),c(Math.max(w,g)),r,l,a.label,d))}else{let w=n.x(a.x1),g=n.x(a.x2);if(w===void 0||g===void 0)continue;let h=b(Math.min(w,g)),y=b(Math.max(w,g));x?t.push(...zt(c(h),c(y),r,l,a.label,d)):t.push(...At(s(h),s(y),r,l,a.label,d))}}return t}function It(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,A(n-4,t-5,i,{...o,anchor:"end"})]:[s]}function Tt(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,A(e+4,n+10,i,{...o,anchor:"start"})]:[s]}function zt(e,n,t,r,i,o){let s={kind:"rect",part:"reference-area",x:t.x,y:e,width:t.width,height:b(Math.max(0,n-e)),fill:r,opacity:.12,title:i};return i?[s,A(t.x+t.width-4,e+12,i,{part:"reference-label",fill:o,anchor:"end"})]:[s]}function At(e,n,t,r,i,o){let s={kind:"rect",part:"reference-area",x:e,y:t.y,width:b(Math.max(0,n-e)),height:t.height,fill:r,opacity:.12,title:i};return i?[s,A(e+4,t.y+12,i,{part:"reference-label",fill:o,anchor:"start"})]:[s]}function he(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var Ie=e=>e.id??e.name??e.series,Lt=e=>e.seriesId??e.series;function P(e,n){let t=!1;return n.id!==void 0&&(t=!0,Ie(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,Lt(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 F(e){let n={},t=Ie(e);t!==void 0&&(n.id=t);let r=Lt(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var Te=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function ze(e,n,t){let r=he(e),i=F(n),o=r.some(s=>P(n,s));return t==="single"?o?[]:[i]:o?r.filter(s=>!P(n,s)):[...r,i]}var rn=.2;function on(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 sn=(e,n)=>e.kind==="text"?{...e,fill:S.grid}:{...e,opacity:(e.opacity??1)*n};function Ae(e,n){let t=he(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:he(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=[],c=d=>!i||r.some(u=>P(d,u))?!0:o.highlighted==="series"?r.some(u=>u.series!==void 0&&P(d,{series:u.series})):!1,a=d=>{if(!i||o.faded==="none"||c(d))return!1;if(o.faded==="series"){let u=i.series;return u!==void 0&&P(d,{series:u})}return!0},l=e.shapes.map(d=>{let u=d.item;if(!u||u.legend)return d;if(t.some(x=>P(u,x))){let x=on(d);x&&s.push(x)}return a(u)?sn(d,rn):d});return s.length?{...e,shapes:[...l,...s]}:{...e,shapes:l}}function W(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 Oe=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function Bt(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 X(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=Bt(t,n),i=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(i,r)??i}}function Le(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[Bt(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 Be(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!Oe(r.plot,n,t))return[];let i=Le(e,n),{rows:o}=X(e,n),s=e.tooltipAnchored?r.plot.y+8:t;return[i,...de(i.x1,s,o,e.width,e.height,e.tooltipPlacement)]}function Re(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 Be(e,i,t.plot.y+8)}function Pe(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:a,y:l}=W(t,r,i,e.width,e.height);if(Oe(e.hit.plot,a,l)){let d=X(e,a),u=Le(e,a);if(d&&u)return{lines:d.rows,shapes:[u]}}}let o=n?.closest?.("[data-skdx-part]"),s=e.tooltipFormatter?j(e,n)?.item:void 0,c=s&&e.tooltipFormatter?.(s)||o&&Array.from(o.children).find(a=>a.tagName.toLowerCase()==="title")?.textContent;return c?{lines:Array.isArray(c)?c:[c],shapes:[]}:{lines:[],shapes:[]}}function Rt(e,n,t,r,i,o,s){let c=e?.closest?.("[data-skdx-part]"),a=s&&s.tooltipFormatter?j(s,e)?.item:void 0,l=a&&s?.tooltipFormatter?.(a)||c&&Array.from(c.children).find(g=>g.tagName.toLowerCase()==="title")?.textContent;if(!l)return[];let d=s?.tooltipAnchored?j(s,e):void 0,u=d?s?.shapes[d.index]:void 0,{x,y:w}=u?Q(u):W(n,t,r,i,o);return de(x,w,l,i,o,s?.tooltipPlacement)}function Ne(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:s}=W(t,r,i,e.width,e.height),c=Be(e,o,s);if(c.length>0)return c}return Rt(n,t,r,i,e.width,e.height,e)}function De(e,n){let t=j(e,n);return t&&!t.item.legend?F(t.item):null}var an=(e,n)=>{let{x:t,y:r}=Q(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 Ge(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!an(i,n))continue;let o=F(i.item),s=JSON.stringify(o);t.has(s)||(t.add(s),r.push(o))}return r}var Fe=e=>({kind:"rect",part:"selection-box",x:b(e.x),y:b(e.y),width:b(e.width),height:b(e.height),fill:S.focus,opacity:.12,stroke:S.focus}),pe=(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 Pt(e,n,t){let r=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){let s=e[i],c=e[o];s.y>t!=c.y>t&&n<(c.x-s.x)*(t-s.y)/(c.y-s.y)+s.x&&(r=!r)}return r}function je(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}=Q(i),c=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:s;if(!Pt(n,o,c))continue;let a=F(i.item),l=JSON.stringify(a);t.has(l)||(t.add(l),r.push(a))}return r}var He=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${b(n.x)} ${b(n.y)}`).join("L")}`:"",fill:S.focus,fillOpacity:.12,stroke:S.focus,dash:"4 3"}),ue=6;function Ve(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-ue||n>i.x1+ue))return Math.abs(n-i.x0)<=ue?{bar:i,mode:"start"}:Math.abs(n-i.x1)<=ue?{bar:i,mode:"end"}:{bar:i,mode:"move"}}}function _e(e,n,t){let r=e.edit;return Nt(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function Ze(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",c=r.snap??r.invert(o.x0+10)-r.invert(o.x0);return Nt(r,{bar:o,mode:s},i*c)}function Nt(e,{bar:n,mode:t},r){let i=c=>e.snap?Math.round(c/e.snap)*e.snap:c,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 Ee(e,n,t){let r=e.edit,i=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:b(Math.min(i,o)),y:b(n.bar.y),width:b(Math.max(1,Math.abs(o-i))),height:b(n.bar.height),fill:S.focus,opacity:.25,stroke:S.focus,rx:2}}var cn=64,ln=e=>Math.max(1,Math.min(cn,e));function We(e,n,t,r){let i=n>0?.8:1.25,o=ln(e.view.zoom*i);if(o===e.view.zoom)return e.view;let{plot:s,scale:c}=e,[a,l]=e.view.center,d=(t-(s.x+s.width/2))/c,u=(r-(s.y+s.height/2))/c,x=e.view.zoom/o;return{center:[a+d*(1-x),e.fromY(e.toY(l)-u*(1-x))],zoom:o}}function Ue(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 j(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 Q(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 Ke(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*G+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}=Q(t),c=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...c?de(b(o),b(s),c,e.width,e.height):[]]}function Ye(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 Z=2,E=(e,n,t)=>{let r=Math.max(Z,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},Dt=(e,n)=>!e||e.start<=0&&e.end>=n;function qe(e,n,t){if(e.count<=Z||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,s=n>0?1.25:.8,c=Math.max(Z,Math.min(e.count,Math.round(o*s)));if(c===o)return n>0&&!Dt(e.zoom,e.count)?E(r,c,e.count):void 0;let a=Math.max(0,Math.min(1,(t-e.plot.x)/e.plot.width)),l=r+a*o;return E(l-a*c,c,e.count)}function Xe(e,n,t,r){let i=n.end-n.start,o=Math.max(Z,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 E(n.start+s*i-s*o,o,e.count)}function Qe(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return E(n.start-t/i,r,e.count)}function Je(e,n,t){let r=e.brush;if(!r||!Oe(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:E(s-o/2,o,e.count)}}function et(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 E(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-Z,Math.round(t.start+o))),end:t.end};let s=Math.min(e.count,Math.max(t.start+Z,Math.round(t.end+o)));return{start:t.start,end:s}}function nt(e,n){switch(n.type){case"svg":return Promise.resolve(tt(e,n.label,n.resolve));case"csv":return Promise.resolve(Ht(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=tt(e,n.label,n.resolve);return jt(t,e.width,e.height,n.scale,n.background)}}}var N=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;"),J=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${N(String(t))}"`).join("");function Gt(e){let n=e.title?`<title>${N(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${J([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${J([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${J([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${J([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${J([t,["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]])}>${N(e.text)}</text>`}}function Ft(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${N(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="${N(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function tt(e,n,t){let r=Ft(e)+e.shapes.map(Gt).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="${N(n)}" font-family="${N(S.fontFamily)}" font-size="${N(S.fontSize)}"><title>${N(n)}</title>${r}</svg>`}function jt(e,n,t,r=2,i){return new Promise((o,s)=>{let c=URL.createObjectURL(new Blob([e],{type:"image/svg+xml;charset=utf-8"})),a=new Image;a.onload=()=>{URL.revokeObjectURL(c);let l=document.createElement("canvas");l.width=Math.round(n*r),l.height=Math.round(t*r);let d=l.getContext("2d");if(!d)return s(new Error("canvas 2d context unavailable"));i&&(d.fillStyle=i,d.fillRect(0,0,l.width,l.height)),d.drawImage(a,0,0,l.width,l.height),l.toBlob(u=>u?o(u):s(new Error("toBlob failed")),"image/png")},a.onerror=()=>{URL.revokeObjectURL(c),s(new Error("svg could not be decoded"))},a.src=c})}function Ht(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
2
- `)}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 c=r.rows[0];if(r.rows.length>t)return;let a=["",...c.slice(1).map(d=>d.replace(/:\s[^:]*$/,""))],l=r.rows.map(d=>[d[0],...d.slice(1).map(u=>u.slice(u.lastIndexOf(": ")+2))]);return[a,...l]}let i=e.shapes.flatMap(c=>c.item&&!c.item.legend&&!(c.part==="anchor"&&!c.title)?[c.item]:[]);if(i.length===0||i.length>t)return;let o=["series","name","category","value"].filter(c=>i.some(a=>a[c]!==void 0)),s=(c,a)=>c[a]===void 0?"":String(c[a]);return[o.map(c=>c[0]?.toUpperCase()+c.slice(1)),...i.map(c=>o.map(a=>s(c,a)))]}var it=new Map;function me(e){let n=it.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&&it.delete(e)}},publish(o,s){Object.assign(r,o);for(let c of t)c(o,s)}};return it.set(e,{group:i,listeners:t}),i}var Vt='[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}}${Vt}{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){${Vt}{animation:none;transition:none}}`;function st(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}var _t=2e3;function Zt(e,n,t){let r=[],i=[],o=(2*n)**2;for(let s of e){let c=[];for(let l=r.length-1;l>=0&&s-r[l].p<2*n;l--)c.push(r[l]);let a=0;for(let l=0;;l++){if(a=l===0?0:(l%2?1:-1)*Math.ceil(l/2),Math.abs(a)>t){a=Math.sign(a)*t;break}if(c.every(d=>(d.p-s)**2+(d.off-a)**2>=o))break}r.push({p:s,off:a}),i.push(a)}return i}function at(e){let n=[];for(let f of e.series){let M=f.data.filter(I=>I!==null&&!Number.isFinite(I)).length;M&&n.push({code:"invalid-value",severity:"warning",message:`Series "${f.name}" has ${M} value${M===1?"":"s"} that ${M===1?"is":"are"} neither a number nor null; skipped.`,itemId:f.id??f.name})}let t=e.series.map(f=>Me(e,f.name)?[]:ut(f.data)),r=Ct(e,t.every(f=>f.length===0));if(r)return{...r,issues:n};let i=ie(e.yAxis?.format??e.format),{width:o,height:s}=we(e),c=e.orientation==="horizontal",a=Math.max(0,...e.series.map(f=>f.name.length))*G,l=gt(o,s,{..._,top:_.top+wt(e)+(!c&&e.yAxis?.label?12:0),left:c?Math.max(_.left,a+16):_.left,bottom:_.bottom+(c&&e.yAxis?.label?14:0)}),d=Mt(kt(t.flat(),!1),c?[l.x,l.x+l.width]:[l.y+l.height,l.y],e.yAxis??{},e.format),u=dt(e.series.length,c?[l.y,l.y+l.height]:[l.x,l.x+l.width]),x=Se(e,o,s,e.series.map((f,M)=>({name:f.name,color:ke(e,M,f.color)}))),w=e.series.map((f,M)=>({pos:b(u.center(M)),label:f.name})),g=$t({...x,plot:l,xTicks:c?w:$e(w,l.width),yTicks:c?$e(d.ticks,l.width):d.ticks,baseline:c?l.x:l.y+l.height},{horizontal:c,grid:St(e.yAxis),...c?{xLabel:e.yAxis?.label}:{yLabel:e.yAxis?.label}});g.push(...Ot(e.references,{plot:l,horizontal:c,x:f=>{let M=e.series.findIndex(I=>I.name===f);return M<0?void 0:u.center(M)},y:f=>d.scale(f)}));let h=e.markerSize??3,y=Math.max(0,u.bandwidth/2-h),v=[];return e.series.forEach((f,M)=>{let I=ke(e,M,f.color),L=u.center(M),z=(Me(e,f.name)?[]:f.data).map((O,V)=>({v:O,index:V})).filter(O=>ce(O.v)).sort((O,V)=>d.scale(O.v)-d.scale(V.v)),xe=Zt(z.map(O=>d.scale(O.v)),h,y),te=z.length<=_t;z.forEach((O,V)=>{let ne=d.scale(O.v),re=xe[V],ct=`${f.name}: ${i(O.v)}`;v.push({kind:"circle",part:"dot",cx:b(c?ne:L+re),cy:b(c?L+re:ne),r:h,fill:I,title:te?ct:void 0,item:te?{label:ct,id:f.id??f.name,series:f.name,seriesId:f.id??f.name,index:O.index,value:O.v}:void 0})})}),{...x,shapes:[...g,...v,...x.shapes],issues:n}}import{css as dn,html as H,LitElement as hn,nothing as T,svg as B}from"lit";import{property as m,state as R}from"lit/decorators.js";import{ifDefined as $}from"lit/directives/if-defined.js";var un={fromAttribute:()=>!1},k=class extends hn{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:s}=this.viewBox(t,r);this.overlay=[Fe(pe(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=[He(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=_e(r,i.gantt,o-i.x),this.overlay=[Ee(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(Ue(r.map,i.view,o-i.x,s-i.y));return}if(i&&r.hit){if(i.grab==="pinch"){let[s,c]=[...this.pointers.values()];if(s===void 0||c===void 0||!i.distance)return;this.setZoom(Xe(r.hit,i.zoom,Math.abs(s-c)/i.distance,(s+c)/2));return}let{x:o}=this.viewBox(t,r);this.setZoom(i.grab==="pan"?Qe(r.hit,i.zoom,o-i.x):et(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:s}=Pe(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=Ne(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(De(r,t.target)),this.syncId&&r.hit?.crosshair){let o=X(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=j(r,t.target)?.item.legend,c=this.canEdit(r)?Ve(r,i,o):void 0;if(c){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"edit",gantt:c},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 l=r.map.plot;if(i<l.x||i>l.x+l.width||o<l.y||o>l.y+l.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[l,d]=[...this.pointers.values()];this.drag={x:(l+d)/2,y:o,zoom:a.zoom,grab:"pinch",distance:Math.abs(l-d)||1}}else{let l=Je(a,i,o);if(l)this.drag={x:i,y:o,zoom:l.zoom,grab:l.grab},l.zoom!==a.zoom&&this.setZoom(l.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:c}=this.viewBox(t,o);if(Math.abs(s-i.x)>2||Math.abs(c-i.y)>2){i.grab==="select"?this.setSelected(Ge(o,pe(i.x,i.y,s,c))):i.grab==="lasso"?this.setSelected(je(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(We(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 c=qe(s,t.deltaY,i);c&&(t.preventDefault(),this.setZoom(c))};this.onClick=t=>{if(!this.layout)return;if(this.drag?.distance===-1){this.drag=null;return}let r=j(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=>{let r=this.layout;if(!r)return;if((t.key==="Enter"||t.key===" ")&&this.focused!==null){let c=r.shapes[this.focused]?.item;c&&(t.preventDefault(),this.select(c),this.emit("skdx-item-click",c));return}let i=this.canEdit(r)?Ze(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=Ye(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?F(s):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:s,palette:c,loading:a,error:l,emptyMessage:d,description:u,decorative:x,animated:w,responsive:g,highlighted:h,highlightScope:y,accessibleTable:v}=this;return{...typeof g=="object"&&this.measured!==void 0&&this.measured<(g.breakpoint??480)?g.compact:void 0,width:g&&this.measured?this.measured:t,height:r,animate:w,responsive:g,legend:i,tooltip:o,format:s,palette:c,loading:a,error:l,emptyMessage:d,description:u,decorative:x,highlighted:h===void 0?this.highlightState:h,highlightScope:y,accessibleTable:v,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&&me(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=me(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&&Te(r,t)||(this.hover=t,this.emit("skdx-highlighted-change",t),this.syncId&&(this.highlightState=t,this.publish({highlighted:t})))}select(t){let r=this.selectionMode;r!=="none"&&this.setSelected(ze(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 W(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&&P(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?nt(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=Ae(Ce(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let v of o.issues??[])this.emit("skdx-data-issue",v)}let s=this.canZoom(o),c=this.canPan(o),a=this.canEdit(o),l=this.brushing(),d=s||c||a||l,u=!o.decorative&&fe(o).length>0,x=o.description?`${r}-desc`:void 0,w=st(o),g=rt(o,this.accessibleTable),h=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,y=this.portal;return H`<svg
1
+ var Ut=Object.defineProperty;var Kt=Object.getOwnPropertyDescriptor;var p=(e,n,t,r)=>{for(var i=r>1?void 0:r?Kt(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&&Ut(n,t,i),i};import{customElement as mn,property as ee}from"lit/decorators.js";var ct=e=>Number(e.toPrecision(12)),Yt,qt=e=>(Yt??(Yt=new Intl.NumberFormat)).format(ct(e)),Xt=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 ie(e){if(e===void 0)return qt;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:i="",timeZone:o}=e,s=d=>i?u=>d(u)+i:d,l=d=>r===void 0?d===void 0?{}:{maximumFractionDigits:d}:{minimumFractionDigits:r,maximumFractionDigits:r},a=d=>{let u=new Intl.NumberFormat(t,d);return s(g=>u.format(ct(g)))},c=d=>{let u=new Intl.DateTimeFormat(t,o?{...d,timeZone:o}:d);return g=>u.format(g)};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(Xt)}}function se([e,n],[t,r]){let i=n-e;return o=>i===0?t:t+(o-e)/i*(r-t)}function ae(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(ht(d));return c}function dt(e,[n,t],r=.2){let i=e===0?0:(t-n)/e,o=i*(1-Math.max(0,Math.min(.9,r)));return{step:i,bandwidth:o,start:s=>n+s*i+(i-o)/2,center:s=>n+(s+.5)*i}}var ht=e=>Number(e.toPrecision(12)),x=e=>Number(e.toFixed(2)),le=e=>typeof e=="number"&&Number.isFinite(e),ut=e=>e.filter(le);function pt(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]}var U=1e3,K=60*U,Y=60*K,oe=24*Y,gn=[U,5*U,15*U,30*U,K,5*K,15*K,30*K,Y,3*Y,6*Y,12*Y,oe,2*oe,7*oe,14*oe];function ft(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(ht(l*10**s));return o.filter(s=>s>=e/1.0001&&s<=n*1.0001)}var Qt=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,Jt=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,en={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function tn(e,n,t){return e.replace(Jt,(r,i,o)=>{let s=en[i];if(s===void 0)return i+o;let a=(o.match(Qt)??[]).map((c,d)=>{let u=Number(c);if(s===-1)return String(u+n);if(s===-2)return String(u+t);let g=d%s;return s===7?g===5?String(u+n):g===6?String(u+t):c:String(g%2===0?u+n:u+t)});return i+a.join(" ")})}var mt=(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:tn(r.d,n,t)}}});var ye=["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)"},ve=(e="neutral")=>e==="neutral"?S.axis:`var(--skdx-color-${e}-500)`,bt=(e="neutral")=>e==="neutral"?S.label:e==="primary"?"var(--skdx-color-text-accent)":`var(--skdx-color-text-${e})`,xt=(e,n)=>n??ye[e%ye.length];var _={top:16,right:16,bottom:32,left:48};function gt(e,n,t=_){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 q(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function yt(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var ce=20,nn=120,vt=e=>{let n=q(e);return n&&(n.position==="left"||n.position==="right")?n.width??nn:0},de=(e,n=600,t=300)=>({width:(e.width??n)-vt(e),height:(e.height??t)-(q(e)?.position==="bottom"?ce:0)}),wt=(e,n,t)=>{let r=q(e);return!r||!(r.position===void 0||r.position==="top")?0:(n?Math.max(1,kt(n,t??de(e).width,r)):1)*ce},P=6.5,ke=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:xt(n)),Me=(e,n)=>e.hiddenSeries?.includes(n)??!1;function we(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,u=r.interactive??!0,g=o,w=i,b=(h,y,v,f)=>{let M=(y?18:4)+h.length*P;g>o&&(s||g+M>n-8)&&(g=o,w+=ce),y&&l.push({kind:"rect",part:"legend-swatch",x:g,y:w-5,width:10,height:10,fill:y,opacity:f?.3:void 0,item:v}),l.push({kind:"text",part:"legend-label",x:g+(y?14:0),y:w,text:h,baseline:"middle",fill:f?S.grid:S.label,item:v}),g+=M+12};for(let h of c){let y=t.includes(h.name),v=u?{label:h.name,series:h.name,legend:!0}:void 0;b(r.formatter?.(h.name)??h.name,h.color,v,y)}return d>0&&b(`+${d} more`,void 0,void 0,!1),r.align==="end"?rn(l,n):l}function rn(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*P)),s=n-8-o;for(let l of i)r.push({...l,x:l.x+s})}return r}var kt=(e,n,t={})=>new Set(we(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function Se(e,n,t,r=[]){let i=q(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,s=yt(e),l=o?.position==="bottom",a=vt(e),c=e.hiddenSeries??[],d=o?a?we(r,1/0,c,o,10,(o.position==="right"?n:0)+8,!0):we(r,n,c,o,l?t+10:10):[],u=l?kt(r,n,o):0;return{width:n+a,height:l?t+Math.max(1,u)*ce: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 Ce(e){let n=e.legendOffset;if(!n)return e;let t=[...mt(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 he(e,n,t,r,i,o="auto"){let s=Array.isArray(t)?t:[t],l=Math.max(...s.map(g=>g.length))*P+12,a=6+s.length*16,c=o==="top"?{x:e-l/2,y:n-a-8}:o==="bottom"?{x:e-l/2,y:n+8}:o==="left"?{x:e-l-8,y:n-a/2}:o==="right"?{x:e+8,y:n-a/2}:{x:e+12,y:n-a-6},d=Math.max(0,Math.min(r-l,c.x)),u=Math.max(0,Math.min(i-a,c.y));return[{kind:"rect",part:"tooltip",x:x(d),y:x(u),width:x(l),height:a,fill:"var(--skdx-color-surface-raised)",stroke:S.axis,rx:3},...s.map((g,w)=>({kind:"text",part:"tooltip-label",x:x(d+6),y:x(u+11+w*16),text:g,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:s.length>1&&w===0?"bold":void 0}))]}function Mt(e,n){let[t,r]=pt(e);return n?[Math.min(0,t),Math.max(0,r)]:[t,r]}function St([e,n],t,r=!1,i){let o=typeof r=="boolean"?{scale:r?"log":"linear"}:r,s=ie(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 h=z=>Math.sign(z)*Math.sqrt(Math.abs(z)),y=o.nice===!1?[l,a]:ae(l,a,o.ticks),v=o.min??y[0],f=o.max??y[y.length-1],M=se([h(v),h(f)],t),I=z=>M(h(z)),L=ae(v,f,o.ticks).filter(z=>z>=v-1e-9&&z<=f+1e-9);return{...c,scale:I,domain:[v,f],format:s,ticks:(L.length>=2?L:[v,f]).map(z=>({pos:x(I(z)),label:s(z)})),zero:x(I(Math.min(Math.max(0,v),f)))}}if(o.scale==="log"){let h=Math.max(l,Number.EPSILON),y=Math.max(a,h),v=ft(h,y),f=[Math.log10(h),Math.log10(y)],M=se(f,t),I=L=>M(Math.log10(Math.max(L,Number.EPSILON)));return{...c,scale:I,domain:f,format:s,ticks:v.map(L=>({pos:x(I(L)),label:s(L)})),zero:x(t[0])}}let d=ae(l,a,o.ticks),u=[o.min??(o.nice===!1?l:d[0]),o.max??(o.nice===!1?a:d[d.length-1])],g=se(u,t),w=d.filter(h=>h>=u[0]-1e-9&&h<=u[1]+1e-9),b=(w.length>=2?w:[u[0],u[1]]).map(h=>({pos:x(g(h)),label:s(h)}));return{...c,scale:g,domain:u,format:s,ticks:b,zero:x(g(Math.min(Math.max(0,u[0]),u[1])))}}var Ct=e=>e?.grid!==!1;function $e(e,n){if(e.length<2)return e;let t=e.reduce((i,o)=>Math.max(i,o.label.length),0)*P+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 $t(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}=de(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:4}),a.push({kind:"text",part:`state-${i}`,x:x(o/2),y:x(s/2),text:l,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":S.label}),{...Se(e,o,s),shapes:a,tooltip:!1}}var It=(e,n,t)=>{let r=n.length*P/2;return e+r>t?"end":e-r<0?"start":"middle"};function Tt(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,h)=>h?{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:s,y1:b.pos,y2:b.pos,stroke:S.grid},u=n.x?.tickRotation??0,g=(b,h,y,v)=>u?A(b,h,y,{part:v,anchor:u<0?"end":"start",baseline:"middle",rotate:u}):A(b,h,y,{part:v,anchor:It(b,y,e.width)}),w=(b,h,y,v,f)=>{for(let M of b)a.push(h==="x"?{kind:"line",part:"tick",x1:M.pos,x2:M.pos,y1:y,y2:x(y+v*f),stroke:S.axis}:{kind:"line",part:"tick",x1:y,x2:x(y+v*f),y1:M.pos,y2:M.pos,stroke:S.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 h of i)a.push(d(h,!0));b[0]?.showLine!==!1&&a.push({kind:"line",part:"axis",x1:o,x2:o,y1:t.y,y2:l,stroke:S.axis});for(let h of b){let y=h.position==="top"||h.position==="right",v=x(y?t.y-h.offset:l+h.offset),f=y||h.offset>0;h.showLine&&f&&a.push({kind:"line",part:"axis",x1:t.x,x2:s,y1:v,y2:v,stroke:S.axis}),h.showTicks&&w(h.ticks,"x",v,y?-1:1,h.tickSize??4);let M=x(y?v-8:v+20);for(let I of h.ticks)a.push(y?A(I.pos,M,I.label,{part:"x-label-top",anchor:It(I.pos,I.label,e.width)}):g(I.pos,M,I.label,"x-label"));h.label&&a.push(f?A(4,M,h.label,{part:"axis-title",anchor:"start",baseline:y?void 0:"middle"}):A(4,t.y-6,h.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:S.axis}),n.x?.showTicks&&w(r,"y",n.rtl?s:t.x,n.rtl?1:-1,n.x.tickSize??4);for(let h of r)a.push(n.rtl?A(s+8,h.pos,h.label,{part:"y-label",anchor:"start",baseline:"middle"}):A(t.x-8,h.pos,h.label,{part:"y-label",anchor:"end",baseline:"middle"}))}else{if(c)for(let h of i)a.push(d(h,!1));n.y?.showLine!==!1&&a.push({kind:"line",part:"axis",x1:t.x,x2:s,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 h of b){let y=h.position==="left",v=y?t.x-h.offset:s+h.offset,f=y?"y-label":"y-label-right";h.showLine&&a.push({kind:"line",part:"axis",x1:x(v),x2:x(v),y1:t.y,y2:l,stroke:S.axis}),h.showTicks&&w(h.ticks,"y",x(v),y?-1:1,h.tickSize??4);for(let M of h.ticks)a.push(A(x(y?v-8:v+8),M.pos,M.label,{part:f,anchor:y?"end":"start",baseline:"middle"}));h.label&&a.push(A(x(y?h.offset===0?4:Math.max(4,v-40):h.offset===0?e.width-4:Math.min(e.width-4,v+40)),t.y-6,h.label,{part:"axis-title",anchor:y?"start":"end"}))}n.x?.showTicks&&w(r,"x",l,1,n.x.tickSize??4);for(let h of r)a.push(g(h.pos,l+(u?12:20),h.label,"x-label"))}return n.xLabel&&a.push(A(x(t.x+t.width/2),e.height-4,n.xLabel,{part:"axis-title",anchor:"middle"})),n.horizontal&&n.rightLabel&&a.push(A(e.width-4,t.y-6,n.rightLabel,{part:"axis-title",anchor:"end"})),a}var A=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:S.label,...r});function Bt(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??ve(a.variant),d=a.color??bt(a.variant),u={part:"reference-label",fill:d},g=n.horizontal===!0;if("y"in a){let w=x(n.y(a.y,a.axis??"left"));if(g){let b=s(w);t.push(...At(b,r.y,o,c,a.label,u))}else{let b=l(w);t.push(...zt(r.x,i,b,c,a.label,u))}}else if("x"in a){let w=n.x(a.x);if(w===void 0)continue;g?t.push(...zt(r.x,i,l(x(w)),c,a.label,u)):t.push(...At(s(x(w)),r.y,o,c,a.label,u))}else if("y1"in a){let w=x(n.y(a.y1,a.axis??"left")),b=x(n.y(a.y2,a.axis??"left"));g?t.push(...Lt(s(Math.min(w,b)),s(Math.max(w,b)),r,c,a.label,d)):t.push(...Ot(l(Math.min(w,b)),l(Math.max(w,b)),r,c,a.label,d))}else{let w=n.x(a.x1),b=n.x(a.x2);if(w===void 0||b===void 0)continue;let h=x(Math.min(w,b)),y=x(Math.max(w,b));g?t.push(...Ot(l(h),l(y),r,c,a.label,d)):t.push(...Lt(s(h),s(y),r,c,a.label,d))}}return t}function zt(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,A(n-4,t-5,i,{...o,anchor:"end"})]:[s]}function At(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,A(e+4,n+10,i,{...o,anchor:"start"})]:[s]}function Ot(e,n,t,r,i,o){let s={kind:"rect",part:"reference-area",x:t.x,y:e,width:t.width,height:x(Math.max(0,n-e)),fill:r,opacity:.12,title:i};return i?[s,A(t.x+t.width-4,e+12,i,{part:"reference-label",fill:o,anchor:"end"})]:[s]}function Lt(e,n,t,r,i,o){let s={kind:"rect",part:"reference-area",x:e,y:t.y,width:x(Math.max(0,n-e)),height:t.height,fill:r,opacity:.12,title:i};return i?[s,A(e+4,t.y+12,i,{part:"reference-label",fill:o,anchor:"start"})]:[s]}function ue(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var Ie=e=>e.id??e.name??e.series,Rt=e=>e.seriesId??e.series;function N(e,n){let t=!1;return n.id!==void 0&&(t=!0,Ie(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,Rt(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 F(e){let n={},t=Ie(e);t!==void 0&&(n.id=t);let r=Rt(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var Te=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function ze(e,n,t){let r=ue(e),i=F(n),o=r.some(s=>N(n,s));return t==="single"?o?[]:[i]:o?r.filter(s=>!N(n,s)):[...r,i]}var on=.2;function sn(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 an=(e,n)=>e.kind==="text"?{...e,fill:S.grid}:{...e,opacity:(e.opacity??1)*n};function Ae(e,n){let t=ue(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:ue(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(u=>N(d,u))?!0:o.highlighted==="series"?r.some(u=>u.series!==void 0&&N(d,{series:u.series})):!1,a=d=>{if(!i||o.faded==="none"||l(d))return!1;if(o.faded==="series"){let u=i.series;return u!==void 0&&N(d,{series:u})}return!0},c=e.shapes.map(d=>{let u=d.item;if(!u||u.legend)return d;if(t.some(g=>N(u,g))){let g=sn(d);g&&s.push(g)}return a(u)?an(d,on):d});return s.length?{...e,shapes:[...c,...s]}:{...e,shapes:c}}function W(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 Oe=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function Pt(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 X(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=Pt(t,n),i=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(i,r)??i}}function Le(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[Pt(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 Be(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!Oe(r.plot,n,t))return[];let i=Le(e,n),{rows:o}=X(e,n),s=e.tooltipAnchored?r.plot.y+8:t;return[i,...he(i.x1,s,o,e.width,e.height,e.tooltipPlacement)]}function Re(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 Be(e,i,t.plot.y+8)}function Pe(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:a,y:c}=W(t,r,i,e.width,e.height);if(Oe(e.hit.plot,a,c)){let d=X(e,a),u=Le(e,a);if(d&&u)return{lines:d.rows,shapes:[u]}}}let o=n?.closest?.("[data-skdx-part]"),s=e.tooltipFormatter?j(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 Nt(e,n,t,r,i,o,s){let l=e?.closest?.("[data-skdx-part]"),a=s&&s.tooltipFormatter?j(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?j(s,e):void 0,u=d?s?.shapes[d.index]:void 0,{x:g,y:w}=u?Q(u):W(n,t,r,i,o);return he(g,w,c,i,o,s?.tooltipPlacement)}function Ne(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:s}=W(t,r,i,e.width,e.height),l=Be(e,o,s);if(l.length>0)return l}return Nt(n,t,r,i,e.width,e.height,e)}function De(e,n){let t=j(e,n);return t&&!t.item.legend?F(t.item):null}var ln=(e,n)=>{let{x:t,y:r}=Q(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 Ge(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!ln(i,n))continue;let o=F(i.item),s=JSON.stringify(o);t.has(s)||(t.add(s),r.push(o))}return r}var Fe=e=>({kind:"rect",part:"selection-box",x:x(e.x),y:x(e.y),width:x(e.width),height:x(e.height),fill:S.focus,opacity:.12,stroke:S.focus}),fe=(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 Dt(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 je(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}=Q(i),l=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:s;if(!Dt(n,o,l))continue;let a=F(i.item),c=JSON.stringify(a);t.has(c)||(t.add(c),r.push(a))}return r}var He=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${x(n.x)} ${x(n.y)}`).join("L")}`:"",fill:S.focus,fillOpacity:.12,stroke:S.focus,dash:"4 3"}),pe=6;function Ve(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-pe||n>i.x1+pe))return Math.abs(n-i.x0)<=pe?{bar:i,mode:"start"}:Math.abs(n-i.x1)<=pe?{bar:i,mode:"end"}:{bar:i,mode:"move"}}}function _e(e,n,t){let r=e.edit;return Gt(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function Ze(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 Gt(r,{bar:o,mode:s},i*l)}function Gt(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 Ee(e,n,t){let r=e.edit,i=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:x(Math.min(i,o)),y:x(n.bar.y),width:x(Math.max(1,Math.abs(o-i))),height:x(n.bar.height),fill:S.focus,opacity:.25,stroke:S.focus,rx:2}}var cn=64,dn=e=>Math.max(1,Math.min(cn,e));function We(e,n,t,r){let i=n>0?.8:1.25,o=dn(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,u=(r-(s.y+s.height/2))/l,g=e.view.zoom/o;return{center:[a+d*(1-g),e.fromY(e.toY(c)-u*(1-g))],zoom:o}}function Ue(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 j(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 me=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function Q(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 Ke(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*P+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}=Q(t),l=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...l?he(x(o),x(s),l,e.width,e.height):[]]}function Ye(e,n,t){let r=me(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 Z=2,E=(e,n,t)=>{let r=Math.max(Z,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},Ft=(e,n)=>!e||e.start<=0&&e.end>=n;function qe(e,n,t){if(e.count<=Z||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,s=n>0?1.25:.8,l=Math.max(Z,Math.min(e.count,Math.round(o*s)));if(l===o)return n>0&&!Ft(e.zoom,e.count)?E(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 E(c-a*l,l,e.count)}function Xe(e,n,t,r){let i=n.end-n.start,o=Math.max(Z,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 E(n.start+s*i-s*o,o,e.count)}function Qe(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return E(n.start-t/i,r,e.count)}function Je(e,n,t){let r=e.brush;if(!r||!Oe(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:E(s-o/2,o,e.count)}}function et(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 E(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-Z,Math.round(t.start+o))),end:t.end};let s=Math.min(e.count,Math.max(t.start+Z,Math.round(t.end+o)));return{start:t.start,end:s}}function nt(e,n){switch(n.type){case"svg":return Promise.resolve(tt(e,n.label,n.resolve));case"csv":return Promise.resolve(_t(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=tt(e,n.label,n.resolve);return Vt(t,e.width,e.height,n.scale,n.background)}}}var D=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;"),J=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${D(String(t))}"`).join("");function jt(e){let n=e.title?`<title>${D(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${J([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${J([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${J([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${J([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${J([t,["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]])}>${D(e.text)}</text>`}}function Ht(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${D(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="${D(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function tt(e,n,t){let r=Ht(e)+e.shapes.map(jt).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="${D(n)}" font-family="${D(S.fontFamily)}" font-size="${D(S.fontSize)}"><title>${D(n)}</title>${r}</svg>`}function Vt(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(u=>u?o(u):s(new Error("toBlob failed")),"image/png")},a.onerror=()=>{URL.revokeObjectURL(l),s(new Error("svg could not be decoded"))},a.src=l})}function _t(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
2
+ `)}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(u=>u.slice(u.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 it=new Map;function be(e){let n=it.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&&it.delete(e)}},publish(o,s){Object.assign(r,o);for(let l of t)l(o,s)}};return it.set(e,{group:i,listeners:t}),i}var Zt='[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}}${Zt}{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){${Zt}{animation:none;transition:none}}`;function st(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}var Et=2e3;function Wt(e,n,t){let r=[],i=[],o=(2*n)**2;for(let s of e){let l=[];for(let c=r.length-1;c>=0&&s-r[c].p<2*n;c--)l.push(r[c]);let a=0;for(let c=0;;c++){if(a=c===0?0:(c%2?1:-1)*Math.ceil(c/2),Math.abs(a)>t){a=Math.sign(a)*t;break}if(l.every(d=>(d.p-s)**2+(d.off-a)**2>=o))break}r.push({p:s,off:a}),i.push(a)}return i}function at(e){let n=[];for(let f of e.series){let M=f.data.filter(I=>I!==null&&!Number.isFinite(I)).length;M&&n.push({code:"invalid-value",severity:"warning",message:`Series "${f.name}" has ${M} value${M===1?"":"s"} that ${M===1?"is":"are"} neither a number nor null; skipped.`,itemId:f.id??f.name})}let t=e.series.map(f=>Me(e,f.name)?[]:ut(f.data)),r=$t(e,t.every(f=>f.length===0));if(r)return{...r,issues:n};let i=ie(e.yAxis?.format??e.format),{width:o,height:s}=de(e),l=e.orientation==="horizontal",a=Math.max(0,...e.series.map(f=>f.name.length))*P,c=gt(o,s,{..._,top:_.top+wt(e)+(!l&&e.yAxis?.label?12:0),left:l?Math.max(_.left,a+16):_.left,bottom:_.bottom+(l&&e.yAxis?.label?14:0)}),d=St(Mt(t.flat(),!1),l?[c.x,c.x+c.width]:[c.y+c.height,c.y],e.yAxis??{},e.format),u=dt(e.series.length,l?[c.y,c.y+c.height]:[c.x,c.x+c.width]),g=Se(e,o,s,e.series.map((f,M)=>({name:f.name,color:ke(e,M,f.color)}))),w=e.series.map((f,M)=>({pos:x(u.center(M)),label:f.name})),b=Tt({...g,plot:c,xTicks:l?w:$e(w,c.width),yTicks:l?$e(d.ticks,c.width):d.ticks,baseline:l?c.x:c.y+c.height},{horizontal:l,grid:Ct(e.yAxis),...l?{xLabel:e.yAxis?.label}:{yLabel:e.yAxis?.label}});b.push(...Bt(e.references,{plot:c,horizontal:l,x:f=>{let M=e.series.findIndex(I=>I.name===f);return M<0?void 0:u.center(M)},y:f=>d.scale(f)}));let h=e.markerSize??3,y=Math.max(0,u.bandwidth/2-h),v=[];return e.series.forEach((f,M)=>{let I=ke(e,M,f.color),L=u.center(M),z=(Me(e,f.name)?[]:f.data).map((O,V)=>({v:O,index:V})).filter(O=>le(O.v)).sort((O,V)=>d.scale(O.v)-d.scale(V.v)),ge=Wt(z.map(O=>d.scale(O.v)),h,y),te=z.length<=Et;z.forEach((O,V)=>{let ne=d.scale(O.v),re=ge[V],lt=`${f.name}: ${i(O.v)}`;v.push({kind:"circle",part:"dot",cx:x(l?ne:L+re),cy:x(l?L+re:ne),r:h,fill:I,title:te?lt:void 0,item:te?{label:lt,id:f.id??f.name,series:f.name,seriesId:f.id??f.name,index:O.index,value:O.v}:void 0})})}),{...g,shapes:[...b,...v,...g.shapes],issues:n}}import{css as hn,html as H,LitElement as un,nothing as T,svg as B}from"lit";import{property as m,state as R}from"lit/decorators.js";import{ifDefined as $}from"lit/directives/if-defined.js";var pn={fromAttribute:()=>!1},k=class extends un{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:s}=this.viewBox(t,r);this.overlay=[Fe(fe(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=[He(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=_e(r,i.gantt,o-i.x),this.overlay=[Ee(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(Ue(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(Xe(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"?Qe(r.hit,i.zoom,o-i.x):et(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:s}=Pe(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=Ne(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(De(r,t.target)),this.syncId&&r.hit?.crosshair){let o=X(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=j(r,t.target)?.item.legend,l=this.canEdit(r)?Ve(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=Je(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(Ge(o,fe(i.x,i.y,s,l))):i.grab==="lasso"?this.setSelected(je(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(We(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=qe(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=j(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=>{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)?Ze(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=Ye(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?F(s):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:s,palette:l,loading:a,error:c,emptyMessage:d,description:u,decorative:g,animated:w,responsive:b,highlighted:h,highlightScope:y,accessibleTable:v}=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:w,responsive:b,legend:i,tooltip:o,format:s,palette:l,loading:a,error:c,emptyMessage:d,description:u,decorative:g,highlighted:h===void 0?this.highlightState:h,highlightScope:y,accessibleTable:v,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&&be(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=be(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&&Te(r,t)||(this.hover=t,this.emit("skdx-highlighted-change",t),this.syncId&&(this.highlightState=t,this.publish({highlighted:t})))}select(t){let r=this.selectionMode;r!=="none"&&this.setSelected(ze(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 W(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&&N(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?nt(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=Ae(Ce(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let v of o.issues??[])this.emit("skdx-data-issue",v)}let s=this.canZoom(o),l=this.canPan(o),a=this.canEdit(o),c=this.brushing(),d=s||l||a||c,u=!o.decorative&&me(o).length>0,g=o.description?`${r}-desc`:void 0,w=st(o),b=rt(o,this.accessibleTable),h=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,y=this.portal;return H`<svg
3
3
  xmlns="http://www.w3.org/2000/svg"
4
4
  viewBox="0 0 ${o.width} ${o.height}"
5
5
  width=${o.width}
@@ -7,11 +7,11 @@ var Et=Object.defineProperty;var Wt=Object.getOwnPropertyDescriptor;var p=(e,n,t
7
7
  role=${o.decorative?"presentation":"img"}
8
8
  aria-hidden=${o.decorative?"true":T}
9
9
  aria-label=${o.decorative?T:i}
10
- aria-describedby=${$(x)}
10
+ aria-describedby=${$(g)}
11
11
  tabindex=${u?0:T}
12
12
  data-skdx-chart=${r}
13
- data-zoomable=${s||c?"":T}
14
- data-brushing=${l&&!(s||c)?"":T}
13
+ data-zoomable=${s||l?"":T}
14
+ data-brushing=${c&&!(s||l)?"":T}
15
15
  data-editable=${a?"":T}
16
16
  style=${w?`--skdx-chart-duration:${w}`:T}
17
17
  font-family=${S.fontFamily}
@@ -21,18 +21,18 @@ var Et=Object.defineProperty;var Wt=Object.getOwnPropertyDescriptor;var p=(e,n,t
21
21
  @pointerdown=${d?this.onPointerDown:T}
22
22
  @pointerup=${d?this.onPointerUp:T}
23
23
  @pointercancel=${d?this.onPointerUp:T}
24
- @wheel=${s||c?this.onWheel:T}
25
- @dblclick=${s||c?()=>c?this.setView(void 0):this.setZoom(void 0):T}
24
+ @wheel=${s||l?this.onWheel:T}
25
+ @dblclick=${s||l?()=>l?this.setView(void 0):this.setZoom(void 0):T}
26
26
  @click=${this.onClick}
27
27
  @keydown=${u?this.onKeyDown:T}
28
28
  @blur=${()=>{this.focused=null,this.highlight(null)}}
29
29
  >
30
30
  <title>${i}</title>
31
- ${o.description?B`<desc id=${$(x)}>${o.description}</desc>`:T}
32
- ${w?B`<style>${ot}</style>`:T} ${pn(o)}
33
- ${be(o.shapes)}
34
- ${be(this.tip.length||!this.crossState?this.tip:Re(o,this.crossState))}
35
- ${be(Ke(o,this.focused))} ${be(this.overlay)}
31
+ ${o.description?B`<desc id=${$(g)}>${o.description}</desc>`:T}
32
+ ${w?B`<style>${ot}</style>`:T} ${fn(o)}
33
+ ${xe(o.shapes)}
34
+ ${xe(this.tip.length||!this.crossState?this.tip:Re(o,this.crossState))}
35
+ ${xe(Ke(o,this.focused))} ${xe(this.overlay)}
36
36
  </svg>
37
37
  ${y?H`<div
38
38
  role="tooltip"
@@ -41,21 +41,21 @@ var Et=Object.defineProperty;var Wt=Object.getOwnPropertyDescriptor;var p=(e,n,t
41
41
  >
42
42
  ${y.lines.map(v=>H`<div>${v}</div>`)}
43
43
  </div>`:T}
44
- ${g?H`<table data-skdx-table=${r}>
44
+ ${b?H`<table data-skdx-table=${r}>
45
45
  <caption>
46
46
  ${h}
47
47
  </caption>
48
48
  <thead>
49
49
  <tr>
50
- ${(g[0]??[]).map(v=>H`<th scope="col">${v}</th>`)}
50
+ ${(b[0]??[]).map(v=>H`<th scope="col">${v}</th>`)}
51
51
  </tr>
52
52
  </thead>
53
53
  <tbody>
54
- ${g.slice(1).map(v=>H`<tr>
54
+ ${b.slice(1).map(v=>H`<tr>
55
55
  ${v.map((f,M)=>M===0?H`<th scope="row">${f}</th>`:H`<td>${f}</td>`)}
56
56
  </tr>`)}
57
57
  </tbody>
58
- </table>`:T}`}};k.styles=dn`
58
+ </table>`:T}`}};k.styles=hn`
59
59
  :host {
60
60
  display: inline-block;
61
61
  }
@@ -106,4 +106,4 @@ var Et=Object.defineProperty;var Wt=Object.getOwnPropertyDescriptor;var p=(e,n,t
106
106
  [role='tooltip'] > :first-child:not(:only-child) {
107
107
  font-weight: bold;
108
108
  }
109
- `,p([m({type:Number})],k.prototype,"width",2),p([m({type:Number})],k.prototype,"height",2),p([m()],k.prototype,"label",2),p([m({type:Boolean,reflect:!0})],k.prototype,"legend",2),p([m({type:Boolean,attribute:"no-tooltip",converter:un})],k.prototype,"tooltip",2),p([m({attribute:!1})],k.prototype,"format",2),p([m({attribute:!1})],k.prototype,"palette",2),p([m({attribute:!1})],k.prototype,"hiddenSeries",2),p([m({attribute:!1})],k.prototype,"selected",2),p([m({attribute:"selection-mode"})],k.prototype,"selectionMode",2),p([m({attribute:!1})],k.prototype,"highlighted",2),p([m({attribute:!1})],k.prototype,"highlightScope",2),p([m({type:Boolean,reflect:!0})],k.prototype,"loading",2),p([m()],k.prototype,"error",2),p([m({attribute:"empty-message"})],k.prototype,"emptyMessage",2),p([m()],k.prototype,"description",2),p([m({type:Boolean,reflect:!0})],k.prototype,"decorative",2),p([m({type:Boolean,attribute:"accessible-table"})],k.prototype,"accessibleTable",2),p([m({attribute:!1})],k.prototype,"zoom",2),p([m({attribute:!1})],k.prototype,"view",2),p([m({type:Boolean,reflect:!0})],k.prototype,"zoomable",2),p([m({type:Boolean,reflect:!0})],k.prototype,"editable",2),p([m({attribute:"sync-id"})],k.prototype,"syncId",2),p([m({type:Boolean,attribute:"cross-filter"})],k.prototype,"crossFilter",2),p([m({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],k.prototype,"animated",2),p([m({type:Boolean,reflect:!0})],k.prototype,"responsive",2),p([R()],k.prototype,"tip",2),p([R()],k.prototype,"overlay",2),p([R()],k.prototype,"portal",2),p([R()],k.prototype,"measured",2),p([R()],k.prototype,"viewState",2),p([R()],k.prototype,"highlightState",2),p([R()],k.prototype,"crossState",2),p([R()],k.prototype,"focused",2),p([R()],k.prototype,"hiddenState",2),p([R()],k.prototype,"zoomState",2),p([R()],k.prototype,"selectedState",2);var C=class extends k{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:c,annotations:a,labels:l,curve:d,connectNulls:u,nulls:x,stacked:w,stackOffset:g,orientation:h,radius:y,barGap:v,barWidth:f,sort:M,transform:I,transforms:L,bins:z,binWidth:xe,binDomain:te,binMode:O,sampling:V,brush:ne,crosshair:re}=this;return{...this.sized(),series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:c,annotations:a,labels:l,curve:d,connectNulls:u,nulls:x,stacked:w,stackOffset:g,orientation:h,radius:y,barGap:v,barWidth:f,sort:M,transform:I,transforms:L,bins:z,binWidth:xe,binDomain:te,binMode:O,sampling:V,brush:ne,crosshair:re}}};p([m({attribute:!1})],C.prototype,"series",2),p([m({attribute:!1})],C.prototype,"categories",2),p([m({attribute:!1})],C.prototype,"xAxis",2),p([m({attribute:!1})],C.prototype,"yAxis",2),p([m({attribute:!1})],C.prototype,"rightAxis",2),p([m({attribute:!1})],C.prototype,"references",2),p([m({attribute:!1})],C.prototype,"annotations",2),p([m({type:Boolean,reflect:!0})],C.prototype,"labels",2),p([m()],C.prototype,"curve",2),p([m({type:Boolean,attribute:"connect-nulls"})],C.prototype,"connectNulls",2),p([m()],C.prototype,"nulls",2),p([m({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],C.prototype,"stacked",2),p([m({attribute:"stack-offset"})],C.prototype,"stackOffset",2),p([m()],C.prototype,"orientation",2),p([m({type:Number})],C.prototype,"radius",2),p([m({type:Number,attribute:"bar-gap"})],C.prototype,"barGap",2),p([m({type:Number,attribute:"bar-width"})],C.prototype,"barWidth",2),p([m()],C.prototype,"sort",2),p([m()],C.prototype,"transform",2),p([m({attribute:!1})],C.prototype,"transforms",2),p([m({type:Number})],C.prototype,"bins",2),p([m({type:Number,attribute:"bin-width"})],C.prototype,"binWidth",2),p([m({attribute:!1})],C.prototype,"binDomain",2),p([m({attribute:"bin-mode"})],C.prototype,"binMode",2),p([m({attribute:!1})],C.prototype,"sampling",2),p([m({type:Boolean,reflect:!0})],C.prototype,"brush",2),p([m({type:Boolean,reflect:!0})],C.prototype,"crosshair",2);var pn=e=>e.defs&&e.defs.length?B`<defs>${e.defs.map(n=>B`<linearGradient id=${n.id} x1="0" y1="0" x2=${n.vertical===!1?1:0} y2=${n.vertical===!1?0:1}>${n.stops.map(t=>B`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${$(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:T,be=e=>B`${e.map((n,t)=>{let r=n.title?B`<title>${n.title}</title>`:T,i=n.item?t:void 0;switch(n.kind){case"path":return B`<path data-skdx-part=${n.part} data-skdx-i=${$(i)} d=${n.d} fill=${n.fill??"none"} stroke=${$(n.stroke)} stroke-width=${$(n.strokeWidth)} stroke-linecap=${$(n.strokeLinecap)} stroke-linejoin=${$(n.strokeLinejoin)} stroke-dasharray=${$(n.dash)} opacity=${$(n.opacity)} fill-opacity=${$(n.fillOpacity)}>${r}</path>`;case"rect":return B`<rect data-skdx-part=${n.part} data-skdx-i=${$(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${$(n.rx)} fill=${n.fill} stroke=${$(n.stroke)} fill-opacity=${$(n.opacity)}>${r}</rect>`;case"line":return B`<line data-skdx-part=${n.part} data-skdx-i=${$(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${$(n.strokeWidth)} stroke-dasharray=${$(n.dash)} opacity=${$(n.opacity)}>${r}</line>`;case"circle":return B`<circle data-skdx-part=${n.part} data-skdx-i=${$(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${$(n.stroke)} opacity=${$(n.opacity)}>${r}</circle>`;case"text":return B`<text data-skdx-part=${n.part} data-skdx-i=${$(i)} x=${n.x} y=${n.y} text-anchor=${$(n.anchor)} dominant-baseline=${$(n.baseline)} fill=${$(n.fill)} font-weight=${$(n.weight)} pointer-events=${$(i===void 0?"none":void 0)} transform=${$(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var D=class extends k{constructor(){super(...arguments);this.series=[]}render(){let{series:t,orientation:r,markerSize:i,yAxis:o,references:s}=this;return this.root(at({...this.sized(),series:t,orientation:r,markerSize:i,yAxis:o,references:s}),"swarm",this.label??"Swarm plot")}};p([ee({attribute:!1})],D.prototype,"series",2),p([ee()],D.prototype,"orientation",2),p([ee({type:Number,attribute:"marker-size"})],D.prototype,"markerSize",2),p([ee({attribute:!1})],D.prototype,"yAxis",2),p([ee({attribute:!1})],D.prototype,"references",2),D=p([fn("skdx-swarm-plot")],D);export{D as SkdxSwarmPlot};
109
+ `,p([m({type:Number})],k.prototype,"width",2),p([m({type:Number})],k.prototype,"height",2),p([m()],k.prototype,"label",2),p([m({type:Boolean,reflect:!0})],k.prototype,"legend",2),p([m({type:Boolean,attribute:"no-tooltip",converter:pn})],k.prototype,"tooltip",2),p([m({attribute:!1})],k.prototype,"format",2),p([m({attribute:!1})],k.prototype,"palette",2),p([m({attribute:!1})],k.prototype,"hiddenSeries",2),p([m({attribute:!1})],k.prototype,"selected",2),p([m({attribute:"selection-mode"})],k.prototype,"selectionMode",2),p([m({attribute:!1})],k.prototype,"highlighted",2),p([m({attribute:!1})],k.prototype,"highlightScope",2),p([m({type:Boolean,reflect:!0})],k.prototype,"loading",2),p([m()],k.prototype,"error",2),p([m({attribute:"empty-message"})],k.prototype,"emptyMessage",2),p([m()],k.prototype,"description",2),p([m({type:Boolean,reflect:!0})],k.prototype,"decorative",2),p([m({type:Boolean,attribute:"accessible-table"})],k.prototype,"accessibleTable",2),p([m({attribute:!1})],k.prototype,"zoom",2),p([m({attribute:!1})],k.prototype,"view",2),p([m({type:Boolean,reflect:!0})],k.prototype,"zoomable",2),p([m({type:Boolean,reflect:!0})],k.prototype,"editable",2),p([m({attribute:"sync-id"})],k.prototype,"syncId",2),p([m({type:Boolean,attribute:"cross-filter"})],k.prototype,"crossFilter",2),p([m({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],k.prototype,"animated",2),p([m({type:Boolean,reflect:!0})],k.prototype,"responsive",2),p([R()],k.prototype,"tip",2),p([R()],k.prototype,"overlay",2),p([R()],k.prototype,"portal",2),p([R()],k.prototype,"measured",2),p([R()],k.prototype,"viewState",2),p([R()],k.prototype,"highlightState",2),p([R()],k.prototype,"crossState",2),p([R()],k.prototype,"focused",2),p([R()],k.prototype,"hiddenState",2),p([R()],k.prototype,"zoomState",2),p([R()],k.prototype,"selectedState",2);var C=class extends k{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:u,nulls:g,stacked:w,stackOffset:b,orientation:h,radius:y,barGap:v,barWidth:f,sort:M,transform:I,transforms:L,bins:z,binWidth:ge,binDomain:te,binMode:O,sampling:V,brush:ne,crosshair:re}=this;return{...this.sized(),series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:l,annotations:a,labels:c,curve:d,connectNulls:u,nulls:g,stacked:w,stackOffset:b,orientation:h,radius:y,barGap:v,barWidth:f,sort:M,transform:I,transforms:L,bins:z,binWidth:ge,binDomain:te,binMode:O,sampling:V,brush:ne,crosshair:re}}};p([m({attribute:!1})],C.prototype,"series",2),p([m({attribute:!1})],C.prototype,"categories",2),p([m({attribute:!1})],C.prototype,"xAxis",2),p([m({attribute:!1})],C.prototype,"yAxis",2),p([m({attribute:!1})],C.prototype,"rightAxis",2),p([m({attribute:!1})],C.prototype,"references",2),p([m({attribute:!1})],C.prototype,"annotations",2),p([m({type:Boolean,reflect:!0})],C.prototype,"labels",2),p([m()],C.prototype,"curve",2),p([m({type:Boolean,attribute:"connect-nulls"})],C.prototype,"connectNulls",2),p([m()],C.prototype,"nulls",2),p([m({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],C.prototype,"stacked",2),p([m({attribute:"stack-offset"})],C.prototype,"stackOffset",2),p([m()],C.prototype,"orientation",2),p([m({type:Number})],C.prototype,"radius",2),p([m({type:Number,attribute:"bar-gap"})],C.prototype,"barGap",2),p([m({type:Number,attribute:"bar-width"})],C.prototype,"barWidth",2),p([m()],C.prototype,"sort",2),p([m()],C.prototype,"transform",2),p([m({attribute:!1})],C.prototype,"transforms",2),p([m({type:Number})],C.prototype,"bins",2),p([m({type:Number,attribute:"bin-width"})],C.prototype,"binWidth",2),p([m({attribute:!1})],C.prototype,"binDomain",2),p([m({attribute:"bin-mode"})],C.prototype,"binMode",2),p([m({attribute:!1})],C.prototype,"sampling",2),p([m({type:Boolean,reflect:!0})],C.prototype,"brush",2),p([m({type:Boolean,reflect:!0})],C.prototype,"crosshair",2);var fn=e=>e.defs&&e.defs.length?B`<defs>${e.defs.map(n=>B`<linearGradient id=${n.id} x1="0" y1="0" x2=${n.vertical===!1?1:0} y2=${n.vertical===!1?0:1}>${n.stops.map(t=>B`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${$(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:T,xe=e=>B`${e.map((n,t)=>{let r=n.title?B`<title>${n.title}</title>`:T,i=n.item?t:void 0;switch(n.kind){case"path":return B`<path data-skdx-part=${n.part} data-skdx-i=${$(i)} d=${n.d} fill=${n.fill??"none"} stroke=${$(n.stroke)} stroke-width=${$(n.strokeWidth)} stroke-linecap=${$(n.strokeLinecap)} stroke-linejoin=${$(n.strokeLinejoin)} stroke-dasharray=${$(n.dash)} opacity=${$(n.opacity)} fill-opacity=${$(n.fillOpacity)}>${r}</path>`;case"rect":return B`<rect data-skdx-part=${n.part} data-skdx-i=${$(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${$(n.rx)} fill=${n.fill} stroke=${$(n.stroke)} fill-opacity=${$(n.opacity)}>${r}</rect>`;case"line":return B`<line data-skdx-part=${n.part} data-skdx-i=${$(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${$(n.strokeWidth)} stroke-dasharray=${$(n.dash)} opacity=${$(n.opacity)}>${r}</line>`;case"circle":return B`<circle data-skdx-part=${n.part} data-skdx-i=${$(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${$(n.stroke)} opacity=${$(n.opacity)}>${r}</circle>`;case"text":return B`<text data-skdx-part=${n.part} data-skdx-i=${$(i)} x=${n.x} y=${n.y} text-anchor=${$(n.anchor)} dominant-baseline=${$(n.baseline)} fill=${$(n.fill)} font-weight=${$(n.weight)} pointer-events=${$(i===void 0?"none":void 0)} transform=${$(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var G=class extends k{constructor(){super(...arguments);this.series=[]}render(){let{series:t,orientation:r,markerSize:i,yAxis:o,references:s}=this;return this.root(at({...this.sized(),series:t,orientation:r,markerSize:i,yAxis:o,references:s}),"swarm",this.label??"Swarm plot")}};p([ee({attribute:!1})],G.prototype,"series",2),p([ee()],G.prototype,"orientation",2),p([ee({type:Number,attribute:"marker-size"})],G.prototype,"markerSize",2),p([ee({attribute:!1})],G.prototype,"yAxis",2),p([ee({attribute:!1})],G.prototype,"references",2),G=p([mn("skdx-swarm-plot")],G);export{G as SkdxSwarmPlot};
package/dist/timeline.cjs CHANGED
@@ -1,5 +1,5 @@
1
- "use strict";var ce=Object.defineProperty;var xt=Object.getOwnPropertyDescriptor;var Gt=Object.getOwnPropertyNames;var jt=Object.prototype.hasOwnProperty;var Ht=(e,n)=>{for(var t in n)ce(e,t,{get:n[t],enumerable:!0})},_t=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of Gt(n))!jt.call(e,i)&&i!==t&&ce(e,i,{get:()=>n[i],enumerable:!(r=xt(n,i))||r.enumerable});return e};var Vt=e=>_t(ce({},"__esModule",{value:!0}),e),u=(e,n,t,r)=>{for(var i=r>1?void 0:r?xt(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&&ce(n,t,i),i};var un={};Ht(un,{SkdxTimelineChart:()=>D});module.exports=Vt(un);var V=require("lit/decorators.js");var gt=e=>Number(e.toPrecision(12)),Zt,bt=e=>(Zt??(Zt=new Intl.NumberFormat)).format(gt(e)),Et=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 Wt(e){if(e===void 0)return bt;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:i="",timeZone:o}=e,s=c=>i?h=>c(h)+i:c,a=c=>r===void 0?c===void 0?{}:{maximumFractionDigits:c}:{minimumFractionDigits:r,maximumFractionDigits:r},l=c=>{let h=new Intl.NumberFormat(t,c);return s(g=>h.format(gt(g)))},d=c=>{let h=new Intl.DateTimeFormat(t,o?{...c,timeZone:o}:c);return g=>h.format(g)};switch(n){case"integer":return l({maximumFractionDigits:0});case"decimal":return l(a(2));case"percent":return l({style:"percent",...a(0)});case"currency":return l({style:"currency",currency:e.currency??"USD",...a()});case"compact":return l({notation:"compact",...a(1)});case"scientific":return l({notation:"scientific",...a(2)});case"date":return d({dateStyle:"medium"});case"time":return d({timeStyle:"short"});case"datetime":return d({dateStyle:"medium",timeStyle:"short"});case"duration":return s(Et)}}function yt(e,n){if(typeof e=="string")return e;let t=e instanceof Date?e.getTime():e;return n?Wt(n)(t):e instanceof Date?new Intl.DateTimeFormat().format(e):bt(t)}function ve([e,n],[t,r]){let i=n-e;return o=>i===0?t:t+(o-e)/i*(r-t)}function we(e,[n,t],r=.2){let i=e===0?0:(t-n)/e,o=i*(1-Math.max(0,Math.min(.9,r)));return{step:i,bandwidth:o,start:s=>n+s*i+(i-o)/2,center:s=>n+(s+.5)*i}}var b=e=>Number(e.toFixed(2)),Ut=e=>typeof e=="number"&&Number.isFinite(e);function ke(e){let n=1/0,t=-1/0;for(let r of e)Ut(r)&&(r<n&&(n=r),r>t&&(t=r));return n===1/0?[0,0]:[n,t]}var q=1e3,X=60*q,Q=60*X,J=24*Q,Kt=[q,5*q,15*q,30*q,X,5*X,15*X,30*X,Q,3*Q,6*Q,12*Q,J,2*J,7*J,14*J];function vt(e,n,t=6){if(!(n>e))return[e];let r=n-e,i=Kt.find(h=>r/h<=t),o=[];if(i!==void 0){for(let h=Math.ceil(e/i)*i;h<=n;h+=i)o.push(h);return o.length?o:[e,n]}let s=r/(30*J),a=[1,2,3,6,12,24,60,120].find(h=>s/h<=t)??240,l=new Date(e),d=l.getUTCFullYear(),c=Math.ceil((l.getUTCMonth()+(l.getUTCDate()>1?1:0))/a)*a;for(let h=Date.UTC(d,c,1);h<=n;)o.push(h),c+=a,c>=12&&(d+=Math.floor(c/12),c%=12),h=Date.UTC(d,c,1);return o.length?o:[e,n]}var Yt=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,qt=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,Xt={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function Qt(e,n,t){return e.replace(qt,(r,i,o)=>{let s=Xt[i];if(s===void 0)return i+o;let l=(o.match(Yt)??[]).map((d,c)=>{let h=Number(d);if(s===-1)return String(h+n);if(s===-2)return String(h+t);let g=c%s;return s===7?g===5?String(h+n):g===6?String(h+t):d:String(g%2===0?h+n:h+t)});return i+l.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:Qt(r.d,n,t)}}});var Me=["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)"))),y={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)"},Se=(e="neutral")=>e==="neutral"?y.axis:`var(--skdx-color-${e}-500)`;var kt=(e,n)=>n??Me[e%Me.length];var Jt={top:16,right:16,bottom:32,left:48};function $e(e,n,t=Jt){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 ee(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function Mt(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var de=20,en=120,St=e=>{let n=ee(e);return n&&(n.position==="left"||n.position==="right")?n.width??en:0},Ie=(e,n=600,t=300)=>({width:(e.width??n)-St(e),height:(e.height??t)-(ee(e)?.position==="bottom"?de:0)}),Te=e=>{let n=ee(e);return n&&(n.position===void 0||n.position==="top")?de:0},P=6.5,Oe=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:kt(n)),Ct=(e,n)=>e.hiddenSeries?.includes(n)??!1;function Ce(e,n,t=[],r={},i=10,o=8,s=!1){let a=[],l=r.maxItems,d=l!==void 0&&l>=0&&e.length>l?e.slice(0,l):e,c=e.length-d.length,h=r.interactive??!0,g=o,$=i,M=(O,S,I,T)=>{let F=(S?18:4)+O.length*P;g>o&&(s||g+F>n-8)&&(g=o,$+=de),S&&a.push({kind:"rect",part:"legend-swatch",x:g,y:$-5,width:10,height:10,fill:S,opacity:T?.3:void 0,item:I}),a.push({kind:"text",part:"legend-label",x:g+(S?14:0),y:$,text:O,baseline:"middle",fill:T?y.grid:y.label,item:I}),g+=F+12};for(let O of d){let S=t.includes(O.name),I=h?{label:O.name,series:O.name,legend:!0}:void 0;M(r.formatter?.(O.name)??O.name,O.color,I,S)}return c>0&&M(`+${c} more`,void 0,void 0,!1),r.align==="end"?tn(a,n):a}function tn(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(a=>a.kind==="rect"?a.x+a.width:a.x+a.text.length*P)),s=n-8-o;for(let a of i)r.push({...a,x:a.x+s})}return r}var nn=(e,n,t={})=>new Set(Ce(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function ze(e,n,t,r=[]){let i=ee(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,s=Mt(e),a=o?.position==="bottom",l=St(e),d=e.hiddenSeries??[],c=o?l?Ce(r,1/0,d,o,10,(o.position==="right"?n:0)+8,!0):Ce(r,n,d,o,a?t+10:10):[],h=a?nn(r,n,o):0;return{width:n+l,height:a?t+Math.max(1,h)*de:t,legendOffset:o?.position==="left"?l: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:c}}function Ae(e){let n=e.legendOffset;if(!n)return e;let t=[...wt(e.shapes.filter(l=>!l.part.startsWith("legend-")),n,0),...e.shapes.filter(l=>l.part.startsWith("legend-"))],r=l=>({...l,x:l.x+n}),i=e.hit?{...e.hit,plot:r(e.hit.plot),xs:e.hit.xs.map(l=>l+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:l=>o.scale(l)+n,invert:l=>o.invert(l-n),bars:o.bars.map(l=>({...l,x0:l.x0+n,x1:l.x1+n}))}:void 0,a=e.map?{...e.map,plot:r(e.map.plot)}:void 0;return{...e,shapes:t,hit:i,edit:s,map:a,legendOffset:void 0}}function ue(e,n,t,r,i,o="auto"){let s=Array.isArray(t)?t:[t],a=Math.max(...s.map(g=>g.length))*P+12,l=6+s.length*16,d=o==="top"?{x:e-a/2,y:n-l-8}:o==="bottom"?{x:e-a/2,y:n+8}:o==="left"?{x:e-a-8,y:n-l/2}:o==="right"?{x:e+8,y:n-l/2}:{x:e+12,y:n-l-6},c=Math.max(0,Math.min(r-a,d.x)),h=Math.max(0,Math.min(i-l,d.y));return[{kind:"rect",part:"tooltip",x:b(c),y:b(h),width:b(a),height:l,fill:"var(--skdx-color-surface-raised)",stroke:y.axis,rx:3},...s.map((g,$)=>({kind:"text",part:"tooltip-label",x:b(c+6),y:b(h+11+$*16),text:g,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:s.length>1&&$===0?"bold":void 0}))]}function $t(e,n){if(e.length<2)return e;let t=e.reduce((i,o)=>Math.max(i,o.label.length),0)*P+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 It(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}=Ie(e,t,r),a=i==="error"?e.error:i==="loading"?"Loading\u2026":e.emptyMessage??"No data available",l=[];return i==="loading"&&l.push({kind:"rect",part:"skeleton",x:0,y:0,width:o,height:s,fill:"var(--skdx-color-surface-sunken)",rx:4}),l.push({kind:"text",part:`state-${i}`,x:b(o/2),y:b(s/2),text:a,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":y.label}),{...ze(e,o,s),shapes:l,tooltip:!1}}var j=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:y.label,...r});function he(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var Le=e=>e.id??e.name??e.series,Tt=e=>e.seriesId??e.series;function R(e,n){let t=!1;return n.id!==void 0&&(t=!0,Le(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,Tt(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 H(e){let n={},t=Le(e);t!==void 0&&(n.id=t);let r=Tt(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var Pe=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function Be(e,n,t){let r=he(e),i=H(n),o=r.some(s=>R(n,s));return t==="single"?o?[]:[i]:o?r.filter(s=>!R(n,s)):[...r,i]}var rn=.2;function on(e){let n=y.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 sn=(e,n)=>e.kind==="text"?{...e,fill:y.grid}:{...e,opacity:(e.opacity??1)*n};function Re(e,n){let t=he(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:he(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=[],a=c=>!i||r.some(h=>R(c,h))?!0:o.highlighted==="series"?r.some(h=>h.series!==void 0&&R(c,{series:h.series})):!1,l=c=>{if(!i||o.faded==="none"||a(c))return!1;if(o.faded==="series"){let h=i.series;return h!==void 0&&R(c,{series:h})}return!0},d=e.shapes.map(c=>{let h=c.item;if(!h||h.legend)return c;if(t.some(g=>R(h,g))){let g=on(c);g&&s.push(g)}return l(h)?sn(c,rn):c});return s.length?{...e,shapes:[...d,...s]}:{...e,shapes:d}}var Ne=14;function De(e){let n=[],t=e.events.map((p,v)=>({event:p,index:v,time:new Date(p.date).getTime()})).filter(p=>Number.isFinite(p.time)?!(p.event.group!==void 0&&Ct(e,p.event.group)):(n.push({code:"invalid-value",severity:"warning",message:`Event "${p.event.label}" has an unparseable date and was dropped.`,itemId:p.event.id??p.event.label}),!1)).sort((p,v)=>p.time-v.time||p.index-v.index),r=It(e,t.length===0);if(r)return{...r,issues:n};let{width:i,height:o}=Ie(e),s=e.orientation==="vertical",a=[...new Set(e.events.map(p=>p.group).filter(p=>p!==void 0))],l=a.length?a:[""],[d,c]=ke(t.map(p=>p.time)),h=e.xAxis?.format??{style:c-d<2*864e5?"time":"date"},g=p=>yt(p,h),$=e.labels??!0,M=t.map(p=>{let v=p.event.group,A=p.event.color??(p.event.variant?Se(p.event.variant):Oe(e,v===void 0?0:a.indexOf(v))),B=p.event.description?` \u2014 ${p.event.description}`:"";return{...p,lane:v===void 0?0:a.indexOf(v),color:A,text:`${p.event.label} \xB7 ${g(p.time)}${B}`}}),O=a.map((p,v)=>({name:p,color:Oe(e,v)})),S=ze(e,i,o,O),I=p=>({label:p.text,id:p.event.id,name:p.event.label,category:p.event.group,index:p.index,value:p.time}),T=[];if(s){let p=Math.max(...M.map(L=>g(L.time).length))*P+16,v=$e(i,o,{top:8+Te(e),right:8,bottom:8,left:p+12}),A=we(M.length,[v.y,v.y+v.height],0),B=b(v.x);return T.push({kind:"line",part:"axis",x1:B,x2:B,y1:v.y,y2:v.y+v.height,stroke:y.axis}),M.forEach((L,ae)=>{let z=b(A.center(ae));if(T.push(j(b(v.x-12),z,g(L.time),{part:"x-label",anchor:"end",baseline:"middle"}),{kind:"circle",part:"event",cx:B,cy:z,r:5,fill:L.color,stroke:"var(--skdx-color-surface-default)",title:L.text,item:I(L)}),$){let Y=L.event.description,le=A.step>=2*Ne&&Y;T.push(j(b(v.x+12),le?b(z-7):z,L.event.label,{part:"event-label",baseline:"middle",fill:"var(--skdx-color-text-default)"})),le&&T.push(j(b(v.x+12),b(z+7),Y,{part:"event-description",baseline:"middle"}))}}),{...S,shapes:[...T,...S.shapes],issues:n}}let F=a.length?Math.max(...a.map(p=>p.length))*P+16:8,ie=Math.max(g(d).length,g(c).length)*P/2+4,C=$e(i,o,{top:8+Te(e),right:Math.max(16,ie),bottom:32+(e.xAxis?.label?14:0),left:Math.max(16,F,ie)}),G=(c-d)*.04||36e5,oe=ve([d-G,c+G],[C.x,C.x+C.width]),be=vt(d-G,c+G).filter(p=>p>=d-G&&p<=c+G).map(p=>({pos:b(oe(p)),label:g(p)}));for(let p of $t(be,C.width))T.push({kind:"line",part:"grid",x1:p.pos,x2:p.pos,y1:C.y,y2:C.y+C.height,stroke:y.grid},j(p.pos,C.y+C.height+20,p.label,{part:"x-label",anchor:"middle"}));e.xAxis?.label&&T.push(j(b(C.x+C.width/2),o-4,e.xAxis.label,{part:"axis-title",anchor:"middle"}));let U=we(l.length,[C.y,C.y+C.height],0),se=Math.max(0,Math.floor((U.step/2-14)/Ne));l.forEach((p,v)=>{let A=b(U.center(v));T.push({kind:"line",part:"axis",x1:C.x,x2:C.x+C.width,y1:A,y2:A,stroke:y.axis}),p&&T.push(j(C.x-8,A,p,{part:"y-label",anchor:"end",baseline:"middle"}))});let ye=l.map(()=>[]),K=[],mt=[];for(let p of M){let v=b(oe(p.time)),A=b(U.center(p.lane));if(mt.push({kind:"circle",part:"event",cx:v,cy:A,r:5,fill:p.color,stroke:"var(--skdx-color-surface-default)",title:p.text,item:I(p)}),!$)continue;let B=p.event.label.length*P,L=v-B/2,ae=ye[p.lane],z=0;for(;z<=se&&(ae[z]??-1/0)>L-6;)z++;if(z>se)continue;ae[z]=L+B;let Y=b(A-12-z*Ne),le=b(Math.max(B/2+2,Math.min(i-B/2-2,v)));z>0&&K.push({kind:"line",part:"connector",x1:v,x2:v,y1:b(A-6),y2:b(Y+4),stroke:y.grid}),K.push(j(le,Y,p.event.label,{part:"event-label",anchor:"middle",fill:"var(--skdx-color-text-default)"}))}return{...S,shapes:[...T,...K,...mt,...S.shapes],issues:n}}function W(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 Fe=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function Ot(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 te(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=Ot(t,n),i=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(i,r)??i}}function Ge(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[Ot(t,n)];return{kind:"line",part:"crosshair",x1:r,x2:r,y1:t.plot.y,y2:t.plot.y+t.plot.height,stroke:y.axis,dash:"3 3"}}function je(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!Fe(r.plot,n,t))return[];let i=Ge(e,n),{rows:o}=te(e,n),s=e.tooltipAnchored?r.plot.y+8:t;return[i,...ue(i.x1,s,o,e.width,e.height,e.tooltipPlacement)]}function He(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 je(e,i,t.plot.y+8)}function _e(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:l,y:d}=W(t,r,i,e.width,e.height);if(Fe(e.hit.plot,l,d)){let c=te(e,l),h=Ge(e,l);if(c&&h)return{lines:c.rows,shapes:[h]}}}let o=n?.closest?.("[data-skdx-part]"),s=e.tooltipFormatter?_(e,n)?.item:void 0,a=s&&e.tooltipFormatter?.(s)||o&&Array.from(o.children).find(l=>l.tagName.toLowerCase()==="title")?.textContent;return a?{lines:Array.isArray(a)?a:[a],shapes:[]}:{lines:[],shapes:[]}}function zt(e,n,t,r,i,o,s){let a=e?.closest?.("[data-skdx-part]"),l=s&&s.tooltipFormatter?_(s,e)?.item:void 0,d=l&&s?.tooltipFormatter?.(l)||a&&Array.from(a.children).find(M=>M.tagName.toLowerCase()==="title")?.textContent;if(!d)return[];let c=s?.tooltipAnchored?_(s,e):void 0,h=c?s?.shapes[c.index]:void 0,{x:g,y:$}=h?ne(h):W(n,t,r,i,o);return ue(g,$,d,i,o,s?.tooltipPlacement)}function Ve(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:s}=W(t,r,i,e.width,e.height),a=je(e,o,s);if(a.length>0)return a}return zt(n,t,r,i,e.width,e.height,e)}function Ze(e,n){let t=_(e,n);return t&&!t.item.legend?H(t.item):null}var an=(e,n)=>{let{x:t,y:r}=ne(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 Ee(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!an(i,n))continue;let o=H(i.item),s=JSON.stringify(o);t.has(s)||(t.add(s),r.push(o))}return r}var We=e=>({kind:"rect",part:"selection-box",x:b(e.x),y:b(e.y),width:b(e.width),height:b(e.height),fill:y.focus,opacity:.12,stroke:y.focus}),fe=(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 At(e,n,t){let r=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){let s=e[i],a=e[o];s.y>t!=a.y>t&&n<(a.x-s.x)*(t-s.y)/(a.y-s.y)+s.x&&(r=!r)}return r}function Ue(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}=ne(i),a=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:s;if(!At(n,o,a))continue;let l=H(i.item),d=JSON.stringify(l);t.has(d)||(t.add(d),r.push(l))}return r}var Ke=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${b(n.x)} ${b(n.y)}`).join("L")}`:"",fill:y.focus,fillOpacity:.12,stroke:y.focus,dash:"4 3"}),pe=6;function Ye(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-pe||n>i.x1+pe))return Math.abs(n-i.x0)<=pe?{bar:i,mode:"start"}:Math.abs(n-i.x1)<=pe?{bar:i,mode:"end"}:{bar:i,mode:"move"}}}function qe(e,n,t){let r=e.edit;return Lt(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function Xe(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(l=>l.index===n);if(!o)return;let s=t.altKey?t.shiftKey?"start":"end":"move",a=r.snap??r.invert(o.x0+10)-r.invert(o.x0);return Lt(r,{bar:o,mode:s},i*a)}function Lt(e,{bar:n,mode:t},r){let i=a=>e.snap?Math.round(a/e.snap)*e.snap:a,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 Qe(e,n,t){let r=e.edit,i=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:b(Math.min(i,o)),y:b(n.bar.y),width:b(Math.max(1,Math.abs(o-i))),height:b(n.bar.height),fill:y.focus,opacity:.25,stroke:y.focus,rx:2}}var ln=64,cn=e=>Math.max(1,Math.min(ln,e));function Je(e,n,t,r){let i=n>0?.8:1.25,o=cn(e.view.zoom*i);if(o===e.view.zoom)return e.view;let{plot:s,scale:a}=e,[l,d]=e.view.center,c=(t-(s.x+s.width/2))/a,h=(r-(s.y+s.height/2))/a,g=e.view.zoom/o;return{center:[l+c*(1-g),e.fromY(e.toY(d)-h*(1-g))],zoom:o}}function et(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 _(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 me=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function ne(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 tt(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let r=y.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*P+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}=ne(t),a=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...a?ue(b(o),b(s),a,e.width,e.height):[]]}function nt(e,n,t){let r=me(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 Z=2,E=(e,n,t)=>{let r=Math.max(Z,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},Pt=(e,n)=>!e||e.start<=0&&e.end>=n;function rt(e,n,t){if(e.count<=Z||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,s=n>0?1.25:.8,a=Math.max(Z,Math.min(e.count,Math.round(o*s)));if(a===o)return n>0&&!Pt(e.zoom,e.count)?E(r,a,e.count):void 0;let l=Math.max(0,Math.min(1,(t-e.plot.x)/e.plot.width)),d=r+l*o;return E(d-l*a,a,e.count)}function it(e,n,t,r){let i=n.end-n.start,o=Math.max(Z,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 E(n.start+s*i-s*o,o,e.count)}function ot(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return E(n.start-t/i,r,e.count)}function st(e,n,t){let r=e.brush;if(!r||!Fe(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:E(s-o/2,o,e.count)}}function at(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 E(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-Z,Math.round(t.start+o))),end:t.end};let s=Math.min(e.count,Math.max(t.start+Z,Math.round(t.end+o)));return{start:t.start,end:s}}function ct(e,n){switch(n.type){case"svg":return Promise.resolve(lt(e,n.label,n.resolve));case"csv":return Promise.resolve(Dt(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=lt(e,n.label,n.resolve);return Nt(t,e.width,e.height,n.scale,n.background)}}}var N=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;"),re=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${N(String(t))}"`).join("");function Bt(e){let n=e.title?`<title>${N(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${re([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${re([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${re([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${re([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${re([t,["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]])}>${N(e.text)}</text>`}}function Rt(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${N(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="${N(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function lt(e,n,t){let r=Rt(e)+e.shapes.map(Bt).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="${N(n)}" font-family="${N(y.fontFamily)}" font-size="${N(y.fontSize)}"><title>${N(n)}</title>${r}</svg>`}function Nt(e,n,t,r=2,i){return new Promise((o,s)=>{let a=URL.createObjectURL(new Blob([e],{type:"image/svg+xml;charset=utf-8"})),l=new Image;l.onload=()=>{URL.revokeObjectURL(a);let d=document.createElement("canvas");d.width=Math.round(n*r),d.height=Math.round(t*r);let c=d.getContext("2d");if(!c)return s(new Error("canvas 2d context unavailable"));i&&(c.fillStyle=i,c.fillRect(0,0,d.width,d.height)),c.drawImage(l,0,0,d.width,d.height),d.toBlob(h=>h?o(h):s(new Error("toBlob failed")),"image/png")},l.onerror=()=>{URL.revokeObjectURL(a),s(new Error("svg could not be decoded"))},l.src=a})}function Dt(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
2
- `)}function dt(e,n){if(!n)return;let t=typeof n=="object"?n.maxRows??500:500,r=e.hit;if(r&&r.rows.length>0){let a=r.rows[0];if(r.rows.length>t)return;let l=["",...a.slice(1).map(c=>c.replace(/:\s[^:]*$/,""))],d=r.rows.map(c=>[c[0],...c.slice(1).map(h=>h.slice(h.lastIndexOf(": ")+2))]);return[l,...d]}let i=e.shapes.flatMap(a=>a.item&&!a.item.legend&&!(a.part==="anchor"&&!a.title)?[a.item]:[]);if(i.length===0||i.length>t)return;let o=["series","name","category","value"].filter(a=>i.some(l=>l[a]!==void 0)),s=(a,l)=>a[l]===void 0?"":String(a[l]);return[o.map(a=>a[0]?.toUpperCase()+a.slice(1)),...i.map(a=>o.map(l=>s(a,l)))]}var ut=new Map;function xe(e){let n=ut.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&&ut.delete(e)}},publish(o,s){Object.assign(r,o);for(let a of t)a(o,s)}};return ut.set(e,{group:i,listeners:t}),i}var Ft='[data-skdx-part]:not([data-skdx-part^="tooltip"]):not([data-skdx-part="focus"]):not([data-skdx-part="crosshair"])',ht=`@keyframes skdx-in{from{opacity:0}to{opacity:1}}${Ft}{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){${Ft}{animation:none;transition:none}}`;function pt(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}var m=require("lit"),f=require("lit/decorators.js"),w=require("lit/directives/if-defined.js");var ft={fromAttribute:()=>!1},x=class extends m.LitElement{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:s}=this.viewBox(t,r);this.overlay=[We(fe(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=[Ke(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=qe(r,i.gantt,o-i.x),this.overlay=[Qe(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(et(r.map,i.view,o-i.x,s-i.y));return}if(i&&r.hit){if(i.grab==="pinch"){let[s,a]=[...this.pointers.values()];if(s===void 0||a===void 0||!i.distance)return;this.setZoom(it(r.hit,i.zoom,Math.abs(s-a)/i.distance,(s+a)/2));return}let{x:o}=this.viewBox(t,r);this.setZoom(i.grab==="pan"?ot(r.hit,i.zoom,o-i.x):at(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:s}=_e(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=Ve(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(Ze(r,t.target)),this.syncId&&r.hit?.crosshair){let o=te(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=_(r,t.target)?.item.legend,a=this.canEdit(r)?Ye(r,i,o):void 0;if(a){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"edit",gantt:a},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 d=r.map.plot;if(i<d.x||i>d.x+d.width||o<d.y||o>d.y+d.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 l=r.hit;if(!(!l||!this.canZoom(r))){if(this.pointers.set(t.pointerId,i),this.pointers.size===2){let[d,c]=[...this.pointers.values()];this.drag={x:(d+c)/2,y:o,zoom:l.zoom,grab:"pinch",distance:Math.abs(d-c)||1}}else{let d=st(l,i,o);if(d)this.drag={x:i,y:o,zoom:d.zoom,grab:d.grab},d.zoom!==l.zoom&&this.setZoom(d.zoom);else if(this.zoomable&&i>=l.plot.x&&i<=l.plot.x+l.plot.width&&o>=l.plot.y&&o<=l.plot.y+l.plot.height)this.drag={x:i,y:o,zoom:l.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:a}=this.viewBox(t,o);if(Math.abs(s-i.x)>2||Math.abs(a-i.y)>2){i.grab==="select"?this.setSelected(Ee(o,fe(i.x,i.y,s,a))):i.grab==="lasso"?this.setSelected(Ue(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 l=r.map.plot;if(i<l.x||i>l.x+l.width||o<l.y||o>l.y+l.height)return;t.preventDefault(),this.setView(Je(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 a=rt(s,t.deltaY,i);a&&(t.preventDefault(),this.setZoom(a))};this.onClick=t=>{if(!this.layout)return;if(this.drag?.distance===-1){this.drag=null;return}let r=_(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=>{let r=this.layout;if(!r)return;if((t.key==="Enter"||t.key===" ")&&this.focused!==null){let a=r.shapes[this.focused]?.item;a&&(t.preventDefault(),this.select(a),this.emit("skdx-item-click",a));return}let i=this.canEdit(r)?Xe(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=nt(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?H(s):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:s,palette:a,loading:l,error:d,emptyMessage:c,description:h,decorative:g,animated:$,responsive:M,highlighted:O,highlightScope:S,accessibleTable:I}=this;return{...typeof M=="object"&&this.measured!==void 0&&this.measured<(M.breakpoint??480)?M.compact:void 0,width:M&&this.measured?this.measured:t,height:r,animate:$,responsive:M,legend:i,tooltip:o,format:s,palette:a,loading:l,error:d,emptyMessage:c,description:h,decorative:g,highlighted:O===void 0?this.highlightState:O,highlightScope:S,accessibleTable:I,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&&xe(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=xe(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&&Pe(r,t)||(this.hover=t,this.emit("skdx-highlighted-change",t),this.syncId&&(this.highlightState=t,this.publish({highlighted:t})))}select(t){let r=this.selectionMode;r!=="none"&&this.setSelected(Be(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 W(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&&R(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?ct(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=Re(Ae(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let I of o.issues??[])this.emit("skdx-data-issue",I)}let s=this.canZoom(o),a=this.canPan(o),l=this.canEdit(o),d=this.brushing(),c=s||a||l||d,h=!o.decorative&&me(o).length>0,g=o.description?`${r}-desc`:void 0,$=pt(o),M=dt(o,this.accessibleTable),O=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,S=this.portal;return m.html`<svg
1
+ "use strict";var ce=Object.defineProperty;var xt=Object.getOwnPropertyDescriptor;var jt=Object.getOwnPropertyNames;var Ht=Object.prototype.hasOwnProperty;var _t=(e,n)=>{for(var t in n)ce(e,t,{get:n[t],enumerable:!0})},Vt=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of jt(n))!Ht.call(e,i)&&i!==t&&ce(e,i,{get:()=>n[i],enumerable:!(r=xt(n,i))||r.enumerable});return e};var Zt=e=>Vt(ce({},"__esModule",{value:!0}),e),u=(e,n,t,r)=>{for(var i=r>1?void 0:r?xt(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&&ce(n,t,i),i};var un={};_t(un,{SkdxTimelineChart:()=>D});module.exports=Zt(un);var V=require("lit/decorators.js");var gt=e=>Number(e.toPrecision(12)),Et,bt=e=>(Et??(Et=new Intl.NumberFormat)).format(gt(e)),Wt=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 Ut(e){if(e===void 0)return bt;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:i="",timeZone:o}=e,s=c=>i?h=>c(h)+i:c,a=c=>r===void 0?c===void 0?{}:{maximumFractionDigits:c}:{minimumFractionDigits:r,maximumFractionDigits:r},l=c=>{let h=new Intl.NumberFormat(t,c);return s(g=>h.format(gt(g)))},d=c=>{let h=new Intl.DateTimeFormat(t,o?{...c,timeZone:o}:c);return g=>h.format(g)};switch(n){case"integer":return l({maximumFractionDigits:0});case"decimal":return l(a(2));case"percent":return l({style:"percent",...a(0)});case"currency":return l({style:"currency",currency:e.currency??"USD",...a()});case"compact":return l({notation:"compact",...a(1)});case"scientific":return l({notation:"scientific",...a(2)});case"date":return d({dateStyle:"medium"});case"time":return d({timeStyle:"short"});case"datetime":return d({dateStyle:"medium",timeStyle:"short"});case"duration":return s(Wt)}}function yt(e,n){if(typeof e=="string")return e;let t=e instanceof Date?e.getTime():e;return n?Ut(n)(t):e instanceof Date?new Intl.DateTimeFormat().format(e):bt(t)}function we([e,n],[t,r]){let i=n-e;return o=>i===0?t:t+(o-e)/i*(r-t)}function ke(e,[n,t],r=.2){let i=e===0?0:(t-n)/e,o=i*(1-Math.max(0,Math.min(.9,r)));return{step:i,bandwidth:o,start:s=>n+s*i+(i-o)/2,center:s=>n+(s+.5)*i}}var b=e=>Number(e.toFixed(2)),Kt=e=>typeof e=="number"&&Number.isFinite(e);function Me(e){let n=1/0,t=-1/0;for(let r of e)Kt(r)&&(r<n&&(n=r),r>t&&(t=r));return n===1/0?[0,0]:[n,t]}var q=1e3,X=60*q,Q=60*X,J=24*Q,Yt=[q,5*q,15*q,30*q,X,5*X,15*X,30*X,Q,3*Q,6*Q,12*Q,J,2*J,7*J,14*J];function vt(e,n,t=6){if(!(n>e))return[e];let r=n-e,i=Yt.find(h=>r/h<=t),o=[];if(i!==void 0){for(let h=Math.ceil(e/i)*i;h<=n;h+=i)o.push(h);return o.length?o:[e,n]}let s=r/(30*J),a=[1,2,3,6,12,24,60,120].find(h=>s/h<=t)??240,l=new Date(e),d=l.getUTCFullYear(),c=Math.ceil((l.getUTCMonth()+(l.getUTCDate()>1?1:0))/a)*a;for(let h=Date.UTC(d,c,1);h<=n;)o.push(h),c+=a,c>=12&&(d+=Math.floor(c/12),c%=12),h=Date.UTC(d,c,1);return o.length?o:[e,n]}var qt=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,Xt=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,Qt={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function Jt(e,n,t){return e.replace(Xt,(r,i,o)=>{let s=Qt[i];if(s===void 0)return i+o;let l=(o.match(qt)??[]).map((d,c)=>{let h=Number(d);if(s===-1)return String(h+n);if(s===-2)return String(h+t);let g=c%s;return s===7?g===5?String(h+n):g===6?String(h+t):d:String(g%2===0?h+n:h+t)});return i+l.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:Jt(r.d,n,t)}}});var Se=["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)"))),y={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)"},Ce=(e="neutral")=>e==="neutral"?y.axis:`var(--skdx-color-${e}-500)`;var kt=(e,n)=>n??Se[e%Se.length];var en={top:16,right:16,bottom:32,left:48};function Ie(e,n,t=en){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 ee(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function Mt(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var de=20,tn=120,St=e=>{let n=ee(e);return n&&(n.position==="left"||n.position==="right")?n.width??tn:0},ue=(e,n=600,t=300)=>({width:(e.width??n)-St(e),height:(e.height??t)-(ee(e)?.position==="bottom"?de:0)}),Te=(e,n,t)=>{let r=ee(e);return!r||!(r.position===void 0||r.position==="top")?0:(n?Math.max(1,$t(n,t??ue(e).width,r)):1)*de},P=6.5,Oe=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:kt(n)),Ct=(e,n)=>e.hiddenSeries?.includes(n)??!1;function $e(e,n,t=[],r={},i=10,o=8,s=!1){let a=[],l=r.maxItems,d=l!==void 0&&l>=0&&e.length>l?e.slice(0,l):e,c=e.length-d.length,h=r.interactive??!0,g=o,$=i,M=(O,S,I,T)=>{let F=(S?18:4)+O.length*P;g>o&&(s||g+F>n-8)&&(g=o,$+=de),S&&a.push({kind:"rect",part:"legend-swatch",x:g,y:$-5,width:10,height:10,fill:S,opacity:T?.3:void 0,item:I}),a.push({kind:"text",part:"legend-label",x:g+(S?14:0),y:$,text:O,baseline:"middle",fill:T?y.grid:y.label,item:I}),g+=F+12};for(let O of d){let S=t.includes(O.name),I=h?{label:O.name,series:O.name,legend:!0}:void 0;M(r.formatter?.(O.name)??O.name,O.color,I,S)}return c>0&&M(`+${c} more`,void 0,void 0,!1),r.align==="end"?nn(a,n):a}function nn(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(a=>a.kind==="rect"?a.x+a.width:a.x+a.text.length*P)),s=n-8-o;for(let a of i)r.push({...a,x:a.x+s})}return r}var $t=(e,n,t={})=>new Set($e(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function ze(e,n,t,r=[]){let i=ee(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,s=Mt(e),a=o?.position==="bottom",l=St(e),d=e.hiddenSeries??[],c=o?l?$e(r,1/0,d,o,10,(o.position==="right"?n:0)+8,!0):$e(r,n,d,o,a?t+10:10):[],h=a?$t(r,n,o):0;return{width:n+l,height:a?t+Math.max(1,h)*de:t,legendOffset:o?.position==="left"?l: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:c}}function Ae(e){let n=e.legendOffset;if(!n)return e;let t=[...wt(e.shapes.filter(l=>!l.part.startsWith("legend-")),n,0),...e.shapes.filter(l=>l.part.startsWith("legend-"))],r=l=>({...l,x:l.x+n}),i=e.hit?{...e.hit,plot:r(e.hit.plot),xs:e.hit.xs.map(l=>l+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:l=>o.scale(l)+n,invert:l=>o.invert(l-n),bars:o.bars.map(l=>({...l,x0:l.x0+n,x1:l.x1+n}))}:void 0,a=e.map?{...e.map,plot:r(e.map.plot)}:void 0;return{...e,shapes:t,hit:i,edit:s,map:a,legendOffset:void 0}}function he(e,n,t,r,i,o="auto"){let s=Array.isArray(t)?t:[t],a=Math.max(...s.map(g=>g.length))*P+12,l=6+s.length*16,d=o==="top"?{x:e-a/2,y:n-l-8}:o==="bottom"?{x:e-a/2,y:n+8}:o==="left"?{x:e-a-8,y:n-l/2}:o==="right"?{x:e+8,y:n-l/2}:{x:e+12,y:n-l-6},c=Math.max(0,Math.min(r-a,d.x)),h=Math.max(0,Math.min(i-l,d.y));return[{kind:"rect",part:"tooltip",x:b(c),y:b(h),width:b(a),height:l,fill:"var(--skdx-color-surface-raised)",stroke:y.axis,rx:3},...s.map((g,$)=>({kind:"text",part:"tooltip-label",x:b(c+6),y:b(h+11+$*16),text:g,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:s.length>1&&$===0?"bold":void 0}))]}function It(e,n){if(e.length<2)return e;let t=e.reduce((i,o)=>Math.max(i,o.label.length),0)*P+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 Tt(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}=ue(e,t,r),a=i==="error"?e.error:i==="loading"?"Loading\u2026":e.emptyMessage??"No data available",l=[];return i==="loading"&&l.push({kind:"rect",part:"skeleton",x:0,y:0,width:o,height:s,fill:"var(--skdx-color-surface-sunken)",rx:4}),l.push({kind:"text",part:`state-${i}`,x:b(o/2),y:b(s/2),text:a,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":y.label}),{...ze(e,o,s),shapes:l,tooltip:!1}}var j=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:y.label,...r});function pe(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var Le=e=>e.id??e.name??e.series,Ot=e=>e.seriesId??e.series;function R(e,n){let t=!1;return n.id!==void 0&&(t=!0,Le(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,Ot(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 H(e){let n={},t=Le(e);t!==void 0&&(n.id=t);let r=Ot(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var Pe=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function Be(e,n,t){let r=pe(e),i=H(n),o=r.some(s=>R(n,s));return t==="single"?o?[]:[i]:o?r.filter(s=>!R(n,s)):[...r,i]}var rn=.2;function on(e){let n=y.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 sn=(e,n)=>e.kind==="text"?{...e,fill:y.grid}:{...e,opacity:(e.opacity??1)*n};function Re(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=[],a=c=>!i||r.some(h=>R(c,h))?!0:o.highlighted==="series"?r.some(h=>h.series!==void 0&&R(c,{series:h.series})):!1,l=c=>{if(!i||o.faded==="none"||a(c))return!1;if(o.faded==="series"){let h=i.series;return h!==void 0&&R(c,{series:h})}return!0},d=e.shapes.map(c=>{let h=c.item;if(!h||h.legend)return c;if(t.some(g=>R(h,g))){let g=on(c);g&&s.push(g)}return l(h)?sn(c,rn):c});return s.length?{...e,shapes:[...d,...s]}:{...e,shapes:d}}var Ne=14;function De(e){let n=[],t=e.events.map((p,v)=>({event:p,index:v,time:new Date(p.date).getTime()})).filter(p=>Number.isFinite(p.time)?!(p.event.group!==void 0&&Ct(e,p.event.group)):(n.push({code:"invalid-value",severity:"warning",message:`Event "${p.event.label}" has an unparseable date and was dropped.`,itemId:p.event.id??p.event.label}),!1)).sort((p,v)=>p.time-v.time||p.index-v.index),r=Tt(e,t.length===0);if(r)return{...r,issues:n};let{width:i,height:o}=ue(e),s=e.orientation==="vertical",a=[...new Set(e.events.map(p=>p.group).filter(p=>p!==void 0))],l=a.length?a:[""],[d,c]=Me(t.map(p=>p.time)),h=e.xAxis?.format??{style:c-d<2*864e5?"time":"date"},g=p=>yt(p,h),$=e.labels??!0,M=t.map(p=>{let v=p.event.group,A=p.event.color??(p.event.variant?Ce(p.event.variant):Oe(e,v===void 0?0:a.indexOf(v))),B=p.event.description?` \u2014 ${p.event.description}`:"";return{...p,lane:v===void 0?0:a.indexOf(v),color:A,text:`${p.event.label} \xB7 ${g(p.time)}${B}`}}),O=a.map((p,v)=>({name:p,color:Oe(e,v)})),S=ze(e,i,o,O),I=p=>({label:p.text,id:p.event.id,name:p.event.label,category:p.event.group,index:p.index,value:p.time}),T=[];if(s){let p=Math.max(...M.map(L=>g(L.time).length))*P+16,v=Ie(i,o,{top:8+Te(e),right:8,bottom:8,left:p+12}),A=ke(M.length,[v.y,v.y+v.height],0),B=b(v.x);return T.push({kind:"line",part:"axis",x1:B,x2:B,y1:v.y,y2:v.y+v.height,stroke:y.axis}),M.forEach((L,ae)=>{let z=b(A.center(ae));if(T.push(j(b(v.x-12),z,g(L.time),{part:"x-label",anchor:"end",baseline:"middle"}),{kind:"circle",part:"event",cx:B,cy:z,r:5,fill:L.color,stroke:"var(--skdx-color-surface-default)",title:L.text,item:I(L)}),$){let Y=L.event.description,le=A.step>=2*Ne&&Y;T.push(j(b(v.x+12),le?b(z-7):z,L.event.label,{part:"event-label",baseline:"middle",fill:"var(--skdx-color-text-default)"})),le&&T.push(j(b(v.x+12),b(z+7),Y,{part:"event-description",baseline:"middle"}))}}),{...S,shapes:[...T,...S.shapes],issues:n}}let F=a.length?Math.max(...a.map(p=>p.length))*P+16:8,ie=Math.max(g(d).length,g(c).length)*P/2+4,C=Ie(i,o,{top:8+Te(e),right:Math.max(16,ie),bottom:32+(e.xAxis?.label?14:0),left:Math.max(16,F,ie)}),G=(c-d)*.04||36e5,oe=we([d-G,c+G],[C.x,C.x+C.width]),ye=vt(d-G,c+G).filter(p=>p>=d-G&&p<=c+G).map(p=>({pos:b(oe(p)),label:g(p)}));for(let p of It(ye,C.width))T.push({kind:"line",part:"grid",x1:p.pos,x2:p.pos,y1:C.y,y2:C.y+C.height,stroke:y.grid},j(p.pos,C.y+C.height+20,p.label,{part:"x-label",anchor:"middle"}));e.xAxis?.label&&T.push(j(b(C.x+C.width/2),o-4,e.xAxis.label,{part:"axis-title",anchor:"middle"}));let U=ke(l.length,[C.y,C.y+C.height],0),se=Math.max(0,Math.floor((U.step/2-14)/Ne));l.forEach((p,v)=>{let A=b(U.center(v));T.push({kind:"line",part:"axis",x1:C.x,x2:C.x+C.width,y1:A,y2:A,stroke:y.axis}),p&&T.push(j(C.x-8,A,p,{part:"y-label",anchor:"end",baseline:"middle"}))});let ve=l.map(()=>[]),K=[],mt=[];for(let p of M){let v=b(oe(p.time)),A=b(U.center(p.lane));if(mt.push({kind:"circle",part:"event",cx:v,cy:A,r:5,fill:p.color,stroke:"var(--skdx-color-surface-default)",title:p.text,item:I(p)}),!$)continue;let B=p.event.label.length*P,L=v-B/2,ae=ve[p.lane],z=0;for(;z<=se&&(ae[z]??-1/0)>L-6;)z++;if(z>se)continue;ae[z]=L+B;let Y=b(A-12-z*Ne),le=b(Math.max(B/2+2,Math.min(i-B/2-2,v)));z>0&&K.push({kind:"line",part:"connector",x1:v,x2:v,y1:b(A-6),y2:b(Y+4),stroke:y.grid}),K.push(j(le,Y,p.event.label,{part:"event-label",anchor:"middle",fill:"var(--skdx-color-text-default)"}))}return{...S,shapes:[...T,...K,...mt,...S.shapes],issues:n}}function W(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 Fe=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function zt(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 te(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=zt(t,n),i=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(i,r)??i}}function Ge(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[zt(t,n)];return{kind:"line",part:"crosshair",x1:r,x2:r,y1:t.plot.y,y2:t.plot.y+t.plot.height,stroke:y.axis,dash:"3 3"}}function je(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!Fe(r.plot,n,t))return[];let i=Ge(e,n),{rows:o}=te(e,n),s=e.tooltipAnchored?r.plot.y+8:t;return[i,...he(i.x1,s,o,e.width,e.height,e.tooltipPlacement)]}function He(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 je(e,i,t.plot.y+8)}function _e(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:l,y:d}=W(t,r,i,e.width,e.height);if(Fe(e.hit.plot,l,d)){let c=te(e,l),h=Ge(e,l);if(c&&h)return{lines:c.rows,shapes:[h]}}}let o=n?.closest?.("[data-skdx-part]"),s=e.tooltipFormatter?_(e,n)?.item:void 0,a=s&&e.tooltipFormatter?.(s)||o&&Array.from(o.children).find(l=>l.tagName.toLowerCase()==="title")?.textContent;return a?{lines:Array.isArray(a)?a:[a],shapes:[]}:{lines:[],shapes:[]}}function At(e,n,t,r,i,o,s){let a=e?.closest?.("[data-skdx-part]"),l=s&&s.tooltipFormatter?_(s,e)?.item:void 0,d=l&&s?.tooltipFormatter?.(l)||a&&Array.from(a.children).find(M=>M.tagName.toLowerCase()==="title")?.textContent;if(!d)return[];let c=s?.tooltipAnchored?_(s,e):void 0,h=c?s?.shapes[c.index]:void 0,{x:g,y:$}=h?ne(h):W(n,t,r,i,o);return he(g,$,d,i,o,s?.tooltipPlacement)}function Ve(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:s}=W(t,r,i,e.width,e.height),a=je(e,o,s);if(a.length>0)return a}return At(n,t,r,i,e.width,e.height,e)}function Ze(e,n){let t=_(e,n);return t&&!t.item.legend?H(t.item):null}var an=(e,n)=>{let{x:t,y:r}=ne(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 Ee(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!an(i,n))continue;let o=H(i.item),s=JSON.stringify(o);t.has(s)||(t.add(s),r.push(o))}return r}var We=e=>({kind:"rect",part:"selection-box",x:b(e.x),y:b(e.y),width:b(e.width),height:b(e.height),fill:y.focus,opacity:.12,stroke:y.focus}),me=(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 Lt(e,n,t){let r=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){let s=e[i],a=e[o];s.y>t!=a.y>t&&n<(a.x-s.x)*(t-s.y)/(a.y-s.y)+s.x&&(r=!r)}return r}function Ue(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}=ne(i),a=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:s;if(!Lt(n,o,a))continue;let l=H(i.item),d=JSON.stringify(l);t.has(d)||(t.add(d),r.push(l))}return r}var Ke=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${b(n.x)} ${b(n.y)}`).join("L")}`:"",fill:y.focus,fillOpacity:.12,stroke:y.focus,dash:"4 3"}),fe=6;function Ye(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-fe||n>i.x1+fe))return Math.abs(n-i.x0)<=fe?{bar:i,mode:"start"}:Math.abs(n-i.x1)<=fe?{bar:i,mode:"end"}:{bar:i,mode:"move"}}}function qe(e,n,t){let r=e.edit;return Pt(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function Xe(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(l=>l.index===n);if(!o)return;let s=t.altKey?t.shiftKey?"start":"end":"move",a=r.snap??r.invert(o.x0+10)-r.invert(o.x0);return Pt(r,{bar:o,mode:s},i*a)}function Pt(e,{bar:n,mode:t},r){let i=a=>e.snap?Math.round(a/e.snap)*e.snap:a,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 Qe(e,n,t){let r=e.edit,i=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:b(Math.min(i,o)),y:b(n.bar.y),width:b(Math.max(1,Math.abs(o-i))),height:b(n.bar.height),fill:y.focus,opacity:.25,stroke:y.focus,rx:2}}var ln=64,cn=e=>Math.max(1,Math.min(ln,e));function Je(e,n,t,r){let i=n>0?.8:1.25,o=cn(e.view.zoom*i);if(o===e.view.zoom)return e.view;let{plot:s,scale:a}=e,[l,d]=e.view.center,c=(t-(s.x+s.width/2))/a,h=(r-(s.y+s.height/2))/a,g=e.view.zoom/o;return{center:[l+c*(1-g),e.fromY(e.toY(d)-h*(1-g))],zoom:o}}function et(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 _(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 xe=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function ne(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 tt(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let r=y.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*P+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}=ne(t),a=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...a?he(b(o),b(s),a,e.width,e.height):[]]}function nt(e,n,t){let r=xe(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 Z=2,E=(e,n,t)=>{let r=Math.max(Z,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},Bt=(e,n)=>!e||e.start<=0&&e.end>=n;function rt(e,n,t){if(e.count<=Z||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,s=n>0?1.25:.8,a=Math.max(Z,Math.min(e.count,Math.round(o*s)));if(a===o)return n>0&&!Bt(e.zoom,e.count)?E(r,a,e.count):void 0;let l=Math.max(0,Math.min(1,(t-e.plot.x)/e.plot.width)),d=r+l*o;return E(d-l*a,a,e.count)}function it(e,n,t,r){let i=n.end-n.start,o=Math.max(Z,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 E(n.start+s*i-s*o,o,e.count)}function ot(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return E(n.start-t/i,r,e.count)}function st(e,n,t){let r=e.brush;if(!r||!Fe(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:E(s-o/2,o,e.count)}}function at(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 E(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-Z,Math.round(t.start+o))),end:t.end};let s=Math.min(e.count,Math.max(t.start+Z,Math.round(t.end+o)));return{start:t.start,end:s}}function ct(e,n){switch(n.type){case"svg":return Promise.resolve(lt(e,n.label,n.resolve));case"csv":return Promise.resolve(Ft(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=lt(e,n.label,n.resolve);return Dt(t,e.width,e.height,n.scale,n.background)}}}var N=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;"),re=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${N(String(t))}"`).join("");function Rt(e){let n=e.title?`<title>${N(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${re([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${re([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${re([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${re([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${re([t,["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]])}>${N(e.text)}</text>`}}function Nt(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${N(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="${N(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function lt(e,n,t){let r=Nt(e)+e.shapes.map(Rt).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="${N(n)}" font-family="${N(y.fontFamily)}" font-size="${N(y.fontSize)}"><title>${N(n)}</title>${r}</svg>`}function Dt(e,n,t,r=2,i){return new Promise((o,s)=>{let a=URL.createObjectURL(new Blob([e],{type:"image/svg+xml;charset=utf-8"})),l=new Image;l.onload=()=>{URL.revokeObjectURL(a);let d=document.createElement("canvas");d.width=Math.round(n*r),d.height=Math.round(t*r);let c=d.getContext("2d");if(!c)return s(new Error("canvas 2d context unavailable"));i&&(c.fillStyle=i,c.fillRect(0,0,d.width,d.height)),c.drawImage(l,0,0,d.width,d.height),d.toBlob(h=>h?o(h):s(new Error("toBlob failed")),"image/png")},l.onerror=()=>{URL.revokeObjectURL(a),s(new Error("svg could not be decoded"))},l.src=a})}function Ft(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
2
+ `)}function dt(e,n){if(!n)return;let t=typeof n=="object"?n.maxRows??500:500,r=e.hit;if(r&&r.rows.length>0){let a=r.rows[0];if(r.rows.length>t)return;let l=["",...a.slice(1).map(c=>c.replace(/:\s[^:]*$/,""))],d=r.rows.map(c=>[c[0],...c.slice(1).map(h=>h.slice(h.lastIndexOf(": ")+2))]);return[l,...d]}let i=e.shapes.flatMap(a=>a.item&&!a.item.legend&&!(a.part==="anchor"&&!a.title)?[a.item]:[]);if(i.length===0||i.length>t)return;let o=["series","name","category","value"].filter(a=>i.some(l=>l[a]!==void 0)),s=(a,l)=>a[l]===void 0?"":String(a[l]);return[o.map(a=>a[0]?.toUpperCase()+a.slice(1)),...i.map(a=>o.map(l=>s(a,l)))]}var ut=new Map;function ge(e){let n=ut.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&&ut.delete(e)}},publish(o,s){Object.assign(r,o);for(let a of t)a(o,s)}};return ut.set(e,{group:i,listeners:t}),i}var Gt='[data-skdx-part]:not([data-skdx-part^="tooltip"]):not([data-skdx-part="focus"]):not([data-skdx-part="crosshair"])',ht=`@keyframes skdx-in{from{opacity:0}to{opacity:1}}${Gt}{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){${Gt}{animation:none;transition:none}}`;function pt(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}var m=require("lit"),f=require("lit/decorators.js"),w=require("lit/directives/if-defined.js");var ft={fromAttribute:()=>!1},x=class extends m.LitElement{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:s}=this.viewBox(t,r);this.overlay=[We(me(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=[Ke(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=qe(r,i.gantt,o-i.x),this.overlay=[Qe(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(et(r.map,i.view,o-i.x,s-i.y));return}if(i&&r.hit){if(i.grab==="pinch"){let[s,a]=[...this.pointers.values()];if(s===void 0||a===void 0||!i.distance)return;this.setZoom(it(r.hit,i.zoom,Math.abs(s-a)/i.distance,(s+a)/2));return}let{x:o}=this.viewBox(t,r);this.setZoom(i.grab==="pan"?ot(r.hit,i.zoom,o-i.x):at(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:s}=_e(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=Ve(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(Ze(r,t.target)),this.syncId&&r.hit?.crosshair){let o=te(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=_(r,t.target)?.item.legend,a=this.canEdit(r)?Ye(r,i,o):void 0;if(a){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"edit",gantt:a},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 d=r.map.plot;if(i<d.x||i>d.x+d.width||o<d.y||o>d.y+d.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 l=r.hit;if(!(!l||!this.canZoom(r))){if(this.pointers.set(t.pointerId,i),this.pointers.size===2){let[d,c]=[...this.pointers.values()];this.drag={x:(d+c)/2,y:o,zoom:l.zoom,grab:"pinch",distance:Math.abs(d-c)||1}}else{let d=st(l,i,o);if(d)this.drag={x:i,y:o,zoom:d.zoom,grab:d.grab},d.zoom!==l.zoom&&this.setZoom(d.zoom);else if(this.zoomable&&i>=l.plot.x&&i<=l.plot.x+l.plot.width&&o>=l.plot.y&&o<=l.plot.y+l.plot.height)this.drag={x:i,y:o,zoom:l.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:a}=this.viewBox(t,o);if(Math.abs(s-i.x)>2||Math.abs(a-i.y)>2){i.grab==="select"?this.setSelected(Ee(o,me(i.x,i.y,s,a))):i.grab==="lasso"?this.setSelected(Ue(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 l=r.map.plot;if(i<l.x||i>l.x+l.width||o<l.y||o>l.y+l.height)return;t.preventDefault(),this.setView(Je(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 a=rt(s,t.deltaY,i);a&&(t.preventDefault(),this.setZoom(a))};this.onClick=t=>{if(!this.layout)return;if(this.drag?.distance===-1){this.drag=null;return}let r=_(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=>{let r=this.layout;if(!r)return;if((t.key==="Enter"||t.key===" ")&&this.focused!==null){let a=r.shapes[this.focused]?.item;a&&(t.preventDefault(),this.select(a),this.emit("skdx-item-click",a));return}let i=this.canEdit(r)?Xe(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=nt(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?H(s):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:s,palette:a,loading:l,error:d,emptyMessage:c,description:h,decorative:g,animated:$,responsive:M,highlighted:O,highlightScope:S,accessibleTable:I}=this;return{...typeof M=="object"&&this.measured!==void 0&&this.measured<(M.breakpoint??480)?M.compact:void 0,width:M&&this.measured?this.measured:t,height:r,animate:$,responsive:M,legend:i,tooltip:o,format:s,palette:a,loading:l,error:d,emptyMessage:c,description:h,decorative:g,highlighted:O===void 0?this.highlightState:O,highlightScope:S,accessibleTable:I,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&&Pe(r,t)||(this.hover=t,this.emit("skdx-highlighted-change",t),this.syncId&&(this.highlightState=t,this.publish({highlighted:t})))}select(t){let r=this.selectionMode;r!=="none"&&this.setSelected(Be(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 W(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&&R(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?ct(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=Re(Ae(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let I of o.issues??[])this.emit("skdx-data-issue",I)}let s=this.canZoom(o),a=this.canPan(o),l=this.canEdit(o),d=this.brushing(),c=s||a||l||d,h=!o.decorative&&xe(o).length>0,g=o.description?`${r}-desc`:void 0,$=pt(o),M=dt(o,this.accessibleTable),O=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,S=this.portal;return m.html`<svg
3
3
  xmlns="http://www.w3.org/2000/svg"
4
4
  viewBox="0 0 ${o.width} ${o.height}"
5
5
  width=${o.width}
@@ -30,9 +30,9 @@
30
30
  <title>${i}</title>
31
31
  ${o.description?m.svg`<desc id=${(0,w.ifDefined)(g)}>${o.description}</desc>`:m.nothing}
32
32
  ${$?m.svg`<style>${ht}</style>`:m.nothing} ${dn(o)}
33
- ${ge(o.shapes)}
34
- ${ge(this.tip.length||!this.crossState?this.tip:He(o,this.crossState))}
35
- ${ge(tt(o,this.focused))} ${ge(this.overlay)}
33
+ ${be(o.shapes)}
34
+ ${be(this.tip.length||!this.crossState?this.tip:He(o,this.crossState))}
35
+ ${be(tt(o,this.focused))} ${be(this.overlay)}
36
36
  </svg>
37
37
  ${S?m.html`<div
38
38
  role="tooltip"
@@ -106,4 +106,4 @@
106
106
  [role='tooltip'] > :first-child:not(:only-child) {
107
107
  font-weight: bold;
108
108
  }
109
- `,u([(0,f.property)({type:Number})],x.prototype,"width",2),u([(0,f.property)({type:Number})],x.prototype,"height",2),u([(0,f.property)()],x.prototype,"label",2),u([(0,f.property)({type:Boolean,reflect:!0})],x.prototype,"legend",2),u([(0,f.property)({type:Boolean,attribute:"no-tooltip",converter:ft})],x.prototype,"tooltip",2),u([(0,f.property)({attribute:!1})],x.prototype,"format",2),u([(0,f.property)({attribute:!1})],x.prototype,"palette",2),u([(0,f.property)({attribute:!1})],x.prototype,"hiddenSeries",2),u([(0,f.property)({attribute:!1})],x.prototype,"selected",2),u([(0,f.property)({attribute:"selection-mode"})],x.prototype,"selectionMode",2),u([(0,f.property)({attribute:!1})],x.prototype,"highlighted",2),u([(0,f.property)({attribute:!1})],x.prototype,"highlightScope",2),u([(0,f.property)({type:Boolean,reflect:!0})],x.prototype,"loading",2),u([(0,f.property)()],x.prototype,"error",2),u([(0,f.property)({attribute:"empty-message"})],x.prototype,"emptyMessage",2),u([(0,f.property)()],x.prototype,"description",2),u([(0,f.property)({type:Boolean,reflect:!0})],x.prototype,"decorative",2),u([(0,f.property)({type:Boolean,attribute:"accessible-table"})],x.prototype,"accessibleTable",2),u([(0,f.property)({attribute:!1})],x.prototype,"zoom",2),u([(0,f.property)({attribute:!1})],x.prototype,"view",2),u([(0,f.property)({type:Boolean,reflect:!0})],x.prototype,"zoomable",2),u([(0,f.property)({type:Boolean,reflect:!0})],x.prototype,"editable",2),u([(0,f.property)({attribute:"sync-id"})],x.prototype,"syncId",2),u([(0,f.property)({type:Boolean,attribute:"cross-filter"})],x.prototype,"crossFilter",2),u([(0,f.property)({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],x.prototype,"animated",2),u([(0,f.property)({type:Boolean,reflect:!0})],x.prototype,"responsive",2),u([(0,f.state)()],x.prototype,"tip",2),u([(0,f.state)()],x.prototype,"overlay",2),u([(0,f.state)()],x.prototype,"portal",2),u([(0,f.state)()],x.prototype,"measured",2),u([(0,f.state)()],x.prototype,"viewState",2),u([(0,f.state)()],x.prototype,"highlightState",2),u([(0,f.state)()],x.prototype,"crossState",2),u([(0,f.state)()],x.prototype,"focused",2),u([(0,f.state)()],x.prototype,"hiddenState",2),u([(0,f.state)()],x.prototype,"zoomState",2),u([(0,f.state)()],x.prototype,"selectedState",2);var k=class extends x{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:a,annotations:l,labels:d,curve:c,connectNulls:h,nulls:g,stacked:$,stackOffset:M,orientation:O,radius:S,barGap:I,barWidth:T,sort:F,transform:ie,transforms:C,bins:G,binWidth:oe,binDomain:be,binMode:U,sampling:se,brush:ye,crosshair:K}=this;return{...this.sized(),series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:a,annotations:l,labels:d,curve:c,connectNulls:h,nulls:g,stacked:$,stackOffset:M,orientation:O,radius:S,barGap:I,barWidth:T,sort:F,transform:ie,transforms:C,bins:G,binWidth:oe,binDomain:be,binMode:U,sampling:se,brush:ye,crosshair:K}}};u([(0,f.property)({attribute:!1})],k.prototype,"series",2),u([(0,f.property)({attribute:!1})],k.prototype,"categories",2),u([(0,f.property)({attribute:!1})],k.prototype,"xAxis",2),u([(0,f.property)({attribute:!1})],k.prototype,"yAxis",2),u([(0,f.property)({attribute:!1})],k.prototype,"rightAxis",2),u([(0,f.property)({attribute:!1})],k.prototype,"references",2),u([(0,f.property)({attribute:!1})],k.prototype,"annotations",2),u([(0,f.property)({type:Boolean,reflect:!0})],k.prototype,"labels",2),u([(0,f.property)()],k.prototype,"curve",2),u([(0,f.property)({type:Boolean,attribute:"connect-nulls"})],k.prototype,"connectNulls",2),u([(0,f.property)()],k.prototype,"nulls",2),u([(0,f.property)({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],k.prototype,"stacked",2),u([(0,f.property)({attribute:"stack-offset"})],k.prototype,"stackOffset",2),u([(0,f.property)()],k.prototype,"orientation",2),u([(0,f.property)({type:Number})],k.prototype,"radius",2),u([(0,f.property)({type:Number,attribute:"bar-gap"})],k.prototype,"barGap",2),u([(0,f.property)({type:Number,attribute:"bar-width"})],k.prototype,"barWidth",2),u([(0,f.property)()],k.prototype,"sort",2),u([(0,f.property)()],k.prototype,"transform",2),u([(0,f.property)({attribute:!1})],k.prototype,"transforms",2),u([(0,f.property)({type:Number})],k.prototype,"bins",2),u([(0,f.property)({type:Number,attribute:"bin-width"})],k.prototype,"binWidth",2),u([(0,f.property)({attribute:!1})],k.prototype,"binDomain",2),u([(0,f.property)({attribute:"bin-mode"})],k.prototype,"binMode",2),u([(0,f.property)({attribute:!1})],k.prototype,"sampling",2),u([(0,f.property)({type:Boolean,reflect:!0})],k.prototype,"brush",2),u([(0,f.property)({type:Boolean,reflect:!0})],k.prototype,"crosshair",2);var dn=e=>e.defs&&e.defs.length?m.svg`<defs>${e.defs.map(n=>m.svg`<linearGradient id=${n.id} x1="0" y1="0" x2=${n.vertical===!1?1:0} y2=${n.vertical===!1?0:1}>${n.stops.map(t=>m.svg`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${(0,w.ifDefined)(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:m.nothing,ge=e=>m.svg`${e.map((n,t)=>{let r=n.title?m.svg`<title>${n.title}</title>`:m.nothing,i=n.item?t:void 0;switch(n.kind){case"path":return m.svg`<path data-skdx-part=${n.part} data-skdx-i=${(0,w.ifDefined)(i)} d=${n.d} fill=${n.fill??"none"} stroke=${(0,w.ifDefined)(n.stroke)} stroke-width=${(0,w.ifDefined)(n.strokeWidth)} stroke-linecap=${(0,w.ifDefined)(n.strokeLinecap)} stroke-linejoin=${(0,w.ifDefined)(n.strokeLinejoin)} stroke-dasharray=${(0,w.ifDefined)(n.dash)} opacity=${(0,w.ifDefined)(n.opacity)} fill-opacity=${(0,w.ifDefined)(n.fillOpacity)}>${r}</path>`;case"rect":return m.svg`<rect data-skdx-part=${n.part} data-skdx-i=${(0,w.ifDefined)(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${(0,w.ifDefined)(n.rx)} fill=${n.fill} stroke=${(0,w.ifDefined)(n.stroke)} fill-opacity=${(0,w.ifDefined)(n.opacity)}>${r}</rect>`;case"line":return m.svg`<line data-skdx-part=${n.part} data-skdx-i=${(0,w.ifDefined)(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${(0,w.ifDefined)(n.strokeWidth)} stroke-dasharray=${(0,w.ifDefined)(n.dash)} opacity=${(0,w.ifDefined)(n.opacity)}>${r}</line>`;case"circle":return m.svg`<circle data-skdx-part=${n.part} data-skdx-i=${(0,w.ifDefined)(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${(0,w.ifDefined)(n.stroke)} opacity=${(0,w.ifDefined)(n.opacity)}>${r}</circle>`;case"text":return m.svg`<text data-skdx-part=${n.part} data-skdx-i=${(0,w.ifDefined)(i)} x=${n.x} y=${n.y} text-anchor=${(0,w.ifDefined)(n.anchor)} dominant-baseline=${(0,w.ifDefined)(n.baseline)} fill=${(0,w.ifDefined)(n.fill)} font-weight=${(0,w.ifDefined)(n.weight)} pointer-events=${(0,w.ifDefined)(i===void 0?"none":void 0)} transform=${(0,w.ifDefined)(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var D=class extends x{constructor(){super(...arguments);this.events=[];this.labels=!0}render(){let{events:t,orientation:r,xAxis:i,labels:o}=this;return this.root(De({...this.sized(),events:t,orientation:r,xAxis:i,labels:o}),"timeline",this.label??"Timeline chart")}};u([(0,V.property)({attribute:!1})],D.prototype,"events",2),u([(0,V.property)()],D.prototype,"orientation",2),u([(0,V.property)({attribute:!1})],D.prototype,"xAxis",2),u([(0,V.property)({type:Boolean,attribute:"no-labels",converter:ft})],D.prototype,"labels",2),D=u([(0,V.customElement)("skdx-timeline-chart")],D);0&&(module.exports={SkdxTimelineChart});
109
+ `,u([(0,f.property)({type:Number})],x.prototype,"width",2),u([(0,f.property)({type:Number})],x.prototype,"height",2),u([(0,f.property)()],x.prototype,"label",2),u([(0,f.property)({type:Boolean,reflect:!0})],x.prototype,"legend",2),u([(0,f.property)({type:Boolean,attribute:"no-tooltip",converter:ft})],x.prototype,"tooltip",2),u([(0,f.property)({attribute:!1})],x.prototype,"format",2),u([(0,f.property)({attribute:!1})],x.prototype,"palette",2),u([(0,f.property)({attribute:!1})],x.prototype,"hiddenSeries",2),u([(0,f.property)({attribute:!1})],x.prototype,"selected",2),u([(0,f.property)({attribute:"selection-mode"})],x.prototype,"selectionMode",2),u([(0,f.property)({attribute:!1})],x.prototype,"highlighted",2),u([(0,f.property)({attribute:!1})],x.prototype,"highlightScope",2),u([(0,f.property)({type:Boolean,reflect:!0})],x.prototype,"loading",2),u([(0,f.property)()],x.prototype,"error",2),u([(0,f.property)({attribute:"empty-message"})],x.prototype,"emptyMessage",2),u([(0,f.property)()],x.prototype,"description",2),u([(0,f.property)({type:Boolean,reflect:!0})],x.prototype,"decorative",2),u([(0,f.property)({type:Boolean,attribute:"accessible-table"})],x.prototype,"accessibleTable",2),u([(0,f.property)({attribute:!1})],x.prototype,"zoom",2),u([(0,f.property)({attribute:!1})],x.prototype,"view",2),u([(0,f.property)({type:Boolean,reflect:!0})],x.prototype,"zoomable",2),u([(0,f.property)({type:Boolean,reflect:!0})],x.prototype,"editable",2),u([(0,f.property)({attribute:"sync-id"})],x.prototype,"syncId",2),u([(0,f.property)({type:Boolean,attribute:"cross-filter"})],x.prototype,"crossFilter",2),u([(0,f.property)({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],x.prototype,"animated",2),u([(0,f.property)({type:Boolean,reflect:!0})],x.prototype,"responsive",2),u([(0,f.state)()],x.prototype,"tip",2),u([(0,f.state)()],x.prototype,"overlay",2),u([(0,f.state)()],x.prototype,"portal",2),u([(0,f.state)()],x.prototype,"measured",2),u([(0,f.state)()],x.prototype,"viewState",2),u([(0,f.state)()],x.prototype,"highlightState",2),u([(0,f.state)()],x.prototype,"crossState",2),u([(0,f.state)()],x.prototype,"focused",2),u([(0,f.state)()],x.prototype,"hiddenState",2),u([(0,f.state)()],x.prototype,"zoomState",2),u([(0,f.state)()],x.prototype,"selectedState",2);var k=class extends x{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:a,annotations:l,labels:d,curve:c,connectNulls:h,nulls:g,stacked:$,stackOffset:M,orientation:O,radius:S,barGap:I,barWidth:T,sort:F,transform:ie,transforms:C,bins:G,binWidth:oe,binDomain:ye,binMode:U,sampling:se,brush:ve,crosshair:K}=this;return{...this.sized(),series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:a,annotations:l,labels:d,curve:c,connectNulls:h,nulls:g,stacked:$,stackOffset:M,orientation:O,radius:S,barGap:I,barWidth:T,sort:F,transform:ie,transforms:C,bins:G,binWidth:oe,binDomain:ye,binMode:U,sampling:se,brush:ve,crosshair:K}}};u([(0,f.property)({attribute:!1})],k.prototype,"series",2),u([(0,f.property)({attribute:!1})],k.prototype,"categories",2),u([(0,f.property)({attribute:!1})],k.prototype,"xAxis",2),u([(0,f.property)({attribute:!1})],k.prototype,"yAxis",2),u([(0,f.property)({attribute:!1})],k.prototype,"rightAxis",2),u([(0,f.property)({attribute:!1})],k.prototype,"references",2),u([(0,f.property)({attribute:!1})],k.prototype,"annotations",2),u([(0,f.property)({type:Boolean,reflect:!0})],k.prototype,"labels",2),u([(0,f.property)()],k.prototype,"curve",2),u([(0,f.property)({type:Boolean,attribute:"connect-nulls"})],k.prototype,"connectNulls",2),u([(0,f.property)()],k.prototype,"nulls",2),u([(0,f.property)({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],k.prototype,"stacked",2),u([(0,f.property)({attribute:"stack-offset"})],k.prototype,"stackOffset",2),u([(0,f.property)()],k.prototype,"orientation",2),u([(0,f.property)({type:Number})],k.prototype,"radius",2),u([(0,f.property)({type:Number,attribute:"bar-gap"})],k.prototype,"barGap",2),u([(0,f.property)({type:Number,attribute:"bar-width"})],k.prototype,"barWidth",2),u([(0,f.property)()],k.prototype,"sort",2),u([(0,f.property)()],k.prototype,"transform",2),u([(0,f.property)({attribute:!1})],k.prototype,"transforms",2),u([(0,f.property)({type:Number})],k.prototype,"bins",2),u([(0,f.property)({type:Number,attribute:"bin-width"})],k.prototype,"binWidth",2),u([(0,f.property)({attribute:!1})],k.prototype,"binDomain",2),u([(0,f.property)({attribute:"bin-mode"})],k.prototype,"binMode",2),u([(0,f.property)({attribute:!1})],k.prototype,"sampling",2),u([(0,f.property)({type:Boolean,reflect:!0})],k.prototype,"brush",2),u([(0,f.property)({type:Boolean,reflect:!0})],k.prototype,"crosshair",2);var dn=e=>e.defs&&e.defs.length?m.svg`<defs>${e.defs.map(n=>m.svg`<linearGradient id=${n.id} x1="0" y1="0" x2=${n.vertical===!1?1:0} y2=${n.vertical===!1?0:1}>${n.stops.map(t=>m.svg`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${(0,w.ifDefined)(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:m.nothing,be=e=>m.svg`${e.map((n,t)=>{let r=n.title?m.svg`<title>${n.title}</title>`:m.nothing,i=n.item?t:void 0;switch(n.kind){case"path":return m.svg`<path data-skdx-part=${n.part} data-skdx-i=${(0,w.ifDefined)(i)} d=${n.d} fill=${n.fill??"none"} stroke=${(0,w.ifDefined)(n.stroke)} stroke-width=${(0,w.ifDefined)(n.strokeWidth)} stroke-linecap=${(0,w.ifDefined)(n.strokeLinecap)} stroke-linejoin=${(0,w.ifDefined)(n.strokeLinejoin)} stroke-dasharray=${(0,w.ifDefined)(n.dash)} opacity=${(0,w.ifDefined)(n.opacity)} fill-opacity=${(0,w.ifDefined)(n.fillOpacity)}>${r}</path>`;case"rect":return m.svg`<rect data-skdx-part=${n.part} data-skdx-i=${(0,w.ifDefined)(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${(0,w.ifDefined)(n.rx)} fill=${n.fill} stroke=${(0,w.ifDefined)(n.stroke)} fill-opacity=${(0,w.ifDefined)(n.opacity)}>${r}</rect>`;case"line":return m.svg`<line data-skdx-part=${n.part} data-skdx-i=${(0,w.ifDefined)(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${(0,w.ifDefined)(n.strokeWidth)} stroke-dasharray=${(0,w.ifDefined)(n.dash)} opacity=${(0,w.ifDefined)(n.opacity)}>${r}</line>`;case"circle":return m.svg`<circle data-skdx-part=${n.part} data-skdx-i=${(0,w.ifDefined)(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${(0,w.ifDefined)(n.stroke)} opacity=${(0,w.ifDefined)(n.opacity)}>${r}</circle>`;case"text":return m.svg`<text data-skdx-part=${n.part} data-skdx-i=${(0,w.ifDefined)(i)} x=${n.x} y=${n.y} text-anchor=${(0,w.ifDefined)(n.anchor)} dominant-baseline=${(0,w.ifDefined)(n.baseline)} fill=${(0,w.ifDefined)(n.fill)} font-weight=${(0,w.ifDefined)(n.weight)} pointer-events=${(0,w.ifDefined)(i===void 0?"none":void 0)} transform=${(0,w.ifDefined)(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var D=class extends x{constructor(){super(...arguments);this.events=[];this.labels=!0}render(){let{events:t,orientation:r,xAxis:i,labels:o}=this;return this.root(De({...this.sized(),events:t,orientation:r,xAxis:i,labels:o}),"timeline",this.label??"Timeline chart")}};u([(0,V.property)({attribute:!1})],D.prototype,"events",2),u([(0,V.property)()],D.prototype,"orientation",2),u([(0,V.property)({attribute:!1})],D.prototype,"xAxis",2),u([(0,V.property)({type:Boolean,attribute:"no-labels",converter:ft})],D.prototype,"labels",2),D=u([(0,V.customElement)("skdx-timeline-chart")],D);0&&(module.exports={SkdxTimelineChart});