@skdx/web-components-charts 0.38.0 → 0.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/area.cjs +31 -31
  2. package/dist/area.js +11 -11
  3. package/dist/bar.cjs +31 -31
  4. package/dist/bar.js +11 -11
  5. package/dist/boxplot.cjs +8 -8
  6. package/dist/boxplot.js +9 -9
  7. package/dist/bubble.cjs +9 -9
  8. package/dist/bubble.js +10 -10
  9. package/dist/bullet.cjs +12 -12
  10. package/dist/bullet.js +13 -13
  11. package/dist/bump.cjs +7 -7
  12. package/dist/bump.js +8 -8
  13. package/dist/candlestick.cjs +34 -34
  14. package/dist/candlestick.js +34 -34
  15. package/dist/chord.cjs +35 -35
  16. package/dist/chord.js +21 -21
  17. package/dist/circle-packing.cjs +16 -16
  18. package/dist/circle-packing.js +30 -30
  19. package/dist/combo.cjs +31 -31
  20. package/dist/combo.js +11 -11
  21. package/dist/dumbbell.cjs +21 -21
  22. package/dist/dumbbell.js +24 -24
  23. package/dist/funnel.cjs +7 -7
  24. package/dist/funnel.js +7 -7
  25. package/dist/gantt.cjs +7 -7
  26. package/dist/gantt.js +8 -8
  27. package/dist/gauge.cjs +6 -6
  28. package/dist/gauge.js +6 -6
  29. package/dist/heatmap.cjs +9 -9
  30. package/dist/heatmap.js +10 -10
  31. package/dist/histogram.cjs +30 -30
  32. package/dist/histogram.js +11 -11
  33. package/dist/icicle.cjs +16 -16
  34. package/dist/icicle.js +16 -16
  35. package/dist/index.cjs +33 -33
  36. package/dist/index.js +17 -17
  37. package/dist/line.cjs +31 -31
  38. package/dist/line.js +11 -11
  39. package/dist/linear-gauge.cjs +12 -12
  40. package/dist/linear-gauge.js +13 -13
  41. package/dist/map.cjs +6 -6
  42. package/dist/map.js +6 -6
  43. package/dist/marimekko.cjs +17 -17
  44. package/dist/marimekko.js +20 -20
  45. package/dist/network.cjs +14 -14
  46. package/dist/network.js +13 -13
  47. package/dist/organization.cjs +10 -10
  48. package/dist/organization.js +14 -14
  49. package/dist/parallel.cjs +6 -6
  50. package/dist/parallel.js +6 -6
  51. package/dist/pareto.cjs +30 -30
  52. package/dist/pareto.js +12 -12
  53. package/dist/pie.cjs +6 -6
  54. package/dist/pie.js +6 -6
  55. package/dist/polar-area.cjs +7 -7
  56. package/dist/polar-area.js +7 -7
  57. package/dist/radar.cjs +7 -7
  58. package/dist/radar.js +6 -6
  59. package/dist/radial.cjs +6 -6
  60. package/dist/radial.js +6 -6
  61. package/dist/range.cjs +31 -31
  62. package/dist/range.js +15 -15
  63. package/dist/sankey.cjs +10 -10
  64. package/dist/sankey.js +15 -15
  65. package/dist/scatter.cjs +31 -31
  66. package/dist/scatter.js +12 -12
  67. package/dist/sunburst.cjs +28 -28
  68. package/dist/sunburst.js +8 -8
  69. package/dist/swarm.cjs +16 -16
  70. package/dist/swarm.js +17 -17
  71. package/dist/timeline.cjs +6 -6
  72. package/dist/timeline.js +6 -6
  73. package/dist/tree.cjs +10 -10
  74. package/dist/tree.js +13 -13
  75. package/dist/treemap.cjs +7 -7
  76. package/dist/treemap.js +7 -7
  77. package/dist/waffle.cjs +31 -31
  78. package/dist/waffle.js +31 -31
  79. package/dist/waterfall.cjs +14 -14
  80. package/dist/waterfall.js +18 -18
  81. package/package.json +3 -3
