@skdx/web-components-charts 0.38.0 → 0.40.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 (167) hide show
  1. package/dist/area.cjs +38 -35
  2. package/dist/area.d.cts +1 -1
  3. package/dist/area.d.ts +1 -1
  4. package/dist/area.js +28 -25
  5. package/dist/bar.cjs +38 -35
  6. package/dist/bar.d.cts +1 -1
  7. package/dist/bar.d.ts +1 -1
  8. package/dist/bar.js +28 -25
  9. package/dist/boxplot.cjs +33 -30
  10. package/dist/boxplot.d.cts +1 -1
  11. package/dist/boxplot.d.ts +1 -1
  12. package/dist/boxplot.js +40 -37
  13. package/dist/bubble.cjs +37 -34
  14. package/dist/bubble.d.cts +1 -1
  15. package/dist/bubble.d.ts +1 -1
  16. package/dist/bubble.js +25 -22
  17. package/dist/bullet.cjs +40 -37
  18. package/dist/bullet.d.cts +1 -1
  19. package/dist/bullet.d.ts +1 -1
  20. package/dist/bullet.js +40 -37
  21. package/dist/bump.cjs +38 -35
  22. package/dist/bump.d.cts +1 -1
  23. package/dist/bump.d.ts +1 -1
  24. package/dist/bump.js +38 -35
  25. package/dist/candlestick.cjs +38 -35
  26. package/dist/candlestick.d.cts +1 -1
  27. package/dist/candlestick.d.ts +1 -1
  28. package/dist/candlestick.js +40 -37
  29. package/dist/chord.cjs +40 -37
  30. package/dist/chord.d.cts +1 -1
  31. package/dist/chord.d.ts +1 -1
  32. package/dist/chord.js +38 -35
  33. package/dist/circle-packing.cjs +31 -28
  34. package/dist/circle-packing.d.cts +1 -1
  35. package/dist/circle-packing.d.ts +1 -1
  36. package/dist/circle-packing.js +30 -27
  37. package/dist/combo.cjs +38 -35
  38. package/dist/combo.d.cts +1 -1
  39. package/dist/combo.d.ts +1 -1
  40. package/dist/combo.js +28 -25
  41. package/dist/dumbbell.cjs +37 -34
  42. package/dist/dumbbell.d.cts +1 -1
  43. package/dist/dumbbell.d.ts +1 -1
  44. package/dist/dumbbell.js +40 -37
  45. package/dist/funnel.cjs +30 -27
  46. package/dist/funnel.d.cts +1 -1
  47. package/dist/funnel.d.ts +1 -1
  48. package/dist/funnel.js +40 -37
  49. package/dist/gantt.cjs +40 -37
  50. package/dist/gantt.d.cts +1 -1
  51. package/dist/gantt.d.ts +1 -1
  52. package/dist/gantt.js +30 -27
  53. package/dist/gauge.cjs +35 -32
  54. package/dist/gauge.d.cts +1 -1
  55. package/dist/gauge.d.ts +1 -1
  56. package/dist/gauge.js +39 -36
  57. package/dist/heatmap.cjs +38 -35
  58. package/dist/heatmap.d.cts +1 -1
  59. package/dist/heatmap.d.ts +1 -1
  60. package/dist/heatmap.js +30 -27
  61. package/dist/histogram.cjs +40 -37
  62. package/dist/histogram.d.cts +1 -1
  63. package/dist/histogram.d.ts +1 -1
  64. package/dist/histogram.js +30 -27
  65. package/dist/icicle.cjs +40 -37
  66. package/dist/icicle.d.cts +1 -1
  67. package/dist/icicle.d.ts +1 -1
  68. package/dist/icicle.js +40 -37
  69. package/dist/{index-oF5ss8v9.d.cts → index-D44-61v7.d.cts} +11 -5
  70. package/dist/{index-oF5ss8v9.d.ts → index-D44-61v7.d.ts} +11 -5
  71. package/dist/index.cjs +40 -37
  72. package/dist/index.d.cts +2 -2
  73. package/dist/index.d.ts +2 -2
  74. package/dist/index.js +40 -37
  75. package/dist/line.cjs +38 -35
  76. package/dist/line.d.cts +1 -1
  77. package/dist/line.d.ts +1 -1
  78. package/dist/line.js +28 -25
  79. package/dist/linear-gauge.cjs +40 -37
  80. package/dist/linear-gauge.d.cts +1 -1
  81. package/dist/linear-gauge.d.ts +1 -1
  82. package/dist/linear-gauge.js +40 -37
  83. package/dist/map.cjs +40 -37
  84. package/dist/map.d.cts +1 -1
  85. package/dist/map.d.ts +1 -1
  86. package/dist/map.js +40 -37
  87. package/dist/marimekko.cjs +32 -29
  88. package/dist/marimekko.d.cts +1 -1
  89. package/dist/marimekko.d.ts +1 -1
  90. package/dist/marimekko.js +33 -30
  91. package/dist/network.cjs +26 -23
  92. package/dist/network.d.cts +1 -1
  93. package/dist/network.d.ts +1 -1
  94. package/dist/network.js +40 -37
  95. package/dist/organization.cjs +29 -26
  96. package/dist/organization.d.cts +1 -1
  97. package/dist/organization.d.ts +1 -1
  98. package/dist/organization.js +40 -37
  99. package/dist/parallel.cjs +25 -22
  100. package/dist/parallel.d.cts +1 -1
  101. package/dist/parallel.d.ts +1 -1
  102. package/dist/parallel.js +37 -34
  103. package/dist/pareto.cjs +40 -37
  104. package/dist/pareto.d.cts +1 -1
  105. package/dist/pareto.d.ts +1 -1
  106. package/dist/pareto.js +26 -23
  107. package/dist/pie.cjs +40 -37
  108. package/dist/pie.d.cts +1 -1
  109. package/dist/pie.d.ts +1 -1
  110. package/dist/pie.js +39 -36
  111. package/dist/polar-area.cjs +40 -37
  112. package/dist/polar-area.d.cts +1 -1
  113. package/dist/polar-area.d.ts +1 -1
  114. package/dist/polar-area.js +40 -37
  115. package/dist/radar.cjs +27 -24
  116. package/dist/radar.d.cts +1 -1
  117. package/dist/radar.d.ts +1 -1
  118. package/dist/radar.js +40 -37
  119. package/dist/radial.cjs +39 -36
  120. package/dist/radial.d.cts +1 -1
  121. package/dist/radial.d.ts +1 -1
  122. package/dist/radial.js +39 -36
  123. package/dist/range.cjs +40 -37
  124. package/dist/range.d.cts +1 -1
  125. package/dist/range.d.ts +1 -1
  126. package/dist/range.js +30 -27
  127. package/dist/sankey.cjs +29 -26
  128. package/dist/sankey.d.cts +1 -1
  129. package/dist/sankey.d.ts +1 -1
  130. package/dist/sankey.js +40 -37
  131. package/dist/scatter.cjs +38 -35
  132. package/dist/scatter.d.cts +1 -1
  133. package/dist/scatter.d.ts +1 -1
  134. package/dist/scatter.js +31 -28
  135. package/dist/sparkline.cjs +23 -20
  136. package/dist/sparkline.d.cts +1 -1
  137. package/dist/sparkline.d.ts +1 -1
  138. package/dist/sparkline.js +38 -35
  139. package/dist/sunburst.cjs +40 -37
  140. package/dist/sunburst.d.cts +1 -1
  141. package/dist/sunburst.d.ts +1 -1
  142. package/dist/sunburst.js +40 -37
  143. package/dist/swarm.cjs +36 -33
  144. package/dist/swarm.d.cts +1 -1
  145. package/dist/swarm.d.ts +1 -1
  146. package/dist/swarm.js +37 -34
  147. package/dist/timeline.cjs +24 -21
  148. package/dist/timeline.d.cts +1 -1
  149. package/dist/timeline.d.ts +1 -1
  150. package/dist/timeline.js +40 -37
  151. package/dist/tree.cjs +24 -21
  152. package/dist/tree.d.cts +1 -1
  153. package/dist/tree.d.ts +1 -1
  154. package/dist/tree.js +38 -35
  155. package/dist/treemap.cjs +27 -24
  156. package/dist/treemap.d.cts +1 -1
  157. package/dist/treemap.d.ts +1 -1
  158. package/dist/treemap.js +40 -37
  159. package/dist/waffle.cjs +21 -18
  160. package/dist/waffle.d.cts +1 -1
  161. package/dist/waffle.d.ts +1 -1
  162. package/dist/waffle.js +37 -34
  163. package/dist/waterfall.cjs +33 -30
  164. package/dist/waterfall.d.cts +1 -1
  165. package/dist/waterfall.d.ts +1 -1
  166. package/dist/waterfall.js +34 -31
  167. package/package.json +3 -3
