@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
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";var J=Object.defineProperty;var rt=Object.getOwnPropertyDescriptor;var zt=Object.getOwnPropertyNames;var Ot=Object.prototype.hasOwnProperty;var At=(e,n)=>{for(var t in n)J(e,t,{get:n[t],enumerable:!0})},Lt=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of zt(n))!Ot.call(e,i)&&i!==t&&J(e,i,{get:()=>n[i],enumerable:!(r=rt(n,i))||r.enumerable});return e};var Pt=e=>Lt(J({},"__esModule",{value:!0}),e),h=(e,n,t,r)=>{for(var i=r>1?void 0:r?rt(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&&J(n,t,i),i};var en={};At(en,{SkdxParallelCoordinatesChart:()=>L});module.exports=Pt(en);var G=require("lit/decorators.js");var it=e=>Number(e.toPrecision(12)),Bt,Rt=e=>(Bt??(Bt=new Intl.NumberFormat)).format(it(e)),Nt=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 ot(e){if(e===void 0)return Rt;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:i="",timeZone:o}=e,s=u=>i?d=>u(d)+i:u,a=u=>r===void 0?u===void 0?{}:{maximumFractionDigits:u}:{minimumFractionDigits:r,maximumFractionDigits:r},l=u=>{let d=new Intl.NumberFormat(t,u);return s(f=>d.format(it(f)))},c=u=>{let d=new Intl.DateTimeFormat(t,o?{...u,timeZone:o}:u);return f=>d.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(Nt)}}function he([e,n],[t,r]){let i=n-e;return o=>i===0?t:t+(o-e)/i*(r-t)}function pe(e,n,t=5){if(e===n)return[e];let r=(n-e)/Math.max(1,t),i=10**Math.floor(Math.log10(r)),o=r/i,s=(o<1.5?1:o<3.5?2:o<7.5?5:10)*i,a=Math.floor(e/s)*s,l=Math.ceil(n/s)*s,c=[];for(let u=a;u<=l+s/2;u+=s)c.push(Dt(u));return c}var Dt=e=>Number(e.toPrecision(12)),x=e=>Number(e.toFixed(2)),fe=e=>typeof e=="number"&&Number.isFinite(e);function me(e){let n=1/0,t=-1/0;for(let r of e)fe(r)&&(r<n&&(n=r),r>t&&(t=r));return n===1/0?[0,0]:[n,t]}function st(e,n="linear"){if(e.length===0)return"";let t=e[0];if(n==="step"||n==="stepBefore"||n==="stepAfter"){let c=`M${t.x} ${t.y}`;for(let u=1;u<e.length;u++){let d=e[u-1],f=e[u];n==="stepAfter"?c+=`H${f.x}V${f.y}`:n==="stepBefore"?c+=`V${f.y}H${f.x}`:c+=`H${x((d.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,u)=>c.x-e[u].x),o=e.slice(1).map((c,u)=>c.y-e[u].y),s=i.map((c,u)=>c===0?0:o[u]/c),a=[s[0]];for(let c=1;c<r-1;c++){let u=s[c-1],d=s[c];a.push(u*d<=0?0:(u+d)/2)}a.push(s[r-2]);for(let c=0;c<r-1;c++){let u=s[c];if(u===0){a[c]=0,a[c+1]=0;continue}let d=a[c]/u,f=a[c+1]/u,k=Math.hypot(d,f);k>3&&(a[c]=3*d*u/k,a[c+1]=3*f*u/k)}let l=`M${t.x} ${t.y}`;for(let c=0;c<r-1;c++){let u=e[c],d=e[c+1],f=i[c]/3;l+=`C${x(u.x+f)} ${x(u.y+f*a[c])} ${x(d.x-f)} ${x(d.y-f*a[c+1])} ${d.x} ${d.y}`}return l}var E=1e3,U=60*E,K=60*U,ee=24*K,rn=[E,5*E,15*E,30*E,U,5*U,15*U,30*U,K,3*K,6*K,12*K,ee,2*ee,7*ee,14*ee];var Gt=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,Ft=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,jt={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function Ht(e,n,t){return e.replace(Ft,(r,i,o)=>{let s=jt[i];if(s===void 0)return i+o;let l=(o.match(Gt)??[]).map((c,u)=>{let d=Number(c);if(s===-1)return String(d+n);if(s===-2)return String(d+t);let f=u%s;return s===7?f===5?String(d+n):f===6?String(d+t):c:String(f%2===0?d+n:d+t)});return i+l.join(" ")})}var at=(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:Ht(r.d,n,t)}}});var ge=["primary","success","warning","danger","neutral"].flatMap(e=>[500,700].map(n=>`var(--skdx-color-${e}-${n})`)).sort((e,n)=>Number(e.endsWith("700)"))-Number(n.endsWith("700)"))),w={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 lt=(e,n)=>n??ge[e%ge.length];var Vt={top:16,right:16,bottom:32,left:48};function ct(e,n,t=Vt){return{x:t.left,y:t.top,width:Math.max(0,e-t.left-t.right),height:Math.max(0,n-t.top-t.bottom)}}function Y(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function ut(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var te=20,Zt=120,dt=e=>{let n=Y(e);return n&&(n.position==="left"||n.position==="right")?n.width??Zt:0},xe=(e,n=600,t=300)=>({width:(e.width??n)-dt(e),height:(e.height??t)-(Y(e)?.position==="bottom"?te:0)}),ht=e=>{let n=Y(e);return n&&(n.position===void 0||n.position==="top")?te:0},H=6.5,ne=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:lt(n)),pt=(e,n)=>e.hiddenSeries?.includes(n)??!1;function be(e,n,t=[],r={},i=10,o=8,s=!1){let a=[],l=r.maxItems,c=l!==void 0&&l>=0&&e.length>l?e.slice(0,l):e,u=e.length-c.length,d=r.interactive??!0,f=o,k=i,M=(S,I,C,P)=>{let B=(I?18:4)+S.length*H;f>o&&(s||f+B>n-8)&&(f=o,k+=te),I&&a.push({kind:"rect",part:"legend-swatch",x:f,y:k-5,width:10,height:10,fill:I,opacity:P?.3:void 0,item:C}),a.push({kind:"text",part:"legend-label",x:f+(I?14:0),y:k,text:S,baseline:"middle",fill:P?w.grid:w.label,item:C}),f+=B+12};for(let S of c){let I=t.includes(S.name),C=d?{label:S.name,series:S.name,legend:!0}:void 0;M(r.formatter?.(S.name)??S.name,S.color,C,I)}return u>0&&M(`+${u} more`,void 0,void 0,!1),r.align==="end"?_t(a,n):a}function _t(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 Wt=(e,n,t={})=>new Set(be(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function ye(e,n,t,r=[]){let i=Y(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,s=ut(e),a=o?.position==="bottom",l=dt(e),c=e.hiddenSeries??[],u=o?l?be(r,1/0,c,o,10,(o.position==="right"?n:0)+8,!0):be(r,n,c,o,a?t+10:10):[],d=a?Wt(r,n,o):0;return{width:n+l,height:a?t+Math.max(1,d)*te:t,legendOffset:o?.position==="left"?l:void 0,tooltip:s.enabled,tooltipFormatter:s.formatter,axisTooltipFormatter:s.axisFormatter,tooltipPortal:s.portal,tooltipPlacement:s.placement,tooltipAnchored:s.followPointer===!1?!0:void 0,description:e.description,decorative:e.decorative,animate:e.animate===!0?300:e.animate||void 0,responsive:!!e.responsive,shapes:u}}function ve(e){let n=e.legendOffset;if(!n)return e;let t=[...at(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 re(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},u=Math.max(0,Math.min(r-a,c.x)),d=Math.max(0,Math.min(i-l,c.y));return[{kind:"rect",part:"tooltip",x:x(u),y:x(d),width:x(a),height:l,fill:"var(--skdx-color-surface-raised)",stroke:w.axis,rx:3},...s.map((f,k)=>({kind:"text",part:"tooltip-label",x:x(u+6),y:x(d+11+k*16),text:f,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:s.length>1&&k===0?"bold":void 0}))]}function ft(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}=xe(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)":w.label}),{...ye(e,o,s),shapes:l,tooltip:!1}}var we=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:w.label,...r});function ie(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var ke=e=>e.id??e.name??e.series,mt=e=>e.seriesId??e.series;function N(e,n){let t=!1;return n.id!==void 0&&(t=!0,ke(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,mt(e)!==n.series&&e.series!==n.series)||n.index!==void 0&&(t=!0,e.index!==n.index)||n.category!==void 0&&(t=!0,e.category!==n.category)?!1:t}function F(e){let n={},t=ke(e);t!==void 0&&(n.id=t);let r=mt(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var Me=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function Se(e,n,t){let r=ie(e),i=F(n),o=r.some(s=>N(n,s));return t==="single"?o?[]:[i]:o?r.filter(s=>!N(n,s)):[...r,i]}var Et=.2;function Ut(e){let n=w.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 Kt=(e,n)=>e.kind==="text"?{...e,fill:w.grid}:{...e,opacity:(e.opacity??1)*n};function $e(e,n){let t=ie(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:ie(n.highlighted),i=r[0];if(t.length===0&&!i)return e;let o={highlighted:n.highlightScope?.highlighted??"item",faded:n.highlightScope?.faded??"global"},s=[],a=u=>!i||r.some(d=>N(u,d))?!0:o.highlighted==="series"?r.some(d=>d.series!==void 0&&N(u,{series:d.series})):!1,l=u=>{if(!i||o.faded==="none"||a(u))return!1;if(o.faded==="series"){let d=i.series;return d!==void 0&&N(u,{series:d})}return!0},c=e.shapes.map(u=>{let d=u.item;if(!d||d.legend)return u;if(t.some(f=>N(d,f))){let f=Ut(u);f&&s.push(f)}return l(d)?Kt(u,Et):u});return s.length?{...e,shapes:[...c,...s]}:{...e,shapes:c}}function W(e,n,t,r,i){let o=e.getBoundingClientRect();return{x:o.width?(n-o.left)*r/o.width:n,y:o.height?(t-o.top)*i/o.height:t}}var Ce=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function gt(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 q(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=gt(t,n),i=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(i,r)??i}}function Ie(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[gt(t,n)];return{kind:"line",part:"crosshair",x1:r,x2:r,y1:t.plot.y,y2:t.plot.y+t.plot.height,stroke:w.axis,dash:"3 3"}}function Te(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!Ce(r.plot,n,t))return[];let i=Ie(e,n),{rows:o}=q(e,n),s=e.tooltipAnchored?r.plot.y+8:t;return[i,...re(i.x1,s,o,e.width,e.height,e.tooltipPlacement)]}function ze(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 Te(e,i,t.plot.y+8)}function Oe(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:l,y:c}=W(t,r,i,e.width,e.height);if(Ce(e.hit.plot,l,c)){let u=q(e,l),d=Ie(e,l);if(u&&d)return{lines:u.rows,shapes:[d]}}}let o=n?.closest?.("[data-skdx-part]"),s=e.tooltipFormatter?j(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 bt(e,n,t,r,i,o,s){let a=e?.closest?.("[data-skdx-part]"),l=s&&s.tooltipFormatter?j(s,e)?.item:void 0,c=l&&s?.tooltipFormatter?.(l)||a&&Array.from(a.children).find(M=>M.tagName.toLowerCase()==="title")?.textContent;if(!c)return[];let u=s?.tooltipAnchored?j(s,e):void 0,d=u?s?.shapes[u.index]:void 0,{x:f,y:k}=d?X(d):W(n,t,r,i,o);return re(f,k,c,i,o,s?.tooltipPlacement)}function Ae(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:s}=W(t,r,i,e.width,e.height),a=Te(e,o,s);if(a.length>0)return a}return bt(n,t,r,i,e.width,e.height,e)}function Le(e,n){let t=j(e,n);return t&&!t.item.legend?F(t.item):null}var Yt=(e,n)=>{let{x:t,y:r}=X(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 Pe(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!Yt(i,n))continue;let o=F(i.item),s=JSON.stringify(o);t.has(s)||(t.add(s),r.push(o))}return r}var Be=e=>({kind:"rect",part:"selection-box",x:x(e.x),y:x(e.y),width:x(e.width),height:x(e.height),fill:w.focus,opacity:.12,stroke:w.focus}),se=(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 xt(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 Re(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}=X(i),a=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:s;if(!xt(n,o,a))continue;let l=F(i.item),c=JSON.stringify(l);t.has(c)||(t.add(c),r.push(l))}return r}var Ne=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${x(n.x)} ${x(n.y)}`).join("L")}`:"",fill:w.focus,fillOpacity:.12,stroke:w.focus,dash:"4 3"}),oe=6;function De(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-oe||n>i.x1+oe))return Math.abs(n-i.x0)<=oe?{bar:i,mode:"start"}:Math.abs(n-i.x1)<=oe?{bar:i,mode:"end"}:{bar:i,mode:"move"}}}function Ge(e,n,t){let r=e.edit;return yt(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function Fe(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 yt(r,{bar:o,mode:s},i*a)}function yt(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 je(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:w.focus,opacity:.25,stroke:w.focus,rx:2}}var qt=64,Xt=e=>Math.max(1,Math.min(qt,e));function He(e,n,t,r){let i=n>0?.8:1.25,o=Xt(e.view.zoom*i);if(o===e.view.zoom)return e.view;let{plot:s,scale:a}=e,[l,c]=e.view.center,u=(t-(s.x+s.width/2))/a,d=(r-(s.y+s.height/2))/a,f=e.view.zoom/o;return{center:[l+u*(1-f),e.fromY(e.toY(c)-d*(1-f))],zoom:o}}function Ve(e,n,t,r){let{scale:i}=e;return{center:[n.center[0]-t/i,e.fromY(e.toY(n.center[1])+r/i)],zoom:n.zoom}}function j(e,n){let t=n?.closest?.("[data-skdx-i]"),r=Number(t?.getAttribute("data-skdx-i")),i=Number.isInteger(r)?e.shapes[r]?.item:void 0;return i?{index:r,item:i}:void 0}var ae=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function X(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 Ze(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let r=w.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}=X(t),a=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...a?re(x(o),x(s),a,e.width,e.height):[]]}function _e(e,n,t){let r=ae(e);if(r.length===0)return;let i=n===null?-1:r.indexOf(n);switch(t){case"ArrowRight":case"ArrowDown":return r[Math.min(r.length-1,i+1)];case"ArrowLeft":case"ArrowUp":return r[Math.max(0,i<=0?0:i-1)];case"Home":return r[0];case"End":return r[r.length-1];case"Escape":return null;default:return}}var Z=2,_=(e,n,t)=>{let r=Math.max(Z,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},vt=(e,n)=>!e||e.start<=0&&e.end>=n;function We(e,n,t){if(e.count<=Z||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,s=n>0?1.25:.8,a=Math.max(Z,Math.min(e.count,Math.round(o*s)));if(a===o)return n>0&&!vt(e.zoom,e.count)?_(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 _(c-l*a,a,e.count)}function Ee(e,n,t,r){let i=n.end-n.start,o=Math.max(Z,Math.min(e.count,Math.round(i/Math.max(.05,t)))),s=Math.max(0,Math.min(1,(r-e.plot.x)/Math.max(1,e.plot.width)));return _(n.start+s*i-s*o,o,e.count)}function Ue(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return _(n.start-t/i,r,e.count)}function Ke(e,n,t){let r=e.brush;if(!r||!Ce(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:_(s-o/2,o,e.count)}}function Ye(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 _(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-Z,Math.round(t.start+o))),end:t.end};let s=Math.min(e.count,Math.max(t.start+Z,Math.round(t.end+o)));return{start:t.start,end:s}}function Xe(e,n){switch(n.type){case"svg":return Promise.resolve(qe(e,n.label,n.resolve));case"csv":return Promise.resolve(St(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=qe(e,n.label,n.resolve);return Mt(t,e.width,e.height,n.scale,n.background)}}}var D=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/"/g,"""),Q=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${D(String(t))}"`).join("");function wt(e){let n=e.title?`<title>${D(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${Q([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${Q([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${Q([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${Q([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${Q([t,["x",e.x],["y",e.y],["text-anchor",e.anchor],["dominant-baseline",e.baseline],["fill",e.fill],["font-weight",e.weight],["transform",e.rotate?`rotate(${e.rotate} ${e.x} ${e.y})`:void 0]])}>${D(e.text)}</text>`}}function kt(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${D(t.id)}" x1="0" y1="0" x2="${t.vertical===!1?1:0}" y2="${t.vertical===!1?0:1}">${t.stops.map(r=>`<stop offset="${r.offset}" stop-color="${D(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function qe(e,n,t){let r=kt(e)+e.shapes.map(wt).join("");return t&&(r=r.replace(/var\((--[\w-]+)\)/g,(i,o)=>t(o).trim()||i)),`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${e.width} ${e.height}" width="${e.width}" height="${e.height}" role="img" aria-label="${D(n)}" font-family="${D(w.fontFamily)}" font-size="${D(w.fontSize)}"><title>${D(n)}</title>${r}</svg>`}function Mt(e,n,t,r=2,i){return new Promise((o,s)=>{let a=URL.createObjectURL(new Blob([e],{type:"image/svg+xml;charset=utf-8"})),l=new Image;l.onload=()=>{URL.revokeObjectURL(a);let c=document.createElement("canvas");c.width=Math.round(n*r),c.height=Math.round(t*r);let u=c.getContext("2d");if(!u)return s(new Error("canvas 2d context unavailable"));i&&(u.fillStyle=i,u.fillRect(0,0,c.width,c.height)),u.drawImage(l,0,0,c.width,c.height),c.toBlob(d=>d?o(d):s(new Error("toBlob failed")),"image/png")},l.onerror=()=>{URL.revokeObjectURL(a),s(new Error("svg could not be decoded"))},l.src=a})}function St(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 Qe(e,n){if(!n)return;let t=typeof n=="object"?n.maxRows??500:500,r=e.hit;if(r&&r.rows.length>0){let a=r.rows[0];if(r.rows.length>t)return;let l=["",...a.slice(1).map(u=>u.replace(/:\s[^:]*$/,""))],c=r.rows.map(u=>[u[0],...u.slice(1).map(d=>d.slice(d.lastIndexOf(": ")+2))]);return[l,...c]}let i=e.shapes.flatMap(a=>a.item&&!a.item.legend&&!(a.part==="anchor"&&!a.title)?[a.item]:[]);if(i.length===0||i.length>t)return;let o=["series","name","category","value"].filter(a=>i.some(l=>l[a]!==void 0)),s=(a,l)=>a[l]===void 0?"":String(a[l]);return[o.map(a=>a[0]?.toUpperCase()+a.slice(1)),...i.map(a=>o.map(l=>s(a,l)))]}var Je=new Map;function le(e){let n=Je.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&&Je.delete(e)}},publish(o,s){Object.assign(r,o);for(let a of t)a(o,s)}};return Je.set(e,{group:i,listeners:t}),i}var $t='[data-skdx-part]:not([data-skdx-part^="tooltip"]):not([data-skdx-part="focus"]):not([data-skdx-part="crosshair"])',et=`@keyframes skdx-in{from{opacity:0}to{opacity:1}}${$t}{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){${$t}{animation:none;transition:none}}`;function tt(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}var Ct=500;function nt(e){let n=[],t=e.dimensions,r=e.data.filter(m=>!(m.group!==void 0&&pt(e,m.group))),i=ft(e,t.length===0||r.length===0);if(i)return{...i,issues:n};let{width:o,height:s}=xe(e),a=[...new Set(e.data.map(m=>m.group).filter(m=>m!==void 0))],l=t[0],c=t[t.length-1],u=m=>(m.label??m.key).length*H/2+8,d=ct(o,s,{top:28+ht(e),right:Math.max(16,u(c)),bottom:16,left:Math.max(48,u(l))}),f=(m,T)=>{let $=m.values[T];return $==null?null:fe($)?$:(n.push({code:"invalid-value",severity:"warning",message:`"${m.name}" has a value on "${T}" that is not a number; drawn as a gap.`,itemId:m.id??m.name}),null)},k=t.map((m,T)=>{let[$,O]=me(r.map(V=>f(V,m.key))),R=pe(m.min??$,m.max??O),z=m.min??R[0],A=m.max??R[R.length-1],ue=m.reversed?[d.y,d.y+d.height]:[d.y+d.height,d.y],de=he([z,A],ue),It=x(t.length===1?d.x+d.width/2:d.x+T*d.width/(t.length-1)),Tt=ot(m.format??e.format);return{d:m,x:It,scale:V=>x(de(Math.max(z,Math.min(A,V)))),format:Tt,ticks:R.filter(V=>V>=z-1e-9&&V<=A+1e-9)}}),M=[];k.forEach((m,T)=>{M.push({kind:"line",part:"axis",x1:m.x,x2:m.x,y1:d.y,y2:d.y+d.height,stroke:w.axis});let $=T===k.length-1&&k.length>1?"start":"end";for(let O of m.ticks)M.push(we(x($==="end"?m.x-6:m.x+6),m.scale(O),m.format(O),{part:"y-label",anchor:$,baseline:"middle"}));M.push(we(m.x,d.y-12,m.d.label??m.d.key,{part:"axis-title",anchor:"middle"}))});let S=r.length<=Ct,I=e.opacity??(r.length>200?.25:.6),C=m=>(e.filters??[]).every(T=>{let $=f(m,T.key);return $!==null&&$>=(T.min??-1/0)&&$<=(T.max??1/0)}),P=r.map((m,T)=>{let $=[],O=[];for(let z of k){let A=f(m,z.d.key);if(A===null){!e.connectNulls&&O.length&&($.push(O),O=[]);continue}O.push({x:z.x,y:z.scale(A)})}O.length&&$.push(O);let R=`${m.name}: ${k.map(z=>{let A=f(m,z.d.key);return`${z.d.label??z.d.key} ${A===null?"\u2014":z.format(A)}`}).join(" \xB7 ")}`;return{kind:"path",part:"row",d:$.map(z=>st(z,e.curve)).join(""),stroke:m.color??(m.group!==void 0?ne(e,a.indexOf(m.group)):ne(e,0)),strokeWidth:1.5,strokeLinejoin:"round",opacity:C(m)?I:.08,title:S?R:void 0,item:S?{label:R,id:m.id??m.name,name:m.name,category:m.group,index:T}:void 0}}),B=ye(e,o,s,a.map((m,T)=>({name:m,color:ne(e,T)})));return{...B,shapes:[...M,...P,...B.shapes],issues:n}}var g=require("lit"),p=require("lit/decorators.js"),y=require("lit/directives/if-defined.js");var Qt={fromAttribute:()=>!1},b=class extends g.LitElement{constructor(){super(...arguments);this.legend=!1;this.tooltip=!0;this.selectionMode="none";this.loading=!1;this.decorative=!1;this.accessibleTable=!1;this.zoomable=!1;this.editable=!1;this.crossFilter=!1;this.animated=!1;this.responsive=!1;this.tip=[];this.overlay=[];this.portal=null;this.highlightState=null;this.crossState=null;this.lastCross=null;this.pointers=new Map;this.hover=null;this.token={};this.focused=null;this.hiddenState=[];this.drag=null;this.onPointerMove=t=>{let r=this.layout;if(!r)return;this.pointers.has(t.pointerId)&&this.pointers.set(t.pointerId,this.viewBox(t,r).x);let i=this.drag;if(i?.grab==="select"){let{x:o,y:s}=this.viewBox(t,r);this.overlay=[Be(se(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=[Ne(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=Ge(r,i.gantt,o-i.x),this.overlay=[je(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(Ve(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(Ee(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"?Ue(r.hit,i.zoom,o-i.x):Ye(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:s}=Oe(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=Ae(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(Le(r,t.target)),this.syncId&&r.hit?.crosshair){let o=q(r,this.viewBox(t,r).x);this.shareCrosshair(o?r.hit.rows[o.index]?.[0]??null:null)}};this.onPointerDown=t=>{let r=this.layout;if(!r||t.button!==0)return;let{x:i,y:o}=this.viewBox(t,r),s=j(r,t.target)?.item.legend,a=this.canEdit(r)?De(r,i,o):void 0;if(a){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"edit",gantt:a},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.brushing()&&!s){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:this.selectionMode==="lasso"?"lasso":"select",points:[{x:i,y:o}]},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.canPan(r)&&r.map){let c=r.map.plot;if(i<c.x||i>c.x+c.width||o<c.y||o>c.y+c.height)return;this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"map",view:r.map.view},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}let l=r.hit;if(!(!l||!this.canZoom(r))){if(this.pointers.set(t.pointerId,i),this.pointers.size===2){let[c,u]=[...this.pointers.values()];this.drag={x:(c+u)/2,y:o,zoom:l.zoom,grab:"pinch",distance:Math.abs(c-u)||1}}else{let c=Ke(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(Pe(o,se(i.x,i.y,s,a))):i.grab==="lasso"?this.setSelected(Re(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(He(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=We(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=j(this.layout,t.target);r&&(r.item.range?this.setZoom(r.item.range):r.item.legend&&r.item.series!==void 0?this.toggle(r.item.series):(this.select(r.item),this.emit("skdx-item-click",r.item)))};this.onKeyDown=t=>{let r=this.layout;if(!r)return;if((t.key==="Enter"||t.key===" ")&&this.focused!==null){let a=r.shapes[this.focused]?.item;a&&(t.preventDefault(),this.select(a),this.emit("skdx-item-click",a));return}let i=this.canEdit(r)?Fe(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=_e(r,this.focused,t.key);if(o===void 0)return;t.preventDefault(),this.focused=o;let s=o===null?void 0:r.shapes[o]?.item;this.highlight(s?F(s):null)}}connectedCallback(){super.connectedCallback(),!(typeof ResizeObserver>"u")&&(this.observer=new ResizeObserver(([t])=>{let r=Math.floor(t?.contentRect.width??0);r>0&&(this.measured=r)}),this.observer.observe(this))}disconnectedCallback(){this.observer?.disconnect(),this.leave?.(),this.leave=void 0,this.joined=void 0,super.disconnectedCallback()}sized(){let{width:t,height:r,legend:i,tooltip:o,format:s,palette:a,loading:l,error:c,emptyMessage:u,description:d,decorative:f,animated:k,responsive:M,highlighted:S,highlightScope:I,accessibleTable:C}=this;return{...typeof M=="object"&&this.measured!==void 0&&this.measured<(M.breakpoint??480)?M.compact:void 0,width:M&&this.measured?this.measured:t,height:r,animate:k,responsive:M,legend:i,tooltip:o,format:s,palette:a,loading:l,error:c,emptyMessage:u,description:d,decorative:f,highlighted:S===void 0?this.highlightState:S,highlightScope:I,accessibleTable:C,hiddenSeries:this.hiddenSeries??this.hiddenState,zoom:this.zoom??this.zoomState,selected:this.selected??this.selectedState,view:this.view??this.viewState}}emit(t,r){this.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0}))}publish(t){this.syncId&&le(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=le(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&&Me(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(Se(this.selected??this.selectedState,t,r==="single"?"single":"multiple"))}shareCrosshair(t){!this.syncId||this.lastCross===t||(this.lastCross=t,this.publish({crosshair:t}))}clearTip(){this.tip=[],this.portal=null,this.shareCrosshair(null)}canZoom(t){return!!(t.hit&&(this.zoomable||t.hit.brush))}canPan(t){return!!(t.map&&this.zoomable)}canEdit(t){return!!(this.editable&&t.edit)}brushing(){return this.selectionMode==="brush"||this.selectionMode==="lasso"}viewBox(t,r){return W(t.currentTarget,t.clientX,t.clientY,r.width,r.height)}getSvgElement(){return this.renderRoot.querySelector("svg")}getLayout(){return this.layout}resetZoom(){this.setZoom(void 0)}zoomTo(t){this.setZoom(t)}focusItem(t){let r=this.layout;if(!r)return!1;let i=r.shapes.findIndex(o=>o.item&&!o.item.legend&&N(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?Xe(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=$e(ve(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let C of o.issues??[])this.emit("skdx-data-issue",C)}let s=this.canZoom(o),a=this.canPan(o),l=this.canEdit(o),c=this.brushing(),u=s||a||l||c,d=!o.decorative&&ae(o).length>0,f=o.description?`${r}-desc`:void 0,k=tt(o),M=Qe(o,this.accessibleTable),S=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,I=this.portal;return g.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":g.nothing}
|
|
9
|
+
aria-label=${o.decorative?g.nothing:i}
|
|
10
|
+
aria-describedby=${(0,y.ifDefined)(f)}
|
|
11
|
+
tabindex=${d?0:g.nothing}
|
|
12
|
+
data-skdx-chart=${r}
|
|
13
|
+
data-zoomable=${s||a?"":g.nothing}
|
|
14
|
+
data-brushing=${c&&!(s||a)?"":g.nothing}
|
|
15
|
+
data-editable=${l?"":g.nothing}
|
|
16
|
+
style=${k?`--skdx-chart-duration:${k}`:g.nothing}
|
|
17
|
+
font-family=${w.fontFamily}
|
|
18
|
+
font-size=${w.fontSize}
|
|
19
|
+
@pointermove=${o.tooltip||u?this.onPointerMove:g.nothing}
|
|
20
|
+
@pointerleave=${()=>{this.clearTip(),this.highlight(null)}}
|
|
21
|
+
@pointerdown=${u?this.onPointerDown:g.nothing}
|
|
22
|
+
@pointerup=${u?this.onPointerUp:g.nothing}
|
|
23
|
+
@pointercancel=${u?this.onPointerUp:g.nothing}
|
|
24
|
+
@wheel=${s||a?this.onWheel:g.nothing}
|
|
25
|
+
@dblclick=${s||a?()=>a?this.setView(void 0):this.setZoom(void 0):g.nothing}
|
|
26
|
+
@click=${this.onClick}
|
|
27
|
+
@keydown=${d?this.onKeyDown:g.nothing}
|
|
28
|
+
@blur=${()=>{this.focused=null,this.highlight(null)}}
|
|
29
|
+
>
|
|
30
|
+
<title>${i}</title>
|
|
31
|
+
${o.description?g.svg`<desc id=${(0,y.ifDefined)(f)}>${o.description}</desc>`:g.nothing}
|
|
32
|
+
${k?g.svg`<style>${et}</style>`:g.nothing} ${Jt(o)}
|
|
33
|
+
${ce(o.shapes)}
|
|
34
|
+
${ce(this.tip.length||!this.crossState?this.tip:ze(o,this.crossState))}
|
|
35
|
+
${ce(Ze(o,this.focused))} ${ce(this.overlay)}
|
|
36
|
+
</svg>
|
|
37
|
+
${I?g.html`<div
|
|
38
|
+
role="tooltip"
|
|
39
|
+
data-skdx-tooltip=${r}
|
|
40
|
+
style="left:${I.x+12}px;top:${I.y+12}px"
|
|
41
|
+
>
|
|
42
|
+
${I.lines.map(C=>g.html`<div>${C}</div>`)}
|
|
43
|
+
</div>`:g.nothing}
|
|
44
|
+
${M?g.html`<table data-skdx-table=${r}>
|
|
45
|
+
<caption>
|
|
46
|
+
${S}
|
|
47
|
+
</caption>
|
|
48
|
+
<thead>
|
|
49
|
+
<tr>
|
|
50
|
+
${(M[0]??[]).map(C=>g.html`<th scope="col">${C}</th>`)}
|
|
51
|
+
</tr>
|
|
52
|
+
</thead>
|
|
53
|
+
<tbody>
|
|
54
|
+
${M.slice(1).map(C=>g.html`<tr>
|
|
55
|
+
${C.map((P,B)=>B===0?g.html`<th scope="row">${P}</th>`:g.html`<td>${P}</td>`)}
|
|
56
|
+
</tr>`)}
|
|
57
|
+
</tbody>
|
|
58
|
+
</table>`:g.nothing}`}};b.styles=g.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
|
+
`,h([(0,p.property)({type:Number})],b.prototype,"width",2),h([(0,p.property)({type:Number})],b.prototype,"height",2),h([(0,p.property)()],b.prototype,"label",2),h([(0,p.property)({type:Boolean,reflect:!0})],b.prototype,"legend",2),h([(0,p.property)({type:Boolean,attribute:"no-tooltip",converter:Qt})],b.prototype,"tooltip",2),h([(0,p.property)({attribute:!1})],b.prototype,"format",2),h([(0,p.property)({attribute:!1})],b.prototype,"palette",2),h([(0,p.property)({attribute:!1})],b.prototype,"hiddenSeries",2),h([(0,p.property)({attribute:!1})],b.prototype,"selected",2),h([(0,p.property)({attribute:"selection-mode"})],b.prototype,"selectionMode",2),h([(0,p.property)({attribute:!1})],b.prototype,"highlighted",2),h([(0,p.property)({attribute:!1})],b.prototype,"highlightScope",2),h([(0,p.property)({type:Boolean,reflect:!0})],b.prototype,"loading",2),h([(0,p.property)()],b.prototype,"error",2),h([(0,p.property)({attribute:"empty-message"})],b.prototype,"emptyMessage",2),h([(0,p.property)()],b.prototype,"description",2),h([(0,p.property)({type:Boolean,reflect:!0})],b.prototype,"decorative",2),h([(0,p.property)({type:Boolean,attribute:"accessible-table"})],b.prototype,"accessibleTable",2),h([(0,p.property)({attribute:!1})],b.prototype,"zoom",2),h([(0,p.property)({attribute:!1})],b.prototype,"view",2),h([(0,p.property)({type:Boolean,reflect:!0})],b.prototype,"zoomable",2),h([(0,p.property)({type:Boolean,reflect:!0})],b.prototype,"editable",2),h([(0,p.property)({attribute:"sync-id"})],b.prototype,"syncId",2),h([(0,p.property)({type:Boolean,attribute:"cross-filter"})],b.prototype,"crossFilter",2),h([(0,p.property)({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],b.prototype,"animated",2),h([(0,p.property)({type:Boolean,reflect:!0})],b.prototype,"responsive",2),h([(0,p.state)()],b.prototype,"tip",2),h([(0,p.state)()],b.prototype,"overlay",2),h([(0,p.state)()],b.prototype,"portal",2),h([(0,p.state)()],b.prototype,"measured",2),h([(0,p.state)()],b.prototype,"viewState",2),h([(0,p.state)()],b.prototype,"highlightState",2),h([(0,p.state)()],b.prototype,"crossState",2),h([(0,p.state)()],b.prototype,"focused",2),h([(0,p.state)()],b.prototype,"hiddenState",2),h([(0,p.state)()],b.prototype,"zoomState",2),h([(0,p.state)()],b.prototype,"selectedState",2);var v=class extends b{constructor(){super(...arguments);this.series=[];this.labels=!1;this.connectNulls=!1;this.stacked=!1;this.brush=!1;this.crosshair=!1}input(){let{series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:a,annotations:l,labels:c,curve:u,connectNulls:d,nulls:f,stacked:k,stackOffset:M,orientation:S,radius:I,barGap:C,barWidth:P,sort:B,transform:m,transforms:T,bins:$,binWidth:O,binDomain:R,binMode:z,sampling:A,brush:ue,crosshair:de}=this;return{...this.sized(),series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:a,annotations:l,labels:c,curve:u,connectNulls:d,nulls:f,stacked:k,stackOffset:M,orientation:S,radius:I,barGap:C,barWidth:P,sort:B,transform:m,transforms:T,bins:$,binWidth:O,binDomain:R,binMode:z,sampling:A,brush:ue,crosshair:de}}};h([(0,p.property)({attribute:!1})],v.prototype,"series",2),h([(0,p.property)({attribute:!1})],v.prototype,"categories",2),h([(0,p.property)({attribute:!1})],v.prototype,"xAxis",2),h([(0,p.property)({attribute:!1})],v.prototype,"yAxis",2),h([(0,p.property)({attribute:!1})],v.prototype,"rightAxis",2),h([(0,p.property)({attribute:!1})],v.prototype,"references",2),h([(0,p.property)({attribute:!1})],v.prototype,"annotations",2),h([(0,p.property)({type:Boolean,reflect:!0})],v.prototype,"labels",2),h([(0,p.property)()],v.prototype,"curve",2),h([(0,p.property)({type:Boolean,attribute:"connect-nulls"})],v.prototype,"connectNulls",2),h([(0,p.property)()],v.prototype,"nulls",2),h([(0,p.property)({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],v.prototype,"stacked",2),h([(0,p.property)({attribute:"stack-offset"})],v.prototype,"stackOffset",2),h([(0,p.property)()],v.prototype,"orientation",2),h([(0,p.property)({type:Number})],v.prototype,"radius",2),h([(0,p.property)({type:Number,attribute:"bar-gap"})],v.prototype,"barGap",2),h([(0,p.property)({type:Number,attribute:"bar-width"})],v.prototype,"barWidth",2),h([(0,p.property)()],v.prototype,"sort",2),h([(0,p.property)()],v.prototype,"transform",2),h([(0,p.property)({attribute:!1})],v.prototype,"transforms",2),h([(0,p.property)({type:Number})],v.prototype,"bins",2),h([(0,p.property)({type:Number,attribute:"bin-width"})],v.prototype,"binWidth",2),h([(0,p.property)({attribute:!1})],v.prototype,"binDomain",2),h([(0,p.property)({attribute:"bin-mode"})],v.prototype,"binMode",2),h([(0,p.property)({attribute:!1})],v.prototype,"sampling",2),h([(0,p.property)({type:Boolean,reflect:!0})],v.prototype,"brush",2),h([(0,p.property)({type:Boolean,reflect:!0})],v.prototype,"crosshair",2);var Jt=e=>e.defs&&e.defs.length?g.svg`<defs>${e.defs.map(n=>g.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=>g.svg`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${(0,y.ifDefined)(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:g.nothing,ce=e=>g.svg`${e.map((n,t)=>{let r=n.title?g.svg`<title>${n.title}</title>`:g.nothing,i=n.item?t:void 0;switch(n.kind){case"path":return g.svg`<path data-skdx-part=${n.part} data-skdx-i=${(0,y.ifDefined)(i)} d=${n.d} fill=${n.fill??"none"} stroke=${(0,y.ifDefined)(n.stroke)} stroke-width=${(0,y.ifDefined)(n.strokeWidth)} stroke-linecap=${(0,y.ifDefined)(n.strokeLinecap)} stroke-linejoin=${(0,y.ifDefined)(n.strokeLinejoin)} stroke-dasharray=${(0,y.ifDefined)(n.dash)} opacity=${(0,y.ifDefined)(n.opacity)} fill-opacity=${(0,y.ifDefined)(n.fillOpacity)}>${r}</path>`;case"rect":return g.svg`<rect data-skdx-part=${n.part} data-skdx-i=${(0,y.ifDefined)(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${(0,y.ifDefined)(n.rx)} fill=${n.fill} stroke=${(0,y.ifDefined)(n.stroke)} fill-opacity=${(0,y.ifDefined)(n.opacity)}>${r}</rect>`;case"line":return g.svg`<line data-skdx-part=${n.part} data-skdx-i=${(0,y.ifDefined)(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${(0,y.ifDefined)(n.strokeWidth)} stroke-dasharray=${(0,y.ifDefined)(n.dash)} opacity=${(0,y.ifDefined)(n.opacity)}>${r}</line>`;case"circle":return g.svg`<circle data-skdx-part=${n.part} data-skdx-i=${(0,y.ifDefined)(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${(0,y.ifDefined)(n.stroke)} opacity=${(0,y.ifDefined)(n.opacity)}>${r}</circle>`;case"text":return g.svg`<text data-skdx-part=${n.part} data-skdx-i=${(0,y.ifDefined)(i)} x=${n.x} y=${n.y} text-anchor=${(0,y.ifDefined)(n.anchor)} dominant-baseline=${(0,y.ifDefined)(n.baseline)} fill=${(0,y.ifDefined)(n.fill)} font-weight=${(0,y.ifDefined)(n.weight)} pointer-events=${(0,y.ifDefined)(i===void 0?"none":void 0)} transform=${(0,y.ifDefined)(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var L=class extends b{constructor(){super(...arguments);this.dimensions=[];this.data=[];this.connectNulls=!1}render(){let{dimensions:t,data:r,opacity:i,curve:o,connectNulls:s,filters:a}=this;return this.root(nt({...this.sized(),dimensions:t,data:r,opacity:i,curve:o,connectNulls:s,filters:a}),"parallel",this.label??"Parallel coordinates chart")}};h([(0,G.property)({attribute:!1})],L.prototype,"dimensions",2),h([(0,G.property)({attribute:!1})],L.prototype,"data",2),h([(0,G.property)({type:Number})],L.prototype,"opacity",2),h([(0,G.property)()],L.prototype,"curve",2),h([(0,G.property)({type:Boolean,reflect:!0,attribute:"connect-nulls"})],L.prototype,"connectNulls",2),h([(0,G.property)({attribute:!1})],L.prototype,"filters",2),L=h([(0,G.customElement)("skdx-parallel-coordinates-chart")],L);0&&(module.exports={SkdxParallelCoordinatesChart});
|
package/dist/parallel.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
var Ot=Object.defineProperty;var At=Object.getOwnPropertyDescriptor;var h=(e,n,t,r)=>{for(var i=r>1?void 0:r?At(n,t):n,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=(r?s(n,t,i):s(i))||i);return r&&i&&Ot(n,t,i),i};import{customElement as en,property as K}from"lit/decorators.js";var ot=e=>Number(e.toPrecision(12)),Lt,Pt=e=>(Lt??(Lt=new Intl.NumberFormat)).format(ot(e)),Bt=e=>{let n=Math.round(Math.abs(e)),t=e<0?"-":"",r=Math.floor(n/3600),i=Math.floor(n%3600/60),o=s=>String(s).padStart(2,"0");return r>0?`${t}${r}h ${o(i)}m`:i>0?`${t}${i}m ${o(n%60)}s`:`${t}${n}s`};function st(e){if(e===void 0)return Pt;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:i="",timeZone:o}=e,s=u=>i?d=>u(d)+i:u,a=u=>r===void 0?u===void 0?{}:{maximumFractionDigits:u}:{minimumFractionDigits:r,maximumFractionDigits:r},l=u=>{let d=new Intl.NumberFormat(t,u);return s(p=>d.format(ot(p)))},c=u=>{let d=new Intl.DateTimeFormat(t,o?{...u,timeZone:o}:u);return p=>d.format(p)};switch(n){case"integer":return l({maximumFractionDigits:0});case"decimal":return l(a(2));case"percent":return l({style:"percent",...a(0)});case"currency":return l({style:"currency",currency:e.currency??"USD",...a()});case"compact":return l({notation:"compact",...a(1)});case"scientific":return l({notation:"scientific",...a(2)});case"date":return c({dateStyle:"medium"});case"time":return c({timeStyle:"short"});case"datetime":return c({dateStyle:"medium",timeStyle:"short"});case"duration":return s(Bt)}}function fe([e,n],[t,r]){let i=n-e;return o=>i===0?t:t+(o-e)/i*(r-t)}function me(e,n,t=5){if(e===n)return[e];let r=(n-e)/Math.max(1,t),i=10**Math.floor(Math.log10(r)),o=r/i,s=(o<1.5?1:o<3.5?2:o<7.5?5:10)*i,a=Math.floor(e/s)*s,l=Math.ceil(n/s)*s,c=[];for(let u=a;u<=l+s/2;u+=s)c.push(Rt(u));return c}var Rt=e=>Number(e.toPrecision(12)),b=e=>Number(e.toFixed(2)),ge=e=>typeof e=="number"&&Number.isFinite(e);function be(e){let n=1/0,t=-1/0;for(let r of e)ge(r)&&(r<n&&(n=r),r>t&&(t=r));return n===1/0?[0,0]:[n,t]}function at(e,n="linear"){if(e.length===0)return"";let t=e[0];if(n==="step"||n==="stepBefore"||n==="stepAfter"){let c=`M${t.x} ${t.y}`;for(let u=1;u<e.length;u++){let d=e[u-1],p=e[u];n==="stepAfter"?c+=`H${p.x}V${p.y}`:n==="stepBefore"?c+=`V${p.y}H${p.x}`:c+=`H${b((d.x+p.x)/2)}V${p.y}H${p.x}`}return c}if(n==="linear"||e.length<3)return`M${e.map(c=>`${c.x} ${c.y}`).join("L")}`;let r=e.length,i=e.slice(1).map((c,u)=>c.x-e[u].x),o=e.slice(1).map((c,u)=>c.y-e[u].y),s=i.map((c,u)=>c===0?0:o[u]/c),a=[s[0]];for(let c=1;c<r-1;c++){let u=s[c-1],d=s[c];a.push(u*d<=0?0:(u+d)/2)}a.push(s[r-2]);for(let c=0;c<r-1;c++){let u=s[c];if(u===0){a[c]=0,a[c+1]=0;continue}let d=a[c]/u,p=a[c+1]/u,w=Math.hypot(d,p);w>3&&(a[c]=3*d*u/w,a[c+1]=3*p*u/w)}let l=`M${t.x} ${t.y}`;for(let c=0;c<r-1;c++){let u=e[c],d=e[c+1],p=i[c]/3;l+=`C${b(u.x+p)} ${b(u.y+p*a[c])} ${b(d.x-p)} ${b(d.y-p*a[c+1])} ${d.x} ${d.y}`}return l}var Y=1e3,q=60*Y,X=60*q,ne=24*X,rn=[Y,5*Y,15*Y,30*Y,q,5*q,15*q,30*q,X,3*X,6*X,12*X,ne,2*ne,7*ne,14*ne];var Nt=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,Dt=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,Gt={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function Ft(e,n,t){return e.replace(Dt,(r,i,o)=>{let s=Gt[i];if(s===void 0)return i+o;let l=(o.match(Nt)??[]).map((c,u)=>{let d=Number(c);if(s===-1)return String(d+n);if(s===-2)return String(d+t);let p=u%s;return s===7?p===5?String(d+n):p===6?String(d+t):c:String(p%2===0?d+n:d+t)});return i+l.join(" ")})}var lt=(e,n,t)=>e.map(r=>{switch(r.kind){case"rect":return{...r,x:r.x+n,y:r.y+t};case"circle":return{...r,cx:r.cx+n,cy:r.cy+t};case"line":return{...r,x1:r.x1+n,x2:r.x2+n,y1:r.y1+t,y2:r.y2+t};case"text":return{...r,x:r.x+n,y:r.y+t};case"path":return{...r,d:Ft(r.d,n,t)}}});var xe=["primary","success","warning","danger","neutral"].flatMap(e=>[500,700].map(n=>`var(--skdx-color-${e}-${n})`)).sort((e,n)=>Number(e.endsWith("700)"))-Number(n.endsWith("700)"))),v={axis:"var(--skdx-color-border-strong)",grid:"var(--skdx-color-border-subtle)",label:"var(--skdx-color-text-muted)",focus:"var(--skdx-color-focus-ring)",positive:"var(--skdx-color-success-500)",negative:"var(--skdx-color-danger-500)",fontFamily:"var(--skdx-font-family)",fontSize:"var(--skdx-font-size-xs)"};var ct=(e,n)=>n??xe[e%xe.length];var jt={top:16,right:16,bottom:32,left:48};function ut(e,n,t=jt){return{x:t.left,y:t.top,width:Math.max(0,e-t.left-t.right),height:Math.max(0,n-t.top-t.bottom)}}function Q(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function dt(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var re=20,Ht=120,ht=e=>{let n=Q(e);return n&&(n.position==="left"||n.position==="right")?n.width??Ht:0},ve=(e,n=600,t=300)=>({width:(e.width??n)-ht(e),height:(e.height??t)-(Q(e)?.position==="bottom"?re:0)}),pt=e=>{let n=Q(e);return n&&(n.position===void 0||n.position==="top")?re:0},Z=6.5,ie=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:ct(n)),ft=(e,n)=>e.hiddenSeries?.includes(n)??!1;function ye(e,n,t=[],r={},i=10,o=8,s=!1){let a=[],l=r.maxItems,c=l!==void 0&&l>=0&&e.length>l?e.slice(0,l):e,u=e.length-c.length,d=r.interactive??!0,p=o,w=i,k=(S,I,C,B)=>{let N=(I?18:4)+S.length*Z;p>o&&(s||p+N>n-8)&&(p=o,w+=re),I&&a.push({kind:"rect",part:"legend-swatch",x:p,y:w-5,width:10,height:10,fill:I,opacity:B?.3:void 0,item:C}),a.push({kind:"text",part:"legend-label",x:p+(I?14:0),y:w,text:S,baseline:"middle",fill:B?v.grid:v.label,item:C}),p+=N+12};for(let S of c){let I=t.includes(S.name),C=d?{label:S.name,series:S.name,legend:!0}:void 0;k(r.formatter?.(S.name)??S.name,S.color,C,I)}return u>0&&k(`+${u} more`,void 0,void 0,!1),r.align==="end"?Vt(a,n):a}function Vt(e,n){let t=new Map;for(let i of e){let o=i.kind==="rect"?i.y+5:i.y;t.set(o,[...t.get(o)??[],i])}let r=[];for(let i of t.values()){let o=Math.max(...i.map(a=>a.kind==="rect"?a.x+a.width:a.x+a.text.length*Z)),s=n-8-o;for(let a of i)r.push({...a,x:a.x+s})}return r}var Zt=(e,n,t={})=>new Set(ye(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function we(e,n,t,r=[]){let i=Q(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,s=dt(e),a=o?.position==="bottom",l=ht(e),c=e.hiddenSeries??[],u=o?l?ye(r,1/0,c,o,10,(o.position==="right"?n:0)+8,!0):ye(r,n,c,o,a?t+10:10):[],d=a?Zt(r,n,o):0;return{width:n+l,height:a?t+Math.max(1,d)*re:t,legendOffset:o?.position==="left"?l:void 0,tooltip:s.enabled,tooltipFormatter:s.formatter,axisTooltipFormatter:s.axisFormatter,tooltipPortal:s.portal,tooltipPlacement:s.placement,tooltipAnchored:s.followPointer===!1?!0:void 0,description:e.description,decorative:e.decorative,animate:e.animate===!0?300:e.animate||void 0,responsive:!!e.responsive,shapes:u}}function ke(e){let n=e.legendOffset;if(!n)return e;let t=[...lt(e.shapes.filter(l=>!l.part.startsWith("legend-")),n,0),...e.shapes.filter(l=>l.part.startsWith("legend-"))],r=l=>({...l,x:l.x+n}),i=e.hit?{...e.hit,plot:r(e.hit.plot),xs:e.hit.xs.map(l=>l+n),brush:e.hit.brush?{box:r(e.hit.brush.box),window:r(e.hit.brush.window)}:void 0}:void 0,o=e.edit,s=o?{...o,scale:l=>o.scale(l)+n,invert:l=>o.invert(l-n),bars:o.bars.map(l=>({...l,x0:l.x0+n,x1:l.x1+n}))}:void 0,a=e.map?{...e.map,plot:r(e.map.plot)}:void 0;return{...e,shapes:t,hit:i,edit:s,map:a,legendOffset:void 0}}function oe(e,n,t,r,i,o="auto"){let s=Array.isArray(t)?t:[t],a=Math.max(...s.map(p=>p.length))*Z+12,l=6+s.length*16,c=o==="top"?{x:e-a/2,y:n-l-8}:o==="bottom"?{x:e-a/2,y:n+8}:o==="left"?{x:e-a-8,y:n-l/2}:o==="right"?{x:e+8,y:n-l/2}:{x:e+12,y:n-l-6},u=Math.max(0,Math.min(r-a,c.x)),d=Math.max(0,Math.min(i-l,c.y));return[{kind:"rect",part:"tooltip",x:b(u),y:b(d),width:b(a),height:l,fill:"var(--skdx-color-surface-raised)",stroke:v.axis,rx:3},...s.map((p,w)=>({kind:"text",part:"tooltip-label",x:b(u+6),y:b(d+11+w*16),text:p,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:s.length>1&&w===0?"bold":void 0}))]}function mt(e,n,t,r){let i=e.error!==void 0?"error":e.loading?"loading":n?"empty":null;if(!i)return null;let{width:o,height:s}=ve(e,t,r),a=i==="error"?e.error:i==="loading"?"Loading\u2026":e.emptyMessage??"No data available",l=[];return i==="loading"&&l.push({kind:"rect",part:"skeleton",x:0,y:0,width:o,height:s,fill:"var(--skdx-color-surface-sunken)",rx:4}),l.push({kind:"text",part:`state-${i}`,x:b(o/2),y:b(s/2),text:a,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":v.label}),{...we(e,o,s),shapes:l,tooltip:!1}}var Me=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:v.label,...r});function se(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var Se=e=>e.id??e.name??e.series,gt=e=>e.seriesId??e.series;function G(e,n){let t=!1;return n.id!==void 0&&(t=!0,Se(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,gt(e)!==n.series&&e.series!==n.series)||n.index!==void 0&&(t=!0,e.index!==n.index)||n.category!==void 0&&(t=!0,e.category!==n.category)?!1:t}function j(e){let n={},t=Se(e);t!==void 0&&(n.id=t);let r=gt(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var $e=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function Ce(e,n,t){let r=se(e),i=j(n),o=r.some(s=>G(n,s));return t==="single"?o?[]:[i]:o?r.filter(s=>!G(n,s)):[...r,i]}var _t=.2;function Wt(e){let n=v.focus;switch(e.kind){case"rect":return{kind:"rect",part:"selected",x:e.x-1.5,y:e.y-1.5,width:e.width+3,height:e.height+3,fill:"none",stroke:n,rx:e.rx};case"circle":return{kind:"circle",part:"selected",cx:e.cx,cy:e.cy,r:e.r+2.5,fill:"none",stroke:n};case"path":return{kind:"path",part:"selected",d:e.d,fill:"none",stroke:n,strokeWidth:2.5};case"line":return{...e,part:"selected",stroke:n,strokeWidth:(e.strokeWidth??1)+3,title:void 0,item:void 0};case"text":return}}var Et=(e,n)=>e.kind==="text"?{...e,fill:v.grid}:{...e,opacity:(e.opacity??1)*n};function Ie(e,n){let t=se(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:se(n.highlighted),i=r[0];if(t.length===0&&!i)return e;let o={highlighted:n.highlightScope?.highlighted??"item",faded:n.highlightScope?.faded??"global"},s=[],a=u=>!i||r.some(d=>G(u,d))?!0:o.highlighted==="series"?r.some(d=>d.series!==void 0&&G(u,{series:d.series})):!1,l=u=>{if(!i||o.faded==="none"||a(u))return!1;if(o.faded==="series"){let d=i.series;return d!==void 0&&G(u,{series:d})}return!0},c=e.shapes.map(u=>{let d=u.item;if(!d||d.legend)return u;if(t.some(p=>G(d,p))){let p=Wt(u);p&&s.push(p)}return l(d)?Et(u,_t):u});return s.length?{...e,shapes:[...c,...s]}:{...e,shapes:c}}function U(e,n,t,r,i){let o=e.getBoundingClientRect();return{x:o.width?(n-o.left)*r/o.width:n,y:o.height?(t-o.top)*i/o.height:t}}var Te=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function bt(e,n){let t=0,r=1/0;return e.xs.forEach((i,o)=>{let s=Math.abs(i-n);s<r&&(r=s,t=o)}),t}function J(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=bt(t,n),i=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(i,r)??i}}function ze(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[bt(t,n)];return{kind:"line",part:"crosshair",x1:r,x2:r,y1:t.plot.y,y2:t.plot.y+t.plot.height,stroke:v.axis,dash:"3 3"}}function Oe(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!Te(r.plot,n,t))return[];let i=ze(e,n),{rows:o}=J(e,n),s=e.tooltipAnchored?r.plot.y+8:t;return[i,...oe(i.x1,s,o,e.width,e.height,e.tooltipPlacement)]}function Ae(e,n){let t=e.hit;if(!t||t.xs.length===0)return[];let r=t.rows.findIndex(o=>o[0]===n);if(r<0)return[];let i=t.xs[r];return Oe(e,i,t.plot.y+8)}function Le(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:l,y:c}=U(t,r,i,e.width,e.height);if(Te(e.hit.plot,l,c)){let u=J(e,l),d=ze(e,l);if(u&&d)return{lines:u.rows,shapes:[d]}}}let o=n?.closest?.("[data-skdx-part]"),s=e.tooltipFormatter?H(e,n)?.item:void 0,a=s&&e.tooltipFormatter?.(s)||o&&Array.from(o.children).find(l=>l.tagName.toLowerCase()==="title")?.textContent;return a?{lines:Array.isArray(a)?a:[a],shapes:[]}:{lines:[],shapes:[]}}function xt(e,n,t,r,i,o,s){let a=e?.closest?.("[data-skdx-part]"),l=s&&s.tooltipFormatter?H(s,e)?.item:void 0,c=l&&s?.tooltipFormatter?.(l)||a&&Array.from(a.children).find(k=>k.tagName.toLowerCase()==="title")?.textContent;if(!c)return[];let u=s?.tooltipAnchored?H(s,e):void 0,d=u?s?.shapes[u.index]:void 0,{x:p,y:w}=d?ee(d):U(n,t,r,i,o);return oe(p,w,c,i,o,s?.tooltipPlacement)}function Pe(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:s}=U(t,r,i,e.width,e.height),a=Oe(e,o,s);if(a.length>0)return a}return xt(n,t,r,i,e.width,e.height,e)}function Be(e,n){let t=H(e,n);return t&&!t.item.legend?j(t.item):null}var Ut=(e,n)=>{let{x:t,y:r}=ee(e),i=e.kind==="circle"?e.cy:e.kind==="rect"?e.y+e.height/2:r;return t>=n.x&&t<=n.x+n.width&&i>=n.y&&i<=n.y+n.height};function Re(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!Ut(i,n))continue;let o=j(i.item),s=JSON.stringify(o);t.has(s)||(t.add(s),r.push(o))}return r}var Ne=e=>({kind:"rect",part:"selection-box",x:b(e.x),y:b(e.y),width:b(e.width),height:b(e.height),fill:v.focus,opacity:.12,stroke:v.focus}),le=(e,n,t,r)=>({x:Math.min(e,t),y:Math.min(n,r),width:Math.abs(t-e),height:Math.abs(r-n)});function yt(e,n,t){let r=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){let s=e[i],a=e[o];s.y>t!=a.y>t&&n<(a.x-s.x)*(t-s.y)/(a.y-s.y)+s.x&&(r=!r)}return r}function De(e,n){if(n.length<3)return[];let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor")continue;let{x:o,y:s}=ee(i),a=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:s;if(!yt(n,o,a))continue;let l=j(i.item),c=JSON.stringify(l);t.has(c)||(t.add(c),r.push(l))}return r}var Ge=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${b(n.x)} ${b(n.y)}`).join("L")}`:"",fill:v.focus,fillOpacity:.12,stroke:v.focus,dash:"4 3"}),ae=6;function Fe(e,n,t){let r=e.edit;if(r){for(let i of r.bars)if(!(t<i.y||t>i.y+i.height||n<i.x0-ae||n>i.x1+ae))return Math.abs(n-i.x0)<=ae?{bar:i,mode:"start"}:Math.abs(n-i.x1)<=ae?{bar:i,mode:"end"}:{bar:i,mode:"move"}}}function je(e,n,t){let r=e.edit;return vt(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function He(e,n,t){let r=e.edit,i=t.key==="ArrowRight"?1:t.key==="ArrowLeft"?-1:0;if(!r||n===null||!i||!(t.shiftKey||t.altKey))return;let o=r.bars.find(l=>l.index===n);if(!o)return;let s=t.altKey?t.shiftKey?"start":"end":"move",a=r.snap??r.invert(o.x0+10)-r.invert(o.x0);return vt(r,{bar:o,mode:s},i*a)}function vt(e,{bar:n,mode:t},r){let i=a=>e.snap?Math.round(a/e.snap)*e.snap:a,o=n.start,s=n.end;return t==="move"?(o=i(n.start+r),s=o+(n.end-n.start)):t==="start"?o=Math.min(i(n.start+r),n.end):s=Math.max(i(n.end+r),n.start),{id:n.id,name:n.name,start:o,end:s}}function Ve(e,n,t){let r=e.edit,i=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:b(Math.min(i,o)),y:b(n.bar.y),width:b(Math.max(1,Math.abs(o-i))),height:b(n.bar.height),fill:v.focus,opacity:.25,stroke:v.focus,rx:2}}var Kt=64,Yt=e=>Math.max(1,Math.min(Kt,e));function Ze(e,n,t,r){let i=n>0?.8:1.25,o=Yt(e.view.zoom*i);if(o===e.view.zoom)return e.view;let{plot:s,scale:a}=e,[l,c]=e.view.center,u=(t-(s.x+s.width/2))/a,d=(r-(s.y+s.height/2))/a,p=e.view.zoom/o;return{center:[l+u*(1-p),e.fromY(e.toY(c)-d*(1-p))],zoom:o}}function _e(e,n,t,r){let{scale:i}=e;return{center:[n.center[0]-t/i,e.fromY(e.toY(n.center[1])+r/i)],zoom:n.zoom}}function H(e,n){let t=n?.closest?.("[data-skdx-i]"),r=Number(t?.getAttribute("data-skdx-i")),i=Number.isInteger(r)?e.shapes[r]?.item:void 0;return i?{index:r,item:i}:void 0}var ce=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function ee(e){switch(e.kind){case"rect":return{x:e.x+e.width/2,y:e.y};case"circle":return{x:e.cx,y:e.cy-e.r};case"line":return{x:(e.x1+e.x2)/2,y:Math.min(e.y1,e.y2)};case"text":return{x:e.x,y:e.y};case"path":{let n=/M\s*(-?[\d.]+)[ ,](-?[\d.]+)/.exec(e.d);return n?{x:Number(n[1]),y:Number(n[2])}:{x:0,y:0}}}}function We(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let r=v.focus,i;switch(t.kind){case"rect":i={kind:"rect",part:"focus",x:t.x-2,y:t.y-2,width:t.width+4,height:t.height+4,fill:"none",stroke:r,rx:2};break;case"circle":i={kind:"circle",part:"focus",cx:t.cx,cy:t.cy,r:t.r+3,fill:"none",stroke:r};break;case"line":i={kind:"line",part:"focus",x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:r,strokeWidth:4};break;case"text":i={kind:"rect",part:"focus",x:t.x-2,y:t.y-8,width:t.text.length*Z+4,height:16,fill:"none",stroke:r,rx:2};break;case"path":i={kind:"path",part:"focus",d:t.d,stroke:r,strokeWidth:2,fill:"none"};break}let{x:o,y:s}=ee(t),a=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...a?oe(b(o),b(s),a,e.width,e.height):[]]}function Ee(e,n,t){let r=ce(e);if(r.length===0)return;let i=n===null?-1:r.indexOf(n);switch(t){case"ArrowRight":case"ArrowDown":return r[Math.min(r.length-1,i+1)];case"ArrowLeft":case"ArrowUp":return r[Math.max(0,i<=0?0:i-1)];case"Home":return r[0];case"End":return r[r.length-1];case"Escape":return null;default:return}}var W=2,E=(e,n,t)=>{let r=Math.max(W,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},wt=(e,n)=>!e||e.start<=0&&e.end>=n;function Ue(e,n,t){if(e.count<=W||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,s=n>0?1.25:.8,a=Math.max(W,Math.min(e.count,Math.round(o*s)));if(a===o)return n>0&&!wt(e.zoom,e.count)?E(r,a,e.count):void 0;let l=Math.max(0,Math.min(1,(t-e.plot.x)/e.plot.width)),c=r+l*o;return E(c-l*a,a,e.count)}function Ke(e,n,t,r){let i=n.end-n.start,o=Math.max(W,Math.min(e.count,Math.round(i/Math.max(.05,t)))),s=Math.max(0,Math.min(1,(r-e.plot.x)/Math.max(1,e.plot.width)));return E(n.start+s*i-s*o,o,e.count)}function Ye(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return E(n.start-t/i,r,e.count)}function qe(e,n,t){let r=e.brush;if(!r||!Te(r.box,n,t))return;let i=r.window;if(Math.abs(n-i.x)<=6)return{grab:"left",zoom:e.zoom};if(Math.abs(n-(i.x+i.width))<=6)return{grab:"right",zoom:e.zoom};if(n>i.x&&n<i.x+i.width)return{grab:"move",zoom:e.zoom};let o=e.zoom.end-e.zoom.start,s=(n-r.box.x)/Math.max(1,r.box.width)*e.count;return{grab:"move",zoom:E(s-o/2,o,e.count)}}function Xe(e,n,t,r){let i=e.brush;if(!i)return t;let o=r/Math.max(1,i.box.width)*e.count;if(n==="move")return E(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-W,Math.round(t.start+o))),end:t.end};let s=Math.min(e.count,Math.max(t.start+W,Math.round(t.end+o)));return{start:t.start,end:s}}function Je(e,n){switch(n.type){case"svg":return Promise.resolve(Qe(e,n.label,n.resolve));case"csv":return Promise.resolve($t(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=Qe(e,n.label,n.resolve);return St(t,e.width,e.height,n.scale,n.background)}}}var F=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/"/g,"""),te=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${F(String(t))}"`).join("");function kt(e){let n=e.title?`<title>${F(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${te([t,["d",e.d],["fill",e.fill??"none"],["stroke",e.stroke],["stroke-width",e.strokeWidth],["stroke-linecap",e.strokeLinecap],["stroke-linejoin",e.strokeLinejoin],["stroke-dasharray",e.dash],["opacity",e.opacity],["fill-opacity",e.fillOpacity]])}>${n}</path>`;case"rect":return`<rect${te([t,["x",e.x],["y",e.y],["width",e.width],["height",e.height],["rx",e.rx],["fill",e.fill],["stroke",e.stroke],["fill-opacity",e.opacity]])}>${n}</rect>`;case"line":return`<line${te([t,["x1",e.x1],["y1",e.y1],["x2",e.x2],["y2",e.y2],["stroke",e.stroke],["stroke-width",e.strokeWidth],["stroke-dasharray",e.dash],["opacity",e.opacity]])}>${n}</line>`;case"circle":return`<circle${te([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${te([t,["x",e.x],["y",e.y],["text-anchor",e.anchor],["dominant-baseline",e.baseline],["fill",e.fill],["font-weight",e.weight],["transform",e.rotate?`rotate(${e.rotate} ${e.x} ${e.y})`:void 0]])}>${F(e.text)}</text>`}}function Mt(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${F(t.id)}" x1="0" y1="0" x2="${t.vertical===!1?1:0}" y2="${t.vertical===!1?0:1}">${t.stops.map(r=>`<stop offset="${r.offset}" stop-color="${F(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function Qe(e,n,t){let r=Mt(e)+e.shapes.map(kt).join("");return t&&(r=r.replace(/var\((--[\w-]+)\)/g,(i,o)=>t(o).trim()||i)),`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${e.width} ${e.height}" width="${e.width}" height="${e.height}" role="img" aria-label="${F(n)}" font-family="${F(v.fontFamily)}" font-size="${F(v.fontSize)}"><title>${F(n)}</title>${r}</svg>`}function St(e,n,t,r=2,i){return new Promise((o,s)=>{let a=URL.createObjectURL(new Blob([e],{type:"image/svg+xml;charset=utf-8"})),l=new Image;l.onload=()=>{URL.revokeObjectURL(a);let c=document.createElement("canvas");c.width=Math.round(n*r),c.height=Math.round(t*r);let u=c.getContext("2d");if(!u)return s(new Error("canvas 2d context unavailable"));i&&(u.fillStyle=i,u.fillRect(0,0,c.width,c.height)),u.drawImage(l,0,0,c.width,c.height),c.toBlob(d=>d?o(d):s(new Error("toBlob failed")),"image/png")},l.onerror=()=>{URL.revokeObjectURL(a),s(new Error("svg could not be decoded"))},l.src=a})}function $t(e){let n=t=>{let r=t==null?"":String(t);return/[",\n\r]/.test(r)?`"${r.replace(/"/g,'""')}"`:r};return e.map(t=>t.map(n).join(",")).join(`\r
|
|
2
|
+
`)}function et(e,n){if(!n)return;let t=typeof n=="object"?n.maxRows??500:500,r=e.hit;if(r&&r.rows.length>0){let a=r.rows[0];if(r.rows.length>t)return;let l=["",...a.slice(1).map(u=>u.replace(/:\s[^:]*$/,""))],c=r.rows.map(u=>[u[0],...u.slice(1).map(d=>d.slice(d.lastIndexOf(": ")+2))]);return[l,...c]}let i=e.shapes.flatMap(a=>a.item&&!a.item.legend&&!(a.part==="anchor"&&!a.title)?[a.item]:[]);if(i.length===0||i.length>t)return;let o=["series","name","category","value"].filter(a=>i.some(l=>l[a]!==void 0)),s=(a,l)=>a[l]===void 0?"":String(a[l]);return[o.map(a=>a[0]?.toUpperCase()+a.slice(1)),...i.map(a=>o.map(l=>s(a,l)))]}var tt=new Map;function ue(e){let n=tt.get(e);if(n)return n.group;let t=new Set,r={},i={current:r,subscribe(o){return t.add(o),()=>{t.delete(o),t.size===0&&tt.delete(e)}},publish(o,s){Object.assign(r,o);for(let a of t)a(o,s)}};return tt.set(e,{group:i,listeners:t}),i}var Ct='[data-skdx-part]:not([data-skdx-part^="tooltip"]):not([data-skdx-part="focus"]):not([data-skdx-part="crosshair"])',nt=`@keyframes skdx-in{from{opacity:0}to{opacity:1}}${Ct}{animation:skdx-in var(--skdx-chart-duration,0ms) ease-out;transition:${["x","y","width","height","cx","cy","r","opacity","fill-opacity","d"].map(e=>`${e} var(--skdx-chart-duration,0ms) ease-out`).join(",")}}@media (prefers-reduced-motion:reduce){${Ct}{animation:none;transition:none}}`;function rt(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}var It=500;function it(e){let n=[],t=e.dimensions,r=e.data.filter(m=>!(m.group!==void 0&&ft(e,m.group))),i=mt(e,t.length===0||r.length===0);if(i)return{...i,issues:n};let{width:o,height:s}=ve(e),a=[...new Set(e.data.map(m=>m.group).filter(m=>m!==void 0))],l=t[0],c=t[t.length-1],u=m=>(m.label??m.key).length*Z/2+8,d=ut(o,s,{top:28+pt(e),right:Math.max(16,u(c)),bottom:16,left:Math.max(48,u(l))}),p=(m,T)=>{let $=m.values[T];return $==null?null:ge($)?$:(n.push({code:"invalid-value",severity:"warning",message:`"${m.name}" has a value on "${T}" that is not a number; drawn as a gap.`,itemId:m.id??m.name}),null)},w=t.map((m,T)=>{let[$,O]=be(r.map(_=>p(_,m.key))),D=me(m.min??$,m.max??O),z=m.min??D[0],L=m.max??D[D.length-1],he=m.reversed?[d.y,d.y+d.height]:[d.y+d.height,d.y],pe=fe([z,L],he),Tt=b(t.length===1?d.x+d.width/2:d.x+T*d.width/(t.length-1)),zt=st(m.format??e.format);return{d:m,x:Tt,scale:_=>b(pe(Math.max(z,Math.min(L,_)))),format:zt,ticks:D.filter(_=>_>=z-1e-9&&_<=L+1e-9)}}),k=[];w.forEach((m,T)=>{k.push({kind:"line",part:"axis",x1:m.x,x2:m.x,y1:d.y,y2:d.y+d.height,stroke:v.axis});let $=T===w.length-1&&w.length>1?"start":"end";for(let O of m.ticks)k.push(Me(b($==="end"?m.x-6:m.x+6),m.scale(O),m.format(O),{part:"y-label",anchor:$,baseline:"middle"}));k.push(Me(m.x,d.y-12,m.d.label??m.d.key,{part:"axis-title",anchor:"middle"}))});let S=r.length<=It,I=e.opacity??(r.length>200?.25:.6),C=m=>(e.filters??[]).every(T=>{let $=p(m,T.key);return $!==null&&$>=(T.min??-1/0)&&$<=(T.max??1/0)}),B=r.map((m,T)=>{let $=[],O=[];for(let z of w){let L=p(m,z.d.key);if(L===null){!e.connectNulls&&O.length&&($.push(O),O=[]);continue}O.push({x:z.x,y:z.scale(L)})}O.length&&$.push(O);let D=`${m.name}: ${w.map(z=>{let L=p(m,z.d.key);return`${z.d.label??z.d.key} ${L===null?"\u2014":z.format(L)}`}).join(" \xB7 ")}`;return{kind:"path",part:"row",d:$.map(z=>at(z,e.curve)).join(""),stroke:m.color??(m.group!==void 0?ie(e,a.indexOf(m.group)):ie(e,0)),strokeWidth:1.5,strokeLinejoin:"round",opacity:C(m)?I:.08,title:S?D:void 0,item:S?{label:D,id:m.id??m.name,name:m.name,category:m.group,index:T}:void 0}}),N=we(e,o,s,a.map((m,T)=>({name:m,color:ie(e,T)})));return{...N,shapes:[...k,...B,...N.shapes],issues:n}}import{css as qt,html as V,LitElement as Xt,nothing as M,svg as A}from"lit";import{property as f,state as P}from"lit/decorators.js";import{ifDefined as y}from"lit/directives/if-defined.js";var Qt={fromAttribute:()=>!1},g=class extends Xt{constructor(){super(...arguments);this.legend=!1;this.tooltip=!0;this.selectionMode="none";this.loading=!1;this.decorative=!1;this.accessibleTable=!1;this.zoomable=!1;this.editable=!1;this.crossFilter=!1;this.animated=!1;this.responsive=!1;this.tip=[];this.overlay=[];this.portal=null;this.highlightState=null;this.crossState=null;this.lastCross=null;this.pointers=new Map;this.hover=null;this.token={};this.focused=null;this.hiddenState=[];this.drag=null;this.onPointerMove=t=>{let r=this.layout;if(!r)return;this.pointers.has(t.pointerId)&&this.pointers.set(t.pointerId,this.viewBox(t,r).x);let i=this.drag;if(i?.grab==="select"){let{x:o,y:s}=this.viewBox(t,r);this.overlay=[Ne(le(i.x,i.y,o,s))];return}if(i?.grab==="lasso"){let{x:o,y:s}=this.viewBox(t,r);i.points=[...i.points??[],{x:o,y:s}],this.overlay=[Ge(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=je(r,i.gantt,o-i.x),this.overlay=[Ve(r,i.gantt,i.change)];return}if(i?.grab==="map"){if(!r.map||!i.view)return;let{x:o,y:s}=this.viewBox(t,r);this.setView(_e(r.map,i.view,o-i.x,s-i.y));return}if(i&&r.hit){if(i.grab==="pinch"){let[s,a]=[...this.pointers.values()];if(s===void 0||a===void 0||!i.distance)return;this.setZoom(Ke(r.hit,i.zoom,Math.abs(s-a)/i.distance,(s+a)/2));return}let{x:o}=this.viewBox(t,r);this.setZoom(i.grab==="pan"?Ye(r.hit,i.zoom,o-i.x):Xe(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:s}=Le(r,t.target,t.currentTarget,t.clientX,t.clientY);this.tip=s,this.portal=o.length?{x:t.clientX,y:t.clientY,lines:o}:null}else{let o=Pe(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(Be(r,t.target)),this.syncId&&r.hit?.crosshair){let o=J(r,this.viewBox(t,r).x);this.shareCrosshair(o?r.hit.rows[o.index]?.[0]??null:null)}};this.onPointerDown=t=>{let r=this.layout;if(!r||t.button!==0)return;let{x:i,y:o}=this.viewBox(t,r),s=H(r,t.target)?.item.legend,a=this.canEdit(r)?Fe(r,i,o):void 0;if(a){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"edit",gantt:a},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.brushing()&&!s){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:this.selectionMode==="lasso"?"lasso":"select",points:[{x:i,y:o}]},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.canPan(r)&&r.map){let c=r.map.plot;if(i<c.x||i>c.x+c.width||o<c.y||o>c.y+c.height)return;this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"map",view:r.map.view},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}let l=r.hit;if(!(!l||!this.canZoom(r))){if(this.pointers.set(t.pointerId,i),this.pointers.size===2){let[c,u]=[...this.pointers.values()];this.drag={x:(c+u)/2,y:o,zoom:l.zoom,grab:"pinch",distance:Math.abs(c-u)||1}}else{let c=qe(l,i,o);if(c)this.drag={x:i,y:o,zoom:c.zoom,grab:c.grab},c.zoom!==l.zoom&&this.setZoom(c.zoom);else if(this.zoomable&&i>=l.plot.x&&i<=l.plot.x+l.plot.width&&o>=l.plot.y&&o<=l.plot.y+l.plot.height)this.drag={x:i,y:o,zoom:l.zoom,grab:"pan"};else{this.pointers.delete(t.pointerId);return}}t.currentTarget.setPointerCapture(t.pointerId),this.clearTip()}};this.onPointerUp=t=>{this.pointers.delete(t.pointerId);let r=t.currentTarget;r.hasPointerCapture(t.pointerId)&&r.releasePointerCapture(t.pointerId);let i=this.drag,o=this.layout;if(o&&(i?.grab==="select"||i?.grab==="lasso"||i?.grab==="edit"||i?.grab==="map")){this.overlay=[];let{x:s,y:a}=this.viewBox(t,o);if(Math.abs(s-i.x)>2||Math.abs(a-i.y)>2){i.grab==="select"?this.setSelected(Re(o,le(i.x,i.y,s,a))):i.grab==="lasso"?this.setSelected(De(o,i.points??[])):i.grab==="edit"&&i.change&&this.emit("skdx-task-change",i.change),this.drag={...i,distance:-1};return}this.drag=null;return}(this.pointers.size===0||this.drag?.grab==="pinch")&&(this.drag=null)};this.onWheel=t=>{let r=this.layout;if(!r)return;let{x:i,y:o}=this.viewBox(t,r);if(r.map&&this.canPan(r)){let l=r.map.plot;if(i<l.x||i>l.x+l.width||o<l.y||o>l.y+l.height)return;t.preventDefault(),this.setView(Ze(r.map,t.deltaY,i,o));return}let s=r.hit;if(!s||!this.canZoom(r)||o<s.plot.y||o>s.plot.y+s.plot.height)return;let a=Ue(s,t.deltaY,i);a&&(t.preventDefault(),this.setZoom(a))};this.onClick=t=>{if(!this.layout)return;if(this.drag?.distance===-1){this.drag=null;return}let r=H(this.layout,t.target);r&&(r.item.range?this.setZoom(r.item.range):r.item.legend&&r.item.series!==void 0?this.toggle(r.item.series):(this.select(r.item),this.emit("skdx-item-click",r.item)))};this.onKeyDown=t=>{let r=this.layout;if(!r)return;if((t.key==="Enter"||t.key===" ")&&this.focused!==null){let a=r.shapes[this.focused]?.item;a&&(t.preventDefault(),this.select(a),this.emit("skdx-item-click",a));return}let i=this.canEdit(r)?He(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=Ee(r,this.focused,t.key);if(o===void 0)return;t.preventDefault(),this.focused=o;let s=o===null?void 0:r.shapes[o]?.item;this.highlight(s?j(s):null)}}connectedCallback(){super.connectedCallback(),!(typeof ResizeObserver>"u")&&(this.observer=new ResizeObserver(([t])=>{let r=Math.floor(t?.contentRect.width??0);r>0&&(this.measured=r)}),this.observer.observe(this))}disconnectedCallback(){this.observer?.disconnect(),this.leave?.(),this.leave=void 0,this.joined=void 0,super.disconnectedCallback()}sized(){let{width:t,height:r,legend:i,tooltip:o,format:s,palette:a,loading:l,error:c,emptyMessage:u,description:d,decorative:p,animated:w,responsive:k,highlighted:S,highlightScope:I,accessibleTable:C}=this;return{...typeof k=="object"&&this.measured!==void 0&&this.measured<(k.breakpoint??480)?k.compact:void 0,width:k&&this.measured?this.measured:t,height:r,animate:w,responsive:k,legend:i,tooltip:o,format:s,palette:a,loading:l,error:c,emptyMessage:u,description:d,decorative:p,highlighted:S===void 0?this.highlightState:S,highlightScope:I,accessibleTable:C,hiddenSeries:this.hiddenSeries??this.hiddenState,zoom:this.zoom??this.zoomState,selected:this.selected??this.selectedState,view:this.view??this.viewState}}emit(t,r){this.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0}))}publish(t){this.syncId&&ue(this.syncId).publish(t,this.token)}join(){if(this.joined===this.syncId||(this.leave?.(),this.leave=void 0,this.joined=this.syncId,!this.syncId))return;let t=ue(this.syncId),r=i=>{"highlighted"in i&&(this.highlightState=i.highlighted??null),i.selected&&(this.selectedState=i.selected,this.crossFilter&&(this.highlightState=i.selected.length?i.selected:null)),"zoom"in i&&(this.zoomState=i.zoom),i.hiddenSeries&&(this.hiddenState=i.hiddenSeries),"crosshair"in i&&(this.crossState=i.crosshair??null)};r(t.current),this.leave=t.subscribe((i,o)=>{o!==this.token&&r(i)})}setZoom(t){this.zoomState=t,this.emit("skdx-zoom-change",t),this.publish({zoom:t})}setView(t){this.viewState=t,this.emit("skdx-view-change",t)}setSelected(t){this.selectedState=t,this.emit("skdx-selected-change",t),this.publish({selected:t})}toggle(t){let r=this.hiddenSeries??this.hiddenState,i=r.includes(t)?r.filter(o=>o!==t):[...r,t];this.hiddenState=i,this.emit("skdx-hidden-series-change",i),this.publish({hiddenSeries:i})}highlight(t){let r=this.hover;r===t||r&&t&&$e(r,t)||(this.hover=t,this.emit("skdx-highlighted-change",t),this.syncId&&(this.highlightState=t,this.publish({highlighted:t})))}select(t){let r=this.selectionMode;r!=="none"&&this.setSelected(Ce(this.selected??this.selectedState,t,r==="single"?"single":"multiple"))}shareCrosshair(t){!this.syncId||this.lastCross===t||(this.lastCross=t,this.publish({crosshair:t}))}clearTip(){this.tip=[],this.portal=null,this.shareCrosshair(null)}canZoom(t){return!!(t.hit&&(this.zoomable||t.hit.brush))}canPan(t){return!!(t.map&&this.zoomable)}canEdit(t){return!!(this.editable&&t.edit)}brushing(){return this.selectionMode==="brush"||this.selectionMode==="lasso"}viewBox(t,r){return U(t.currentTarget,t.clientX,t.clientY,r.width,r.height)}getSvgElement(){return this.renderRoot.querySelector("svg")}getLayout(){return this.layout}resetZoom(){this.setZoom(void 0)}zoomTo(t){this.setZoom(t)}focusItem(t){let r=this.layout;if(!r)return!1;let i=r.shapes.findIndex(o=>o.item&&!o.item.legend&&G(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?Je(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=Ie(ke(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let C of o.issues??[])this.emit("skdx-data-issue",C)}let s=this.canZoom(o),a=this.canPan(o),l=this.canEdit(o),c=this.brushing(),u=s||a||l||c,d=!o.decorative&&ce(o).length>0,p=o.description?`${r}-desc`:void 0,w=rt(o),k=et(o,this.accessibleTable),S=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,I=this.portal;return V`<svg
|
|
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}
|
|
9
|
+
aria-label=${o.decorative?M:i}
|
|
10
|
+
aria-describedby=${y(p)}
|
|
11
|
+
tabindex=${d?0:M}
|
|
12
|
+
data-skdx-chart=${r}
|
|
13
|
+
data-zoomable=${s||a?"":M}
|
|
14
|
+
data-brushing=${c&&!(s||a)?"":M}
|
|
15
|
+
data-editable=${l?"":M}
|
|
16
|
+
style=${w?`--skdx-chart-duration:${w}`:M}
|
|
17
|
+
font-family=${v.fontFamily}
|
|
18
|
+
font-size=${v.fontSize}
|
|
19
|
+
@pointermove=${o.tooltip||u?this.onPointerMove:M}
|
|
20
|
+
@pointerleave=${()=>{this.clearTip(),this.highlight(null)}}
|
|
21
|
+
@pointerdown=${u?this.onPointerDown:M}
|
|
22
|
+
@pointerup=${u?this.onPointerUp:M}
|
|
23
|
+
@pointercancel=${u?this.onPointerUp:M}
|
|
24
|
+
@wheel=${s||a?this.onWheel:M}
|
|
25
|
+
@dblclick=${s||a?()=>a?this.setView(void 0):this.setZoom(void 0):M}
|
|
26
|
+
@click=${this.onClick}
|
|
27
|
+
@keydown=${d?this.onKeyDown:M}
|
|
28
|
+
@blur=${()=>{this.focused=null,this.highlight(null)}}
|
|
29
|
+
>
|
|
30
|
+
<title>${i}</title>
|
|
31
|
+
${o.description?A`<desc id=${y(p)}>${o.description}</desc>`:M}
|
|
32
|
+
${w?A`<style>${nt}</style>`:M} ${Jt(o)}
|
|
33
|
+
${de(o.shapes)}
|
|
34
|
+
${de(this.tip.length||!this.crossState?this.tip:Ae(o,this.crossState))}
|
|
35
|
+
${de(We(o,this.focused))} ${de(this.overlay)}
|
|
36
|
+
</svg>
|
|
37
|
+
${I?V`<div
|
|
38
|
+
role="tooltip"
|
|
39
|
+
data-skdx-tooltip=${r}
|
|
40
|
+
style="left:${I.x+12}px;top:${I.y+12}px"
|
|
41
|
+
>
|
|
42
|
+
${I.lines.map(C=>V`<div>${C}</div>`)}
|
|
43
|
+
</div>`:M}
|
|
44
|
+
${k?V`<table data-skdx-table=${r}>
|
|
45
|
+
<caption>
|
|
46
|
+
${S}
|
|
47
|
+
</caption>
|
|
48
|
+
<thead>
|
|
49
|
+
<tr>
|
|
50
|
+
${(k[0]??[]).map(C=>V`<th scope="col">${C}</th>`)}
|
|
51
|
+
</tr>
|
|
52
|
+
</thead>
|
|
53
|
+
<tbody>
|
|
54
|
+
${k.slice(1).map(C=>V`<tr>
|
|
55
|
+
${C.map((B,N)=>N===0?V`<th scope="row">${B}</th>`:V`<td>${B}</td>`)}
|
|
56
|
+
</tr>`)}
|
|
57
|
+
</tbody>
|
|
58
|
+
</table>`:M}`}};g.styles=qt`
|
|
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([f({type:Number})],g.prototype,"width",2),h([f({type:Number})],g.prototype,"height",2),h([f()],g.prototype,"label",2),h([f({type:Boolean,reflect:!0})],g.prototype,"legend",2),h([f({type:Boolean,attribute:"no-tooltip",converter:Qt})],g.prototype,"tooltip",2),h([f({attribute:!1})],g.prototype,"format",2),h([f({attribute:!1})],g.prototype,"palette",2),h([f({attribute:!1})],g.prototype,"hiddenSeries",2),h([f({attribute:!1})],g.prototype,"selected",2),h([f({attribute:"selection-mode"})],g.prototype,"selectionMode",2),h([f({attribute:!1})],g.prototype,"highlighted",2),h([f({attribute:!1})],g.prototype,"highlightScope",2),h([f({type:Boolean,reflect:!0})],g.prototype,"loading",2),h([f()],g.prototype,"error",2),h([f({attribute:"empty-message"})],g.prototype,"emptyMessage",2),h([f()],g.prototype,"description",2),h([f({type:Boolean,reflect:!0})],g.prototype,"decorative",2),h([f({type:Boolean,attribute:"accessible-table"})],g.prototype,"accessibleTable",2),h([f({attribute:!1})],g.prototype,"zoom",2),h([f({attribute:!1})],g.prototype,"view",2),h([f({type:Boolean,reflect:!0})],g.prototype,"zoomable",2),h([f({type:Boolean,reflect:!0})],g.prototype,"editable",2),h([f({attribute:"sync-id"})],g.prototype,"syncId",2),h([f({type:Boolean,attribute:"cross-filter"})],g.prototype,"crossFilter",2),h([f({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],g.prototype,"animated",2),h([f({type:Boolean,reflect:!0})],g.prototype,"responsive",2),h([P()],g.prototype,"tip",2),h([P()],g.prototype,"overlay",2),h([P()],g.prototype,"portal",2),h([P()],g.prototype,"measured",2),h([P()],g.prototype,"viewState",2),h([P()],g.prototype,"highlightState",2),h([P()],g.prototype,"crossState",2),h([P()],g.prototype,"focused",2),h([P()],g.prototype,"hiddenState",2),h([P()],g.prototype,"zoomState",2),h([P()],g.prototype,"selectedState",2);var x=class extends g{constructor(){super(...arguments);this.series=[];this.labels=!1;this.connectNulls=!1;this.stacked=!1;this.brush=!1;this.crosshair=!1}input(){let{series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:a,annotations:l,labels:c,curve:u,connectNulls:d,nulls:p,stacked:w,stackOffset:k,orientation:S,radius:I,barGap:C,barWidth:B,sort:N,transform:m,transforms:T,bins:$,binWidth:O,binDomain:D,binMode:z,sampling:L,brush:he,crosshair:pe}=this;return{...this.sized(),series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:a,annotations:l,labels:c,curve:u,connectNulls:d,nulls:p,stacked:w,stackOffset:k,orientation:S,radius:I,barGap:C,barWidth:B,sort:N,transform:m,transforms:T,bins:$,binWidth:O,binDomain:D,binMode:z,sampling:L,brush:he,crosshair:pe}}};h([f({attribute:!1})],x.prototype,"series",2),h([f({attribute:!1})],x.prototype,"categories",2),h([f({attribute:!1})],x.prototype,"xAxis",2),h([f({attribute:!1})],x.prototype,"yAxis",2),h([f({attribute:!1})],x.prototype,"rightAxis",2),h([f({attribute:!1})],x.prototype,"references",2),h([f({attribute:!1})],x.prototype,"annotations",2),h([f({type:Boolean,reflect:!0})],x.prototype,"labels",2),h([f()],x.prototype,"curve",2),h([f({type:Boolean,attribute:"connect-nulls"})],x.prototype,"connectNulls",2),h([f()],x.prototype,"nulls",2),h([f({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],x.prototype,"stacked",2),h([f({attribute:"stack-offset"})],x.prototype,"stackOffset",2),h([f()],x.prototype,"orientation",2),h([f({type:Number})],x.prototype,"radius",2),h([f({type:Number,attribute:"bar-gap"})],x.prototype,"barGap",2),h([f({type:Number,attribute:"bar-width"})],x.prototype,"barWidth",2),h([f()],x.prototype,"sort",2),h([f()],x.prototype,"transform",2),h([f({attribute:!1})],x.prototype,"transforms",2),h([f({type:Number})],x.prototype,"bins",2),h([f({type:Number,attribute:"bin-width"})],x.prototype,"binWidth",2),h([f({attribute:!1})],x.prototype,"binDomain",2),h([f({attribute:"bin-mode"})],x.prototype,"binMode",2),h([f({attribute:!1})],x.prototype,"sampling",2),h([f({type:Boolean,reflect:!0})],x.prototype,"brush",2),h([f({type:Boolean,reflect:!0})],x.prototype,"crosshair",2);var Jt=e=>e.defs&&e.defs.length?A`<defs>${e.defs.map(n=>A`<linearGradient id=${n.id} x1="0" y1="0" x2=${n.vertical===!1?1:0} y2=${n.vertical===!1?0:1}>${n.stops.map(t=>A`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${y(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:M,de=e=>A`${e.map((n,t)=>{let r=n.title?A`<title>${n.title}</title>`:M,i=n.item?t:void 0;switch(n.kind){case"path":return A`<path data-skdx-part=${n.part} data-skdx-i=${y(i)} d=${n.d} fill=${n.fill??"none"} stroke=${y(n.stroke)} stroke-width=${y(n.strokeWidth)} stroke-linecap=${y(n.strokeLinecap)} stroke-linejoin=${y(n.strokeLinejoin)} stroke-dasharray=${y(n.dash)} opacity=${y(n.opacity)} fill-opacity=${y(n.fillOpacity)}>${r}</path>`;case"rect":return A`<rect data-skdx-part=${n.part} data-skdx-i=${y(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${y(n.rx)} fill=${n.fill} stroke=${y(n.stroke)} fill-opacity=${y(n.opacity)}>${r}</rect>`;case"line":return A`<line data-skdx-part=${n.part} data-skdx-i=${y(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${y(n.strokeWidth)} stroke-dasharray=${y(n.dash)} opacity=${y(n.opacity)}>${r}</line>`;case"circle":return A`<circle data-skdx-part=${n.part} data-skdx-i=${y(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${y(n.stroke)} opacity=${y(n.opacity)}>${r}</circle>`;case"text":return A`<text data-skdx-part=${n.part} data-skdx-i=${y(i)} x=${n.x} y=${n.y} text-anchor=${y(n.anchor)} dominant-baseline=${y(n.baseline)} fill=${y(n.fill)} font-weight=${y(n.weight)} pointer-events=${y(i===void 0?"none":void 0)} transform=${y(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var R=class extends g{constructor(){super(...arguments);this.dimensions=[];this.data=[];this.connectNulls=!1}render(){let{dimensions:t,data:r,opacity:i,curve:o,connectNulls:s,filters:a}=this;return this.root(it({...this.sized(),dimensions:t,data:r,opacity:i,curve:o,connectNulls:s,filters:a}),"parallel",this.label??"Parallel coordinates chart")}};h([K({attribute:!1})],R.prototype,"dimensions",2),h([K({attribute:!1})],R.prototype,"data",2),h([K({type:Number})],R.prototype,"opacity",2),h([K()],R.prototype,"curve",2),h([K({type:Boolean,reflect:!0,attribute:"connect-nulls"})],R.prototype,"connectNulls",2),h([K({attribute:!1})],R.prototype,"filters",2),R=h([en("skdx-parallel-coordinates-chart")],R);export{R as SkdxParallelCoordinatesChart};
|