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