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