@@ -1,61 +1,61 @@
1
- "use strict";var Je=Object.defineProperty;var qn=Object.getOwnPropertyDescriptor;var Zr=Object.getOwnPropertyNames;var Er=Object.prototype.hasOwnProperty;var Hr=(e,n)=>{for(var t in n)Je(e,t,{get:n[t],enumerable:!0})},Ur=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of Zr(n))!Er.call(e,i)&&i!==t&&Je(e,i,{get:()=>n[i],enumerable:!(r=qn(n,i))||r.enumerable});return e};var Kr=e=>Ur(Je({},"__esModule",{value:!0}),e),g=(e,n,t,r)=>{for(var i=r>1?void 0:r?qn(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&&Je(n,t,i),i};var Li={};Hr(Li,{SkdxHistogram:()=>J});module.exports=Kr(Li);var ee=require("lit/decorators.js");var Yn=e=>Number(e.toPrecision(12)),qr,Xn=e=>(qr??(qr=new Intl.NumberFormat)).format(Yn(e)),Yr=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 ae(e){if(e===void 0)return Xn;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,l=u=>r===void 0?u===void 0?{}:{maximumFractionDigits:u}:{minimumFractionDigits:r,maximumFractionDigits:r},c=u=>{let h=new Intl.NumberFormat(t,u);return s(b=>h.format(Yn(b)))},d=u=>{let h=new Intl.DateTimeFormat(t,o?{...u,timeZone:o}:u);return b=>h.format(b)};switch(n){case"integer":return c({maximumFractionDigits:0});case"decimal":return c(l(2));case"percent":return c({style:"percent",...l(0)});case"currency":return c({style:"currency",currency:e.currency??"USD",...l()});case"compact":return c({notation:"compact",...l(1)});case"scientific":return c({notation:"scientific",...l(2)});case"date":return d({dateStyle:"medium"});case"time":return d({timeStyle:"short"});case"datetime":return d({dateStyle:"medium",timeStyle:"short"});case"duration":return s(Yr)}}function et(e,n){if(typeof e=="string")return e;let t=e instanceof Date?e.getTime():e;return n?ae(n)(t):e instanceof Date?new Intl.DateTimeFormat().format(e):Xn(t)}var le=e=>{if(e instanceof Date)return e.getTime();if(typeof e=="number")return e;let n=Number(e);return Number.isFinite(n)&&e.trim()!==""?n:Date.parse(e)};function Se([e,n],[t,r]){let i=n-e;return o=>i===0?t:t+(o-e)/i*(r-t)}function xe(e,n,t=5){if(e===n)return[e];let r=(n-e)/Math.max(1,t),i=10**Math.floor(Math.log10(r)),o=r/i,s=(o<1.5?1:o<3.5?2:o<7.5?5:10)*i,l=Math.floor(e/s)*s,c=Math.ceil(n/s)*s,d=[];for(let u=l;u<=c+s/2;u+=s)d.push(Jn(u));return d}function Qn(e,[n,t],r=.2){let i=e===0?0:(t-n)/e,o=i*(1-Math.max(0,Math.min(.9,r)));return{step:i,bandwidth:o,start:s=>n+s*i+(i-o)/2,center:s=>n+(s+.5)*i}}var Jn=e=>Number(e.toPrecision(12)),p=e=>Number(e.toFixed(2)),I=e=>typeof e=="number"&&Number.isFinite(e),re=e=>e.filter(I);function ce(e){let n=1/0,t=-1/0;for(let r of e)I(r)&&(r<n&&(n=r),r>t&&(t=r));return n===1/0?[0,0]:[n,t]}function ye(e,n="linear"){if(e.length===0)return"";let t=e[0];if(n==="step"||n==="stepBefore"||n==="stepAfter"){let d=`M${t.x} ${t.y}`;for(let u=1;u<e.length;u++){let h=e[u-1],b=e[u];n==="stepAfter"?d+=`H${b.x}V${b.y}`:n==="stepBefore"?d+=`V${b.y}H${b.x}`:d+=`H${p((h.x+b.x)/2)}V${b.y}H${b.x}`}return d}if(n==="linear"||e.length<3)return`M${e.map(d=>`${d.x} ${d.y}`).join("L")}`;let r=e.length,i=e.slice(1).map((d,u)=>d.x-e[u].x),o=e.slice(1).map((d,u)=>d.y-e[u].y),s=i.map((d,u)=>d===0?0:o[u]/d),l=[s[0]];for(let d=1;d<r-1;d++){let u=s[d-1],h=s[d];l.push(u*h<=0?0:(u+h)/2)}l.push(s[r-2]);for(let d=0;d<r-1;d++){let u=s[d];if(u===0){l[d]=0,l[d+1]=0;continue}let h=l[d]/u,b=l[d+1]/u,v=Math.hypot(h,b);v>3&&(l[d]=3*h*u/v,l[d+1]=3*b*u/v)}let c=`M${t.x} ${t.y}`;for(let d=0;d<r-1;d++){let u=e[d],h=e[d+1],b=i[d]/3;c+=`C${p(u.x+b)} ${p(u.y+b*l[d])} ${p(h.x-b)} ${p(h.y-b*l[d+1])} ${h.x} ${h.y}`}return c}var Pe=1e3,De=60*Pe,Ne=60*De,Fe=24*Ne,Xr=[Pe,5*Pe,15*Pe,30*Pe,De,5*De,15*De,30*De,Ne,3*Ne,6*Ne,12*Ne,Fe,2*Fe,7*Fe,14*Fe];function er(e,n,t=6){if(!(n>e))return[e];let r=n-e,i=Xr.find(h=>r/h<=t),o=[];if(i!==void 0){for(let h=Math.ceil(e/i)*i;h<=n;h+=i)o.push(h);return o.length?o:[e,n]}let s=r/(30*Fe),l=[1,2,3,6,12,24,60,120].find(h=>s/h<=t)??240,c=new Date(e),d=c.getUTCFullYear(),u=Math.ceil((c.getUTCMonth()+(c.getUTCDate()>1?1:0))/l)*l;for(let h=Date.UTC(d,u,1);h<=n;)o.push(h),u+=l,u>=12&&(d+=Math.floor(u/12),u%=12),h=Date.UTC(d,u,1);return o.length?o:[e,n]}function tr(e,n){let t=Math.floor(Math.log10(e)),r=Math.ceil(Math.log10(n)),i=r-t<=1?[1,2,5]:[1],o=[];for(let s=t;s<=r;s++)for(let l of i)o.push(Jn(l*10**s));return o.filter(s=>s>=e/1.0001&&s<=n*1.0001)}function $e(e,n={}){if(n.thresholds&&n.thresholds.length>=2)return[...n.thresholds].filter(Number.isFinite).sort((c,d)=>c-d);let[t,r]=n.domain??ce(e),i=Math.max(1,e.length),o=Math.max(1,n.bins??Math.ceil(Math.log2(i)+1)),s=n.binWidth??(r>t?(r-t)/o:1),l=r>t?Math.max(1,Math.ceil((r-t)/s-1e-9)):1;return Array.from({length:l+1},(c,d)=>Number((t+d*s).toPrecision(12)))}function Ce(e,n){let t=[];for(let o=0;o+1<n.length;o++)t.push({x0:n[o],x1:n[o+1],count:0});if(t.length===0)return t;let r=n[0],i=n[n.length-1];for(let o of re(e)){if(o<r||o>i)continue;let s=0,l=t.length-1;for(;s<l;){let c=s+l+1>>1;t[c].x0<=o?s=c:l=c-1}t[s].count++}return t}var Qr=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,Jr=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,ei={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function ti(e,n,t){return e.replace(Jr,(r,i,o)=>{let s=ei[i];if(s===void 0)return i+o;let c=(o.match(Qr)??[]).map((d,u)=>{let h=Number(d);if(s===-1)return String(h+n);if(s===-2)return String(h+t);let b=u%s;return s===7?b===5?String(h+n):b===6?String(h+t):d:String(b%2===0?h+n:h+t)});return i+c.join(" ")})}var nr=(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:ti(r.d,n,t)}}});var Ot=["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)"))),B={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)"},tt=(e="neutral")=>e==="neutral"?B.axis:`var(--skdx-color-${e}-500)`,zt=(e="neutral")=>e==="neutral"?B.label:e==="primary"?"var(--skdx-color-text-accent)":`var(--skdx-color-text-${e})`,rr=(e,n)=>n??Ot[e%Ot.length];var ne={top:16,right:16,bottom:32,left:48};function ir(e,n,t=ne){return{x:t.left,y:t.top,width:Math.max(0,e-t.left-t.right),height:Math.max(0,n-t.top-t.bottom)}}function Ge(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function Rt(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var or=e=>e.crosshair===!0||Rt(e).trigger==="axis",nt=20,ni=120,sr=e=>{let n=Ge(e);return n&&(n.position==="left"||n.position==="right")?n.width??ni:0},Vt=(e,n=600,t=300)=>({width:(e.width??n)-sr(e),height:(e.height??t)-(Ge(e)?.position==="bottom"?nt:0)}),ar=e=>{let n=Ge(e);return n&&(n.position===void 0||n.position==="top")?nt:0},de=6.5,lr=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:rr(n)),cr=(e,n)=>e.hiddenSeries?.includes(n)??!1;function Lt(e,n,t=[],r={},i=10,o=8,s=!1){let l=[],c=r.maxItems,d=c!==void 0&&c>=0&&e.length>c?e.slice(0,c):e,u=e.length-d.length,h=r.interactive??!0,b=o,v=i,x=(m,w,y,f)=>{let M=(w?18:4)+m.length*de;b>o&&(s||b+M>n-8)&&(b=o,v+=nt),w&&l.push({kind:"rect",part:"legend-swatch",x:b,y:v-5,width:10,height:10,fill:w,opacity:f?.3:void 0,item:y}),l.push({kind:"text",part:"legend-label",x:b+(w?14:0),y:v,text:m,baseline:"middle",fill:f?B.grid:B.label,item:y}),b+=M+12};for(let m of d){let w=t.includes(m.name),y=h?{label:m.name,series:m.name,legend:!0}:void 0;x(r.formatter?.(m.name)??m.name,m.color,y,w)}return u>0&&x(`+${u} more`,void 0,void 0,!1),r.align==="end"?ri(l,n):l}function ri(e,n){let t=new Map;for(let i of e){let o=i.kind==="rect"?i.y+5:i.y;t.set(o,[...t.get(o)??[],i])}let r=[];for(let i of t.values()){let o=Math.max(...i.map(l=>l.kind==="rect"?l.x+l.width:l.x+l.text.length*de)),s=n-8-o;for(let l of i)r.push({...l,x:l.x+s})}return r}var ii=(e,n,t={})=>new Set(Lt(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function Bt(e,n,t,r=[]){let i=Ge(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,s=Rt(e),l=o?.position==="bottom",c=sr(e),d=e.hiddenSeries??[],u=o?c?Lt(r,1/0,d,o,10,(o.position==="right"?n:0)+8,!0):Lt(r,n,d,o,l?t+10:10):[],h=l?ii(r,n,o):0;return{width:n+c,height:l?t+Math.max(1,h)*nt:t,legendOffset:o?.position==="left"?c: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 Pt(e){let n=e.legendOffset;if(!n)return e;let t=[...nr(e.shapes.filter(c=>!c.part.startsWith("legend-")),n,0),...e.shapes.filter(c=>c.part.startsWith("legend-"))],r=c=>({...c,x:c.x+n}),i=e.hit?{...e.hit,plot:r(e.hit.plot),xs:e.hit.xs.map(c=>c+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:c=>o.scale(c)+n,invert:c=>o.invert(c-n),bars:o.bars.map(c=>({...c,x0:c.x0+n,x1:c.x1+n}))}:void 0,l=e.map?{...e.map,plot:r(e.map.plot)}:void 0;return{...e,shapes:t,hit:i,edit:s,map:l,legendOffset:void 0}}function rt(e,n,t,r,i,o="auto"){let s=Array.isArray(t)?t:[t],l=Math.max(...s.map(b=>b.length))*de+12,c=6+s.length*16,d=o==="top"?{x:e-l/2,y:n-c-8}:o==="bottom"?{x:e-l/2,y:n+8}:o==="left"?{x:e-l-8,y:n-c/2}:o==="right"?{x:e+8,y:n-c/2}:{x:e+12,y:n-c-6},u=Math.max(0,Math.min(r-l,d.x)),h=Math.max(0,Math.min(i-c,d.y));return[{kind:"rect",part:"tooltip",x:p(u),y:p(h),width:p(l),height:c,fill:"var(--skdx-color-surface-raised)",stroke:B.axis,rx:3},...s.map((b,v)=>({kind:"text",part:"tooltip-label",x:p(u+6),y:p(h+11+v*16),text:b,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:s.length>1&&v===0?"bold":void 0}))]}function dr([e,n],t,r=!1,i){let o=typeof r=="boolean"?{scale:r?"log":"linear"}:r,s=ae(o.format??i),l=o.min??e,c=o.max??n;o.reversed&&(t=[t[1],t[0]]);let d={id:o.id,position:o.position,options:o};if(o.scale==="sqrt"){let m=O=>Math.sign(O)*Math.sqrt(Math.abs(O)),w=o.nice===!1?[l,c]:xe(l,c,o.ticks),y=o.min??w[0],f=o.max??w[w.length-1],M=Se([m(y),m(f)],t),A=O=>M(m(O)),S=xe(y,f,o.ticks).filter(O=>O>=y-1e-9&&O<=f+1e-9);return{...d,scale:A,domain:[y,f],format:s,ticks:(S.length>=2?S:[y,f]).map(O=>({pos:p(A(O)),label:s(O)})),zero:p(A(Math.min(Math.max(0,y),f)))}}if(o.scale==="log"){let m=Math.max(l,Number.EPSILON),w=Math.max(c,m),y=tr(m,w),f=[Math.log10(m),Math.log10(w)],M=Se(f,t),A=S=>M(Math.log10(Math.max(S,Number.EPSILON)));return{...d,scale:A,domain:f,format:s,ticks:y.map(S=>({pos:p(A(S)),label:s(S)})),zero:p(t[0])}}let u=xe(l,c,o.ticks),h=[o.min??(o.nice===!1?l:u[0]),o.max??(o.nice===!1?c:u[u.length-1])],b=Se(h,t),v=u.filter(m=>m>=h[0]-1e-9&&m<=h[1]+1e-9),x=(v.length>=2?v:[h[0],h[1]]).map(m=>({pos:p(b(m)),label:s(m)}));return{...d,scale:b,domain:h,format:s,ticks:x,zero:p(b(Math.min(Math.max(0,h[0]),h[1])))}}var ur=e=>e?.grid!==!1;function it(e,n){if(e.length<2)return e;let t=e.reduce((i,o)=>Math.max(i,o.label.length),0)*de+8,r=Math.max(1,Math.ceil(e.length*t/Math.max(1,n)));return r===1?e:e.filter((i,o)=>o%r===0)}var Dt=(e,n,t,r)=>`${e}, ${n}: ${r(t)}`;function ot(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}=Vt(e,t,r),l=i==="error"?e.error:i==="loading"?"Loading\u2026":e.emptyMessage??"No data available",c=[];return i==="loading"&&c.push({kind:"rect",part:"skeleton",x:0,y:0,width:o,height:s,fill:"var(--skdx-color-surface-sunken)",rx:4}),c.push({kind:"text",part:`state-${i}`,x:p(o/2),y:p(s/2),text:l,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":B.label}),{...Bt(e,o,s),shapes:c,tooltip:!1}}function Nt(e,n={}){let{plot:t,xTicks:r,yTicks:i,baseline:o}=e,s=t.x+t.width,l=t.y+t.height,c=[],d=n.grid??!0,u=(x,m)=>m?{kind:"line",part:"grid",x1:x.pos,x2:x.pos,y1:t.y,y2:l,stroke:B.grid}:{kind:"line",part:"grid",x1:t.x,x2:s,y1:x.pos,y2:x.pos,stroke:B.grid},h=n.x?.tickRotation??0,b=(x,m,w,y)=>h?Y(x,m,w,{part:y,anchor:h<0?"end":"start",baseline:"middle",rotate:h}):Y(x,m,w,{part:y,anchor:"middle"}),v=(x,m,w,y,f)=>{for(let M of x)c.push(m==="x"?{kind:"line",part:"tick",x1:M.pos,x2:M.pos,y1:w,y2:p(w+y*f),stroke:B.axis}:{kind:"line",part:"tick",x1:w,x2:p(w+y*f),y1:M.pos,y2:M.pos,stroke:B.axis})};if(n.categoryGrid)for(let x of r)c.push(u(x,!n.horizontal));if(n.horizontal){let x=n.axes??[{ticks:i,position:"bottom",offset:0,label:n.yLabel,...n.y}];if(d)for(let m of i)c.push(u(m,!0));x[0]?.showLine!==!1&&c.push({kind:"line",part:"axis",x1:o,x2:o,y1:t.y,y2:l,stroke:B.axis});for(let m of x){let w=m.position==="top"||m.position==="right",y=p(w?t.y-m.offset:l+m.offset),f=w||m.offset>0;m.showLine&&f&&c.push({kind:"line",part:"axis",x1:t.x,x2:s,y1:y,y2:y,stroke:B.axis}),m.showTicks&&v(m.ticks,"x",y,w?-1:1,m.tickSize??4);let M=p(w?y-8:y+20);for(let A of m.ticks)c.push(w?Y(A.pos,M,A.label,{part:"x-label-top",anchor:"middle"}):b(A.pos,M,A.label,"x-label"));m.label&&c.push(f?Y(4,M,m.label,{part:"axis-title",anchor:"start",baseline:w?void 0:"middle"}):Y(4,t.y-6,m.label,{part:"axis-title",anchor:"start"}))}n.x?.showLine&&c.push({kind:"line",part:"axis",x1:n.rtl?s:t.x,x2:n.rtl?s:t.x,y1:t.y,y2:l,stroke:B.axis}),n.x?.showTicks&&v(r,"y",n.rtl?s:t.x,n.rtl?1:-1,n.x.tickSize??4);for(let m of r)c.push(n.rtl?Y(s+8,m.pos,m.label,{part:"y-label",anchor:"start",baseline:"middle"}):Y(t.x-8,m.pos,m.label,{part:"y-label",anchor:"end",baseline:"middle"}))}else{if(d)for(let m of i)c.push(u(m,!1));n.y?.showLine!==!1&&c.push({kind:"line",part:"axis",x1:t.x,x2:s,y1:o,y2:o,stroke:B.axis});let x=n.axes??[{ticks:i,position:"left",offset:0,label:n.yLabel,...n.y},...n.rightTicks?[{ticks:n.rightTicks,position:"right",offset:0,label:n.rightLabel}]:[]];for(let m of x){let w=m.position==="left",y=w?t.x-m.offset:s+m.offset,f=w?"y-label":"y-label-right";m.showLine&&c.push({kind:"line",part:"axis",x1:p(y),x2:p(y),y1:t.y,y2:l,stroke:B.axis}),m.showTicks&&v(m.ticks,"y",p(y),w?-1:1,m.tickSize??4);for(let M of m.ticks)c.push(Y(p(w?y-8:y+8),M.pos,M.label,{part:f,anchor:w?"end":"start",baseline:"middle"}));m.label&&c.push(Y(p(w?m.offset===0?4:Math.max(4,y-40):m.offset===0?e.width-4:Math.min(e.width-4,y+40)),t.y-6,m.label,{part:"axis-title",anchor:w?"start":"end"}))}n.x?.showTicks&&v(r,"x",l,1,n.x.tickSize??4);for(let m of r)c.push(b(m.pos,l+(h?12:20),m.label,"x-label"))}return n.xLabel&&c.push(Y(p(t.x+t.width/2),e.height-4,n.xLabel,{part:"axis-title",anchor:"middle"})),n.horizontal&&n.rightLabel&&c.push(Y(e.width-4,t.y-6,n.rightLabel,{part:"axis-title",anchor:"end"})),c}var Y=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:B.label,...r}),_e=(e,n,t,r,i,o)=>({kind:"circle",part:"point",cx:e,cy:n,r:t,fill:r,title:i,item:o});function Ft(e,n){let t=[],{plot:r}=n,i=r.x+r.width,o=r.y+r.height,s=c=>Math.max(r.x,Math.min(i,c)),l=c=>Math.max(r.y,Math.min(o,c));for(let c of e??[]){let d=c.color??tt(c.variant),u=c.color??zt(c.variant),h={part:"reference-label",fill:u},b=n.horizontal===!0;if("y"in c){let v=p(n.y(c.y,c.axis??"left"));if(b){let x=s(v);t.push(...fr(x,r.y,o,d,c.label,h))}else{let x=l(v);t.push(...hr(r.x,i,x,d,c.label,h))}}else if("x"in c){let v=n.x(c.x);if(v===void 0)continue;b?t.push(...hr(r.x,i,l(p(v)),d,c.label,h)):t.push(...fr(s(p(v)),r.y,o,d,c.label,h))}else if("y1"in c){let v=p(n.y(c.y1,c.axis??"left")),x=p(n.y(c.y2,c.axis??"left"));b?t.push(...pr(s(Math.min(v,x)),s(Math.max(v,x)),r,d,c.label,u)):t.push(...mr(l(Math.min(v,x)),l(Math.max(v,x)),r,d,c.label,u))}else{let v=n.x(c.x1),x=n.x(c.x2);if(v===void 0||x===void 0)continue;let m=p(Math.min(v,x)),w=p(Math.max(v,x));b?t.push(...mr(l(m),l(w),r,d,c.label,u)):t.push(...pr(s(m),s(w),r,d,c.label,u))}}return t}function hr(e,n,t,r,i,o){let s={kind:"line",part:"reference",x1:e,x2:n,y1:t,y2:t,stroke:r,dash:"6 4",strokeWidth:1.5,title:i};return i?[s,Y(n-4,t-5,i,{...o,anchor:"end"})]:[s]}function fr(e,n,t,r,i,o){let s={kind:"line",part:"reference",x1:e,x2:e,y1:n,y2:t,stroke:r,dash:"6 4",strokeWidth:1.5,title:i};return i?[s,Y(e+4,n+10,i,{...o,anchor:"start"})]:[s]}function mr(e,n,t,r,i,o){let s={kind:"rect",part:"reference-area",x:t.x,y:e,width:t.width,height:p(Math.max(0,n-e)),fill:r,opacity:.12,title:i};return i?[s,Y(t.x+t.width-4,e+12,i,{part:"reference-label",fill:o,anchor:"end"})]:[s]}function pr(e,n,t,r,i,o){let s={kind:"rect",part:"reference-area",x:e,y:t.y,width:p(Math.max(0,n-e)),height:t.height,fill:r,opacity:.12,title:i};return i?[s,Y(e+4,t.y+12,i,{part:"reference-label",fill:o,anchor:"start"})]:[s]}function br(e,n){let t=[],{plot:r}=n,i=r.x+r.width,o=r.y+r.height;for(let s of e??[]){let l=s.color??tt(s.variant),c=s.color??zt(s.variant),d=(x,m,w)=>{let y=n.x(x);if(y===void 0)return;let f=n.y(m,w??"left");return n.horizontal?{x:p(f),y:p(y)}:{x:p(y),y:p(f)}},u=s.id??s.label,h=x=>({label:x,id:u,name:s.label});if(s.type==="line"||s.type==="band"){let{type:x,id:m,...w}=s;t.push(...Ft([w],n));continue}if(s.type==="rect"){let x=d(s.x1,s.y1,s.axis),m=d(s.x2,s.y2,s.axis);if(!x||!m)continue;let w=Math.max(r.x,Math.min(x.x,m.x)),y=Math.max(r.y,Math.min(x.y,m.y)),f=s.label??"";t.push({kind:"rect",part:"annotation-rect",x:p(w),y:p(y),width:p(Math.max(0,Math.min(i,Math.max(x.x,m.x))-w)),height:p(Math.max(0,Math.min(o,Math.max(x.y,m.y))-y)),fill:l,opacity:.12,stroke:l,title:f||void 0,item:f?h(f):void 0}),s.label&&t.push(Y(p(w+4),p(y+12),s.label,{part:"annotation-label",fill:c}));continue}let b=d(s.x,s.y,s.axis);if(!b)continue;if(s.type==="text"){t.push(Y(b.x,b.y,s.text,{part:"annotation-text",fill:c,anchor:"middle",baseline:"middle",title:s.label}));continue}let v=s.label??`${String(s.x)}, ${s.y}`;if(t.push({kind:"circle",part:"annotation-point",cx:b.x,cy:b.y,r:5,fill:l,stroke:"var(--skdx-color-surface-default)",title:v,item:h(v)}),s.type==="callout"&&s.label){let[x,m]=s.offset??[16,-16],w=p(Math.max(r.x,Math.min(i,b.x+x))),y=p(Math.max(r.y,Math.min(o,b.y+m)));t.push({kind:"line",part:"annotation-leader",x1:b.x,y1:b.y,x2:w,y2:y,stroke:l},Y(w,y,s.label,{part:"annotation-label",fill:c,anchor:x>=0?"start":"end",baseline:"middle"}))}}return t}var Gt=2e3;function oi(e){if(e!=="none")return e===void 0||e==="auto"?{strategy:"lttb",threshold:Gt}:typeof e=="string"?{strategy:e,threshold:Gt}:{strategy:e.strategy,threshold:e.threshold??Gt}}function si(e,n){let t=e.length;if(n>=t||n<3)return e.map((l,c)=>c);let r=[0],i=[],o=(t-2)/(n-2),s=0;for(let l=0;l<n-2;l++){let c=Math.floor((l+1)*o)+1,d=Math.min(t-1,Math.floor((l+2)*o)+1),u=0,h=0,b=0;for(let M=c;M<d;M++){let A=e[M];I(A)&&(u+=M,h+=A,b++)}u=b?u/b:(c+d)/2,h=b?h/b:0;let v=Math.floor(l*o)+1,x=Math.min(t-1,Math.floor((l+1)*o)+1),m=e[s],w=I(m)?m:0,y=-1,f=-1;for(let M=v;M<x;M++){let A=e[M];if(!I(A)){i.push(M);continue}let S=Math.abs((s-u)*(A-w)-(s-M)*(h-w));S>f&&(f=S,y=M)}y<0&&(y=v),r.push(y),s=y}return r.push(t-1),i.length?[...new Set([...r,...i])].sort((l,c)=>l-c):r}function ai(e,n){let t=e.length,r=Math.max(1,Math.floor(n/2));if(r*2>=t)return e.map((s,l)=>l);let i=[],o=t/r;for(let s=0;s<r;s++){let l=Math.floor(s*o),c=s===r-1?t:Math.floor((s+1)*o),d=-1,u=-1;for(let h=l;h<c;h++){let b=e[h];if(!I(b)){i.push(h);continue}(d<0||b<e[d])&&(d=h),(u<0||b>e[u])&&(u=h)}d>=0&&i.push(Math.min(d,u)),u>=0&&u!==d&&i.push(Math.max(d,u))}return[...new Set(i)].sort((s,l)=>s-l)}function li(e,n){let t=e.length,r=Math.max(1,Math.floor(n/4));if(r*4>=t)return e.map((s,l)=>l);let i=[],o=t/r;for(let s=0;s<r;s++){let l=Math.floor(s*o),c=s===r-1?t:Math.floor((s+1)*o),d=-1,u=-1,h=-1,b=-1;for(let v=l;v<c;v++){let x=e[v];if(!I(x)){i.push(v);continue}h<0&&(h=v),b=v,(d<0||x<e[d])&&(d=v),(u<0||x>e[u])&&(u=v)}for(let v of[h,d,u,b])v>=0&&i.push(v)}return[...new Set(i)].sort((s,l)=>s-l)}function gr(e,n,t){let r=oi(t);if(!r||n<=r.threshold||e.length===0)return;let i=r.strategy==="minmax"?ai:r.strategy==="m4"?li:si,o=new Set;for(let s of e)for(let l of i(s.slice(0,n),r.threshold))o.add(l);return[...o].sort((s,l)=>s-l)}function xr(e,n,t,r,i,o,s,l){if(r==="circle")return{..._e(e,n,t,i,o,s),part:l};let c=r==="square"?`M${p(e-t)} ${p(n-t)}h${p(2*t)}v${p(2*t)}h${p(-2*t)}Z`:r==="diamond"?`M${p(e)} ${p(n-t*1.3)}L${p(e+t*1.3)} ${p(n)}L${p(e)} ${p(n+t*1.3)}L${p(e-t*1.3)} ${p(n)}Z`:`M${p(e)} ${p(n-t*1.2)}L${p(e+t*1.15)} ${p(n+t*.9)}L${p(e-t*1.15)} ${p(n+t*.9)}Z`;return{kind:"path",part:l,d:c,fill:i,title:o,item:s}}var ci=e=>{let n=0;return e.map(t=>I(t)?n+=t:null)},di=e=>e.map((n,t)=>{let r=e[t-1];return t>0&&I(n)&&I(r)?n-r:null}),ui=e=>e.map((n,t)=>{let r=e[t-1];return t>0&&I(n)&&I(r)&&r!==0?(n-r)/Math.abs(r):null});function hi(e,n){let t=Math.max(1,Math.floor(n));return e.map((r,i)=>{if(i<t-1)return null;let o=0;for(let s=i-t+1;s<=i;s++){let l=e[s];if(!I(l))return null;o+=l}return o/t})}function fi(e,n="max"){let t=0;for(let r of e)I(r)&&(t=n==="sum"?t+r:Math.max(t,r));return e.map(r=>I(r)?t===0?0:r/t:null)}function mi(e,n="desc"){let t=e.filter(I).sort((r,i)=>n==="asc"?r-i:i-r);return e.map(r=>I(r)?t.indexOf(r)+1:null)}var pi=(e,n=-1/0,t=1/0)=>e.map(r=>I(r)&&r>=n&&r<=t?r:null),bi=(e,n="asc")=>[...e].sort((t,r)=>I(t)?I(r)?n==="asc"?t-r:r-t:-1:I(r)?1:0);function gi(e,n,t="sum"){let r=Math.max(1,Math.floor(n)),i=[];for(let o=0;o<e.length;o+=r){let s=e.slice(o,o+r).filter(I);if(s.length===0){i.push(null);continue}let l=s.reduce((c,d)=>c+d,0);i.push(t==="sum"?l:t==="mean"?l/s.length:t==="min"?Math.min(...s):Math.max(...s))}return i}function xi(e,n={}){let t=e.filter(I),r=$e(t,n);return{edges:r,counts:Ce(t,r).map(i=>i.count)}}function _t(e,n){let t=[...e];for(let r of n??[])switch(r.type){case"cumulative":t=ci(t);break;case"difference":t=di(t);break;case"percentageChange":t=ui(t);break;case"movingAverage":t=hi(t,r.window);break;case"normalize":t=fi(t,r.to);break;case"rank":t=mi(t,r.order);break;case"filter":t=pi(t,r.min,r.max);break;case"sort":t=bi(t,r.order);break;case"aggregate":t=gi(t,r.every,r.method);break;case"bin":t=xi(t,r).counts;break}return t}var yi=100,ki=2e3,yr=32,kr=28,at=e=>e.position==="right"||e.position==="top";function vi(e){let t=(e.yAxis===void 0?[]:Array.isArray(e.yAxis)?e.yAxis:[e.yAxis]).map((i,o)=>({...i,id:i.id??(o===0?"left":o===1?"right":String(o)),position:i.position??(o===1?"right":"left")}));t.length===0&&t.push({id:"left",position:"left"});let r=t.some(i=>i.id==="right"||at(i));return e.rightAxis?t.push({...e.rightAxis,id:"right",position:"right"}):!r&&e.series.some(i=>i.axis==="right")&&t.push({id:"right",position:"right"}),t}function wr(e,n){let t=e[0]?.id;return n===void 0||n==="left"?t:n==="right"?(e.find(r=>r.id==="right")??e.find(at))?.id:e.find(r=>r.id===n)?.id}var st=e=>e.kind==="bar"||e.kind==="range"&&e.style==="bar";function Mr(e,n){let t=ae(e.format),{series:r,categories:i,issues:o,axes:s}=Mi(e,n,t),l=e.direction==="rtl",c=e.baseline??0,d=Math.max(i.length,...r.map(a=>Math.max(a.data.length,a.low.length))),u=r.every(a=>re(a.data).length===0&&re(a.high).length===0),h=ot(e,u);if(h)return{...h,issues:o};let b=e.xAxis?.type??"category",v=b!=="category"&&i.length>0&&i.every(a=>typeof a!="string"||b==="time"&&I(le(a))),x=v?i.map(le):[],[m,w]=ce(x),y=e.xAxis?.format??(b==="time"?{style:w-m<2*864e5?"time":"date"}:void 0),f=Array.from({length:d},(a,k)=>{let C=i[k];return C===void 0?String(k+1):et(C,y)}),M=wi(e.zoom,d),A=Array.from({length:M.end-M.start},(a,k)=>M.start+k),S=e.orientation==="horizontal",_=r.map(a=>({...a,hidden:a.hidden||S&&!st(a)})).filter(a=>!a.hidden),W=_.some(a=>!st(a))?gr(_.filter(a=>!st(a)).map(a=>A.map(k=>(a.kind==="range"?a.high[k]:a.data[k])??null)),A.length,e.sampling):void 0,P=W?W.map(a=>A[a]):A,X=e.stacked==="percent"||e.stackOffset==="expand",Q=e.stackOffset??"zero",ie=new Map,fe=new Map,mt=new Map;for(let a of _)a.stack!==void 0&&a.kind!=="range"&&mt.set(a.stack,[...mt.get(a.stack)??[],a]);for(let a of mt.values()){let k=new Array(d).fill(c),C=new Array(d).fill(c),j=new Array(d).fill(0);if(X)for(let D of a)D.data.forEach((z,F)=>{I(z)&&(j[F]=j[F]+Math.abs(z))});for(let D of a){let z=[],F=[];for(let N=0;N<d;N++){let G=D.data[N];if(!I(G)){z.push(null),F.push(null);continue}let R=j[N],T=X?R>0?G/R:0:G,Z=T>=0?k:C;z.push(Z[N]),Z[N]=Z[N]+T,F.push(Z[N])}ie.set(D,z),fe.set(D,F)}if(Q==="silhouette"||Q==="wiggle"){let D=new Array(d).fill(0);if(Q==="silhouette")for(let z=0;z<d;z++)D[z]=-(k[z]-c)/2;else{let z=0;for(let F=0;F<d;F++){let N=a.length,G=0;for(let T=0;T<N;T++){let Z=a[T],E=Z.data[F],q=Z.data[F-1],te=F>0&&I(E)&&I(q)?E-q:0;G+=(N-T-.5)*te}let R=k[F]-c;z=F===0?-R/2:z-(R>0?G/Math.max(1,N):0),D[F]=z}}for(let z of a){let F=ie.get(z),N=fe.get(z);for(let G=0;G<d;G++){let R=F[G],T=N[G];I(R)&&(F[G]=R+D[G]),I(T)&&(N[G]=T+D[G])}}}}let Sn=a=>a.kind==="range"?{from:a.low,to:a.high}:{from:ie.get(a)??new Array(d).fill(c),to:fe.get(a)??a.data},$n=a=>{let k=[],C=!1;for(let z of _){if(z.axis!==a)continue;let{from:F,to:N}=Sn(z);for(let G of P){let R=N[G];if(I(R)&&k.push(R),z.kind==="range"||z.stack!==void 0){let T=F[G];I(T)&&k.push(T)}}if(z.errors)for(let G of P){let R=vr(z.data[G],z.errors[G]);R&&k.push(R[0],R[1])}(z.kind==="bar"||z.kind==="area")&&Q==="zero"&&(C=!0)}let[j,D]=ce(k);return C?[Math.min(c,j),Math.max(c,D)]:[j,D]},{width:Cn,height:In}=Vt(e),Br=e.brush?yr+kr:0,Tn=P.reduce((a,k)=>Math.max(a,f[k].length),0)*de,An=X?{style:"percent"}:void 0,Pr=a=>{if(a.scale==="log")return ne.left;let[k,C]=$n(a.id),j=ae(a.format??An??e.format),D=xe(a.min??k,a.max??C).reduce((z,F)=>Math.max(z,j(F).length),0);return Math.max(ne.left,D*de+14)+(a.showTicks?a.tickSize??4:0)},pt=a=>S?at(a)?"top":"bottom":at(a)!==l?"right":"left",On=a=>S?24+(a.showTicks?a.tickSize??4:0):Pr(a),Dr=new Set(_.map(a=>a.axis)),bt=s.filter(a=>Dr.has(a.id)||s.length>1),zn=new Map,ke={left:0,right:0,top:0,bottom:0};for(let a of bt){let k=pt(a);zn.set(a.id,ke[k]),ke[k]+=On(a)}let Ln=bt.find(a=>pt(a)==="bottom"),Nr={top:ne.top+ar(e)+(s.some(a=>a.label)?12:0)+ke.top,right:S?l?Math.max(ne.left,Tn+16):ne.right:Math.max(ne.right,ke.right),bottom:ne.bottom+Br+(e.xAxis?.label?14:0)+(e.xAxis?.tickRotation?24:0)+ke.bottom-(Ln?On(Ln):0),left:S?l?ne.right:Math.max(ne.left,Tn+16):Math.max(ne.left,ke.left)},K=ir(Cn,In,Nr),Fr=S?l?[K.x+K.width,K.x]:[K.x,K.x+K.width]:[K.y+K.height,K.y],Rn=S?[K.y,K.y+K.height]:l?[K.x+K.width,K.x]:[K.x,K.x+K.width],gt=new Map(s.map(a=>[a.id,{...dr($n(a.id),Fr,{format:An,...a},e.format),position:pt(a),offset:zn.get(a.id)??0}])),Vn=s[0]?.id,Ee=gt.get(Vn),xt=a=>gt.get(wr(s,a)??Vn)??Ee,oe=(a,k)=>xt(k).scale(a),Bn=a=>p(a.scale(Math.min(Math.max(c,Math.min(...a.domain)),Math.max(...a.domain)))),He=Qn(P.length,Rn,e.barGap),yt=P.map(a=>x[a]),kt=[...yt].sort((a,k)=>a-k),ve=1/0;for(let a=1;a<kt.length;a++)ve=Math.min(ve,kt[a]-kt[a-1]);let[we,Oe]=ce(yt),se=ve===1/0?Math.max(1,Math.abs(Oe)*.05||1):ve/2,ze=Se([we-se,Oe+se],Rn),Ue=a=>p(v?ze(yt[a]):He.center(a)),Pn=v?Math.abs(ze(we+(ve===1/0?se:ve))-ze(we))*.8:He.bandwidth,Dn=a=>v?Ue(a)-Pn/2:He.start(a),Gr=v?(b==="time"?er(we-se,Oe+se):xe(we-se,Oe+se)).filter(a=>a>=we-se&&a<=Oe+se).map(a=>({pos:p(ze(a)),label:et(a,y)})):it(P.map((a,k)=>({pos:Ue(k),label:f[a]})),S?1/0:K.width/Math.max(.2,Math.abs(Math.cos((e.xAxis?.tickRotation??0)*Math.PI/180)))),vt={...Bt(e,Cn,In,r.map(a=>({name:a.name,color:a.color}))),plot:K,xTicks:Gr,yTicks:S?it(Ee.ticks,K.width):Ee.ticks,baseline:Bn(Ee)},_r=s[0],Nn=Nt(vt,{horizontal:S,rtl:l,axes:bt.map(a=>{let k=gt.get(a.id);return{ticks:S?it(k.ticks,K.width):k.ticks,position:k.position,offset:k.offset??0,label:a.label,showLine:a.showLine,showTicks:a.showTicks,tickSize:a.tickSize}}),xLabel:e.xAxis?.label,grid:ur(_r),categoryGrid:e.xAxis?.grid===!0,x:e.xAxis}),jr=a=>{if(typeof a=="number"&&i.every(C=>typeof C=="string"))return a;let k=typeof a=="string"?a:le(a);for(let C=0;C<d;C++){let j=i[C];if(j!==void 0&&(typeof k=="string"?j===k||f[C]===k:le(j)===k))return C}},Fn={plot:K,horizontal:S,x:a=>{if(v&&(typeof a!="string"||I(le(a))))return ze(le(a));let k=jr(a),C=k===void 0?-1:P.indexOf(k);return C<0?void 0:He.center(C)},y:(a,k)=>oe(a,k)};Nn.push(...Ft(e.references,Fn));let wt=[],Mt=new Map;for(let a of _){if(!st(a))continue;let k=a.stack??a,C=wt.indexOf(k);C<0&&(C=wt.push(k)-1),Mt.set(a,C)}let Ke=Pn/Math.max(1,wt.length),me=Math.min(Ke,e.barWidth??1/0),Gn=(Ke-me)/2,St=[],qe=[],$t=[],Ct=[],It=[],_n=[],Ye=[],Xe=a=>xt(a.axis).format,Tt=Math.max(0,e.minBarSize??0),Wr=(a,k,C)=>{let j=Math.abs(k-a);if(j>=Tt)return[Math.min(a,k),j];let z=a+(S?C?1:-1:C?-1:1)*Tt;return[Math.min(a,z),Tt]},Le=(a,k,C,j)=>({label:j,series:a.name,seriesId:a.id??a.name,category:f[k],index:k,value:C}),jn=(a,k,C,j)=>{let D=vr(j,a.errors?.[k]);if(!D)return;let z=p(oe(D[0],a.axis)),F=p(oe(D[1],a.axis)),N=4,G="var(--skdx-color-text-default)",R=`${a.name}, ${f[k]}: ${Xe(a)(D[0])} \u2013 ${Xe(a)(D[1])}`;_n.push(S?{kind:"line",part:"error-bar",x1:z,x2:F,y1:C,y2:C,stroke:G,title:R}:{kind:"line",part:"error-bar",x1:C,x2:C,y1:z,y2:F,stroke:G,title:R},S?{kind:"line",part:"error-cap",x1:z,x2:z,y1:p(C-N),y2:p(C+N),stroke:G}:{kind:"line",part:"error-cap",x1:p(C-N),x2:p(C+N),y1:z,y2:z,stroke:G},S?{kind:"line",part:"error-cap",x1:F,x2:F,y1:p(C-N),y2:p(C+N),stroke:G}:{kind:"line",part:"error-cap",x1:p(C-N),x2:p(C+N),y1:F,y2:F,stroke:G})};for(let a of _){let{from:k,to:C}=Sn(a),j=Xe(a),D=P.length<=ki;if(a.kind==="bar"){let R="";P.forEach((T,Z)=>{let E=a.data[T],q=k[T],te=C[T];if(!I(E)||!I(q)||!I(te))return;let Me=oe(q,a.axis),ge=oe(te,a.axis),[Re,Ve]=Wr(Me,ge,te>=q),Be=Dn(Z)+Mt.get(a)*Ke+Gn,Zn=p(S?Re:Be),En=p(S?Be:Re),At=p(S?Ve:me),Hn=p(S?me:Ve);if(!D){R+=`M${Zn} ${En}h${At}v${Hn}h${-At}Z`;return}let Un=Dt(a.name,f[T],X?te-q:E,j);if(qe.push({kind:"rect",part:"bar",x:Zn,y:En,width:At,height:Hn,fill:a.color,rx:e.radius,title:Un,item:Le(a,T,E,Un)}),jn(a,T,p(Be+me/2),E),e.labels){let Kn=j(X?te-q:E);It.push(S?Y(p(Math.max(Me,ge)+4),p(Be+me/2),Kn,{baseline:"middle"}):Y(p(Be+me/2),p(Math.min(Me,ge)-4),Kn,{anchor:"middle"}))}}),R&&qe.push({kind:"path",part:"bars",d:R,fill:a.color,title:a.name});continue}if(a.kind==="range"&&a.style==="bar"){P.forEach((R,T)=>{let Z=k[R],E=C[R];if(!I(Z)||!I(E))return;let q=oe(Math.min(Z,E),a.axis),te=oe(Math.max(Z,E),a.axis),Me=Dn(T)+Mt.get(a)*Ke+Gn,ge=`${a.name}, ${f[R]}: ${j(Math.min(Z,E))} \u2013 ${j(Math.max(Z,E))}`,Re=Le(a,R,E,ge),Ve=Math.max(1,Math.abs(te-q));qe.push(S?{kind:"rect",part:"range",x:p(Math.min(q,te)),y:p(Me),width:p(Ve),height:p(me),fill:a.color,rx:e.radius,title:D?ge:void 0,item:Re}:{kind:"rect",part:"range",x:p(Me),y:p(Math.min(q,te)),width:p(me),height:p(Ve),fill:a.color,rx:e.radius,title:D?ge:void 0,item:Re})});continue}let z=e.nulls==="connect"||e.nulls===void 0&&e.connectNulls,F=[],N=[];P.forEach((R,T)=>{let Z=k[R],E=C[R];if(!I(E)||!I(Z)){!z&&N.length&&(F.push(N),N=[]);return}N.push({x:Ue(T),y:p(oe(E,a.axis)),y0:p(oe(Z,a.axis)),i:R})}),N.length&&F.push(N);let G=a.markers??P.length<=yi;for(let R of F){let T=ye(R,a.curve);if(a.kind==="range"&&a.style==="line"){$t.push({kind:"path",part:"range-high",d:T,stroke:a.color,strokeWidth:2,strokeLinejoin:"round"},{kind:"path",part:"range-low",d:ye(R.map(Z=>({x:Z.x,y:Z.y0})),a.curve),stroke:a.color,strokeWidth:2,strokeLinejoin:"round",dash:"4 3"});continue}if(a.kind==="range"){let Z=ye([...R].reverse().map(E=>({x:E.x,y:E.y0})),a.curve);St.push({kind:"path",part:"range",d:`${T}L${Z.slice(1)}Z`,fill:a.color,fillOpacity:.2,title:a.name});continue}if(a.kind==="area"){let Z=Bn(xt(a.axis)),E=a.stack!==void 0?ye([...R].reverse().map(te=>({x:te.x,y:te.y0})),a.curve).slice(1):`${R[R.length-1]?.x} ${Z}L${R[0]?.x} ${Z}`,q=`skdx-g-${a.index}`;a.gradient&&!Ye.some(te=>te.id===q)&&Ye.push({id:q,vertical:!0,stops:[{offset:0,color:a.color,opacity:a.fillOpacity},{offset:1,color:a.color,opacity:0}]}),St.push({kind:"path",part:"area",d:`${T}L${E}Z`,fill:a.gradient?`url(#${q})`:a.color,fillOpacity:a.gradient?void 0:a.fillOpacity})}$t.push({kind:"path",part:"line",d:T,stroke:a.color,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",dash:a.dash})}if(a.kind==="range"&&D)for(let R of F)for(let T of R){let Z=a.low[T.i],E=a.high[T.i],q=`${a.name}, ${f[T.i]}: ${j(Math.min(Z,E))} \u2013 ${j(Math.max(Z,E))}`;Ct.push({..._e(T.x,T.y,.01,a.color,q,Le(a,T.i,E,q)),part:"anchor"})}if(a.kind!=="range")for(let R of F)for(let T of R){if(!G&&!D&&!e.labels&&!a.errors)continue;let Z=a.data[T.i],E=X?C[T.i]-k[T.i]:Z,q=Dt(a.name,f[T.i],E,j);(G||D)&&Ct.push(G&&a.symbol!=="circle"?xr(T.x,T.y,a.markerSize,a.symbol,a.color,D?q:void 0,Le(a,T.i,Z,q),"point"):{..._e(T.x,T.y,G?a.markerSize:.01,a.color,D?q:void 0,Le(a,T.i,Z,q)),part:G?"point":"anchor"}),D&&jn(a,T.i,S?T.y:T.x,C[T.i]),e.labels&&It.push(Y(T.x,T.y-8,j(E),{anchor:"middle"}))}}let Wn={plot:K,xs:S?[]:P.map((a,k)=>Ue(k)),rows:P.map(a=>[f[a],..._.map(k=>{let C=Xe(k);if(k.kind==="range"){let D=k.low[a],z=k.high[a];return`${k.name}: ${I(D)&&I(z)?`${C(D)} \u2013 ${C(z)}`:"\u2014"}`}let j=k.data[a];return`${k.name}: ${I(j)?C(X?(fe.get(k)?.[a]??0)-(ie.get(k)?.[a]??0):j):"\u2014"}`})]),count:d,zoom:M,crosshair:or(e)},Qe=[];if(e.brush&&!S){let a={x:K.x,y:K.y+K.height+kr,width:K.width,height:yr},k=_.find(j=>j.kind!=="range"),C={x:p(a.x+M.start/Math.max(1,d)*a.width),y:a.y,width:p((M.end-M.start)/Math.max(1,d)*a.width),height:a.height};if(Qe.push({kind:"rect",part:"brush",x:a.x,y:a.y,width:a.width,height:a.height,fill:"var(--skdx-color-surface-sunken)",stroke:B.grid}),k){let j=re(k.data),[D,z]=ce(j),F=d>1?a.width/(d-1):0,N=k.data.flatMap((R,T)=>I(R)?[{x:p(a.x+T*F),y:p(a.y+a.height-(z===D?.5:(R-D)/(z-D))*(a.height-4)-2)}]:[]),G=ye(N);N.length>1&&Qe.push({kind:"path",part:"brush-series",d:`${G}L${N[N.length-1]?.x} ${a.y+a.height}L${N[0]?.x} ${a.y+a.height}Z`,fill:k.color,fillOpacity:.3})}Qe.push({kind:"rect",part:"brush-window",...C,fill:"var(--skdx-color-primary-500)",opacity:.15,stroke:B.axis},{kind:"rect",part:"brush-handle",x:p(C.x-3),y:a.y+8,width:6,height:a.height-16,fill:B.axis,rx:2},{kind:"rect",part:"brush-handle",x:p(C.x+C.width-3),y:a.y+8,width:6,height:a.height-16,fill:B.axis,rx:2}),Wn.brush={box:a,window:C}}return{...vt,shapes:[...Nn,...St,...qe,...$t,..._n,...Ct,...It,...br(e.annotations,Fn),...Qe,...vt.shapes],hit:Wn,issues:o,defs:Ye.length?Ye:void 0}}function vr(e,n){if(!(!I(e)||n===null||n===void 0))return typeof n=="number"?I(n)?[e-Math.abs(n),e+Math.abs(n)]:void 0:I(n[0])&&I(n[1])?[Math.min(n[0],n[1]),Math.max(n[0],n[1])]:void 0}function wi(e,n){if(!e||n<2)return{start:0,end:n};let t=Math.max(0,Math.min(n-1,Math.floor(e.start))),r=Math.max(t+1,Math.min(n,Math.ceil(e.end)));return r-t<2&&n>=2?{start:Math.min(t,n-2),end:Math.min(t,n-2)+2}:{start:t,end:r}}function Mi(e,n,t){let r=f=>f.type??n,i=[],o=vi(e),s=e.categories??[],l=(e.transforms??[]).filter(f=>f.type==="sort"||f.type==="bin"||f.type==="aggregate"),c=(e.transforms??[]).filter(f=>!l.includes(f)),d=e.stacked||e.stackOffset!==void 0&&e.stackOffset!=="zero",u=(f,M,A)=>{let S=A.filter(O=>O!==null&&!(typeof O=="number"&&Number.isFinite(O))).length;S&&i.push({code:"invalid-value",severity:"warning",message:`Series "${f}" has ${S} value${S===1?"":"s"} that ${S===1?"is":"are"} neither a number nor null; drawn as gaps.`,itemId:M??f}),s.length&&A.length!==s.length&&!e.transform&&i.push({code:"length-mismatch",severity:"warning",message:`Series "${f}" has ${A.length} values for ${s.length} categories.`,itemId:M??f})},h=e.series.map((f,M)=>{let A=r(f),S=d?!0:void 0,O=f.type==="range"?void 0:f.stack,_=O===!1?void 0:O===!0||O===void 0&&S?`${A}`:O;f.type==="range"?(u(f.name,f.id,f.low),u(f.name,f.id,f.high)):u(f.name,f.id,f.data);let W=X=>e.nulls==="zero"?X.map(Q=>I(Q)?Q:0):X,P=wr(o,f.axis);return P===void 0&&i.push({code:"unknown-axis",severity:"warning",message:`Series "${f.name}" names axis "${String(f.axis)}", which is not defined; drawn on the first axis.`,itemId:f.id??f.name}),{name:f.name,id:f.id,color:lr(e,M,f.color),axis:P??o[0]?.id,hidden:cr(e,f.name),index:M,kind:A,data:f.type==="range"?[]:W(_t(_t(f.data,c),f.transforms)),low:f.type==="range"?f.low:[],high:f.type==="range"?f.high:[],curve:f.curve??e.curve??"linear",dash:f.type==="range"?void 0:f.dash,markers:f.type==="range"?void 0:f.markers,symbol:f.type==="range"?"circle":f.symbol??"circle",markerSize:f.type==="range"?3:f.markerSize??3,errors:f.type==="range"?void 0:f.errors,stack:A==="range"||A==="line"?void 0:_,style:f.type==="range"?f.style??"area":"area",fillOpacity:(f.type==="range"?void 0:f.fillOpacity)??e.fillOpacity??.25,gradient:f.type!=="range"&&f.gradient===!0}}),b=()=>Math.max(s.length,...h.map(f=>Math.max(f.data.length,f.low.length))),v=f=>{let M=S=>S.length?f.map(O=>S[O]??null):S,A=Array.from({length:b()},(S,O)=>s[O]??String(O+1));s=f.map(S=>A[S]),h=h.map(S=>({...S,data:M(S.data),low:M(S.low),high:M(S.high)}))},x=(f,M)=>{let A=(M!==void 0?h.find(O=>O.name===M):void 0)??h.find(O=>!O.hidden&&O.kind!=="range")??h[0];M!==void 0&&!h.some(O=>O.name===M)&&i.push({code:"unknown-series",severity:"warning",message:`sort.by names "${M}", which is not a series; sorted by the first series.`});let S=Array.from({length:b()},(O,_)=>_).sort((O,_)=>{let W=A?.data[O]??A?.high[O],P=A?.data[_]??A?.high[_],X=I(W)?W:-1/0,Q=I(P)?P:-1/0;return f==="asc"?X-Q:Q-X});v(S)},m=f=>{let M=h.flatMap(S=>re(S.data)),A=$e(M,f);s=A.slice(1).map((S,O)=>`${t(A[O])}\u2013${t(S)}`),h=h.map(S=>{let O=re(S.data),_=0,W=Ce(O,A).map(P=>e.binMode==="density"?O.length?P.count/(O.length*(P.x1-P.x0)):0:e.binMode==="cumulative"?_+=P.count:P.count);return{...S,data:W}})},w=(f,M)=>{let A=Math.max(1,Math.floor(f)),S=b(),O=W=>{if(!W.length)return W;let P=[];for(let X=0;X<S;X+=A){let Q=re(W.slice(X,X+A));P.push(Q.length===0?null:M==="sum"?Q.reduce((ie,fe)=>ie+fe,0):M==="mean"?Q.reduce((ie,fe)=>ie+fe,0)/Q.length:M==="min"?Math.min(...Q):Math.max(...Q))}return P};s=Array.from({length:S},(W,P)=>s[P]??String(P+1)).filter((W,P)=>P%A===0),h=h.map(W=>({...W,data:O(W.data),low:O(W.low),high:O(W.high)}))};e.transform==="histogram"?m({bins:e.bins,binWidth:e.binWidth,domain:e.binDomain}):e.transform==="cumulative"&&(h=h.map(f=>{let M=0;return{...f,data:f.data.map(A=>I(A)?M+=A:M)}}));for(let f of l)f.type==="sort"?x(f.order??"desc"):f.type==="bin"?m(f):f.type==="aggregate"&&w(f.every,f.method??"sum");typeof e.sort=="string"?x(e.sort):e.sort&&x(e.sort.order,e.sort.by);let y=e.xAxis?.domain;if(y){let f=b(),M=Array.from({length:f},(_,W)=>s[W]??String(W+1)),A=_=>{let W=typeof _=="string"?_:le(_);return M.findIndex(P=>typeof W=="string"?P===W||et(P)===W:le(P)===W)},S=y.map(A),O=_=>_.length?S.map(W=>W<0?null:_[W]??null):_;s=[...y],h=h.map(_=>({..._,data:O(_.data),low:O(_.low),high:O(_.high)}))}return{series:h,categories:s,issues:i,axes:o}}function lt(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var jt=e=>e.id??e.name??e.series,Sr=e=>e.seriesId??e.series;function ue(e,n){let t=!1;return n.id!==void 0&&(t=!0,jt(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,Sr(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 pe(e){let n={},t=jt(e);t!==void 0&&(n.id=t);let r=Sr(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var Wt=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function Zt(e,n,t){let r=lt(e),i=pe(n),o=r.some(s=>ue(n,s));return t==="single"?o?[]:[i]:o?r.filter(s=>!ue(n,s)):[...r,i]}var Si=.2;function $i(e){let n=B.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 Ci=(e,n)=>e.kind==="text"?{...e,fill:B.grid}:{...e,opacity:(e.opacity??1)*n};function Et(e,n){let t=lt(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:lt(n.highlighted),i=r[0];if(t.length===0&&!i)return e;let o={highlighted:n.highlightScope?.highlighted??"item",faded:n.highlightScope?.faded??"global"},s=[],l=u=>!i||r.some(h=>ue(u,h))?!0:o.highlighted==="series"?r.some(h=>h.series!==void 0&&ue(u,{series:h.series})):!1,c=u=>{if(!i||o.faded==="none"||l(u))return!1;if(o.faded==="series"){let h=i.series;return h!==void 0&&ue(u,{series:h})}return!0},d=e.shapes.map(u=>{let h=u.item;if(!h||h.legend)return u;if(t.some(b=>ue(h,b))){let b=$i(u);b&&s.push(b)}return c(h)?Ci(u,Si):u});return s.length?{...e,shapes:[...d,...s]}:{...e,shapes:d}}function Ht(e){let n=re(e.data),t=ot(e,n.length===0);if(t)return t;let r=$e(n,{bins:e.bins,binWidth:e.binWidth,domain:e.domain,thresholds:e.thresholds}),i=Ce(n,r),o=i.reduce((m,w)=>m+w.count,0),s=e.mode??"count",l=ae(e.xAxis?.format??e.format),c=ae(s==="percent"?{style:"percent",digits:1}:s==="density"?{style:"decimal",digits:3}:e.format),d=e.name??(s==="density"?"Density":s==="percent"?"Share":"Count"),u=m=>s==="density"?o>0&&m.x1>m.x0?m.count/(o*(m.x1-m.x0)):0:s==="percent"?o>0?m.count/o:0:m.count,h=i.map(m=>`${l(m.x0)}\u2013${l(m.x1)}`),b=Mr({...e,format:c,series:[{name:d,data:i.map(u),color:e.color}],categories:h,xAxis:e.xAxis?.label?{label:e.xAxis.label}:void 0,barGap:e.barGap??.05,transform:void 0},"bar"),v=b.shapes.map((m,w)=>{if(m.part!=="bar"||!m.item||m.item.index===void 0)return m;let y=i[m.item.index];if(!y)return m;let f=o>0?` (${Math.round(y.count/o*1e3)/10}%)`:"",M=`${h[m.item.index]??String(w)}: ${y.count}${f}${s==="count"?"":` \xB7 ${d} ${c(u(y))}`}`;return{...m,title:m.title===void 0?void 0:M,item:{...m.item,label:M}}}),x=b.hit?.rows.map((m,w)=>{let y=i[w];return y?[m[0],`${d}: ${c(u(y))}`,`Observations: ${y.count}`]:m});return{...b,shapes:v,hit:b.hit&&x?{...b.hit,rows:x}:b.hit}}function Ae(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 Ut=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function $r(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 je(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=$r(t,n),i=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(i,r)??i}}function Kt(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[$r(t,n)];return{kind:"line",part:"crosshair",x1:r,x2:r,y1:t.plot.y,y2:t.plot.y+t.plot.height,stroke:B.axis,dash:"3 3"}}function qt(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!Ut(r.plot,n,t))return[];let i=Kt(e,n),{rows:o}=je(e,n),s=e.tooltipAnchored?r.plot.y+8:t;return[i,...rt(i.x1,s,o,e.width,e.height,e.tooltipPlacement)]}function Yt(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 qt(e,i,t.plot.y+8)}function Xt(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:c,y:d}=Ae(t,r,i,e.width,e.height);if(Ut(e.hit.plot,c,d)){let u=je(e,c),h=Kt(e,c);if(u&&h)return{lines:u.rows,shapes:[h]}}}let o=n?.closest?.("[data-skdx-part]"),s=e.tooltipFormatter?be(e,n)?.item:void 0,l=s&&e.tooltipFormatter?.(s)||o&&Array.from(o.children).find(c=>c.tagName.toLowerCase()==="title")?.textContent;return l?{lines:Array.isArray(l)?l:[l],shapes:[]}:{lines:[],shapes:[]}}function Cr(e,n,t,r,i,o,s){let l=e?.closest?.("[data-skdx-part]"),c=s&&s.tooltipFormatter?be(s,e)?.item:void 0,d=c&&s?.tooltipFormatter?.(c)||l&&Array.from(l.children).find(x=>x.tagName.toLowerCase()==="title")?.textContent;if(!d)return[];let u=s?.tooltipAnchored?be(s,e):void 0,h=u?s?.shapes[u.index]:void 0,{x:b,y:v}=h?We(h):Ae(n,t,r,i,o);return rt(b,v,d,i,o,s?.tooltipPlacement)}function Qt(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:s}=Ae(t,r,i,e.width,e.height),l=qt(e,o,s);if(l.length>0)return l}return Cr(n,t,r,i,e.width,e.height,e)}function Jt(e,n){let t=be(e,n);return t&&!t.item.legend?pe(t.item):null}var Ii=(e,n)=>{let{x:t,y:r}=We(e),i=e.kind==="circle"?e.cy:e.kind==="rect"?e.y+e.height/2:r;return t>=n.x&&t<=n.x+n.width&&i>=n.y&&i<=n.y+n.height};function en(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!Ii(i,n))continue;let o=pe(i.item),s=JSON.stringify(o);t.has(s)||(t.add(s),r.push(o))}return r}var tn=e=>({kind:"rect",part:"selection-box",x:p(e.x),y:p(e.y),width:p(e.width),height:p(e.height),fill:B.focus,opacity:.12,stroke:B.focus}),dt=(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 Ir(e,n,t){let r=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){let s=e[i],l=e[o];s.y>t!=l.y>t&&n<(l.x-s.x)*(t-s.y)/(l.y-s.y)+s.x&&(r=!r)}return r}function nn(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}=We(i),l=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:s;if(!Ir(n,o,l))continue;let c=pe(i.item),d=JSON.stringify(c);t.has(d)||(t.add(d),r.push(c))}return r}var rn=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${p(n.x)} ${p(n.y)}`).join("L")}`:"",fill:B.focus,fillOpacity:.12,stroke:B.focus,dash:"4 3"}),ct=6;function on(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-ct||n>i.x1+ct))return Math.abs(n-i.x0)<=ct?{bar:i,mode:"start"}:Math.abs(n-i.x1)<=ct?{bar:i,mode:"end"}:{bar:i,mode:"move"}}}function sn(e,n,t){let r=e.edit;return Tr(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function an(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(c=>c.index===n);if(!o)return;let s=t.altKey?t.shiftKey?"start":"end":"move",l=r.snap??r.invert(o.x0+10)-r.invert(o.x0);return Tr(r,{bar:o,mode:s},i*l)}function Tr(e,{bar:n,mode:t},r){let i=l=>e.snap?Math.round(l/e.snap)*e.snap:l,o=n.start,s=n.end;return t==="move"?(o=i(n.start+r),s=o+(n.end-n.start)):t==="start"?o=Math.min(i(n.start+r),n.end):s=Math.max(i(n.end+r),n.start),{id:n.id,name:n.name,start:o,end:s}}function ln(e,n,t){let r=e.edit,i=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:p(Math.min(i,o)),y:p(n.bar.y),width:p(Math.max(1,Math.abs(o-i))),height:p(n.bar.height),fill:B.focus,opacity:.25,stroke:B.focus,rx:2}}var Ti=64,Ai=e=>Math.max(1,Math.min(Ti,e));function cn(e,n,t,r){let i=n>0?.8:1.25,o=Ai(e.view.zoom*i);if(o===e.view.zoom)return e.view;let{plot:s,scale:l}=e,[c,d]=e.view.center,u=(t-(s.x+s.width/2))/l,h=(r-(s.y+s.height/2))/l,b=e.view.zoom/o;return{center:[c+u*(1-b),e.fromY(e.toY(d)-h*(1-b))],zoom:o}}function dn(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 be(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 ut=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function We(e){switch(e.kind){case"rect":return{x:e.x+e.width/2,y:e.y};case"circle":return{x:e.cx,y:e.cy-e.r};case"line":return{x:(e.x1+e.x2)/2,y:Math.min(e.y1,e.y2)};case"text":return{x:e.x,y:e.y};case"path":{let n=/M\s*(-?[\d.]+)[ ,](-?[\d.]+)/.exec(e.d);return n?{x:Number(n[1]),y:Number(n[2])}:{x:0,y:0}}}}function un(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let r=B.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*de+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}=We(t),l=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...l?rt(p(o),p(s),l,e.width,e.height):[]]}function hn(e,n,t){let r=ut(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 Ie=2,Te=(e,n,t)=>{let r=Math.max(Ie,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},Ar=(e,n)=>!e||e.start<=0&&e.end>=n;function fn(e,n,t){if(e.count<=Ie||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,s=n>0?1.25:.8,l=Math.max(Ie,Math.min(e.count,Math.round(o*s)));if(l===o)return n>0&&!Ar(e.zoom,e.count)?Te(r,l,e.count):void 0;let c=Math.max(0,Math.min(1,(t-e.plot.x)/e.plot.width)),d=r+c*o;return Te(d-c*l,l,e.count)}function mn(e,n,t,r){let i=n.end-n.start,o=Math.max(Ie,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 Te(n.start+s*i-s*o,o,e.count)}function pn(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return Te(n.start-t/i,r,e.count)}function bn(e,n,t){let r=e.brush;if(!r||!Ut(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:Te(s-o/2,o,e.count)}}function gn(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 Te(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-Ie,Math.round(t.start+o))),end:t.end};let s=Math.min(e.count,Math.max(t.start+Ie,Math.round(t.end+o)));return{start:t.start,end:s}}function yn(e,n){switch(n.type){case"svg":return Promise.resolve(xn(e,n.label,n.resolve));case"csv":return Promise.resolve(Rr(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=xn(e,n.label,n.resolve);return Lr(t,e.width,e.height,n.scale,n.background)}}}var he=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;"),Ze=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${he(String(t))}"`).join("");function Or(e){let n=e.title?`<title>${he(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${Ze([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${Ze([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${Ze([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${Ze([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${Ze([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]])}>${he(e.text)}</text>`}}function zr(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${he(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="${he(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function xn(e,n,t){let r=zr(e)+e.shapes.map(Or).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="${he(n)}" font-family="${he(B.fontFamily)}" font-size="${he(B.fontSize)}"><title>${he(n)}</title>${r}</svg>`}function Lr(e,n,t,r=2,i){return new Promise((o,s)=>{let l=URL.createObjectURL(new Blob([e],{type:"image/svg+xml;charset=utf-8"})),c=new Image;c.onload=()=>{URL.revokeObjectURL(l);let d=document.createElement("canvas");d.width=Math.round(n*r),d.height=Math.round(t*r);let u=d.getContext("2d");if(!u)return s(new Error("canvas 2d context unavailable"));i&&(u.fillStyle=i,u.fillRect(0,0,d.width,d.height)),u.drawImage(c,0,0,d.width,d.height),d.toBlob(h=>h?o(h):s(new Error("toBlob failed")),"image/png")},c.onerror=()=>{URL.revokeObjectURL(l),s(new Error("svg could not be decoded"))},c.src=l})}function Rr(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 kn(e,n){if(!n)return;let t=typeof n=="object"?n.maxRows??500:500,r=e.hit;if(r&&r.rows.length>0){let l=r.rows[0];if(r.rows.length>t)return;let c=["",...l.slice(1).map(u=>u.replace(/:\s[^:]*$/,""))],d=r.rows.map(u=>[u[0],...u.slice(1).map(h=>h.slice(h.lastIndexOf(": ")+2))]);return[c,...d]}let i=e.shapes.flatMap(l=>l.item&&!l.item.legend&&!(l.part==="anchor"&&!l.title)?[l.item]:[]);if(i.length===0||i.length>t)return;let o=["series","name","category","value"].filter(l=>i.some(c=>c[l]!==void 0)),s=(l,c)=>l[c]===void 0?"":String(l[c]);return[o.map(l=>l[0]?.toUpperCase()+l.slice(1)),...i.map(l=>o.map(c=>s(l,c)))]}var vn=new Map;function ht(e){let n=vn.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&&vn.delete(e)}},publish(o,s){Object.assign(r,o);for(let l of t)l(o,s)}};return vn.set(e,{group:i,listeners:t}),i}var Vr='[data-skdx-part]:not([data-skdx-part^="tooltip"]):not([data-skdx-part="focus"]):not([data-skdx-part="crosshair"])',wn=`@keyframes skdx-in{from{opacity:0}to{opacity:1}}${Vr}{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){${Vr}{animation:none;transition:none}}`;function Mn(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}var L=require("lit"),$=require("lit/decorators.js"),H=require("lit/directives/if-defined.js");var Oi={fromAttribute:()=>!1},V=class extends L.LitElement{constructor(){super(...arguments);this.legend=!1;this.tooltip=!0;this.selectionMode="none";this.loading=!1;this.decorative=!1;this.accessibleTable=!1;this.zoomable=!1;this.editable=!1;this.crossFilter=!1;this.animated=!1;this.responsive=!1;this.tip=[];this.overlay=[];this.portal=null;this.highlightState=null;this.crossState=null;this.lastCross=null;this.pointers=new Map;this.hover=null;this.token={};this.focused=null;this.hiddenState=[];this.drag=null;this.onPointerMove=t=>{let r=this.layout;if(!r)return;this.pointers.has(t.pointerId)&&this.pointers.set(t.pointerId,this.viewBox(t,r).x);let i=this.drag;if(i?.grab==="select"){let{x:o,y:s}=this.viewBox(t,r);this.overlay=[tn(dt(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=[rn(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=sn(r,i.gantt,o-i.x),this.overlay=[ln(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(dn(r.map,i.view,o-i.x,s-i.y));return}if(i&&r.hit){if(i.grab==="pinch"){let[s,l]=[...this.pointers.values()];if(s===void 0||l===void 0||!i.distance)return;this.setZoom(mn(r.hit,i.zoom,Math.abs(s-l)/i.distance,(s+l)/2));return}let{x:o}=this.viewBox(t,r);this.setZoom(i.grab==="pan"?pn(r.hit,i.zoom,o-i.x):gn(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:s}=Xt(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=Qt(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(Jt(r,t.target)),this.syncId&&r.hit?.crosshair){let o=je(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=be(r,t.target)?.item.legend,l=this.canEdit(r)?on(r,i,o):void 0;if(l){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"edit",gantt:l},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.brushing()&&!s){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:this.selectionMode==="lasso"?"lasso":"select",points:[{x:i,y:o}]},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.canPan(r)&&r.map){let d=r.map.plot;if(i<d.x||i>d.x+d.width||o<d.y||o>d.y+d.height)return;this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"map",view:r.map.view},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}let c=r.hit;if(!(!c||!this.canZoom(r))){if(this.pointers.set(t.pointerId,i),this.pointers.size===2){let[d,u]=[...this.pointers.values()];this.drag={x:(d+u)/2,y:o,zoom:c.zoom,grab:"pinch",distance:Math.abs(d-u)||1}}else{let d=bn(c,i,o);if(d)this.drag={x:i,y:o,zoom:d.zoom,grab:d.grab},d.zoom!==c.zoom&&this.setZoom(d.zoom);else if(this.zoomable&&i>=c.plot.x&&i<=c.plot.x+c.plot.width&&o>=c.plot.y&&o<=c.plot.y+c.plot.height)this.drag={x:i,y:o,zoom:c.zoom,grab:"pan"};else{this.pointers.delete(t.pointerId);return}}t.currentTarget.setPointerCapture(t.pointerId),this.clearTip()}};this.onPointerUp=t=>{this.pointers.delete(t.pointerId);let r=t.currentTarget;r.hasPointerCapture(t.pointerId)&&r.releasePointerCapture(t.pointerId);let i=this.drag,o=this.layout;if(o&&(i?.grab==="select"||i?.grab==="lasso"||i?.grab==="edit"||i?.grab==="map")){this.overlay=[];let{x:s,y:l}=this.viewBox(t,o);if(Math.abs(s-i.x)>2||Math.abs(l-i.y)>2){i.grab==="select"?this.setSelected(en(o,dt(i.x,i.y,s,l))):i.grab==="lasso"?this.setSelected(nn(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 c=r.map.plot;if(i<c.x||i>c.x+c.width||o<c.y||o>c.y+c.height)return;t.preventDefault(),this.setView(cn(r.map,t.deltaY,i,o));return}let s=r.hit;if(!s||!this.canZoom(r)||o<s.plot.y||o>s.plot.y+s.plot.height)return;let l=fn(s,t.deltaY,i);l&&(t.preventDefault(),this.setZoom(l))};this.onClick=t=>{if(!this.layout)return;if(this.drag?.distance===-1){this.drag=null;return}let r=be(this.layout,t.target);r&&(r.item.range?this.setZoom(r.item.range):r.item.legend&&r.item.series!==void 0?this.toggle(r.item.series):(this.select(r.item),this.emit("skdx-item-click",r.item)))};this.onKeyDown=t=>{let r=this.layout;if(!r)return;if((t.key==="Enter"||t.key===" ")&&this.focused!==null){let l=r.shapes[this.focused]?.item;l&&(t.preventDefault(),this.select(l),this.emit("skdx-item-click",l));return}let i=this.canEdit(r)?an(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=hn(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?pe(s):null)}}connectedCallback(){super.connectedCallback(),!(typeof ResizeObserver>"u")&&(this.observer=new ResizeObserver(([t])=>{let r=Math.floor(t?.contentRect.width??0);r>0&&(this.measured=r)}),this.observer.observe(this))}disconnectedCallback(){this.observer?.disconnect(),this.leave?.(),this.leave=void 0,this.joined=void 0,super.disconnectedCallback()}sized(){let{width:t,height:r,legend:i,tooltip:o,format:s,palette:l,loading:c,error:d,emptyMessage:u,description:h,decorative:b,animated:v,responsive:x,highlighted:m,highlightScope:w,accessibleTable:y}=this;return{...typeof x=="object"&&this.measured!==void 0&&this.measured<(x.breakpoint??480)?x.compact:void 0,width:x&&this.measured?this.measured:t,height:r,animate:v,responsive:x,legend:i,tooltip:o,format:s,palette:l,loading:c,error:d,emptyMessage:u,description:h,decorative:b,highlighted:m===void 0?this.highlightState:m,highlightScope:w,accessibleTable:y,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&&ht(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=ht(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&&Wt(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(Zt(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 Ae(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&&ue(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?yn(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=Et(Pt(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let y of o.issues??[])this.emit("skdx-data-issue",y)}let s=this.canZoom(o),l=this.canPan(o),c=this.canEdit(o),d=this.brushing(),u=s||l||c||d,h=!o.decorative&&ut(o).length>0,b=o.description?`${r}-desc`:void 0,v=Mn(o),x=kn(o,this.accessibleTable),m=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,w=this.portal;return L.html`<svg
1
+ "use strict";var Je=Object.defineProperty;var qn=Object.getOwnPropertyDescriptor;var Ur=Object.getOwnPropertyNames;var Kr=Object.prototype.hasOwnProperty;var qr=(e,n)=>{for(var t in n)Je(e,t,{get:n[t],enumerable:!0})},Yr=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of Ur(n))!Kr.call(e,i)&&i!==t&&Je(e,i,{get:()=>n[i],enumerable:!(r=qn(n,i))||r.enumerable});return e};var Xr=e=>Yr(Je({},"__esModule",{value:!0}),e),x=(e,n,t,r)=>{for(var i=r>1?void 0:r?qn(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&&Je(n,t,i),i};var Vi={};qr(Vi,{SkdxHistogram:()=>J});module.exports=Xr(Vi);var ee=require("lit/decorators.js");var Yn=e=>Number(e.toPrecision(12)),Qr,Xn=e=>(Qr??(Qr=new Intl.NumberFormat)).format(Yn(e)),Jr=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 le(e){if(e===void 0)return Xn;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,l=u=>r===void 0?u===void 0?{}:{maximumFractionDigits:u}:{minimumFractionDigits:r,maximumFractionDigits:r},c=u=>{let h=new Intl.NumberFormat(t,u);return s(b=>h.format(Yn(b)))},d=u=>{let h=new Intl.DateTimeFormat(t,o?{...u,timeZone:o}:u);return b=>h.format(b)};switch(n){case"integer":return c({maximumFractionDigits:0});case"decimal":return c(l(2));case"percent":return c({style:"percent",...l(0)});case"currency":return c({style:"currency",currency:e.currency??"USD",...l()});case"compact":return c({notation:"compact",...l(1)});case"scientific":return c({notation:"scientific",...l(2)});case"date":return d({dateStyle:"medium"});case"time":return d({timeStyle:"short"});case"datetime":return d({dateStyle:"medium",timeStyle:"short"});case"duration":return s(Jr)}}function et(e,n){if(typeof e=="string")return e;let t=e instanceof Date?e.getTime():e;return n?le(n)(t):e instanceof Date?new Intl.DateTimeFormat().format(e):Xn(t)}var ce=e=>{if(e instanceof Date)return e.getTime();if(typeof e=="number")return e;let n=Number(e);return Number.isFinite(n)&&e.trim()!==""?n:Date.parse(e)};function Se([e,n],[t,r]){let i=n-e;return o=>i===0?t:t+(o-e)/i*(r-t)}function xe(e,n,t=5){if(e===n)return[e];let r=(n-e)/Math.max(1,t),i=10**Math.floor(Math.log10(r)),o=r/i,s=(o<1.5?1:o<3.5?2:o<7.5?5:10)*i,l=Math.floor(e/s)*s,c=Math.ceil(n/s)*s,d=[];for(let u=l;u<=c+s/2;u+=s)d.push(Jn(u));return d}function Qn(e,[n,t],r=.2){let i=e===0?0:(t-n)/e,o=i*(1-Math.max(0,Math.min(.9,r)));return{step:i,bandwidth:o,start:s=>n+s*i+(i-o)/2,center:s=>n+(s+.5)*i}}var Jn=e=>Number(e.toPrecision(12)),p=e=>Number(e.toFixed(2)),I=e=>typeof e=="number"&&Number.isFinite(e),re=e=>e.filter(I);function de(e){let n=1/0,t=-1/0;for(let r of e)I(r)&&(r<n&&(n=r),r>t&&(t=r));return n===1/0?[0,0]:[n,t]}function ye(e,n="linear"){if(e.length===0)return"";let t=e[0];if(n==="step"||n==="stepBefore"||n==="stepAfter"){let d=`M${t.x} ${t.y}`;for(let u=1;u<e.length;u++){let h=e[u-1],b=e[u];n==="stepAfter"?d+=`H${b.x}V${b.y}`:n==="stepBefore"?d+=`V${b.y}H${b.x}`:d+=`H${p((h.x+b.x)/2)}V${b.y}H${b.x}`}return d}if(n==="linear"||e.length<3)return`M${e.map(d=>`${d.x} ${d.y}`).join("L")}`;let r=e.length,i=e.slice(1).map((d,u)=>d.x-e[u].x),o=e.slice(1).map((d,u)=>d.y-e[u].y),s=i.map((d,u)=>d===0?0:o[u]/d),l=[s[0]];for(let d=1;d<r-1;d++){let u=s[d-1],h=s[d];l.push(u*h<=0?0:(u+h)/2)}l.push(s[r-2]);for(let d=0;d<r-1;d++){let u=s[d];if(u===0){l[d]=0,l[d+1]=0;continue}let h=l[d]/u,b=l[d+1]/u,v=Math.hypot(h,b);v>3&&(l[d]=3*h*u/v,l[d+1]=3*b*u/v)}let c=`M${t.x} ${t.y}`;for(let d=0;d<r-1;d++){let u=e[d],h=e[d+1],b=i[d]/3;c+=`C${p(u.x+b)} ${p(u.y+b*l[d])} ${p(h.x-b)} ${p(h.y-b*l[d+1])} ${h.x} ${h.y}`}return c}var Pe=1e3,De=60*Pe,Ne=60*De,Fe=24*Ne,ei=[Pe,5*Pe,15*Pe,30*Pe,De,5*De,15*De,30*De,Ne,3*Ne,6*Ne,12*Ne,Fe,2*Fe,7*Fe,14*Fe];function er(e,n,t=6){if(!(n>e))return[e];let r=n-e,i=ei.find(h=>r/h<=t),o=[];if(i!==void 0){for(let h=Math.ceil(e/i)*i;h<=n;h+=i)o.push(h);return o.length?o:[e,n]}let s=r/(30*Fe),l=[1,2,3,6,12,24,60,120].find(h=>s/h<=t)??240,c=new Date(e),d=c.getUTCFullYear(),u=Math.ceil((c.getUTCMonth()+(c.getUTCDate()>1?1:0))/l)*l;for(let h=Date.UTC(d,u,1);h<=n;)o.push(h),u+=l,u>=12&&(d+=Math.floor(u/12),u%=12),h=Date.UTC(d,u,1);return o.length?o:[e,n]}function tr(e,n){let t=Math.floor(Math.log10(e)),r=Math.ceil(Math.log10(n)),i=r-t<=1?[1,2,5]:[1],o=[];for(let s=t;s<=r;s++)for(let l of i)o.push(Jn(l*10**s));return o.filter(s=>s>=e/1.0001&&s<=n*1.0001)}function $e(e,n={}){if(n.thresholds&&n.thresholds.length>=2)return[...n.thresholds].filter(Number.isFinite).sort((c,d)=>c-d);let[t,r]=n.domain??de(e),i=Math.max(1,e.length),o=Math.max(1,n.bins??Math.ceil(Math.log2(i)+1)),s=n.binWidth??(r>t?(r-t)/o:1),l=r>t?Math.max(1,Math.ceil((r-t)/s-1e-9)):1;return Array.from({length:l+1},(c,d)=>Number((t+d*s).toPrecision(12)))}function Ce(e,n){let t=[];for(let o=0;o+1<n.length;o++)t.push({x0:n[o],x1:n[o+1],count:0});if(t.length===0)return t;let r=n[0],i=n[n.length-1];for(let o of re(e)){if(o<r||o>i)continue;let s=0,l=t.length-1;for(;s<l;){let c=s+l+1>>1;t[c].x0<=o?s=c:l=c-1}t[s].count++}return t}var ti=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,ni=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,ri={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function ii(e,n,t){return e.replace(ni,(r,i,o)=>{let s=ri[i];if(s===void 0)return i+o;let c=(o.match(ti)??[]).map((d,u)=>{let h=Number(d);if(s===-1)return String(h+n);if(s===-2)return String(h+t);let b=u%s;return s===7?b===5?String(h+n):b===6?String(h+t):d:String(b%2===0?h+n:h+t)});return i+c.join(" ")})}var nr=(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:ii(r.d,n,t)}}});var zt=["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)"))),B={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)"},tt=(e="neutral")=>e==="neutral"?B.axis:`var(--skdx-color-${e}-500)`,Lt=(e="neutral")=>e==="neutral"?B.label:e==="primary"?"var(--skdx-color-text-accent)":`var(--skdx-color-text-${e})`,rr=(e,n)=>n??zt[e%zt.length];var ne={top:16,right:16,bottom:32,left:48};function ir(e,n,t=ne){return{x:t.left,y:t.top,width:Math.max(0,e-t.left-t.right),height:Math.max(0,n-t.top-t.bottom)}}function Ge(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function Vt(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var or=e=>e.crosshair===!0||Vt(e).trigger==="axis",nt=20,oi=120,sr=e=>{let n=Ge(e);return n&&(n.position==="left"||n.position==="right")?n.width??oi:0},rt=(e,n=600,t=300)=>({width:(e.width??n)-sr(e),height:(e.height??t)-(Ge(e)?.position==="bottom"?nt:0)}),ar=(e,n,t)=>{let r=Ge(e);return!r||!(r.position===void 0||r.position==="top")?0:(n?Math.max(1,dr(n,t??rt(e).width,r)):1)*nt},ie=6.5,lr=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:rr(n)),cr=(e,n)=>e.hiddenSeries?.includes(n)??!1;function Rt(e,n,t=[],r={},i=10,o=8,s=!1){let l=[],c=r.maxItems,d=c!==void 0&&c>=0&&e.length>c?e.slice(0,c):e,u=e.length-d.length,h=r.interactive??!0,b=o,v=i,g=(m,w,y,f)=>{let M=(w?18:4)+m.length*ie;b>o&&(s||b+M>n-8)&&(b=o,v+=nt),w&&l.push({kind:"rect",part:"legend-swatch",x:b,y:v-5,width:10,height:10,fill:w,opacity:f?.3:void 0,item:y}),l.push({kind:"text",part:"legend-label",x:b+(w?14:0),y:v,text:m,baseline:"middle",fill:f?B.grid:B.label,item:y}),b+=M+12};for(let m of d){let w=t.includes(m.name),y=h?{label:m.name,series:m.name,legend:!0}:void 0;g(r.formatter?.(m.name)??m.name,m.color,y,w)}return u>0&&g(`+${u} more`,void 0,void 0,!1),r.align==="end"?si(l,n):l}function si(e,n){let t=new Map;for(let i of e){let o=i.kind==="rect"?i.y+5:i.y;t.set(o,[...t.get(o)??[],i])}let r=[];for(let i of t.values()){let o=Math.max(...i.map(l=>l.kind==="rect"?l.x+l.width:l.x+l.text.length*ie)),s=n-8-o;for(let l of i)r.push({...l,x:l.x+s})}return r}var dr=(e,n,t={})=>new Set(Rt(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function Bt(e,n,t,r=[]){let i=Ge(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,s=Vt(e),l=o?.position==="bottom",c=sr(e),d=e.hiddenSeries??[],u=o?c?Rt(r,1/0,d,o,10,(o.position==="right"?n:0)+8,!0):Rt(r,n,d,o,l?t+10:10):[],h=l?dr(r,n,o):0;return{width:n+c,height:l?t+Math.max(1,h)*nt:t,legendOffset:o?.position==="left"?c: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 Pt(e){let n=e.legendOffset;if(!n)return e;let t=[...nr(e.shapes.filter(c=>!c.part.startsWith("legend-")),n,0),...e.shapes.filter(c=>c.part.startsWith("legend-"))],r=c=>({...c,x:c.x+n}),i=e.hit?{...e.hit,plot:r(e.hit.plot),xs:e.hit.xs.map(c=>c+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:c=>o.scale(c)+n,invert:c=>o.invert(c-n),bars:o.bars.map(c=>({...c,x0:c.x0+n,x1:c.x1+n}))}:void 0,l=e.map?{...e.map,plot:r(e.map.plot)}:void 0;return{...e,shapes:t,hit:i,edit:s,map:l,legendOffset:void 0}}function it(e,n,t,r,i,o="auto"){let s=Array.isArray(t)?t:[t],l=Math.max(...s.map(b=>b.length))*ie+12,c=6+s.length*16,d=o==="top"?{x:e-l/2,y:n-c-8}:o==="bottom"?{x:e-l/2,y:n+8}:o==="left"?{x:e-l-8,y:n-c/2}:o==="right"?{x:e+8,y:n-c/2}:{x:e+12,y:n-c-6},u=Math.max(0,Math.min(r-l,d.x)),h=Math.max(0,Math.min(i-c,d.y));return[{kind:"rect",part:"tooltip",x:p(u),y:p(h),width:p(l),height:c,fill:"var(--skdx-color-surface-raised)",stroke:B.axis,rx:3},...s.map((b,v)=>({kind:"text",part:"tooltip-label",x:p(u+6),y:p(h+11+v*16),text:b,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:s.length>1&&v===0?"bold":void 0}))]}function ur([e,n],t,r=!1,i){let o=typeof r=="boolean"?{scale:r?"log":"linear"}:r,s=le(o.format??i),l=o.min??e,c=o.max??n;o.reversed&&(t=[t[1],t[0]]);let d={id:o.id,position:o.position,options:o};if(o.scale==="sqrt"){let m=O=>Math.sign(O)*Math.sqrt(Math.abs(O)),w=o.nice===!1?[l,c]:xe(l,c,o.ticks),y=o.min??w[0],f=o.max??w[w.length-1],M=Se([m(y),m(f)],t),T=O=>M(m(O)),S=xe(y,f,o.ticks).filter(O=>O>=y-1e-9&&O<=f+1e-9);return{...d,scale:T,domain:[y,f],format:s,ticks:(S.length>=2?S:[y,f]).map(O=>({pos:p(T(O)),label:s(O)})),zero:p(T(Math.min(Math.max(0,y),f)))}}if(o.scale==="log"){let m=Math.max(l,Number.EPSILON),w=Math.max(c,m),y=tr(m,w),f=[Math.log10(m),Math.log10(w)],M=Se(f,t),T=S=>M(Math.log10(Math.max(S,Number.EPSILON)));return{...d,scale:T,domain:f,format:s,ticks:y.map(S=>({pos:p(T(S)),label:s(S)})),zero:p(t[0])}}let u=xe(l,c,o.ticks),h=[o.min??(o.nice===!1?l:u[0]),o.max??(o.nice===!1?c:u[u.length-1])],b=Se(h,t),v=u.filter(m=>m>=h[0]-1e-9&&m<=h[1]+1e-9),g=(v.length>=2?v:[h[0],h[1]]).map(m=>({pos:p(b(m)),label:s(m)}));return{...d,scale:b,domain:h,format:s,ticks:g,zero:p(b(Math.min(Math.max(0,h[0]),h[1])))}}var hr=([e,n],t)=>Math.max(ne.left,xe(e,n).reduce((r,i)=>Math.max(r,t(i).length),0)*ie+14),fr=e=>e?.grid!==!1;function ot(e,n){if(e.length<2)return e;let t=e.reduce((i,o)=>Math.max(i,o.label.length),0)*ie+8,r=Math.max(1,Math.ceil(e.length*t/Math.max(1,n)));return r===1?e:e.filter((i,o)=>o%r===0)}var Dt=(e,n,t,r)=>`${e}, ${n}: ${r(t)}`;function st(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}=rt(e,t,r),l=i==="error"?e.error:i==="loading"?"Loading\u2026":e.emptyMessage??"No data available",c=[];return i==="loading"&&c.push({kind:"rect",part:"skeleton",x:0,y:0,width:o,height:s,fill:"var(--skdx-color-surface-sunken)",rx:4}),c.push({kind:"text",part:`state-${i}`,x:p(o/2),y:p(s/2),text:l,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":B.label}),{...Bt(e,o,s),shapes:c,tooltip:!1}}var mr=(e,n,t)=>{let r=n.length*ie/2;return e+r>t?"end":e-r<0?"start":"middle"};function Nt(e,n={}){let{plot:t,xTicks:r,yTicks:i,baseline:o}=e,s=t.x+t.width,l=t.y+t.height,c=[],d=n.grid??!0,u=(g,m)=>m?{kind:"line",part:"grid",x1:g.pos,x2:g.pos,y1:t.y,y2:l,stroke:B.grid}:{kind:"line",part:"grid",x1:t.x,x2:s,y1:g.pos,y2:g.pos,stroke:B.grid},h=n.x?.tickRotation??0,b=(g,m,w,y)=>h?Y(g,m,w,{part:y,anchor:h<0?"end":"start",baseline:"middle",rotate:h}):Y(g,m,w,{part:y,anchor:mr(g,w,e.width)}),v=(g,m,w,y,f)=>{for(let M of g)c.push(m==="x"?{kind:"line",part:"tick",x1:M.pos,x2:M.pos,y1:w,y2:p(w+y*f),stroke:B.axis}:{kind:"line",part:"tick",x1:w,x2:p(w+y*f),y1:M.pos,y2:M.pos,stroke:B.axis})};if(n.categoryGrid)for(let g of r)c.push(u(g,!n.horizontal));if(n.horizontal){let g=n.axes??[{ticks:i,position:"bottom",offset:0,label:n.yLabel,...n.y}];if(d)for(let m of i)c.push(u(m,!0));g[0]?.showLine!==!1&&c.push({kind:"line",part:"axis",x1:o,x2:o,y1:t.y,y2:l,stroke:B.axis});for(let m of g){let w=m.position==="top"||m.position==="right",y=p(w?t.y-m.offset:l+m.offset),f=w||m.offset>0;m.showLine&&f&&c.push({kind:"line",part:"axis",x1:t.x,x2:s,y1:y,y2:y,stroke:B.axis}),m.showTicks&&v(m.ticks,"x",y,w?-1:1,m.tickSize??4);let M=p(w?y-8:y+20);for(let T of m.ticks)c.push(w?Y(T.pos,M,T.label,{part:"x-label-top",anchor:mr(T.pos,T.label,e.width)}):b(T.pos,M,T.label,"x-label"));m.label&&c.push(f?Y(4,M,m.label,{part:"axis-title",anchor:"start",baseline:w?void 0:"middle"}):Y(4,t.y-6,m.label,{part:"axis-title",anchor:"start"}))}n.x?.showLine&&c.push({kind:"line",part:"axis",x1:n.rtl?s:t.x,x2:n.rtl?s:t.x,y1:t.y,y2:l,stroke:B.axis}),n.x?.showTicks&&v(r,"y",n.rtl?s:t.x,n.rtl?1:-1,n.x.tickSize??4);for(let m of r)c.push(n.rtl?Y(s+8,m.pos,m.label,{part:"y-label",anchor:"start",baseline:"middle"}):Y(t.x-8,m.pos,m.label,{part:"y-label",anchor:"end",baseline:"middle"}))}else{if(d)for(let m of i)c.push(u(m,!1));n.y?.showLine!==!1&&c.push({kind:"line",part:"axis",x1:t.x,x2:s,y1:o,y2:o,stroke:B.axis});let g=n.axes??[{ticks:i,position:"left",offset:0,label:n.yLabel,...n.y},...n.rightTicks?[{ticks:n.rightTicks,position:"right",offset:0,label:n.rightLabel}]:[]];for(let m of g){let w=m.position==="left",y=w?t.x-m.offset:s+m.offset,f=w?"y-label":"y-label-right";m.showLine&&c.push({kind:"line",part:"axis",x1:p(y),x2:p(y),y1:t.y,y2:l,stroke:B.axis}),m.showTicks&&v(m.ticks,"y",p(y),w?-1:1,m.tickSize??4);for(let M of m.ticks)c.push(Y(p(w?y-8:y+8),M.pos,M.label,{part:f,anchor:w?"end":"start",baseline:"middle"}));m.label&&c.push(Y(p(w?m.offset===0?4:Math.max(4,y-40):m.offset===0?e.width-4:Math.min(e.width-4,y+40)),t.y-6,m.label,{part:"axis-title",anchor:w?"start":"end"}))}n.x?.showTicks&&v(r,"x",l,1,n.x.tickSize??4);for(let m of r)c.push(b(m.pos,l+(h?12:20),m.label,"x-label"))}return n.xLabel&&c.push(Y(p(t.x+t.width/2),e.height-4,n.xLabel,{part:"axis-title",anchor:"middle"})),n.horizontal&&n.rightLabel&&c.push(Y(e.width-4,t.y-6,n.rightLabel,{part:"axis-title",anchor:"end"})),c}var Y=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:B.label,...r}),_e=(e,n,t,r,i,o)=>({kind:"circle",part:"point",cx:e,cy:n,r:t,fill:r,title:i,item:o});function Ft(e,n){let t=[],{plot:r}=n,i=r.x+r.width,o=r.y+r.height,s=c=>Math.max(r.x,Math.min(i,c)),l=c=>Math.max(r.y,Math.min(o,c));for(let c of e??[]){let d=c.color??tt(c.variant),u=c.color??Lt(c.variant),h={part:"reference-label",fill:u},b=n.horizontal===!0;if("y"in c){let v=p(n.y(c.y,c.axis??"left"));if(b){let g=s(v);t.push(...br(g,r.y,o,d,c.label,h))}else{let g=l(v);t.push(...pr(r.x,i,g,d,c.label,h))}}else if("x"in c){let v=n.x(c.x);if(v===void 0)continue;b?t.push(...pr(r.x,i,l(p(v)),d,c.label,h)):t.push(...br(s(p(v)),r.y,o,d,c.label,h))}else if("y1"in c){let v=p(n.y(c.y1,c.axis??"left")),g=p(n.y(c.y2,c.axis??"left"));b?t.push(...xr(s(Math.min(v,g)),s(Math.max(v,g)),r,d,c.label,u)):t.push(...gr(l(Math.min(v,g)),l(Math.max(v,g)),r,d,c.label,u))}else{let v=n.x(c.x1),g=n.x(c.x2);if(v===void 0||g===void 0)continue;let m=p(Math.min(v,g)),w=p(Math.max(v,g));b?t.push(...gr(l(m),l(w),r,d,c.label,u)):t.push(...xr(s(m),s(w),r,d,c.label,u))}}return t}function pr(e,n,t,r,i,o){let s={kind:"line",part:"reference",x1:e,x2:n,y1:t,y2:t,stroke:r,dash:"6 4",strokeWidth:1.5,title:i};return i?[s,Y(n-4,t-5,i,{...o,anchor:"end"})]:[s]}function br(e,n,t,r,i,o){let s={kind:"line",part:"reference",x1:e,x2:e,y1:n,y2:t,stroke:r,dash:"6 4",strokeWidth:1.5,title:i};return i?[s,Y(e+4,n+10,i,{...o,anchor:"start"})]:[s]}function gr(e,n,t,r,i,o){let s={kind:"rect",part:"reference-area",x:t.x,y:e,width:t.width,height:p(Math.max(0,n-e)),fill:r,opacity:.12,title:i};return i?[s,Y(t.x+t.width-4,e+12,i,{part:"reference-label",fill:o,anchor:"end"})]:[s]}function xr(e,n,t,r,i,o){let s={kind:"rect",part:"reference-area",x:e,y:t.y,width:p(Math.max(0,n-e)),height:t.height,fill:r,opacity:.12,title:i};return i?[s,Y(e+4,t.y+12,i,{part:"reference-label",fill:o,anchor:"start"})]:[s]}function yr(e,n){let t=[],{plot:r}=n,i=r.x+r.width,o=r.y+r.height;for(let s of e??[]){let l=s.color??tt(s.variant),c=s.color??Lt(s.variant),d=(g,m,w)=>{let y=n.x(g);if(y===void 0)return;let f=n.y(m,w??"left");return n.horizontal?{x:p(f),y:p(y)}:{x:p(y),y:p(f)}},u=s.id??s.label,h=g=>({label:g,id:u,name:s.label});if(s.type==="line"||s.type==="band"){let{type:g,id:m,...w}=s;t.push(...Ft([w],n));continue}if(s.type==="rect"){let g=d(s.x1,s.y1,s.axis),m=d(s.x2,s.y2,s.axis);if(!g||!m)continue;let w=Math.max(r.x,Math.min(g.x,m.x)),y=Math.max(r.y,Math.min(g.y,m.y)),f=s.label??"";t.push({kind:"rect",part:"annotation-rect",x:p(w),y:p(y),width:p(Math.max(0,Math.min(i,Math.max(g.x,m.x))-w)),height:p(Math.max(0,Math.min(o,Math.max(g.y,m.y))-y)),fill:l,opacity:.12,stroke:l,title:f||void 0,item:f?h(f):void 0}),s.label&&t.push(Y(p(w+4),p(y+12),s.label,{part:"annotation-label",fill:c}));continue}let b=d(s.x,s.y,s.axis);if(!b)continue;if(s.type==="text"){t.push(Y(b.x,b.y,s.text,{part:"annotation-text",fill:c,anchor:"middle",baseline:"middle",title:s.label}));continue}let v=s.label??`${String(s.x)}, ${s.y}`;if(t.push({kind:"circle",part:"annotation-point",cx:b.x,cy:b.y,r:5,fill:l,stroke:"var(--skdx-color-surface-default)",title:v,item:h(v)}),s.type==="callout"&&s.label){let[g,m]=s.offset??[16,-16],w=p(Math.max(r.x,Math.min(i,b.x+g))),y=p(Math.max(r.y,Math.min(o,b.y+m)));t.push({kind:"line",part:"annotation-leader",x1:b.x,y1:b.y,x2:w,y2:y,stroke:l},Y(w,y,s.label,{part:"annotation-label",fill:c,anchor:g>=0?"start":"end",baseline:"middle"}))}}return t}var Gt=2e3;function ai(e){if(e!=="none")return e===void 0||e==="auto"?{strategy:"lttb",threshold:Gt}:typeof e=="string"?{strategy:e,threshold:Gt}:{strategy:e.strategy,threshold:e.threshold??Gt}}function li(e,n){let t=e.length;if(n>=t||n<3)return e.map((l,c)=>c);let r=[0],i=[],o=(t-2)/(n-2),s=0;for(let l=0;l<n-2;l++){let c=Math.floor((l+1)*o)+1,d=Math.min(t-1,Math.floor((l+2)*o)+1),u=0,h=0,b=0;for(let M=c;M<d;M++){let T=e[M];I(T)&&(u+=M,h+=T,b++)}u=b?u/b:(c+d)/2,h=b?h/b:0;let v=Math.floor(l*o)+1,g=Math.min(t-1,Math.floor((l+1)*o)+1),m=e[s],w=I(m)?m:0,y=-1,f=-1;for(let M=v;M<g;M++){let T=e[M];if(!I(T)){i.push(M);continue}let S=Math.abs((s-u)*(T-w)-(s-M)*(h-w));S>f&&(f=S,y=M)}y<0&&(y=v),r.push(y),s=y}return r.push(t-1),i.length?[...new Set([...r,...i])].sort((l,c)=>l-c):r}function ci(e,n){let t=e.length,r=Math.max(1,Math.floor(n/2));if(r*2>=t)return e.map((s,l)=>l);let i=[],o=t/r;for(let s=0;s<r;s++){let l=Math.floor(s*o),c=s===r-1?t:Math.floor((s+1)*o),d=-1,u=-1;for(let h=l;h<c;h++){let b=e[h];if(!I(b)){i.push(h);continue}(d<0||b<e[d])&&(d=h),(u<0||b>e[u])&&(u=h)}d>=0&&i.push(Math.min(d,u)),u>=0&&u!==d&&i.push(Math.max(d,u))}return[...new Set(i)].sort((s,l)=>s-l)}function di(e,n){let t=e.length,r=Math.max(1,Math.floor(n/4));if(r*4>=t)return e.map((s,l)=>l);let i=[],o=t/r;for(let s=0;s<r;s++){let l=Math.floor(s*o),c=s===r-1?t:Math.floor((s+1)*o),d=-1,u=-1,h=-1,b=-1;for(let v=l;v<c;v++){let g=e[v];if(!I(g)){i.push(v);continue}h<0&&(h=v),b=v,(d<0||g<e[d])&&(d=v),(u<0||g>e[u])&&(u=v)}for(let v of[h,d,u,b])v>=0&&i.push(v)}return[...new Set(i)].sort((s,l)=>s-l)}function kr(e,n,t){let r=ai(t);if(!r||n<=r.threshold||e.length===0)return;let i=r.strategy==="minmax"?ci:r.strategy==="m4"?di:li,o=new Set;for(let s of e)for(let l of i(s.slice(0,n),r.threshold))o.add(l);return[...o].sort((s,l)=>s-l)}function vr(e,n,t,r,i,o,s,l){if(r==="circle")return{..._e(e,n,t,i,o,s),part:l};let c=r==="square"?`M${p(e-t)} ${p(n-t)}h${p(2*t)}v${p(2*t)}h${p(-2*t)}Z`:r==="diamond"?`M${p(e)} ${p(n-t*1.3)}L${p(e+t*1.3)} ${p(n)}L${p(e)} ${p(n+t*1.3)}L${p(e-t*1.3)} ${p(n)}Z`:`M${p(e)} ${p(n-t*1.2)}L${p(e+t*1.15)} ${p(n+t*.9)}L${p(e-t*1.15)} ${p(n+t*.9)}Z`;return{kind:"path",part:l,d:c,fill:i,title:o,item:s}}var ui=e=>{let n=0;return e.map(t=>I(t)?n+=t:null)},hi=e=>e.map((n,t)=>{let r=e[t-1];return t>0&&I(n)&&I(r)?n-r:null}),fi=e=>e.map((n,t)=>{let r=e[t-1];return t>0&&I(n)&&I(r)&&r!==0?(n-r)/Math.abs(r):null});function mi(e,n){let t=Math.max(1,Math.floor(n));return e.map((r,i)=>{if(i<t-1)return null;let o=0;for(let s=i-t+1;s<=i;s++){let l=e[s];if(!I(l))return null;o+=l}return o/t})}function pi(e,n="max"){let t=0;for(let r of e)I(r)&&(t=n==="sum"?t+r:Math.max(t,r));return e.map(r=>I(r)?t===0?0:r/t:null)}function bi(e,n="desc"){let t=e.filter(I).sort((r,i)=>n==="asc"?r-i:i-r);return e.map(r=>I(r)?t.indexOf(r)+1:null)}var gi=(e,n=-1/0,t=1/0)=>e.map(r=>I(r)&&r>=n&&r<=t?r:null),xi=(e,n="asc")=>[...e].sort((t,r)=>I(t)?I(r)?n==="asc"?t-r:r-t:-1:I(r)?1:0);function yi(e,n,t="sum"){let r=Math.max(1,Math.floor(n)),i=[];for(let o=0;o<e.length;o+=r){let s=e.slice(o,o+r).filter(I);if(s.length===0){i.push(null);continue}let l=s.reduce((c,d)=>c+d,0);i.push(t==="sum"?l:t==="mean"?l/s.length:t==="min"?Math.min(...s):Math.max(...s))}return i}function ki(e,n={}){let t=e.filter(I),r=$e(t,n);return{edges:r,counts:Ce(t,r).map(i=>i.count)}}function _t(e,n){let t=[...e];for(let r of n??[])switch(r.type){case"cumulative":t=ui(t);break;case"difference":t=hi(t);break;case"percentageChange":t=fi(t);break;case"movingAverage":t=mi(t,r.window);break;case"normalize":t=pi(t,r.to);break;case"rank":t=bi(t,r.order);break;case"filter":t=gi(t,r.min,r.max);break;case"sort":t=xi(t,r.order);break;case"aggregate":t=yi(t,r.every,r.method);break;case"bin":t=ki(t,r).counts;break}return t}var vi=100,wi=2e3,wr=32,Mr=28,lt=e=>e.position==="right"||e.position==="top";function Mi(e){let t=(e.yAxis===void 0?[]:Array.isArray(e.yAxis)?e.yAxis:[e.yAxis]).map((i,o)=>({...i,id:i.id??(o===0?"left":o===1?"right":String(o)),position:i.position??(o===1?"right":"left")}));t.length===0&&t.push({id:"left",position:"left"});let r=t.some(i=>i.id==="right"||lt(i));return e.rightAxis?t.push({...e.rightAxis,id:"right",position:"right"}):!r&&e.series.some(i=>i.axis==="right")&&t.push({id:"right",position:"right"}),t}function $r(e,n){let t=e[0]?.id;return n===void 0||n==="left"?t:n==="right"?(e.find(r=>r.id==="right")??e.find(lt))?.id:e.find(r=>r.id===n)?.id}var at=e=>e.kind==="bar"||e.kind==="range"&&e.style==="bar";function Cr(e,n){let t=le(e.format),{series:r,categories:i,issues:o,axes:s}=$i(e,n,t),l=e.direction==="rtl",c=e.baseline??0,d=Math.max(i.length,...r.map(a=>Math.max(a.data.length,a.low.length))),u=r.every(a=>re(a.data).length===0&&re(a.high).length===0),h=st(e,u);if(h)return{...h,issues:o};let b=e.xAxis?.type??"category",v=b!=="category"&&i.length>0&&i.every(a=>typeof a!="string"||b==="time"&&I(ce(a))),g=v?i.map(ce):[],[m,w]=de(g),y=e.xAxis?.format??(b==="time"?{style:w-m<2*864e5?"time":"date"}:void 0),f=Array.from({length:d},(a,k)=>{let C=i[k];return C===void 0?String(k+1):et(C,y)}),M=Si(e.zoom,d),T=Array.from({length:M.end-M.start},(a,k)=>M.start+k),S=e.orientation==="horizontal",G=r.map(a=>({...a,hidden:a.hidden||S&&!at(a)})).filter(a=>!a.hidden),W=G.some(a=>!at(a))?kr(G.filter(a=>!at(a)).map(a=>T.map(k=>(a.kind==="range"?a.high[k]:a.data[k])??null)),T.length,e.sampling):void 0,P=W?W.map(a=>T[a]):T,X=e.stacked==="percent"||e.stackOffset==="expand",Q=e.stackOffset??"zero",oe=new Map,fe=new Map,pt=new Map;for(let a of G)a.stack!==void 0&&a.kind!=="range"&&pt.set(a.stack,[...pt.get(a.stack)??[],a]);for(let a of pt.values()){let k=new Array(d).fill(c),C=new Array(d).fill(c),_=new Array(d).fill(0);if(X)for(let N of a)N.data.forEach((R,j)=>{I(R)&&(_[j]=_[j]+Math.abs(R))});for(let N of a){let R=[],j=[];for(let D=0;D<d;D++){let F=N.data[D];if(!I(F)){R.push(null),j.push(null);continue}let L=_[D],A=X?L>0?F/L:0:F,Z=A>=0?k:C;R.push(Z[D]),Z[D]=Z[D]+A,j.push(Z[D])}oe.set(N,R),fe.set(N,j)}if(Q==="silhouette"||Q==="wiggle"){let N=new Array(d).fill(0);if(Q==="silhouette")for(let R=0;R<d;R++)N[R]=-(k[R]-c)/2;else{let R=0;for(let j=0;j<d;j++){let D=a.length,F=0;for(let A=0;A<D;A++){let Z=a[A],E=Z.data[j],q=Z.data[j-1],te=j>0&&I(E)&&I(q)?E-q:0;F+=(D-A-.5)*te}let L=k[j]-c;R=j===0?-L/2:R-(L>0?F/Math.max(1,D):0),N[j]=R}}for(let R of a){let j=oe.get(R),D=fe.get(R);for(let F=0;F<d;F++){let L=j[F],A=D[F];I(L)&&(j[F]=L+N[F]),I(A)&&(D[F]=A+N[F])}}}}let Sn=a=>a.kind==="range"?{from:a.low,to:a.high}:{from:oe.get(a)??new Array(d).fill(c),to:fe.get(a)??a.data},$n=a=>{let k=[],C=!1;for(let R of G){if(R.axis!==a)continue;let{from:j,to:D}=Sn(R);for(let F of P){let L=D[F];if(I(L)&&k.push(L),R.kind==="range"||R.stack!==void 0){let A=j[F];I(A)&&k.push(A)}}if(R.errors)for(let F of P){let L=Sr(R.data[F],R.errors[F]);L&&k.push(L[0],L[1])}(R.kind==="bar"||R.kind==="area")&&Q==="zero"&&(C=!0)}let[_,N]=de(k);return C?[Math.min(c,_),Math.max(c,N)]:[_,N]},{width:Cn,height:In}=rt(e),Nr=e.brush?wr+Mr:0,Tn=P.reduce((a,k)=>Math.max(a,f[k].length),0)*ie,An=X?{style:"percent"}:void 0,Fr=a=>{if(a.scale==="log")return ne.left;let[k,C]=$n(a.id),_=le(a.format??An??e.format);return hr([a.min??k,a.max??C],_)+(a.showTicks?a.tickSize??4:0)},bt=a=>S?lt(a)?"top":"bottom":lt(a)!==l?"right":"left",On=a=>S?24+(a.showTicks?a.tickSize??4:0):Fr(a),Gr=new Set(G.map(a=>a.axis)),gt=s.filter(a=>Gr.has(a.id)||s.length>1),zn=new Map,ke={left:0,right:0,top:0,bottom:0};for(let a of gt){let k=bt(a);zn.set(a.id,ke[k]),ke[k]+=On(a)}let Ln=gt.find(a=>bt(a)==="bottom"),_r={top:ne.top+ar(e)+(s.some(a=>a.label)?12:0)+ke.top,right:S?l?Math.max(ne.left,Tn+16):ne.right:Math.max(ne.right,ke.right),bottom:ne.bottom+Nr+(e.xAxis?.label?14:0)+(e.xAxis?.tickRotation?24:0)+ke.bottom-(Ln?On(Ln):0),left:S?l?ne.right:Math.max(ne.left,Tn+16):Math.max(ne.left,ke.left)},K=ir(Cn,In,_r),jr=S?l?[K.x+K.width,K.x]:[K.x,K.x+K.width]:[K.y+K.height,K.y],Rn=S?[K.y,K.y+K.height]:l?[K.x+K.width,K.x]:[K.x,K.x+K.width],xt=new Map(s.map(a=>[a.id,{...ur($n(a.id),jr,{format:An,...a},e.format),position:bt(a),offset:zn.get(a.id)??0}])),Vn=s[0]?.id,Ee=xt.get(Vn),yt=a=>xt.get($r(s,a)??Vn)??Ee,se=(a,k)=>yt(k).scale(a),Bn=a=>p(a.scale(Math.min(Math.max(c,Math.min(...a.domain)),Math.max(...a.domain)))),He=Qn(P.length,Rn,e.barGap),kt=P.map(a=>g[a]),vt=[...kt].sort((a,k)=>a-k),ve=1/0;for(let a=1;a<vt.length;a++)ve=Math.min(ve,vt[a]-vt[a-1]);let[we,Oe]=de(kt),ae=ve===1/0?Math.max(1,Math.abs(Oe)*.05||1):ve/2,ze=Se([we-ae,Oe+ae],Rn),Ue=a=>p(v?ze(kt[a]):He.center(a)),Pn=v?Math.abs(ze(we+(ve===1/0?ae:ve))-ze(we))*.8:He.bandwidth,Dn=a=>v?Ue(a)-Pn/2:He.start(a),Wr=v?(b==="time"?er(we-ae,Oe+ae):xe(we-ae,Oe+ae)).filter(a=>a>=we-ae&&a<=Oe+ae).map(a=>({pos:p(ze(a)),label:et(a,y)})):ot(P.map((a,k)=>({pos:Ue(k),label:f[a]})),S?1/0:K.width/Math.max(.2,Math.abs(Math.cos((e.xAxis?.tickRotation??0)*Math.PI/180)))),wt={...Bt(e,Cn,In,r.map(a=>({name:a.name,color:a.color}))),plot:K,xTicks:Wr,yTicks:S?ot(Ee.ticks,K.width):Ee.ticks,baseline:Bn(Ee)},Zr=s[0],Nn=Nt(wt,{horizontal:S,rtl:l,axes:gt.map(a=>{let k=xt.get(a.id);return{ticks:S?ot(k.ticks,K.width):k.ticks,position:k.position,offset:k.offset??0,label:a.label,showLine:a.showLine,showTicks:a.showTicks,tickSize:a.tickSize}}),xLabel:e.xAxis?.label,grid:fr(Zr),categoryGrid:e.xAxis?.grid===!0,x:e.xAxis}),Er=a=>{if(typeof a=="number"&&i.every(C=>typeof C=="string"))return a;let k=typeof a=="string"?a:ce(a);for(let C=0;C<d;C++){let _=i[C];if(_!==void 0&&(typeof k=="string"?_===k||f[C]===k:ce(_)===k))return C}},Fn={plot:K,horizontal:S,x:a=>{if(v&&(typeof a!="string"||I(ce(a))))return ze(ce(a));let k=Er(a),C=k===void 0?-1:P.indexOf(k);return C<0?void 0:He.center(C)},y:(a,k)=>se(a,k)};Nn.push(...Ft(e.references,Fn));let Mt=[],St=new Map;for(let a of G){if(!at(a))continue;let k=a.stack??a,C=Mt.indexOf(k);C<0&&(C=Mt.push(k)-1),St.set(a,C)}let Ke=Pn/Math.max(1,Mt.length),me=Math.min(Ke,e.barWidth??1/0),Gn=(Ke-me)/2,$t=[],qe=[],Ct=[],It=[],Tt=[],_n=[],Ye=[],Xe=a=>yt(a.axis).format,At=Math.max(0,e.minBarSize??0),Hr=(a,k,C)=>{let _=Math.abs(k-a);if(_>=At)return[Math.min(a,k),_];let R=a+(S?C?1:-1:C?-1:1)*At;return[Math.min(a,R),At]},Le=(a,k,C,_)=>({label:_,series:a.name,seriesId:a.id??a.name,category:f[k],index:k,value:C}),jn=(a,k,C,_)=>{let N=Sr(_,a.errors?.[k]);if(!N)return;let R=p(se(N[0],a.axis)),j=p(se(N[1],a.axis)),D=4,F="var(--skdx-color-text-default)",L=`${a.name}, ${f[k]}: ${Xe(a)(N[0])} \u2013 ${Xe(a)(N[1])}`;_n.push(S?{kind:"line",part:"error-bar",x1:R,x2:j,y1:C,y2:C,stroke:F,title:L}:{kind:"line",part:"error-bar",x1:C,x2:C,y1:R,y2:j,stroke:F,title:L},S?{kind:"line",part:"error-cap",x1:R,x2:R,y1:p(C-D),y2:p(C+D),stroke:F}:{kind:"line",part:"error-cap",x1:p(C-D),x2:p(C+D),y1:R,y2:R,stroke:F},S?{kind:"line",part:"error-cap",x1:j,x2:j,y1:p(C-D),y2:p(C+D),stroke:F}:{kind:"line",part:"error-cap",x1:p(C-D),x2:p(C+D),y1:j,y2:j,stroke:F})};for(let a of G){let{from:k,to:C}=Sn(a),_=Xe(a),N=P.length<=wi;if(a.kind==="bar"){let L="";P.forEach((A,Z)=>{let E=a.data[A],q=k[A],te=C[A];if(!I(E)||!I(q)||!I(te))return;let Me=se(q,a.axis),ge=se(te,a.axis),[Re,Ve]=Hr(Me,ge,te>=q),Be=Dn(Z)+St.get(a)*Ke+Gn,Zn=p(S?Re:Be),En=p(S?Be:Re),Ot=p(S?Ve:me),Hn=p(S?me:Ve);if(!N){L+=`M${Zn} ${En}h${Ot}v${Hn}h${-Ot}Z`;return}let Un=Dt(a.name,f[A],X?te-q:E,_);if(qe.push({kind:"rect",part:"bar",x:Zn,y:En,width:Ot,height:Hn,fill:a.color,rx:e.radius,title:Un,item:Le(a,A,E,Un)}),jn(a,A,p(Be+me/2),E),e.labels){let Kn=_(X?te-q:E);Tt.push(S?Y(p(Math.max(Me,ge)+4),p(Be+me/2),Kn,{baseline:"middle"}):Y(p(Be+me/2),p(Math.min(Me,ge)-4),Kn,{anchor:"middle"}))}}),L&&qe.push({kind:"path",part:"bars",d:L,fill:a.color,title:a.name});continue}if(a.kind==="range"&&a.style==="bar"){P.forEach((L,A)=>{let Z=k[L],E=C[L];if(!I(Z)||!I(E))return;let q=se(Math.min(Z,E),a.axis),te=se(Math.max(Z,E),a.axis),Me=Dn(A)+St.get(a)*Ke+Gn,ge=`${a.name}, ${f[L]}: ${_(Math.min(Z,E))} \u2013 ${_(Math.max(Z,E))}`,Re=Le(a,L,E,ge),Ve=Math.max(1,Math.abs(te-q));qe.push(S?{kind:"rect",part:"range",x:p(Math.min(q,te)),y:p(Me),width:p(Ve),height:p(me),fill:a.color,rx:e.radius,title:N?ge:void 0,item:Re}:{kind:"rect",part:"range",x:p(Me),y:p(Math.min(q,te)),width:p(me),height:p(Ve),fill:a.color,rx:e.radius,title:N?ge:void 0,item:Re})});continue}let R=e.nulls==="connect"||e.nulls===void 0&&e.connectNulls,j=[],D=[];P.forEach((L,A)=>{let Z=k[L],E=C[L];if(!I(E)||!I(Z)){!R&&D.length&&(j.push(D),D=[]);return}D.push({x:Ue(A),y:p(se(E,a.axis)),y0:p(se(Z,a.axis)),i:L})}),D.length&&j.push(D);let F=a.markers??P.length<=vi;for(let L of j){let A=ye(L,a.curve);if(a.kind==="range"&&a.style==="line"){Ct.push({kind:"path",part:"range-high",d:A,stroke:a.color,strokeWidth:2,strokeLinejoin:"round"},{kind:"path",part:"range-low",d:ye(L.map(Z=>({x:Z.x,y:Z.y0})),a.curve),stroke:a.color,strokeWidth:2,strokeLinejoin:"round",dash:"4 3"});continue}if(a.kind==="range"){let Z=ye([...L].reverse().map(E=>({x:E.x,y:E.y0})),a.curve);$t.push({kind:"path",part:"range",d:`${A}L${Z.slice(1)}Z`,fill:a.color,fillOpacity:.2,title:a.name});continue}if(a.kind==="area"){let Z=Bn(yt(a.axis)),E=a.stack!==void 0?ye([...L].reverse().map(te=>({x:te.x,y:te.y0})),a.curve).slice(1):`${L[L.length-1]?.x} ${Z}L${L[0]?.x} ${Z}`,q=`skdx-g-${a.index}`;a.gradient&&!Ye.some(te=>te.id===q)&&Ye.push({id:q,vertical:!0,stops:[{offset:0,color:a.color,opacity:a.fillOpacity},{offset:1,color:a.color,opacity:0}]}),$t.push({kind:"path",part:"area",d:`${A}L${E}Z`,fill:a.gradient?`url(#${q})`:a.color,fillOpacity:a.gradient?void 0:a.fillOpacity})}Ct.push({kind:"path",part:"line",d:A,stroke:a.color,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",dash:a.dash})}if(a.kind==="range"&&N)for(let L of j)for(let A of L){let Z=a.low[A.i],E=a.high[A.i],q=`${a.name}, ${f[A.i]}: ${_(Math.min(Z,E))} \u2013 ${_(Math.max(Z,E))}`;It.push({..._e(A.x,A.y,.01,a.color,q,Le(a,A.i,E,q)),part:"anchor"})}if(a.kind!=="range")for(let L of j)for(let A of L){if(!F&&!N&&!e.labels&&!a.errors)continue;let Z=a.data[A.i],E=X?C[A.i]-k[A.i]:Z,q=Dt(a.name,f[A.i],E,_);(F||N)&&It.push(F&&a.symbol!=="circle"?vr(A.x,A.y,a.markerSize,a.symbol,a.color,N?q:void 0,Le(a,A.i,Z,q),"point"):{..._e(A.x,A.y,F?a.markerSize:.01,a.color,N?q:void 0,Le(a,A.i,Z,q)),part:F?"point":"anchor"}),N&&jn(a,A.i,S?A.y:A.x,C[A.i]),e.labels&&Tt.push(Y(A.x,A.y-8,_(E),{anchor:"middle"}))}}let Wn={plot:K,xs:S?[]:P.map((a,k)=>Ue(k)),rows:P.map(a=>[f[a],...G.map(k=>{let C=Xe(k);if(k.kind==="range"){let N=k.low[a],R=k.high[a];return`${k.name}: ${I(N)&&I(R)?`${C(N)} \u2013 ${C(R)}`:"\u2014"}`}let _=k.data[a];return`${k.name}: ${I(_)?C(X?(fe.get(k)?.[a]??0)-(oe.get(k)?.[a]??0):_):"\u2014"}`})]),count:d,zoom:M,crosshair:or(e)},Qe=[];if(e.brush&&!S){let a={x:K.x,y:K.y+K.height+Mr,width:K.width,height:wr},k=G.find(_=>_.kind!=="range"),C={x:p(a.x+M.start/Math.max(1,d)*a.width),y:a.y,width:p((M.end-M.start)/Math.max(1,d)*a.width),height:a.height};if(Qe.push({kind:"rect",part:"brush",x:a.x,y:a.y,width:a.width,height:a.height,fill:"var(--skdx-color-surface-sunken)",stroke:B.grid}),k){let _=re(k.data),[N,R]=de(_),j=d>1?a.width/(d-1):0,D=k.data.flatMap((L,A)=>I(L)?[{x:p(a.x+A*j),y:p(a.y+a.height-(R===N?.5:(L-N)/(R-N))*(a.height-4)-2)}]:[]),F=ye(D);D.length>1&&Qe.push({kind:"path",part:"brush-series",d:`${F}L${D[D.length-1]?.x} ${a.y+a.height}L${D[0]?.x} ${a.y+a.height}Z`,fill:k.color,fillOpacity:.3})}Qe.push({kind:"rect",part:"brush-window",...C,fill:"var(--skdx-color-primary-500)",opacity:.15,stroke:B.axis},{kind:"rect",part:"brush-handle",x:p(C.x-3),y:a.y+8,width:6,height:a.height-16,fill:B.axis,rx:2},{kind:"rect",part:"brush-handle",x:p(C.x+C.width-3),y:a.y+8,width:6,height:a.height-16,fill:B.axis,rx:2}),Wn.brush={box:a,window:C}}return{...wt,shapes:[...Nn,...$t,...qe,...Ct,..._n,...It,...Tt,...yr(e.annotations,Fn),...Qe,...wt.shapes],hit:Wn,issues:o,defs:Ye.length?Ye:void 0}}function Sr(e,n){if(!(!I(e)||n===null||n===void 0))return typeof n=="number"?I(n)?[e-Math.abs(n),e+Math.abs(n)]:void 0:I(n[0])&&I(n[1])?[Math.min(n[0],n[1]),Math.max(n[0],n[1])]:void 0}function Si(e,n){if(!e||n<2)return{start:0,end:n};let t=Math.max(0,Math.min(n-1,Math.floor(e.start))),r=Math.max(t+1,Math.min(n,Math.ceil(e.end)));return r-t<2&&n>=2?{start:Math.min(t,n-2),end:Math.min(t,n-2)+2}:{start:t,end:r}}function $i(e,n,t){let r=f=>f.type??n,i=[],o=Mi(e),s=e.categories??[],l=(e.transforms??[]).filter(f=>f.type==="sort"||f.type==="bin"||f.type==="aggregate"),c=(e.transforms??[]).filter(f=>!l.includes(f)),d=e.stacked||e.stackOffset!==void 0&&e.stackOffset!=="zero",u=(f,M,T)=>{let S=T.filter(O=>O!==null&&!(typeof O=="number"&&Number.isFinite(O))).length;S&&i.push({code:"invalid-value",severity:"warning",message:`Series "${f}" has ${S} value${S===1?"":"s"} that ${S===1?"is":"are"} neither a number nor null; drawn as gaps.`,itemId:M??f}),s.length&&T.length!==s.length&&!e.transform&&i.push({code:"length-mismatch",severity:"warning",message:`Series "${f}" has ${T.length} values for ${s.length} categories.`,itemId:M??f})},h=e.series.map((f,M)=>{let T=r(f),S=d?!0:void 0,O=f.type==="range"?void 0:f.stack,G=O===!1?void 0:O===!0||O===void 0&&S?`${T}`:O;f.type==="range"?(u(f.name,f.id,f.low),u(f.name,f.id,f.high)):u(f.name,f.id,f.data);let W=X=>e.nulls==="zero"?X.map(Q=>I(Q)?Q:0):X,P=$r(o,f.axis);return P===void 0&&i.push({code:"unknown-axis",severity:"warning",message:`Series "${f.name}" names axis "${String(f.axis)}", which is not defined; drawn on the first axis.`,itemId:f.id??f.name}),{name:f.name,id:f.id,color:lr(e,M,f.color),axis:P??o[0]?.id,hidden:cr(e,f.name),index:M,kind:T,data:f.type==="range"?[]:W(_t(_t(f.data,c),f.transforms)),low:f.type==="range"?f.low:[],high:f.type==="range"?f.high:[],curve:f.curve??e.curve??"linear",dash:f.type==="range"?void 0:f.dash,markers:f.type==="range"?void 0:f.markers,symbol:f.type==="range"?"circle":f.symbol??"circle",markerSize:f.type==="range"?3:f.markerSize??3,errors:f.type==="range"?void 0:f.errors,stack:T==="range"||T==="line"?void 0:G,style:f.type==="range"?f.style??"area":"area",fillOpacity:(f.type==="range"?void 0:f.fillOpacity)??e.fillOpacity??.25,gradient:f.type!=="range"&&f.gradient===!0}}),b=()=>Math.max(s.length,...h.map(f=>Math.max(f.data.length,f.low.length))),v=f=>{let M=S=>S.length?f.map(O=>S[O]??null):S,T=Array.from({length:b()},(S,O)=>s[O]??String(O+1));s=f.map(S=>T[S]),h=h.map(S=>({...S,data:M(S.data),low:M(S.low),high:M(S.high)}))},g=(f,M)=>{let T=(M!==void 0?h.find(O=>O.name===M):void 0)??h.find(O=>!O.hidden&&O.kind!=="range")??h[0];M!==void 0&&!h.some(O=>O.name===M)&&i.push({code:"unknown-series",severity:"warning",message:`sort.by names "${M}", which is not a series; sorted by the first series.`});let S=Array.from({length:b()},(O,G)=>G).sort((O,G)=>{let W=T?.data[O]??T?.high[O],P=T?.data[G]??T?.high[G],X=I(W)?W:-1/0,Q=I(P)?P:-1/0;return f==="asc"?X-Q:Q-X});v(S)},m=f=>{let M=h.flatMap(S=>re(S.data)),T=$e(M,f);s=T.slice(1).map((S,O)=>`${t(T[O])}\u2013${t(S)}`),h=h.map(S=>{let O=re(S.data),G=0,W=Ce(O,T).map(P=>e.binMode==="density"?O.length?P.count/(O.length*(P.x1-P.x0)):0:e.binMode==="cumulative"?G+=P.count:P.count);return{...S,data:W}})},w=(f,M)=>{let T=Math.max(1,Math.floor(f)),S=b(),O=W=>{if(!W.length)return W;let P=[];for(let X=0;X<S;X+=T){let Q=re(W.slice(X,X+T));P.push(Q.length===0?null:M==="sum"?Q.reduce((oe,fe)=>oe+fe,0):M==="mean"?Q.reduce((oe,fe)=>oe+fe,0)/Q.length:M==="min"?Math.min(...Q):Math.max(...Q))}return P};s=Array.from({length:S},(W,P)=>s[P]??String(P+1)).filter((W,P)=>P%T===0),h=h.map(W=>({...W,data:O(W.data),low:O(W.low),high:O(W.high)}))};e.transform==="histogram"?m({bins:e.bins,binWidth:e.binWidth,domain:e.binDomain}):e.transform==="cumulative"&&(h=h.map(f=>{let M=0;return{...f,data:f.data.map(T=>I(T)?M+=T:M)}}));for(let f of l)f.type==="sort"?g(f.order??"desc"):f.type==="bin"?m(f):f.type==="aggregate"&&w(f.every,f.method??"sum");typeof e.sort=="string"?g(e.sort):e.sort&&g(e.sort.order,e.sort.by);let y=e.xAxis?.domain;if(y){let f=b(),M=Array.from({length:f},(G,W)=>s[W]??String(W+1)),T=G=>{let W=typeof G=="string"?G:ce(G);return M.findIndex(P=>typeof W=="string"?P===W||et(P)===W:ce(P)===W)},S=y.map(T),O=G=>G.length?S.map(W=>W<0?null:G[W]??null):G;s=[...y],h=h.map(G=>({...G,data:O(G.data),low:O(G.low),high:O(G.high)}))}return{series:h,categories:s,issues:i,axes:o}}function ct(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var jt=e=>e.id??e.name??e.series,Ir=e=>e.seriesId??e.series;function ue(e,n){let t=!1;return n.id!==void 0&&(t=!0,jt(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,Ir(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 pe(e){let n={},t=jt(e);t!==void 0&&(n.id=t);let r=Ir(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var Wt=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function Zt(e,n,t){let r=ct(e),i=pe(n),o=r.some(s=>ue(n,s));return t==="single"?o?[]:[i]:o?r.filter(s=>!ue(n,s)):[...r,i]}var Ci=.2;function Ii(e){let n=B.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 Ti=(e,n)=>e.kind==="text"?{...e,fill:B.grid}:{...e,opacity:(e.opacity??1)*n};function Et(e,n){let t=ct(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:ct(n.highlighted),i=r[0];if(t.length===0&&!i)return e;let o={highlighted:n.highlightScope?.highlighted??"item",faded:n.highlightScope?.faded??"global"},s=[],l=u=>!i||r.some(h=>ue(u,h))?!0:o.highlighted==="series"?r.some(h=>h.series!==void 0&&ue(u,{series:h.series})):!1,c=u=>{if(!i||o.faded==="none"||l(u))return!1;if(o.faded==="series"){let h=i.series;return h!==void 0&&ue(u,{series:h})}return!0},d=e.shapes.map(u=>{let h=u.item;if(!h||h.legend)return u;if(t.some(b=>ue(h,b))){let b=Ii(u);b&&s.push(b)}return c(h)?Ti(u,Ci):u});return s.length?{...e,shapes:[...d,...s]}:{...e,shapes:d}}function Ht(e){let n=re(e.data),t=st(e,n.length===0);if(t)return t;let r=$e(n,{bins:e.bins,binWidth:e.binWidth,domain:e.domain,thresholds:e.thresholds}),i=Ce(n,r),o=i.reduce((m,w)=>m+w.count,0),s=e.mode??"count",l=le(e.xAxis?.format??e.format),c=le(s==="percent"?{style:"percent",digits:1}:s==="density"?{style:"decimal",digits:3}:e.format),d=e.name??(s==="density"?"Density":s==="percent"?"Share":"Count"),u=m=>s==="density"?o>0&&m.x1>m.x0?m.count/(o*(m.x1-m.x0)):0:s==="percent"?o>0?m.count/o:0:m.count,h=i.map(m=>`${l(m.x0)}\u2013${l(m.x1)}`),b=Cr({...e,format:c,series:[{name:d,data:i.map(u),color:e.color}],categories:h,xAxis:e.xAxis?.label?{label:e.xAxis.label}:void 0,barGap:e.barGap??.05,transform:void 0},"bar"),v=b.shapes.map((m,w)=>{if(m.part!=="bar"||!m.item||m.item.index===void 0)return m;let y=i[m.item.index];if(!y)return m;let f=o>0?` (${Math.round(y.count/o*1e3)/10}%)`:"",M=`${h[m.item.index]??String(w)}: ${y.count}${f}${s==="count"?"":` \xB7 ${d} ${c(u(y))}`}`;return{...m,title:m.title===void 0?void 0:M,item:{...m.item,label:M}}}),g=b.hit?.rows.map((m,w)=>{let y=i[w];return y?[m[0],`${d}: ${c(u(y))}`,`Observations: ${y.count}`]:m});return{...b,shapes:v,hit:b.hit&&g?{...b.hit,rows:g}:b.hit}}function Ae(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 Ut=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function Tr(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 je(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=Tr(t,n),i=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(i,r)??i}}function Kt(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[Tr(t,n)];return{kind:"line",part:"crosshair",x1:r,x2:r,y1:t.plot.y,y2:t.plot.y+t.plot.height,stroke:B.axis,dash:"3 3"}}function qt(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!Ut(r.plot,n,t))return[];let i=Kt(e,n),{rows:o}=je(e,n),s=e.tooltipAnchored?r.plot.y+8:t;return[i,...it(i.x1,s,o,e.width,e.height,e.tooltipPlacement)]}function Yt(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 qt(e,i,t.plot.y+8)}function Xt(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:c,y:d}=Ae(t,r,i,e.width,e.height);if(Ut(e.hit.plot,c,d)){let u=je(e,c),h=Kt(e,c);if(u&&h)return{lines:u.rows,shapes:[h]}}}let o=n?.closest?.("[data-skdx-part]"),s=e.tooltipFormatter?be(e,n)?.item:void 0,l=s&&e.tooltipFormatter?.(s)||o&&Array.from(o.children).find(c=>c.tagName.toLowerCase()==="title")?.textContent;return l?{lines:Array.isArray(l)?l:[l],shapes:[]}:{lines:[],shapes:[]}}function Ar(e,n,t,r,i,o,s){let l=e?.closest?.("[data-skdx-part]"),c=s&&s.tooltipFormatter?be(s,e)?.item:void 0,d=c&&s?.tooltipFormatter?.(c)||l&&Array.from(l.children).find(g=>g.tagName.toLowerCase()==="title")?.textContent;if(!d)return[];let u=s?.tooltipAnchored?be(s,e):void 0,h=u?s?.shapes[u.index]:void 0,{x:b,y:v}=h?We(h):Ae(n,t,r,i,o);return it(b,v,d,i,o,s?.tooltipPlacement)}function Qt(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:s}=Ae(t,r,i,e.width,e.height),l=qt(e,o,s);if(l.length>0)return l}return Ar(n,t,r,i,e.width,e.height,e)}function Jt(e,n){let t=be(e,n);return t&&!t.item.legend?pe(t.item):null}var Ai=(e,n)=>{let{x:t,y:r}=We(e),i=e.kind==="circle"?e.cy:e.kind==="rect"?e.y+e.height/2:r;return t>=n.x&&t<=n.x+n.width&&i>=n.y&&i<=n.y+n.height};function en(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!Ai(i,n))continue;let o=pe(i.item),s=JSON.stringify(o);t.has(s)||(t.add(s),r.push(o))}return r}var tn=e=>({kind:"rect",part:"selection-box",x:p(e.x),y:p(e.y),width:p(e.width),height:p(e.height),fill:B.focus,opacity:.12,stroke:B.focus}),ut=(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 Or(e,n,t){let r=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){let s=e[i],l=e[o];s.y>t!=l.y>t&&n<(l.x-s.x)*(t-s.y)/(l.y-s.y)+s.x&&(r=!r)}return r}function nn(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}=We(i),l=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:s;if(!Or(n,o,l))continue;let c=pe(i.item),d=JSON.stringify(c);t.has(d)||(t.add(d),r.push(c))}return r}var rn=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${p(n.x)} ${p(n.y)}`).join("L")}`:"",fill:B.focus,fillOpacity:.12,stroke:B.focus,dash:"4 3"}),dt=6;function on(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-dt||n>i.x1+dt))return Math.abs(n-i.x0)<=dt?{bar:i,mode:"start"}:Math.abs(n-i.x1)<=dt?{bar:i,mode:"end"}:{bar:i,mode:"move"}}}function sn(e,n,t){let r=e.edit;return zr(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function an(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(c=>c.index===n);if(!o)return;let s=t.altKey?t.shiftKey?"start":"end":"move",l=r.snap??r.invert(o.x0+10)-r.invert(o.x0);return zr(r,{bar:o,mode:s},i*l)}function zr(e,{bar:n,mode:t},r){let i=l=>e.snap?Math.round(l/e.snap)*e.snap:l,o=n.start,s=n.end;return t==="move"?(o=i(n.start+r),s=o+(n.end-n.start)):t==="start"?o=Math.min(i(n.start+r),n.end):s=Math.max(i(n.end+r),n.start),{id:n.id,name:n.name,start:o,end:s}}function ln(e,n,t){let r=e.edit,i=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:p(Math.min(i,o)),y:p(n.bar.y),width:p(Math.max(1,Math.abs(o-i))),height:p(n.bar.height),fill:B.focus,opacity:.25,stroke:B.focus,rx:2}}var Oi=64,zi=e=>Math.max(1,Math.min(Oi,e));function cn(e,n,t,r){let i=n>0?.8:1.25,o=zi(e.view.zoom*i);if(o===e.view.zoom)return e.view;let{plot:s,scale:l}=e,[c,d]=e.view.center,u=(t-(s.x+s.width/2))/l,h=(r-(s.y+s.height/2))/l,b=e.view.zoom/o;return{center:[c+u*(1-b),e.fromY(e.toY(d)-h*(1-b))],zoom:o}}function dn(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 be(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 ht=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function We(e){switch(e.kind){case"rect":return{x:e.x+e.width/2,y:e.y};case"circle":return{x:e.cx,y:e.cy-e.r};case"line":return{x:(e.x1+e.x2)/2,y:Math.min(e.y1,e.y2)};case"text":return{x:e.x,y:e.y};case"path":{let n=/M\s*(-?[\d.]+)[ ,](-?[\d.]+)/.exec(e.d);return n?{x:Number(n[1]),y:Number(n[2])}:{x:0,y:0}}}}function un(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let r=B.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*ie+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}=We(t),l=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...l?it(p(o),p(s),l,e.width,e.height):[]]}function hn(e,n,t){let r=ht(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 Ie=2,Te=(e,n,t)=>{let r=Math.max(Ie,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},Lr=(e,n)=>!e||e.start<=0&&e.end>=n;function fn(e,n,t){if(e.count<=Ie||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,s=n>0?1.25:.8,l=Math.max(Ie,Math.min(e.count,Math.round(o*s)));if(l===o)return n>0&&!Lr(e.zoom,e.count)?Te(r,l,e.count):void 0;let c=Math.max(0,Math.min(1,(t-e.plot.x)/e.plot.width)),d=r+c*o;return Te(d-c*l,l,e.count)}function mn(e,n,t,r){let i=n.end-n.start,o=Math.max(Ie,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 Te(n.start+s*i-s*o,o,e.count)}function pn(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return Te(n.start-t/i,r,e.count)}function bn(e,n,t){let r=e.brush;if(!r||!Ut(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:Te(s-o/2,o,e.count)}}function gn(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 Te(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-Ie,Math.round(t.start+o))),end:t.end};let s=Math.min(e.count,Math.max(t.start+Ie,Math.round(t.end+o)));return{start:t.start,end:s}}function yn(e,n){switch(n.type){case"svg":return Promise.resolve(xn(e,n.label,n.resolve));case"csv":return Promise.resolve(Pr(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=xn(e,n.label,n.resolve);return Br(t,e.width,e.height,n.scale,n.background)}}}var he=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;"),Ze=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${he(String(t))}"`).join("");function Rr(e){let n=e.title?`<title>${he(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${Ze([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${Ze([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${Ze([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${Ze([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${Ze([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]])}>${he(e.text)}</text>`}}function Vr(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${he(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="${he(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function xn(e,n,t){let r=Vr(e)+e.shapes.map(Rr).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="${he(n)}" font-family="${he(B.fontFamily)}" font-size="${he(B.fontSize)}"><title>${he(n)}</title>${r}</svg>`}function Br(e,n,t,r=2,i){return new Promise((o,s)=>{let l=URL.createObjectURL(new Blob([e],{type:"image/svg+xml;charset=utf-8"})),c=new Image;c.onload=()=>{URL.revokeObjectURL(l);let d=document.createElement("canvas");d.width=Math.round(n*r),d.height=Math.round(t*r);let u=d.getContext("2d");if(!u)return s(new Error("canvas 2d context unavailable"));i&&(u.fillStyle=i,u.fillRect(0,0,d.width,d.height)),u.drawImage(c,0,0,d.width,d.height),d.toBlob(h=>h?o(h):s(new Error("toBlob failed")),"image/png")},c.onerror=()=>{URL.revokeObjectURL(l),s(new Error("svg could not be decoded"))},c.src=l})}function Pr(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 kn(e,n){if(!n)return;let t=typeof n=="object"?n.maxRows??500:500,r=e.hit;if(r&&r.rows.length>0){let l=r.rows[0];if(r.rows.length>t)return;let c=["",...l.slice(1).map(u=>u.replace(/:\s[^:]*$/,""))],d=r.rows.map(u=>[u[0],...u.slice(1).map(h=>h.slice(h.lastIndexOf(": ")+2))]);return[c,...d]}let i=e.shapes.flatMap(l=>l.item&&!l.item.legend&&!(l.part==="anchor"&&!l.title)?[l.item]:[]);if(i.length===0||i.length>t)return;let o=["series","name","category","value"].filter(l=>i.some(c=>c[l]!==void 0)),s=(l,c)=>l[c]===void 0?"":String(l[c]);return[o.map(l=>l[0]?.toUpperCase()+l.slice(1)),...i.map(l=>o.map(c=>s(l,c)))]}var vn=new Map;function ft(e){let n=vn.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&&vn.delete(e)}},publish(o,s){Object.assign(r,o);for(let l of t)l(o,s)}};return vn.set(e,{group:i,listeners:t}),i}var Dr='[data-skdx-part]:not([data-skdx-part^="tooltip"]):not([data-skdx-part="focus"]):not([data-skdx-part="crosshair"])',wn=`@keyframes skdx-in{from{opacity:0}to{opacity:1}}${Dr}{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){${Dr}{animation:none;transition:none}}`;function Mn(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}var z=require("lit"),$=require("lit/decorators.js"),H=require("lit/directives/if-defined.js");var Li={fromAttribute:()=>!1},V=class extends z.LitElement{constructor(){super(...arguments);this.legend=!1;this.tooltip=!0;this.selectionMode="none";this.loading=!1;this.decorative=!1;this.accessibleTable=!1;this.zoomable=!1;this.editable=!1;this.crossFilter=!1;this.animated=!1;this.responsive=!1;this.tip=[];this.overlay=[];this.portal=null;this.highlightState=null;this.crossState=null;this.lastCross=null;this.pointers=new Map;this.hover=null;this.token={};this.focused=null;this.hiddenState=[];this.drag=null;this.onPointerMove=t=>{let r=this.layout;if(!r)return;this.pointers.has(t.pointerId)&&this.pointers.set(t.pointerId,this.viewBox(t,r).x);let i=this.drag;if(i?.grab==="select"){let{x:o,y:s}=this.viewBox(t,r);this.overlay=[tn(ut(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=[rn(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=sn(r,i.gantt,o-i.x),this.overlay=[ln(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(dn(r.map,i.view,o-i.x,s-i.y));return}if(i&&r.hit){if(i.grab==="pinch"){let[s,l]=[...this.pointers.values()];if(s===void 0||l===void 0||!i.distance)return;this.setZoom(mn(r.hit,i.zoom,Math.abs(s-l)/i.distance,(s+l)/2));return}let{x:o}=this.viewBox(t,r);this.setZoom(i.grab==="pan"?pn(r.hit,i.zoom,o-i.x):gn(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:s}=Xt(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=Qt(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(Jt(r,t.target)),this.syncId&&r.hit?.crosshair){let o=je(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=be(r,t.target)?.item.legend,l=this.canEdit(r)?on(r,i,o):void 0;if(l){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"edit",gantt:l},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.brushing()&&!s){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:this.selectionMode==="lasso"?"lasso":"select",points:[{x:i,y:o}]},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.canPan(r)&&r.map){let d=r.map.plot;if(i<d.x||i>d.x+d.width||o<d.y||o>d.y+d.height)return;this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"map",view:r.map.view},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}let c=r.hit;if(!(!c||!this.canZoom(r))){if(this.pointers.set(t.pointerId,i),this.pointers.size===2){let[d,u]=[...this.pointers.values()];this.drag={x:(d+u)/2,y:o,zoom:c.zoom,grab:"pinch",distance:Math.abs(d-u)||1}}else{let d=bn(c,i,o);if(d)this.drag={x:i,y:o,zoom:d.zoom,grab:d.grab},d.zoom!==c.zoom&&this.setZoom(d.zoom);else if(this.zoomable&&i>=c.plot.x&&i<=c.plot.x+c.plot.width&&o>=c.plot.y&&o<=c.plot.y+c.plot.height)this.drag={x:i,y:o,zoom:c.zoom,grab:"pan"};else{this.pointers.delete(t.pointerId);return}}t.currentTarget.setPointerCapture(t.pointerId),this.clearTip()}};this.onPointerUp=t=>{this.pointers.delete(t.pointerId);let r=t.currentTarget;r.hasPointerCapture(t.pointerId)&&r.releasePointerCapture(t.pointerId);let i=this.drag,o=this.layout;if(o&&(i?.grab==="select"||i?.grab==="lasso"||i?.grab==="edit"||i?.grab==="map")){this.overlay=[];let{x:s,y:l}=this.viewBox(t,o);if(Math.abs(s-i.x)>2||Math.abs(l-i.y)>2){i.grab==="select"?this.setSelected(en(o,ut(i.x,i.y,s,l))):i.grab==="lasso"?this.setSelected(nn(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 c=r.map.plot;if(i<c.x||i>c.x+c.width||o<c.y||o>c.y+c.height)return;t.preventDefault(),this.setView(cn(r.map,t.deltaY,i,o));return}let s=r.hit;if(!s||!this.canZoom(r)||o<s.plot.y||o>s.plot.y+s.plot.height)return;let l=fn(s,t.deltaY,i);l&&(t.preventDefault(),this.setZoom(l))};this.onClick=t=>{if(!this.layout)return;if(this.drag?.distance===-1){this.drag=null;return}let r=be(this.layout,t.target);r&&(r.item.range?this.setZoom(r.item.range):r.item.legend&&r.item.series!==void 0?this.toggle(r.item.series):(this.select(r.item),this.emit("skdx-item-click",r.item)))};this.onKeyDown=t=>{let r=this.layout;if(!r)return;if((t.key==="Enter"||t.key===" ")&&this.focused!==null){let l=r.shapes[this.focused]?.item;l&&(t.preventDefault(),this.select(l),this.emit("skdx-item-click",l));return}let i=this.canEdit(r)?an(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=hn(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?pe(s):null)}}connectedCallback(){super.connectedCallback(),!(typeof ResizeObserver>"u")&&(this.observer=new ResizeObserver(([t])=>{let r=Math.floor(t?.contentRect.width??0);r>0&&(this.measured=r)}),this.observer.observe(this))}disconnectedCallback(){this.observer?.disconnect(),this.leave?.(),this.leave=void 0,this.joined=void 0,super.disconnectedCallback()}sized(){let{width:t,height:r,legend:i,tooltip:o,format:s,palette:l,loading:c,error:d,emptyMessage:u,description:h,decorative:b,animated:v,responsive:g,highlighted:m,highlightScope:w,accessibleTable:y}=this;return{...typeof g=="object"&&this.measured!==void 0&&this.measured<(g.breakpoint??480)?g.compact:void 0,width:g&&this.measured?this.measured:t,height:r,animate:v,responsive:g,legend:i,tooltip:o,format:s,palette:l,loading:c,error:d,emptyMessage:u,description:h,decorative:b,highlighted:m===void 0?this.highlightState:m,highlightScope:w,accessibleTable:y,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&&ft(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=ft(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&&Wt(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(Zt(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 Ae(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&&ue(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?yn(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=Et(Pt(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let y of o.issues??[])this.emit("skdx-data-issue",y)}let s=this.canZoom(o),l=this.canPan(o),c=this.canEdit(o),d=this.brushing(),u=s||l||c||d,h=!o.decorative&&ht(o).length>0,b=o.description?`${r}-desc`:void 0,v=Mn(o),g=kn(o,this.accessibleTable),m=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,w=this.portal;return z.html`<svg
3
3
  xmlns="http://www.w3.org/2000/svg"
4
4
  viewBox="0 0 ${o.width} ${o.height}"
5
5
  width=${o.width}
6
6
  height=${o.height}
7
7
  role=${o.decorative?"presentation":"img"}
8
- aria-hidden=${o.decorative?"true":L.nothing}
9
- aria-label=${o.decorative?L.nothing:i}
8
+ aria-hidden=${o.decorative?"true":z.nothing}
9
+ aria-label=${o.decorative?z.nothing:i}
10
10
  aria-describedby=${(0,H.ifDefined)(b)}
11
- tabindex=${h?0:L.nothing}
11
+ tabindex=${h?0:z.nothing}
12
12
  data-skdx-chart=${r}
13
- data-zoomable=${s||l?"":L.nothing}
14
- data-brushing=${d&&!(s||l)?"":L.nothing}
15
- data-editable=${c?"":L.nothing}
16
- style=${v?`--skdx-chart-duration:${v}`:L.nothing}
13
+ data-zoomable=${s||l?"":z.nothing}
14
+ data-brushing=${d&&!(s||l)?"":z.nothing}
15
+ data-editable=${c?"":z.nothing}
16
+ style=${v?`--skdx-chart-duration:${v}`:z.nothing}
17
17
  font-family=${B.fontFamily}
18
18
  font-size=${B.fontSize}
19
- @pointermove=${o.tooltip||u?this.onPointerMove:L.nothing}
19
+ @pointermove=${o.tooltip||u?this.onPointerMove:z.nothing}
20
20
  @pointerleave=${()=>{this.clearTip(),this.highlight(null)}}
21
- @pointerdown=${u?this.onPointerDown:L.nothing}
22
- @pointerup=${u?this.onPointerUp:L.nothing}
23
- @pointercancel=${u?this.onPointerUp:L.nothing}
24
- @wheel=${s||l?this.onWheel:L.nothing}
25
- @dblclick=${s||l?()=>l?this.setView(void 0):this.setZoom(void 0):L.nothing}
21
+ @pointerdown=${u?this.onPointerDown:z.nothing}
22
+ @pointerup=${u?this.onPointerUp:z.nothing}
23
+ @pointercancel=${u?this.onPointerUp:z.nothing}
24
+ @wheel=${s||l?this.onWheel:z.nothing}
25
+ @dblclick=${s||l?()=>l?this.setView(void 0):this.setZoom(void 0):z.nothing}
26
26
  @click=${this.onClick}
27
- @keydown=${h?this.onKeyDown:L.nothing}
27
+ @keydown=${h?this.onKeyDown:z.nothing}
28
28
  @blur=${()=>{this.focused=null,this.highlight(null)}}
29
29
  >
30
30
  <title>${i}</title>
31
- ${o.description?L.svg`<desc id=${(0,H.ifDefined)(b)}>${o.description}</desc>`:L.nothing}
32
- ${v?L.svg`<style>${wn}</style>`:L.nothing} ${zi(o)}
33
- ${ft(o.shapes)}
34
- ${ft(this.tip.length||!this.crossState?this.tip:Yt(o,this.crossState))}
35
- ${ft(un(o,this.focused))} ${ft(this.overlay)}
31
+ ${o.description?z.svg`<desc id=${(0,H.ifDefined)(b)}>${o.description}</desc>`:z.nothing}
32
+ ${v?z.svg`<style>${wn}</style>`:z.nothing} ${Ri(o)}
33
+ ${mt(o.shapes)}
34
+ ${mt(this.tip.length||!this.crossState?this.tip:Yt(o,this.crossState))}
35
+ ${mt(un(o,this.focused))} ${mt(this.overlay)}
36
36
  </svg>
37
- ${w?L.html`<div
37
+ ${w?z.html`<div
38
38
  role="tooltip"
39
39
  data-skdx-tooltip=${r}
40
40
  style="left:${w.x+12}px;top:${w.y+12}px"
41
41
  >
42
- ${w.lines.map(y=>L.html`<div>${y}</div>`)}
43
- </div>`:L.nothing}
44
- ${x?L.html`<table data-skdx-table=${r}>
42
+ ${w.lines.map(y=>z.html`<div>${y}</div>`)}
43
+ </div>`:z.nothing}
44
+ ${g?z.html`<table data-skdx-table=${r}>
45
45
  <caption>
46
46
  ${m}
47
47
  </caption>
48
48
  <thead>
49
49
  <tr>
50
- ${(x[0]??[]).map(y=>L.html`<th scope="col">${y}</th>`)}
50
+ ${(g[0]??[]).map(y=>z.html`<th scope="col">${y}</th>`)}
51
51
  </tr>
52
52
  </thead>
53
53
  <tbody>
54
- ${x.slice(1).map(y=>L.html`<tr>
55
- ${y.map((f,M)=>M===0?L.html`<th scope="row">${f}</th>`:L.html`<td>${f}</td>`)}
54
+ ${g.slice(1).map(y=>z.html`<tr>
55
+ ${y.map((f,M)=>M===0?z.html`<th scope="row">${f}</th>`:z.html`<td>${f}</td>`)}
56
56
  </tr>`)}
57
57
  </tbody>
58
- </table>`:L.nothing}`}};V.styles=L.css`
58
+ </table>`:z.nothing}`}};V.styles=z.css`
59
59
  :host {
60
60
  display: inline-block;
61
61
  }
@@ -106,4 +106,4 @@
106
106
  [role='tooltip'] > :first-child:not(:only-child) {
107
107
  font-weight: bold;
108
108
  }
109
- `,g([(0,$.property)({type:Number})],V.prototype,"width",2),g([(0,$.property)({type:Number})],V.prototype,"height",2),g([(0,$.property)()],V.prototype,"label",2),g([(0,$.property)({type:Boolean,reflect:!0})],V.prototype,"legend",2),g([(0,$.property)({type:Boolean,attribute:"no-tooltip",converter:Oi})],V.prototype,"tooltip",2),g([(0,$.property)({attribute:!1})],V.prototype,"format",2),g([(0,$.property)({attribute:!1})],V.prototype,"palette",2),g([(0,$.property)({attribute:!1})],V.prototype,"hiddenSeries",2),g([(0,$.property)({attribute:!1})],V.prototype,"selected",2),g([(0,$.property)({attribute:"selection-mode"})],V.prototype,"selectionMode",2),g([(0,$.property)({attribute:!1})],V.prototype,"highlighted",2),g([(0,$.property)({attribute:!1})],V.prototype,"highlightScope",2),g([(0,$.property)({type:Boolean,reflect:!0})],V.prototype,"loading",2),g([(0,$.property)()],V.prototype,"error",2),g([(0,$.property)({attribute:"empty-message"})],V.prototype,"emptyMessage",2),g([(0,$.property)()],V.prototype,"description",2),g([(0,$.property)({type:Boolean,reflect:!0})],V.prototype,"decorative",2),g([(0,$.property)({type:Boolean,attribute:"accessible-table"})],V.prototype,"accessibleTable",2),g([(0,$.property)({attribute:!1})],V.prototype,"zoom",2),g([(0,$.property)({attribute:!1})],V.prototype,"view",2),g([(0,$.property)({type:Boolean,reflect:!0})],V.prototype,"zoomable",2),g([(0,$.property)({type:Boolean,reflect:!0})],V.prototype,"editable",2),g([(0,$.property)({attribute:"sync-id"})],V.prototype,"syncId",2),g([(0,$.property)({type:Boolean,attribute:"cross-filter"})],V.prototype,"crossFilter",2),g([(0,$.property)({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],V.prototype,"animated",2),g([(0,$.property)({type:Boolean,reflect:!0})],V.prototype,"responsive",2),g([(0,$.state)()],V.prototype,"tip",2),g([(0,$.state)()],V.prototype,"overlay",2),g([(0,$.state)()],V.prototype,"portal",2),g([(0,$.state)()],V.prototype,"measured",2),g([(0,$.state)()],V.prototype,"viewState",2),g([(0,$.state)()],V.prototype,"highlightState",2),g([(0,$.state)()],V.prototype,"crossState",2),g([(0,$.state)()],V.prototype,"focused",2),g([(0,$.state)()],V.prototype,"hiddenState",2),g([(0,$.state)()],V.prototype,"zoomState",2),g([(0,$.state)()],V.prototype,"selectedState",2);var U=class extends V{constructor(){super(...arguments);this.series=[];this.labels=!1;this.connectNulls=!1;this.stacked=!1;this.brush=!1;this.crosshair=!1}input(){let{series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:l,annotations:c,labels:d,curve:u,connectNulls:h,nulls:b,stacked:v,stackOffset:x,orientation:m,radius:w,barGap:y,barWidth:f,sort:M,transform:A,transforms:S,bins:O,binWidth:_,binDomain:W,binMode:P,sampling:X,brush:Q,crosshair:ie}=this;return{...this.sized(),series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:l,annotations:c,labels:d,curve:u,connectNulls:h,nulls:b,stacked:v,stackOffset:x,orientation:m,radius:w,barGap:y,barWidth:f,sort:M,transform:A,transforms:S,bins:O,binWidth:_,binDomain:W,binMode:P,sampling:X,brush:Q,crosshair:ie}}};g([(0,$.property)({attribute:!1})],U.prototype,"series",2),g([(0,$.property)({attribute:!1})],U.prototype,"categories",2),g([(0,$.property)({attribute:!1})],U.prototype,"xAxis",2),g([(0,$.property)({attribute:!1})],U.prototype,"yAxis",2),g([(0,$.property)({attribute:!1})],U.prototype,"rightAxis",2),g([(0,$.property)({attribute:!1})],U.prototype,"references",2),g([(0,$.property)({attribute:!1})],U.prototype,"annotations",2),g([(0,$.property)({type:Boolean,reflect:!0})],U.prototype,"labels",2),g([(0,$.property)()],U.prototype,"curve",2),g([(0,$.property)({type:Boolean,attribute:"connect-nulls"})],U.prototype,"connectNulls",2),g([(0,$.property)()],U.prototype,"nulls",2),g([(0,$.property)({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],U.prototype,"stacked",2),g([(0,$.property)({attribute:"stack-offset"})],U.prototype,"stackOffset",2),g([(0,$.property)()],U.prototype,"orientation",2),g([(0,$.property)({type:Number})],U.prototype,"radius",2),g([(0,$.property)({type:Number,attribute:"bar-gap"})],U.prototype,"barGap",2),g([(0,$.property)({type:Number,attribute:"bar-width"})],U.prototype,"barWidth",2),g([(0,$.property)()],U.prototype,"sort",2),g([(0,$.property)()],U.prototype,"transform",2),g([(0,$.property)({attribute:!1})],U.prototype,"transforms",2),g([(0,$.property)({type:Number})],U.prototype,"bins",2),g([(0,$.property)({type:Number,attribute:"bin-width"})],U.prototype,"binWidth",2),g([(0,$.property)({attribute:!1})],U.prototype,"binDomain",2),g([(0,$.property)({attribute:"bin-mode"})],U.prototype,"binMode",2),g([(0,$.property)({attribute:!1})],U.prototype,"sampling",2),g([(0,$.property)({type:Boolean,reflect:!0})],U.prototype,"brush",2),g([(0,$.property)({type:Boolean,reflect:!0})],U.prototype,"crosshair",2);var zi=e=>e.defs&&e.defs.length?L.svg`<defs>${e.defs.map(n=>L.svg`<linearGradient id=${n.id} x1="0" y1="0" x2=${n.vertical===!1?1:0} y2=${n.vertical===!1?0:1}>${n.stops.map(t=>L.svg`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${(0,H.ifDefined)(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:L.nothing,ft=e=>L.svg`${e.map((n,t)=>{let r=n.title?L.svg`<title>${n.title}</title>`:L.nothing,i=n.item?t:void 0;switch(n.kind){case"path":return L.svg`<path data-skdx-part=${n.part} data-skdx-i=${(0,H.ifDefined)(i)} d=${n.d} fill=${n.fill??"none"} stroke=${(0,H.ifDefined)(n.stroke)} stroke-width=${(0,H.ifDefined)(n.strokeWidth)} stroke-linecap=${(0,H.ifDefined)(n.strokeLinecap)} stroke-linejoin=${(0,H.ifDefined)(n.strokeLinejoin)} stroke-dasharray=${(0,H.ifDefined)(n.dash)} opacity=${(0,H.ifDefined)(n.opacity)} fill-opacity=${(0,H.ifDefined)(n.fillOpacity)}>${r}</path>`;case"rect":return L.svg`<rect data-skdx-part=${n.part} data-skdx-i=${(0,H.ifDefined)(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${(0,H.ifDefined)(n.rx)} fill=${n.fill} stroke=${(0,H.ifDefined)(n.stroke)} fill-opacity=${(0,H.ifDefined)(n.opacity)}>${r}</rect>`;case"line":return L.svg`<line data-skdx-part=${n.part} data-skdx-i=${(0,H.ifDefined)(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${(0,H.ifDefined)(n.strokeWidth)} stroke-dasharray=${(0,H.ifDefined)(n.dash)} opacity=${(0,H.ifDefined)(n.opacity)}>${r}</line>`;case"circle":return L.svg`<circle data-skdx-part=${n.part} data-skdx-i=${(0,H.ifDefined)(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${(0,H.ifDefined)(n.stroke)} opacity=${(0,H.ifDefined)(n.opacity)}>${r}</circle>`;case"text":return L.svg`<text data-skdx-part=${n.part} data-skdx-i=${(0,H.ifDefined)(i)} x=${n.x} y=${n.y} text-anchor=${(0,H.ifDefined)(n.anchor)} dominant-baseline=${(0,H.ifDefined)(n.baseline)} fill=${(0,H.ifDefined)(n.fill)} font-weight=${(0,H.ifDefined)(n.weight)} pointer-events=${(0,H.ifDefined)(i===void 0?"none":void 0)} transform=${(0,H.ifDefined)(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var J=class extends V{constructor(){super(...arguments);this.data=[];this.labels=!1}render(){let{data:t,name:r,color:i,bins:o,binWidth:s,thresholds:l,domain:c,mode:d,xAxis:u,yAxis:h,references:b,annotations:v,labels:x,barGap:m}=this;return this.root(Ht({...this.sized(),data:t,name:r,color:i,bins:o,binWidth:s,thresholds:l,domain:c,mode:d,xAxis:u,yAxis:h,references:b,annotations:v,labels:x,barGap:m}),"histogram",this.label??"Histogram")}};g([(0,ee.property)({attribute:!1})],J.prototype,"data",2),g([(0,ee.property)()],J.prototype,"name",2),g([(0,ee.property)()],J.prototype,"color",2),g([(0,ee.property)({type:Number})],J.prototype,"bins",2),g([(0,ee.property)({type:Number,attribute:"bin-width"})],J.prototype,"binWidth",2),g([(0,ee.property)({attribute:!1})],J.prototype,"thresholds",2),g([(0,ee.property)({attribute:!1})],J.prototype,"domain",2),g([(0,ee.property)()],J.prototype,"mode",2),g([(0,ee.property)({attribute:!1})],J.prototype,"xAxis",2),g([(0,ee.property)({attribute:!1})],J.prototype,"yAxis",2),g([(0,ee.property)({attribute:!1})],J.prototype,"references",2),g([(0,ee.property)({attribute:!1})],J.prototype,"annotations",2),g([(0,ee.property)({type:Boolean,reflect:!0})],J.prototype,"labels",2),g([(0,ee.property)({type:Number,attribute:"bar-gap"})],J.prototype,"barGap",2),J=g([(0,ee.customElement)("skdx-histogram")],J);0&&(module.exports={SkdxHistogram});
109
+ `,x([(0,$.property)({type:Number})],V.prototype,"width",2),x([(0,$.property)({type:Number})],V.prototype,"height",2),x([(0,$.property)()],V.prototype,"label",2),x([(0,$.property)({type:Boolean,reflect:!0})],V.prototype,"legend",2),x([(0,$.property)({type:Boolean,attribute:"no-tooltip",converter:Li})],V.prototype,"tooltip",2),x([(0,$.property)({attribute:!1})],V.prototype,"format",2),x([(0,$.property)({attribute:!1})],V.prototype,"palette",2),x([(0,$.property)({attribute:!1})],V.prototype,"hiddenSeries",2),x([(0,$.property)({attribute:!1})],V.prototype,"selected",2),x([(0,$.property)({attribute:"selection-mode"})],V.prototype,"selectionMode",2),x([(0,$.property)({attribute:!1})],V.prototype,"highlighted",2),x([(0,$.property)({attribute:!1})],V.prototype,"highlightScope",2),x([(0,$.property)({type:Boolean,reflect:!0})],V.prototype,"loading",2),x([(0,$.property)()],V.prototype,"error",2),x([(0,$.property)({attribute:"empty-message"})],V.prototype,"emptyMessage",2),x([(0,$.property)()],V.prototype,"description",2),x([(0,$.property)({type:Boolean,reflect:!0})],V.prototype,"decorative",2),x([(0,$.property)({type:Boolean,attribute:"accessible-table"})],V.prototype,"accessibleTable",2),x([(0,$.property)({attribute:!1})],V.prototype,"zoom",2),x([(0,$.property)({attribute:!1})],V.prototype,"view",2),x([(0,$.property)({type:Boolean,reflect:!0})],V.prototype,"zoomable",2),x([(0,$.property)({type:Boolean,reflect:!0})],V.prototype,"editable",2),x([(0,$.property)({attribute:"sync-id"})],V.prototype,"syncId",2),x([(0,$.property)({type:Boolean,attribute:"cross-filter"})],V.prototype,"crossFilter",2),x([(0,$.property)({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],V.prototype,"animated",2),x([(0,$.property)({type:Boolean,reflect:!0})],V.prototype,"responsive",2),x([(0,$.state)()],V.prototype,"tip",2),x([(0,$.state)()],V.prototype,"overlay",2),x([(0,$.state)()],V.prototype,"portal",2),x([(0,$.state)()],V.prototype,"measured",2),x([(0,$.state)()],V.prototype,"viewState",2),x([(0,$.state)()],V.prototype,"highlightState",2),x([(0,$.state)()],V.prototype,"crossState",2),x([(0,$.state)()],V.prototype,"focused",2),x([(0,$.state)()],V.prototype,"hiddenState",2),x([(0,$.state)()],V.prototype,"zoomState",2),x([(0,$.state)()],V.prototype,"selectedState",2);var U=class extends V{constructor(){super(...arguments);this.series=[];this.labels=!1;this.connectNulls=!1;this.stacked=!1;this.brush=!1;this.crosshair=!1}input(){let{series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:l,annotations:c,labels:d,curve:u,connectNulls:h,nulls:b,stacked:v,stackOffset:g,orientation:m,radius:w,barGap:y,barWidth:f,sort:M,transform:T,transforms:S,bins:O,binWidth:G,binDomain:W,binMode:P,sampling:X,brush:Q,crosshair:oe}=this;return{...this.sized(),series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:l,annotations:c,labels:d,curve:u,connectNulls:h,nulls:b,stacked:v,stackOffset:g,orientation:m,radius:w,barGap:y,barWidth:f,sort:M,transform:T,transforms:S,bins:O,binWidth:G,binDomain:W,binMode:P,sampling:X,brush:Q,crosshair:oe}}};x([(0,$.property)({attribute:!1})],U.prototype,"series",2),x([(0,$.property)({attribute:!1})],U.prototype,"categories",2),x([(0,$.property)({attribute:!1})],U.prototype,"xAxis",2),x([(0,$.property)({attribute:!1})],U.prototype,"yAxis",2),x([(0,$.property)({attribute:!1})],U.prototype,"rightAxis",2),x([(0,$.property)({attribute:!1})],U.prototype,"references",2),x([(0,$.property)({attribute:!1})],U.prototype,"annotations",2),x([(0,$.property)({type:Boolean,reflect:!0})],U.prototype,"labels",2),x([(0,$.property)()],U.prototype,"curve",2),x([(0,$.property)({type:Boolean,attribute:"connect-nulls"})],U.prototype,"connectNulls",2),x([(0,$.property)()],U.prototype,"nulls",2),x([(0,$.property)({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],U.prototype,"stacked",2),x([(0,$.property)({attribute:"stack-offset"})],U.prototype,"stackOffset",2),x([(0,$.property)()],U.prototype,"orientation",2),x([(0,$.property)({type:Number})],U.prototype,"radius",2),x([(0,$.property)({type:Number,attribute:"bar-gap"})],U.prototype,"barGap",2),x([(0,$.property)({type:Number,attribute:"bar-width"})],U.prototype,"barWidth",2),x([(0,$.property)()],U.prototype,"sort",2),x([(0,$.property)()],U.prototype,"transform",2),x([(0,$.property)({attribute:!1})],U.prototype,"transforms",2),x([(0,$.property)({type:Number})],U.prototype,"bins",2),x([(0,$.property)({type:Number,attribute:"bin-width"})],U.prototype,"binWidth",2),x([(0,$.property)({attribute:!1})],U.prototype,"binDomain",2),x([(0,$.property)({attribute:"bin-mode"})],U.prototype,"binMode",2),x([(0,$.property)({attribute:!1})],U.prototype,"sampling",2),x([(0,$.property)({type:Boolean,reflect:!0})],U.prototype,"brush",2),x([(0,$.property)({type:Boolean,reflect:!0})],U.prototype,"crosshair",2);var Ri=e=>e.defs&&e.defs.length?z.svg`<defs>${e.defs.map(n=>z.svg`<linearGradient id=${n.id} x1="0" y1="0" x2=${n.vertical===!1?1:0} y2=${n.vertical===!1?0:1}>${n.stops.map(t=>z.svg`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${(0,H.ifDefined)(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:z.nothing,mt=e=>z.svg`${e.map((n,t)=>{let r=n.title?z.svg`<title>${n.title}</title>`:z.nothing,i=n.item?t:void 0;switch(n.kind){case"path":return z.svg`<path data-skdx-part=${n.part} data-skdx-i=${(0,H.ifDefined)(i)} d=${n.d} fill=${n.fill??"none"} stroke=${(0,H.ifDefined)(n.stroke)} stroke-width=${(0,H.ifDefined)(n.strokeWidth)} stroke-linecap=${(0,H.ifDefined)(n.strokeLinecap)} stroke-linejoin=${(0,H.ifDefined)(n.strokeLinejoin)} stroke-dasharray=${(0,H.ifDefined)(n.dash)} opacity=${(0,H.ifDefined)(n.opacity)} fill-opacity=${(0,H.ifDefined)(n.fillOpacity)}>${r}</path>`;case"rect":return z.svg`<rect data-skdx-part=${n.part} data-skdx-i=${(0,H.ifDefined)(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${(0,H.ifDefined)(n.rx)} fill=${n.fill} stroke=${(0,H.ifDefined)(n.stroke)} fill-opacity=${(0,H.ifDefined)(n.opacity)}>${r}</rect>`;case"line":return z.svg`<line data-skdx-part=${n.part} data-skdx-i=${(0,H.ifDefined)(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${(0,H.ifDefined)(n.strokeWidth)} stroke-dasharray=${(0,H.ifDefined)(n.dash)} opacity=${(0,H.ifDefined)(n.opacity)}>${r}</line>`;case"circle":return z.svg`<circle data-skdx-part=${n.part} data-skdx-i=${(0,H.ifDefined)(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${(0,H.ifDefined)(n.stroke)} opacity=${(0,H.ifDefined)(n.opacity)}>${r}</circle>`;case"text":return z.svg`<text data-skdx-part=${n.part} data-skdx-i=${(0,H.ifDefined)(i)} x=${n.x} y=${n.y} text-anchor=${(0,H.ifDefined)(n.anchor)} dominant-baseline=${(0,H.ifDefined)(n.baseline)} fill=${(0,H.ifDefined)(n.fill)} font-weight=${(0,H.ifDefined)(n.weight)} pointer-events=${(0,H.ifDefined)(i===void 0?"none":void 0)} transform=${(0,H.ifDefined)(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var J=class extends V{constructor(){super(...arguments);this.data=[];this.labels=!1}render(){let{data:t,name:r,color:i,bins:o,binWidth:s,thresholds:l,domain:c,mode:d,xAxis:u,yAxis:h,references:b,annotations:v,labels:g,barGap:m}=this;return this.root(Ht({...this.sized(),data:t,name:r,color:i,bins:o,binWidth:s,thresholds:l,domain:c,mode:d,xAxis:u,yAxis:h,references:b,annotations:v,labels:g,barGap:m}),"histogram",this.label??"Histogram")}};x([(0,ee.property)({attribute:!1})],J.prototype,"data",2),x([(0,ee.property)()],J.prototype,"name",2),x([(0,ee.property)()],J.prototype,"color",2),x([(0,ee.property)({type:Number})],J.prototype,"bins",2),x([(0,ee.property)({type:Number,attribute:"bin-width"})],J.prototype,"binWidth",2),x([(0,ee.property)({attribute:!1})],J.prototype,"thresholds",2),x([(0,ee.property)({attribute:!1})],J.prototype,"domain",2),x([(0,ee.property)()],J.prototype,"mode",2),x([(0,ee.property)({attribute:!1})],J.prototype,"xAxis",2),x([(0,ee.property)({attribute:!1})],J.prototype,"yAxis",2),x([(0,ee.property)({attribute:!1})],J.prototype,"references",2),x([(0,ee.property)({attribute:!1})],J.prototype,"annotations",2),x([(0,ee.property)({type:Boolean,reflect:!0})],J.prototype,"labels",2),x([(0,ee.property)({type:Number,attribute:"bar-gap"})],J.prototype,"barGap",2),J=x([(0,ee.customElement)("skdx-histogram")],J);0&&(module.exports={SkdxHistogram});