package/dist/parallel.js CHANGED
@@ -1,61 +1,62 @@
1
- var Ot=Object.defineProperty;var At=Object.getOwnPropertyDescriptor;var h=(e,n,t,r)=>{for(var i=r>1?void 0:r?At(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&&Ot(n,t,i),i};import{customElement as en,property as K}from"lit/decorators.js";var ot=e=>Number(e.toPrecision(12)),Lt,Pt=e=>(Lt??(Lt=new Intl.NumberFormat)).format(ot(e)),Bt=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 st(e){if(e===void 0)return Pt;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:i="",timeZone:o}=e,s=u=>i?d=>u(d)+i:u,a=u=>r===void 0?u===void 0?{}:{maximumFractionDigits:u}:{minimumFractionDigits:r,maximumFractionDigits:r},l=u=>{let d=new Intl.NumberFormat(t,u);return s(p=>d.format(ot(p)))},c=u=>{let d=new Intl.DateTimeFormat(t,o?{...u,timeZone:o}:u);return p=>d.format(p)};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 c({dateStyle:"medium"});case"time":return c({timeStyle:"short"});case"datetime":return c({dateStyle:"medium",timeStyle:"short"});case"duration":return s(Bt)}}function fe([e,n],[t,r]){let i=n-e;return o=>i===0?t:t+(o-e)/i*(r-t)}function me(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,a=Math.floor(e/s)*s,l=Math.ceil(n/s)*s,c=[];for(let u=a;u<=l+s/2;u+=s)c.push(Rt(u));return c}var Rt=e=>Number(e.toPrecision(12)),b=e=>Number(e.toFixed(2)),ge=e=>typeof e=="number"&&Number.isFinite(e);function be(e){let n=1/0,t=-1/0;for(let r of e)ge(r)&&(r<n&&(n=r),r>t&&(t=r));return n===1/0?[0,0]:[n,t]}function at(e,n="linear"){if(e.length===0)return"";let t=e[0];if(n==="step"||n==="stepBefore"||n==="stepAfter"){let c=`M${t.x} ${t.y}`;for(let u=1;u<e.length;u++){let d=e[u-1],p=e[u];n==="stepAfter"?c+=`H${p.x}V${p.y}`:n==="stepBefore"?c+=`V${p.y}H${p.x}`:c+=`H${b((d.x+p.x)/2)}V${p.y}H${p.x}`}return c}if(n==="linear"||e.length<3)return`M${e.map(c=>`${c.x} ${c.y}`).join("L")}`;let r=e.length,i=e.slice(1).map((c,u)=>c.x-e[u].x),o=e.slice(1).map((c,u)=>c.y-e[u].y),s=i.map((c,u)=>c===0?0:o[u]/c),a=[s[0]];for(let c=1;c<r-1;c++){let u=s[c-1],d=s[c];a.push(u*d<=0?0:(u+d)/2)}a.push(s[r-2]);for(let c=0;c<r-1;c++){let u=s[c];if(u===0){a[c]=0,a[c+1]=0;continue}let d=a[c]/u,p=a[c+1]/u,w=Math.hypot(d,p);w>3&&(a[c]=3*d*u/w,a[c+1]=3*p*u/w)}let l=`M${t.x} ${t.y}`;for(let c=0;c<r-1;c++){let u=e[c],d=e[c+1],p=i[c]/3;l+=`C${b(u.x+p)} ${b(u.y+p*a[c])} ${b(d.x-p)} ${b(d.y-p*a[c+1])} ${d.x} ${d.y}`}return l}var Y=1e3,q=60*Y,X=60*q,ne=24*X,rn=[Y,5*Y,15*Y,30*Y,q,5*q,15*q,30*q,X,3*X,6*X,12*X,ne,2*ne,7*ne,14*ne];var Nt=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,Dt=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,Gt={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function Ft(e,n,t){return e.replace(Dt,(r,i,o)=>{let s=Gt[i];if(s===void 0)return i+o;let l=(o.match(Nt)??[]).map((c,u)=>{let d=Number(c);if(s===-1)return String(d+n);if(s===-2)return String(d+t);let p=u%s;return s===7?p===5?String(d+n):p===6?String(d+t):c:String(p%2===0?d+n:d+t)});return i+l.join(" ")})}var lt=(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:Ft(r.d,n,t)}}});var xe=["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)"))),v={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)"};var ct=(e,n)=>n??xe[e%xe.length];var jt={top:16,right:16,bottom:32,left:48};function ut(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 Q(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function dt(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var re=20,Ht=120,ht=e=>{let n=Q(e);return n&&(n.position==="left"||n.position==="right")?n.width??Ht:0},ve=(e,n=600,t=300)=>({width:(e.width??n)-ht(e),height:(e.height??t)-(Q(e)?.position==="bottom"?re:0)}),pt=e=>{let n=Q(e);return n&&(n.position===void 0||n.position==="top")?re:0},Z=6.5,ie=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:ct(n)),ft=(e,n)=>e.hiddenSeries?.includes(n)??!1;function ye(e,n,t=[],r={},i=10,o=8,s=!1){let a=[],l=r.maxItems,c=l!==void 0&&l>=0&&e.length>l?e.slice(0,l):e,u=e.length-c.length,d=r.interactive??!0,p=o,w=i,k=(S,I,C,B)=>{let N=(I?18:4)+S.length*Z;p>o&&(s||p+N>n-8)&&(p=o,w+=re),I&&a.push({kind:"rect",part:"legend-swatch",x:p,y:w-5,width:10,height:10,fill:I,opacity:B?.3:void 0,item:C}),a.push({kind:"text",part:"legend-label",x:p+(I?14:0),y:w,text:S,baseline:"middle",fill:B?v.grid:v.label,item:C}),p+=N+12};for(let S of c){let I=t.includes(S.name),C=d?{label:S.name,series:S.name,legend:!0}:void 0;k(r.formatter?.(S.name)??S.name,S.color,C,I)}return u>0&&k(`+${u} more`,void 0,void 0,!1),r.align==="end"?Vt(a,n):a}function Vt(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*Z)),s=n-8-o;for(let a of i)r.push({...a,x:a.x+s})}return r}var Zt=(e,n,t={})=>new Set(ye(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function we(e,n,t,r=[]){let i=Q(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,s=dt(e),a=o?.position==="bottom",l=ht(e),c=e.hiddenSeries??[],u=o?l?ye(r,1/0,c,o,10,(o.position==="right"?n:0)+8,!0):ye(r,n,c,o,a?t+10:10):[],d=a?Zt(r,n,o):0;return{width:n+l,height:a?t+Math.max(1,d)*re: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:u}}function ke(e){let n=e.legendOffset;if(!n)return e;let t=[...lt(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 oe(e,n,t,r,i,o="auto"){let s=Array.isArray(t)?t:[t],a=Math.max(...s.map(p=>p.length))*Z+12,l=6+s.length*16,c=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},u=Math.max(0,Math.min(r-a,c.x)),d=Math.max(0,Math.min(i-l,c.y));return[{kind:"rect",part:"tooltip",x:b(u),y:b(d),width:b(a),height:l,fill:"var(--skdx-color-surface-raised)",stroke:v.axis,rx:3},...s.map((p,w)=>({kind:"text",part:"tooltip-label",x:b(u+6),y:b(d+11+w*16),text:p,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:s.length>1&&w===0?"bold":void 0}))]}function mt(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}=ve(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)":v.label}),{...we(e,o,s),shapes:l,tooltip:!1}}var Me=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:v.label,...r});function se(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var Se=e=>e.id??e.name??e.series,gt=e=>e.seriesId??e.series;function G(e,n){let t=!1;return n.id!==void 0&&(t=!0,Se(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,gt(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 j(e){let n={},t=Se(e);t!==void 0&&(n.id=t);let r=gt(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var $e=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function Ce(e,n,t){let r=se(e),i=j(n),o=r.some(s=>G(n,s));return t==="single"?o?[]:[i]:o?r.filter(s=>!G(n,s)):[...r,i]}var _t=.2;function Wt(e){let n=v.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 Et=(e,n)=>e.kind==="text"?{...e,fill:v.grid}:{...e,opacity:(e.opacity??1)*n};function Ie(e,n){let t=se(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:se(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=u=>!i||r.some(d=>G(u,d))?!0:o.highlighted==="series"?r.some(d=>d.series!==void 0&&G(u,{series:d.series})):!1,l=u=>{if(!i||o.faded==="none"||a(u))return!1;if(o.faded==="series"){let d=i.series;return d!==void 0&&G(u,{series:d})}return!0},c=e.shapes.map(u=>{let d=u.item;if(!d||d.legend)return u;if(t.some(p=>G(d,p))){let p=Wt(u);p&&s.push(p)}return l(d)?Et(u,_t):u});return s.length?{...e,shapes:[...c,...s]}:{...e,shapes:c}}function U(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 Te=(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 J(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 ze(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:v.axis,dash:"3 3"}}function Oe(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!Te(r.plot,n,t))return[];let i=ze(e,n),{rows:o}=J(e,n),s=e.tooltipAnchored?r.plot.y+8:t;return[i,...oe(i.x1,s,o,e.width,e.height,e.tooltipPlacement)]}function Ae(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 Oe(e,i,t.plot.y+8)}function Le(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:l,y:c}=U(t,r,i,e.width,e.height);if(Te(e.hit.plot,l,c)){let u=J(e,l),d=ze(e,l);if(u&&d)return{lines:u.rows,shapes:[d]}}}let o=n?.closest?.("[data-skdx-part]"),s=e.tooltipFormatter?H(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 xt(e,n,t,r,i,o,s){let a=e?.closest?.("[data-skdx-part]"),l=s&&s.tooltipFormatter?H(s,e)?.item:void 0,c=l&&s?.tooltipFormatter?.(l)||a&&Array.from(a.children).find(k=>k.tagName.toLowerCase()==="title")?.textContent;if(!c)return[];let u=s?.tooltipAnchored?H(s,e):void 0,d=u?s?.shapes[u.index]:void 0,{x:p,y:w}=d?ee(d):U(n,t,r,i,o);return oe(p,w,c,i,o,s?.tooltipPlacement)}function Pe(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:s}=U(t,r,i,e.width,e.height),a=Oe(e,o,s);if(a.length>0)return a}return xt(n,t,r,i,e.width,e.height,e)}function Be(e,n){let t=H(e,n);return t&&!t.item.legend?j(t.item):null}var Ut=(e,n)=>{let{x:t,y:r}=ee(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 Re(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!Ut(i,n))continue;let o=j(i.item),s=JSON.stringify(o);t.has(s)||(t.add(s),r.push(o))}return r}var Ne=e=>({kind:"rect",part:"selection-box",x:b(e.x),y:b(e.y),width:b(e.width),height:b(e.height),fill:v.focus,opacity:.12,stroke:v.focus}),le=(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 yt(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 De(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}=ee(i),a=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:s;if(!yt(n,o,a))continue;let l=j(i.item),c=JSON.stringify(l);t.has(c)||(t.add(c),r.push(l))}return r}var Ge=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${b(n.x)} ${b(n.y)}`).join("L")}`:"",fill:v.focus,fillOpacity:.12,stroke:v.focus,dash:"4 3"}),ae=6;function Fe(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-ae||n>i.x1+ae))return Math.abs(n-i.x0)<=ae?{bar:i,mode:"start"}:Math.abs(n-i.x1)<=ae?{bar:i,mode:"end"}:{bar:i,mode:"move"}}}function je(e,n,t){let r=e.edit;return vt(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function He(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 vt(r,{bar:o,mode:s},i*a)}function vt(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 Ve(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:v.focus,opacity:.25,stroke:v.focus,rx:2}}var Kt=64,Yt=e=>Math.max(1,Math.min(Kt,e));function Ze(e,n,t,r){let i=n>0?.8:1.25,o=Yt(e.view.zoom*i);if(o===e.view.zoom)return e.view;let{plot:s,scale:a}=e,[l,c]=e.view.center,u=(t-(s.x+s.width/2))/a,d=(r-(s.y+s.height/2))/a,p=e.view.zoom/o;return{center:[l+u*(1-p),e.fromY(e.toY(c)-d*(1-p))],zoom:o}}function _e(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 H(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 ce=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function ee(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 We(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let r=v.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*Z+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}=ee(t),a=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...a?oe(b(o),b(s),a,e.width,e.height):[]]}function Ee(e,n,t){let r=ce(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 W=2,E=(e,n,t)=>{let r=Math.max(W,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},wt=(e,n)=>!e||e.start<=0&&e.end>=n;function Ue(e,n,t){if(e.count<=W||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,s=n>0?1.25:.8,a=Math.max(W,Math.min(e.count,Math.round(o*s)));if(a===o)return n>0&&!wt(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)),c=r+l*o;return E(c-l*a,a,e.count)}function Ke(e,n,t,r){let i=n.end-n.start,o=Math.max(W,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 Ye(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 qe(e,n,t){let r=e.brush;if(!r||!Te(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 Xe(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-W,Math.round(t.start+o))),end:t.end};let s=Math.min(e.count,Math.max(t.start+W,Math.round(t.end+o)));return{start:t.start,end:s}}function Je(e,n){switch(n.type){case"svg":return Promise.resolve(Qe(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=Qe(e,n.label,n.resolve);return St(t,e.width,e.height,n.scale,n.background)}}}var F=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;"),te=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${F(String(t))}"`).join("");function kt(e){let n=e.title?`<title>${F(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${te([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${te([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${te([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${te([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${te([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]])}>${F(e.text)}</text>`}}function Mt(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${F(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="${F(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function Qe(e,n,t){let r=Mt(e)+e.shapes.map(kt).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="${F(n)}" font-family="${F(v.fontFamily)}" font-size="${F(v.fontSize)}"><title>${F(n)}</title>${r}</svg>`}function St(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 c=document.createElement("canvas");c.width=Math.round(n*r),c.height=Math.round(t*r);let u=c.getContext("2d");if(!u)return s(new Error("canvas 2d context unavailable"));i&&(u.fillStyle=i,u.fillRect(0,0,c.width,c.height)),u.drawImage(l,0,0,c.width,c.height),c.toBlob(d=>d?o(d):s(new Error("toBlob failed")),"image/png")},l.onerror=()=>{URL.revokeObjectURL(a),s(new Error("svg could not be decoded"))},l.src=a})}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 et(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(u=>u.replace(/:\s[^:]*$/,""))],c=r.rows.map(u=>[u[0],...u.slice(1).map(d=>d.slice(d.lastIndexOf(": ")+2))]);return[l,...c]}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 tt=new Map;function ue(e){let n=tt.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&&tt.delete(e)}},publish(o,s){Object.assign(r,o);for(let a of t)a(o,s)}};return tt.set(e,{group:i,listeners:t}),i}var Ct='[data-skdx-part]:not([data-skdx-part^="tooltip"]):not([data-skdx-part="focus"]):not([data-skdx-part="crosshair"])',nt=`@keyframes skdx-in{from{opacity:0}to{opacity:1}}${Ct}{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){${Ct}{animation:none;transition:none}}`;function rt(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}var It=500;function it(e){let n=[],t=e.dimensions,r=e.data.filter(m=>!(m.group!==void 0&&ft(e,m.group))),i=mt(e,t.length===0||r.length===0);if(i)return{...i,issues:n};let{width:o,height:s}=ve(e),a=[...new Set(e.data.map(m=>m.group).filter(m=>m!==void 0))],l=t[0],c=t[t.length-1],u=m=>(m.label??m.key).length*Z/2+8,d=ut(o,s,{top:28+pt(e),right:Math.max(16,u(c)),bottom:16,left:Math.max(48,u(l))}),p=(m,T)=>{let $=m.values[T];return $==null?null:ge($)?$:(n.push({code:"invalid-value",severity:"warning",message:`"${m.name}" has a value on "${T}" that is not a number; drawn as a gap.`,itemId:m.id??m.name}),null)},w=t.map((m,T)=>{let[$,O]=be(r.map(_=>p(_,m.key))),D=me(m.min??$,m.max??O),z=m.min??D[0],L=m.max??D[D.length-1],he=m.reversed?[d.y,d.y+d.height]:[d.y+d.height,d.y],pe=fe([z,L],he),Tt=b(t.length===1?d.x+d.width/2:d.x+T*d.width/(t.length-1)),zt=st(m.format??e.format);return{d:m,x:Tt,scale:_=>b(pe(Math.max(z,Math.min(L,_)))),format:zt,ticks:D.filter(_=>_>=z-1e-9&&_<=L+1e-9)}}),k=[];w.forEach((m,T)=>{k.push({kind:"line",part:"axis",x1:m.x,x2:m.x,y1:d.y,y2:d.y+d.height,stroke:v.axis});let $=T===w.length-1&&w.length>1?"start":"end";for(let O of m.ticks)k.push(Me(b($==="end"?m.x-6:m.x+6),m.scale(O),m.format(O),{part:"y-label",anchor:$,baseline:"middle"}));k.push(Me(m.x,d.y-12,m.d.label??m.d.key,{part:"axis-title",anchor:"middle"}))});let S=r.length<=It,I=e.opacity??(r.length>200?.25:.6),C=m=>(e.filters??[]).every(T=>{let $=p(m,T.key);return $!==null&&$>=(T.min??-1/0)&&$<=(T.max??1/0)}),B=r.map((m,T)=>{let $=[],O=[];for(let z of w){let L=p(m,z.d.key);if(L===null){!e.connectNulls&&O.length&&($.push(O),O=[]);continue}O.push({x:z.x,y:z.scale(L)})}O.length&&$.push(O);let D=`${m.name}: ${w.map(z=>{let L=p(m,z.d.key);return`${z.d.label??z.d.key} ${L===null?"\u2014":z.format(L)}`}).join(" \xB7 ")}`;return{kind:"path",part:"row",d:$.map(z=>at(z,e.curve)).join(""),stroke:m.color??(m.group!==void 0?ie(e,a.indexOf(m.group)):ie(e,0)),strokeWidth:1.5,strokeLinejoin:"round",opacity:C(m)?I:.08,title:S?D:void 0,item:S?{label:D,id:m.id??m.name,name:m.name,category:m.group,index:T}:void 0}}),N=we(e,o,s,a.map((m,T)=>({name:m,color:ie(e,T)})));return{...N,shapes:[...k,...B,...N.shapes],issues:n}}import{css as qt,html as V,LitElement as Xt,nothing as M,svg as A}from"lit";import{property as f,state as P}from"lit/decorators.js";import{ifDefined as y}from"lit/directives/if-defined.js";var Qt={fromAttribute:()=>!1},g=class extends Xt{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=[Ne(le(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=[Ge(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=je(r,i.gantt,o-i.x),this.overlay=[Ve(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(_e(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(Ke(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"?Ye(r.hit,i.zoom,o-i.x):Xe(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:s}=Le(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=Pe(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(Be(r,t.target)),this.syncId&&r.hit?.crosshair){let o=J(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=H(r,t.target)?.item.legend,a=this.canEdit(r)?Fe(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 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 l=r.hit;if(!(!l||!this.canZoom(r))){if(this.pointers.set(t.pointerId,i),this.pointers.size===2){let[c,u]=[...this.pointers.values()];this.drag={x:(c+u)/2,y:o,zoom:l.zoom,grab:"pinch",distance:Math.abs(c-u)||1}}else{let c=qe(l,i,o);if(c)this.drag={x:i,y:o,zoom:c.zoom,grab:c.grab},c.zoom!==l.zoom&&this.setZoom(c.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(Re(o,le(i.x,i.y,s,a))):i.grab==="lasso"?this.setSelected(De(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(Ze(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=Ue(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=H(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)?He(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=Ee(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?j(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:c,emptyMessage:u,description:d,decorative:p,animated:w,responsive:k,highlighted:S,highlightScope:I,accessibleTable:C}=this;return{...typeof k=="object"&&this.measured!==void 0&&this.measured<(k.breakpoint??480)?k.compact:void 0,width:k&&this.measured?this.measured:t,height:r,animate:w,responsive:k,legend:i,tooltip:o,format:s,palette:a,loading:l,error:c,emptyMessage:u,description:d,decorative:p,highlighted:S===void 0?this.highlightState:S,highlightScope:I,accessibleTable:C,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&&ue(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=ue(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&&$e(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(Ce(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 U(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&&G(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?Je(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=Ie(ke(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let C of o.issues??[])this.emit("skdx-data-issue",C)}let s=this.canZoom(o),a=this.canPan(o),l=this.canEdit(o),c=this.brushing(),u=s||a||l||c,d=!o.decorative&&ce(o).length>0,p=o.description?`${r}-desc`:void 0,w=rt(o),k=et(o,this.accessibleTable),S=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,I=this.portal;return V`<svg
1
+ var Pt=Object.defineProperty;var Bt=Object.getOwnPropertyDescriptor;var d=(e,n,t,r)=>{for(var i=r>1?void 0:r?Bt(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&&Pt(n,t,i),i};import{customElement as on,property as K}from"lit/decorators.js";var st=e=>Number(e.toPrecision(12)),Dt,Nt=e=>(Dt??(Dt=new Intl.NumberFormat)).format(st(e)),Gt=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 at(e){if(e===void 0)return Nt;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:i="",timeZone:o}=e,s=u=>i?h=>u(h)+i:u,a=u=>r===void 0?u===void 0?{}:{maximumFractionDigits:u}:{minimumFractionDigits:r,maximumFractionDigits:r},l=u=>{let h=new Intl.NumberFormat(t,u);return s(p=>h.format(st(p)))},c=u=>{let h=new Intl.DateTimeFormat(t,o?{...u,timeZone:o}:u);return p=>h.format(p)};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 c({dateStyle:"medium"});case"time":return c({timeStyle:"short"});case"datetime":return c({dateStyle:"medium",timeStyle:"short"});case"duration":return s(Gt)}}function ge([e,n],[t,r]){let i=n-e;return o=>i===0?t:t+(o-e)/i*(r-t)}function be(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,a=Math.floor(e/s)*s,l=Math.ceil(n/s)*s,c=[];for(let u=a;u<=l+s/2;u+=s)c.push(Ft(u));return c}var Ft=e=>Number(e.toPrecision(12)),x=e=>Number(e.toFixed(2)),xe=e=>typeof e=="number"&&Number.isFinite(e);function ye(e){let n=1/0,t=-1/0;for(let r of e)xe(r)&&(r<n&&(n=r),r>t&&(t=r));return n===1/0?[0,0]:[n,t]}function lt(e,n="linear"){if(e.length===0)return"";let t=e[0];if(n==="step"||n==="stepBefore"||n==="stepAfter"){let c=`M${t.x} ${t.y}`;for(let u=1;u<e.length;u++){let h=e[u-1],p=e[u];n==="stepAfter"?c+=`H${p.x}V${p.y}`:n==="stepBefore"?c+=`V${p.y}H${p.x}`:c+=`H${x((h.x+p.x)/2)}V${p.y}H${p.x}`}return c}if(n==="linear"||e.length<3)return`M${e.map(c=>`${c.x} ${c.y}`).join("L")}`;let r=e.length,i=e.slice(1).map((c,u)=>c.x-e[u].x),o=e.slice(1).map((c,u)=>c.y-e[u].y),s=i.map((c,u)=>c===0?0:o[u]/c),a=[s[0]];for(let c=1;c<r-1;c++){let u=s[c-1],h=s[c];a.push(u*h<=0?0:(u+h)/2)}a.push(s[r-2]);for(let c=0;c<r-1;c++){let u=s[c];if(u===0){a[c]=0,a[c+1]=0;continue}let h=a[c]/u,p=a[c+1]/u,M=Math.hypot(h,p);M>3&&(a[c]=3*h*u/M,a[c+1]=3*p*u/M)}let l=`M${t.x} ${t.y}`;for(let c=0;c<r-1;c++){let u=e[c],h=e[c+1],p=i[c]/3;l+=`C${x(u.x+p)} ${x(u.y+p*a[c])} ${x(h.x-p)} ${x(h.y-p*a[c+1])} ${h.x} ${h.y}`}return l}var Y=1e3,q=60*Y,X=60*q,re=24*X,ln=[Y,5*Y,15*Y,30*Y,q,5*q,15*q,30*q,X,3*X,6*X,12*X,re,2*re,7*re,14*re];var jt=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,Ht=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,_t={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function Et(e,n,t){return e.replace(Ht,(r,i,o)=>{let s=_t[i];if(s===void 0)return i+o;let l=(o.match(jt)??[]).map((c,u)=>{let h=Number(c);if(s===-1)return String(h+n);if(s===-2)return String(h+t);let p=u%s;return s===7?p===5?String(h+n):p===6?String(h+t):c:String(p%2===0?h+n:h+t)});return i+l.join(" ")})}var ct=(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:Et(r.d,n,t)}}});var ve=["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)"))),v={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)"};var ut=(e,n)=>n??ve[e%ve.length];var Vt={top:16,right:16,bottom:32,left:48};function dt(e,n,t=Vt){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 ht(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var ie=20,Zt=120,pt=e=>{let n=Q(e);return n&&(n.position==="left"||n.position==="right")?n.width??Zt:0},oe=(e,n=600,t=300)=>({width:(e.width??n)-pt(e),height:(e.height??t)-(Q(e)?.position==="bottom"?ie:0)}),ft=(e,n,t)=>{let r=Q(e);return!r||!(r.position===void 0||r.position==="top")?0:(n?Math.max(1,gt(n,t??oe(e).width,r)):1)*ie},G=6.5;function Wt(e,n){let t=Array.from(e),r=Math.max(0,Math.floor(n/G));return t.length<=r?e:r===0?"":`${t.slice(0,r-1).join("")}\u2026`}var se=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:ut(n)),mt=(e,n)=>e.hiddenSeries?.includes(n)??!1;function we(e,n,t=[],r={},i=10,o=8,s=!1){let a=[],l=r.maxItems,c=l!==void 0&&l>=0&&e.length>l?e.slice(0,l):e,u=e.length-c.length,h=r.interactive??!0,p=o,M=i,S=(w,k,$,T)=>{let R=(k?18:4)+w.length*G;p>o&&(s||p+R>n-8)&&(p=o,M+=ie),k&&a.push({kind:"rect",part:"legend-swatch",x:p,y:M-5,width:10,height:10,fill:k,opacity:T?.3:void 0,item:$}),a.push({kind:"text",part:"legend-label",x:p+(k?14:0),y:M,text:w,baseline:"middle",fill:T?v.grid:v.label,item:$}),p+=R+12};for(let w of c){let k=t.includes(w.name),$=h?{label:w.name,series:w.name,legend:!0}:void 0;S(r.formatter?.(w.name)??w.name,w.color,$,k)}return u>0&&S(`+${u} more`,void 0,void 0,!1),r.align==="end"?Ut(a,n):a}function Ut(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*G)),s=n-8-o;for(let a of i)r.push({...a,x:a.x+s})}return r}var gt=(e,n,t={})=>new Set(we(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function ke(e,n,t,r=[]){let i=Q(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,s=ht(e),a=o?.position==="bottom",l=pt(e),c=e.hiddenSeries??[],u=o?l?we(r,1/0,c,o,10,(o.position==="right"?n:0)+8,!0):we(r,n,c,o,a?t+10:10):[],h=a?gt(r,n,o):0;return{width:n+l,height:a?t+Math.max(1,h)*ie: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:u}}function Me(e){let n=e.legendOffset;if(!n)return e;let t=[...ct(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 ae(e,n,t,r,i,o="auto"){let s=Array.isArray(t)?t:[t],a=Math.max(1,Math.floor((r-12)/G)),l=s.flatMap(k=>{let $=[],T=Array.from(k);for(;T.length>a;){let R=T.slice(0,a+1).lastIndexOf(" ");R<1&&(R=a),$.push(T.slice(0,R).join("")),T=T.slice(R),T[0]===" "&&T.shift()}return $.push(T.join("")),$}),c=Math.max(1,Math.floor((i-6)/16)),u=l.slice(0,c);l.length>c&&(u[c-1]=Wt(`${u[c-1]}\u2026`,r-12));let h=Math.min(r,Math.max(0,...u.map(k=>Array.from(k).length))*G+12),p=Math.min(i,6+u.length*16),M=o==="top"?{x:e-h/2,y:n-p-8}:o==="bottom"?{x:e-h/2,y:n+8}:o==="left"?{x:e-h-8,y:n-p/2}:o==="right"?{x:e+8,y:n-p/2}:{x:e+12,y:n-p-6},S=Math.max(0,Math.min(r-h,M.x)),w=Math.max(0,Math.min(i-p,M.y));return[{kind:"rect",part:"tooltip",title:s.join(`
2
+ `),x:x(S),y:x(w),width:x(h),height:p,fill:"var(--skdx-color-surface-raised)",stroke:v.axis,rx:8},...u.map((k,$)=>({kind:"text",part:"tooltip-label",x:x(S+6),y:x(w+11+$*16),text:k,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:u.length>1&&$===0?"bold":void 0}))]}function bt(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}=oe(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:8}),l.push({kind:"text",part:`state-${i}`,x:x(o/2),y:x(s/2),text:a,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":v.label}),{...ke(e,o,s),shapes:l,tooltip:!1}}var Se=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:v.label,...r});function le(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var $e=e=>e.id??e.name??e.series,xt=e=>e.seriesId??e.series;function F(e,n){let t=!1;return n.id!==void 0&&(t=!0,$e(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,xt(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=$e(e);t!==void 0&&(n.id=t);let r=xt(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var Ce=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function Ie(e,n,t){let r=le(e),i=H(n),o=r.some(s=>F(n,s));return t==="single"?o?[]:[i]:o?r.filter(s=>!F(n,s)):[...r,i]}var Kt=.2;function Yt(e){let n=v.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 qt=(e,n)=>e.kind==="text"?{...e,fill:v.grid}:{...e,opacity:(e.opacity??1)*n};function Te(e,n){let t=le(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:le(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=u=>!i||r.some(h=>F(u,h))?!0:o.highlighted==="series"?r.some(h=>h.series!==void 0&&F(u,{series:h.series})):!1,l=u=>{if(!i||o.faded==="none"||a(u))return!1;if(o.faded==="series"){let h=i.series;return h!==void 0&&F(u,{series:h})}return!0},c=e.shapes.map(u=>{let h=u.item;if(!h||h.legend)return u;if(t.some(p=>F(h,p))){let p=Yt(u);p&&s.push(p)}return l(h)?qt(u,Kt):u});return s.length?{...e,shapes:[...c,...s]}:{...e,shapes:c}}var yt="var(--skdx-radius-default, var(--skdx-radius-md, 0.5rem))";function ce(e){return["tooltip","skeleton","label-background","stage-label-background","brush-handle"].includes(e)?yt:void 0}function U(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 vt(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 J(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=vt(t,n),i=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(i,r)??i}}function Ae(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[vt(t,n)];return{kind:"line",part:"crosshair",x1:r,x2:r,y1:t.plot.y,y2:t.plot.y+t.plot.height,stroke:v.axis,dash:"3 3"}}function ze(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!Oe(r.plot,n,t))return[];let i=Ae(e,n),{rows:o}=J(e,n),s=e.tooltipAnchored?r.plot.y+8:t;return[i,...ae(i.x1,s,o,e.width,e.height,e.tooltipPlacement)]}function Le(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 ze(e,i,t.plot.y+8)}function Re(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:l,y:c}=U(t,r,i,e.width,e.height);if(Oe(e.hit.plot,l,c)){let u=J(e,l),h=Ae(e,l);if(u&&h)return{lines:u.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 wt(e,n,t,r,i,o,s){let a=e?.closest?.("[data-skdx-part]"),l=s&&s.tooltipFormatter?_(s,e)?.item:void 0,c=l&&s?.tooltipFormatter?.(l)||a&&Array.from(a.children).find(S=>S.tagName.toLowerCase()==="title")?.textContent;if(!c)return[];let u=s?.tooltipAnchored?_(s,e):void 0,h=u?s?.shapes[u.index]:void 0,{x:p,y:M}=h?ee(h):U(n,t,r,i,o);return ae(p,M,c,i,o,s?.tooltipPlacement)}function Pe(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:s}=U(t,r,i,e.width,e.height),a=ze(e,o,s);if(a.length>0)return a}return wt(n,t,r,i,e.width,e.height,e)}function Be(e,n){let t=_(e,n);return t&&!t.item.legend?H(t.item):null}var Xt=(e,n)=>{let{x:t,y:r}=ee(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 De(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!Xt(i,n))continue;let o=H(i.item),s=JSON.stringify(o);t.has(s)||(t.add(s),r.push(o))}return r}var Ne=e=>({kind:"rect",part:"selection-box",x:x(e.x),y:x(e.y),width:x(e.width),height:x(e.height),fill:v.focus,opacity:.12,stroke:v.focus}),de=(e,n,t,r)=>({x:Math.min(e,t),y:Math.min(n,r),width:Math.abs(t-e),height:Math.abs(r-n)});function kt(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 Ge(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}=ee(i),a=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:s;if(!kt(n,o,a))continue;let l=H(i.item),c=JSON.stringify(l);t.has(c)||(t.add(c),r.push(l))}return r}var Fe=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${x(n.x)} ${x(n.y)}`).join("L")}`:"",fill:v.focus,fillOpacity:.12,stroke:v.focus,dash:"4 3"}),ue=6;function je(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 He(e,n,t){let r=e.edit;return Mt(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function _e(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 Mt(r,{bar:o,mode:s},i*a)}function Mt(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 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:v.focus,opacity:.25,stroke:v.focus,rx:2}}var Qt=64,Jt=e=>Math.max(1,Math.min(Qt,e));function Ve(e,n,t,r){let i=n>0?.8:1.25,o=Jt(e.view.zoom*i);if(o===e.view.zoom)return e.view;let{plot:s,scale:a}=e,[l,c]=e.view.center,u=(t-(s.x+s.width/2))/a,h=(r-(s.y+s.height/2))/a,p=e.view.zoom/o;return{center:[l+u*(1-p),e.fromY(e.toY(c)-h*(1-p))],zoom:o}}function Ze(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 he=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function ee(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 We(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let r=v.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}=ee(t),a=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...a?ae(x(o),x(s),a,e.width,e.height):[]]}function Ue(e,n,t){let r=he(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,W=(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}},St=(e,n)=>!e||e.start<=0&&e.end>=n;function Ke(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&&!St(e.zoom,e.count)?W(r,a,e.count):void 0;let l=Math.max(0,Math.min(1,(t-e.plot.x)/e.plot.width)),c=r+l*o;return W(c-l*a,a,e.count)}function Ye(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 W(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 W(n.start-t/i,r,e.count)}function Xe(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:W(s-o/2,o,e.count)}}function Qe(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 W(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 et(e,n){switch(n.type){case"svg":return Promise.resolve(Je(e,n.label,n.resolve));case"csv":return Promise.resolve(Tt(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=Je(e,n.label,n.resolve);return It(t,e.width,e.height,n.scale,n.background)}}}var j=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;"),te=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${j(String(t))}"`).join("");function $t(e){let n=e.title?`<title>${j(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${te([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${te([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${te([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${te([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${te([t,["aria-label",e.title],["x",e.x],["y",e.y],["text-anchor",e.anchor],["dominant-baseline",e.baseline],["fill",e.fill],["font-weight",e.weight],["transform",e.rotate?`rotate(${e.rotate} ${e.x} ${e.y})`:void 0]])}>${j(e.text)}</text>`}}function Ct(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${j(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="${j(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function Je(e,n,t){let r=Ct(e)+e.shapes.map($t).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="${j(n)}" font-family="${j(v.fontFamily)}" font-size="${j(v.fontSize)}"><title>${j(n)}</title>${r}</svg>`}function It(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 c=document.createElement("canvas");c.width=Math.round(n*r),c.height=Math.round(t*r);let u=c.getContext("2d");if(!u)return s(new Error("canvas 2d context unavailable"));i&&(u.fillStyle=i,u.fillRect(0,0,c.width,c.height)),u.drawImage(l,0,0,c.width,c.height),c.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 Tt(e){let n=t=>{let r=t==null?"":String(t);return/[",\n\r]/.test(r)?`"${r.replace(/"/g,'""')}"`:r};return e.map(t=>t.map(n).join(",")).join(`\r
3
+ `)}function tt(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(u=>u.replace(/:\s[^:]*$/,""))],c=r.rows.map(u=>[u[0],...u.slice(1).map(h=>h.slice(h.lastIndexOf(": ")+2))]);return[l,...c]}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 nt=new Map;function pe(e){let n=nt.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&&nt.delete(e)}},publish(o,s){Object.assign(r,o);for(let a of t)a(o,s)}};return nt.set(e,{group:i,listeners:t}),i}var Ot='[data-skdx-part]:not([data-skdx-part^="tooltip"]):not([data-skdx-part="focus"]):not([data-skdx-part="crosshair"])',rt=`@keyframes skdx-in{from{opacity:0}to{opacity:1}}${Ot}{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){${Ot}{animation:none;transition:none}}`;function it(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}var At=500;function ot(e){let n=[],t=e.dimensions,r=e.data.filter(m=>!(m.group!==void 0&&mt(e,m.group))),i=bt(e,t.length===0||r.length===0);if(i)return{...i,issues:n};let{width:o,height:s}=oe(e),a=[...new Set(e.data.map(m=>m.group).filter(m=>m!==void 0))],l=t[0],c=t[t.length-1],u=m=>(m.label??m.key).length*G/2+8,h=a.map((m,O)=>({name:m,color:se(e,O)})),p=dt(o,s,{top:28+ft(e,h,o),right:Math.max(16,u(c)),bottom:16,left:Math.max(48,u(l))}),M=(m,O)=>{let I=m.values[O];return I==null?null:xe(I)?I:(n.push({code:"invalid-value",severity:"warning",message:`"${m.name}" has a value on "${O}" that is not a number; drawn as a gap.`,itemId:m.id??m.name}),null)},S=t.map((m,O)=>{let[I,z]=ye(r.map(V=>M(V,m.key))),N=be(m.min??I,m.max??z),A=m.min??N[0],P=m.max??N[N.length-1],me=m.reversed?[p.y,p.y+p.height]:[p.y+p.height,p.y],zt=ge([A,P],me),Lt=x(t.length===1?p.x+p.width/2:p.x+O*p.width/(t.length-1)),Rt=at(m.format??e.format);return{d:m,x:Lt,scale:V=>x(zt(Math.max(A,Math.min(P,V)))),format:Rt,ticks:N.filter(V=>V>=A-1e-9&&V<=P+1e-9)}}),w=[];S.forEach((m,O)=>{w.push({kind:"line",part:"axis",x1:m.x,x2:m.x,y1:p.y,y2:p.y+p.height,stroke:v.axis});let I=O===S.length-1&&S.length>1?"start":"end";for(let z of m.ticks)w.push(Se(x(I==="end"?m.x-6:m.x+6),m.scale(z),m.format(z),{part:"y-label",anchor:I,baseline:"middle"}));w.push(Se(m.x,p.y-12,m.d.label??m.d.key,{part:"axis-title",anchor:"middle"}))});let k=r.length<=At,$=e.opacity??(r.length>200?.25:.6),T=m=>(e.filters??[]).every(O=>{let I=M(m,O.key);return I!==null&&I>=(O.min??-1/0)&&I<=(O.max??1/0)}),R=r.map((m,O)=>{let I=[],z=[];for(let A of S){let P=M(m,A.d.key);if(P===null){!e.connectNulls&&z.length&&(I.push(z),z=[]);continue}z.push({x:A.x,y:A.scale(P)})}z.length&&I.push(z);let N=`${m.name}: ${S.map(A=>{let P=M(m,A.d.key);return`${A.d.label??A.d.key} ${P===null?"\u2014":A.format(P)}`}).join(" \xB7 ")}`;return{kind:"path",part:"row",d:I.map(A=>lt(A,e.curve)).join(""),stroke:m.color??(m.group!==void 0?se(e,a.indexOf(m.group)):se(e,0)),strokeWidth:1.5,strokeLinejoin:"round",opacity:T(m)?$:.08,title:k?N:void 0,item:k?{label:N,id:m.id??m.name,name:m.name,category:m.group,index:O}:void 0}}),ne=ke(e,o,s,h);return{...ne,shapes:[...w,...R,...ne.shapes],issues:n}}import{css as en,html as E,LitElement as tn,nothing as C,svg as L}from"lit";import{property as f,state as B}from"lit/decorators.js";import{ifDefined as b}from"lit/directives/if-defined.js";var nn={fromAttribute:()=>!1},g=class extends tn{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=[Ne(de(i.x,i.y,o,s))];return}if(i?.grab==="lasso"){let{x:o,y:s}=this.viewBox(t,r);i.points=[...i.points??[],{x:o,y:s}],this.overlay=[Fe(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=He(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(Ze(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(Ye(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"?qe(r.hit,i.zoom,o-i.x):Qe(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:s}=Re(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=Pe(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(Be(r,t.target)),this.syncId&&r.hit?.crosshair){let o=J(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)?je(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 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 l=r.hit;if(!(!l||!this.canZoom(r))){if(this.pointers.set(t.pointerId,i),this.pointers.size===2){let[c,u]=[...this.pointers.values()];this.drag={x:(c+u)/2,y:o,zoom:l.zoom,grab:"pinch",distance:Math.abs(c-u)||1}}else{let c=Xe(l,i,o);if(c)this.drag={x:i,y:o,zoom:c.zoom,grab:c.grab},c.zoom!==l.zoom&&this.setZoom(c.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(De(o,de(i.x,i.y,s,a))):i.grab==="lasso"?this.setSelected(Ge(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(Ve(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=Ke(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=>{if(t.key==="Escape"){t.preventDefault(),this.focused=null,this.clearTip(),this.crossState=null,this.highlight(null);return}let r=this.layout;if(!r)return;if((t.key==="Enter"||t.key===" ")&&this.focused!==null){let a=r.shapes[this.focused]?.item;a&&(t.preventDefault(),this.select(a),this.emit("skdx-item-click",a));return}let i=this.canEdit(r)?_e(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=Ue(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:c,emptyMessage:u,description:h,decorative:p,animated:M,responsive:S,highlighted:w,highlightScope:k,accessibleTable:$}=this;return{...typeof S=="object"&&this.measured!==void 0&&this.measured<(S.breakpoint??480)?S.compact:void 0,width:S&&this.measured?this.measured:t,height:r,animate:M,responsive:S,legend:i,tooltip:o,format:s,palette:a,loading:l,error:c,emptyMessage:u,description:h,decorative:p,highlighted:w===void 0?this.highlightState:w,highlightScope:k,accessibleTable:$,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&&pe(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=pe(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&&Ce(r,t)||(this.hover=t,this.emit("skdx-highlighted-change",t),this.highlightState=t,this.syncId&&this.publish({highlighted:t}))}select(t){let r=this.selectionMode;r!=="none"&&this.setSelected(Ie(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 U(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&&F(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?et(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=Te(Me(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let k of o.issues??[])this.emit("skdx-data-issue",k)}let s=this.canZoom(o),a=this.canPan(o),l=this.canEdit(o),c=this.brushing(),u=s||a||l||c,h=!o.decorative&&he(o).length>0,p=it(o),M=tt(o,this.accessibleTable),S=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,w=this.portal;return E`<svg
3
4
  xmlns="http://www.w3.org/2000/svg"
4
5
  viewBox="0 0 ${o.width} ${o.height}"
5
6
  width=${o.width}
6
7
  height=${o.height}
7
8
  role=${o.decorative?"presentation":"img"}
8
- aria-hidden=${o.decorative?"true":M}
9
- aria-label=${o.decorative?M:i}
10
- aria-describedby=${y(p)}
11
- tabindex=${d?0:M}
9
+ aria-hidden=${o.decorative?"true":C}
10
+ aria-label=${o.decorative?C:i}
11
+ aria-description=${b(o.description)}
12
+ tabindex=${h?0:C}
12
13
  data-skdx-chart=${r}
13
- data-zoomable=${s||a?"":M}
14
- data-brushing=${c&&!(s||a)?"":M}
15
- data-editable=${l?"":M}
16
- style=${w?`--skdx-chart-duration:${w}`:M}
14
+ data-zoomable=${s||a?"":C}
15
+ data-brushing=${c&&!(s||a)?"":C}
16
+ data-editable=${l?"":C}
17
+ style=${p?`--skdx-chart-duration:${p}`:C}
17
18
  font-family=${v.fontFamily}
18
19
  font-size=${v.fontSize}
19
- @pointermove=${o.tooltip||u?this.onPointerMove:M}
20
+ @pointermove=${o.tooltip||u?this.onPointerMove:C}
20
21
  @pointerleave=${()=>{this.clearTip(),this.highlight(null)}}
21
- @pointerdown=${u?this.onPointerDown:M}
22
- @pointerup=${u?this.onPointerUp:M}
23
- @pointercancel=${u?this.onPointerUp:M}
24
- @wheel=${s||a?this.onWheel:M}
25
- @dblclick=${s||a?()=>a?this.setView(void 0):this.setZoom(void 0):M}
22
+ @pointerdown=${u?this.onPointerDown:C}
23
+ @pointerup=${u?this.onPointerUp:C}
24
+ @pointercancel=${u?this.onPointerUp:C}
25
+ @wheel=${s||a?this.onWheel:C}
26
+ @dblclick=${s||a?()=>a?this.setView(void 0):this.setZoom(void 0):C}
26
27
  @click=${this.onClick}
27
- @keydown=${d?this.onKeyDown:M}
28
+ @keydown=${h?this.onKeyDown:C}
28
29
  @blur=${()=>{this.focused=null,this.highlight(null)}}
29
30
  >
30
31
  <title>${i}</title>
31
- ${o.description?A`<desc id=${y(p)}>${o.description}</desc>`:M}
32
- ${w?A`<style>${nt}</style>`:M} ${Jt(o)}
33
- ${de(o.shapes)}
34
- ${de(this.tip.length||!this.crossState?this.tip:Ae(o,this.crossState))}
35
- ${de(We(o,this.focused))} ${de(this.overlay)}
32
+ ${o.description?L`<desc>${o.description}</desc>`:C}
33
+ ${p?L`<style>${rt}</style>`:C} ${rn(o)}
34
+ ${fe(o.shapes)}
35
+ ${fe(this.tip.length||!this.crossState?this.tip:Le(o,this.crossState))}
36
+ ${fe(We(o,this.focused))} ${fe(this.overlay)}
36
37
  </svg>
37
- ${I?V`<div
38
+ ${w?E`<div
38
39
  role="tooltip"
39
40
  data-skdx-tooltip=${r}
40
- style="left:${I.x+12}px;top:${I.y+12}px"
41
+ style="left:${w.x+12}px;top:${w.y+12}px"
41
42
  >
42
- ${I.lines.map(C=>V`<div>${C}</div>`)}
43
- </div>`:M}
44
- ${k?V`<table data-skdx-table=${r}>
43
+ ${w.lines.map(k=>E`<div>${k}</div>`)}
44
+ </div>`:C}
45
+ ${M?E`<table data-skdx-table=${r}>
45
46
  <caption>
46
47
  ${S}
47
48
  </caption>
48
49
  <thead>
49
50
  <tr>
50
- ${(k[0]??[]).map(C=>V`<th scope="col">${C}</th>`)}
51
+ ${(M[0]??[]).map(k=>E`<th scope="col">${k}</th>`)}
51
52
  </tr>
52
53
  </thead>
53
54
  <tbody>
54
- ${k.slice(1).map(C=>V`<tr>
55
- ${C.map((B,N)=>N===0?V`<th scope="row">${B}</th>`:V`<td>${B}</td>`)}
55
+ ${M.slice(1).map(k=>E`<tr>
56
+ ${k.map(($,T)=>T===0?E`<th scope="row">${$}</th>`:E`<td>${$}</td>`)}
56
57
  </tr>`)}
57
58
  </tbody>
58
- </table>`:M}`}};g.styles=qt`
59
+ </table>`:C}`}};g.styles=en`
59
60
  :host {
60
61
  display: inline-block;
61
62
  }
@@ -63,7 +64,6 @@ var Ot=Object.defineProperty;var At=Object.getOwnPropertyDescriptor;var h=(e,n,t
63
64
  display: block;
64
65
  max-width: 100%;
65
66
  height: auto;
66
- outline: none;
67
67
  }
68
68
  svg[data-zoomable] {
69
69
  cursor: grab;
@@ -78,6 +78,9 @@ var Ot=Object.defineProperty;var At=Object.getOwnPropertyDescriptor;var h=(e,n,t
78
78
  }
79
79
  :host([responsive]) {
80
80
  display: block;
81
+ /* Keep centered flex/grid hosts independent of the previous SVG's intrinsic width. */
82
+ width: 100%;
83
+ min-width: 0;
81
84
  }
82
85
  table {
83
86
  position: absolute;
@@ -97,7 +100,7 @@ var Ot=Object.defineProperty;var At=Object.getOwnPropertyDescriptor;var h=(e,n,t
97
100
  background: var(--skdx-color-surface-raised);
98
101
  color: var(--skdx-color-text-default);
99
102
  border: 1px solid var(--skdx-color-border-strong);
100
- border-radius: 3px;
103
+ border-radius: var(--skdx-radius-default, var(--skdx-radius-md, 0.5rem));
101
104
  padding: 4px 8px;
102
105
  font-family: var(--skdx-font-family);
103
106
  font-size: var(--skdx-font-size-xs);
@@ -106,4 +109,4 @@ var Ot=Object.defineProperty;var At=Object.getOwnPropertyDescriptor;var h=(e,n,t
106
109
  [role='tooltip'] > :first-child:not(:only-child) {
107
110
  font-weight: bold;
108
111
  }
109
- `,h([f({type:Number})],g.prototype,"width",2),h([f({type:Number})],g.prototype,"height",2),h([f()],g.prototype,"label",2),h([f({type:Boolean,reflect:!0})],g.prototype,"legend",2),h([f({type:Boolean,attribute:"no-tooltip",converter:Qt})],g.prototype,"tooltip",2),h([f({attribute:!1})],g.prototype,"format",2),h([f({attribute:!1})],g.prototype,"palette",2),h([f({attribute:!1})],g.prototype,"hiddenSeries",2),h([f({attribute:!1})],g.prototype,"selected",2),h([f({attribute:"selection-mode"})],g.prototype,"selectionMode",2),h([f({attribute:!1})],g.prototype,"highlighted",2),h([f({attribute:!1})],g.prototype,"highlightScope",2),h([f({type:Boolean,reflect:!0})],g.prototype,"loading",2),h([f()],g.prototype,"error",2),h([f({attribute:"empty-message"})],g.prototype,"emptyMessage",2),h([f()],g.prototype,"description",2),h([f({type:Boolean,reflect:!0})],g.prototype,"decorative",2),h([f({type:Boolean,attribute:"accessible-table"})],g.prototype,"accessibleTable",2),h([f({attribute:!1})],g.prototype,"zoom",2),h([f({attribute:!1})],g.prototype,"view",2),h([f({type:Boolean,reflect:!0})],g.prototype,"zoomable",2),h([f({type:Boolean,reflect:!0})],g.prototype,"editable",2),h([f({attribute:"sync-id"})],g.prototype,"syncId",2),h([f({type:Boolean,attribute:"cross-filter"})],g.prototype,"crossFilter",2),h([f({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],g.prototype,"animated",2),h([f({type:Boolean,reflect:!0})],g.prototype,"responsive",2),h([P()],g.prototype,"tip",2),h([P()],g.prototype,"overlay",2),h([P()],g.prototype,"portal",2),h([P()],g.prototype,"measured",2),h([P()],g.prototype,"viewState",2),h([P()],g.prototype,"highlightState",2),h([P()],g.prototype,"crossState",2),h([P()],g.prototype,"focused",2),h([P()],g.prototype,"hiddenState",2),h([P()],g.prototype,"zoomState",2),h([P()],g.prototype,"selectedState",2);var x=class extends g{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:c,curve:u,connectNulls:d,nulls:p,stacked:w,stackOffset:k,orientation:S,radius:I,barGap:C,barWidth:B,sort:N,transform:m,transforms:T,bins:$,binWidth:O,binDomain:D,binMode:z,sampling:L,brush:he,crosshair:pe}=this;return{...this.sized(),series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:a,annotations:l,labels:c,curve:u,connectNulls:d,nulls:p,stacked:w,stackOffset:k,orientation:S,radius:I,barGap:C,barWidth:B,sort:N,transform:m,transforms:T,bins:$,binWidth:O,binDomain:D,binMode:z,sampling:L,brush:he,crosshair:pe}}};h([f({attribute:!1})],x.prototype,"series",2),h([f({attribute:!1})],x.prototype,"categories",2),h([f({attribute:!1})],x.prototype,"xAxis",2),h([f({attribute:!1})],x.prototype,"yAxis",2),h([f({attribute:!1})],x.prototype,"rightAxis",2),h([f({attribute:!1})],x.prototype,"references",2),h([f({attribute:!1})],x.prototype,"annotations",2),h([f({type:Boolean,reflect:!0})],x.prototype,"labels",2),h([f()],x.prototype,"curve",2),h([f({type:Boolean,attribute:"connect-nulls"})],x.prototype,"connectNulls",2),h([f()],x.prototype,"nulls",2),h([f({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],x.prototype,"stacked",2),h([f({attribute:"stack-offset"})],x.prototype,"stackOffset",2),h([f()],x.prototype,"orientation",2),h([f({type:Number})],x.prototype,"radius",2),h([f({type:Number,attribute:"bar-gap"})],x.prototype,"barGap",2),h([f({type:Number,attribute:"bar-width"})],x.prototype,"barWidth",2),h([f()],x.prototype,"sort",2),h([f()],x.prototype,"transform",2),h([f({attribute:!1})],x.prototype,"transforms",2),h([f({type:Number})],x.prototype,"bins",2),h([f({type:Number,attribute:"bin-width"})],x.prototype,"binWidth",2),h([f({attribute:!1})],x.prototype,"binDomain",2),h([f({attribute:"bin-mode"})],x.prototype,"binMode",2),h([f({attribute:!1})],x.prototype,"sampling",2),h([f({type:Boolean,reflect:!0})],x.prototype,"brush",2),h([f({type:Boolean,reflect:!0})],x.prototype,"crosshair",2);var Jt=e=>e.defs&&e.defs.length?A`<defs>${e.defs.map(n=>A`<linearGradient id=${n.id} x1="0" y1="0" x2=${n.vertical===!1?1:0} y2=${n.vertical===!1?0:1}>${n.stops.map(t=>A`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${y(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:M,de=e=>A`${e.map((n,t)=>{let r=n.title?A`<title>${n.title}</title>`:M,i=n.item?t:void 0;switch(n.kind){case"path":return A`<path data-skdx-part=${n.part} data-skdx-i=${y(i)} d=${n.d} fill=${n.fill??"none"} stroke=${y(n.stroke)} stroke-width=${y(n.strokeWidth)} stroke-linecap=${y(n.strokeLinecap)} stroke-linejoin=${y(n.strokeLinejoin)} stroke-dasharray=${y(n.dash)} opacity=${y(n.opacity)} fill-opacity=${y(n.fillOpacity)}>${r}</path>`;case"rect":return A`<rect data-skdx-part=${n.part} data-skdx-i=${y(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${y(n.rx)} fill=${n.fill} stroke=${y(n.stroke)} fill-opacity=${y(n.opacity)}>${r}</rect>`;case"line":return A`<line data-skdx-part=${n.part} data-skdx-i=${y(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${y(n.strokeWidth)} stroke-dasharray=${y(n.dash)} opacity=${y(n.opacity)}>${r}</line>`;case"circle":return A`<circle data-skdx-part=${n.part} data-skdx-i=${y(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${y(n.stroke)} opacity=${y(n.opacity)}>${r}</circle>`;case"text":return A`<text data-skdx-part=${n.part} data-skdx-i=${y(i)} x=${n.x} y=${n.y} text-anchor=${y(n.anchor)} dominant-baseline=${y(n.baseline)} fill=${y(n.fill)} font-weight=${y(n.weight)} pointer-events=${y(i===void 0?"none":void 0)} transform=${y(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var R=class extends g{constructor(){super(...arguments);this.dimensions=[];this.data=[];this.connectNulls=!1}render(){let{dimensions:t,data:r,opacity:i,curve:o,connectNulls:s,filters:a}=this;return this.root(it({...this.sized(),dimensions:t,data:r,opacity:i,curve:o,connectNulls:s,filters:a}),"parallel",this.label??"Parallel coordinates chart")}};h([K({attribute:!1})],R.prototype,"dimensions",2),h([K({attribute:!1})],R.prototype,"data",2),h([K({type:Number})],R.prototype,"opacity",2),h([K()],R.prototype,"curve",2),h([K({type:Boolean,reflect:!0,attribute:"connect-nulls"})],R.prototype,"connectNulls",2),h([K({attribute:!1})],R.prototype,"filters",2),R=h([en("skdx-parallel-coordinates-chart")],R);export{R as SkdxParallelCoordinatesChart};
112
+ `,d([f({type:Number})],g.prototype,"width",2),d([f({type:Number})],g.prototype,"height",2),d([f()],g.prototype,"label",2),d([f({type:Boolean,reflect:!0})],g.prototype,"legend",2),d([f({type:Boolean,attribute:"no-tooltip",converter:nn})],g.prototype,"tooltip",2),d([f({attribute:!1})],g.prototype,"format",2),d([f({attribute:!1})],g.prototype,"palette",2),d([f({attribute:!1})],g.prototype,"hiddenSeries",2),d([f({attribute:!1})],g.prototype,"selected",2),d([f({attribute:"selection-mode"})],g.prototype,"selectionMode",2),d([f({attribute:!1})],g.prototype,"highlighted",2),d([f({attribute:!1})],g.prototype,"highlightScope",2),d([f({type:Boolean,reflect:!0})],g.prototype,"loading",2),d([f()],g.prototype,"error",2),d([f({attribute:"empty-message"})],g.prototype,"emptyMessage",2),d([f()],g.prototype,"description",2),d([f({type:Boolean,reflect:!0})],g.prototype,"decorative",2),d([f({type:Boolean,attribute:"accessible-table"})],g.prototype,"accessibleTable",2),d([f({attribute:!1})],g.prototype,"zoom",2),d([f({attribute:!1})],g.prototype,"view",2),d([f({type:Boolean,reflect:!0})],g.prototype,"zoomable",2),d([f({type:Boolean,reflect:!0})],g.prototype,"editable",2),d([f({attribute:"sync-id"})],g.prototype,"syncId",2),d([f({type:Boolean,attribute:"cross-filter"})],g.prototype,"crossFilter",2),d([f({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],g.prototype,"animated",2),d([f({type:Boolean,reflect:!0})],g.prototype,"responsive",2),d([B()],g.prototype,"tip",2),d([B()],g.prototype,"overlay",2),d([B()],g.prototype,"portal",2),d([B()],g.prototype,"measured",2),d([B()],g.prototype,"viewState",2),d([B()],g.prototype,"highlightState",2),d([B()],g.prototype,"crossState",2),d([B()],g.prototype,"focused",2),d([B()],g.prototype,"hiddenState",2),d([B()],g.prototype,"zoomState",2),d([B()],g.prototype,"selectedState",2);var y=class extends g{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:c,curve:u,connectNulls:h,nulls:p,stacked:M,stackOffset:S,orientation:w,radius:k,barGap:$,barWidth:T,sort:R,transform:ne,transforms:m,bins:O,binWidth:I,binDomain:z,binMode:N,sampling:A,brush:P,crosshair:me}=this;return{...this.sized(),series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:a,annotations:l,labels:c,curve:u,connectNulls:h,nulls:p,stacked:M,stackOffset:S,orientation:w,radius:k,barGap:$,barWidth:T,sort:R,transform:ne,transforms:m,bins:O,binWidth:I,binDomain:z,binMode:N,sampling:A,brush:P,crosshair:me}}};d([f({attribute:!1})],y.prototype,"series",2),d([f({attribute:!1})],y.prototype,"categories",2),d([f({attribute:!1})],y.prototype,"xAxis",2),d([f({attribute:!1})],y.prototype,"yAxis",2),d([f({attribute:!1})],y.prototype,"rightAxis",2),d([f({attribute:!1})],y.prototype,"references",2),d([f({attribute:!1})],y.prototype,"annotations",2),d([f({type:Boolean,reflect:!0})],y.prototype,"labels",2),d([f()],y.prototype,"curve",2),d([f({type:Boolean,attribute:"connect-nulls"})],y.prototype,"connectNulls",2),d([f()],y.prototype,"nulls",2),d([f({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],y.prototype,"stacked",2),d([f({attribute:"stack-offset"})],y.prototype,"stackOffset",2),d([f()],y.prototype,"orientation",2),d([f({type:Number})],y.prototype,"radius",2),d([f({type:Number,attribute:"bar-gap"})],y.prototype,"barGap",2),d([f({type:Number,attribute:"bar-width"})],y.prototype,"barWidth",2),d([f()],y.prototype,"sort",2),d([f()],y.prototype,"transform",2),d([f({attribute:!1})],y.prototype,"transforms",2),d([f({type:Number})],y.prototype,"bins",2),d([f({type:Number,attribute:"bin-width"})],y.prototype,"binWidth",2),d([f({attribute:!1})],y.prototype,"binDomain",2),d([f({attribute:"bin-mode"})],y.prototype,"binMode",2),d([f({attribute:!1})],y.prototype,"sampling",2),d([f({type:Boolean,reflect:!0})],y.prototype,"brush",2),d([f({type:Boolean,reflect:!0})],y.prototype,"crosshair",2);var rn=e=>e.defs&&e.defs.length?L`<defs>${e.defs.map(n=>L`<linearGradient id=${n.id} x1="0" y1="0" x2=${n.vertical===!1?1:0} y2=${n.vertical===!1?0:1}>${n.stops.map(t=>L`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${b(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:C,fe=e=>L`${e.map((n,t)=>{let r=n.title?L`<title>${n.title}</title>`:C,i=n.item?t:void 0;switch(n.kind){case"path":return L`<path data-skdx-part=${n.part} data-skdx-i=${b(i)} d=${n.d} fill=${n.fill??"none"} stroke=${b(n.stroke)} stroke-width=${b(n.strokeWidth)} stroke-linecap=${b(n.strokeLinecap)} stroke-linejoin=${b(n.strokeLinejoin)} stroke-dasharray=${b(n.dash)} opacity=${b(n.opacity)} fill-opacity=${b(n.fillOpacity)}>${r}</path>`;case"rect":return L`<rect data-skdx-part=${n.part} data-skdx-i=${b(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${b(n.rx)} style=${b(ce(n.part)?`rx:${ce(n.part)}`:void 0)} fill=${n.fill} stroke=${b(n.stroke)} fill-opacity=${b(n.opacity)} pointer-events=${b(n.part==="stage-label-background"||n.part==="label-background"?"none":void 0)}>${r}</rect>`;case"line":return L`<line data-skdx-part=${n.part} data-skdx-i=${b(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${b(n.strokeWidth)} stroke-dasharray=${b(n.dash)} opacity=${b(n.opacity)}>${r}</line>`;case"circle":return L`<circle data-skdx-part=${n.part} data-skdx-i=${b(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${b(n.stroke)} opacity=${b(n.opacity)}>${r}</circle>`;case"text":return L`<text aria-label=${b(n.title)} data-skdx-part=${n.part} data-skdx-i=${b(i)} x=${n.x} y=${n.y} text-anchor=${b(n.anchor)} dominant-baseline=${b(n.baseline)} fill=${b(n.fill)} font-weight=${b(n.weight)} pointer-events=${b(i===void 0?"none":void 0)} transform=${b(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var D=class extends g{constructor(){super(...arguments);this.dimensions=[];this.data=[];this.connectNulls=!1}render(){let{dimensions:t,data:r,opacity:i,curve:o,connectNulls:s,filters:a}=this;return this.root(ot({...this.sized(),dimensions:t,data:r,opacity:i,curve:o,connectNulls:s,filters:a}),"parallel",this.label??"Parallel coordinates chart")}};d([K({attribute:!1})],D.prototype,"dimensions",2),d([K({attribute:!1})],D.prototype,"data",2),d([K({type:Number})],D.prototype,"opacity",2),d([K()],D.prototype,"curve",2),d([K({type:Boolean,reflect:!0,attribute:"connect-nulls"})],D.prototype,"connectNulls",2),d([K({attribute:!1})],D.prototype,"filters",2),D=d([on("skdx-parallel-coordinates-chart")],D);export{D as SkdxParallelCoordinatesChart};