@skdx/web-components-charts 0.38.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/LICENSE +21 -0
- package/README.md +98 -0
- package/dist/area.cjs +109 -0
- package/dist/area.d.cts +2 -0
- package/dist/area.d.ts +2 -0
- package/dist/area.js +109 -0
- package/dist/bar.cjs +109 -0
- package/dist/bar.d.cts +2 -0
- package/dist/bar.d.ts +2 -0
- package/dist/bar.js +109 -0
- package/dist/boxplot.cjs +109 -0
- package/dist/boxplot.d.cts +2 -0
- package/dist/boxplot.d.ts +2 -0
- package/dist/boxplot.js +109 -0
- package/dist/bubble.cjs +109 -0
- package/dist/bubble.d.cts +2 -0
- package/dist/bubble.d.ts +2 -0
- package/dist/bubble.js +109 -0
- package/dist/bullet.cjs +109 -0
- package/dist/bullet.d.cts +2 -0
- package/dist/bullet.d.ts +2 -0
- package/dist/bullet.js +109 -0
- package/dist/bump.cjs +109 -0
- package/dist/bump.d.cts +2 -0
- package/dist/bump.d.ts +2 -0
- package/dist/bump.js +109 -0
- package/dist/candlestick.cjs +109 -0
- package/dist/candlestick.d.cts +2 -0
- package/dist/candlestick.d.ts +2 -0
- package/dist/candlestick.js +109 -0
- package/dist/chord.cjs +109 -0
- package/dist/chord.d.cts +2 -0
- package/dist/chord.d.ts +2 -0
- package/dist/chord.js +109 -0
- package/dist/circle-packing.cjs +109 -0
- package/dist/circle-packing.d.cts +2 -0
- package/dist/circle-packing.d.ts +2 -0
- package/dist/circle-packing.js +109 -0
- package/dist/combo.cjs +109 -0
- package/dist/combo.d.cts +2 -0
- package/dist/combo.d.ts +2 -0
- package/dist/combo.js +109 -0
- package/dist/dumbbell.cjs +109 -0
- package/dist/dumbbell.d.cts +2 -0
- package/dist/dumbbell.d.ts +2 -0
- package/dist/dumbbell.js +109 -0
- package/dist/funnel.cjs +109 -0
- package/dist/funnel.d.cts +2 -0
- package/dist/funnel.d.ts +2 -0
- package/dist/funnel.js +109 -0
- package/dist/gantt.cjs +109 -0
- package/dist/gantt.d.cts +2 -0
- package/dist/gantt.d.ts +2 -0
- package/dist/gantt.js +109 -0
- package/dist/gauge.cjs +109 -0
- package/dist/gauge.d.cts +2 -0
- package/dist/gauge.d.ts +2 -0
- package/dist/gauge.js +109 -0
- package/dist/heatmap.cjs +109 -0
- package/dist/heatmap.d.cts +2 -0
- package/dist/heatmap.d.ts +2 -0
- package/dist/heatmap.js +109 -0
- package/dist/histogram.cjs +109 -0
- package/dist/histogram.d.cts +2 -0
- package/dist/histogram.d.ts +2 -0
- package/dist/histogram.js +109 -0
- package/dist/icicle.cjs +109 -0
- package/dist/icicle.d.cts +2 -0
- package/dist/icicle.d.ts +2 -0
- package/dist/icicle.js +109 -0
- package/dist/index-oF5ss8v9.d.cts +2331 -0
- package/dist/index-oF5ss8v9.d.ts +2331 -0
- package/dist/index.cjs +109 -0
- package/dist/index.d.cts +29 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +109 -0
- package/dist/line.cjs +109 -0
- package/dist/line.d.cts +2 -0
- package/dist/line.d.ts +2 -0
- package/dist/line.js +109 -0
- package/dist/linear-gauge.cjs +109 -0
- package/dist/linear-gauge.d.cts +2 -0
- package/dist/linear-gauge.d.ts +2 -0
- package/dist/linear-gauge.js +109 -0
- package/dist/map.cjs +109 -0
- package/dist/map.d.cts +2 -0
- package/dist/map.d.ts +2 -0
- package/dist/map.js +109 -0
- package/dist/marimekko.cjs +109 -0
- package/dist/marimekko.d.cts +2 -0
- package/dist/marimekko.d.ts +2 -0
- package/dist/marimekko.js +109 -0
- package/dist/network.cjs +109 -0
- package/dist/network.d.cts +2 -0
- package/dist/network.d.ts +2 -0
- package/dist/network.js +109 -0
- package/dist/organization.cjs +109 -0
- package/dist/organization.d.cts +2 -0
- package/dist/organization.d.ts +2 -0
- package/dist/organization.js +109 -0
- package/dist/parallel.cjs +109 -0
- package/dist/parallel.d.cts +2 -0
- package/dist/parallel.d.ts +2 -0
- package/dist/parallel.js +109 -0
- package/dist/pareto.cjs +109 -0
- package/dist/pareto.d.cts +2 -0
- package/dist/pareto.d.ts +2 -0
- package/dist/pareto.js +109 -0
- package/dist/pie.cjs +109 -0
- package/dist/pie.d.cts +2 -0
- package/dist/pie.d.ts +2 -0
- package/dist/pie.js +109 -0
- package/dist/polar-area.cjs +109 -0
- package/dist/polar-area.d.cts +2 -0
- package/dist/polar-area.d.ts +2 -0
- package/dist/polar-area.js +109 -0
- package/dist/radar.cjs +109 -0
- package/dist/radar.d.cts +2 -0
- package/dist/radar.d.ts +2 -0
- package/dist/radar.js +109 -0
- package/dist/radial.cjs +109 -0
- package/dist/radial.d.cts +2 -0
- package/dist/radial.d.ts +2 -0
- package/dist/radial.js +109 -0
- package/dist/range.cjs +109 -0
- package/dist/range.d.cts +2 -0
- package/dist/range.d.ts +2 -0
- package/dist/range.js +109 -0
- package/dist/sankey.cjs +109 -0
- package/dist/sankey.d.cts +2 -0
- package/dist/sankey.d.ts +2 -0
- package/dist/sankey.js +109 -0
- package/dist/scatter.cjs +109 -0
- package/dist/scatter.d.cts +2 -0
- package/dist/scatter.d.ts +2 -0
- package/dist/scatter.js +109 -0
- package/dist/sparkline.cjs +109 -0
- package/dist/sparkline.d.cts +2 -0
- package/dist/sparkline.d.ts +2 -0
- package/dist/sparkline.js +109 -0
- package/dist/sunburst.cjs +109 -0
- package/dist/sunburst.d.cts +2 -0
- package/dist/sunburst.d.ts +2 -0
- package/dist/sunburst.js +109 -0
- package/dist/swarm.cjs +109 -0
- package/dist/swarm.d.cts +2 -0
- package/dist/swarm.d.ts +2 -0
- package/dist/swarm.js +109 -0
- package/dist/timeline.cjs +109 -0
- package/dist/timeline.d.cts +2 -0
- package/dist/timeline.d.ts +2 -0
- package/dist/timeline.js +109 -0
- package/dist/tree.cjs +109 -0
- package/dist/tree.d.cts +2 -0
- package/dist/tree.d.ts +2 -0
- package/dist/tree.js +109 -0
- package/dist/treemap.cjs +109 -0
- package/dist/treemap.d.cts +2 -0
- package/dist/treemap.d.ts +2 -0
- package/dist/treemap.js +109 -0
- package/dist/waffle.cjs +109 -0
- package/dist/waffle.d.cts +2 -0
- package/dist/waffle.d.ts +2 -0
- package/dist/waffle.js +109 -0
- package/dist/waterfall.cjs +109 -0
- package/dist/waterfall.d.cts +2 -0
- package/dist/waterfall.d.ts +2 -0
- package/dist/waterfall.js +109 -0
- package/package.json +76 -0
package/dist/bump.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
var jt=Object.defineProperty;var Ht=Object.getOwnPropertyDescriptor;var h=(e,n,t,r)=>{for(var i=r>1?void 0:r?Ht(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&&jt(n,t,i),i};import{customElement as an,property as W}from"lit/decorators.js";var ht=e=>Number(e.toPrecision(12)),Vt,pt=e=>(Vt??(Vt=new Intl.NumberFormat)).format(ht(e)),_t=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 ve(e){if(e===void 0)return pt;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:i="",timeZone:o}=e,s=d=>i?u=>d(u)+i:d,a=d=>r===void 0?d===void 0?{}:{maximumFractionDigits:d}:{minimumFractionDigits:r,maximumFractionDigits:r},l=d=>{let u=new Intl.NumberFormat(t,d);return s(f=>u.format(ht(f)))},c=d=>{let u=new Intl.DateTimeFormat(t,o?{...d,timeZone:o}:d);return f=>u.format(f)};switch(n){case"integer":return l({maximumFractionDigits:0});case"decimal":return l(a(2));case"percent":return l({style:"percent",...a(0)});case"currency":return l({style:"currency",currency:e.currency??"USD",...a()});case"compact":return l({notation:"compact",...a(1)});case"scientific":return l({notation:"scientific",...a(2)});case"date":return c({dateStyle:"medium"});case"time":return c({timeStyle:"short"});case"datetime":return c({dateStyle:"medium",timeStyle:"short"});case"duration":return s(_t)}}function ft(e,n){if(typeof e=="string")return e;let t=e instanceof Date?e.getTime():e;return n?ve(n)(t):e instanceof Date?new Intl.DateTimeFormat().format(e):pt(t)}function we([e,n],[t,r]){let i=n-e;return o=>i===0?t:t+(o-e)/i*(r-t)}function mt(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 x=e=>Number(e.toFixed(2)),K=e=>typeof e=="number"&&Number.isFinite(e),bt=e=>e.filter(K);function gt(e,n="linear"){if(e.length===0)return"";let t=e[0];if(n==="step"||n==="stepBefore"||n==="stepAfter"){let c=`M${t.x} ${t.y}`;for(let d=1;d<e.length;d++){let u=e[d-1],f=e[d];n==="stepAfter"?c+=`H${f.x}V${f.y}`:n==="stepBefore"?c+=`V${f.y}H${f.x}`:c+=`H${x((u.x+f.x)/2)}V${f.y}H${f.x}`}return c}if(n==="linear"||e.length<3)return`M${e.map(c=>`${c.x} ${c.y}`).join("L")}`;let r=e.length,i=e.slice(1).map((c,d)=>c.x-e[d].x),o=e.slice(1).map((c,d)=>c.y-e[d].y),s=i.map((c,d)=>c===0?0:o[d]/c),a=[s[0]];for(let c=1;c<r-1;c++){let d=s[c-1],u=s[c];a.push(d*u<=0?0:(d+u)/2)}a.push(s[r-2]);for(let c=0;c<r-1;c++){let d=s[c];if(d===0){a[c]=0,a[c+1]=0;continue}let u=a[c]/d,f=a[c+1]/d,$=Math.hypot(u,f);$>3&&(a[c]=3*u*d/$,a[c+1]=3*f*d/$)}let l=`M${t.x} ${t.y}`;for(let c=0;c<r-1;c++){let d=e[c],u=e[c+1],f=i[c]/3;l+=`C${x(d.x+f)} ${x(d.y+f*a[c])} ${x(u.x-f)} ${x(u.y-f*a[c+1])} ${u.x} ${u.y}`}return l}var J=1e3,ee=60*J,te=60*ee,ue=24*te,dn=[J,5*J,15*J,30*J,ee,5*ee,15*ee,30*ee,te,3*te,6*te,12*te,ue,2*ue,7*ue,14*ue];var Zt=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,Wt=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,Et={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function Ut(e,n,t){return e.replace(Wt,(r,i,o)=>{let s=Et[i];if(s===void 0)return i+o;let l=(o.match(Zt)??[]).map((c,d)=>{let u=Number(c);if(s===-1)return String(u+n);if(s===-2)return String(u+t);let f=d%s;return s===7?f===5?String(u+n):f===6?String(u+t):c:String(f%2===0?u+n:u+t)});return i+l.join(" ")})}var xt=(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:Ut(r.d,n,t)}}});var ke=["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)"))),k={axis:"var(--skdx-color-border-strong)",grid:"var(--skdx-color-border-subtle)",label:"var(--skdx-color-text-muted)",focus:"var(--skdx-color-focus-ring)",positive:"var(--skdx-color-success-500)",negative:"var(--skdx-color-danger-500)",fontFamily:"var(--skdx-font-family)",fontSize:"var(--skdx-font-size-xs)"};var yt=(e,n)=>n??ke[e%ke.length];var Y={top:16,right:16,bottom:32,left:48};function vt(e,n,t=Y){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 wt(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var he=20,Kt=120,kt=e=>{let n=ne(e);return n&&(n.position==="left"||n.position==="right")?n.width??Kt:0},Me=(e,n=600,t=300)=>({width:(e.width??n)-kt(e),height:(e.height??t)-(ne(e)?.position==="bottom"?he:0)}),St=e=>{let n=ne(e);return n&&(n.position===void 0||n.position==="top")?he:0},H=6.5,$e=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:yt(n)),Mt=(e,n)=>e.hiddenSeries?.includes(n)??!1;function Se(e,n,t=[],r={},i=10,o=8,s=!1){let a=[],l=r.maxItems,c=l!==void 0&&l>=0&&e.length>l?e.slice(0,l):e,d=e.length-c.length,u=r.interactive??!0,f=o,$=i,g=(p,v,w,A)=>{let T=(v?18:4)+p.length*H;f>o&&(s||f+T>n-8)&&(f=o,$+=he),v&&a.push({kind:"rect",part:"legend-swatch",x:f,y:$-5,width:10,height:10,fill:v,opacity:A?.3:void 0,item:w}),a.push({kind:"text",part:"legend-label",x:f+(v?14:0),y:$,text:p,baseline:"middle",fill:A?k.grid:k.label,item:w}),f+=T+12};for(let p of c){let v=t.includes(p.name),w=u?{label:p.name,series:p.name,legend:!0}:void 0;g(r.formatter?.(p.name)??p.name,p.color,w,v)}return d>0&&g(`+${d} more`,void 0,void 0,!1),r.align==="end"?Yt(a,n):a}function Yt(e,n){let t=new Map;for(let i of e){let o=i.kind==="rect"?i.y+5:i.y;t.set(o,[...t.get(o)??[],i])}let r=[];for(let i of t.values()){let o=Math.max(...i.map(a=>a.kind==="rect"?a.x+a.width:a.x+a.text.length*H)),s=n-8-o;for(let a of i)r.push({...a,x:a.x+s})}return r}var qt=(e,n,t={})=>new Set(Se(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function Ce(e,n,t,r=[]){let i=ne(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,s=wt(e),a=o?.position==="bottom",l=kt(e),c=e.hiddenSeries??[],d=o?l?Se(r,1/0,c,o,10,(o.position==="right"?n:0)+8,!0):Se(r,n,c,o,a?t+10:10):[],u=a?qt(r,n,o):0;return{width:n+l,height:a?t+Math.max(1,u)*he:t,legendOffset:o?.position==="left"?l:void 0,tooltip:s.enabled,tooltipFormatter:s.formatter,axisTooltipFormatter:s.axisFormatter,tooltipPortal:s.portal,tooltipPlacement:s.placement,tooltipAnchored:s.followPointer===!1?!0:void 0,description:e.description,decorative:e.decorative,animate:e.animate===!0?300:e.animate||void 0,responsive:!!e.responsive,shapes:d}}function Ie(e){let n=e.legendOffset;if(!n)return e;let t=[...xt(e.shapes.filter(l=>!l.part.startsWith("legend-")),n,0),...e.shapes.filter(l=>l.part.startsWith("legend-"))],r=l=>({...l,x:l.x+n}),i=e.hit?{...e.hit,plot:r(e.hit.plot),xs:e.hit.xs.map(l=>l+n),brush:e.hit.brush?{box:r(e.hit.brush.box),window:r(e.hit.brush.window)}:void 0}:void 0,o=e.edit,s=o?{...o,scale:l=>o.scale(l)+n,invert:l=>o.invert(l-n),bars:o.bars.map(l=>({...l,x0:l.x0+n,x1:l.x1+n}))}:void 0,a=e.map?{...e.map,plot:r(e.map.plot)}:void 0;return{...e,shapes:t,hit:i,edit:s,map:a,legendOffset:void 0}}function pe(e,n,t,r,i,o="auto"){let s=Array.isArray(t)?t:[t],a=Math.max(...s.map(f=>f.length))*H+12,l=6+s.length*16,c=o==="top"?{x:e-a/2,y:n-l-8}:o==="bottom"?{x:e-a/2,y:n+8}:o==="left"?{x:e-a-8,y:n-l/2}:o==="right"?{x:e+8,y:n-l/2}:{x:e+12,y:n-l-6},d=Math.max(0,Math.min(r-a,c.x)),u=Math.max(0,Math.min(i-l,c.y));return[{kind:"rect",part:"tooltip",x:x(d),y:x(u),width:x(a),height:l,fill:"var(--skdx-color-surface-raised)",stroke:k.axis,rx:3},...s.map((f,$)=>({kind:"text",part:"tooltip-label",x:x(d+6),y:x(u+11+$*16),text:f,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:s.length>1&&$===0?"bold":void 0}))]}function $t(e,n){if(e.length<2)return e;let t=e.reduce((i,o)=>Math.max(i,o.label.length),0)*H+8,r=Math.max(1,Math.ceil(e.length*t/Math.max(1,n)));return r===1?e:e.filter((i,o)=>o%r===0)}function Ct(e,n,t,r){let i=e.error!==void 0?"error":e.loading?"loading":n?"empty":null;if(!i)return null;let{width:o,height:s}=Me(e,t,r),a=i==="error"?e.error:i==="loading"?"Loading\u2026":e.emptyMessage??"No data available",l=[];return i==="loading"&&l.push({kind:"rect",part:"skeleton",x:0,y:0,width:o,height:s,fill:"var(--skdx-color-surface-sunken)",rx:4}),l.push({kind:"text",part:`state-${i}`,x:x(o/2),y:x(s/2),text:a,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":k.label}),{...Ce(e,o,s),shapes:l,tooltip:!1}}function It(e,n={}){let{plot:t,xTicks:r,yTicks:i,baseline:o}=e,s=t.x+t.width,a=t.y+t.height,l=[],c=n.grid??!0,d=(g,p)=>p?{kind:"line",part:"grid",x1:g.pos,x2:g.pos,y1:t.y,y2:a,stroke:k.grid}:{kind:"line",part:"grid",x1:t.x,x2:s,y1:g.pos,y2:g.pos,stroke:k.grid},u=n.x?.tickRotation??0,f=(g,p,v,w)=>u?L(g,p,v,{part:w,anchor:u<0?"end":"start",baseline:"middle",rotate:u}):L(g,p,v,{part:w,anchor:"middle"}),$=(g,p,v,w,A)=>{for(let T of g)l.push(p==="x"?{kind:"line",part:"tick",x1:T.pos,x2:T.pos,y1:v,y2:x(v+w*A),stroke:k.axis}:{kind:"line",part:"tick",x1:v,x2:x(v+w*A),y1:T.pos,y2:T.pos,stroke:k.axis})};if(n.categoryGrid)for(let g of r)l.push(d(g,!n.horizontal));if(n.horizontal){let g=n.axes??[{ticks:i,position:"bottom",offset:0,label:n.yLabel,...n.y}];if(c)for(let p of i)l.push(d(p,!0));g[0]?.showLine!==!1&&l.push({kind:"line",part:"axis",x1:o,x2:o,y1:t.y,y2:a,stroke:k.axis});for(let p of g){let v=p.position==="top"||p.position==="right",w=x(v?t.y-p.offset:a+p.offset),A=v||p.offset>0;p.showLine&&A&&l.push({kind:"line",part:"axis",x1:t.x,x2:s,y1:w,y2:w,stroke:k.axis}),p.showTicks&&$(p.ticks,"x",w,v?-1:1,p.tickSize??4);let T=x(v?w-8:w+20);for(let D of p.ticks)l.push(v?L(D.pos,T,D.label,{part:"x-label-top",anchor:"middle"}):f(D.pos,T,D.label,"x-label"));p.label&&l.push(A?L(4,T,p.label,{part:"axis-title",anchor:"start",baseline:v?void 0:"middle"}):L(4,t.y-6,p.label,{part:"axis-title",anchor:"start"}))}n.x?.showLine&&l.push({kind:"line",part:"axis",x1:n.rtl?s:t.x,x2:n.rtl?s:t.x,y1:t.y,y2:a,stroke:k.axis}),n.x?.showTicks&&$(r,"y",n.rtl?s:t.x,n.rtl?1:-1,n.x.tickSize??4);for(let p of r)l.push(n.rtl?L(s+8,p.pos,p.label,{part:"y-label",anchor:"start",baseline:"middle"}):L(t.x-8,p.pos,p.label,{part:"y-label",anchor:"end",baseline:"middle"}))}else{if(c)for(let p of i)l.push(d(p,!1));n.y?.showLine!==!1&&l.push({kind:"line",part:"axis",x1:t.x,x2:s,y1:o,y2:o,stroke:k.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 v=p.position==="left",w=v?t.x-p.offset:s+p.offset,A=v?"y-label":"y-label-right";p.showLine&&l.push({kind:"line",part:"axis",x1:x(w),x2:x(w),y1:t.y,y2:a,stroke:k.axis}),p.showTicks&&$(p.ticks,"y",x(w),v?-1:1,p.tickSize??4);for(let T of p.ticks)l.push(L(x(v?w-8:w+8),T.pos,T.label,{part:A,anchor:v?"end":"start",baseline:"middle"}));p.label&&l.push(L(x(v?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:v?"start":"end"}))}n.x?.showTicks&&$(r,"x",a,1,n.x.tickSize??4);for(let p of r)l.push(f(p.pos,a+(u?12:20),p.label,"x-label"))}return n.xLabel&&l.push(L(x(t.x+t.width/2),e.height-4,n.xLabel,{part:"axis-title",anchor:"middle"})),n.horizontal&&n.rightLabel&&l.push(L(e.width-4,t.y-6,n.rightLabel,{part:"axis-title",anchor:"end"})),l}var L=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:k.label,...r}),Tt=(e,n,t,r,i,o)=>({kind:"circle",part:"point",cx:e,cy:n,r:t,fill:r,title:i,item:o});function fe(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var Te=e=>e.id??e.name??e.series,zt=e=>e.seriesId??e.series;function F(e,n){let t=!1;return n.id!==void 0&&(t=!0,Te(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,zt(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 V(e){let n={},t=Te(e);t!==void 0&&(n.id=t);let r=zt(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var ze=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function Ae(e,n,t){let r=fe(e),i=V(n),o=r.some(s=>F(n,s));return t==="single"?o?[]:[i]:o?r.filter(s=>!F(n,s)):[...r,i]}var Xt=.2;function Qt(e){let n=k.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 Jt=(e,n)=>e.kind==="text"?{...e,fill:k.grid}:{...e,opacity:(e.opacity??1)*n};function Oe(e,n){let t=fe(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:fe(n.highlighted),i=r[0];if(t.length===0&&!i)return e;let o={highlighted:n.highlightScope?.highlighted??"item",faded:n.highlightScope?.faded??"global"},s=[],a=d=>!i||r.some(u=>F(d,u))?!0:o.highlighted==="series"?r.some(u=>u.series!==void 0&&F(d,{series:u.series})):!1,l=d=>{if(!i||o.faded==="none"||a(d))return!1;if(o.faded==="series"){let u=i.series;return u!==void 0&&F(d,{series:u})}return!0},c=e.shapes.map(d=>{let u=d.item;if(!u||u.legend)return d;if(t.some(f=>F(u,f))){let f=Qt(d);f&&s.push(f)}return l(u)?Jt(d,Xt):d});return s.length?{...e,shapes:[...c,...s]}:{...e,shapes:c}}function Q(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 Le=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function At(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 re(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=At(t,n),i=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(i,r)??i}}function Pe(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[At(t,n)];return{kind:"line",part:"crosshair",x1:r,x2:r,y1:t.plot.y,y2:t.plot.y+t.plot.height,stroke:k.axis,dash:"3 3"}}function Re(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!Le(r.plot,n,t))return[];let i=Pe(e,n),{rows:o}=re(e,n),s=e.tooltipAnchored?r.plot.y+8:t;return[i,...pe(i.x1,s,o,e.width,e.height,e.tooltipPlacement)]}function Be(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 Re(e,i,t.plot.y+8)}function Ne(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:l,y:c}=Q(t,r,i,e.width,e.height);if(Le(e.hit.plot,l,c)){let d=re(e,l),u=Pe(e,l);if(d&&u)return{lines:d.rows,shapes:[u]}}}let o=n?.closest?.("[data-skdx-part]"),s=e.tooltipFormatter?_(e,n)?.item:void 0,a=s&&e.tooltipFormatter?.(s)||o&&Array.from(o.children).find(l=>l.tagName.toLowerCase()==="title")?.textContent;return a?{lines:Array.isArray(a)?a:[a],shapes:[]}:{lines:[],shapes:[]}}function Ot(e,n,t,r,i,o,s){let a=e?.closest?.("[data-skdx-part]"),l=s&&s.tooltipFormatter?_(s,e)?.item:void 0,c=l&&s?.tooltipFormatter?.(l)||a&&Array.from(a.children).find(g=>g.tagName.toLowerCase()==="title")?.textContent;if(!c)return[];let d=s?.tooltipAnchored?_(s,e):void 0,u=d?s?.shapes[d.index]:void 0,{x:f,y:$}=u?ie(u):Q(n,t,r,i,o);return pe(f,$,c,i,o,s?.tooltipPlacement)}function De(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:s}=Q(t,r,i,e.width,e.height),a=Re(e,o,s);if(a.length>0)return a}return Ot(n,t,r,i,e.width,e.height,e)}function Ge(e,n){let t=_(e,n);return t&&!t.item.legend?V(t.item):null}var en=(e,n)=>{let{x:t,y:r}=ie(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 Fe(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!en(i,n))continue;let o=V(i.item),s=JSON.stringify(o);t.has(s)||(t.add(s),r.push(o))}return r}var je=e=>({kind:"rect",part:"selection-box",x:x(e.x),y:x(e.y),width:x(e.width),height:x(e.height),fill:k.focus,opacity:.12,stroke:k.focus}),be=(e,n,t,r)=>({x:Math.min(e,t),y:Math.min(n,r),width:Math.abs(t-e),height:Math.abs(r-n)});function Lt(e,n,t){let r=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){let s=e[i],a=e[o];s.y>t!=a.y>t&&n<(a.x-s.x)*(t-s.y)/(a.y-s.y)+s.x&&(r=!r)}return r}function He(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}=ie(i),a=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:s;if(!Lt(n,o,a))continue;let l=V(i.item),c=JSON.stringify(l);t.has(c)||(t.add(c),r.push(l))}return r}var Ve=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${x(n.x)} ${x(n.y)}`).join("L")}`:"",fill:k.focus,fillOpacity:.12,stroke:k.focus,dash:"4 3"}),me=6;function _e(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-me||n>i.x1+me))return Math.abs(n-i.x0)<=me?{bar:i,mode:"start"}:Math.abs(n-i.x1)<=me?{bar:i,mode:"end"}:{bar:i,mode:"move"}}}function Ze(e,n,t){let r=e.edit;return Pt(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function We(e,n,t){let r=e.edit,i=t.key==="ArrowRight"?1:t.key==="ArrowLeft"?-1:0;if(!r||n===null||!i||!(t.shiftKey||t.altKey))return;let o=r.bars.find(l=>l.index===n);if(!o)return;let s=t.altKey?t.shiftKey?"start":"end":"move",a=r.snap??r.invert(o.x0+10)-r.invert(o.x0);return Pt(r,{bar:o,mode:s},i*a)}function Pt(e,{bar:n,mode:t},r){let i=a=>e.snap?Math.round(a/e.snap)*e.snap:a,o=n.start,s=n.end;return t==="move"?(o=i(n.start+r),s=o+(n.end-n.start)):t==="start"?o=Math.min(i(n.start+r),n.end):s=Math.max(i(n.end+r),n.start),{id:n.id,name:n.name,start:o,end:s}}function Ee(e,n,t){let r=e.edit,i=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:x(Math.min(i,o)),y:x(n.bar.y),width:x(Math.max(1,Math.abs(o-i))),height:x(n.bar.height),fill:k.focus,opacity:.25,stroke:k.focus,rx:2}}var tn=64,nn=e=>Math.max(1,Math.min(tn,e));function Ue(e,n,t,r){let i=n>0?.8:1.25,o=nn(e.view.zoom*i);if(o===e.view.zoom)return e.view;let{plot:s,scale:a}=e,[l,c]=e.view.center,d=(t-(s.x+s.width/2))/a,u=(r-(s.y+s.height/2))/a,f=e.view.zoom/o;return{center:[l+d*(1-f),e.fromY(e.toY(c)-u*(1-f))],zoom:o}}function Ke(e,n,t,r){let{scale:i}=e;return{center:[n.center[0]-t/i,e.fromY(e.toY(n.center[1])+r/i)],zoom:n.zoom}}function _(e,n){let t=n?.closest?.("[data-skdx-i]"),r=Number(t?.getAttribute("data-skdx-i")),i=Number.isInteger(r)?e.shapes[r]?.item:void 0;return i?{index:r,item:i}:void 0}var ge=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function ie(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 Ye(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let r=k.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*H+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}=ie(t),a=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...a?pe(x(o),x(s),a,e.width,e.height):[]]}function qe(e,n,t){let r=ge(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 q=2,X=(e,n,t)=>{let r=Math.max(q,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},Rt=(e,n)=>!e||e.start<=0&&e.end>=n;function Xe(e,n,t){if(e.count<=q||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,s=n>0?1.25:.8,a=Math.max(q,Math.min(e.count,Math.round(o*s)));if(a===o)return n>0&&!Rt(e.zoom,e.count)?X(r,a,e.count):void 0;let l=Math.max(0,Math.min(1,(t-e.plot.x)/e.plot.width)),c=r+l*o;return X(c-l*a,a,e.count)}function Qe(e,n,t,r){let i=n.end-n.start,o=Math.max(q,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 X(n.start+s*i-s*o,o,e.count)}function Je(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return X(n.start-t/i,r,e.count)}function et(e,n,t){let r=e.brush;if(!r||!Le(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:X(s-o/2,o,e.count)}}function tt(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 X(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-q,Math.round(t.start+o))),end:t.end};let s=Math.min(e.count,Math.max(t.start+q,Math.round(t.end+o)));return{start:t.start,end:s}}function rt(e,n){switch(n.type){case"svg":return Promise.resolve(nt(e,n.label,n.resolve));case"csv":return Promise.resolve(Gt(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=nt(e,n.label,n.resolve);return Dt(t,e.width,e.height,n.scale,n.background)}}}var j=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/"/g,"""),oe=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${j(String(t))}"`).join("");function Bt(e){let n=e.title?`<title>${j(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${oe([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${oe([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${oe([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${oe([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${oe([t,["x",e.x],["y",e.y],["text-anchor",e.anchor],["dominant-baseline",e.baseline],["fill",e.fill],["font-weight",e.weight],["transform",e.rotate?`rotate(${e.rotate} ${e.x} ${e.y})`:void 0]])}>${j(e.text)}</text>`}}function Nt(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${j(t.id)}" x1="0" y1="0" x2="${t.vertical===!1?1:0}" y2="${t.vertical===!1?0:1}">${t.stops.map(r=>`<stop offset="${r.offset}" stop-color="${j(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function nt(e,n,t){let r=Nt(e)+e.shapes.map(Bt).join("");return t&&(r=r.replace(/var\((--[\w-]+)\)/g,(i,o)=>t(o).trim()||i)),`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${e.width} ${e.height}" width="${e.width}" height="${e.height}" role="img" aria-label="${j(n)}" font-family="${j(k.fontFamily)}" font-size="${j(k.fontSize)}"><title>${j(n)}</title>${r}</svg>`}function Dt(e,n,t,r=2,i){return new Promise((o,s)=>{let a=URL.createObjectURL(new Blob([e],{type:"image/svg+xml;charset=utf-8"})),l=new Image;l.onload=()=>{URL.revokeObjectURL(a);let c=document.createElement("canvas");c.width=Math.round(n*r),c.height=Math.round(t*r);let d=c.getContext("2d");if(!d)return s(new Error("canvas 2d context unavailable"));i&&(d.fillStyle=i,d.fillRect(0,0,c.width,c.height)),d.drawImage(l,0,0,c.width,c.height),c.toBlob(u=>u?o(u):s(new Error("toBlob failed")),"image/png")},l.onerror=()=>{URL.revokeObjectURL(a),s(new Error("svg could not be decoded"))},l.src=a})}function Gt(e){let n=t=>{let r=t==null?"":String(t);return/[",\n\r]/.test(r)?`"${r.replace(/"/g,'""')}"`:r};return e.map(t=>t.map(n).join(",")).join(`\r
|
|
2
|
+
`)}function it(e,n){if(!n)return;let t=typeof n=="object"?n.maxRows??500:500,r=e.hit;if(r&&r.rows.length>0){let a=r.rows[0];if(r.rows.length>t)return;let l=["",...a.slice(1).map(d=>d.replace(/:\s[^:]*$/,""))],c=r.rows.map(d=>[d[0],...d.slice(1).map(u=>u.slice(u.lastIndexOf(": ")+2))]);return[l,...c]}let i=e.shapes.flatMap(a=>a.item&&!a.item.legend&&!(a.part==="anchor"&&!a.title)?[a.item]:[]);if(i.length===0||i.length>t)return;let o=["series","name","category","value"].filter(a=>i.some(l=>l[a]!==void 0)),s=(a,l)=>a[l]===void 0?"":String(a[l]);return[o.map(a=>a[0]?.toUpperCase()+a.slice(1)),...i.map(a=>o.map(l=>s(a,l)))]}var ot=new Map;function xe(e){let n=ot.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&&ot.delete(e)}},publish(o,s){Object.assign(r,o);for(let a of t)a(o,s)}};return ot.set(e,{group:i,listeners:t}),i}var Ft='[data-skdx-part]:not([data-skdx-part^="tooltip"]):not([data-skdx-part="focus"]):not([data-skdx-part="crosshair"])',st=`@keyframes skdx-in{from{opacity:0}to{opacity:1}}${Ft}{animation:skdx-in var(--skdx-chart-duration,0ms) ease-out;transition:${["x","y","width","height","cx","cy","r","opacity","fill-opacity","d"].map(e=>`${e} var(--skdx-chart-duration,0ms) ease-out`).join(",")}}@media (prefers-reduced-motion:reduce){${Ft}{animation:none;transition:none}}`;function at(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}function lt(e){let n=[],t=e.series.map((b,C)=>({...b,index:C,hidden:Mt(e,b.name)})),r=Math.max(e.categories?.length??0,...t.map(b=>b.data.length)),i=Ct(e,r===0||t.every(b=>b.hidden||bt(b.data).length===0));if(i)return{...i,issues:n};for(let b of t){let C=b.data.filter(I=>I!==null&&!K(I)).length;C&&n.push({code:"invalid-value",severity:"warning",message:`Series "${b.name}" has ${C} value${C===1?"":"s"} that ${C===1?"is":"are"} neither a number nor null; drawn as gaps.`,itemId:b.id??b.name})}let o=ve(e.format),{width:s,height:a}=Me(e),l=t.filter(b=>!b.hidden),c=l.map(()=>new Array(r).fill(null));for(let b=0;b<r;b++){if(e.ranked){l.forEach((I,O)=>{let G=I.data[b];c[O][b]=K(G)?G:null});continue}l.map((I,O)=>({si:O,v:I.data[b]})).filter(I=>K(I.v)).sort((I,O)=>O.v-I.v||I.si-O.si).forEach((I,O)=>{c[I.si][b]=O+1})}let d=e.topRank??Math.max(1,l.length),u=Array.from({length:r},(b,C)=>{let I=e.categories?.[C];return I===void 0?String(C+1):ft(I,e.xAxis?.format)}),f=e.labels??!0,$=f?Math.max(0,...l.map(b=>b.name.length))*H+12:0,g=vt(s,a,{...Y,top:Y.top+St(e),right:Math.max(Y.right,$),bottom:Y.bottom+(e.xAxis?.label?14:0)}),p=we([.5,d+.5],[g.y,g.y+g.height]),v=mt(r,[g.x,g.x+g.width],0),w=Ce(e,s,a,e.series.map((b,C)=>({name:b.name,color:$e(e,C,b.color)}))),A=Array.from({length:d},(b,C)=>({pos:x(p(C+1)),label:`#${C+1}`})),T=It({...w,plot:g,xTicks:$t(u.map((b,C)=>({pos:x(v.center(C)),label:b})),g.width),yTicks:d>20?A.filter((b,C)=>C%Math.ceil(d/20)===0):A,baseline:g.y+g.height},{xLabel:e.xAxis?.label,grid:e.xAxis?.grid!==!1}),D=e.markerSize??5,se=[],ae=[],le=[],ce=[];return l.forEach((b,C)=>{let I=$e(e,b.index,b.color),O=[],G=[],U;for(let P=0;P<r;P++){let E=c[C][P];if(E==null||E>d||E<1){G.length&&O.push(G),G=[];continue}let de={x:x(v.center(P)),y:x(p(E))};G.push(de),U=de;let dt=b.data[P],ut=`${b.name}, ${u[P]}: #${E}${e.ranked||!K(dt)?"":` (${o(dt)})`}`;ae.push(Tt(de.x,de.y,D,I,ut,{label:ut,id:b.id??b.name,series:b.name,seriesId:b.id??b.name,category:u[P],index:P,value:E}))}G.length&&O.push(G);for(let P of O)se.push({kind:"path",part:"line",d:gt(P,e.curve??"monotone"),stroke:I,strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round",title:b.name,item:{label:b.name,id:b.id??b.name,series:b.name,seriesId:b.id??b.name}});f&&U&&!ce.some(P=>Math.abs(P-U.y)<12)&&(ce.push(U.y),le.push(L(x(U.x+D+4),U.y,b.name,{part:"series-label",baseline:"middle",fill:k.label})))}),{...w,shapes:[...T,...se,...ae,...le,...w.shapes],issues:n}}import{css as rn,html as Z,LitElement as on,nothing as z,svg as R}from"lit";import{property as m,state as N}from"lit/decorators.js";import{ifDefined as M}from"lit/directives/if-defined.js";var ct={fromAttribute:()=>!1},y=class extends on{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=[je(be(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=[Ve(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=Ze(r,i.gantt,o-i.x),this.overlay=[Ee(r,i.gantt,i.change)];return}if(i?.grab==="map"){if(!r.map||!i.view)return;let{x:o,y:s}=this.viewBox(t,r);this.setView(Ke(r.map,i.view,o-i.x,s-i.y));return}if(i&&r.hit){if(i.grab==="pinch"){let[s,a]=[...this.pointers.values()];if(s===void 0||a===void 0||!i.distance)return;this.setZoom(Qe(r.hit,i.zoom,Math.abs(s-a)/i.distance,(s+a)/2));return}let{x:o}=this.viewBox(t,r);this.setZoom(i.grab==="pan"?Je(r.hit,i.zoom,o-i.x):tt(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:s}=Ne(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=De(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(Ge(r,t.target)),this.syncId&&r.hit?.crosshair){let o=re(r,this.viewBox(t,r).x);this.shareCrosshair(o?r.hit.rows[o.index]?.[0]??null:null)}};this.onPointerDown=t=>{let r=this.layout;if(!r||t.button!==0)return;let{x:i,y:o}=this.viewBox(t,r),s=_(r,t.target)?.item.legend,a=this.canEdit(r)?_e(r,i,o):void 0;if(a){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"edit",gantt:a},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.brushing()&&!s){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:this.selectionMode==="lasso"?"lasso":"select",points:[{x:i,y:o}]},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.canPan(r)&&r.map){let c=r.map.plot;if(i<c.x||i>c.x+c.width||o<c.y||o>c.y+c.height)return;this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"map",view:r.map.view},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}let l=r.hit;if(!(!l||!this.canZoom(r))){if(this.pointers.set(t.pointerId,i),this.pointers.size===2){let[c,d]=[...this.pointers.values()];this.drag={x:(c+d)/2,y:o,zoom:l.zoom,grab:"pinch",distance:Math.abs(c-d)||1}}else{let c=et(l,i,o);if(c)this.drag={x:i,y:o,zoom:c.zoom,grab:c.grab},c.zoom!==l.zoom&&this.setZoom(c.zoom);else if(this.zoomable&&i>=l.plot.x&&i<=l.plot.x+l.plot.width&&o>=l.plot.y&&o<=l.plot.y+l.plot.height)this.drag={x:i,y:o,zoom:l.zoom,grab:"pan"};else{this.pointers.delete(t.pointerId);return}}t.currentTarget.setPointerCapture(t.pointerId),this.clearTip()}};this.onPointerUp=t=>{this.pointers.delete(t.pointerId);let r=t.currentTarget;r.hasPointerCapture(t.pointerId)&&r.releasePointerCapture(t.pointerId);let i=this.drag,o=this.layout;if(o&&(i?.grab==="select"||i?.grab==="lasso"||i?.grab==="edit"||i?.grab==="map")){this.overlay=[];let{x:s,y:a}=this.viewBox(t,o);if(Math.abs(s-i.x)>2||Math.abs(a-i.y)>2){i.grab==="select"?this.setSelected(Fe(o,be(i.x,i.y,s,a))):i.grab==="lasso"?this.setSelected(He(o,i.points??[])):i.grab==="edit"&&i.change&&this.emit("skdx-task-change",i.change),this.drag={...i,distance:-1};return}this.drag=null;return}(this.pointers.size===0||this.drag?.grab==="pinch")&&(this.drag=null)};this.onWheel=t=>{let r=this.layout;if(!r)return;let{x:i,y:o}=this.viewBox(t,r);if(r.map&&this.canPan(r)){let l=r.map.plot;if(i<l.x||i>l.x+l.width||o<l.y||o>l.y+l.height)return;t.preventDefault(),this.setView(Ue(r.map,t.deltaY,i,o));return}let s=r.hit;if(!s||!this.canZoom(r)||o<s.plot.y||o>s.plot.y+s.plot.height)return;let a=Xe(s,t.deltaY,i);a&&(t.preventDefault(),this.setZoom(a))};this.onClick=t=>{if(!this.layout)return;if(this.drag?.distance===-1){this.drag=null;return}let r=_(this.layout,t.target);r&&(r.item.range?this.setZoom(r.item.range):r.item.legend&&r.item.series!==void 0?this.toggle(r.item.series):(this.select(r.item),this.emit("skdx-item-click",r.item)))};this.onKeyDown=t=>{let r=this.layout;if(!r)return;if((t.key==="Enter"||t.key===" ")&&this.focused!==null){let a=r.shapes[this.focused]?.item;a&&(t.preventDefault(),this.select(a),this.emit("skdx-item-click",a));return}let i=this.canEdit(r)?We(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=qe(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?V(s):null)}}connectedCallback(){super.connectedCallback(),!(typeof ResizeObserver>"u")&&(this.observer=new ResizeObserver(([t])=>{let r=Math.floor(t?.contentRect.width??0);r>0&&(this.measured=r)}),this.observer.observe(this))}disconnectedCallback(){this.observer?.disconnect(),this.leave?.(),this.leave=void 0,this.joined=void 0,super.disconnectedCallback()}sized(){let{width:t,height:r,legend:i,tooltip:o,format:s,palette:a,loading:l,error:c,emptyMessage:d,description:u,decorative:f,animated:$,responsive:g,highlighted:p,highlightScope:v,accessibleTable:w}=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:$,responsive:g,legend:i,tooltip:o,format:s,palette:a,loading:l,error:c,emptyMessage:d,description:u,decorative:f,highlighted:p===void 0?this.highlightState:p,highlightScope:v,accessibleTable:w,hiddenSeries:this.hiddenSeries??this.hiddenState,zoom:this.zoom??this.zoomState,selected:this.selected??this.selectedState,view:this.view??this.viewState}}emit(t,r){this.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0}))}publish(t){this.syncId&&xe(this.syncId).publish(t,this.token)}join(){if(this.joined===this.syncId||(this.leave?.(),this.leave=void 0,this.joined=this.syncId,!this.syncId))return;let t=xe(this.syncId),r=i=>{"highlighted"in i&&(this.highlightState=i.highlighted??null),i.selected&&(this.selectedState=i.selected,this.crossFilter&&(this.highlightState=i.selected.length?i.selected:null)),"zoom"in i&&(this.zoomState=i.zoom),i.hiddenSeries&&(this.hiddenState=i.hiddenSeries),"crosshair"in i&&(this.crossState=i.crosshair??null)};r(t.current),this.leave=t.subscribe((i,o)=>{o!==this.token&&r(i)})}setZoom(t){this.zoomState=t,this.emit("skdx-zoom-change",t),this.publish({zoom:t})}setView(t){this.viewState=t,this.emit("skdx-view-change",t)}setSelected(t){this.selectedState=t,this.emit("skdx-selected-change",t),this.publish({selected:t})}toggle(t){let r=this.hiddenSeries??this.hiddenState,i=r.includes(t)?r.filter(o=>o!==t):[...r,t];this.hiddenState=i,this.emit("skdx-hidden-series-change",i),this.publish({hiddenSeries:i})}highlight(t){let r=this.hover;r===t||r&&t&&ze(r,t)||(this.hover=t,this.emit("skdx-highlighted-change",t),this.syncId&&(this.highlightState=t,this.publish({highlighted:t})))}select(t){let r=this.selectionMode;r!=="none"&&this.setSelected(Ae(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 Q(t.currentTarget,t.clientX,t.clientY,r.width,r.height)}getSvgElement(){return this.renderRoot.querySelector("svg")}getLayout(){return this.layout}resetZoom(){this.setZoom(void 0)}zoomTo(t){this.setZoom(t)}focusItem(t){let r=this.layout;if(!r)return!1;let i=r.shapes.findIndex(o=>o.item&&!o.item.legend&&F(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?rt(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=Oe(Ie(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let w of o.issues??[])this.emit("skdx-data-issue",w)}let s=this.canZoom(o),a=this.canPan(o),l=this.canEdit(o),c=this.brushing(),d=s||a||l||c,u=!o.decorative&&ge(o).length>0,f=o.description?`${r}-desc`:void 0,$=at(o),g=it(o,this.accessibleTable),p=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,v=this.portal;return Z`<svg
|
|
3
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
4
|
+
viewBox="0 0 ${o.width} ${o.height}"
|
|
5
|
+
width=${o.width}
|
|
6
|
+
height=${o.height}
|
|
7
|
+
role=${o.decorative?"presentation":"img"}
|
|
8
|
+
aria-hidden=${o.decorative?"true":z}
|
|
9
|
+
aria-label=${o.decorative?z:i}
|
|
10
|
+
aria-describedby=${M(f)}
|
|
11
|
+
tabindex=${u?0:z}
|
|
12
|
+
data-skdx-chart=${r}
|
|
13
|
+
data-zoomable=${s||a?"":z}
|
|
14
|
+
data-brushing=${c&&!(s||a)?"":z}
|
|
15
|
+
data-editable=${l?"":z}
|
|
16
|
+
style=${$?`--skdx-chart-duration:${$}`:z}
|
|
17
|
+
font-family=${k.fontFamily}
|
|
18
|
+
font-size=${k.fontSize}
|
|
19
|
+
@pointermove=${o.tooltip||d?this.onPointerMove:z}
|
|
20
|
+
@pointerleave=${()=>{this.clearTip(),this.highlight(null)}}
|
|
21
|
+
@pointerdown=${d?this.onPointerDown:z}
|
|
22
|
+
@pointerup=${d?this.onPointerUp:z}
|
|
23
|
+
@pointercancel=${d?this.onPointerUp:z}
|
|
24
|
+
@wheel=${s||a?this.onWheel:z}
|
|
25
|
+
@dblclick=${s||a?()=>a?this.setView(void 0):this.setZoom(void 0):z}
|
|
26
|
+
@click=${this.onClick}
|
|
27
|
+
@keydown=${u?this.onKeyDown:z}
|
|
28
|
+
@blur=${()=>{this.focused=null,this.highlight(null)}}
|
|
29
|
+
>
|
|
30
|
+
<title>${i}</title>
|
|
31
|
+
${o.description?R`<desc id=${M(f)}>${o.description}</desc>`:z}
|
|
32
|
+
${$?R`<style>${st}</style>`:z} ${sn(o)}
|
|
33
|
+
${ye(o.shapes)}
|
|
34
|
+
${ye(this.tip.length||!this.crossState?this.tip:Be(o,this.crossState))}
|
|
35
|
+
${ye(Ye(o,this.focused))} ${ye(this.overlay)}
|
|
36
|
+
</svg>
|
|
37
|
+
${v?Z`<div
|
|
38
|
+
role="tooltip"
|
|
39
|
+
data-skdx-tooltip=${r}
|
|
40
|
+
style="left:${v.x+12}px;top:${v.y+12}px"
|
|
41
|
+
>
|
|
42
|
+
${v.lines.map(w=>Z`<div>${w}</div>`)}
|
|
43
|
+
</div>`:z}
|
|
44
|
+
${g?Z`<table data-skdx-table=${r}>
|
|
45
|
+
<caption>
|
|
46
|
+
${p}
|
|
47
|
+
</caption>
|
|
48
|
+
<thead>
|
|
49
|
+
<tr>
|
|
50
|
+
${(g[0]??[]).map(w=>Z`<th scope="col">${w}</th>`)}
|
|
51
|
+
</tr>
|
|
52
|
+
</thead>
|
|
53
|
+
<tbody>
|
|
54
|
+
${g.slice(1).map(w=>Z`<tr>
|
|
55
|
+
${w.map((A,T)=>T===0?Z`<th scope="row">${A}</th>`:Z`<td>${A}</td>`)}
|
|
56
|
+
</tr>`)}
|
|
57
|
+
</tbody>
|
|
58
|
+
</table>`:z}`}};y.styles=rn`
|
|
59
|
+
:host {
|
|
60
|
+
display: inline-block;
|
|
61
|
+
}
|
|
62
|
+
svg {
|
|
63
|
+
display: block;
|
|
64
|
+
max-width: 100%;
|
|
65
|
+
height: auto;
|
|
66
|
+
outline: none;
|
|
67
|
+
}
|
|
68
|
+
svg[data-zoomable] {
|
|
69
|
+
cursor: grab;
|
|
70
|
+
touch-action: none;
|
|
71
|
+
}
|
|
72
|
+
svg[data-brushing] {
|
|
73
|
+
cursor: crosshair;
|
|
74
|
+
touch-action: none;
|
|
75
|
+
}
|
|
76
|
+
svg[data-editable] {
|
|
77
|
+
touch-action: none;
|
|
78
|
+
}
|
|
79
|
+
:host([responsive]) {
|
|
80
|
+
display: block;
|
|
81
|
+
}
|
|
82
|
+
table {
|
|
83
|
+
position: absolute;
|
|
84
|
+
width: 1px;
|
|
85
|
+
height: 1px;
|
|
86
|
+
margin: -1px;
|
|
87
|
+
padding: 0;
|
|
88
|
+
overflow: hidden;
|
|
89
|
+
clip: rect(0 0 0 0);
|
|
90
|
+
white-space: nowrap;
|
|
91
|
+
border: 0;
|
|
92
|
+
}
|
|
93
|
+
[role='tooltip'] {
|
|
94
|
+
position: fixed;
|
|
95
|
+
pointer-events: none;
|
|
96
|
+
z-index: 1000;
|
|
97
|
+
background: var(--skdx-color-surface-raised);
|
|
98
|
+
color: var(--skdx-color-text-default);
|
|
99
|
+
border: 1px solid var(--skdx-color-border-strong);
|
|
100
|
+
border-radius: 3px;
|
|
101
|
+
padding: 4px 8px;
|
|
102
|
+
font-family: var(--skdx-font-family);
|
|
103
|
+
font-size: var(--skdx-font-size-xs);
|
|
104
|
+
white-space: nowrap;
|
|
105
|
+
}
|
|
106
|
+
[role='tooltip'] > :first-child:not(:only-child) {
|
|
107
|
+
font-weight: bold;
|
|
108
|
+
}
|
|
109
|
+
`,h([m({type:Number})],y.prototype,"width",2),h([m({type:Number})],y.prototype,"height",2),h([m()],y.prototype,"label",2),h([m({type:Boolean,reflect:!0})],y.prototype,"legend",2),h([m({type:Boolean,attribute:"no-tooltip",converter:ct})],y.prototype,"tooltip",2),h([m({attribute:!1})],y.prototype,"format",2),h([m({attribute:!1})],y.prototype,"palette",2),h([m({attribute:!1})],y.prototype,"hiddenSeries",2),h([m({attribute:!1})],y.prototype,"selected",2),h([m({attribute:"selection-mode"})],y.prototype,"selectionMode",2),h([m({attribute:!1})],y.prototype,"highlighted",2),h([m({attribute:!1})],y.prototype,"highlightScope",2),h([m({type:Boolean,reflect:!0})],y.prototype,"loading",2),h([m()],y.prototype,"error",2),h([m({attribute:"empty-message"})],y.prototype,"emptyMessage",2),h([m()],y.prototype,"description",2),h([m({type:Boolean,reflect:!0})],y.prototype,"decorative",2),h([m({type:Boolean,attribute:"accessible-table"})],y.prototype,"accessibleTable",2),h([m({attribute:!1})],y.prototype,"zoom",2),h([m({attribute:!1})],y.prototype,"view",2),h([m({type:Boolean,reflect:!0})],y.prototype,"zoomable",2),h([m({type:Boolean,reflect:!0})],y.prototype,"editable",2),h([m({attribute:"sync-id"})],y.prototype,"syncId",2),h([m({type:Boolean,attribute:"cross-filter"})],y.prototype,"crossFilter",2),h([m({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],y.prototype,"animated",2),h([m({type:Boolean,reflect:!0})],y.prototype,"responsive",2),h([N()],y.prototype,"tip",2),h([N()],y.prototype,"overlay",2),h([N()],y.prototype,"portal",2),h([N()],y.prototype,"measured",2),h([N()],y.prototype,"viewState",2),h([N()],y.prototype,"highlightState",2),h([N()],y.prototype,"crossState",2),h([N()],y.prototype,"focused",2),h([N()],y.prototype,"hiddenState",2),h([N()],y.prototype,"zoomState",2),h([N()],y.prototype,"selectedState",2);var S=class extends y{constructor(){super(...arguments);this.series=[];this.labels=!1;this.connectNulls=!1;this.stacked=!1;this.brush=!1;this.crosshair=!1}input(){let{series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:a,annotations:l,labels:c,curve:d,connectNulls:u,nulls:f,stacked:$,stackOffset:g,orientation:p,radius:v,barGap:w,barWidth:A,sort:T,transform:D,transforms:se,bins:ae,binWidth:le,binDomain:ce,binMode:b,sampling:C,brush:I,crosshair:O}=this;return{...this.sized(),series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:a,annotations:l,labels:c,curve:d,connectNulls:u,nulls:f,stacked:$,stackOffset:g,orientation:p,radius:v,barGap:w,barWidth:A,sort:T,transform:D,transforms:se,bins:ae,binWidth:le,binDomain:ce,binMode:b,sampling:C,brush:I,crosshair:O}}};h([m({attribute:!1})],S.prototype,"series",2),h([m({attribute:!1})],S.prototype,"categories",2),h([m({attribute:!1})],S.prototype,"xAxis",2),h([m({attribute:!1})],S.prototype,"yAxis",2),h([m({attribute:!1})],S.prototype,"rightAxis",2),h([m({attribute:!1})],S.prototype,"references",2),h([m({attribute:!1})],S.prototype,"annotations",2),h([m({type:Boolean,reflect:!0})],S.prototype,"labels",2),h([m()],S.prototype,"curve",2),h([m({type:Boolean,attribute:"connect-nulls"})],S.prototype,"connectNulls",2),h([m()],S.prototype,"nulls",2),h([m({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],S.prototype,"stacked",2),h([m({attribute:"stack-offset"})],S.prototype,"stackOffset",2),h([m()],S.prototype,"orientation",2),h([m({type:Number})],S.prototype,"radius",2),h([m({type:Number,attribute:"bar-gap"})],S.prototype,"barGap",2),h([m({type:Number,attribute:"bar-width"})],S.prototype,"barWidth",2),h([m()],S.prototype,"sort",2),h([m()],S.prototype,"transform",2),h([m({attribute:!1})],S.prototype,"transforms",2),h([m({type:Number})],S.prototype,"bins",2),h([m({type:Number,attribute:"bin-width"})],S.prototype,"binWidth",2),h([m({attribute:!1})],S.prototype,"binDomain",2),h([m({attribute:"bin-mode"})],S.prototype,"binMode",2),h([m({attribute:!1})],S.prototype,"sampling",2),h([m({type:Boolean,reflect:!0})],S.prototype,"brush",2),h([m({type:Boolean,reflect:!0})],S.prototype,"crosshair",2);var sn=e=>e.defs&&e.defs.length?R`<defs>${e.defs.map(n=>R`<linearGradient id=${n.id} x1="0" y1="0" x2=${n.vertical===!1?1:0} y2=${n.vertical===!1?0:1}>${n.stops.map(t=>R`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${M(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:z,ye=e=>R`${e.map((n,t)=>{let r=n.title?R`<title>${n.title}</title>`:z,i=n.item?t:void 0;switch(n.kind){case"path":return R`<path data-skdx-part=${n.part} data-skdx-i=${M(i)} d=${n.d} fill=${n.fill??"none"} stroke=${M(n.stroke)} stroke-width=${M(n.strokeWidth)} stroke-linecap=${M(n.strokeLinecap)} stroke-linejoin=${M(n.strokeLinejoin)} stroke-dasharray=${M(n.dash)} opacity=${M(n.opacity)} fill-opacity=${M(n.fillOpacity)}>${r}</path>`;case"rect":return R`<rect data-skdx-part=${n.part} data-skdx-i=${M(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${M(n.rx)} fill=${n.fill} stroke=${M(n.stroke)} fill-opacity=${M(n.opacity)}>${r}</rect>`;case"line":return R`<line data-skdx-part=${n.part} data-skdx-i=${M(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${M(n.strokeWidth)} stroke-dasharray=${M(n.dash)} opacity=${M(n.opacity)}>${r}</line>`;case"circle":return R`<circle data-skdx-part=${n.part} data-skdx-i=${M(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${M(n.stroke)} opacity=${M(n.opacity)}>${r}</circle>`;case"text":return R`<text data-skdx-part=${n.part} data-skdx-i=${M(i)} x=${n.x} y=${n.y} text-anchor=${M(n.anchor)} dominant-baseline=${M(n.baseline)} fill=${M(n.fill)} font-weight=${M(n.weight)} pointer-events=${M(i===void 0?"none":void 0)} transform=${M(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var B=class extends y{constructor(){super(...arguments);this.series=[];this.ranked=!1;this.labels=!0}render(){let{series:t,categories:r,ranked:i,topRank:o,curve:s,labels:a,markerSize:l,xAxis:c}=this;return this.root(lt({...this.sized(),series:t,categories:r,ranked:i,topRank:o,curve:s,labels:a,markerSize:l,xAxis:c}),"bump",this.label??"Bump chart")}};h([W({attribute:!1})],B.prototype,"series",2),h([W({attribute:!1})],B.prototype,"categories",2),h([W({type:Boolean,reflect:!0})],B.prototype,"ranked",2),h([W({type:Number,attribute:"top-rank"})],B.prototype,"topRank",2),h([W()],B.prototype,"curve",2),h([W({type:Boolean,attribute:"no-labels",converter:ct})],B.prototype,"labels",2),h([W({type:Number,attribute:"marker-size"})],B.prototype,"markerSize",2),h([W({attribute:!1})],B.prototype,"xAxis",2),B=h([an("skdx-bump-chart")],B);export{B as SkdxBumpChart};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";var ve=Object.defineProperty;var zt=Object.getOwnPropertyDescriptor;var yn=Object.getOwnPropertyNames;var vn=Object.prototype.hasOwnProperty;var wn=(e,n)=>{for(var t in n)ve(e,t,{get:n[t],enumerable:!0})},kn=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of yn(n))!vn.call(e,i)&&i!==t&&ve(e,i,{get:()=>n[i],enumerable:!(r=zt(n,i))||r.enumerable});return e};var Mn=e=>kn(ve({},"__esModule",{value:!0}),e),x=(e,n,t,r)=>{for(var i=r>1?void 0:r?zt(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&&ve(n,t,i),i};var Zn={};wn(Zn,{SkdxCandlestickChart:()=>F});module.exports=Mn(Zn);var _=require("lit/decorators.js");var Ot=e=>Number(e.toPrecision(12)),$n,At=e=>($n??($n=new Intl.NumberFormat)).format(Ot(e)),Sn=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 ne(e){if(e===void 0)return At;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:i="",timeZone:o}=e,a=d=>i?h=>d(h)+i:d,s=d=>r===void 0?d===void 0?{}:{maximumFractionDigits:d}:{minimumFractionDigits:r,maximumFractionDigits:r},l=d=>{let h=new Intl.NumberFormat(t,d);return a(m=>h.format(Ot(m)))},c=d=>{let h=new Intl.DateTimeFormat(t,o?{...d,timeZone:o}:d);return m=>h.format(m)};switch(n){case"integer":return l({maximumFractionDigits:0});case"decimal":return l(s(2));case"percent":return l({style:"percent",...s(0)});case"currency":return l({style:"currency",currency:e.currency??"USD",...s()});case"compact":return l({notation:"compact",...s(1)});case"scientific":return l({notation:"scientific",...s(2)});case"date":return c({dateStyle:"medium"});case"time":return c({timeStyle:"short"});case"datetime":return c({dateStyle:"medium",timeStyle:"short"});case"duration":return a(Sn)}}function Pe(e,n){if(typeof e=="string")return e;let t=e instanceof Date?e.getTime():e;return n?ne(n)(t):e instanceof Date?new Intl.DateTimeFormat().format(e):At(t)}var we=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 re([e,n],[t,r]){let i=n-e;return o=>i===0?t:t+(o-e)/i*(r-t)}function ke(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,s=Math.floor(e/a)*a,l=Math.ceil(n/a)*a,c=[];for(let d=s;d<=l+a/2;d+=a)c.push(Bt(d));return c}function Lt(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 Bt=e=>Number(e.toPrecision(12)),p=e=>Number(e.toFixed(2)),G=e=>typeof e=="number"&&Number.isFinite(e);function ie(e){let n=1/0,t=-1/0;for(let r of e)G(r)&&(r<n&&(n=r),r>t&&(t=r));return n===1/0?[0,0]:[n,t]}function Ve(e,n="linear"){if(e.length===0)return"";let t=e[0];if(n==="step"||n==="stepBefore"||n==="stepAfter"){let c=`M${t.x} ${t.y}`;for(let d=1;d<e.length;d++){let h=e[d-1],m=e[d];n==="stepAfter"?c+=`H${m.x}V${m.y}`:n==="stepBefore"?c+=`V${m.y}H${m.x}`:c+=`H${p((h.x+m.x)/2)}V${m.y}H${m.x}`}return c}if(n==="linear"||e.length<3)return`M${e.map(c=>`${c.x} ${c.y}`).join("L")}`;let r=e.length,i=e.slice(1).map((c,d)=>c.x-e[d].x),o=e.slice(1).map((c,d)=>c.y-e[d].y),a=i.map((c,d)=>c===0?0:o[d]/c),s=[a[0]];for(let c=1;c<r-1;c++){let d=a[c-1],h=a[c];s.push(d*h<=0?0:(d+h)/2)}s.push(a[r-2]);for(let c=0;c<r-1;c++){let d=a[c];if(d===0){s[c]=0,s[c+1]=0;continue}let h=s[c]/d,m=s[c+1]/d,w=Math.hypot(h,m);w>3&&(s[c]=3*h*d/w,s[c+1]=3*m*d/w)}let l=`M${t.x} ${t.y}`;for(let c=0;c<r-1;c++){let d=e[c],h=e[c+1],m=i[c]/3;l+=`C${p(d.x+m)} ${p(d.y+m*s[c])} ${p(h.x-m)} ${p(h.y-m*s[c+1])} ${h.x} ${h.y}`}return l}var ue=1e3,de=60*ue,he=60*de,pe=24*he,Cn=[ue,5*ue,15*ue,30*ue,de,5*de,15*de,30*de,he,3*he,6*he,12*he,pe,2*pe,7*pe,14*pe];function Rt(e,n,t=6){if(!(n>e))return[e];let r=n-e,i=Cn.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*pe),s=[1,2,3,6,12,24,60,120].find(h=>a/h<=t)??240,l=new Date(e),c=l.getUTCFullYear(),d=Math.ceil((l.getUTCMonth()+(l.getUTCDate()>1?1:0))/s)*s;for(let h=Date.UTC(c,d,1);h<=n;)o.push(h),d+=s,d>=12&&(c+=Math.floor(d/12),d%=12),h=Date.UTC(c,d,1);return o.length?o:[e,n]}function Pt(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 s of i)o.push(Bt(s*10**a));return o.filter(a=>a>=e/1.0001&&a<=n*1.0001)}var In=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,Tn=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,zn={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function On(e,n,t){return e.replace(Tn,(r,i,o)=>{let a=zn[i];if(a===void 0)return i+o;let l=(o.match(In)??[]).map((c,d)=>{let h=Number(c);if(a===-1)return String(h+n);if(a===-2)return String(h+t);let m=d%a;return a===7?m===5?String(h+n):m===6?String(h+t):c:String(m%2===0?h+n:h+t)});return i+l.join(" ")})}var Vt=(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:On(r.d,n,t)}}});var Ne=["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)"))),$={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)"},oe=(e="neutral")=>e==="neutral"?$.axis:`var(--skdx-color-${e}-500)`,De=(e="neutral")=>e==="neutral"?$.label:e==="primary"?"var(--skdx-color-text-accent)":`var(--skdx-color-text-${e})`,Nt=(e,n)=>n??Ne[e%Ne.length];var fe={top:16,right:16,bottom:32,left:48};function Dt(e,n,t=fe){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 me(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function Fe(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var Gt=e=>e.crosshair===!0||Fe(e).trigger==="axis",Me=20,An=120,Ft=e=>{let n=me(e);return n&&(n.position==="left"||n.position==="right")?n.width??An:0},He=(e,n=600,t=300)=>({width:(e.width??n)-Ft(e),height:(e.height??t)-(me(e)?.position==="bottom"?Me:0)}),Ht=e=>{let n=me(e);return n&&(n.position===void 0||n.position==="top")?Me:0},ae=6.5,jt=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:Nt(n)),_t=(e,n)=>e.hiddenSeries?.includes(n)??!1;function Ge(e,n,t=[],r={},i=10,o=8,a=!1){let s=[],l=r.maxItems,c=l!==void 0&&l>=0&&e.length>l?e.slice(0,l):e,d=e.length-c.length,h=r.interactive??!0,m=o,w=i,y=(f,v,b,I)=>{let C=(v?18:4)+f.length*ae;m>o&&(a||m+C>n-8)&&(m=o,w+=Me),v&&s.push({kind:"rect",part:"legend-swatch",x:m,y:w-5,width:10,height:10,fill:v,opacity:I?.3:void 0,item:b}),s.push({kind:"text",part:"legend-label",x:m+(v?14:0),y:w,text:f,baseline:"middle",fill:I?$.grid:$.label,item:b}),m+=C+12};for(let f of c){let v=t.includes(f.name),b=h?{label:f.name,series:f.name,legend:!0}:void 0;y(r.formatter?.(f.name)??f.name,f.color,b,v)}return d>0&&y(`+${d} more`,void 0,void 0,!1),r.align==="end"?Ln(s,n):s}function Ln(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(s=>s.kind==="rect"?s.x+s.width:s.x+s.text.length*ae)),a=n-8-o;for(let s of i)r.push({...s,x:s.x+a})}return r}var Bn=(e,n,t={})=>new Set(Ge(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function je(e,n,t,r=[]){let i=me(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,a=Fe(e),s=o?.position==="bottom",l=Ft(e),c=e.hiddenSeries??[],d=o?l?Ge(r,1/0,c,o,10,(o.position==="right"?n:0)+8,!0):Ge(r,n,c,o,s?t+10:10):[],h=s?Bn(r,n,o):0;return{width:n+l,height:s?t+Math.max(1,h)*Me:t,legendOffset:o?.position==="left"?l:void 0,tooltip:a.enabled,tooltipFormatter:a.formatter,axisTooltipFormatter:a.axisFormatter,tooltipPortal:a.portal,tooltipPlacement:a.placement,tooltipAnchored:a.followPointer===!1?!0:void 0,description:e.description,decorative:e.decorative,animate:e.animate===!0?300:e.animate||void 0,responsive:!!e.responsive,shapes:d}}function _e(e){let n=e.legendOffset;if(!n)return e;let t=[...Vt(e.shapes.filter(l=>!l.part.startsWith("legend-")),n,0),...e.shapes.filter(l=>l.part.startsWith("legend-"))],r=l=>({...l,x:l.x+n}),i=e.hit?{...e.hit,plot:r(e.hit.plot),xs:e.hit.xs.map(l=>l+n),brush:e.hit.brush?{box:r(e.hit.brush.box),window:r(e.hit.brush.window)}:void 0}:void 0,o=e.edit,a=o?{...o,scale:l=>o.scale(l)+n,invert:l=>o.invert(l-n),bars:o.bars.map(l=>({...l,x0:l.x0+n,x1:l.x1+n}))}:void 0,s=e.map?{...e.map,plot:r(e.map.plot)}:void 0;return{...e,shapes:t,hit:i,edit:a,map:s,legendOffset:void 0}}function $e(e,n,t,r,i,o="auto"){let a=Array.isArray(t)?t:[t],s=Math.max(...a.map(m=>m.length))*ae+12,l=6+a.length*16,c=o==="top"?{x:e-s/2,y:n-l-8}:o==="bottom"?{x:e-s/2,y:n+8}:o==="left"?{x:e-s-8,y:n-l/2}:o==="right"?{x:e+8,y:n-l/2}:{x:e+12,y:n-l-6},d=Math.max(0,Math.min(r-s,c.x)),h=Math.max(0,Math.min(i-l,c.y));return[{kind:"rect",part:"tooltip",x:p(d),y:p(h),width:p(s),height:l,fill:"var(--skdx-color-surface-raised)",stroke:$.axis,rx:3},...a.map((m,w)=>({kind:"text",part:"tooltip-label",x:p(d+6),y:p(h+11+w*16),text:m,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:a.length>1&&w===0?"bold":void 0}))]}function Et(e,n){let[t,r]=ie(e);return n?[Math.min(0,t),Math.max(0,r)]:[t,r]}function Zt([e,n],t,r=!1,i){let o=typeof r=="boolean"?{scale:r?"log":"linear"}:r,a=ne(o.format??i),s=o.min??e,l=o.max??n;o.reversed&&(t=[t[1],t[0]]);let c={id:o.id,position:o.position,options:o};if(o.scale==="sqrt"){let f=N=>Math.sign(N)*Math.sqrt(Math.abs(N)),v=o.nice===!1?[s,l]:ke(s,l,o.ticks),b=o.min??v[0],I=o.max??v[v.length-1],C=re([f(b),f(I)],t),H=N=>C(f(N)),Z=ke(b,I,o.ticks).filter(N=>N>=b-1e-9&&N<=I+1e-9);return{...c,scale:H,domain:[b,I],format:a,ticks:(Z.length>=2?Z:[b,I]).map(N=>({pos:p(H(N)),label:a(N)})),zero:p(H(Math.min(Math.max(0,b),I)))}}if(o.scale==="log"){let f=Math.max(s,Number.EPSILON),v=Math.max(l,f),b=Pt(f,v),I=[Math.log10(f),Math.log10(v)],C=re(I,t),H=Z=>C(Math.log10(Math.max(Z,Number.EPSILON)));return{...c,scale:H,domain:I,format:a,ticks:b.map(Z=>({pos:p(H(Z)),label:a(Z)})),zero:p(t[0])}}let d=ke(s,l,o.ticks),h=[o.min??(o.nice===!1?s:d[0]),o.max??(o.nice===!1?l:d[d.length-1])],m=re(h,t),w=d.filter(f=>f>=h[0]-1e-9&&f<=h[1]+1e-9),y=(w.length>=2?w:[h[0],h[1]]).map(f=>({pos:p(m(f)),label:a(f)}));return{...c,scale:m,domain:h,format:a,ticks:y,zero:p(m(Math.min(Math.max(0,h[0]),h[1])))}}function Wt(e,n){if(e.length<2)return e;let t=e.reduce((i,o)=>Math.max(i,o.label.length),0)*ae+8,r=Math.max(1,Math.ceil(e.length*t/Math.max(1,n)));return r===1?e:e.filter((i,o)=>o%r===0)}function Ut(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}=He(e,t,r),s=i==="error"?e.error:i==="loading"?"Loading\u2026":e.emptyMessage??"No data available",l=[];return i==="loading"&&l.push({kind:"rect",part:"skeleton",x:0,y:0,width:o,height:a,fill:"var(--skdx-color-surface-sunken)",rx:4}),l.push({kind:"text",part:`state-${i}`,x:p(o/2),y:p(a/2),text:s,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":$.label}),{...je(e,o,a),shapes:l,tooltip:!1}}function Kt(e,n={}){let{plot:t,xTicks:r,yTicks:i,baseline:o}=e,a=t.x+t.width,s=t.y+t.height,l=[],c=n.grid??!0,d=(y,f)=>f?{kind:"line",part:"grid",x1:y.pos,x2:y.pos,y1:t.y,y2:s,stroke:$.grid}:{kind:"line",part:"grid",x1:t.x,x2:a,y1:y.pos,y2:y.pos,stroke:$.grid},h=n.x?.tickRotation??0,m=(y,f,v,b)=>h?R(y,f,v,{part:b,anchor:h<0?"end":"start",baseline:"middle",rotate:h}):R(y,f,v,{part:b,anchor:"middle"}),w=(y,f,v,b,I)=>{for(let C of y)l.push(f==="x"?{kind:"line",part:"tick",x1:C.pos,x2:C.pos,y1:v,y2:p(v+b*I),stroke:$.axis}:{kind:"line",part:"tick",x1:v,x2:p(v+b*I),y1:C.pos,y2:C.pos,stroke:$.axis})};if(n.categoryGrid)for(let y of r)l.push(d(y,!n.horizontal));if(n.horizontal){let y=n.axes??[{ticks:i,position:"bottom",offset:0,label:n.yLabel,...n.y}];if(c)for(let f of i)l.push(d(f,!0));y[0]?.showLine!==!1&&l.push({kind:"line",part:"axis",x1:o,x2:o,y1:t.y,y2:s,stroke:$.axis});for(let f of y){let v=f.position==="top"||f.position==="right",b=p(v?t.y-f.offset:s+f.offset),I=v||f.offset>0;f.showLine&&I&&l.push({kind:"line",part:"axis",x1:t.x,x2:a,y1:b,y2:b,stroke:$.axis}),f.showTicks&&w(f.ticks,"x",b,v?-1:1,f.tickSize??4);let C=p(v?b-8:b+20);for(let H of f.ticks)l.push(v?R(H.pos,C,H.label,{part:"x-label-top",anchor:"middle"}):m(H.pos,C,H.label,"x-label"));f.label&&l.push(I?R(4,C,f.label,{part:"axis-title",anchor:"start",baseline:v?void 0:"middle"}):R(4,t.y-6,f.label,{part:"axis-title",anchor:"start"}))}n.x?.showLine&&l.push({kind:"line",part:"axis",x1:n.rtl?a:t.x,x2:n.rtl?a:t.x,y1:t.y,y2:s,stroke:$.axis}),n.x?.showTicks&&w(r,"y",n.rtl?a:t.x,n.rtl?1:-1,n.x.tickSize??4);for(let f of r)l.push(n.rtl?R(a+8,f.pos,f.label,{part:"y-label",anchor:"start",baseline:"middle"}):R(t.x-8,f.pos,f.label,{part:"y-label",anchor:"end",baseline:"middle"}))}else{if(c)for(let f of i)l.push(d(f,!1));n.y?.showLine!==!1&&l.push({kind:"line",part:"axis",x1:t.x,x2:a,y1:o,y2:o,stroke:$.axis});let y=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 f of y){let v=f.position==="left",b=v?t.x-f.offset:a+f.offset,I=v?"y-label":"y-label-right";f.showLine&&l.push({kind:"line",part:"axis",x1:p(b),x2:p(b),y1:t.y,y2:s,stroke:$.axis}),f.showTicks&&w(f.ticks,"y",p(b),v?-1:1,f.tickSize??4);for(let C of f.ticks)l.push(R(p(v?b-8:b+8),C.pos,C.label,{part:I,anchor:v?"end":"start",baseline:"middle"}));f.label&&l.push(R(p(v?f.offset===0?4:Math.max(4,b-40):f.offset===0?e.width-4:Math.min(e.width-4,b+40)),t.y-6,f.label,{part:"axis-title",anchor:v?"start":"end"}))}n.x?.showTicks&&w(r,"x",s,1,n.x.tickSize??4);for(let f of r)l.push(m(f.pos,s+(h?12:20),f.label,"x-label"))}return n.xLabel&&l.push(R(p(t.x+t.width/2),e.height-4,n.xLabel,{part:"axis-title",anchor:"middle"})),n.horizontal&&n.rightLabel&&l.push(R(e.width-4,t.y-6,n.rightLabel,{part:"axis-title",anchor:"end"})),l}var R=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:$.label,...r});function Ee(e,n){let t=[],{plot:r}=n,i=r.x+r.width,o=r.y+r.height,a=l=>Math.max(r.x,Math.min(i,l)),s=l=>Math.max(r.y,Math.min(o,l));for(let l of e??[]){let c=l.color??oe(l.variant),d=l.color??De(l.variant),h={part:"reference-label",fill:d},m=n.horizontal===!0;if("y"in l){let w=p(n.y(l.y,l.axis??"left"));if(m){let y=a(w);t.push(...qt(y,r.y,o,c,l.label,h))}else{let y=s(w);t.push(...Yt(r.x,i,y,c,l.label,h))}}else if("x"in l){let w=n.x(l.x);if(w===void 0)continue;m?t.push(...Yt(r.x,i,s(p(w)),c,l.label,h)):t.push(...qt(a(p(w)),r.y,o,c,l.label,h))}else if("y1"in l){let w=p(n.y(l.y1,l.axis??"left")),y=p(n.y(l.y2,l.axis??"left"));m?t.push(...Qt(a(Math.min(w,y)),a(Math.max(w,y)),r,c,l.label,d)):t.push(...Xt(s(Math.min(w,y)),s(Math.max(w,y)),r,c,l.label,d))}else{let w=n.x(l.x1),y=n.x(l.x2);if(w===void 0||y===void 0)continue;let f=p(Math.min(w,y)),v=p(Math.max(w,y));m?t.push(...Xt(s(f),s(v),r,c,l.label,d)):t.push(...Qt(a(f),a(v),r,c,l.label,d))}}return t}function Yt(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,R(n-4,t-5,i,{...o,anchor:"end"})]:[a]}function qt(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,R(e+4,n+10,i,{...o,anchor:"start"})]:[a]}function Xt(e,n,t,r,i,o){let a={kind:"rect",part:"reference-area",x:t.x,y:e,width:t.width,height:p(Math.max(0,n-e)),fill:r,opacity:.12,title:i};return i?[a,R(t.x+t.width-4,e+12,i,{part:"reference-label",fill:o,anchor:"end"})]:[a]}function Qt(e,n,t,r,i,o){let a={kind:"rect",part:"reference-area",x:e,y:t.y,width:p(Math.max(0,n-e)),height:t.height,fill:r,opacity:.12,title:i};return i?[a,R(e+4,t.y+12,i,{part:"reference-label",fill:o,anchor:"start"})]:[a]}function Jt(e,n){let t=[],{plot:r}=n,i=r.x+r.width,o=r.y+r.height;for(let a of e??[]){let s=a.color??oe(a.variant),l=a.color??De(a.variant),c=(y,f,v)=>{let b=n.x(y);if(b===void 0)return;let I=n.y(f,v??"left");return n.horizontal?{x:p(I),y:p(b)}:{x:p(b),y:p(I)}},d=a.id??a.label,h=y=>({label:y,id:d,name:a.label});if(a.type==="line"||a.type==="band"){let{type:y,id:f,...v}=a;t.push(...Ee([v],n));continue}if(a.type==="rect"){let y=c(a.x1,a.y1,a.axis),f=c(a.x2,a.y2,a.axis);if(!y||!f)continue;let v=Math.max(r.x,Math.min(y.x,f.x)),b=Math.max(r.y,Math.min(y.y,f.y)),I=a.label??"";t.push({kind:"rect",part:"annotation-rect",x:p(v),y:p(b),width:p(Math.max(0,Math.min(i,Math.max(y.x,f.x))-v)),height:p(Math.max(0,Math.min(o,Math.max(y.y,f.y))-b)),fill:s,opacity:.12,stroke:s,title:I||void 0,item:I?h(I):void 0}),a.label&&t.push(R(p(v+4),p(b+12),a.label,{part:"annotation-label",fill:l}));continue}let m=c(a.x,a.y,a.axis);if(!m)continue;if(a.type==="text"){t.push(R(m.x,m.y,a.text,{part:"annotation-text",fill:l,anchor:"middle",baseline:"middle",title:a.label}));continue}let w=a.label??`${String(a.x)}, ${a.y}`;if(t.push({kind:"circle",part:"annotation-point",cx:m.x,cy:m.y,r:5,fill:s,stroke:"var(--skdx-color-surface-default)",title:w,item:h(w)}),a.type==="callout"&&a.label){let[y,f]=a.offset??[16,-16],v=p(Math.max(r.x,Math.min(i,m.x+y))),b=p(Math.max(r.y,Math.min(o,m.y+f)));t.push({kind:"line",part:"annotation-leader",x1:m.x,y1:m.y,x2:v,y2:b,stroke:s},R(v,b,a.label,{part:"annotation-label",fill:l,anchor:y>=0?"start":"end",baseline:"middle"}))}}return t}function en(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 s=e[a];if(!G(s))return null;o+=s}return o/t})}function tn(e,n){let t=Math.max(1,Math.floor(n)),r=2/(t+1),i,o=0,a=0;return e.map(s=>G(s)?i===void 0?(o+=s,a++,a<t?null:(i=o/t,i)):(i=r*s+(1-r)*i,i):i??null)}function Se(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var Ze=e=>e.id??e.name??e.series,nn=e=>e.seriesId??e.series;function K(e,n){let t=!1;return n.id!==void 0&&(t=!0,Ze(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,nn(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 X(e){let n={},t=Ze(e);t!==void 0&&(n.id=t);let r=nn(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var We=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function Ue(e,n,t){let r=Se(e),i=X(n),o=r.some(a=>K(n,a));return t==="single"?o?[]:[i]:o?r.filter(a=>!K(n,a)):[...r,i]}var Rn=.2;function Pn(e){let n=$.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 Vn=(e,n)=>e.kind==="text"?{...e,fill:$.grid}:{...e,opacity:(e.opacity??1)*n};function Ke(e,n){let t=Se(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:Se(n.highlighted),i=r[0];if(t.length===0&&!i)return e;let o={highlighted:n.highlightScope?.highlighted??"item",faded:n.highlightScope?.faded??"global"},a=[],s=d=>!i||r.some(h=>K(d,h))?!0:o.highlighted==="series"?r.some(h=>h.series!==void 0&&K(d,{series:h.series})):!1,l=d=>{if(!i||o.faded==="none"||s(d))return!1;if(o.faded==="series"){let h=i.series;return h!==void 0&&K(d,{series:h})}return!0},c=e.shapes.map(d=>{let h=d.item;if(!h||h.legend)return d;if(t.some(m=>K(h,m))){let m=Pn(d);m&&a.push(m)}return l(h)?Vn(d,Rn):d});return a.length?{...e,shapes:[...c,...a]}:{...e,shapes:c}}function ce(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 Ye=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function rn(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 xe(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=rn(t,n),i=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(i,r)??i}}function qe(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[rn(t,n)];return{kind:"line",part:"crosshair",x1:r,x2:r,y1:t.plot.y,y2:t.plot.y+t.plot.height,stroke:$.axis,dash:"3 3"}}function Xe(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!Ye(r.plot,n,t))return[];let i=qe(e,n),{rows:o}=xe(e,n),a=e.tooltipAnchored?r.plot.y+8:t;return[i,...$e(i.x1,a,o,e.width,e.height,e.tooltipPlacement)]}function Qe(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 Xe(e,i,t.plot.y+8)}function Je(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:l,y:c}=ce(t,r,i,e.width,e.height);if(Ye(e.hit.plot,l,c)){let d=xe(e,l),h=qe(e,l);if(d&&h)return{lines:d.rows,shapes:[h]}}}let o=n?.closest?.("[data-skdx-part]"),a=e.tooltipFormatter?Q(e,n)?.item:void 0,s=a&&e.tooltipFormatter?.(a)||o&&Array.from(o.children).find(l=>l.tagName.toLowerCase()==="title")?.textContent;return s?{lines:Array.isArray(s)?s:[s],shapes:[]}:{lines:[],shapes:[]}}function on(e,n,t,r,i,o,a){let s=e?.closest?.("[data-skdx-part]"),l=a&&a.tooltipFormatter?Q(a,e)?.item:void 0,c=l&&a?.tooltipFormatter?.(l)||s&&Array.from(s.children).find(y=>y.tagName.toLowerCase()==="title")?.textContent;if(!c)return[];let d=a?.tooltipAnchored?Q(a,e):void 0,h=d?a?.shapes[d.index]:void 0,{x:m,y:w}=h?be(h):ce(n,t,r,i,o);return $e(m,w,c,i,o,a?.tooltipPlacement)}function et(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:a}=ce(t,r,i,e.width,e.height),s=Xe(e,o,a);if(s.length>0)return s}return on(n,t,r,i,e.width,e.height,e)}function tt(e,n){let t=Q(e,n);return t&&!t.item.legend?X(t.item):null}var Nn=(e,n)=>{let{x:t,y:r}=be(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 nt(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!Nn(i,n))continue;let o=X(i.item),a=JSON.stringify(o);t.has(a)||(t.add(a),r.push(o))}return r}var rt=e=>({kind:"rect",part:"selection-box",x:p(e.x),y:p(e.y),width:p(e.width),height:p(e.height),fill:$.focus,opacity:.12,stroke:$.focus}),Ie=(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 an(e,n,t){let r=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){let a=e[i],s=e[o];a.y>t!=s.y>t&&n<(s.x-a.x)*(t-a.y)/(s.y-a.y)+a.x&&(r=!r)}return r}function it(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}=be(i),s=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:a;if(!an(n,o,s))continue;let l=X(i.item),c=JSON.stringify(l);t.has(c)||(t.add(c),r.push(l))}return r}var ot=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${p(n.x)} ${p(n.y)}`).join("L")}`:"",fill:$.focus,fillOpacity:.12,stroke:$.focus,dash:"4 3"}),Ce=6;function at(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-Ce||n>i.x1+Ce))return Math.abs(n-i.x0)<=Ce?{bar:i,mode:"start"}:Math.abs(n-i.x1)<=Ce?{bar:i,mode:"end"}:{bar:i,mode:"move"}}}function st(e,n,t){let r=e.edit;return sn(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function lt(e,n,t){let r=e.edit,i=t.key==="ArrowRight"?1:t.key==="ArrowLeft"?-1:0;if(!r||n===null||!i||!(t.shiftKey||t.altKey))return;let o=r.bars.find(l=>l.index===n);if(!o)return;let a=t.altKey?t.shiftKey?"start":"end":"move",s=r.snap??r.invert(o.x0+10)-r.invert(o.x0);return sn(r,{bar:o,mode:a},i*s)}function sn(e,{bar:n,mode:t},r){let i=s=>e.snap?Math.round(s/e.snap)*e.snap:s,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 ct(e,n,t){let r=e.edit,i=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:p(Math.min(i,o)),y:p(n.bar.y),width:p(Math.max(1,Math.abs(o-i))),height:p(n.bar.height),fill:$.focus,opacity:.25,stroke:$.focus,rx:2}}var Dn=64,Gn=e=>Math.max(1,Math.min(Dn,e));function ut(e,n,t,r){let i=n>0?.8:1.25,o=Gn(e.view.zoom*i);if(o===e.view.zoom)return e.view;let{plot:a,scale:s}=e,[l,c]=e.view.center,d=(t-(a.x+a.width/2))/s,h=(r-(a.y+a.height/2))/s,m=e.view.zoom/o;return{center:[l+d*(1-m),e.fromY(e.toY(c)-h*(1-m))],zoom:o}}function dt(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 Q(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 Te=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function be(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 ht(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let r=$.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*ae+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}=be(t),s=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...s?$e(p(o),p(a),s,e.width,e.height):[]]}function pt(e,n,t){let r=Te(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 se=2,le=(e,n,t)=>{let r=Math.max(se,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},ln=(e,n)=>!e||e.start<=0&&e.end>=n;function ft(e,n,t){if(e.count<=se||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,a=n>0?1.25:.8,s=Math.max(se,Math.min(e.count,Math.round(o*a)));if(s===o)return n>0&&!ln(e.zoom,e.count)?le(r,s,e.count):void 0;let l=Math.max(0,Math.min(1,(t-e.plot.x)/e.plot.width)),c=r+l*o;return le(c-l*s,s,e.count)}function mt(e,n,t,r){let i=n.end-n.start,o=Math.max(se,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 le(n.start+a*i-a*o,o,e.count)}function xt(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return le(n.start-t/i,r,e.count)}function bt(e,n,t){let r=e.brush;if(!r||!Ye(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:le(a-o/2,o,e.count)}}function gt(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 le(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-se,Math.round(t.start+o))),end:t.end};let a=Math.min(e.count,Math.max(t.start+se,Math.round(t.end+o)));return{start:t.start,end:a}}function vt(e,n){switch(n.type){case"svg":return Promise.resolve(yt(e,n.label,n.resolve));case"csv":return Promise.resolve(hn(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=yt(e,n.label,n.resolve);return dn(t,e.width,e.height,n.scale,n.background)}}}var Y=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/"/g,"""),ge=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${Y(String(t))}"`).join("");function cn(e){let n=e.title?`<title>${Y(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${ge([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${ge([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${ge([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${ge([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${ge([t,["x",e.x],["y",e.y],["text-anchor",e.anchor],["dominant-baseline",e.baseline],["fill",e.fill],["font-weight",e.weight],["transform",e.rotate?`rotate(${e.rotate} ${e.x} ${e.y})`:void 0]])}>${Y(e.text)}</text>`}}function un(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${Y(t.id)}" x1="0" y1="0" x2="${t.vertical===!1?1:0}" y2="${t.vertical===!1?0:1}">${t.stops.map(r=>`<stop offset="${r.offset}" stop-color="${Y(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function yt(e,n,t){let r=un(e)+e.shapes.map(cn).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="${Y(n)}" font-family="${Y($.fontFamily)}" font-size="${Y($.fontSize)}"><title>${Y(n)}</title>${r}</svg>`}function dn(e,n,t,r=2,i){return new Promise((o,a)=>{let s=URL.createObjectURL(new Blob([e],{type:"image/svg+xml;charset=utf-8"})),l=new Image;l.onload=()=>{URL.revokeObjectURL(s);let c=document.createElement("canvas");c.width=Math.round(n*r),c.height=Math.round(t*r);let d=c.getContext("2d");if(!d)return a(new Error("canvas 2d context unavailable"));i&&(d.fillStyle=i,d.fillRect(0,0,c.width,c.height)),d.drawImage(l,0,0,c.width,c.height),c.toBlob(h=>h?o(h):a(new Error("toBlob failed")),"image/png")},l.onerror=()=>{URL.revokeObjectURL(s),a(new Error("svg could not be decoded"))},l.src=s})}function hn(e){let n=t=>{let r=t==null?"":String(t);return/[",\n\r]/.test(r)?`"${r.replace(/"/g,'""')}"`:r};return e.map(t=>t.map(n).join(",")).join(`\r
|
|
2
|
+
`)}function wt(e,n){if(!n)return;let t=typeof n=="object"?n.maxRows??500:500,r=e.hit;if(r&&r.rows.length>0){let s=r.rows[0];if(r.rows.length>t)return;let l=["",...s.slice(1).map(d=>d.replace(/:\s[^:]*$/,""))],c=r.rows.map(d=>[d[0],...d.slice(1).map(h=>h.slice(h.lastIndexOf(": ")+2))]);return[l,...c]}let i=e.shapes.flatMap(s=>s.item&&!s.item.legend&&!(s.part==="anchor"&&!s.title)?[s.item]:[]);if(i.length===0||i.length>t)return;let o=["series","name","category","value"].filter(s=>i.some(l=>l[s]!==void 0)),a=(s,l)=>s[l]===void 0?"":String(s[l]);return[o.map(s=>s[0]?.toUpperCase()+s.slice(1)),...i.map(s=>o.map(l=>a(s,l)))]}var kt=new Map;function ze(e){let n=kt.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&&kt.delete(e)}},publish(o,a){Object.assign(r,o);for(let s of t)s(o,a)}};return kt.set(e,{group:i,listeners:t}),i}var pn='[data-skdx-part]:not([data-skdx-part^="tooltip"]):not([data-skdx-part="focus"]):not([data-skdx-part="crosshair"])',Mt=`@keyframes skdx-in{from{opacity:0}to{opacity:1}}${pn}{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){${pn}{animation:none;transition:none}}`;function $t(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}var Fn=.22,Hn=20,fn=32,mn=28,jn=e=>G(e.open)&&G(e.high)&&G(e.low)&&G(e.close);function St(e){let n=[],t=e.data.filter(u=>jn(u)?!0:(n.push({code:"invalid-value",severity:"warning",message:`Candle "${String(u.label)}" has a non-finite open/high/low/close and was dropped.`,itemId:u.id}),!1)),r=Ut(e,t.length===0);if(r)return{...r,issues:n};let i=e.upColor??$.positive,o=e.downColor??$.negative,a=ne(e.format),s=t.length,l=Math.max(0,Math.min(s-2,Math.floor(e.zoom?.start??0))),c=e.zoom?Math.max(l+2,Math.min(s,Math.ceil(e.zoom.end))):s,d={start:l,end:c},h=t.slice(l,c),m=t.some(u=>G(u.volume)),{width:w,height:y}=He(e),f=e.brush?fn+mn:0,v=e.rangeSelector??[],b=Dt(w,y,{...fe,top:fe.top+Ht(e)+(v.length?Hn:0),bottom:fe.bottom+f}),I=e.compare?h[0].close:void 0,C=u=>I!==void 0&&I!==0?u/I-1:u,H=I!==void 0?{style:"percent",digits:1}:void 0,Z=ne({style:"percent",digits:1}),N=m?b.height*Fn:0,P={...b,height:Math.max(0,b.height-N-(m?8:0))},ye=t.map(u=>u.close),te=(e.overlays??[]).map((u,k)=>{let T=u.name??`${u.type.toUpperCase()} ${u.period}`,A=u.type==="ema"?tn(ye,u.period):en(ye,u.period);return{name:T,color:u.color??jt(e,k+2),values:A.slice(l,c),hidden:_t(e,T)}}),D=Zt(Et([...h.flatMap(u=>[C(u.low),C(u.high)]),...te.filter(u=>!u.hidden).flatMap(u=>u.values.map(k=>G(k)?C(k):k))],!1),[P.y+P.height,P.y],{scale:e.scale==="log"?"log":"linear",format:H},e.format),J=h.map(u=>we(u.label)),Ae=e.xAxis?.type==="time"&&J.every(u=>Number.isFinite(u)),E=Lt(h.length,[P.x,P.x+P.width]),Ct;if(Ae){let u=[...J].sort((B,Re)=>B-Re),k=1/0;for(let B=1;B<u.length;B++)k=Math.min(k,u[B]-u[B-1]);let[T,A]=ie(J),L=k===1/0?Math.max(1,Math.abs(A)*.05||1):k/2,V=re([T-L,A+L],[P.x,P.x+P.width]),j=Math.abs(V(T+(k===1/0?L:k))-V(T))*.8;E={step:j,bandwidth:j,start:B=>V(J[B])-j/2,center:B=>V(J[B])};let U=e.xAxis?.format??{style:"date"};Ct=Rt(T-L,A+L).filter(B=>B>=T-L&&B<=A+L).map(B=>({pos:p(V(B)),label:Pe(B,U)}))}let ee=h.map(u=>Pe(u.label,e.xAxis?.format)),xn=[{name:"Up",color:i},{name:"Down",color:o},...te.map(u=>({name:u.name,color:u.color}))],Le=je(e,w,y,xn),bn={...Le,plot:P,xTicks:Wt(Ct??h.map((u,k)=>({pos:p(E.center(k)),label:ee[k]})),P.width),yTicks:D.ticks,baseline:P.y+P.height},W=Kt(bn),Be={plot:P,x:u=>{let k=typeof u=="string"?u:we(u),T=h.findIndex((A,L)=>typeof k=="string"?ee[L]===k||A.label===k:we(A.label)===k);return T<0?void 0:E.center(T)},y:u=>D.scale(C(u))};W.push(...Ee(e.references,Be)),v.forEach((u,k)=>{let T=u.candles>0?{start:Math.max(0,s-u.candles),end:s}:{start:0,end:s},A=T.start===l&&T.end===c;W.push(R(p(P.x+k*40),p(b.y-8),u.label,{part:"range-button",baseline:"middle",fill:A?"var(--skdx-color-text-default)":$.label,weight:A?"bold":void 0,title:`${u.label}: last ${u.candles>0?Math.min(u.candles,s):s} candles`,item:{label:u.label,name:u.label,range:T}}))});let gn=e.variant==="ohlc",It=[];if(h.forEach((u,k)=>{let A=u.close>=u.open?i:o,L=p(E.center(k)),V=I!==void 0?` (${Z(C(u.close))})`:"",j=`${ee[k]}: O ${a(u.open)} H ${a(u.high)} L ${a(u.low)} C ${a(u.close)}${V}${G(u.volume)?` V ${a(u.volume)}`:""}`,U={label:j,id:u.id,category:ee[k],index:l+k,value:u.close};It.push([ee[k],`Open: ${a(u.open)}`,`High: ${a(u.high)}`,`Low: ${a(u.low)}`,`Close: ${a(u.close)}${V}`,...G(u.volume)?[`Volume: ${a(u.volume)}`]:[],...te.filter(q=>!q.hidden).map(q=>`${q.name}: ${G(q.values[k])?a(q.values[k]):"\u2014"}`)]);let B=D.scale(C(Math.max(u.open,u.close))),Re=D.scale(C(Math.min(u.open,u.close)));if(gn){let q=E.bandwidth/2;W.push({kind:"line",part:"wick",x1:L,x2:L,y1:p(D.scale(C(u.high))),y2:p(D.scale(C(u.low))),stroke:A,strokeWidth:1.5,title:j,item:U},{kind:"line",part:"open",x1:p(L-q),x2:L,y1:p(D.scale(C(u.open))),y2:p(D.scale(C(u.open))),stroke:A,strokeWidth:1.5},{kind:"line",part:"close",x1:L,x2:p(L+q),y1:p(D.scale(C(u.close))),y2:p(D.scale(C(u.close))),stroke:A,strokeWidth:1.5})}else W.push({kind:"line",part:"wick",x1:L,x2:L,y1:p(D.scale(C(u.high))),y2:p(D.scale(C(u.low))),stroke:A,title:j},{kind:"rect",part:"candle",x:p(E.start(k)),y:p(B),width:p(E.bandwidth),height:p(Math.max(1,Re-B)),fill:A,title:j,item:U})}),m){let u=P.y+P.height+8,[,k]=ie(h.map(T=>T.volume));h.forEach((T,A)=>{if(!G(T.volume))return;let L=k>0?T.volume/k*N:0;W.push({kind:"rect",part:"volume",x:p(E.start(A)),y:p(u+N-L),width:p(E.bandwidth),height:p(Math.max(L,0)),fill:T.close>=T.open?i:o,opacity:.4,title:`${ee[A]}: volume ${a(T.volume)}`})})}for(let u of te){if(u.hidden)continue;let k=u.values.flatMap((T,A)=>G(T)?[{x:p(E.center(A)),y:p(D.scale(C(T)))}]:[]);k.length<2||W.push({kind:"path",part:"overlay",d:Ve(k),stroke:u.color,strokeWidth:1.5,strokeLinejoin:"round",title:u.name,item:{label:u.name,series:u.name}})}for(let u of e.flags??[]){let k=Be.x(u.label);if(k===void 0)continue;let T=h.findIndex((j,U)=>E.center(U)===k),A=h[T],L=D.scale(C(A.high))-6,V=oe(u.variant??"primary");W.push({kind:"path",part:"flag",d:`M${p(k)} ${p(L)}V${p(L-10)}H${p(k+8)}L${p(k+5)} ${p(L-7)}L${p(k+8)} ${p(L-4)}H${p(k)}Z`,fill:V,stroke:V,title:u.text,item:{label:u.text,name:u.text,category:ee[T],index:l+T}})}W.push(...Jt(e.annotations,Be));let Tt={plot:b,xs:h.map((u,k)=>p(E.center(k))),rows:It,count:s,zoom:d,crosshair:Gt(e)};if(e.brush){let u={x:b.x,y:b.y+b.height+mn,width:b.width,height:fn},k=t.map(U=>U.close),[T,A]=ie(k),L=s>1?u.width/(s-1):0,V=k.map((U,B)=>({x:p(u.x+B*L),y:p(u.y+u.height-(A===T?.5:(U-T)/(A-T))*(u.height-4)-2)})),j={x:p(u.x+l/s*u.width),y:u.y,width:p((c-l)/s*u.width),height:u.height};W.push({kind:"rect",part:"brush",...u,fill:"var(--skdx-color-surface-sunken)",stroke:$.grid},{kind:"path",part:"brush-series",d:V.length>1?`${Ve(V)}L${V[V.length-1]?.x} ${u.y+u.height}L${V[0]?.x} ${u.y+u.height}Z`:"",fill:"var(--skdx-color-primary-500)",fillOpacity:.3},{kind:"rect",part:"brush-window",...j,fill:"var(--skdx-color-primary-500)",opacity:.15,stroke:$.axis},{kind:"rect",part:"brush-handle",x:p(j.x-3),y:u.y+8,width:6,height:u.height-16,fill:$.axis,rx:2},{kind:"rect",part:"brush-handle",x:p(j.x+j.width-3),y:u.y+8,width:6,height:u.height-16,fill:$.axis,rx:2}),Tt.brush={box:u,window:j}}return{...Le,shapes:[...W,...Le.shapes],hit:Tt,issues:n}}var M=require("lit"),g=require("lit/decorators.js"),z=require("lit/directives/if-defined.js");var _n={fromAttribute:()=>!1},S=class extends M.LitElement{constructor(){super(...arguments);this.legend=!1;this.tooltip=!0;this.selectionMode="none";this.loading=!1;this.decorative=!1;this.accessibleTable=!1;this.zoomable=!1;this.editable=!1;this.crossFilter=!1;this.animated=!1;this.responsive=!1;this.tip=[];this.overlay=[];this.portal=null;this.highlightState=null;this.crossState=null;this.lastCross=null;this.pointers=new Map;this.hover=null;this.token={};this.focused=null;this.hiddenState=[];this.drag=null;this.onPointerMove=t=>{let r=this.layout;if(!r)return;this.pointers.has(t.pointerId)&&this.pointers.set(t.pointerId,this.viewBox(t,r).x);let i=this.drag;if(i?.grab==="select"){let{x:o,y:a}=this.viewBox(t,r);this.overlay=[rt(Ie(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=[ot(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=st(r,i.gantt,o-i.x),this.overlay=[ct(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(dt(r.map,i.view,o-i.x,a-i.y));return}if(i&&r.hit){if(i.grab==="pinch"){let[a,s]=[...this.pointers.values()];if(a===void 0||s===void 0||!i.distance)return;this.setZoom(mt(r.hit,i.zoom,Math.abs(a-s)/i.distance,(a+s)/2));return}let{x:o}=this.viewBox(t,r);this.setZoom(i.grab==="pan"?xt(r.hit,i.zoom,o-i.x):gt(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:a}=Je(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=et(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(tt(r,t.target)),this.syncId&&r.hit?.crosshair){let o=xe(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=Q(r,t.target)?.item.legend,s=this.canEdit(r)?at(r,i,o):void 0;if(s){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"edit",gantt:s},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.brushing()&&!a){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:this.selectionMode==="lasso"?"lasso":"select",points:[{x:i,y:o}]},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.canPan(r)&&r.map){let c=r.map.plot;if(i<c.x||i>c.x+c.width||o<c.y||o>c.y+c.height)return;this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"map",view:r.map.view},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}let l=r.hit;if(!(!l||!this.canZoom(r))){if(this.pointers.set(t.pointerId,i),this.pointers.size===2){let[c,d]=[...this.pointers.values()];this.drag={x:(c+d)/2,y:o,zoom:l.zoom,grab:"pinch",distance:Math.abs(c-d)||1}}else{let c=bt(l,i,o);if(c)this.drag={x:i,y:o,zoom:c.zoom,grab:c.grab},c.zoom!==l.zoom&&this.setZoom(c.zoom);else if(this.zoomable&&i>=l.plot.x&&i<=l.plot.x+l.plot.width&&o>=l.plot.y&&o<=l.plot.y+l.plot.height)this.drag={x:i,y:o,zoom:l.zoom,grab:"pan"};else{this.pointers.delete(t.pointerId);return}}t.currentTarget.setPointerCapture(t.pointerId),this.clearTip()}};this.onPointerUp=t=>{this.pointers.delete(t.pointerId);let r=t.currentTarget;r.hasPointerCapture(t.pointerId)&&r.releasePointerCapture(t.pointerId);let i=this.drag,o=this.layout;if(o&&(i?.grab==="select"||i?.grab==="lasso"||i?.grab==="edit"||i?.grab==="map")){this.overlay=[];let{x:a,y:s}=this.viewBox(t,o);if(Math.abs(a-i.x)>2||Math.abs(s-i.y)>2){i.grab==="select"?this.setSelected(nt(o,Ie(i.x,i.y,a,s))):i.grab==="lasso"?this.setSelected(it(o,i.points??[])):i.grab==="edit"&&i.change&&this.emit("skdx-task-change",i.change),this.drag={...i,distance:-1};return}this.drag=null;return}(this.pointers.size===0||this.drag?.grab==="pinch")&&(this.drag=null)};this.onWheel=t=>{let r=this.layout;if(!r)return;let{x:i,y:o}=this.viewBox(t,r);if(r.map&&this.canPan(r)){let l=r.map.plot;if(i<l.x||i>l.x+l.width||o<l.y||o>l.y+l.height)return;t.preventDefault(),this.setView(ut(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 s=ft(a,t.deltaY,i);s&&(t.preventDefault(),this.setZoom(s))};this.onClick=t=>{if(!this.layout)return;if(this.drag?.distance===-1){this.drag=null;return}let r=Q(this.layout,t.target);r&&(r.item.range?this.setZoom(r.item.range):r.item.legend&&r.item.series!==void 0?this.toggle(r.item.series):(this.select(r.item),this.emit("skdx-item-click",r.item)))};this.onKeyDown=t=>{let r=this.layout;if(!r)return;if((t.key==="Enter"||t.key===" ")&&this.focused!==null){let s=r.shapes[this.focused]?.item;s&&(t.preventDefault(),this.select(s),this.emit("skdx-item-click",s));return}let i=this.canEdit(r)?lt(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=pt(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?X(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:s,loading:l,error:c,emptyMessage:d,description:h,decorative:m,animated:w,responsive:y,highlighted:f,highlightScope:v,accessibleTable:b}=this;return{...typeof y=="object"&&this.measured!==void 0&&this.measured<(y.breakpoint??480)?y.compact:void 0,width:y&&this.measured?this.measured:t,height:r,animate:w,responsive:y,legend:i,tooltip:o,format:a,palette:s,loading:l,error:c,emptyMessage:d,description:h,decorative:m,highlighted:f===void 0?this.highlightState:f,highlightScope:v,accessibleTable:b,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&&ze(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=ze(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&&We(r,t)||(this.hover=t,this.emit("skdx-highlighted-change",t),this.syncId&&(this.highlightState=t,this.publish({highlighted:t})))}select(t){let r=this.selectionMode;r!=="none"&&this.setSelected(Ue(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 ce(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&&K(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?vt(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=Ke(_e(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let b of o.issues??[])this.emit("skdx-data-issue",b)}let a=this.canZoom(o),s=this.canPan(o),l=this.canEdit(o),c=this.brushing(),d=a||s||l||c,h=!o.decorative&&Te(o).length>0,m=o.description?`${r}-desc`:void 0,w=$t(o),y=wt(o,this.accessibleTable),f=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,v=this.portal;return M.html`<svg
|
|
3
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
4
|
+
viewBox="0 0 ${o.width} ${o.height}"
|
|
5
|
+
width=${o.width}
|
|
6
|
+
height=${o.height}
|
|
7
|
+
role=${o.decorative?"presentation":"img"}
|
|
8
|
+
aria-hidden=${o.decorative?"true":M.nothing}
|
|
9
|
+
aria-label=${o.decorative?M.nothing:i}
|
|
10
|
+
aria-describedby=${(0,z.ifDefined)(m)}
|
|
11
|
+
tabindex=${h?0:M.nothing}
|
|
12
|
+
data-skdx-chart=${r}
|
|
13
|
+
data-zoomable=${a||s?"":M.nothing}
|
|
14
|
+
data-brushing=${c&&!(a||s)?"":M.nothing}
|
|
15
|
+
data-editable=${l?"":M.nothing}
|
|
16
|
+
style=${w?`--skdx-chart-duration:${w}`:M.nothing}
|
|
17
|
+
font-family=${$.fontFamily}
|
|
18
|
+
font-size=${$.fontSize}
|
|
19
|
+
@pointermove=${o.tooltip||d?this.onPointerMove:M.nothing}
|
|
20
|
+
@pointerleave=${()=>{this.clearTip(),this.highlight(null)}}
|
|
21
|
+
@pointerdown=${d?this.onPointerDown:M.nothing}
|
|
22
|
+
@pointerup=${d?this.onPointerUp:M.nothing}
|
|
23
|
+
@pointercancel=${d?this.onPointerUp:M.nothing}
|
|
24
|
+
@wheel=${a||s?this.onWheel:M.nothing}
|
|
25
|
+
@dblclick=${a||s?()=>s?this.setView(void 0):this.setZoom(void 0):M.nothing}
|
|
26
|
+
@click=${this.onClick}
|
|
27
|
+
@keydown=${h?this.onKeyDown:M.nothing}
|
|
28
|
+
@blur=${()=>{this.focused=null,this.highlight(null)}}
|
|
29
|
+
>
|
|
30
|
+
<title>${i}</title>
|
|
31
|
+
${o.description?M.svg`<desc id=${(0,z.ifDefined)(m)}>${o.description}</desc>`:M.nothing}
|
|
32
|
+
${w?M.svg`<style>${Mt}</style>`:M.nothing} ${En(o)}
|
|
33
|
+
${Oe(o.shapes)}
|
|
34
|
+
${Oe(this.tip.length||!this.crossState?this.tip:Qe(o,this.crossState))}
|
|
35
|
+
${Oe(ht(o,this.focused))} ${Oe(this.overlay)}
|
|
36
|
+
</svg>
|
|
37
|
+
${v?M.html`<div
|
|
38
|
+
role="tooltip"
|
|
39
|
+
data-skdx-tooltip=${r}
|
|
40
|
+
style="left:${v.x+12}px;top:${v.y+12}px"
|
|
41
|
+
>
|
|
42
|
+
${v.lines.map(b=>M.html`<div>${b}</div>`)}
|
|
43
|
+
</div>`:M.nothing}
|
|
44
|
+
${y?M.html`<table data-skdx-table=${r}>
|
|
45
|
+
<caption>
|
|
46
|
+
${f}
|
|
47
|
+
</caption>
|
|
48
|
+
<thead>
|
|
49
|
+
<tr>
|
|
50
|
+
${(y[0]??[]).map(b=>M.html`<th scope="col">${b}</th>`)}
|
|
51
|
+
</tr>
|
|
52
|
+
</thead>
|
|
53
|
+
<tbody>
|
|
54
|
+
${y.slice(1).map(b=>M.html`<tr>
|
|
55
|
+
${b.map((I,C)=>C===0?M.html`<th scope="row">${I}</th>`:M.html`<td>${I}</td>`)}
|
|
56
|
+
</tr>`)}
|
|
57
|
+
</tbody>
|
|
58
|
+
</table>`:M.nothing}`}};S.styles=M.css`
|
|
59
|
+
:host {
|
|
60
|
+
display: inline-block;
|
|
61
|
+
}
|
|
62
|
+
svg {
|
|
63
|
+
display: block;
|
|
64
|
+
max-width: 100%;
|
|
65
|
+
height: auto;
|
|
66
|
+
outline: none;
|
|
67
|
+
}
|
|
68
|
+
svg[data-zoomable] {
|
|
69
|
+
cursor: grab;
|
|
70
|
+
touch-action: none;
|
|
71
|
+
}
|
|
72
|
+
svg[data-brushing] {
|
|
73
|
+
cursor: crosshair;
|
|
74
|
+
touch-action: none;
|
|
75
|
+
}
|
|
76
|
+
svg[data-editable] {
|
|
77
|
+
touch-action: none;
|
|
78
|
+
}
|
|
79
|
+
:host([responsive]) {
|
|
80
|
+
display: block;
|
|
81
|
+
}
|
|
82
|
+
table {
|
|
83
|
+
position: absolute;
|
|
84
|
+
width: 1px;
|
|
85
|
+
height: 1px;
|
|
86
|
+
margin: -1px;
|
|
87
|
+
padding: 0;
|
|
88
|
+
overflow: hidden;
|
|
89
|
+
clip: rect(0 0 0 0);
|
|
90
|
+
white-space: nowrap;
|
|
91
|
+
border: 0;
|
|
92
|
+
}
|
|
93
|
+
[role='tooltip'] {
|
|
94
|
+
position: fixed;
|
|
95
|
+
pointer-events: none;
|
|
96
|
+
z-index: 1000;
|
|
97
|
+
background: var(--skdx-color-surface-raised);
|
|
98
|
+
color: var(--skdx-color-text-default);
|
|
99
|
+
border: 1px solid var(--skdx-color-border-strong);
|
|
100
|
+
border-radius: 3px;
|
|
101
|
+
padding: 4px 8px;
|
|
102
|
+
font-family: var(--skdx-font-family);
|
|
103
|
+
font-size: var(--skdx-font-size-xs);
|
|
104
|
+
white-space: nowrap;
|
|
105
|
+
}
|
|
106
|
+
[role='tooltip'] > :first-child:not(:only-child) {
|
|
107
|
+
font-weight: bold;
|
|
108
|
+
}
|
|
109
|
+
`,x([(0,g.property)({type:Number})],S.prototype,"width",2),x([(0,g.property)({type:Number})],S.prototype,"height",2),x([(0,g.property)()],S.prototype,"label",2),x([(0,g.property)({type:Boolean,reflect:!0})],S.prototype,"legend",2),x([(0,g.property)({type:Boolean,attribute:"no-tooltip",converter:_n})],S.prototype,"tooltip",2),x([(0,g.property)({attribute:!1})],S.prototype,"format",2),x([(0,g.property)({attribute:!1})],S.prototype,"palette",2),x([(0,g.property)({attribute:!1})],S.prototype,"hiddenSeries",2),x([(0,g.property)({attribute:!1})],S.prototype,"selected",2),x([(0,g.property)({attribute:"selection-mode"})],S.prototype,"selectionMode",2),x([(0,g.property)({attribute:!1})],S.prototype,"highlighted",2),x([(0,g.property)({attribute:!1})],S.prototype,"highlightScope",2),x([(0,g.property)({type:Boolean,reflect:!0})],S.prototype,"loading",2),x([(0,g.property)()],S.prototype,"error",2),x([(0,g.property)({attribute:"empty-message"})],S.prototype,"emptyMessage",2),x([(0,g.property)()],S.prototype,"description",2),x([(0,g.property)({type:Boolean,reflect:!0})],S.prototype,"decorative",2),x([(0,g.property)({type:Boolean,attribute:"accessible-table"})],S.prototype,"accessibleTable",2),x([(0,g.property)({attribute:!1})],S.prototype,"zoom",2),x([(0,g.property)({attribute:!1})],S.prototype,"view",2),x([(0,g.property)({type:Boolean,reflect:!0})],S.prototype,"zoomable",2),x([(0,g.property)({type:Boolean,reflect:!0})],S.prototype,"editable",2),x([(0,g.property)({attribute:"sync-id"})],S.prototype,"syncId",2),x([(0,g.property)({type:Boolean,attribute:"cross-filter"})],S.prototype,"crossFilter",2),x([(0,g.property)({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],S.prototype,"animated",2),x([(0,g.property)({type:Boolean,reflect:!0})],S.prototype,"responsive",2),x([(0,g.state)()],S.prototype,"tip",2),x([(0,g.state)()],S.prototype,"overlay",2),x([(0,g.state)()],S.prototype,"portal",2),x([(0,g.state)()],S.prototype,"measured",2),x([(0,g.state)()],S.prototype,"viewState",2),x([(0,g.state)()],S.prototype,"highlightState",2),x([(0,g.state)()],S.prototype,"crossState",2),x([(0,g.state)()],S.prototype,"focused",2),x([(0,g.state)()],S.prototype,"hiddenState",2),x([(0,g.state)()],S.prototype,"zoomState",2),x([(0,g.state)()],S.prototype,"selectedState",2);var O=class extends S{constructor(){super(...arguments);this.series=[];this.labels=!1;this.connectNulls=!1;this.stacked=!1;this.brush=!1;this.crosshair=!1}input(){let{series:t,categories:r,xAxis:i,yAxis:o,rightAxis:a,references:s,annotations:l,labels:c,curve:d,connectNulls:h,nulls:m,stacked:w,stackOffset:y,orientation:f,radius:v,barGap:b,barWidth:I,sort:C,transform:H,transforms:Z,bins:N,binWidth:P,binDomain:ye,binMode:te,sampling:D,brush:J,crosshair:Ae}=this;return{...this.sized(),series:t,categories:r,xAxis:i,yAxis:o,rightAxis:a,references:s,annotations:l,labels:c,curve:d,connectNulls:h,nulls:m,stacked:w,stackOffset:y,orientation:f,radius:v,barGap:b,barWidth:I,sort:C,transform:H,transforms:Z,bins:N,binWidth:P,binDomain:ye,binMode:te,sampling:D,brush:J,crosshair:Ae}}};x([(0,g.property)({attribute:!1})],O.prototype,"series",2),x([(0,g.property)({attribute:!1})],O.prototype,"categories",2),x([(0,g.property)({attribute:!1})],O.prototype,"xAxis",2),x([(0,g.property)({attribute:!1})],O.prototype,"yAxis",2),x([(0,g.property)({attribute:!1})],O.prototype,"rightAxis",2),x([(0,g.property)({attribute:!1})],O.prototype,"references",2),x([(0,g.property)({attribute:!1})],O.prototype,"annotations",2),x([(0,g.property)({type:Boolean,reflect:!0})],O.prototype,"labels",2),x([(0,g.property)()],O.prototype,"curve",2),x([(0,g.property)({type:Boolean,attribute:"connect-nulls"})],O.prototype,"connectNulls",2),x([(0,g.property)()],O.prototype,"nulls",2),x([(0,g.property)({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],O.prototype,"stacked",2),x([(0,g.property)({attribute:"stack-offset"})],O.prototype,"stackOffset",2),x([(0,g.property)()],O.prototype,"orientation",2),x([(0,g.property)({type:Number})],O.prototype,"radius",2),x([(0,g.property)({type:Number,attribute:"bar-gap"})],O.prototype,"barGap",2),x([(0,g.property)({type:Number,attribute:"bar-width"})],O.prototype,"barWidth",2),x([(0,g.property)()],O.prototype,"sort",2),x([(0,g.property)()],O.prototype,"transform",2),x([(0,g.property)({attribute:!1})],O.prototype,"transforms",2),x([(0,g.property)({type:Number})],O.prototype,"bins",2),x([(0,g.property)({type:Number,attribute:"bin-width"})],O.prototype,"binWidth",2),x([(0,g.property)({attribute:!1})],O.prototype,"binDomain",2),x([(0,g.property)({attribute:"bin-mode"})],O.prototype,"binMode",2),x([(0,g.property)({attribute:!1})],O.prototype,"sampling",2),x([(0,g.property)({type:Boolean,reflect:!0})],O.prototype,"brush",2),x([(0,g.property)({type:Boolean,reflect:!0})],O.prototype,"crosshair",2);var En=e=>e.defs&&e.defs.length?M.svg`<defs>${e.defs.map(n=>M.svg`<linearGradient id=${n.id} x1="0" y1="0" x2=${n.vertical===!1?1:0} y2=${n.vertical===!1?0:1}>${n.stops.map(t=>M.svg`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${(0,z.ifDefined)(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:M.nothing,Oe=e=>M.svg`${e.map((n,t)=>{let r=n.title?M.svg`<title>${n.title}</title>`:M.nothing,i=n.item?t:void 0;switch(n.kind){case"path":return M.svg`<path data-skdx-part=${n.part} data-skdx-i=${(0,z.ifDefined)(i)} d=${n.d} fill=${n.fill??"none"} stroke=${(0,z.ifDefined)(n.stroke)} stroke-width=${(0,z.ifDefined)(n.strokeWidth)} stroke-linecap=${(0,z.ifDefined)(n.strokeLinecap)} stroke-linejoin=${(0,z.ifDefined)(n.strokeLinejoin)} stroke-dasharray=${(0,z.ifDefined)(n.dash)} opacity=${(0,z.ifDefined)(n.opacity)} fill-opacity=${(0,z.ifDefined)(n.fillOpacity)}>${r}</path>`;case"rect":return M.svg`<rect data-skdx-part=${n.part} data-skdx-i=${(0,z.ifDefined)(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${(0,z.ifDefined)(n.rx)} fill=${n.fill} stroke=${(0,z.ifDefined)(n.stroke)} fill-opacity=${(0,z.ifDefined)(n.opacity)}>${r}</rect>`;case"line":return M.svg`<line data-skdx-part=${n.part} data-skdx-i=${(0,z.ifDefined)(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${(0,z.ifDefined)(n.strokeWidth)} stroke-dasharray=${(0,z.ifDefined)(n.dash)} opacity=${(0,z.ifDefined)(n.opacity)}>${r}</line>`;case"circle":return M.svg`<circle data-skdx-part=${n.part} data-skdx-i=${(0,z.ifDefined)(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${(0,z.ifDefined)(n.stroke)} opacity=${(0,z.ifDefined)(n.opacity)}>${r}</circle>`;case"text":return M.svg`<text data-skdx-part=${n.part} data-skdx-i=${(0,z.ifDefined)(i)} x=${n.x} y=${n.y} text-anchor=${(0,z.ifDefined)(n.anchor)} dominant-baseline=${(0,z.ifDefined)(n.baseline)} fill=${(0,z.ifDefined)(n.fill)} font-weight=${(0,z.ifDefined)(n.weight)} pointer-events=${(0,z.ifDefined)(i===void 0?"none":void 0)} transform=${(0,z.ifDefined)(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var F=class extends S{constructor(){super(...arguments);this.data=[];this.brush=!1;this.crosshair=!1}render(){let{data:t,scale:r,variant:i,xAxis:o,references:a,annotations:s,overlays:l,upColor:c,downColor:d,brush:h,crosshair:m}=this;return this.root(St({...this.sized(),data:t,scale:r,variant:i,xAxis:o,references:a,annotations:s,overlays:l,upColor:c,downColor:d,brush:h,crosshair:m}),"candlestick",this.label??"Candlestick chart")}};x([(0,_.property)({attribute:!1})],F.prototype,"data",2),x([(0,_.property)()],F.prototype,"scale",2),x([(0,_.property)()],F.prototype,"variant",2),x([(0,_.property)({attribute:!1})],F.prototype,"xAxis",2),x([(0,_.property)({attribute:!1})],F.prototype,"references",2),x([(0,_.property)({attribute:!1})],F.prototype,"annotations",2),x([(0,_.property)({attribute:!1})],F.prototype,"overlays",2),x([(0,_.property)({attribute:"up-color"})],F.prototype,"upColor",2),x([(0,_.property)({attribute:"down-color"})],F.prototype,"downColor",2),x([(0,_.property)({type:Boolean,reflect:!0})],F.prototype,"brush",2),x([(0,_.property)({type:Boolean,reflect:!0})],F.prototype,"crosshair",2),F=x([(0,_.customElement)("skdx-candlestick-chart")],F);0&&(module.exports={SkdxCandlestickChart});
|