@skdx/web-components-charts 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +98 -0
- package/dist/area.cjs +109 -0
- package/dist/area.d.cts +2 -0
- package/dist/area.d.ts +2 -0
- package/dist/area.js +109 -0
- package/dist/bar.cjs +109 -0
- package/dist/bar.d.cts +2 -0
- package/dist/bar.d.ts +2 -0
- package/dist/bar.js +109 -0
- package/dist/boxplot.cjs +109 -0
- package/dist/boxplot.d.cts +2 -0
- package/dist/boxplot.d.ts +2 -0
- package/dist/boxplot.js +109 -0
- package/dist/bubble.cjs +109 -0
- package/dist/bubble.d.cts +2 -0
- package/dist/bubble.d.ts +2 -0
- package/dist/bubble.js +109 -0
- package/dist/bullet.cjs +109 -0
- package/dist/bullet.d.cts +2 -0
- package/dist/bullet.d.ts +2 -0
- package/dist/bullet.js +109 -0
- package/dist/bump.cjs +109 -0
- package/dist/bump.d.cts +2 -0
- package/dist/bump.d.ts +2 -0
- package/dist/bump.js +109 -0
- package/dist/candlestick.cjs +109 -0
- package/dist/candlestick.d.cts +2 -0
- package/dist/candlestick.d.ts +2 -0
- package/dist/candlestick.js +109 -0
- package/dist/chord.cjs +109 -0
- package/dist/chord.d.cts +2 -0
- package/dist/chord.d.ts +2 -0
- package/dist/chord.js +109 -0
- package/dist/circle-packing.cjs +109 -0
- package/dist/circle-packing.d.cts +2 -0
- package/dist/circle-packing.d.ts +2 -0
- package/dist/circle-packing.js +109 -0
- package/dist/combo.cjs +109 -0
- package/dist/combo.d.cts +2 -0
- package/dist/combo.d.ts +2 -0
- package/dist/combo.js +109 -0
- package/dist/dumbbell.cjs +109 -0
- package/dist/dumbbell.d.cts +2 -0
- package/dist/dumbbell.d.ts +2 -0
- package/dist/dumbbell.js +109 -0
- package/dist/funnel.cjs +109 -0
- package/dist/funnel.d.cts +2 -0
- package/dist/funnel.d.ts +2 -0
- package/dist/funnel.js +109 -0
- package/dist/gantt.cjs +109 -0
- package/dist/gantt.d.cts +2 -0
- package/dist/gantt.d.ts +2 -0
- package/dist/gantt.js +109 -0
- package/dist/gauge.cjs +109 -0
- package/dist/gauge.d.cts +2 -0
- package/dist/gauge.d.ts +2 -0
- package/dist/gauge.js +109 -0
- package/dist/heatmap.cjs +109 -0
- package/dist/heatmap.d.cts +2 -0
- package/dist/heatmap.d.ts +2 -0
- package/dist/heatmap.js +109 -0
- package/dist/histogram.cjs +109 -0
- package/dist/histogram.d.cts +2 -0
- package/dist/histogram.d.ts +2 -0
- package/dist/histogram.js +109 -0
- package/dist/icicle.cjs +109 -0
- package/dist/icicle.d.cts +2 -0
- package/dist/icicle.d.ts +2 -0
- package/dist/icicle.js +109 -0
- package/dist/index-oF5ss8v9.d.cts +2331 -0
- package/dist/index-oF5ss8v9.d.ts +2331 -0
- package/dist/index.cjs +109 -0
- package/dist/index.d.cts +29 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +109 -0
- package/dist/line.cjs +109 -0
- package/dist/line.d.cts +2 -0
- package/dist/line.d.ts +2 -0
- package/dist/line.js +109 -0
- package/dist/linear-gauge.cjs +109 -0
- package/dist/linear-gauge.d.cts +2 -0
- package/dist/linear-gauge.d.ts +2 -0
- package/dist/linear-gauge.js +109 -0
- package/dist/map.cjs +109 -0
- package/dist/map.d.cts +2 -0
- package/dist/map.d.ts +2 -0
- package/dist/map.js +109 -0
- package/dist/marimekko.cjs +109 -0
- package/dist/marimekko.d.cts +2 -0
- package/dist/marimekko.d.ts +2 -0
- package/dist/marimekko.js +109 -0
- package/dist/network.cjs +109 -0
- package/dist/network.d.cts +2 -0
- package/dist/network.d.ts +2 -0
- package/dist/network.js +109 -0
- package/dist/organization.cjs +109 -0
- package/dist/organization.d.cts +2 -0
- package/dist/organization.d.ts +2 -0
- package/dist/organization.js +109 -0
- package/dist/parallel.cjs +109 -0
- package/dist/parallel.d.cts +2 -0
- package/dist/parallel.d.ts +2 -0
- package/dist/parallel.js +109 -0
- package/dist/pareto.cjs +109 -0
- package/dist/pareto.d.cts +2 -0
- package/dist/pareto.d.ts +2 -0
- package/dist/pareto.js +109 -0
- package/dist/pie.cjs +109 -0
- package/dist/pie.d.cts +2 -0
- package/dist/pie.d.ts +2 -0
- package/dist/pie.js +109 -0
- package/dist/polar-area.cjs +109 -0
- package/dist/polar-area.d.cts +2 -0
- package/dist/polar-area.d.ts +2 -0
- package/dist/polar-area.js +109 -0
- package/dist/radar.cjs +109 -0
- package/dist/radar.d.cts +2 -0
- package/dist/radar.d.ts +2 -0
- package/dist/radar.js +109 -0
- package/dist/radial.cjs +109 -0
- package/dist/radial.d.cts +2 -0
- package/dist/radial.d.ts +2 -0
- package/dist/radial.js +109 -0
- package/dist/range.cjs +109 -0
- package/dist/range.d.cts +2 -0
- package/dist/range.d.ts +2 -0
- package/dist/range.js +109 -0
- package/dist/sankey.cjs +109 -0
- package/dist/sankey.d.cts +2 -0
- package/dist/sankey.d.ts +2 -0
- package/dist/sankey.js +109 -0
- package/dist/scatter.cjs +109 -0
- package/dist/scatter.d.cts +2 -0
- package/dist/scatter.d.ts +2 -0
- package/dist/scatter.js +109 -0
- package/dist/sparkline.cjs +109 -0
- package/dist/sparkline.d.cts +2 -0
- package/dist/sparkline.d.ts +2 -0
- package/dist/sparkline.js +109 -0
- package/dist/sunburst.cjs +109 -0
- package/dist/sunburst.d.cts +2 -0
- package/dist/sunburst.d.ts +2 -0
- package/dist/sunburst.js +109 -0
- package/dist/swarm.cjs +109 -0
- package/dist/swarm.d.cts +2 -0
- package/dist/swarm.d.ts +2 -0
- package/dist/swarm.js +109 -0
- package/dist/timeline.cjs +109 -0
- package/dist/timeline.d.cts +2 -0
- package/dist/timeline.d.ts +2 -0
- package/dist/timeline.js +109 -0
- package/dist/tree.cjs +109 -0
- package/dist/tree.d.cts +2 -0
- package/dist/tree.d.ts +2 -0
- package/dist/tree.js +109 -0
- package/dist/treemap.cjs +109 -0
- package/dist/treemap.d.cts +2 -0
- package/dist/treemap.d.ts +2 -0
- package/dist/treemap.js +109 -0
- package/dist/waffle.cjs +109 -0
- package/dist/waffle.d.cts +2 -0
- package/dist/waffle.d.ts +2 -0
- package/dist/waffle.js +109 -0
- package/dist/waterfall.cjs +109 -0
- package/dist/waterfall.d.cts +2 -0
- package/dist/waterfall.d.ts +2 -0
- package/dist/waterfall.js +109 -0
- package/package.json +76 -0
package/dist/gauge.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
var Wt=Object.defineProperty;var Et=Object.getOwnPropertyDescriptor;var l=(e,n,t,r)=>{for(var i=r>1?void 0:r?Et(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&&Wt(n,t,i),i};import{customElement as mn,property as O}from"lit/decorators.js";var yt=e=>Number(e.toPrecision(12)),Ut,Kt=e=>(Ut??(Ut=new Intl.NumberFormat)).format(yt(e)),Yt=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 vt(e){if(e===void 0)return Kt;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:i="",timeZone:o}=e,s=h=>i?u=>h(u)+i:h,a=h=>r===void 0?h===void 0?{}:{maximumFractionDigits:h}:{minimumFractionDigits:r,maximumFractionDigits:r},c=h=>{let u=new Intl.NumberFormat(t,h);return s(b=>u.format(yt(b)))},d=h=>{let u=new Intl.DateTimeFormat(t,o?{...h,timeZone:o}:h);return b=>u.format(b)};switch(n){case"integer":return c({maximumFractionDigits:0});case"decimal":return c(a(2));case"percent":return c({style:"percent",...a(0)});case"currency":return c({style:"currency",currency:e.currency??"USD",...a()});case"compact":return c({notation:"compact",...a(1)});case"scientific":return c({notation:"scientific",...a(2)});case"date":return d({dateStyle:"medium"});case"time":return d({timeStyle:"short"});case"datetime":return d({dateStyle:"medium",timeStyle:"short"});case"duration":return s(Yt)}}var g=e=>Number(e.toFixed(2)),j=e=>typeof e=="number"&&Number.isFinite(e);var te=1e3,ne=60*te,re=60*ne,le=24*re,yn=[te,5*te,15*te,30*te,ne,5*ne,15*ne,30*ne,re,3*re,6*re,12*re,le,2*le,7*le,14*le];var qt=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,Xt=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,Qt={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function Jt(e,n,t){return e.replace(Xt,(r,i,o)=>{let s=Qt[i];if(s===void 0)return i+o;let c=(o.match(qt)??[]).map((d,h)=>{let u=Number(d);if(s===-1)return String(u+n);if(s===-2)return String(u+t);let b=h%s;return s===7?b===5?String(u+n):b===6?String(u+t):d:String(b%2===0?u+n:u+t)});return i+c.join(" ")})}var Mt=(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:Jt(r.d,n,t)}}});var Se=["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)"))),x={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)"},Ie=(e="neutral")=>e==="neutral"?x.axis:`var(--skdx-color-${e}-500)`;var wt=(e,n)=>n??Se[e%Se.length];function ie(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function $t(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var de=20,en=120,kt=e=>{let n=ie(e);return n&&(n.position==="left"||n.position==="right")?n.width??en:0},Ae=(e,n=600,t=300)=>({width:(e.width??n)-kt(e),height:(e.height??t)-(ie(e)?.position==="bottom"?de:0)}),Ct=e=>{let n=ie(e);return n&&(n.position===void 0||n.position==="top")?de:0},Y=6.5,St=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:wt(n));function Te(e,n,t=[],r={},i=10,o=8,s=!1){let a=[],c=r.maxItems,d=c!==void 0&&c>=0&&e.length>c?e.slice(0,c):e,h=e.length-d.length,u=r.interactive??!0,b=o,$=i,M=(S,k,I,B)=>{let G=(k?18:4)+S.length*Y;b>o&&(s||b+G>n-8)&&(b=o,$+=de),k&&a.push({kind:"rect",part:"legend-swatch",x:b,y:$-5,width:10,height:10,fill:k,opacity:B?.3:void 0,item:I}),a.push({kind:"text",part:"legend-label",x:b+(k?14:0),y:$,text:S,baseline:"middle",fill:B?x.grid:x.label,item:I}),b+=G+12};for(let S of d){let k=t.includes(S.name),I=u?{label:S.name,series:S.name,legend:!0}:void 0;M(r.formatter?.(S.name)??S.name,S.color,I,k)}return h>0&&M(`+${h} more`,void 0,void 0,!1),r.align==="end"?tn(a,n):a}function tn(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*Y)),s=n-8-o;for(let a of i)r.push({...a,x:a.x+s})}return r}var nn=(e,n,t={})=>new Set(Te(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function Oe(e,n,t,r=[]){let i=ie(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,s=$t(e),a=o?.position==="bottom",c=kt(e),d=e.hiddenSeries??[],h=o?c?Te(r,1/0,d,o,10,(o.position==="right"?n:0)+8,!0):Te(r,n,d,o,a?t+10:10):[],u=a?nn(r,n,o):0;return{width:n+c,height:a?t+Math.max(1,u)*de:t,legendOffset:o?.position==="left"?c:void 0,tooltip:s.enabled,tooltipFormatter:s.formatter,axisTooltipFormatter:s.axisFormatter,tooltipPortal:s.portal,tooltipPlacement:s.placement,tooltipAnchored:s.followPointer===!1?!0:void 0,description:e.description,decorative:e.decorative,animate:e.animate===!0?300:e.animate||void 0,responsive:!!e.responsive,shapes:h}}function ze(e){let n=e.legendOffset;if(!n)return e;let t=[...Mt(e.shapes.filter(c=>!c.part.startsWith("legend-")),n,0),...e.shapes.filter(c=>c.part.startsWith("legend-"))],r=c=>({...c,x:c.x+n}),i=e.hit?{...e.hit,plot:r(e.hit.plot),xs:e.hit.xs.map(c=>c+n),brush:e.hit.brush?{box:r(e.hit.brush.box),window:r(e.hit.brush.window)}:void 0}:void 0,o=e.edit,s=o?{...o,scale:c=>o.scale(c)+n,invert:c=>o.invert(c-n),bars:o.bars.map(c=>({...c,x0:c.x0+n,x1:c.x1+n}))}:void 0,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 he(e,n,t,r,i,o="auto"){let s=Array.isArray(t)?t:[t],a=Math.max(...s.map(b=>b.length))*Y+12,c=6+s.length*16,d=o==="top"?{x:e-a/2,y:n-c-8}:o==="bottom"?{x:e-a/2,y:n+8}:o==="left"?{x:e-a-8,y:n-c/2}:o==="right"?{x:e+8,y:n-c/2}:{x:e+12,y:n-c-6},h=Math.max(0,Math.min(r-a,d.x)),u=Math.max(0,Math.min(i-c,d.y));return[{kind:"rect",part:"tooltip",x:g(h),y:g(u),width:g(a),height:c,fill:"var(--skdx-color-surface-raised)",stroke:x.axis,rx:3},...s.map((b,$)=>({kind:"text",part:"tooltip-label",x:g(h+6),y:g(u+11+$*16),text:b,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:s.length>1&&$===0?"bold":void 0}))]}function It(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}=Ae(e,t,r),a=i==="error"?e.error:i==="loading"?"Loading\u2026":e.emptyMessage??"No data available",c=[];return i==="loading"&&c.push({kind:"rect",part:"skeleton",x:0,y:0,width:o,height:s,fill:"var(--skdx-color-surface-sunken)",rx:4}),c.push({kind:"text",part:`state-${i}`,x:g(o/2),y:g(s/2),text:a,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":x.label}),{...Oe(e,o,s),shapes:c,tooltip:!1}}var ue=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:x.label,...r});function pe(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var Le=e=>e.id??e.name??e.series,Tt=e=>e.seriesId??e.series;function Z(e,n){let t=!1;return n.id!==void 0&&(t=!0,Le(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,Tt(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 W(e){let n={},t=Le(e);t!==void 0&&(n.id=t);let r=Tt(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var Pe=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function Be(e,n,t){let r=pe(e),i=W(n),o=r.some(s=>Z(n,s));return t==="single"?o?[]:[i]:o?r.filter(s=>!Z(n,s)):[...r,i]}var rn=.2;function on(e){let n=x.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 sn=(e,n)=>e.kind==="text"?{...e,fill:x.grid}:{...e,opacity:(e.opacity??1)*n};function Re(e,n){let t=pe(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:pe(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=h=>!i||r.some(u=>Z(h,u))?!0:o.highlighted==="series"?r.some(u=>u.series!==void 0&&Z(h,{series:u.series})):!1,c=h=>{if(!i||o.faded==="none"||a(h))return!1;if(o.faded==="series"){let u=i.series;return u!==void 0&&Z(h,{series:u})}return!0},d=e.shapes.map(h=>{let u=h.item;if(!u||u.legend)return h;if(t.some(b=>Z(u,b))){let b=on(h);b&&s.push(b)}return c(u)?sn(h,rn):h});return s.length?{...e,shapes:[...d,...s]}:{...e,shapes:d}}var At=2*Math.PI;function q(e,n,t,r,i,o){let s=(d,h)=>`${g(e+d*Math.sin(h))} ${g(n-d*Math.cos(h))}`;if(o-i>=At-1e-9){let d=i+At/2;return`${q(e,n,t,r,i,d)}${q(e,n,t,r,d,o)}`}let a=o-i>Math.PI?1:0,c=`M${s(t,i)}A${t} ${t} 0 ${a} 1 ${s(t,o)}`;return r>0?`${c}L${s(r,o)}A${r} ${r} 0 ${a} 0 ${s(r,i)}Z`:`${c}L${g(e)} ${g(n)}Z`}var Ot=e=>e*Math.PI/180;function an(e,n){let t=[0],r=[0],i=o=>{t.push(Math.sin(o)),r.push(-Math.cos(o))};i(e),i(n);for(let o=Math.ceil(e/(Math.PI/2));o*(Math.PI/2)<=n;o++)i(o*(Math.PI/2));return{x0:Math.min(...t),y0:Math.min(...r),x1:Math.max(...t),y1:Math.max(...r)}}function Ne(e){let n=It(e,!j(e.value),300,300);if(n)return n;let t=vt(e.format),{width:r,height:i}=Ae(e,300,300),o=Ct(e),s=j(e.min)?e.min:0,a=j(e.max)?e.max:100,c=e.startAngle??-120,d=e.endAngle??120,h=Ot(c),u=Ot(Math.max(c,Math.min(c+360,d))),b=u-h,$=m=>a>s?Math.max(0,Math.min(1,(m-s)/(a-s))):0,M=m=>h+$(m)*b,S=e.variant==="solid",k=e.ticks===!1?0:e.ticks===!0||e.ticks===void 0?5:e.ticks,I=e.tickLabels??!0,B=Array.from({length:k},(m,w)=>k===1?s:s+(a-s)*w/(k-1)),G=k>0&&I,ye=G?Math.max(...B.map(m=>t(m).length))*Y:0,ve=G?14+ye:10,Me=G?26:10,R=an(h,u),we=Math.max(R.x1-R.x0,.2),$e=Math.max(R.y1-R.y0,.2),A=Math.max(0,Math.min((r-2*ve)/we,(i-o-2*Me)/$e)),N=r/2-(R.x0+R.x1)/2*A,z=o+(i-o)/2-(R.y0+R.y1)/2*A,Zt=A*Math.max(.04,Math.min(.6,e.thickness??.18)),K=A-Zt,H=(m,w)=>({x:g(N+m*Math.sin(w)),y:g(z-m*Math.cos(w))}),D=[],Vt=`${t(s)} \u2013 ${t(a)}`,ft=(e.bands??[]).filter(m=>j(m.from)&&j(m.to)),Ht=m=>ft.find(w=>m>=w.from&&m<=w.to),ke=m=>m.color??Ie(m.variant);D.push({kind:"path",part:"track",d:q(N,z,A,K,h,u),fill:x.grid,opacity:.6});for(let m of ft){let w=M(Math.min(m.from,m.to)),L=M(Math.max(m.from,m.to));if(L<=w)continue;let _=`${m.label?`${m.label}: `:""}${t(m.from)} \u2013 ${t(m.to)}`;D.push(S?{kind:"path",part:"band",d:q(N,z,A+6,A+2,w,L),fill:ke(m),opacity:.7,title:_}:{kind:"path",part:"band",d:q(N,z,A,K,w,L),fill:ke(m),opacity:.75,title:_})}let ce=`${e.caption??"Value"}: ${t(e.value)} (${Vt})`,Ce={label:ce,name:e.caption,value:e.value},ee=M(e.value);if(S){let m=Ht(e.value),w=m?ke(m):St(e,0);ee>h+1e-6?D.push({kind:"path",part:"value",d:q(N,z,A,K,h,ee),fill:w,title:ce,item:Ce}):D.push({...cn(N,z),title:ce,item:Ce})}else{let m=H(K-4,ee),w=4,L=H(w,ee-Math.PI/2),_=H(w,ee+Math.PI/2);D.push({kind:"path",part:"needle",d:`M${L.x} ${L.y}L${m.x} ${m.y}L${_.x} ${_.y}Z`,fill:"var(--skdx-color-text-default)",title:ce,item:Ce},{kind:"circle",part:"hub",cx:g(N),cy:g(z),r:5,fill:"var(--skdx-color-text-default)"})}for(let m of B){let w=M(m),L=H(A+2,w),_=H(A+7,w);if(D.push({kind:"line",part:"tick",x1:L.x,y1:L.y,x2:_.x,y2:_.y,stroke:x.axis}),I){let gt=H(A+12,w),xt=Math.sin(w);D.push(ue(gt.x,gt.y,t(m),{part:"tick-label",anchor:xt>.3?"start":xt<-.3?"end":"middle",baseline:"middle"}))}}if(j(e.target)){let m=M(e.target),w=H(K-2,m),L=H(A+4,m);D.push({kind:"line",part:"target",x1:w.x,y1:w.y,x2:L.x,y2:L.y,stroke:"var(--skdx-color-text-default)",strokeWidth:2,title:`Target: ${t(e.target)}`})}let mt=b<2*Math.PI-1e-6?R.y1<.2?z-K*.4:z+K*.45:z;D.push(ue(g(N),g(mt),e.centerLabel??t(e.value),{part:"center-label",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-default)",weight:"bold"})),e.caption&&D.push(ue(g(N),g(mt+16),e.caption,{part:"caption",anchor:"middle",baseline:"middle"}));let bt=Oe(e,r,i),_t=j(e.target)?`, target ${t(e.target)}`:"";return{...bt,description:e.description??`${e.caption??"Value"} ${t(e.value)} on a scale from ${t(s)} to ${t(a)}${_t}.`,shapes:[...D,...bt.shapes]}}var cn=(e,n)=>({kind:"circle",part:"anchor",cx:g(e),cy:g(n),r:.01,fill:"none"});function J(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 De=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function zt(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 oe(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=zt(t,n),i=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(i,r)??i}}function Fe(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[zt(t,n)];return{kind:"line",part:"crosshair",x1:r,x2:r,y1:t.plot.y,y2:t.plot.y+t.plot.height,stroke:x.axis,dash:"3 3"}}function Ge(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!De(r.plot,n,t))return[];let i=Fe(e,n),{rows:o}=oe(e,n),s=e.tooltipAnchored?r.plot.y+8:t;return[i,...he(i.x1,s,o,e.width,e.height,e.tooltipPlacement)]}function je(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 Ge(e,i,t.plot.y+8)}function Ze(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:c,y:d}=J(t,r,i,e.width,e.height);if(De(e.hit.plot,c,d)){let h=oe(e,c),u=Fe(e,c);if(h&&u)return{lines:h.rows,shapes:[u]}}}let o=n?.closest?.("[data-skdx-part]"),s=e.tooltipFormatter?E(e,n)?.item:void 0,a=s&&e.tooltipFormatter?.(s)||o&&Array.from(o.children).find(c=>c.tagName.toLowerCase()==="title")?.textContent;return a?{lines:Array.isArray(a)?a:[a],shapes:[]}:{lines:[],shapes:[]}}function Lt(e,n,t,r,i,o,s){let a=e?.closest?.("[data-skdx-part]"),c=s&&s.tooltipFormatter?E(s,e)?.item:void 0,d=c&&s?.tooltipFormatter?.(c)||a&&Array.from(a.children).find(M=>M.tagName.toLowerCase()==="title")?.textContent;if(!d)return[];let h=s?.tooltipAnchored?E(s,e):void 0,u=h?s?.shapes[h.index]:void 0,{x:b,y:$}=u?se(u):J(n,t,r,i,o);return he(b,$,d,i,o,s?.tooltipPlacement)}function Ve(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:s}=J(t,r,i,e.width,e.height),a=Ge(e,o,s);if(a.length>0)return a}return Lt(n,t,r,i,e.width,e.height,e)}function He(e,n){let t=E(e,n);return t&&!t.item.legend?W(t.item):null}var ln=(e,n)=>{let{x:t,y:r}=se(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 _e(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!ln(i,n))continue;let o=W(i.item),s=JSON.stringify(o);t.has(s)||(t.add(s),r.push(o))}return r}var We=e=>({kind:"rect",part:"selection-box",x:g(e.x),y:g(e.y),width:g(e.width),height:g(e.height),fill:x.focus,opacity:.12,stroke:x.focus}),me=(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 Pt(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 Ee(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}=se(i),a=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:s;if(!Pt(n,o,a))continue;let c=W(i.item),d=JSON.stringify(c);t.has(d)||(t.add(d),r.push(c))}return r}var Ue=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${g(n.x)} ${g(n.y)}`).join("L")}`:"",fill:x.focus,fillOpacity:.12,stroke:x.focus,dash:"4 3"}),fe=6;function Ke(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-fe||n>i.x1+fe))return Math.abs(n-i.x0)<=fe?{bar:i,mode:"start"}:Math.abs(n-i.x1)<=fe?{bar:i,mode:"end"}:{bar:i,mode:"move"}}}function Ye(e,n,t){let r=e.edit;return Bt(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function qe(e,n,t){let r=e.edit,i=t.key==="ArrowRight"?1:t.key==="ArrowLeft"?-1:0;if(!r||n===null||!i||!(t.shiftKey||t.altKey))return;let o=r.bars.find(c=>c.index===n);if(!o)return;let s=t.altKey?t.shiftKey?"start":"end":"move",a=r.snap??r.invert(o.x0+10)-r.invert(o.x0);return Bt(r,{bar:o,mode:s},i*a)}function Bt(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 Xe(e,n,t){let r=e.edit,i=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:g(Math.min(i,o)),y:g(n.bar.y),width:g(Math.max(1,Math.abs(o-i))),height:g(n.bar.height),fill:x.focus,opacity:.25,stroke:x.focus,rx:2}}var dn=64,hn=e=>Math.max(1,Math.min(dn,e));function Qe(e,n,t,r){let i=n>0?.8:1.25,o=hn(e.view.zoom*i);if(o===e.view.zoom)return e.view;let{plot:s,scale:a}=e,[c,d]=e.view.center,h=(t-(s.x+s.width/2))/a,u=(r-(s.y+s.height/2))/a,b=e.view.zoom/o;return{center:[c+h*(1-b),e.fromY(e.toY(d)-u*(1-b))],zoom:o}}function Je(e,n,t,r){let{scale:i}=e;return{center:[n.center[0]-t/i,e.fromY(e.toY(n.center[1])+r/i)],zoom:n.zoom}}function E(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 be=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function se(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 et(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let r=x.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*Y+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}=se(t),a=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...a?he(g(o),g(s),a,e.width,e.height):[]]}function tt(e,n,t){let r=be(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 X=2,Q=(e,n,t)=>{let r=Math.max(X,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},Rt=(e,n)=>!e||e.start<=0&&e.end>=n;function nt(e,n,t){if(e.count<=X||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,s=n>0?1.25:.8,a=Math.max(X,Math.min(e.count,Math.round(o*s)));if(a===o)return n>0&&!Rt(e.zoom,e.count)?Q(r,a,e.count):void 0;let c=Math.max(0,Math.min(1,(t-e.plot.x)/e.plot.width)),d=r+c*o;return Q(d-c*a,a,e.count)}function rt(e,n,t,r){let i=n.end-n.start,o=Math.max(X,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 Q(n.start+s*i-s*o,o,e.count)}function it(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return Q(n.start-t/i,r,e.count)}function ot(e,n,t){let r=e.brush;if(!r||!De(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:Q(s-o/2,o,e.count)}}function st(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 Q(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-X,Math.round(t.start+o))),end:t.end};let s=Math.min(e.count,Math.max(t.start+X,Math.round(t.end+o)));return{start:t.start,end:s}}function ct(e,n){switch(n.type){case"svg":return Promise.resolve(at(e,n.label,n.resolve));case"csv":return Promise.resolve(Gt(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=at(e,n.label,n.resolve);return Ft(t,e.width,e.height,n.scale,n.background)}}}var V=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/"/g,"""),ae=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${V(String(t))}"`).join("");function Nt(e){let n=e.title?`<title>${V(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${ae([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${ae([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${ae([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${ae([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${ae([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]])}>${V(e.text)}</text>`}}function Dt(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${V(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="${V(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function at(e,n,t){let r=Dt(e)+e.shapes.map(Nt).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="${V(n)}" font-family="${V(x.fontFamily)}" font-size="${V(x.fontSize)}"><title>${V(n)}</title>${r}</svg>`}function Ft(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"})),c=new Image;c.onload=()=>{URL.revokeObjectURL(a);let d=document.createElement("canvas");d.width=Math.round(n*r),d.height=Math.round(t*r);let h=d.getContext("2d");if(!h)return s(new Error("canvas 2d context unavailable"));i&&(h.fillStyle=i,h.fillRect(0,0,d.width,d.height)),h.drawImage(c,0,0,d.width,d.height),d.toBlob(u=>u?o(u):s(new Error("toBlob failed")),"image/png")},c.onerror=()=>{URL.revokeObjectURL(a),s(new Error("svg could not be decoded"))},c.src=a})}function Gt(e){let n=t=>{let r=t==null?"":String(t);return/[",\n\r]/.test(r)?`"${r.replace(/"/g,'""')}"`:r};return e.map(t=>t.map(n).join(",")).join(`\r
|
|
2
|
+
`)}function lt(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 c=["",...a.slice(1).map(h=>h.replace(/:\s[^:]*$/,""))],d=r.rows.map(h=>[h[0],...h.slice(1).map(u=>u.slice(u.lastIndexOf(": ")+2))]);return[c,...d]}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(c=>c[a]!==void 0)),s=(a,c)=>a[c]===void 0?"":String(a[c]);return[o.map(a=>a[0]?.toUpperCase()+a.slice(1)),...i.map(a=>o.map(c=>s(a,c)))]}var dt=new Map;function ge(e){let n=dt.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&&dt.delete(e)}},publish(o,s){Object.assign(r,o);for(let a of t)a(o,s)}};return dt.set(e,{group:i,listeners:t}),i}var jt='[data-skdx-part]:not([data-skdx-part^="tooltip"]):not([data-skdx-part="focus"]):not([data-skdx-part="crosshair"])',ht=`@keyframes skdx-in{from{opacity:0}to{opacity:1}}${jt}{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){${jt}{animation:none;transition:none}}`;function ut(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}import{css as un,html as U,LitElement as pn,nothing as C,svg as P}from"lit";import{property as p,state as F}from"lit/decorators.js";import{ifDefined as v}from"lit/directives/if-defined.js";var pt={fromAttribute:()=>!1},f=class extends pn{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=[We(me(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=[Ue(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=Ye(r,i.gantt,o-i.x),this.overlay=[Xe(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(Je(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(rt(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"?it(r.hit,i.zoom,o-i.x):st(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:s}=Ze(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=Ve(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(He(r,t.target)),this.syncId&&r.hit?.crosshair){let o=oe(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=E(r,t.target)?.item.legend,a=this.canEdit(r)?Ke(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 d=r.map.plot;if(i<d.x||i>d.x+d.width||o<d.y||o>d.y+d.height)return;this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"map",view:r.map.view},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}let c=r.hit;if(!(!c||!this.canZoom(r))){if(this.pointers.set(t.pointerId,i),this.pointers.size===2){let[d,h]=[...this.pointers.values()];this.drag={x:(d+h)/2,y:o,zoom:c.zoom,grab:"pinch",distance:Math.abs(d-h)||1}}else{let d=ot(c,i,o);if(d)this.drag={x:i,y:o,zoom:d.zoom,grab:d.grab},d.zoom!==c.zoom&&this.setZoom(d.zoom);else if(this.zoomable&&i>=c.plot.x&&i<=c.plot.x+c.plot.width&&o>=c.plot.y&&o<=c.plot.y+c.plot.height)this.drag={x:i,y:o,zoom:c.zoom,grab:"pan"};else{this.pointers.delete(t.pointerId);return}}t.currentTarget.setPointerCapture(t.pointerId),this.clearTip()}};this.onPointerUp=t=>{this.pointers.delete(t.pointerId);let r=t.currentTarget;r.hasPointerCapture(t.pointerId)&&r.releasePointerCapture(t.pointerId);let i=this.drag,o=this.layout;if(o&&(i?.grab==="select"||i?.grab==="lasso"||i?.grab==="edit"||i?.grab==="map")){this.overlay=[];let{x:s,y:a}=this.viewBox(t,o);if(Math.abs(s-i.x)>2||Math.abs(a-i.y)>2){i.grab==="select"?this.setSelected(_e(o,me(i.x,i.y,s,a))):i.grab==="lasso"?this.setSelected(Ee(o,i.points??[])):i.grab==="edit"&&i.change&&this.emit("skdx-task-change",i.change),this.drag={...i,distance:-1};return}this.drag=null;return}(this.pointers.size===0||this.drag?.grab==="pinch")&&(this.drag=null)};this.onWheel=t=>{let r=this.layout;if(!r)return;let{x:i,y:o}=this.viewBox(t,r);if(r.map&&this.canPan(r)){let c=r.map.plot;if(i<c.x||i>c.x+c.width||o<c.y||o>c.y+c.height)return;t.preventDefault(),this.setView(Qe(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=nt(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=E(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)?qe(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=tt(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?W(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:c,error:d,emptyMessage:h,description:u,decorative:b,animated:$,responsive:M,highlighted:S,highlightScope:k,accessibleTable:I}=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:$,responsive:M,legend:i,tooltip:o,format:s,palette:a,loading:c,error:d,emptyMessage:h,description:u,decorative:b,highlighted:S===void 0?this.highlightState:S,highlightScope:k,accessibleTable:I,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&&ge(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=ge(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&&Pe(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(Be(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 J(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&&Z(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?ct(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=Re(ze(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let I of o.issues??[])this.emit("skdx-data-issue",I)}let s=this.canZoom(o),a=this.canPan(o),c=this.canEdit(o),d=this.brushing(),h=s||a||c||d,u=!o.decorative&&be(o).length>0,b=o.description?`${r}-desc`:void 0,$=ut(o),M=lt(o,this.accessibleTable),S=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,k=this.portal;return U`<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":C}
|
|
9
|
+
aria-label=${o.decorative?C:i}
|
|
10
|
+
aria-describedby=${v(b)}
|
|
11
|
+
tabindex=${u?0:C}
|
|
12
|
+
data-skdx-chart=${r}
|
|
13
|
+
data-zoomable=${s||a?"":C}
|
|
14
|
+
data-brushing=${d&&!(s||a)?"":C}
|
|
15
|
+
data-editable=${c?"":C}
|
|
16
|
+
style=${$?`--skdx-chart-duration:${$}`:C}
|
|
17
|
+
font-family=${x.fontFamily}
|
|
18
|
+
font-size=${x.fontSize}
|
|
19
|
+
@pointermove=${o.tooltip||h?this.onPointerMove:C}
|
|
20
|
+
@pointerleave=${()=>{this.clearTip(),this.highlight(null)}}
|
|
21
|
+
@pointerdown=${h?this.onPointerDown:C}
|
|
22
|
+
@pointerup=${h?this.onPointerUp:C}
|
|
23
|
+
@pointercancel=${h?this.onPointerUp:C}
|
|
24
|
+
@wheel=${s||a?this.onWheel:C}
|
|
25
|
+
@dblclick=${s||a?()=>a?this.setView(void 0):this.setZoom(void 0):C}
|
|
26
|
+
@click=${this.onClick}
|
|
27
|
+
@keydown=${u?this.onKeyDown:C}
|
|
28
|
+
@blur=${()=>{this.focused=null,this.highlight(null)}}
|
|
29
|
+
>
|
|
30
|
+
<title>${i}</title>
|
|
31
|
+
${o.description?P`<desc id=${v(b)}>${o.description}</desc>`:C}
|
|
32
|
+
${$?P`<style>${ht}</style>`:C} ${fn(o)}
|
|
33
|
+
${xe(o.shapes)}
|
|
34
|
+
${xe(this.tip.length||!this.crossState?this.tip:je(o,this.crossState))}
|
|
35
|
+
${xe(et(o,this.focused))} ${xe(this.overlay)}
|
|
36
|
+
</svg>
|
|
37
|
+
${k?U`<div
|
|
38
|
+
role="tooltip"
|
|
39
|
+
data-skdx-tooltip=${r}
|
|
40
|
+
style="left:${k.x+12}px;top:${k.y+12}px"
|
|
41
|
+
>
|
|
42
|
+
${k.lines.map(I=>U`<div>${I}</div>`)}
|
|
43
|
+
</div>`:C}
|
|
44
|
+
${M?U`<table data-skdx-table=${r}>
|
|
45
|
+
<caption>
|
|
46
|
+
${S}
|
|
47
|
+
</caption>
|
|
48
|
+
<thead>
|
|
49
|
+
<tr>
|
|
50
|
+
${(M[0]??[]).map(I=>U`<th scope="col">${I}</th>`)}
|
|
51
|
+
</tr>
|
|
52
|
+
</thead>
|
|
53
|
+
<tbody>
|
|
54
|
+
${M.slice(1).map(I=>U`<tr>
|
|
55
|
+
${I.map((B,G)=>G===0?U`<th scope="row">${B}</th>`:U`<td>${B}</td>`)}
|
|
56
|
+
</tr>`)}
|
|
57
|
+
</tbody>
|
|
58
|
+
</table>`:C}`}};f.styles=un`
|
|
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
|
+
`,l([p({type:Number})],f.prototype,"width",2),l([p({type:Number})],f.prototype,"height",2),l([p()],f.prototype,"label",2),l([p({type:Boolean,reflect:!0})],f.prototype,"legend",2),l([p({type:Boolean,attribute:"no-tooltip",converter:pt})],f.prototype,"tooltip",2),l([p({attribute:!1})],f.prototype,"format",2),l([p({attribute:!1})],f.prototype,"palette",2),l([p({attribute:!1})],f.prototype,"hiddenSeries",2),l([p({attribute:!1})],f.prototype,"selected",2),l([p({attribute:"selection-mode"})],f.prototype,"selectionMode",2),l([p({attribute:!1})],f.prototype,"highlighted",2),l([p({attribute:!1})],f.prototype,"highlightScope",2),l([p({type:Boolean,reflect:!0})],f.prototype,"loading",2),l([p()],f.prototype,"error",2),l([p({attribute:"empty-message"})],f.prototype,"emptyMessage",2),l([p()],f.prototype,"description",2),l([p({type:Boolean,reflect:!0})],f.prototype,"decorative",2),l([p({type:Boolean,attribute:"accessible-table"})],f.prototype,"accessibleTable",2),l([p({attribute:!1})],f.prototype,"zoom",2),l([p({attribute:!1})],f.prototype,"view",2),l([p({type:Boolean,reflect:!0})],f.prototype,"zoomable",2),l([p({type:Boolean,reflect:!0})],f.prototype,"editable",2),l([p({attribute:"sync-id"})],f.prototype,"syncId",2),l([p({type:Boolean,attribute:"cross-filter"})],f.prototype,"crossFilter",2),l([p({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],f.prototype,"animated",2),l([p({type:Boolean,reflect:!0})],f.prototype,"responsive",2),l([F()],f.prototype,"tip",2),l([F()],f.prototype,"overlay",2),l([F()],f.prototype,"portal",2),l([F()],f.prototype,"measured",2),l([F()],f.prototype,"viewState",2),l([F()],f.prototype,"highlightState",2),l([F()],f.prototype,"crossState",2),l([F()],f.prototype,"focused",2),l([F()],f.prototype,"hiddenState",2),l([F()],f.prototype,"zoomState",2),l([F()],f.prototype,"selectedState",2);var y=class extends f{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:c,labels:d,curve:h,connectNulls:u,nulls:b,stacked:$,stackOffset:M,orientation:S,radius:k,barGap:I,barWidth:B,sort:G,transform:ye,transforms:ve,bins:Me,binWidth:R,binDomain:we,binMode:$e,sampling:A,brush:N,crosshair:z}=this;return{...this.sized(),series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:a,annotations:c,labels:d,curve:h,connectNulls:u,nulls:b,stacked:$,stackOffset:M,orientation:S,radius:k,barGap:I,barWidth:B,sort:G,transform:ye,transforms:ve,bins:Me,binWidth:R,binDomain:we,binMode:$e,sampling:A,brush:N,crosshair:z}}};l([p({attribute:!1})],y.prototype,"series",2),l([p({attribute:!1})],y.prototype,"categories",2),l([p({attribute:!1})],y.prototype,"xAxis",2),l([p({attribute:!1})],y.prototype,"yAxis",2),l([p({attribute:!1})],y.prototype,"rightAxis",2),l([p({attribute:!1})],y.prototype,"references",2),l([p({attribute:!1})],y.prototype,"annotations",2),l([p({type:Boolean,reflect:!0})],y.prototype,"labels",2),l([p()],y.prototype,"curve",2),l([p({type:Boolean,attribute:"connect-nulls"})],y.prototype,"connectNulls",2),l([p()],y.prototype,"nulls",2),l([p({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],y.prototype,"stacked",2),l([p({attribute:"stack-offset"})],y.prototype,"stackOffset",2),l([p()],y.prototype,"orientation",2),l([p({type:Number})],y.prototype,"radius",2),l([p({type:Number,attribute:"bar-gap"})],y.prototype,"barGap",2),l([p({type:Number,attribute:"bar-width"})],y.prototype,"barWidth",2),l([p()],y.prototype,"sort",2),l([p()],y.prototype,"transform",2),l([p({attribute:!1})],y.prototype,"transforms",2),l([p({type:Number})],y.prototype,"bins",2),l([p({type:Number,attribute:"bin-width"})],y.prototype,"binWidth",2),l([p({attribute:!1})],y.prototype,"binDomain",2),l([p({attribute:"bin-mode"})],y.prototype,"binMode",2),l([p({attribute:!1})],y.prototype,"sampling",2),l([p({type:Boolean,reflect:!0})],y.prototype,"brush",2),l([p({type:Boolean,reflect:!0})],y.prototype,"crosshair",2);var fn=e=>e.defs&&e.defs.length?P`<defs>${e.defs.map(n=>P`<linearGradient id=${n.id} x1="0" y1="0" x2=${n.vertical===!1?1:0} y2=${n.vertical===!1?0:1}>${n.stops.map(t=>P`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${v(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:C,xe=e=>P`${e.map((n,t)=>{let r=n.title?P`<title>${n.title}</title>`:C,i=n.item?t:void 0;switch(n.kind){case"path":return P`<path data-skdx-part=${n.part} data-skdx-i=${v(i)} d=${n.d} fill=${n.fill??"none"} stroke=${v(n.stroke)} stroke-width=${v(n.strokeWidth)} stroke-linecap=${v(n.strokeLinecap)} stroke-linejoin=${v(n.strokeLinejoin)} stroke-dasharray=${v(n.dash)} opacity=${v(n.opacity)} fill-opacity=${v(n.fillOpacity)}>${r}</path>`;case"rect":return P`<rect data-skdx-part=${n.part} data-skdx-i=${v(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${v(n.rx)} fill=${n.fill} stroke=${v(n.stroke)} fill-opacity=${v(n.opacity)}>${r}</rect>`;case"line":return P`<line data-skdx-part=${n.part} data-skdx-i=${v(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${v(n.strokeWidth)} stroke-dasharray=${v(n.dash)} opacity=${v(n.opacity)}>${r}</line>`;case"circle":return P`<circle data-skdx-part=${n.part} data-skdx-i=${v(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${v(n.stroke)} opacity=${v(n.opacity)}>${r}</circle>`;case"text":return P`<text data-skdx-part=${n.part} data-skdx-i=${v(i)} x=${n.x} y=${n.y} text-anchor=${v(n.anchor)} dominant-baseline=${v(n.baseline)} fill=${v(n.fill)} font-weight=${v(n.weight)} pointer-events=${v(i===void 0?"none":void 0)} transform=${v(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var T=class extends f{constructor(){super(...arguments);this.value=Number.NaN;this.tickLabels=!0}render(){let{value:t,min:r,max:i,variant:o,startAngle:s,endAngle:a,thickness:c,bands:d,target:h,ticks:u,tickLabels:b,centerLabel:$,caption:M}=this;return this.root(Ne({...this.sized(),value:t,min:r,max:i,variant:o,startAngle:s,endAngle:a,thickness:c,bands:d,target:h,ticks:u,tickLabels:b,centerLabel:$,caption:M}),"gauge",this.label??"Gauge chart")}};l([O({type:Number})],T.prototype,"value",2),l([O({type:Number})],T.prototype,"min",2),l([O({type:Number})],T.prototype,"max",2),l([O()],T.prototype,"variant",2),l([O({type:Number,attribute:"start-angle"})],T.prototype,"startAngle",2),l([O({type:Number,attribute:"end-angle"})],T.prototype,"endAngle",2),l([O({type:Number})],T.prototype,"thickness",2),l([O({attribute:!1})],T.prototype,"bands",2),l([O({type:Number})],T.prototype,"target",2),l([O({attribute:!1})],T.prototype,"ticks",2),l([O({type:Boolean,attribute:"no-tick-labels",converter:pt})],T.prototype,"tickLabels",2),l([O({attribute:"center-label"})],T.prototype,"centerLabel",2),l([O()],T.prototype,"caption",2),T=l([mn("skdx-gauge-chart")],T);export{T as SkdxGaugeChart};
|
package/dist/heatmap.cjs
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";var se=Object.defineProperty;var ht=Object.getOwnPropertyDescriptor;var jt=Object.getOwnPropertyNames;var Et=Object.prototype.hasOwnProperty;var Zt=(e,n)=>{for(var t in n)se(e,t,{get:n[t],enumerable:!0})},Wt=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of jt(n))!Et.call(e,i)&&i!==t&&se(e,i,{get:()=>n[i],enumerable:!(r=ht(n,i))||r.enumerable});return e};var Ht=e=>Wt(se({},"__esModule",{value:!0}),e),c=(e,n,t,r)=>{for(var i=r>1?void 0:r?ht(n,t):n,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=(r?s(n,t,i):s(i))||i);return r&&i&&se(n,t,i),i};var bn={};Zt(bn,{SkdxHeatmap:()=>T});module.exports=Ht(bn);var L=require("lit/decorators.js");var pt=e=>Number(e.toPrecision(12)),Ut,Kt=e=>(Ut??(Ut=new Intl.NumberFormat)).format(pt(e)),qt=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 ft(e){if(e===void 0)return Kt;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:i="",timeZone:o}=e,s=u=>i?h=>u(h)+i:u,a=u=>r===void 0?u===void 0?{}:{maximumFractionDigits:u}:{minimumFractionDigits:r,maximumFractionDigits:r},l=u=>{let h=new Intl.NumberFormat(t,u);return s(m=>h.format(pt(m)))},d=u=>{let h=new Intl.DateTimeFormat(t,o?{...u,timeZone:o}:u);return m=>h.format(m)};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 d({dateStyle:"medium"});case"time":return d({timeStyle:"short"});case"datetime":return d({dateStyle:"medium",timeStyle:"short"});case"duration":return s(qt)}}var y=e=>Number(e.toFixed(2)),H=e=>typeof e=="number"&&Number.isFinite(e);function te(e){let n=1/0,t=-1/0;for(let r of e)H(r)&&(r<n&&(n=r),r>t&&(t=r));return n===1/0?[0,0]:[n,t]}var Q=1e3,J=60*Q,ee=60*J,ae=24*ee,vn=[Q,5*Q,15*Q,30*Q,J,5*J,15*J,30*J,ee,3*ee,6*ee,12*ee,ae,2*ae,7*ae,14*ae];var Yt=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,Xt=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,Qt={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function Jt(e,n,t){return e.replace(Xt,(r,i,o)=>{let s=Qt[i];if(s===void 0)return i+o;let l=(o.match(Yt)??[]).map((d,u)=>{let h=Number(d);if(s===-1)return String(h+n);if(s===-2)return String(h+t);let m=u%s;return s===7?m===5?String(h+n):m===6?String(h+t):d:String(m%2===0?h+n:h+t)});return i+l.join(" ")})}var mt=(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:Jt(r.d,n,t)}}});var ye=["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)"))),C={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 gt=(e,n)=>n??ye[e%ye.length];var en={top:16,right:16,bottom:32,left:48};function bt(e,n,t=en){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 le(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function xt(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var we=20,tn=120,yt=e=>{let n=le(e);return n&&(n.position==="left"||n.position==="right")?n.width??tn:0},Ce=(e,n=600,t=300)=>({width:(e.width??n)-yt(e),height:(e.height??t)-(le(e)?.position==="bottom"?we:0)});var W=6.5,vt=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:gt(n));function ve(e,n,t=[],r={},i=10,o=8,s=!1){let a=[],l=r.maxItems,d=l!==void 0&&l>=0&&e.length>l?e.slice(0,l):e,u=e.length-d.length,h=r.interactive??!0,m=o,b=i,k=(x,f,v,M)=>{let O=(f?18:4)+x.length*W;m>o&&(s||m+O>n-8)&&(m=o,b+=we),f&&a.push({kind:"rect",part:"legend-swatch",x:m,y:b-5,width:10,height:10,fill:f,opacity:M?.3:void 0,item:v}),a.push({kind:"text",part:"legend-label",x:m+(f?14:0),y:b,text:x,baseline:"middle",fill:M?C.grid:C.label,item:v}),m+=O+12};for(let x of d){let f=t.includes(x.name),v=h?{label:x.name,series:x.name,legend:!0}:void 0;k(r.formatter?.(x.name)??x.name,x.color,v,f)}return u>0&&k(`+${u} more`,void 0,void 0,!1),r.align==="end"?nn(a,n):a}function nn(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*W)),s=n-8-o;for(let a of i)r.push({...a,x:a.x+s})}return r}var rn=(e,n,t={})=>new Set(ve(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function Me(e,n,t,r=[]){let i=le(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,s=xt(e),a=o?.position==="bottom",l=yt(e),d=e.hiddenSeries??[],u=o?l?ve(r,1/0,d,o,10,(o.position==="right"?n:0)+8,!0):ve(r,n,d,o,a?t+10:10):[],h=a?rn(r,n,o):0;return{width:n+l,height:a?t+Math.max(1,h)*we: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 Se(e){let n=e.legendOffset;if(!n)return e;let t=[...mt(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 ce(e,n,t,r,i,o="auto"){let s=Array.isArray(t)?t:[t],a=Math.max(...s.map(m=>m.length))*W+12,l=6+s.length*16,d=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,d.x)),h=Math.max(0,Math.min(i-l,d.y));return[{kind:"rect",part:"tooltip",x:y(u),y:y(h),width:y(a),height:l,fill:"var(--skdx-color-surface-raised)",stroke:C.axis,rx:3},...s.map((m,b)=>({kind:"text",part:"tooltip-label",x:y(u+6),y:y(h+11+b*16),text:m,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:s.length>1&&b===0?"bold":void 0}))]}function wt(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}=Ce(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:y(o/2),y:y(s/2),text:a,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":C.label}),{...Me(e,o,s),shapes:l,tooltip:!1}}var de=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:C.label,...r});var ne=e=>Math.max(0,Math.min(1,e));function Ct(e){let n=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(n){let r=n[1],i=r.length===3?r.split("").map(o=>o+o).join(""):r;return[0,2,4].map(o=>parseInt(i.slice(o,o+2),16))}let t=/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)/i.exec(e.trim());return t?[Number(t[1]),Number(t[2]),Number(t[3])]:void 0}function Mt(e,n){if(e.length===0)return C.axis;if(e.length===1)return e[0];let t=ne(n)*(e.length-1),r=Math.min(e.length-2,Math.floor(t)),i=t-r,o=Ct(e[r]),s=Ct(e[r+1]);if(!o||!s)return e[Math.round(t)];let a=l=>Math.round(o[l]+(s[l]-o[l])*i);return`rgb(${a(0)}, ${a(1)}, ${a(2)})`}var St=(e,n)=>n!==void 0&&n>=2?Math.min(n-1,Math.floor(ne(e)*n))/(n-1):ne(e);function kt(e,n,t,r=C.negative,i=String){let[o,s]=te(n),a=e??{type:"sequential"},l=f=>y(.15+.85*f);if(a.type==="threshold"){let{thresholds:f,colors:v,labels:M}=a,O=B=>{if(typeof B!="number"||!Number.isFinite(B))return;let z=0;for(;z<f.length&&B>=f[z];)z++;return{fill:v[Math.min(z,v.length-1)]??t,opacity:1}},P=v.map((B,z)=>({fill:B,opacity:1,label:M?.[z]??(z===0?`< ${i(f[0]??0)}`:z===f.length?`\u2265 ${i(f[z-1])}`:`${i(f[z-1])} \u2013 ${i(f[z])}`)}));return{color:O,domain:[o,s],swatches:P,kind:"threshold"}}if(a.type==="ordinal"){let f=a.colors?.length?a.colors:[t];return{color:M=>typeof M=="number"&&Number.isFinite(M)?{fill:f[Math.abs(Math.round(M))%f.length],opacity:1}:void 0,domain:[o,s],swatches:f.map((M,O)=>({fill:M,opacity:1,label:String(O)})),kind:"ordinal"}}if(a.type==="diverging"){let[f,v,M]=a.domain??[-Math.max(Math.abs(o),Math.abs(s)),0,Math.max(Math.abs(o),Math.abs(s))],O=a.colors,P=A=>A<v?.5*(A-f)/Math.max(1e-12,v-f):.5+.5*(A-v)/Math.max(1e-12,M-v),B=A=>{let N=St(a.reversed?1-ne(A):A,a.steps);if(O&&O.length>=2)return{fill:Mt(O,N),opacity:1};let D=N<.5?r:t,$=Math.abs(N-.5)*2;return{fill:D,opacity:l($)}},z=A=>typeof A=="number"&&Number.isFinite(A)?B(P(A)):void 0,_=a.steps??5,V=Array.from({length:_},(A,N)=>{let D=_===1?.5:N/(_-1),$=D<.5?f+(v-f)*(D*2):v+(M-v)*((D-.5)*2);return{...B(D),label:i($)}});return{color:z,domain:[f,M],swatches:V,kind:"diverging"}}let[d,u]=a.domain??[o,s],h=a.colors,m=f=>{let v=St(a.reversed?1-ne(f):f,a.steps);return h&&h.length>=2?{fill:Mt(h,v),opacity:1}:{fill:h?.[0]??t,opacity:l(v)}},b=f=>typeof f!="number"||!Number.isFinite(f)?void 0:m(u===d?1:(f-d)/(u-d)),k=a.steps??5,x=Array.from({length:k},(f,v)=>{let M=k===1?1:v/(k-1);return{...m(M),label:i(d+(u-d)*M)}});return{color:b,domain:[d,u],swatches:x,kind:"sequential"}}var on=34,sn=72;function $t(e){if(!e)return{bottom:0,right:0,options:{}};let n=e===!0?{}:e;return n.orientation==="vertical"?{bottom:0,right:sn,options:n}:{bottom:on,right:0,options:n}}function It(e,n,t){let r=typeof t=="string"?{title:t}:t??{},i=r.title,o=e.swatches;if(o.length===0||n.width<=0)return[];if(r.orientation==="vertical"){let u=Math.max(0,n.height-(i?16:0)),h=Math.min(16,u/o.length),m=n.y+(i?16:0),b=o.map((x,f)=>({kind:"rect",part:"color-legend-swatch",x:y(n.x),y:y(m+f*h),width:10,height:y(h),fill:x.fill,opacity:x.opacity,title:x.label})),k=h>=12?1:2;return o.forEach((x,f)=>{f%k!==0&&f!==o.length-1||b.push({kind:"text",part:"color-legend-label",x:y(n.x+14),y:y(m+(f+.5)*h),text:x.label,baseline:"middle",fill:C.label})}),i&&b.push({kind:"text",part:"color-legend-title",x:y(n.x),y:y(n.y+6),text:i,baseline:"middle",fill:C.label}),b}let s=Math.min(n.width/o.length,96),a=n.x+(n.width-s*o.length)/2,l=o.map((u,h)=>({kind:"rect",part:"color-legend-swatch",x:y(a+h*s),y:y(n.y),width:y(s),height:10,fill:u.fill,opacity:u.opacity,title:u.label})),d=e.kind==="threshold"?1:Math.max(1,Math.ceil(o.length*7*W/Math.max(1,s*o.length)));return o.forEach((u,h)=>{h%d!==0&&h!==o.length-1||l.push({kind:"text",part:"color-legend-label",x:y(a+(h+.5)*s),y:y(n.y+22),text:u.label,anchor:"middle",fill:C.label})}),i&&l.push({kind:"text",part:"color-legend-title",x:y(a-6),y:y(n.y+5),text:i,anchor:"end",baseline:"middle",fill:C.label}),l}function ue(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,Tt=e=>e.seriesId??e.series;function G(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,Tt(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 E(e){let n={},t=ke(e);t!==void 0&&(n.id=t);let r=Tt(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 Ie(e,n,t){let r=ue(e),i=E(n),o=r.some(s=>G(n,s));return t==="single"?o?[]:[i]:o?r.filter(s=>!G(n,s)):[...r,i]}var an=.2;function ln(e){let n=C.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 cn=(e,n)=>e.kind==="text"?{...e,fill:C.grid}:{...e,opacity:(e.opacity??1)*n};function Te(e,n){let t=ue(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:ue(n.highlighted),i=r[0];if(t.length===0&&!i)return e;let o={highlighted:n.highlightScope?.highlighted??"item",faded:n.highlightScope?.faded??"global"},s=[],a=u=>!i||r.some(h=>G(u,h))?!0:o.highlighted==="series"?r.some(h=>h.series!==void 0&&G(u,{series:h.series})):!1,l=u=>{if(!i||o.faded==="none"||a(u))return!1;if(o.faded==="series"){let h=i.series;return h!==void 0&&G(u,{series:h})}return!0},d=e.shapes.map(u=>{let h=u.item;if(!h||h.legend)return u;if(t.some(m=>G(h,m))){let m=ln(u);m&&s.push(m)}return l(h)?cn(u,an):u});return s.length?{...e,shapes:[...d,...s]}:{...e,shapes:d}}var he={top:24,right:8,bottom:8,left:64},Oe=864e5,Le=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];function dn(e,n="monday"){let t=n==="sunday"?[Le[6],...Le.slice(0,6)]:Le,r=e.map(x=>({day:Math.floor(new Date(x.date).getTime()/Oe),value:x.value})).filter(x=>Number.isFinite(x.day));if(r.length===0)return{rows:t,columns:[],data:t.map(()=>[]),dates:t.map(()=>[])};let[i,o]=te(r.map(x=>x.day)),s=n==="sunday"?4:3,a=x=>((x+s)%7+7)%7,l=i-a(i),d=Math.floor((o-l)/7)+1,u=t.map(()=>new Array(d).fill(null)),h=t.map(()=>new Array(d).fill(void 0));for(let x of r){let f=Math.floor((x.day-l)/7);u[a(x.day)][f]=x.value,h[a(x.day)][f]=new Date(x.day*Oe).toISOString().slice(0,10)}let m=new Intl.DateTimeFormat(void 0,{month:"short"}),b=-1,k=Array.from({length:d},(x,f)=>{let v=new Date((l+f*7+6)*Oe),M=v.getUTCMonth();return M===b?"":(b=M,m.format(v))});return{rows:t,columns:k,data:u,dates:h}}var un=e=>e.colorScale??(e.diverging?{type:"diverging",steps:e.steps}:{type:"sequential",domain:e.domain,steps:e.steps}),Ot=(e,n)=>{let t=e.map((r,i)=>i);return n&&t.sort((r,i)=>(n==="asc"?1:-1)*(e[r]-e[i])),t};function ze(e){let n=[],t=e.calendar?dn(e.calendar,e.weekStart):void 0,r=t?.rows??e.rows??[],i=t?.columns??e.columns??[],o=t?.data??e.data??[];!t&&(o.length!==r.length||o.some($=>$.length!==i.length))&&n.push({code:"ragged-matrix",severity:"warning",message:`The matrix is ${o.length} \xD7 ${o[0]?.length??0} but there are ${r.length} rows and ${i.length} columns; missing cells are blank.`});let s=o.flat().filter($=>$!=null&&!H($)).length;s&&n.push({code:"invalid-value",severity:"warning",message:`${s} cell${s===1?" is":"s are"} neither a number nor null; drawn as blank.`});let a=o.flat(),l=wt(e,r.length===0||i.length===0||!a.some(H));if(l)return{...l,issues:n};let d=ft(e.format),{width:u,height:h}=Ce(e),m=$t(e.colorLegend),b=bt(u,h,{...he,left:t?40:he.left,right:he.right+m.right,bottom:he.bottom+m.bottom}),k=$=>$.reduce((R,j)=>R+(H(j)?j:0),0),x=Ot(r.map(($,R)=>k(o[R]??[])),e.rowOrder),f=Ot(i.map(($,R)=>k(o.map(j=>j[R]))),e.columnOrder),v=x.map($=>r[$]),M=f.map($=>i[$]),O=b.width/Math.max(1,M.length),P=b.height/Math.max(1,v.length),B=kt(un(e),a,vt(e,0,e.color),e.negativeColor,d),z=[],_=[],V=e.cellGap??(t?1:0),A=e.cellRadius??(t?2:0);v.forEach(($,R)=>{M.forEach((j,Y)=>{let X=o[x[R]]?.[f[Y]],xe=t?.dates[x[R]]?.[f[Y]],lt=t?xe??$:`${$}, ${j}`,_t=y(b.x+Y*O+V),Vt=y(b.y+R*P+V),ct={x:_t,y:Vt,width:y(Math.max(0,O-2*V)),height:y(Math.max(0,P-2*V)),rx:A||void 0};if(!H(X)){e.missingColor&&(!t||xe)&&z.push({kind:"rect",part:"missing",...ct,fill:e.missingColor,title:`${lt}: \u2014`});return}let dt=B.color(X),ut=`${lt}: ${d(X)}`;z.push({kind:"rect",part:"cell",...ct,fill:dt.fill,opacity:dt.opacity,title:ut,item:{label:ut,id:t?xe:`${$}:${j}`,category:j,name:$,index:Y,value:X}}),e.labels&&O>24&&P>12&&_.push(de(y(b.x+(Y+.5)*O),y(b.y+(R+.5)*P),d(X),{part:"cell-label",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-default)"}))})});let N=Me(e,u,h),D=e.colorLegend?It(B,m.right?{x:b.x+b.width+12,y:b.y,width:m.right,height:b.height}:{x:b.x,y:b.y+b.height+8,width:b.width,height:m.bottom},m.options):[];return{...N,shapes:[...v.map(($,R)=>de(b.x-8,y(b.y+(R+.5)*P),$,{part:"y-label",anchor:"end",baseline:"middle"})),...M.flatMap(($,R)=>$?[de(y(b.x+(R+.5)*O),b.y-8,$,{part:"x-label",anchor:t?"start":"middle"})]:[]),...z,..._,...D,...N.shapes],issues:n}}function q(e,n,t,r,i){let o=e.getBoundingClientRect();return{x:o.width?(n-o.left)*r/o.width:n,y:o.height?(t-o.top)*i/o.height:t}}var Ae=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function Lt(e,n){let t=0,r=1/0;return e.xs.forEach((i,o)=>{let s=Math.abs(i-n);s<r&&(r=s,t=o)}),t}function re(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=Lt(t,n),i=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(i,r)??i}}function Re(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[Lt(t,n)];return{kind:"line",part:"crosshair",x1:r,x2:r,y1:t.plot.y,y2:t.plot.y+t.plot.height,stroke:C.axis,dash:"3 3"}}function Be(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!Ae(r.plot,n,t))return[];let i=Re(e,n),{rows:o}=re(e,n),s=e.tooltipAnchored?r.plot.y+8:t;return[i,...ce(i.x1,s,o,e.width,e.height,e.tooltipPlacement)]}function Pe(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 Be(e,i,t.plot.y+8)}function Ne(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:l,y:d}=q(t,r,i,e.width,e.height);if(Ae(e.hit.plot,l,d)){let u=re(e,l),h=Re(e,l);if(u&&h)return{lines:u.rows,shapes:[h]}}}let o=n?.closest?.("[data-skdx-part]"),s=e.tooltipFormatter?Z(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 zt(e,n,t,r,i,o,s){let a=e?.closest?.("[data-skdx-part]"),l=s&&s.tooltipFormatter?Z(s,e)?.item:void 0,d=l&&s?.tooltipFormatter?.(l)||a&&Array.from(a.children).find(k=>k.tagName.toLowerCase()==="title")?.textContent;if(!d)return[];let u=s?.tooltipAnchored?Z(s,e):void 0,h=u?s?.shapes[u.index]:void 0,{x:m,y:b}=h?ie(h):q(n,t,r,i,o);return ce(m,b,d,i,o,s?.tooltipPlacement)}function De(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:s}=q(t,r,i,e.width,e.height),a=Be(e,o,s);if(a.length>0)return a}return zt(n,t,r,i,e.width,e.height,e)}function Ge(e,n){let t=Z(e,n);return t&&!t.item.legend?E(t.item):null}var hn=(e,n)=>{let{x:t,y:r}=ie(e),i=e.kind==="circle"?e.cy:e.kind==="rect"?e.y+e.height/2:r;return t>=n.x&&t<=n.x+n.width&&i>=n.y&&i<=n.y+n.height};function Fe(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!hn(i,n))continue;let o=E(i.item),s=JSON.stringify(o);t.has(s)||(t.add(s),r.push(o))}return r}var _e=e=>({kind:"rect",part:"selection-box",x:y(e.x),y:y(e.y),width:y(e.width),height:y(e.height),fill:C.focus,opacity:.12,stroke:C.focus}),fe=(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 At(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 Ve(e,n){if(n.length<3)return[];let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor")continue;let{x:o,y:s}=ie(i),a=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:s;if(!At(n,o,a))continue;let l=E(i.item),d=JSON.stringify(l);t.has(d)||(t.add(d),r.push(l))}return r}var je=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${y(n.x)} ${y(n.y)}`).join("L")}`:"",fill:C.focus,fillOpacity:.12,stroke:C.focus,dash:"4 3"}),pe=6;function Ee(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-pe||n>i.x1+pe))return Math.abs(n-i.x0)<=pe?{bar:i,mode:"start"}:Math.abs(n-i.x1)<=pe?{bar:i,mode:"end"}:{bar:i,mode:"move"}}}function Ze(e,n,t){let r=e.edit;return Rt(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function We(e,n,t){let r=e.edit,i=t.key==="ArrowRight"?1:t.key==="ArrowLeft"?-1:0;if(!r||n===null||!i||!(t.shiftKey||t.altKey))return;let o=r.bars.find(l=>l.index===n);if(!o)return;let s=t.altKey?t.shiftKey?"start":"end":"move",a=r.snap??r.invert(o.x0+10)-r.invert(o.x0);return Rt(r,{bar:o,mode:s},i*a)}function Rt(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 He(e,n,t){let r=e.edit,i=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:y(Math.min(i,o)),y:y(n.bar.y),width:y(Math.max(1,Math.abs(o-i))),height:y(n.bar.height),fill:C.focus,opacity:.25,stroke:C.focus,rx:2}}var pn=64,fn=e=>Math.max(1,Math.min(pn,e));function Ue(e,n,t,r){let i=n>0?.8:1.25,o=fn(e.view.zoom*i);if(o===e.view.zoom)return e.view;let{plot:s,scale:a}=e,[l,d]=e.view.center,u=(t-(s.x+s.width/2))/a,h=(r-(s.y+s.height/2))/a,m=e.view.zoom/o;return{center:[l+u*(1-m),e.fromY(e.toY(d)-h*(1-m))],zoom:o}}function Ke(e,n,t,r){let{scale:i}=e;return{center:[n.center[0]-t/i,e.fromY(e.toY(n.center[1])+r/i)],zoom:n.zoom}}function Z(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 me=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function ie(e){switch(e.kind){case"rect":return{x:e.x+e.width/2,y:e.y};case"circle":return{x:e.cx,y:e.cy-e.r};case"line":return{x:(e.x1+e.x2)/2,y:Math.min(e.y1,e.y2)};case"text":return{x:e.x,y:e.y};case"path":{let n=/M\s*(-?[\d.]+)[ ,](-?[\d.]+)/.exec(e.d);return n?{x:Number(n[1]),y:Number(n[2])}:{x:0,y:0}}}}function qe(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let r=C.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*W+4,height:16,fill:"none",stroke:r,rx:2};break;case"path":i={kind:"path",part:"focus",d:t.d,stroke:r,strokeWidth:2,fill:"none"};break}let{x:o,y:s}=ie(t),a=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...a?ce(y(o),y(s),a,e.width,e.height):[]]}function Ye(e,n,t){let r=me(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 U=2,K=(e,n,t)=>{let r=Math.max(U,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},Bt=(e,n)=>!e||e.start<=0&&e.end>=n;function Xe(e,n,t){if(e.count<=U||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,s=n>0?1.25:.8,a=Math.max(U,Math.min(e.count,Math.round(o*s)));if(a===o)return n>0&&!Bt(e.zoom,e.count)?K(r,a,e.count):void 0;let l=Math.max(0,Math.min(1,(t-e.plot.x)/e.plot.width)),d=r+l*o;return K(d-l*a,a,e.count)}function Qe(e,n,t,r){let i=n.end-n.start,o=Math.max(U,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 K(n.start+s*i-s*o,o,e.count)}function Je(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return K(n.start-t/i,r,e.count)}function et(e,n,t){let r=e.brush;if(!r||!Ae(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:K(s-o/2,o,e.count)}}function tt(e,n,t,r){let i=e.brush;if(!i)return t;let o=r/Math.max(1,i.box.width)*e.count;if(n==="move")return K(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-U,Math.round(t.start+o))),end:t.end};let s=Math.min(e.count,Math.max(t.start+U,Math.round(t.end+o)));return{start:t.start,end:s}}function rt(e,n){switch(n.type){case"svg":return Promise.resolve(nt(e,n.label,n.resolve));case"csv":return Promise.resolve(Gt(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=nt(e,n.label,n.resolve);return Dt(t,e.width,e.height,n.scale,n.background)}}}var F=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/"/g,"""),oe=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${F(String(t))}"`).join("");function Pt(e){let n=e.title?`<title>${F(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${oe([t,["d",e.d],["fill",e.fill??"none"],["stroke",e.stroke],["stroke-width",e.strokeWidth],["stroke-linecap",e.strokeLinecap],["stroke-linejoin",e.strokeLinejoin],["stroke-dasharray",e.dash],["opacity",e.opacity],["fill-opacity",e.fillOpacity]])}>${n}</path>`;case"rect":return`<rect${oe([t,["x",e.x],["y",e.y],["width",e.width],["height",e.height],["rx",e.rx],["fill",e.fill],["stroke",e.stroke],["fill-opacity",e.opacity]])}>${n}</rect>`;case"line":return`<line${oe([t,["x1",e.x1],["y1",e.y1],["x2",e.x2],["y2",e.y2],["stroke",e.stroke],["stroke-width",e.strokeWidth],["stroke-dasharray",e.dash],["opacity",e.opacity]])}>${n}</line>`;case"circle":return`<circle${oe([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${oe([t,["x",e.x],["y",e.y],["text-anchor",e.anchor],["dominant-baseline",e.baseline],["fill",e.fill],["font-weight",e.weight],["transform",e.rotate?`rotate(${e.rotate} ${e.x} ${e.y})`:void 0]])}>${F(e.text)}</text>`}}function Nt(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 nt(e,n,t){let r=Nt(e)+e.shapes.map(Pt).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(C.fontFamily)}" font-size="${F(C.fontSize)}"><title>${F(n)}</title>${r}</svg>`}function Dt(e,n,t,r=2,i){return new Promise((o,s)=>{let a=URL.createObjectURL(new Blob([e],{type:"image/svg+xml;charset=utf-8"})),l=new Image;l.onload=()=>{URL.revokeObjectURL(a);let d=document.createElement("canvas");d.width=Math.round(n*r),d.height=Math.round(t*r);let u=d.getContext("2d");if(!u)return s(new Error("canvas 2d context unavailable"));i&&(u.fillStyle=i,u.fillRect(0,0,d.width,d.height)),u.drawImage(l,0,0,d.width,d.height),d.toBlob(h=>h?o(h):s(new Error("toBlob failed")),"image/png")},l.onerror=()=>{URL.revokeObjectURL(a),s(new Error("svg could not be decoded"))},l.src=a})}function Gt(e){let n=t=>{let r=t==null?"":String(t);return/[",\n\r]/.test(r)?`"${r.replace(/"/g,'""')}"`:r};return e.map(t=>t.map(n).join(",")).join(`\r
|
|
2
|
+
`)}function it(e,n){if(!n)return;let t=typeof n=="object"?n.maxRows??500:500,r=e.hit;if(r&&r.rows.length>0){let a=r.rows[0];if(r.rows.length>t)return;let l=["",...a.slice(1).map(u=>u.replace(/:\s[^:]*$/,""))],d=r.rows.map(u=>[u[0],...u.slice(1).map(h=>h.slice(h.lastIndexOf(": ")+2))]);return[l,...d]}let i=e.shapes.flatMap(a=>a.item&&!a.item.legend&&!(a.part==="anchor"&&!a.title)?[a.item]:[]);if(i.length===0||i.length>t)return;let o=["series","name","category","value"].filter(a=>i.some(l=>l[a]!==void 0)),s=(a,l)=>a[l]===void 0?"":String(a[l]);return[o.map(a=>a[0]?.toUpperCase()+a.slice(1)),...i.map(a=>o.map(l=>s(a,l)))]}var ot=new Map;function ge(e){let n=ot.get(e);if(n)return n.group;let t=new Set,r={},i={current:r,subscribe(o){return t.add(o),()=>{t.delete(o),t.size===0&&ot.delete(e)}},publish(o,s){Object.assign(r,o);for(let a of t)a(o,s)}};return ot.set(e,{group:i,listeners:t}),i}var Ft='[data-skdx-part]:not([data-skdx-part^="tooltip"]):not([data-skdx-part="focus"]):not([data-skdx-part="crosshair"])',st=`@keyframes skdx-in{from{opacity:0}to{opacity:1}}${Ft}{animation:skdx-in var(--skdx-chart-duration,0ms) ease-out;transition:${["x","y","width","height","cx","cy","r","opacity","fill-opacity","d"].map(e=>`${e} var(--skdx-chart-duration,0ms) ease-out`).join(",")}}@media (prefers-reduced-motion:reduce){${Ft}{animation:none;transition:none}}`;function at(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}var g=require("lit"),p=require("lit/decorators.js"),S=require("lit/directives/if-defined.js");var mn={fromAttribute:()=>!1},w=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=[_e(fe(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=[je(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=Ze(r,i.gantt,o-i.x),this.overlay=[He(r,i.gantt,i.change)];return}if(i?.grab==="map"){if(!r.map||!i.view)return;let{x:o,y:s}=this.viewBox(t,r);this.setView(Ke(r.map,i.view,o-i.x,s-i.y));return}if(i&&r.hit){if(i.grab==="pinch"){let[s,a]=[...this.pointers.values()];if(s===void 0||a===void 0||!i.distance)return;this.setZoom(Qe(r.hit,i.zoom,Math.abs(s-a)/i.distance,(s+a)/2));return}let{x:o}=this.viewBox(t,r);this.setZoom(i.grab==="pan"?Je(r.hit,i.zoom,o-i.x):tt(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:s}=Ne(r,t.target,t.currentTarget,t.clientX,t.clientY);this.tip=s,this.portal=o.length?{x:t.clientX,y:t.clientY,lines:o}:null}else{let o=De(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(Ge(r,t.target)),this.syncId&&r.hit?.crosshair){let o=re(r,this.viewBox(t,r).x);this.shareCrosshair(o?r.hit.rows[o.index]?.[0]??null:null)}};this.onPointerDown=t=>{let r=this.layout;if(!r||t.button!==0)return;let{x:i,y:o}=this.viewBox(t,r),s=Z(r,t.target)?.item.legend,a=this.canEdit(r)?Ee(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 d=r.map.plot;if(i<d.x||i>d.x+d.width||o<d.y||o>d.y+d.height)return;this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"map",view:r.map.view},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}let l=r.hit;if(!(!l||!this.canZoom(r))){if(this.pointers.set(t.pointerId,i),this.pointers.size===2){let[d,u]=[...this.pointers.values()];this.drag={x:(d+u)/2,y:o,zoom:l.zoom,grab:"pinch",distance:Math.abs(d-u)||1}}else{let d=et(l,i,o);if(d)this.drag={x:i,y:o,zoom:d.zoom,grab:d.grab},d.zoom!==l.zoom&&this.setZoom(d.zoom);else if(this.zoomable&&i>=l.plot.x&&i<=l.plot.x+l.plot.width&&o>=l.plot.y&&o<=l.plot.y+l.plot.height)this.drag={x:i,y:o,zoom:l.zoom,grab:"pan"};else{this.pointers.delete(t.pointerId);return}}t.currentTarget.setPointerCapture(t.pointerId),this.clearTip()}};this.onPointerUp=t=>{this.pointers.delete(t.pointerId);let r=t.currentTarget;r.hasPointerCapture(t.pointerId)&&r.releasePointerCapture(t.pointerId);let i=this.drag,o=this.layout;if(o&&(i?.grab==="select"||i?.grab==="lasso"||i?.grab==="edit"||i?.grab==="map")){this.overlay=[];let{x:s,y:a}=this.viewBox(t,o);if(Math.abs(s-i.x)>2||Math.abs(a-i.y)>2){i.grab==="select"?this.setSelected(Fe(o,fe(i.x,i.y,s,a))):i.grab==="lasso"?this.setSelected(Ve(o,i.points??[])):i.grab==="edit"&&i.change&&this.emit("skdx-task-change",i.change),this.drag={...i,distance:-1};return}this.drag=null;return}(this.pointers.size===0||this.drag?.grab==="pinch")&&(this.drag=null)};this.onWheel=t=>{let r=this.layout;if(!r)return;let{x:i,y:o}=this.viewBox(t,r);if(r.map&&this.canPan(r)){let l=r.map.plot;if(i<l.x||i>l.x+l.width||o<l.y||o>l.y+l.height)return;t.preventDefault(),this.setView(Ue(r.map,t.deltaY,i,o));return}let s=r.hit;if(!s||!this.canZoom(r)||o<s.plot.y||o>s.plot.y+s.plot.height)return;let a=Xe(s,t.deltaY,i);a&&(t.preventDefault(),this.setZoom(a))};this.onClick=t=>{if(!this.layout)return;if(this.drag?.distance===-1){this.drag=null;return}let r=Z(this.layout,t.target);r&&(r.item.range?this.setZoom(r.item.range):r.item.legend&&r.item.series!==void 0?this.toggle(r.item.series):(this.select(r.item),this.emit("skdx-item-click",r.item)))};this.onKeyDown=t=>{let r=this.layout;if(!r)return;if((t.key==="Enter"||t.key===" ")&&this.focused!==null){let a=r.shapes[this.focused]?.item;a&&(t.preventDefault(),this.select(a),this.emit("skdx-item-click",a));return}let i=this.canEdit(r)?We(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=Ye(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?E(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:d,emptyMessage:u,description:h,decorative:m,animated:b,responsive:k,highlighted:x,highlightScope:f,accessibleTable:v}=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:b,responsive:k,legend:i,tooltip:o,format:s,palette:a,loading:l,error:d,emptyMessage:u,description:h,decorative:m,highlighted:x===void 0?this.highlightState:x,highlightScope:f,accessibleTable:v,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&&ge(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=ge(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(Ie(this.selected??this.selectedState,t,r==="single"?"single":"multiple"))}shareCrosshair(t){!this.syncId||this.lastCross===t||(this.lastCross=t,this.publish({crosshair:t}))}clearTip(){this.tip=[],this.portal=null,this.shareCrosshair(null)}canZoom(t){return!!(t.hit&&(this.zoomable||t.hit.brush))}canPan(t){return!!(t.map&&this.zoomable)}canEdit(t){return!!(this.editable&&t.edit)}brushing(){return this.selectionMode==="brush"||this.selectionMode==="lasso"}viewBox(t,r){return q(t.currentTarget,t.clientX,t.clientY,r.width,r.height)}getSvgElement(){return this.renderRoot.querySelector("svg")}getLayout(){return this.layout}resetZoom(){this.setZoom(void 0)}zoomTo(t){this.setZoom(t)}focusItem(t){let r=this.layout;if(!r)return!1;let i=r.shapes.findIndex(o=>o.item&&!o.item.legend&&G(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?rt(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=Te(Se(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let v of o.issues??[])this.emit("skdx-data-issue",v)}let s=this.canZoom(o),a=this.canPan(o),l=this.canEdit(o),d=this.brushing(),u=s||a||l||d,h=!o.decorative&&me(o).length>0,m=o.description?`${r}-desc`:void 0,b=at(o),k=it(o,this.accessibleTable),x=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,f=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,S.ifDefined)(m)}
|
|
11
|
+
tabindex=${h?0:g.nothing}
|
|
12
|
+
data-skdx-chart=${r}
|
|
13
|
+
data-zoomable=${s||a?"":g.nothing}
|
|
14
|
+
data-brushing=${d&&!(s||a)?"":g.nothing}
|
|
15
|
+
data-editable=${l?"":g.nothing}
|
|
16
|
+
style=${b?`--skdx-chart-duration:${b}`:g.nothing}
|
|
17
|
+
font-family=${C.fontFamily}
|
|
18
|
+
font-size=${C.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=${h?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,S.ifDefined)(m)}>${o.description}</desc>`:g.nothing}
|
|
32
|
+
${b?g.svg`<style>${st}</style>`:g.nothing} ${gn(o)}
|
|
33
|
+
${be(o.shapes)}
|
|
34
|
+
${be(this.tip.length||!this.crossState?this.tip:Pe(o,this.crossState))}
|
|
35
|
+
${be(qe(o,this.focused))} ${be(this.overlay)}
|
|
36
|
+
</svg>
|
|
37
|
+
${f?g.html`<div
|
|
38
|
+
role="tooltip"
|
|
39
|
+
data-skdx-tooltip=${r}
|
|
40
|
+
style="left:${f.x+12}px;top:${f.y+12}px"
|
|
41
|
+
>
|
|
42
|
+
${f.lines.map(v=>g.html`<div>${v}</div>`)}
|
|
43
|
+
</div>`:g.nothing}
|
|
44
|
+
${k?g.html`<table data-skdx-table=${r}>
|
|
45
|
+
<caption>
|
|
46
|
+
${x}
|
|
47
|
+
</caption>
|
|
48
|
+
<thead>
|
|
49
|
+
<tr>
|
|
50
|
+
${(k[0]??[]).map(v=>g.html`<th scope="col">${v}</th>`)}
|
|
51
|
+
</tr>
|
|
52
|
+
</thead>
|
|
53
|
+
<tbody>
|
|
54
|
+
${k.slice(1).map(v=>g.html`<tr>
|
|
55
|
+
${v.map((M,O)=>O===0?g.html`<th scope="row">${M}</th>`:g.html`<td>${M}</td>`)}
|
|
56
|
+
</tr>`)}
|
|
57
|
+
</tbody>
|
|
58
|
+
</table>`:g.nothing}`}};w.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
|
+
`,c([(0,p.property)({type:Number})],w.prototype,"width",2),c([(0,p.property)({type:Number})],w.prototype,"height",2),c([(0,p.property)()],w.prototype,"label",2),c([(0,p.property)({type:Boolean,reflect:!0})],w.prototype,"legend",2),c([(0,p.property)({type:Boolean,attribute:"no-tooltip",converter:mn})],w.prototype,"tooltip",2),c([(0,p.property)({attribute:!1})],w.prototype,"format",2),c([(0,p.property)({attribute:!1})],w.prototype,"palette",2),c([(0,p.property)({attribute:!1})],w.prototype,"hiddenSeries",2),c([(0,p.property)({attribute:!1})],w.prototype,"selected",2),c([(0,p.property)({attribute:"selection-mode"})],w.prototype,"selectionMode",2),c([(0,p.property)({attribute:!1})],w.prototype,"highlighted",2),c([(0,p.property)({attribute:!1})],w.prototype,"highlightScope",2),c([(0,p.property)({type:Boolean,reflect:!0})],w.prototype,"loading",2),c([(0,p.property)()],w.prototype,"error",2),c([(0,p.property)({attribute:"empty-message"})],w.prototype,"emptyMessage",2),c([(0,p.property)()],w.prototype,"description",2),c([(0,p.property)({type:Boolean,reflect:!0})],w.prototype,"decorative",2),c([(0,p.property)({type:Boolean,attribute:"accessible-table"})],w.prototype,"accessibleTable",2),c([(0,p.property)({attribute:!1})],w.prototype,"zoom",2),c([(0,p.property)({attribute:!1})],w.prototype,"view",2),c([(0,p.property)({type:Boolean,reflect:!0})],w.prototype,"zoomable",2),c([(0,p.property)({type:Boolean,reflect:!0})],w.prototype,"editable",2),c([(0,p.property)({attribute:"sync-id"})],w.prototype,"syncId",2),c([(0,p.property)({type:Boolean,attribute:"cross-filter"})],w.prototype,"crossFilter",2),c([(0,p.property)({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],w.prototype,"animated",2),c([(0,p.property)({type:Boolean,reflect:!0})],w.prototype,"responsive",2),c([(0,p.state)()],w.prototype,"tip",2),c([(0,p.state)()],w.prototype,"overlay",2),c([(0,p.state)()],w.prototype,"portal",2),c([(0,p.state)()],w.prototype,"measured",2),c([(0,p.state)()],w.prototype,"viewState",2),c([(0,p.state)()],w.prototype,"highlightState",2),c([(0,p.state)()],w.prototype,"crossState",2),c([(0,p.state)()],w.prototype,"focused",2),c([(0,p.state)()],w.prototype,"hiddenState",2),c([(0,p.state)()],w.prototype,"zoomState",2),c([(0,p.state)()],w.prototype,"selectedState",2);var I=class extends w{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:d,curve:u,connectNulls:h,nulls:m,stacked:b,stackOffset:k,orientation:x,radius:f,barGap:v,barWidth:M,sort:O,transform:P,transforms:B,bins:z,binWidth:_,binDomain:V,binMode:A,sampling:N,brush:D,crosshair:$}=this;return{...this.sized(),series:t,categories:r,xAxis:i,yAxis:o,rightAxis:s,references:a,annotations:l,labels:d,curve:u,connectNulls:h,nulls:m,stacked:b,stackOffset:k,orientation:x,radius:f,barGap:v,barWidth:M,sort:O,transform:P,transforms:B,bins:z,binWidth:_,binDomain:V,binMode:A,sampling:N,brush:D,crosshair:$}}};c([(0,p.property)({attribute:!1})],I.prototype,"series",2),c([(0,p.property)({attribute:!1})],I.prototype,"categories",2),c([(0,p.property)({attribute:!1})],I.prototype,"xAxis",2),c([(0,p.property)({attribute:!1})],I.prototype,"yAxis",2),c([(0,p.property)({attribute:!1})],I.prototype,"rightAxis",2),c([(0,p.property)({attribute:!1})],I.prototype,"references",2),c([(0,p.property)({attribute:!1})],I.prototype,"annotations",2),c([(0,p.property)({type:Boolean,reflect:!0})],I.prototype,"labels",2),c([(0,p.property)()],I.prototype,"curve",2),c([(0,p.property)({type:Boolean,attribute:"connect-nulls"})],I.prototype,"connectNulls",2),c([(0,p.property)()],I.prototype,"nulls",2),c([(0,p.property)({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],I.prototype,"stacked",2),c([(0,p.property)({attribute:"stack-offset"})],I.prototype,"stackOffset",2),c([(0,p.property)()],I.prototype,"orientation",2),c([(0,p.property)({type:Number})],I.prototype,"radius",2),c([(0,p.property)({type:Number,attribute:"bar-gap"})],I.prototype,"barGap",2),c([(0,p.property)({type:Number,attribute:"bar-width"})],I.prototype,"barWidth",2),c([(0,p.property)()],I.prototype,"sort",2),c([(0,p.property)()],I.prototype,"transform",2),c([(0,p.property)({attribute:!1})],I.prototype,"transforms",2),c([(0,p.property)({type:Number})],I.prototype,"bins",2),c([(0,p.property)({type:Number,attribute:"bin-width"})],I.prototype,"binWidth",2),c([(0,p.property)({attribute:!1})],I.prototype,"binDomain",2),c([(0,p.property)({attribute:"bin-mode"})],I.prototype,"binMode",2),c([(0,p.property)({attribute:!1})],I.prototype,"sampling",2),c([(0,p.property)({type:Boolean,reflect:!0})],I.prototype,"brush",2),c([(0,p.property)({type:Boolean,reflect:!0})],I.prototype,"crosshair",2);var gn=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,S.ifDefined)(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:g.nothing,be=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,S.ifDefined)(i)} d=${n.d} fill=${n.fill??"none"} stroke=${(0,S.ifDefined)(n.stroke)} stroke-width=${(0,S.ifDefined)(n.strokeWidth)} stroke-linecap=${(0,S.ifDefined)(n.strokeLinecap)} stroke-linejoin=${(0,S.ifDefined)(n.strokeLinejoin)} stroke-dasharray=${(0,S.ifDefined)(n.dash)} opacity=${(0,S.ifDefined)(n.opacity)} fill-opacity=${(0,S.ifDefined)(n.fillOpacity)}>${r}</path>`;case"rect":return g.svg`<rect data-skdx-part=${n.part} data-skdx-i=${(0,S.ifDefined)(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${(0,S.ifDefined)(n.rx)} fill=${n.fill} stroke=${(0,S.ifDefined)(n.stroke)} fill-opacity=${(0,S.ifDefined)(n.opacity)}>${r}</rect>`;case"line":return g.svg`<line data-skdx-part=${n.part} data-skdx-i=${(0,S.ifDefined)(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${(0,S.ifDefined)(n.strokeWidth)} stroke-dasharray=${(0,S.ifDefined)(n.dash)} opacity=${(0,S.ifDefined)(n.opacity)}>${r}</line>`;case"circle":return g.svg`<circle data-skdx-part=${n.part} data-skdx-i=${(0,S.ifDefined)(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${(0,S.ifDefined)(n.stroke)} opacity=${(0,S.ifDefined)(n.opacity)}>${r}</circle>`;case"text":return g.svg`<text data-skdx-part=${n.part} data-skdx-i=${(0,S.ifDefined)(i)} x=${n.x} y=${n.y} text-anchor=${(0,S.ifDefined)(n.anchor)} dominant-baseline=${(0,S.ifDefined)(n.baseline)} fill=${(0,S.ifDefined)(n.fill)} font-weight=${(0,S.ifDefined)(n.weight)} pointer-events=${(0,S.ifDefined)(i===void 0?"none":void 0)} transform=${(0,S.ifDefined)(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var T=class extends w{constructor(){super(...arguments);this.diverging=!1;this.labels=!1}render(){let{rows:t,columns:r,data:i,calendar:o,color:s,diverging:a,negativeColor:l,labels:d,domain:u,steps:h,weekStart:m,colorScale:b,colorLegend:k,missingColor:x,cellGap:f,cellRadius:v,rowOrder:M,columnOrder:O}=this;return this.root(ze({...this.sized(),rows:t,columns:r,data:i,calendar:o,color:s,diverging:a,negativeColor:l,labels:d,domain:u,steps:h,weekStart:m,colorScale:b,colorLegend:k,missingColor:x,cellGap:f,cellRadius:v,rowOrder:M,columnOrder:O}),"heatmap",this.label??"Heatmap")}};c([(0,L.property)({attribute:!1})],T.prototype,"rows",2),c([(0,L.property)({attribute:!1})],T.prototype,"columns",2),c([(0,L.property)({attribute:!1})],T.prototype,"data",2),c([(0,L.property)({attribute:!1})],T.prototype,"calendar",2),c([(0,L.property)()],T.prototype,"color",2),c([(0,L.property)({type:Boolean,reflect:!0})],T.prototype,"diverging",2),c([(0,L.property)({attribute:"negative-color"})],T.prototype,"negativeColor",2),c([(0,L.property)({type:Boolean,reflect:!0})],T.prototype,"labels",2),c([(0,L.property)({attribute:!1})],T.prototype,"domain",2),c([(0,L.property)({type:Number})],T.prototype,"steps",2),c([(0,L.property)({attribute:"week-start"})],T.prototype,"weekStart",2),c([(0,L.property)({attribute:!1})],T.prototype,"colorScale",2),c([(0,L.property)({attribute:!1})],T.prototype,"colorLegend",2),c([(0,L.property)({attribute:"missing-color"})],T.prototype,"missingColor",2),c([(0,L.property)({type:Number,attribute:"cell-gap"})],T.prototype,"cellGap",2),c([(0,L.property)({type:Number,attribute:"cell-radius"})],T.prototype,"cellRadius",2),c([(0,L.property)({attribute:"row-order"})],T.prototype,"rowOrder",2),c([(0,L.property)({attribute:"column-order"})],T.prototype,"columnOrder",2),T=c([(0,L.customElement)("skdx-heatmap")],T);0&&(module.exports={SkdxHeatmap});
|