@skdx/web-components-charts 0.38.0 → 0.40.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.
Files changed (167) hide show
  1. package/dist/area.cjs +38 -35
  2. package/dist/area.d.cts +1 -1
  3. package/dist/area.d.ts +1 -1
  4. package/dist/area.js +28 -25
  5. package/dist/bar.cjs +38 -35
  6. package/dist/bar.d.cts +1 -1
  7. package/dist/bar.d.ts +1 -1
  8. package/dist/bar.js +28 -25
  9. package/dist/boxplot.cjs +33 -30
  10. package/dist/boxplot.d.cts +1 -1
  11. package/dist/boxplot.d.ts +1 -1
  12. package/dist/boxplot.js +40 -37
  13. package/dist/bubble.cjs +37 -34
  14. package/dist/bubble.d.cts +1 -1
  15. package/dist/bubble.d.ts +1 -1
  16. package/dist/bubble.js +25 -22
  17. package/dist/bullet.cjs +40 -37
  18. package/dist/bullet.d.cts +1 -1
  19. package/dist/bullet.d.ts +1 -1
  20. package/dist/bullet.js +40 -37
  21. package/dist/bump.cjs +38 -35
  22. package/dist/bump.d.cts +1 -1
  23. package/dist/bump.d.ts +1 -1
  24. package/dist/bump.js +38 -35
  25. package/dist/candlestick.cjs +38 -35
  26. package/dist/candlestick.d.cts +1 -1
  27. package/dist/candlestick.d.ts +1 -1
  28. package/dist/candlestick.js +40 -37
  29. package/dist/chord.cjs +40 -37
  30. package/dist/chord.d.cts +1 -1
  31. package/dist/chord.d.ts +1 -1
  32. package/dist/chord.js +38 -35
  33. package/dist/circle-packing.cjs +31 -28
  34. package/dist/circle-packing.d.cts +1 -1
  35. package/dist/circle-packing.d.ts +1 -1
  36. package/dist/circle-packing.js +30 -27
  37. package/dist/combo.cjs +38 -35
  38. package/dist/combo.d.cts +1 -1
  39. package/dist/combo.d.ts +1 -1
  40. package/dist/combo.js +28 -25
  41. package/dist/dumbbell.cjs +37 -34
  42. package/dist/dumbbell.d.cts +1 -1
  43. package/dist/dumbbell.d.ts +1 -1
  44. package/dist/dumbbell.js +40 -37
  45. package/dist/funnel.cjs +30 -27
  46. package/dist/funnel.d.cts +1 -1
  47. package/dist/funnel.d.ts +1 -1
  48. package/dist/funnel.js +40 -37
  49. package/dist/gantt.cjs +40 -37
  50. package/dist/gantt.d.cts +1 -1
  51. package/dist/gantt.d.ts +1 -1
  52. package/dist/gantt.js +30 -27
  53. package/dist/gauge.cjs +35 -32
  54. package/dist/gauge.d.cts +1 -1
  55. package/dist/gauge.d.ts +1 -1
  56. package/dist/gauge.js +39 -36
  57. package/dist/heatmap.cjs +38 -35
  58. package/dist/heatmap.d.cts +1 -1
  59. package/dist/heatmap.d.ts +1 -1
  60. package/dist/heatmap.js +30 -27
  61. package/dist/histogram.cjs +40 -37
  62. package/dist/histogram.d.cts +1 -1
  63. package/dist/histogram.d.ts +1 -1
  64. package/dist/histogram.js +30 -27
  65. package/dist/icicle.cjs +40 -37
  66. package/dist/icicle.d.cts +1 -1
  67. package/dist/icicle.d.ts +1 -1
  68. package/dist/icicle.js +40 -37
  69. package/dist/{index-oF5ss8v9.d.cts → index-D44-61v7.d.cts} +11 -5
  70. package/dist/{index-oF5ss8v9.d.ts → index-D44-61v7.d.ts} +11 -5
  71. package/dist/index.cjs +40 -37
  72. package/dist/index.d.cts +2 -2
  73. package/dist/index.d.ts +2 -2
  74. package/dist/index.js +40 -37
  75. package/dist/line.cjs +38 -35
  76. package/dist/line.d.cts +1 -1
  77. package/dist/line.d.ts +1 -1
  78. package/dist/line.js +28 -25
  79. package/dist/linear-gauge.cjs +40 -37
  80. package/dist/linear-gauge.d.cts +1 -1
  81. package/dist/linear-gauge.d.ts +1 -1
  82. package/dist/linear-gauge.js +40 -37
  83. package/dist/map.cjs +40 -37
  84. package/dist/map.d.cts +1 -1
  85. package/dist/map.d.ts +1 -1
  86. package/dist/map.js +40 -37
  87. package/dist/marimekko.cjs +32 -29
  88. package/dist/marimekko.d.cts +1 -1
  89. package/dist/marimekko.d.ts +1 -1
  90. package/dist/marimekko.js +33 -30
  91. package/dist/network.cjs +26 -23
  92. package/dist/network.d.cts +1 -1
  93. package/dist/network.d.ts +1 -1
  94. package/dist/network.js +40 -37
  95. package/dist/organization.cjs +29 -26
  96. package/dist/organization.d.cts +1 -1
  97. package/dist/organization.d.ts +1 -1
  98. package/dist/organization.js +40 -37
  99. package/dist/parallel.cjs +25 -22
  100. package/dist/parallel.d.cts +1 -1
  101. package/dist/parallel.d.ts +1 -1
  102. package/dist/parallel.js +37 -34
  103. package/dist/pareto.cjs +40 -37
  104. package/dist/pareto.d.cts +1 -1
  105. package/dist/pareto.d.ts +1 -1
  106. package/dist/pareto.js +26 -23
  107. package/dist/pie.cjs +40 -37
  108. package/dist/pie.d.cts +1 -1
  109. package/dist/pie.d.ts +1 -1
  110. package/dist/pie.js +39 -36
  111. package/dist/polar-area.cjs +40 -37
  112. package/dist/polar-area.d.cts +1 -1
  113. package/dist/polar-area.d.ts +1 -1
  114. package/dist/polar-area.js +40 -37
  115. package/dist/radar.cjs +27 -24
  116. package/dist/radar.d.cts +1 -1
  117. package/dist/radar.d.ts +1 -1
  118. package/dist/radar.js +40 -37
  119. package/dist/radial.cjs +39 -36
  120. package/dist/radial.d.cts +1 -1
  121. package/dist/radial.d.ts +1 -1
  122. package/dist/radial.js +39 -36
  123. package/dist/range.cjs +40 -37
  124. package/dist/range.d.cts +1 -1
  125. package/dist/range.d.ts +1 -1
  126. package/dist/range.js +30 -27
  127. package/dist/sankey.cjs +29 -26
  128. package/dist/sankey.d.cts +1 -1
  129. package/dist/sankey.d.ts +1 -1
  130. package/dist/sankey.js +40 -37
  131. package/dist/scatter.cjs +38 -35
  132. package/dist/scatter.d.cts +1 -1
  133. package/dist/scatter.d.ts +1 -1
  134. package/dist/scatter.js +31 -28
  135. package/dist/sparkline.cjs +23 -20
  136. package/dist/sparkline.d.cts +1 -1
  137. package/dist/sparkline.d.ts +1 -1
  138. package/dist/sparkline.js +38 -35
  139. package/dist/sunburst.cjs +40 -37
  140. package/dist/sunburst.d.cts +1 -1
  141. package/dist/sunburst.d.ts +1 -1
  142. package/dist/sunburst.js +40 -37
  143. package/dist/swarm.cjs +36 -33
  144. package/dist/swarm.d.cts +1 -1
  145. package/dist/swarm.d.ts +1 -1
  146. package/dist/swarm.js +37 -34
  147. package/dist/timeline.cjs +24 -21
  148. package/dist/timeline.d.cts +1 -1
  149. package/dist/timeline.d.ts +1 -1
  150. package/dist/timeline.js +40 -37
  151. package/dist/tree.cjs +24 -21
  152. package/dist/tree.d.cts +1 -1
  153. package/dist/tree.d.ts +1 -1
  154. package/dist/tree.js +38 -35
  155. package/dist/treemap.cjs +27 -24
  156. package/dist/treemap.d.cts +1 -1
  157. package/dist/treemap.d.ts +1 -1
  158. package/dist/treemap.js +40 -37
  159. package/dist/waffle.cjs +21 -18
  160. package/dist/waffle.d.cts +1 -1
  161. package/dist/waffle.d.ts +1 -1
  162. package/dist/waffle.js +37 -34
  163. package/dist/waterfall.cjs +33 -30
  164. package/dist/waterfall.d.cts +1 -1
  165. package/dist/waterfall.d.ts +1 -1
  166. package/dist/waterfall.js +34 -31
  167. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1,61 +1,62 @@
1
- var Js=Object.defineProperty;var ei=Object.getOwnPropertyDescriptor;var m=(e,n,t,r)=>{for(var a=r>1?void 0:r?ei(n,t):n,o=e.length-1,s;o>=0;o--)(s=e[o])&&(a=(r?s(n,t,a):s(a))||a);return r&&a&&Js(n,t,a),a};import{customElement as fl}from"lit/decorators.js";var ts=e=>Number(e.toPrecision(12)),ti,sa=e=>(ti??(ti=new Intl.NumberFormat)).format(ts(e)),ni=e=>{let n=Math.round(Math.abs(e)),t=e<0?"-":"",r=Math.floor(n/3600),a=Math.floor(n%3600/60),o=s=>String(s).padStart(2,"0");return r>0?`${t}${r}h ${o(a)}m`:a>0?`${t}${a}m ${o(n%60)}s`:`${t}${n}s`};function re(e){if(e===void 0)return sa;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:a="",timeZone:o}=e,s=u=>a?h=>u(h)+a:u,c=u=>r===void 0?u===void 0?{}:{maximumFractionDigits:u}:{minimumFractionDigits:r,maximumFractionDigits:r},l=u=>{let h=new Intl.NumberFormat(t,u);return s(f=>h.format(ts(f)))},d=u=>{let h=new Intl.DateTimeFormat(t,o?{...u,timeZone:o}:u);return f=>h.format(f)};switch(n){case"integer":return l({maximumFractionDigits:0});case"decimal":return l(c(2));case"percent":return l({style:"percent",...c(0)});case"currency":return l({style:"currency",currency:e.currency??"USD",...c()});case"compact":return l({notation:"compact",...c(1)});case"scientific":return l({notation:"scientific",...c(2)});case"date":return d({dateStyle:"medium"});case"time":return d({timeStyle:"short"});case"datetime":return d({dateStyle:"medium",timeStyle:"short"});case"duration":return s(ni)}}function Dt(e,n){if(typeof e=="string")return e;let t=e instanceof Date?e.getTime():e;return n?re(n)(t):e instanceof Date?new Intl.DateTimeFormat().format(e):sa(t)}var je=e=>{if(e instanceof Date)return e.getTime();if(typeof e=="number")return e;let n=Number(e);return Number.isFinite(n)&&e.trim()!==""?n:Date.parse(e)};function Je([e,n],[t,r]){let a=n-e;return o=>a===0?t:t+(o-e)/a*(r-t)}function st(e,n,t=5){if(e===n)return[e];let r=(n-e)/Math.max(1,t),a=10**Math.floor(Math.log10(r)),o=r/a,s=(o<1.5?1:o<3.5?2:o<7.5?5:10)*a,c=Math.floor(e/s)*s,l=Math.ceil(n/s)*s,d=[];for(let u=c;u<=l+s/2;u+=s)d.push(ns(u));return d}function Pe(e,[n,t],r=.2){let a=e===0?0:(t-n)/e,o=a*(1-Math.max(0,Math.min(.9,r)));return{step:a,bandwidth:o,start:s=>n+s*a+(a-o)/2,center:s=>n+(s+.5)*a}}var ns=e=>Number(e.toPrecision(12)),i=e=>Number(e.toFixed(2)),P=e=>typeof e=="number"&&Number.isFinite(e),Be=e=>e.filter(P);function ye(e){let n=1/0,t=-1/0;for(let r of e)P(r)&&(r<n&&(n=r),r>t&&(t=r));return n===1/0?[0,0]:[n,t]}function et(e,n="linear"){if(e.length===0)return"";let t=e[0];if(n==="step"||n==="stepBefore"||n==="stepAfter"){let d=`M${t.x} ${t.y}`;for(let u=1;u<e.length;u++){let h=e[u-1],f=e[u];n==="stepAfter"?d+=`H${f.x}V${f.y}`:n==="stepBefore"?d+=`V${f.y}H${f.x}`:d+=`H${i((h.x+f.x)/2)}V${f.y}H${f.x}`}return d}if(n==="linear"||e.length<3)return`M${e.map(d=>`${d.x} ${d.y}`).join("L")}`;let r=e.length,a=e.slice(1).map((d,u)=>d.x-e[u].x),o=e.slice(1).map((d,u)=>d.y-e[u].y),s=a.map((d,u)=>d===0?0:o[u]/d),c=[s[0]];for(let d=1;d<r-1;d++){let u=s[d-1],h=s[d];c.push(u*h<=0?0:(u+h)/2)}c.push(s[r-2]);for(let d=0;d<r-1;d++){let u=s[d];if(u===0){c[d]=0,c[d+1]=0;continue}let h=c[d]/u,f=c[d+1]/u,y=Math.hypot(h,f);y>3&&(c[d]=3*h*u/y,c[d+1]=3*f*u/y)}let l=`M${t.x} ${t.y}`;for(let d=0;d<r-1;d++){let u=e[d],h=e[d+1],f=a[d]/3;l+=`C${i(u.x+f)} ${i(u.y+f*c[d])} ${i(h.x-f)} ${i(h.y-f*c[d+1])} ${h.x} ${h.y}`}return l}var cr=1e3,dr=60*cr,mr=60*dr,ur=24*mr,ri=[cr,5*cr,15*cr,30*cr,dr,5*dr,15*dr,30*dr,mr,3*mr,6*mr,12*mr,ur,2*ur,7*ur,14*ur];function Gn(e,n,t=6){if(!(n>e))return[e];let r=n-e,a=ri.find(h=>r/h<=t),o=[];if(a!==void 0){for(let h=Math.ceil(e/a)*a;h<=n;h+=a)o.push(h);return o.length?o:[e,n]}let s=r/(30*ur),c=[1,2,3,6,12,24,60,120].find(h=>s/h<=t)??240,l=new Date(e),d=l.getUTCFullYear(),u=Math.ceil((l.getUTCMonth()+(l.getUTCDate()>1?1:0))/c)*c;for(let h=Date.UTC(d,u,1);h<=n;)o.push(h),u+=c,u>=12&&(d+=Math.floor(u/12),u%=12),h=Date.UTC(d,u,1);return o.length?o:[e,n]}function rs(e,n){let t=Math.floor(Math.log10(e)),r=Math.ceil(Math.log10(n)),a=r-t<=1?[1,2,5]:[1],o=[];for(let s=t;s<=r;s++)for(let c of a)o.push(ns(c*10**s));return o.filter(s=>s>=e/1.0001&&s<=n*1.0001)}function Wn(e,n={}){if(n.thresholds&&n.thresholds.length>=2)return[...n.thresholds].filter(Number.isFinite).sort((l,d)=>l-d);let[t,r]=n.domain??ye(e),a=Math.max(1,e.length),o=Math.max(1,n.bins??Math.ceil(Math.log2(a)+1)),s=n.binWidth??(r>t?(r-t)/o:1),c=r>t?Math.max(1,Math.ceil((r-t)/s-1e-9)):1;return Array.from({length:c+1},(l,d)=>Number((t+d*s).toPrecision(12)))}function Zn(e,n){let t=[];for(let o=0;o+1<n.length;o++)t.push({x0:n[o],x1:n[o+1],count:0});if(t.length===0)return t;let r=n[0],a=n[n.length-1];for(let o of Be(e)){if(o<r||o>a)continue;let s=0,c=t.length-1;for(;s<c;){let l=s+c+1>>1;t[l].x0<=o?s=l:c=l-1}t[s].count++}return t}var ai=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,oi=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,si={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function ii(e,n,t){return e.replace(oi,(r,a,o)=>{let s=si[a];if(s===void 0)return a+o;let l=(o.match(ai)??[]).map((d,u)=>{let h=Number(d);if(s===-1)return String(h+n);if(s===-2)return String(h+t);let f=u%s;return s===7?f===5?String(h+n):f===6?String(h+t):d:String(f%2===0?h+n:h+t)});return a+l.join(" ")})}var as=(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:ii(r.d,n,t)}}});var ia=["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)"))),Y={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)"},pt=(e="neutral")=>e==="neutral"?Y.axis:`var(--skdx-color-${e}-500)`,la=(e="neutral")=>e==="neutral"?Y.label:e==="primary"?"var(--skdx-color-text-accent)":`var(--skdx-color-text-${e})`,os=(e,n)=>n??ia[e%ia.length];var de={top:16,right:16,bottom:32,left:48};function $e(e,n,t=de){return{x:t.left,y:t.top,width:Math.max(0,e-t.left-t.right),height:Math.max(0,n-t.top-t.bottom)}}function Pn(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function da(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var Er=e=>e.crosshair===!0||da(e).trigger==="axis",Dr=20,li=120,ss=e=>{let n=Pn(e);return n&&(n.position==="left"||n.position==="right")?n.width??li:0},se=(e,n=600,t=300)=>({width:(e.width??n)-ss(e),height:(e.height??t)-(Pn(e)?.position==="bottom"?Dr:0)}),ie=e=>{let n=Pn(e);return n&&(n.position===void 0||n.position==="top")?Dr:0},ue=6.5,ee=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:os(n)),be=(e,n)=>e.hiddenSeries?.includes(n)??!1;function ca(e,n,t=[],r={},a=10,o=8,s=!1){let c=[],l=r.maxItems,d=l!==void 0&&l>=0&&e.length>l?e.slice(0,l):e,u=e.length-d.length,h=r.interactive??!0,f=o,y=a,I=(x,T,O,b)=>{let z=(T?18:4)+x.length*ue;f>o&&(s||f+z>n-8)&&(f=o,y+=Dr),T&&c.push({kind:"rect",part:"legend-swatch",x:f,y:y-5,width:10,height:10,fill:T,opacity:b?.3:void 0,item:O}),c.push({kind:"text",part:"legend-label",x:f+(T?14:0),y,text:x,baseline:"middle",fill:b?Y.grid:Y.label,item:O}),f+=z+12};for(let x of d){let T=t.includes(x.name),O=h?{label:x.name,series:x.name,legend:!0}:void 0;I(r.formatter?.(x.name)??x.name,x.color,O,T)}return u>0&&I(`+${u} more`,void 0,void 0,!1),r.align==="end"?ci(c,n):c}function ci(e,n){let t=new Map;for(let a of e){let o=a.kind==="rect"?a.y+5:a.y;t.set(o,[...t.get(o)??[],a])}let r=[];for(let a of t.values()){let o=Math.max(...a.map(c=>c.kind==="rect"?c.x+c.width:c.x+c.text.length*ue)),s=n-8-o;for(let c of a)r.push({...c,x:c.x+s})}return r}var di=(e,n,t={})=>new Set(ca(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function le(e,n,t,r=[]){let a=Pn(e),o=a&&e.direction==="rtl"&&a.align===void 0?{...a,align:"end"}:a,s=da(e),c=o?.position==="bottom",l=ss(e),d=e.hiddenSeries??[],u=o?l?ca(r,1/0,d,o,10,(o.position==="right"?n:0)+8,!0):ca(r,n,d,o,c?t+10:10):[],h=c?di(r,n,o):0;return{width:n+l,height:c?t+Math.max(1,h)*Dr: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 ma(e){let n=e.legendOffset;if(!n)return e;let t=[...as(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}),a=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,c=e.map?{...e.map,plot:r(e.map.plot)}:void 0;return{...e,shapes:t,hit:a,edit:s,map:c,legendOffset:void 0}}function Br(e,n,t,r,a,o="auto"){let s=Array.isArray(t)?t:[t],c=Math.max(...s.map(f=>f.length))*ue+12,l=6+s.length*16,d=o==="top"?{x:e-c/2,y:n-l-8}:o==="bottom"?{x:e-c/2,y:n+8}:o==="left"?{x:e-c-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-c,d.x)),h=Math.max(0,Math.min(a-l,d.y));return[{kind:"rect",part:"tooltip",x:i(u),y:i(h),width:i(c),height:l,fill:"var(--skdx-color-surface-raised)",stroke:Y.axis,rx:3},...s.map((f,y)=>({kind:"text",part:"tooltip-label",x:i(u+6),y:i(h+11+y*16),text:f,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:s.length>1&&y===0?"bold":void 0}))]}function At(e,n){let[t,r]=ye(e);return n?[Math.min(0,t),Math.max(0,r)]:[t,r]}function Ve([e,n],t,r=!1,a){let o=typeof r=="boolean"?{scale:r?"log":"linear"}:r,s=re(o.format??a),c=o.min??e,l=o.max??n;o.reversed&&(t=[t[1],t[0]]);let d={id:o.id,position:o.position,options:o};if(o.scale==="sqrt"){let x=$=>Math.sign($)*Math.sqrt(Math.abs($)),T=o.nice===!1?[c,l]:st(c,l,o.ticks),O=o.min??T[0],b=o.max??T[T.length-1],z=Je([x(O),x(b)],t),N=$=>z(x($)),k=st(O,b,o.ticks).filter($=>$>=O-1e-9&&$<=b+1e-9);return{...d,scale:N,domain:[O,b],format:s,ticks:(k.length>=2?k:[O,b]).map($=>({pos:i(N($)),label:s($)})),zero:i(N(Math.min(Math.max(0,O),b)))}}if(o.scale==="log"){let x=Math.max(c,Number.EPSILON),T=Math.max(l,x),O=rs(x,T),b=[Math.log10(x),Math.log10(T)],z=Je(b,t),N=k=>z(Math.log10(Math.max(k,Number.EPSILON)));return{...d,scale:N,domain:b,format:s,ticks:O.map(k=>({pos:i(N(k)),label:s(k)})),zero:i(t[0])}}let u=st(c,l,o.ticks),h=[o.min??(o.nice===!1?c:u[0]),o.max??(o.nice===!1?l:u[u.length-1])],f=Je(h,t),y=u.filter(x=>x>=h[0]-1e-9&&x<=h[1]+1e-9),I=(y.length>=2?y:[h[0],h[1]]).map(x=>({pos:i(f(x)),label:s(x)}));return{...d,scale:f,domain:h,format:s,ticks:I,zero:i(f(Math.min(Math.max(0,h[0]),h[1])))}}var Cn=e=>e?.grid!==!1;function ze(e,n){if(e.length<2)return e;let t=e.reduce((a,o)=>Math.max(a,o.label.length),0)*ue+8,r=Math.max(1,Math.ceil(e.length*t/Math.max(1,n)));return r===1?e:e.filter((a,o)=>o%r===0)}var hr=(e,n,t,r)=>`${e}, ${n}: ${r(t)}`;function oe(e,n,t,r){let a=e.error!==void 0?"error":e.loading?"loading":n?"empty":null;if(!a)return null;let{width:o,height:s}=se(e,t,r),c=a==="error"?e.error:a==="loading"?"Loading\u2026":e.emptyMessage??"No data available",l=[];return a==="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-${a}`,x:i(o/2),y:i(s/2),text:c,anchor:"middle",baseline:"middle",fill:a==="error"?"var(--skdx-color-text-danger)":Y.label}),{...le(e,o,s),shapes:l,tooltip:!1}}function Ge(e,n={}){let{plot:t,xTicks:r,yTicks:a,baseline:o}=e,s=t.x+t.width,c=t.y+t.height,l=[],d=n.grid??!0,u=(I,x)=>x?{kind:"line",part:"grid",x1:I.pos,x2:I.pos,y1:t.y,y2:c,stroke:Y.grid}:{kind:"line",part:"grid",x1:t.x,x2:s,y1:I.pos,y2:I.pos,stroke:Y.grid},h=n.x?.tickRotation??0,f=(I,x,T,O)=>h?K(I,x,T,{part:O,anchor:h<0?"end":"start",baseline:"middle",rotate:h}):K(I,x,T,{part:O,anchor:"middle"}),y=(I,x,T,O,b)=>{for(let z of I)l.push(x==="x"?{kind:"line",part:"tick",x1:z.pos,x2:z.pos,y1:T,y2:i(T+O*b),stroke:Y.axis}:{kind:"line",part:"tick",x1:T,x2:i(T+O*b),y1:z.pos,y2:z.pos,stroke:Y.axis})};if(n.categoryGrid)for(let I of r)l.push(u(I,!n.horizontal));if(n.horizontal){let I=n.axes??[{ticks:a,position:"bottom",offset:0,label:n.yLabel,...n.y}];if(d)for(let x of a)l.push(u(x,!0));I[0]?.showLine!==!1&&l.push({kind:"line",part:"axis",x1:o,x2:o,y1:t.y,y2:c,stroke:Y.axis});for(let x of I){let T=x.position==="top"||x.position==="right",O=i(T?t.y-x.offset:c+x.offset),b=T||x.offset>0;x.showLine&&b&&l.push({kind:"line",part:"axis",x1:t.x,x2:s,y1:O,y2:O,stroke:Y.axis}),x.showTicks&&y(x.ticks,"x",O,T?-1:1,x.tickSize??4);let z=i(T?O-8:O+20);for(let N of x.ticks)l.push(T?K(N.pos,z,N.label,{part:"x-label-top",anchor:"middle"}):f(N.pos,z,N.label,"x-label"));x.label&&l.push(b?K(4,z,x.label,{part:"axis-title",anchor:"start",baseline:T?void 0:"middle"}):K(4,t.y-6,x.label,{part:"axis-title",anchor:"start"}))}n.x?.showLine&&l.push({kind:"line",part:"axis",x1:n.rtl?s:t.x,x2:n.rtl?s:t.x,y1:t.y,y2:c,stroke:Y.axis}),n.x?.showTicks&&y(r,"y",n.rtl?s:t.x,n.rtl?1:-1,n.x.tickSize??4);for(let x of r)l.push(n.rtl?K(s+8,x.pos,x.label,{part:"y-label",anchor:"start",baseline:"middle"}):K(t.x-8,x.pos,x.label,{part:"y-label",anchor:"end",baseline:"middle"}))}else{if(d)for(let x of a)l.push(u(x,!1));n.y?.showLine!==!1&&l.push({kind:"line",part:"axis",x1:t.x,x2:s,y1:o,y2:o,stroke:Y.axis});let I=n.axes??[{ticks:a,position:"left",offset:0,label:n.yLabel,...n.y},...n.rightTicks?[{ticks:n.rightTicks,position:"right",offset:0,label:n.rightLabel}]:[]];for(let x of I){let T=x.position==="left",O=T?t.x-x.offset:s+x.offset,b=T?"y-label":"y-label-right";x.showLine&&l.push({kind:"line",part:"axis",x1:i(O),x2:i(O),y1:t.y,y2:c,stroke:Y.axis}),x.showTicks&&y(x.ticks,"y",i(O),T?-1:1,x.tickSize??4);for(let z of x.ticks)l.push(K(i(T?O-8:O+8),z.pos,z.label,{part:b,anchor:T?"end":"start",baseline:"middle"}));x.label&&l.push(K(i(T?x.offset===0?4:Math.max(4,O-40):x.offset===0?e.width-4:Math.min(e.width-4,O+40)),t.y-6,x.label,{part:"axis-title",anchor:T?"start":"end"}))}n.x?.showTicks&&y(r,"x",c,1,n.x.tickSize??4);for(let x of r)l.push(f(x.pos,c+(h?12:20),x.label,"x-label"))}return n.xLabel&&l.push(K(i(t.x+t.width/2),e.height-4,n.xLabel,{part:"axis-title",anchor:"middle"})),n.horizontal&&n.rightLabel&&l.push(K(e.width-4,t.y-6,n.rightLabel,{part:"axis-title",anchor:"end"})),l}var K=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:Y.label,...r}),bt=(e,n,t,r,a,o)=>({kind:"circle",part:"point",cx:e,cy:n,r:t,fill:r,title:a,item:o});function Lt(e,n){let t=[],{plot:r}=n,a=r.x+r.width,o=r.y+r.height,s=l=>Math.max(r.x,Math.min(a,l)),c=l=>Math.max(r.y,Math.min(o,l));for(let l of e??[]){let d=l.color??pt(l.variant),u=l.color??la(l.variant),h={part:"reference-label",fill:u},f=n.horizontal===!0;if("y"in l){let y=i(n.y(l.y,l.axis??"left"));if(f){let I=s(y);t.push(...ls(I,r.y,o,d,l.label,h))}else{let I=c(y);t.push(...is(r.x,a,I,d,l.label,h))}}else if("x"in l){let y=n.x(l.x);if(y===void 0)continue;f?t.push(...is(r.x,a,c(i(y)),d,l.label,h)):t.push(...ls(s(i(y)),r.y,o,d,l.label,h))}else if("y1"in l){let y=i(n.y(l.y1,l.axis??"left")),I=i(n.y(l.y2,l.axis??"left"));f?t.push(...ds(s(Math.min(y,I)),s(Math.max(y,I)),r,d,l.label,u)):t.push(...cs(c(Math.min(y,I)),c(Math.max(y,I)),r,d,l.label,u))}else{let y=n.x(l.x1),I=n.x(l.x2);if(y===void 0||I===void 0)continue;let x=i(Math.min(y,I)),T=i(Math.max(y,I));f?t.push(...cs(c(x),c(T),r,d,l.label,u)):t.push(...ds(s(x),s(T),r,d,l.label,u))}}return t}function is(e,n,t,r,a,o){let s={kind:"line",part:"reference",x1:e,x2:n,y1:t,y2:t,stroke:r,dash:"6 4",strokeWidth:1.5,title:a};return a?[s,K(n-4,t-5,a,{...o,anchor:"end"})]:[s]}function ls(e,n,t,r,a,o){let s={kind:"line",part:"reference",x1:e,x2:e,y1:n,y2:t,stroke:r,dash:"6 4",strokeWidth:1.5,title:a};return a?[s,K(e+4,n+10,a,{...o,anchor:"start"})]:[s]}function cs(e,n,t,r,a,o){let s={kind:"rect",part:"reference-area",x:t.x,y:e,width:t.width,height:i(Math.max(0,n-e)),fill:r,opacity:.12,title:a};return a?[s,K(t.x+t.width-4,e+12,a,{part:"reference-label",fill:o,anchor:"end"})]:[s]}function ds(e,n,t,r,a,o){let s={kind:"rect",part:"reference-area",x:e,y:t.y,width:i(Math.max(0,n-e)),height:t.height,fill:r,opacity:.12,title:a};return a?[s,K(e+4,t.y+12,a,{part:"reference-label",fill:o,anchor:"start"})]:[s]}function An(e,n){let t=[],{plot:r}=n,a=r.x+r.width,o=r.y+r.height;for(let s of e??[]){let c=s.color??pt(s.variant),l=s.color??la(s.variant),d=(I,x,T)=>{let O=n.x(I);if(O===void 0)return;let b=n.y(x,T??"left");return n.horizontal?{x:i(b),y:i(O)}:{x:i(O),y:i(b)}},u=s.id??s.label,h=I=>({label:I,id:u,name:s.label});if(s.type==="line"||s.type==="band"){let{type:I,id:x,...T}=s;t.push(...Lt([T],n));continue}if(s.type==="rect"){let I=d(s.x1,s.y1,s.axis),x=d(s.x2,s.y2,s.axis);if(!I||!x)continue;let T=Math.max(r.x,Math.min(I.x,x.x)),O=Math.max(r.y,Math.min(I.y,x.y)),b=s.label??"";t.push({kind:"rect",part:"annotation-rect",x:i(T),y:i(O),width:i(Math.max(0,Math.min(a,Math.max(I.x,x.x))-T)),height:i(Math.max(0,Math.min(o,Math.max(I.y,x.y))-O)),fill:c,opacity:.12,stroke:c,title:b||void 0,item:b?h(b):void 0}),s.label&&t.push(K(i(T+4),i(O+12),s.label,{part:"annotation-label",fill:l}));continue}let f=d(s.x,s.y,s.axis);if(!f)continue;if(s.type==="text"){t.push(K(f.x,f.y,s.text,{part:"annotation-text",fill:l,anchor:"middle",baseline:"middle",title:s.label}));continue}let y=s.label??`${String(s.x)}, ${s.y}`;if(t.push({kind:"circle",part:"annotation-point",cx:f.x,cy:f.y,r:5,fill:c,stroke:"var(--skdx-color-surface-default)",title:y,item:h(y)}),s.type==="callout"&&s.label){let[I,x]=s.offset??[16,-16],T=i(Math.max(r.x,Math.min(a,f.x+I))),O=i(Math.max(r.y,Math.min(o,f.y+x)));t.push({kind:"line",part:"annotation-leader",x1:f.x,y1:f.y,x2:T,y2:O,stroke:c},K(T,O,s.label,{part:"annotation-label",fill:l,anchor:I>=0?"start":"end",baseline:"middle"}))}}return t}var ua=2e3;function mi(e){if(e!=="none")return e===void 0||e==="auto"?{strategy:"lttb",threshold:ua}:typeof e=="string"?{strategy:e,threshold:ua}:{strategy:e.strategy,threshold:e.threshold??ua}}function ui(e,n){let t=e.length;if(n>=t||n<3)return e.map((c,l)=>l);let r=[0],a=[],o=(t-2)/(n-2),s=0;for(let c=0;c<n-2;c++){let l=Math.floor((c+1)*o)+1,d=Math.min(t-1,Math.floor((c+2)*o)+1),u=0,h=0,f=0;for(let z=l;z<d;z++){let N=e[z];P(N)&&(u+=z,h+=N,f++)}u=f?u/f:(l+d)/2,h=f?h/f:0;let y=Math.floor(c*o)+1,I=Math.min(t-1,Math.floor((c+1)*o)+1),x=e[s],T=P(x)?x:0,O=-1,b=-1;for(let z=y;z<I;z++){let N=e[z];if(!P(N)){a.push(z);continue}let k=Math.abs((s-u)*(N-T)-(s-z)*(h-T));k>b&&(b=k,O=z)}O<0&&(O=y),r.push(O),s=O}return r.push(t-1),a.length?[...new Set([...r,...a])].sort((c,l)=>c-l):r}function hi(e,n){let t=e.length,r=Math.max(1,Math.floor(n/2));if(r*2>=t)return e.map((s,c)=>c);let a=[],o=t/r;for(let s=0;s<r;s++){let c=Math.floor(s*o),l=s===r-1?t:Math.floor((s+1)*o),d=-1,u=-1;for(let h=c;h<l;h++){let f=e[h];if(!P(f)){a.push(h);continue}(d<0||f<e[d])&&(d=h),(u<0||f>e[u])&&(u=h)}d>=0&&a.push(Math.min(d,u)),u>=0&&u!==d&&a.push(Math.max(d,u))}return[...new Set(a)].sort((s,c)=>s-c)}function fi(e,n){let t=e.length,r=Math.max(1,Math.floor(n/4));if(r*4>=t)return e.map((s,c)=>c);let a=[],o=t/r;for(let s=0;s<r;s++){let c=Math.floor(s*o),l=s===r-1?t:Math.floor((s+1)*o),d=-1,u=-1,h=-1,f=-1;for(let y=c;y<l;y++){let I=e[y];if(!P(I)){a.push(y);continue}h<0&&(h=y),f=y,(d<0||I<e[d])&&(d=y),(u<0||I>e[u])&&(u=y)}for(let y of[h,d,u,f])y>=0&&a.push(y)}return[...new Set(a)].sort((s,c)=>s-c)}function ms(e,n,t){let r=mi(t);if(!r||n<=r.threshold||e.length===0)return;let a=r.strategy==="minmax"?hi:r.strategy==="m4"?fi:ui,o=new Set;for(let s of e)for(let c of a(s.slice(0,n),r.threshold))o.add(c);return[...o].sort((s,c)=>s-c)}var fr=e=>Math.max(0,Math.min(1,e));function us(e){let n=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(n){let r=n[1],a=r.length===3?r.split("").map(o=>o+o).join(""):r;return[0,2,4].map(o=>parseInt(a.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 hs(e,n){if(e.length===0)return Y.axis;if(e.length===1)return e[0];let t=fr(n)*(e.length-1),r=Math.min(e.length-2,Math.floor(t)),a=t-r,o=us(e[r]),s=us(e[r+1]);if(!o||!s)return e[Math.round(t)];let c=l=>Math.round(o[l]+(s[l]-o[l])*a);return`rgb(${c(0)}, ${c(1)}, ${c(2)})`}var fs=(e,n)=>n!==void 0&&n>=2?Math.min(n-1,Math.floor(fr(e)*n))/(n-1):fr(e);function gt(e,n,t,r=Y.negative,a=String){let[o,s]=ye(n),c=e??{type:"sequential"},l=T=>i(.15+.85*T);if(c.type==="threshold"){let{thresholds:T,colors:O,labels:b}=c,z=k=>{if(typeof k!="number"||!Number.isFinite(k))return;let $=0;for(;$<T.length&&k>=T[$];)$++;return{fill:O[Math.min($,O.length-1)]??t,opacity:1}},N=O.map((k,$)=>({fill:k,opacity:1,label:b?.[$]??($===0?`< ${a(T[0]??0)}`:$===T.length?`\u2265 ${a(T[$-1])}`:`${a(T[$-1])} \u2013 ${a(T[$])}`)}));return{color:z,domain:[o,s],swatches:N,kind:"threshold"}}if(c.type==="ordinal"){let T=c.colors?.length?c.colors:[t];return{color:b=>typeof b=="number"&&Number.isFinite(b)?{fill:T[Math.abs(Math.round(b))%T.length],opacity:1}:void 0,domain:[o,s],swatches:T.map((b,z)=>({fill:b,opacity:1,label:String(z)})),kind:"ordinal"}}if(c.type==="diverging"){let[T,O,b]=c.domain??[-Math.max(Math.abs(o),Math.abs(s)),0,Math.max(Math.abs(o),Math.abs(s))],z=c.colors,N=v=>v<O?.5*(v-T)/Math.max(1e-12,O-T):.5+.5*(v-O)/Math.max(1e-12,b-O),k=v=>{let R=fs(c.reversed?1-fr(v):v,c.steps);if(z&&z.length>=2)return{fill:hs(z,R),opacity:1};let j=R<.5?r:t,p=Math.abs(R-.5)*2;return{fill:j,opacity:l(p)}},$=v=>typeof v=="number"&&Number.isFinite(v)?k(N(v)):void 0,L=c.steps??5,S=Array.from({length:L},(v,R)=>{let j=L===1?.5:R/(L-1),p=j<.5?T+(O-T)*(j*2):O+(b-O)*((j-.5)*2);return{...k(j),label:a(p)}});return{color:$,domain:[T,b],swatches:S,kind:"diverging"}}let[d,u]=c.domain??[o,s],h=c.colors,f=T=>{let O=fs(c.reversed?1-fr(T):T,c.steps);return h&&h.length>=2?{fill:hs(h,O),opacity:1}:{fill:h?.[0]??t,opacity:l(O)}},y=T=>typeof T!="number"||!Number.isFinite(T)?void 0:f(u===d?1:(T-d)/(u-d)),I=c.steps??5,x=Array.from({length:I},(T,O)=>{let b=I===1?1:O/(I-1);return{...f(b),label:a(d+(u-d)*b)}});return{color:y,domain:[d,u],swatches:x,kind:"sequential"}}var pi=34,bi=72;function Ln(e){if(!e)return{bottom:0,right:0,options:{}};let n=e===!0?{}:e;return n.orientation==="vertical"?{bottom:0,right:bi,options:n}:{bottom:pi,right:0,options:n}}function qn(e,n,t){let r=typeof t=="string"?{title:t}:t??{},a=r.title,o=e.swatches;if(o.length===0||n.width<=0)return[];if(r.orientation==="vertical"){let u=Math.max(0,n.height-(a?16:0)),h=Math.min(16,u/o.length),f=n.y+(a?16:0),y=o.map((x,T)=>({kind:"rect",part:"color-legend-swatch",x:i(n.x),y:i(f+T*h),width:10,height:i(h),fill:x.fill,opacity:x.opacity,title:x.label})),I=h>=12?1:2;return o.forEach((x,T)=>{T%I!==0&&T!==o.length-1||y.push({kind:"text",part:"color-legend-label",x:i(n.x+14),y:i(f+(T+.5)*h),text:x.label,baseline:"middle",fill:Y.label})}),a&&y.push({kind:"text",part:"color-legend-title",x:i(n.x),y:i(n.y+6),text:a,baseline:"middle",fill:Y.label}),y}let s=Math.min(n.width/o.length,96),c=n.x+(n.width-s*o.length)/2,l=o.map((u,h)=>({kind:"rect",part:"color-legend-swatch",x:i(c+h*s),y:i(n.y),width:i(s),height:10,fill:u.fill,opacity:u.opacity,title:u.label})),d=e.kind==="threshold"?1:Math.max(1,Math.ceil(o.length*7*ue/Math.max(1,s*o.length)));return o.forEach((u,h)=>{h%d!==0&&h!==o.length-1||l.push({kind:"text",part:"color-legend-label",x:i(c+(h+.5)*s),y:i(n.y+22),text:u.label,anchor:"middle",fill:Y.label})}),a&&l.push({kind:"text",part:"color-legend-title",x:i(c-6),y:i(n.y+5),text:a,anchor:"end",baseline:"middle",fill:Y.label}),l}var gi=1e4,xi=e=>Array.isArray(e)?{x:e[0],y:e[1],size:e[2],label:void 0,id:void 0,color:void 0,value:void 0}:{x:e.x,y:e.y,size:e.size,label:e.label,id:e.id,color:e.color,value:e.value};function ha(e,n,t,r,a,o,s,c){if(r==="circle")return{...bt(e,n,t,a,o,s),part:c};let l=r==="square"?`M${i(e-t)} ${i(n-t)}h${i(2*t)}v${i(2*t)}h${i(-2*t)}Z`:r==="diamond"?`M${i(e)} ${i(n-t*1.3)}L${i(e+t*1.3)} ${i(n)}L${i(e)} ${i(n+t*1.3)}L${i(e-t*1.3)} ${i(n)}Z`:`M${i(e)} ${i(n-t*1.2)}L${i(e+t*1.15)} ${i(n+t*.9)}L${i(e-t*1.15)} ${i(n+t*.9)}Z`;return{kind:"path",part:c,d:l,fill:a,title:o,item:s}}function fa(e,n){let t=[],r=e.series.map((D,Z)=>({name:D.name,id:D.id,symbol:D.symbol??"circle",color:ee(e,Z,D.color),data:be(e,D.name)?[]:D.data.flatMap((B,H)=>{let V=xi(B);return P(V.x)&&P(V.y)?[{...V,index:H}]:[]})})),a=e.sampling==="auto"?gi:typeof e.sampling=="object"?e.sampling.threshold:1/0,o=r.reduce((D,Z)=>D+Z.data.length,0),s=o>a?Math.ceil(o/a):1;s>1&&t.push({code:"sampled",severity:"warning",message:`${o} points exceed the sampling threshold of ${a}; every ${s}th point is drawn.`});let c=s>1?r.map(D=>({...D,data:D.data.filter((Z,B)=>B%s===0)})):r,l=c.flatMap(D=>D.data),d=oe(e,l.length===0);if(d)return{...d,issues:t};let{width:u,height:h}=se(e),f=e.colorScale?Ln(e.colorLegend):{bottom:0,right:0,options:{}},y=$e(u,h,{...de,top:de.top+ie(e)+(e.yAxis?.label?12:0),right:de.right+f.right,bottom:de.bottom+(e.xAxis?.label?14:0)+f.bottom}),I=e.markerSize??3,x=Math.max(0,e.hitRadius??0),T=Math.max(0,e.jitter??0),O=new Map,b=e.colorScale?gt(e.colorScale,l.map(D=>D.value),ee(e,0),void 0,re(e.format)):void 0,z=Ve(At(l.map(D=>D.x),!1),[y.x,y.x+y.width],e.xAxis??{},e.format),N=Ve(At(l.map(D=>D.y),!1),[y.y+y.height,y.y],e.yAxis??{},e.format),k=ye(l.map(D=>D.size)),$=e.series.map((D,Z)=>({name:D.name,color:ee(e,Z,D.color)})),L=le(e,u,h,$),S=[],v=[],R=[],j=[];for(let D of c){let Z=D.data.some(B=>B.size!==void 0);for(let B of D.data){let H=B.index,V=n.describe(D.name,B,z,N),U=Z?n.radius(B.size,k):I,A=i(z.scale(B.x)),g=i(N.scale(B.y));if(T>0){let G=`${Math.round(A)},${Math.round(g)}`,J=O.get(G)??0;if(O.set(G,J+1),J>0){let te=J*2.399963;A=i(A+T*Math.cos(te)),g=i(g+T*Math.sin(te))}}let _=b?.color(B.value),W={label:V,id:B.id,series:D.name,seriesId:D.id??D.name,name:B.label,index:H,value:B.y},Q=B.color??_?.fill??D.color;if(S.push(ha(A,g,i(U),D.symbol,Q,V,W,Z?n.part:"point")),x>0&&S.push({kind:"circle",part:"hit",cx:A,cy:g,r:i(U+x),fill:Q,opacity:0,title:V,item:W}),e.labels&&B.label){let G=B.label.length*ue,J=A-G/2,te=g-U-4;j.some(ne=>Math.abs(ne.y-te)<12&&J<ne.x+ne.w+4&&J+G+4>ne.x)||(j.push({x:J,y:te,w:G}),v.push(K(A,i(te),B.label,{part:"point-label",anchor:"middle",fill:"var(--skdx-color-text-default)"})))}}if(e.trendline&&D.data.length>=2){let B=e.trendline===!0?"linear":e.trendline,H=yi(D.data.map(V=>[V.x,V.y]),B);if(H){let[V,U]=z.domain,A=`${D.name} trend${B==="linear"?"":` (${B})`}: r\xB2 ${H.r2.toFixed(2)}`,g=D.color;if(B==="linear")R.push({kind:"line",part:"trendline",x1:i(z.scale(V)),y1:i(N.scale(H.predict(V))),x2:i(z.scale(U)),y2:i(N.scale(H.predict(U))),stroke:g,dash:"5 4",strokeWidth:1.5,title:A});else{let _=Array.from({length:40},(W,Q)=>V+(U-V)*Q/39).map(W=>({v:W,p:H.predict(W)})).filter(({p:W})=>Number.isFinite(W)).map(({v:W,p:Q})=>({x:i(z.scale(W)),y:i(N.scale(Q))}));_.length>1&&R.push({kind:"path",part:"trendline",d:et(_),stroke:g,dash:"5 4",strokeWidth:1.5,title:A})}}}}let p={...L,plot:y,xTicks:z.ticks,yTicks:N.ticks,baseline:N.zero},w={plot:y,x:D=>z.scale(je(D)),y:D=>N.scale(D)},M=Lt(e.references,w),E=b&&(f.bottom||f.right)?qn(b,f.right?{x:y.x+y.width+12,y:y.y,width:f.right,height:y.height}:{x:y.x,y:h-f.bottom+8,width:y.width,height:f.bottom},f.options):[],F=n.opacity;return{...L,shapes:[...Ge(p,{xLabel:e.xAxis?.label,yLabel:e.yAxis?.label}),...M,...F!==void 0&&S.some(D=>D.part===n.part)?S.map(D=>(D.kind==="circle"||D.kind==="path")&&D.part!=="hit"?{...D,opacity:F}:D):S,...R,...v,...An(e.annotations,w),...E,...L.shapes],issues:t}}function yi(e,n="linear"){let t;if(n==="polynomial"){let l=0,d=0,u=0,h=0,f=0,y=0,I=0,x=0;for(let[$,L]of e)l+=1,d+=$,u+=$*$,h+=$**3,f+=$**4,y+=L,I+=$*L,x+=$*$*L;let T=$=>$[0]*($[4]*$[8]-$[5]*$[7])-$[1]*($[3]*$[8]-$[5]*$[6])+$[2]*($[3]*$[7]-$[4]*$[6]),b=T([f,h,u,h,u,d,u,d,l]);if(Math.abs(b)<1e-12)return;let z=T([x,h,u,I,u,d,y,d,l])/b,N=T([f,x,u,h,I,d,u,y,l])/b,k=T([f,h,x,h,u,I,u,d,y])/b;t=$=>z*$*$+N*$+k}else{let l=n==="logarithmic"||n==="power"?Math.log:y=>y,d=n==="exponential"||n==="power"?Math.log:y=>y,u=e.filter(([y,I])=>Number.isFinite(l(y))&&Number.isFinite(d(I))),h=vi(u.map(([y,I])=>[l(y),d(I)]));if(!h)return;let f=n==="exponential"||n==="power"?Math.exp:y=>y;t=y=>f(h.intercept+h.slope*l(y))}let r=t,a=e.filter(([l])=>Number.isFinite(r(l)));if(a.length===0)return;let o=a.reduce((l,[,d])=>l+d,0)/a.length,s=0,c=0;for(let[l,d]of a)s+=(d-r(l))**2,c+=(d-o)**2;return{predict:r,r2:c===0?1:Math.max(0,1-s/c)}}function pa(e){let[n,t]=e.sizeRange??[3,18];return fa(e,{part:"bubble",opacity:.7,radius:(r,[a,o])=>P(r)?o===a?(n+t)/2:n+Math.sqrt((r-a)/(o-a))*(t-n):3,describe:(r,a,o,s)=>`${r}${a.label?` ${a.label}`:""}: ${o.format(a.x)}, ${s.format(a.y)}${P(a.size)?` (${s.format(a.size)})`:""}`})}function vi(e){let n=e.length,t=e.reduce((d,u)=>d+u[0],0)/n,r=e.reduce((d,u)=>d+u[1],0)/n,a=0,o=0,s=0;for(let[d,u]of e)a+=(d-t)**2,o+=(d-t)*(u-r),s+=(u-r)**2;if(a===0)return;let c=o/a,l=s===0?1:o*o/(a*s);return{slope:c,intercept:r-c*t,r2:l}}var Mi=e=>{let n=0;return e.map(t=>P(t)?n+=t:null)},wi=e=>e.map((n,t)=>{let r=e[t-1];return t>0&&P(n)&&P(r)?n-r:null}),$i=e=>e.map((n,t)=>{let r=e[t-1];return t>0&&P(n)&&P(r)&&r!==0?(n-r)/Math.abs(r):null});function ba(e,n){let t=Math.max(1,Math.floor(n));return e.map((r,a)=>{if(a<t-1)return null;let o=0;for(let s=a-t+1;s<=a;s++){let c=e[s];if(!P(c))return null;o+=c}return o/t})}function ps(e,n){let t=Math.max(1,Math.floor(n)),r=2/(t+1),a,o=0,s=0;return e.map(c=>P(c)?a===void 0?(o+=c,s++,s<t?null:(a=o/t,a)):(a=r*c+(1-r)*a,a):a??null)}function ki(e,n="max"){let t=0;for(let r of e)P(r)&&(t=n==="sum"?t+r:Math.max(t,r));return e.map(r=>P(r)?t===0?0:r/t:null)}function Ii(e,n="desc"){let t=e.filter(P).sort((r,a)=>n==="asc"?r-a:a-r);return e.map(r=>P(r)?t.indexOf(r)+1:null)}var Ti=(e,n=-1/0,t=1/0)=>e.map(r=>P(r)&&r>=n&&r<=t?r:null),Ci=(e,n="asc")=>[...e].sort((t,r)=>P(t)?P(r)?n==="asc"?t-r:r-t:-1:P(r)?1:0);function Ai(e,n,t="sum"){let r=Math.max(1,Math.floor(n)),a=[];for(let o=0;o<e.length;o+=r){let s=e.slice(o,o+r).filter(P);if(s.length===0){a.push(null);continue}let c=s.reduce((l,d)=>l+d,0);a.push(t==="sum"?c:t==="mean"?c/s.length:t==="min"?Math.min(...s):Math.max(...s))}return a}function Li(e,n={}){let t=e.filter(P),r=Wn(t,n);return{edges:r,counts:Zn(t,r).map(a=>a.count)}}function ga(e,n){let t=[...e];for(let r of n??[])switch(r.type){case"cumulative":t=Mi(t);break;case"difference":t=wi(t);break;case"percentageChange":t=$i(t);break;case"movingAverage":t=ba(t,r.window);break;case"normalize":t=ki(t,r.to);break;case"rank":t=Ii(t,r.order);break;case"filter":t=Ti(t,r.min,r.max);break;case"sort":t=Ci(t,r.order);break;case"aggregate":t=Ai(t,r.every,r.method);break;case"bin":t=Li(t,r).counts;break}return t}var Oi=100,Si=2e3,bs=32,gs=28,Pr=e=>e.position==="right"||e.position==="top";function zi(e){let t=(e.yAxis===void 0?[]:Array.isArray(e.yAxis)?e.yAxis:[e.yAxis]).map((a,o)=>({...a,id:a.id??(o===0?"left":o===1?"right":String(o)),position:a.position??(o===1?"right":"left")}));t.length===0&&t.push({id:"left",position:"left"});let r=t.some(a=>a.id==="right"||Pr(a));return e.rightAxis?t.push({...e.rightAxis,id:"right",position:"right"}):!r&&e.series.some(a=>a.axis==="right")&&t.push({id:"right",position:"right"}),t}function ys(e,n){let t=e[0]?.id;return n===void 0||n==="left"?t:n==="right"?(e.find(r=>r.id==="right")??e.find(Pr))?.id:e.find(r=>r.id===n)?.id}var Fr=e=>e.kind==="bar"||e.kind==="range"&&e.style==="bar";function Ot(e,n){let t=re(e.format),{series:r,categories:a,issues:o,axes:s}=Ri(e,n,t),c=e.direction==="rtl",l=e.baseline??0,d=Math.max(a.length,...r.map(C=>Math.max(C.data.length,C.low.length))),u=r.every(C=>Be(C.data).length===0&&Be(C.high).length===0),h=oe(e,u);if(h)return{...h,issues:o};let f=e.xAxis?.type??"category",y=f!=="category"&&a.length>0&&a.every(C=>typeof C!="string"||f==="time"&&P(je(C))),I=y?a.map(je):[],[x,T]=ye(I),O=e.xAxis?.format??(f==="time"?{style:T-x<2*864e5?"time":"date"}:void 0),b=Array.from({length:d},(C,ae)=>{let me=a[ae];return me===void 0?String(ae+1):Dt(me,O)}),z=Ni(e.zoom,d),N=Array.from({length:z.end-z.start},(C,ae)=>z.start+ae),k=e.orientation==="horizontal",L=r.map(C=>({...C,hidden:C.hidden||k&&!Fr(C)})).filter(C=>!C.hidden),S=L.some(C=>!Fr(C))?ms(L.filter(C=>!Fr(C)).map(C=>N.map(ae=>(C.kind==="range"?C.high[ae]:C.data[ae])??null)),N.length,e.sampling):void 0,v=S?S.map(C=>N[C]):N,R=e.stacked==="percent"||e.stackOffset==="expand",j=e.stackOffset??"zero",p=new Map,w=new Map,M=new Map;for(let C of L)C.stack!==void 0&&C.kind!=="range"&&M.set(C.stack,[...M.get(C.stack)??[],C]);for(let C of M.values()){let ae=new Array(d).fill(l),me=new Array(d).fill(l),Ce=new Array(d).fill(0);if(R)for(let ve of C)ve.data.forEach((ge,we)=>{P(ge)&&(Ce[we]=Ce[we]+Math.abs(ge))});for(let ve of C){let ge=[],we=[];for(let Me=0;Me<d;Me++){let Ie=ve.data[Me];if(!P(Ie)){ge.push(null),we.push(null);continue}let xe=Ce[Me],he=R?xe>0?Ie/xe:0:Ie,Ae=he>=0?ae:me;ge.push(Ae[Me]),Ae[Me]=Ae[Me]+he,we.push(Ae[Me])}p.set(ve,ge),w.set(ve,we)}if(j==="silhouette"||j==="wiggle"){let ve=new Array(d).fill(0);if(j==="silhouette")for(let ge=0;ge<d;ge++)ve[ge]=-(ae[ge]-l)/2;else{let ge=0;for(let we=0;we<d;we++){let Me=C.length,Ie=0;for(let he=0;he<Me;he++){let Ae=C[he],Oe=Ae.data[we],De=Ae.data[we-1],ot=we>0&&P(Oe)&&P(De)?Oe-De:0;Ie+=(Me-he-.5)*ot}let xe=ae[we]-l;ge=we===0?-xe/2:ge-(xe>0?Ie/Math.max(1,Me):0),ve[we]=ge}}for(let ge of C){let we=p.get(ge),Me=w.get(ge);for(let Ie=0;Ie<d;Ie++){let xe=we[Ie],he=Me[Ie];P(xe)&&(we[Ie]=xe+ve[Ie]),P(he)&&(Me[Ie]=he+ve[Ie])}}}}let E=C=>C.kind==="range"?{from:C.low,to:C.high}:{from:p.get(C)??new Array(d).fill(l),to:w.get(C)??C.data},F=C=>{let ae=[],me=!1;for(let ge of L){if(ge.axis!==C)continue;let{from:we,to:Me}=E(ge);for(let Ie of v){let xe=Me[Ie];if(P(xe)&&ae.push(xe),ge.kind==="range"||ge.stack!==void 0){let he=we[Ie];P(he)&&ae.push(he)}}if(ge.errors)for(let Ie of v){let xe=xs(ge.data[Ie],ge.errors[Ie]);xe&&ae.push(xe[0],xe[1])}(ge.kind==="bar"||ge.kind==="area")&&j==="zero"&&(me=!0)}let[Ce,ve]=ye(ae);return me?[Math.min(l,Ce),Math.max(l,ve)]:[Ce,ve]},{width:D,height:Z}=se(e),B=e.brush?bs+gs:0,H=v.reduce((C,ae)=>Math.max(C,b[ae].length),0)*ue,V=R?{style:"percent"}:void 0,U=C=>{if(C.scale==="log")return de.left;let[ae,me]=F(C.id),Ce=re(C.format??V??e.format),ve=st(C.min??ae,C.max??me).reduce((ge,we)=>Math.max(ge,Ce(we).length),0);return Math.max(de.left,ve*ue+14)+(C.showTicks?C.tickSize??4:0)},A=C=>k?Pr(C)?"top":"bottom":Pr(C)!==c?"right":"left",g=C=>k?24+(C.showTicks?C.tickSize??4:0):U(C),_=new Set(L.map(C=>C.axis)),W=s.filter(C=>_.has(C.id)||s.length>1),Q=new Map,G={left:0,right:0,top:0,bottom:0};for(let C of W){let ae=A(C);Q.set(C.id,G[ae]),G[ae]+=g(C)}let J=W.find(C=>A(C)==="bottom"),te={top:de.top+ie(e)+(s.some(C=>C.label)?12:0)+G.top,right:k?c?Math.max(de.left,H+16):de.right:Math.max(de.right,G.right),bottom:de.bottom+B+(e.xAxis?.label?14:0)+(e.xAxis?.tickRotation?24:0)+G.bottom-(J?g(J):0),left:k?c?de.right:Math.max(de.left,H+16):Math.max(de.left,G.left)},ne=$e(D,Z,te),pe=k?c?[ne.x+ne.width,ne.x]:[ne.x,ne.x+ne.width]:[ne.y+ne.height,ne.y],Te=k?[ne.y,ne.y+ne.height]:c?[ne.x+ne.width,ne.x]:[ne.x,ne.x+ne.width],Ee=new Map(s.map(C=>[C.id,{...Ve(F(C.id),pe,{format:V,...C},e.format),position:A(C),offset:Q.get(C.id)??0}])),q=s[0]?.id,ce=Ee.get(q),Se=C=>Ee.get(ys(s,C)??q)??ce,Ze=(C,ae)=>Se(ae).scale(C),un=C=>i(C.scale(Math.min(Math.max(l,Math.min(...C.domain)),Math.max(...C.domain)))),tn=Pe(v.length,Te,e.barGap),hn=v.map(C=>I[C]),fn=[...hn].sort((C,ae)=>C-ae),Gt=1/0;for(let C=1;C<fn.length;C++)Gt=Math.min(Gt,fn[C]-fn[C-1]);let[Wt,pn]=ye(hn),_e=Gt===1/0?Math.max(1,Math.abs(pn)*.05||1):Gt/2,Zt=Je([Wt-_e,pn+_e],Te),nn=C=>i(y?Zt(hn[C]):tn.center(C)),ar=y?Math.abs(Zt(Wt+(Gt===1/0?_e:Gt))-Zt(Wt))*.8:tn.bandwidth,jo=C=>y?nn(C)-ar/2:tn.start(C),Ys=y?(f==="time"?Gn(Wt-_e,pn+_e):st(Wt-_e,pn+_e)).filter(C=>C>=Wt-_e&&C<=pn+_e).map(C=>({pos:i(Zt(C)),label:Dt(C,O)})):ze(v.map((C,ae)=>({pos:nn(ae),label:b[C]})),k?1/0:ne.width/Math.max(.2,Math.abs(Math.cos((e.xAxis?.tickRotation??0)*Math.PI/180)))),Xr={...le(e,D,Z,r.map(C=>({name:C.name,color:C.color}))),plot:ne,xTicks:Ys,yTicks:k?ze(ce.ticks,ne.width):ce.ticks,baseline:un(ce)},Ks=s[0],Go=Ge(Xr,{horizontal:k,rtl:c,axes:W.map(C=>{let ae=Ee.get(C.id);return{ticks:k?ze(ae.ticks,ne.width):ae.ticks,position:ae.position,offset:ae.offset??0,label:C.label,showLine:C.showLine,showTicks:C.showTicks,tickSize:C.tickSize}}),xLabel:e.xAxis?.label,grid:Cn(Ks),categoryGrid:e.xAxis?.grid===!0,x:e.xAxis}),Xs=C=>{if(typeof C=="number"&&a.every(me=>typeof me=="string"))return C;let ae=typeof C=="string"?C:je(C);for(let me=0;me<d;me++){let Ce=a[me];if(Ce!==void 0&&(typeof ae=="string"?Ce===ae||b[me]===ae:je(Ce)===ae))return me}},Wo={plot:ne,horizontal:k,x:C=>{if(y&&(typeof C!="string"||P(je(C))))return Zt(je(C));let ae=Xs(C),me=ae===void 0?-1:v.indexOf(ae);return me<0?void 0:tn.center(me)},y:(C,ae)=>Ze(C,ae)};Go.push(...Lt(e.references,Wo));let Qr=[],Jr=new Map;for(let C of L){if(!Fr(C))continue;let ae=C.stack??C,me=Qr.indexOf(ae);me<0&&(me=Qr.push(ae)-1),Jr.set(C,me)}let Or=ar/Math.max(1,Qr.length),Tn=Math.min(Or,e.barWidth??1/0),Zo=(Or-Tn)/2,ea=[],Sr=[],ta=[],na=[],ra=[],qo=[],zr=[],Nr=C=>Se(C.axis).format,aa=Math.max(0,e.minBarSize??0),Qs=(C,ae,me)=>{let Ce=Math.abs(ae-C);if(Ce>=aa)return[Math.min(C,ae),Ce];let ge=C+(k?me?1:-1:me?-1:1)*aa;return[Math.min(C,ge),aa]},or=(C,ae,me,Ce)=>({label:Ce,series:C.name,seriesId:C.id??C.name,category:b[ae],index:ae,value:me}),Uo=(C,ae,me,Ce)=>{let ve=xs(Ce,C.errors?.[ae]);if(!ve)return;let ge=i(Ze(ve[0],C.axis)),we=i(Ze(ve[1],C.axis)),Me=4,Ie="var(--skdx-color-text-default)",xe=`${C.name}, ${b[ae]}: ${Nr(C)(ve[0])} \u2013 ${Nr(C)(ve[1])}`;qo.push(k?{kind:"line",part:"error-bar",x1:ge,x2:we,y1:me,y2:me,stroke:Ie,title:xe}:{kind:"line",part:"error-bar",x1:me,x2:me,y1:ge,y2:we,stroke:Ie,title:xe},k?{kind:"line",part:"error-cap",x1:ge,x2:ge,y1:i(me-Me),y2:i(me+Me),stroke:Ie}:{kind:"line",part:"error-cap",x1:i(me-Me),x2:i(me+Me),y1:ge,y2:ge,stroke:Ie},k?{kind:"line",part:"error-cap",x1:we,x2:we,y1:i(me-Me),y2:i(me+Me),stroke:Ie}:{kind:"line",part:"error-cap",x1:i(me-Me),x2:i(me+Me),y1:we,y2:we,stroke:Ie})};for(let C of L){let{from:ae,to:me}=E(C),Ce=Nr(C),ve=v.length<=Si;if(C.kind==="bar"){let xe="";v.forEach((he,Ae)=>{let Oe=C.data[he],De=ae[he],ot=me[he];if(!P(Oe)||!P(De)||!P(ot))return;let jn=Ze(De,C.axis),Fn=Ze(ot,C.axis),[sr,ir]=Qs(jn,Fn,ot>=De),lr=jo(Ae)+Jr.get(C)*Or+Zo,Ko=i(k?sr:lr),Xo=i(k?lr:sr),oa=i(k?ir:Tn),Qo=i(k?Tn:ir);if(!ve){xe+=`M${Ko} ${Xo}h${oa}v${Qo}h${-oa}Z`;return}let Jo=hr(C.name,b[he],R?ot-De:Oe,Ce);if(Sr.push({kind:"rect",part:"bar",x:Ko,y:Xo,width:oa,height:Qo,fill:C.color,rx:e.radius,title:Jo,item:or(C,he,Oe,Jo)}),Uo(C,he,i(lr+Tn/2),Oe),e.labels){let es=Ce(R?ot-De:Oe);ra.push(k?K(i(Math.max(jn,Fn)+4),i(lr+Tn/2),es,{baseline:"middle"}):K(i(lr+Tn/2),i(Math.min(jn,Fn)-4),es,{anchor:"middle"}))}}),xe&&Sr.push({kind:"path",part:"bars",d:xe,fill:C.color,title:C.name});continue}if(C.kind==="range"&&C.style==="bar"){v.forEach((xe,he)=>{let Ae=ae[xe],Oe=me[xe];if(!P(Ae)||!P(Oe))return;let De=Ze(Math.min(Ae,Oe),C.axis),ot=Ze(Math.max(Ae,Oe),C.axis),jn=jo(he)+Jr.get(C)*Or+Zo,Fn=`${C.name}, ${b[xe]}: ${Ce(Math.min(Ae,Oe))} \u2013 ${Ce(Math.max(Ae,Oe))}`,sr=or(C,xe,Oe,Fn),ir=Math.max(1,Math.abs(ot-De));Sr.push(k?{kind:"rect",part:"range",x:i(Math.min(De,ot)),y:i(jn),width:i(ir),height:i(Tn),fill:C.color,rx:e.radius,title:ve?Fn:void 0,item:sr}:{kind:"rect",part:"range",x:i(jn),y:i(Math.min(De,ot)),width:i(Tn),height:i(ir),fill:C.color,rx:e.radius,title:ve?Fn:void 0,item:sr})});continue}let ge=e.nulls==="connect"||e.nulls===void 0&&e.connectNulls,we=[],Me=[];v.forEach((xe,he)=>{let Ae=ae[xe],Oe=me[xe];if(!P(Oe)||!P(Ae)){!ge&&Me.length&&(we.push(Me),Me=[]);return}Me.push({x:nn(he),y:i(Ze(Oe,C.axis)),y0:i(Ze(Ae,C.axis)),i:xe})}),Me.length&&we.push(Me);let Ie=C.markers??v.length<=Oi;for(let xe of we){let he=et(xe,C.curve);if(C.kind==="range"&&C.style==="line"){ta.push({kind:"path",part:"range-high",d:he,stroke:C.color,strokeWidth:2,strokeLinejoin:"round"},{kind:"path",part:"range-low",d:et(xe.map(Ae=>({x:Ae.x,y:Ae.y0})),C.curve),stroke:C.color,strokeWidth:2,strokeLinejoin:"round",dash:"4 3"});continue}if(C.kind==="range"){let Ae=et([...xe].reverse().map(Oe=>({x:Oe.x,y:Oe.y0})),C.curve);ea.push({kind:"path",part:"range",d:`${he}L${Ae.slice(1)}Z`,fill:C.color,fillOpacity:.2,title:C.name});continue}if(C.kind==="area"){let Ae=un(Se(C.axis)),Oe=C.stack!==void 0?et([...xe].reverse().map(ot=>({x:ot.x,y:ot.y0})),C.curve).slice(1):`${xe[xe.length-1]?.x} ${Ae}L${xe[0]?.x} ${Ae}`,De=`skdx-g-${C.index}`;C.gradient&&!zr.some(ot=>ot.id===De)&&zr.push({id:De,vertical:!0,stops:[{offset:0,color:C.color,opacity:C.fillOpacity},{offset:1,color:C.color,opacity:0}]}),ea.push({kind:"path",part:"area",d:`${he}L${Oe}Z`,fill:C.gradient?`url(#${De})`:C.color,fillOpacity:C.gradient?void 0:C.fillOpacity})}ta.push({kind:"path",part:"line",d:he,stroke:C.color,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",dash:C.dash})}if(C.kind==="range"&&ve)for(let xe of we)for(let he of xe){let Ae=C.low[he.i],Oe=C.high[he.i],De=`${C.name}, ${b[he.i]}: ${Ce(Math.min(Ae,Oe))} \u2013 ${Ce(Math.max(Ae,Oe))}`;na.push({...bt(he.x,he.y,.01,C.color,De,or(C,he.i,Oe,De)),part:"anchor"})}if(C.kind!=="range")for(let xe of we)for(let he of xe){if(!Ie&&!ve&&!e.labels&&!C.errors)continue;let Ae=C.data[he.i],Oe=R?me[he.i]-ae[he.i]:Ae,De=hr(C.name,b[he.i],Oe,Ce);(Ie||ve)&&na.push(Ie&&C.symbol!=="circle"?ha(he.x,he.y,C.markerSize,C.symbol,C.color,ve?De:void 0,or(C,he.i,Ae,De),"point"):{...bt(he.x,he.y,Ie?C.markerSize:.01,C.color,ve?De:void 0,or(C,he.i,Ae,De)),part:Ie?"point":"anchor"}),ve&&Uo(C,he.i,k?he.y:he.x,me[he.i]),e.labels&&ra.push(K(he.x,he.y-8,Ce(Oe),{anchor:"middle"}))}}let Yo={plot:ne,xs:k?[]:v.map((C,ae)=>nn(ae)),rows:v.map(C=>[b[C],...L.map(ae=>{let me=Nr(ae);if(ae.kind==="range"){let ve=ae.low[C],ge=ae.high[C];return`${ae.name}: ${P(ve)&&P(ge)?`${me(ve)} \u2013 ${me(ge)}`:"\u2014"}`}let Ce=ae.data[C];return`${ae.name}: ${P(Ce)?me(R?(w.get(ae)?.[C]??0)-(p.get(ae)?.[C]??0):Ce):"\u2014"}`})]),count:d,zoom:z,crosshair:Er(e)},Rr=[];if(e.brush&&!k){let C={x:ne.x,y:ne.y+ne.height+gs,width:ne.width,height:bs},ae=L.find(Ce=>Ce.kind!=="range"),me={x:i(C.x+z.start/Math.max(1,d)*C.width),y:C.y,width:i((z.end-z.start)/Math.max(1,d)*C.width),height:C.height};if(Rr.push({kind:"rect",part:"brush",x:C.x,y:C.y,width:C.width,height:C.height,fill:"var(--skdx-color-surface-sunken)",stroke:Y.grid}),ae){let Ce=Be(ae.data),[ve,ge]=ye(Ce),we=d>1?C.width/(d-1):0,Me=ae.data.flatMap((xe,he)=>P(xe)?[{x:i(C.x+he*we),y:i(C.y+C.height-(ge===ve?.5:(xe-ve)/(ge-ve))*(C.height-4)-2)}]:[]),Ie=et(Me);Me.length>1&&Rr.push({kind:"path",part:"brush-series",d:`${Ie}L${Me[Me.length-1]?.x} ${C.y+C.height}L${Me[0]?.x} ${C.y+C.height}Z`,fill:ae.color,fillOpacity:.3})}Rr.push({kind:"rect",part:"brush-window",...me,fill:"var(--skdx-color-primary-500)",opacity:.15,stroke:Y.axis},{kind:"rect",part:"brush-handle",x:i(me.x-3),y:C.y+8,width:6,height:C.height-16,fill:Y.axis,rx:2},{kind:"rect",part:"brush-handle",x:i(me.x+me.width-3),y:C.y+8,width:6,height:C.height-16,fill:Y.axis,rx:2}),Yo.brush={box:C,window:me}}return{...Xr,shapes:[...Go,...ea,...Sr,...ta,...qo,...na,...ra,...An(e.annotations,Wo),...Rr,...Xr.shapes],hit:Yo,issues:o,defs:zr.length?zr:void 0}}function xs(e,n){if(!(!P(e)||n===null||n===void 0))return typeof n=="number"?P(n)?[e-Math.abs(n),e+Math.abs(n)]:void 0:P(n[0])&&P(n[1])?[Math.min(n[0],n[1]),Math.max(n[0],n[1])]:void 0}function Ni(e,n){if(!e||n<2)return{start:0,end:n};let t=Math.max(0,Math.min(n-1,Math.floor(e.start))),r=Math.max(t+1,Math.min(n,Math.ceil(e.end)));return r-t<2&&n>=2?{start:Math.min(t,n-2),end:Math.min(t,n-2)+2}:{start:t,end:r}}function Ri(e,n,t){let r=b=>b.type??n,a=[],o=zi(e),s=e.categories??[],c=(e.transforms??[]).filter(b=>b.type==="sort"||b.type==="bin"||b.type==="aggregate"),l=(e.transforms??[]).filter(b=>!c.includes(b)),d=e.stacked||e.stackOffset!==void 0&&e.stackOffset!=="zero",u=(b,z,N)=>{let k=N.filter($=>$!==null&&!(typeof $=="number"&&Number.isFinite($))).length;k&&a.push({code:"invalid-value",severity:"warning",message:`Series "${b}" has ${k} value${k===1?"":"s"} that ${k===1?"is":"are"} neither a number nor null; drawn as gaps.`,itemId:z??b}),s.length&&N.length!==s.length&&!e.transform&&a.push({code:"length-mismatch",severity:"warning",message:`Series "${b}" has ${N.length} values for ${s.length} categories.`,itemId:z??b})},h=e.series.map((b,z)=>{let N=r(b),k=d?!0:void 0,$=b.type==="range"?void 0:b.stack,L=$===!1?void 0:$===!0||$===void 0&&k?`${N}`:$;b.type==="range"?(u(b.name,b.id,b.low),u(b.name,b.id,b.high)):u(b.name,b.id,b.data);let S=R=>e.nulls==="zero"?R.map(j=>P(j)?j:0):R,v=ys(o,b.axis);return v===void 0&&a.push({code:"unknown-axis",severity:"warning",message:`Series "${b.name}" names axis "${String(b.axis)}", which is not defined; drawn on the first axis.`,itemId:b.id??b.name}),{name:b.name,id:b.id,color:ee(e,z,b.color),axis:v??o[0]?.id,hidden:be(e,b.name),index:z,kind:N,data:b.type==="range"?[]:S(ga(ga(b.data,l),b.transforms)),low:b.type==="range"?b.low:[],high:b.type==="range"?b.high:[],curve:b.curve??e.curve??"linear",dash:b.type==="range"?void 0:b.dash,markers:b.type==="range"?void 0:b.markers,symbol:b.type==="range"?"circle":b.symbol??"circle",markerSize:b.type==="range"?3:b.markerSize??3,errors:b.type==="range"?void 0:b.errors,stack:N==="range"||N==="line"?void 0:L,style:b.type==="range"?b.style??"area":"area",fillOpacity:(b.type==="range"?void 0:b.fillOpacity)??e.fillOpacity??.25,gradient:b.type!=="range"&&b.gradient===!0}}),f=()=>Math.max(s.length,...h.map(b=>Math.max(b.data.length,b.low.length))),y=b=>{let z=k=>k.length?b.map($=>k[$]??null):k,N=Array.from({length:f()},(k,$)=>s[$]??String($+1));s=b.map(k=>N[k]),h=h.map(k=>({...k,data:z(k.data),low:z(k.low),high:z(k.high)}))},I=(b,z)=>{let N=(z!==void 0?h.find($=>$.name===z):void 0)??h.find($=>!$.hidden&&$.kind!=="range")??h[0];z!==void 0&&!h.some($=>$.name===z)&&a.push({code:"unknown-series",severity:"warning",message:`sort.by names "${z}", which is not a series; sorted by the first series.`});let k=Array.from({length:f()},($,L)=>L).sort(($,L)=>{let S=N?.data[$]??N?.high[$],v=N?.data[L]??N?.high[L],R=P(S)?S:-1/0,j=P(v)?v:-1/0;return b==="asc"?R-j:j-R});y(k)},x=b=>{let z=h.flatMap(k=>Be(k.data)),N=Wn(z,b);s=N.slice(1).map((k,$)=>`${t(N[$])}\u2013${t(k)}`),h=h.map(k=>{let $=Be(k.data),L=0,S=Zn($,N).map(v=>e.binMode==="density"?$.length?v.count/($.length*(v.x1-v.x0)):0:e.binMode==="cumulative"?L+=v.count:v.count);return{...k,data:S}})},T=(b,z)=>{let N=Math.max(1,Math.floor(b)),k=f(),$=S=>{if(!S.length)return S;let v=[];for(let R=0;R<k;R+=N){let j=Be(S.slice(R,R+N));v.push(j.length===0?null:z==="sum"?j.reduce((p,w)=>p+w,0):z==="mean"?j.reduce((p,w)=>p+w,0)/j.length:z==="min"?Math.min(...j):Math.max(...j))}return v};s=Array.from({length:k},(S,v)=>s[v]??String(v+1)).filter((S,v)=>v%N===0),h=h.map(S=>({...S,data:$(S.data),low:$(S.low),high:$(S.high)}))};e.transform==="histogram"?x({bins:e.bins,binWidth:e.binWidth,domain:e.binDomain}):e.transform==="cumulative"&&(h=h.map(b=>{let z=0;return{...b,data:b.data.map(N=>P(N)?z+=N:z)}}));for(let b of c)b.type==="sort"?I(b.order??"desc"):b.type==="bin"?x(b):b.type==="aggregate"&&T(b.every,b.method??"sum");typeof e.sort=="string"?I(e.sort):e.sort&&I(e.sort.order,e.sort.by);let O=e.xAxis?.domain;if(O){let b=f(),z=Array.from({length:b},(L,S)=>s[S]??String(S+1)),N=L=>{let S=typeof L=="string"?L:je(L);return z.findIndex(v=>typeof S=="string"?v===S||Dt(v)===S:je(v)===S)},k=O.map(N),$=L=>L.length?k.map(S=>S<0?null:L[S]??null):L;s=[...O],h=h.map(L=>({...L,data:$(L.data),low:$(L.low),high:$(L.high)}))}return{series:h,categories:s,issues:a,axes:o}}var xa=e=>Ot(e,"bar");var ya=e=>Ot(e,"line"),va=e=>Ot(e,"area");function On(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var Ma=e=>e.id??e.name??e.series,vs=e=>e.seriesId??e.series;function rn(e,n){let t=!1;return n.id!==void 0&&(t=!0,Ma(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,vs(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}var wa=(e,n,t=On(n))=>t.some(r=>rn(e,r)),Vn=e=>On(e).flatMap(n=>n.id!==void 0?[n.id]:[]);function Sn(e){let n={},t=Ma(e);t!==void 0&&(n.id=t);let r=vs(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var $a=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function ka(e,n,t){let r=On(e),a=Sn(n),o=r.some(s=>rn(n,s));return t==="single"?o?[]:[a]:o?r.filter(s=>!rn(n,s)):[...r,a]}var Ei=.2;function Di(e){let n=Y.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 Bi=(e,n)=>e.kind==="text"?{...e,fill:Y.grid}:{...e,opacity:(e.opacity??1)*n};function Ia(e,n){let t=On(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:On(n.highlighted),a=r[0];if(t.length===0&&!a)return e;let o={highlighted:n.highlightScope?.highlighted??"item",faded:n.highlightScope?.faded??"global"},s=[],c=u=>!a||r.some(h=>rn(u,h))?!0:o.highlighted==="series"?r.some(h=>h.series!==void 0&&rn(u,{series:h.series})):!1,l=u=>{if(!a||o.faded==="none"||c(u))return!1;if(o.faded==="series"){let h=a.series;return h!==void 0&&rn(u,{series:h})}return!0},d=e.shapes.map(u=>{let h=u.item;if(!h||h.legend)return u;if(t.some(f=>rn(h,f))){let f=Di(u);f&&s.push(f)}return l(h)?Bi(u,Ei):u});return s.length?{...e,shapes:[...d,...s]}:{...e,shapes:d}}var pr=2*Math.PI;function qe(e,n,t,r,a,o){let s=(d,u)=>`${i(e+d*Math.sin(u))} ${i(n-d*Math.cos(u))}`;if(o-a>=pr-1e-9){let d=a+pr/2;return`${qe(e,n,t,r,a,d)}${qe(e,n,t,r,d,o)}`}let c=o-a>Math.PI?1:0,l=`M${s(t,a)}A${t} ${t} 0 ${c} 1 ${s(t,o)}`;return r>0?`${l}L${s(r,o)}A${r} ${r} 0 ${c} 0 ${s(r,a)}Z`:`${l}L${i(e)} ${i(n)}Z`}function Fi(e,n,t,r,a,o,s){let c=o-a;if(s<=0||c>=pr-1e-9)return qe(e,n,t,r,a,o);let l=Math.sin(Math.min(Math.PI/2,c/2)),d=Math.min(s,r>0?(t-r)/2:t/2,t*l/(1+l));if(r>0&&l<1&&(d=Math.min(d,r*l/(1-l))),d<=.25)return qe(e,n,t,r,a,o);let u=(T,O)=>`${i(e+T*Math.sin(O))} ${i(n-T*Math.cos(O))}`,h=T=>`A${i(d)} ${i(d)} 0 0 1 ${T}`,f=Math.asin(d/(t-d)),y=Math.sqrt((t-d)**2-d*d),I=o-a-2*f>Math.PI?1:0,x=`M${u(y,a)}${h(u(t,a+f))}A${t} ${t} 0 ${I} 1 ${u(t,o-f)}${h(u(y,o))}`;if(r>0){let T=Math.asin(d/(r+d)),O=Math.sqrt((r+d)**2-d*d),b=o-a-2*T>Math.PI?1:0;x+=`L${u(O,o)}${h(u(r,o-T))}A${r} ${r} 0 ${b} 0 ${u(r,a+T)}${h(u(O,a))}Z`}else x+=`L${i(e)} ${i(n)}Z`;return x}function Ta(e){let n=[];for(let V of e.data)P(V.value)&&V.value<0&&n.push({code:"negative-value",severity:"warning",message:`"${V.name}" is negative (${V.value}); a share of a whole cannot be, so it is drawn as zero.`,itemId:V.id??V.name});let t=oe(e,!e.data.some(V=>P(V.value)&&V.value>0),300,300);if(t)return{...t,issues:n};let r=re(e.format),a=e.percentFormat?re(e.percentFormat):V=>`${Math.round(V*100)}%`,o=Math.max(0,e.cornerRadius??0),{width:s,height:c}=se(e,300,300),l=ie(e),d=(e.startAngle??0)*Math.PI/180,u=(e.endAngle??(e.startAngle??0)+360)*Math.PI/180,h=Math.max(0,Math.min(pr,u-d)),f=h<=Math.PI+1e-9&&Math.abs(Math.sin(d))>.99,y=e.labels&&e.labelPosition==="outside",I=s/2,x=Math.max(.2,Math.min(1,e.outerRadius??1)),T=y?40:8,O=(f?Math.max(0,Math.min(s/2,c-l)-T):Math.max(0,Math.min(s,c-l)/2-T))*x,b=f?d<0||d>Math.PI?c-T:l+T:l+(c-l)/2,z=O*Math.min(.95,Math.max(0,e.innerRadius??(e.variant==="donut"?.6:0))),N=e.data.map((V,U)=>({...V,i:U,value:P(V.value)&&!be(e,V.name)?Math.max(0,V.value):0})),k=e.sort?[...N].sort((V,U)=>e.sort==="asc"?V.value-U.value:U.value-V.value):N,$=k.reduce((V,U)=>V+U.value,0),L=k.filter(V=>V.value>0).length,S=Math.max(0,Math.min((e.padAngle??0)*Math.PI/180,h/Math.max(1,L)/2)),v=h>=pr-1e-9,R=L>1?v?L:L-1:0,j=h-R*S,p=Math.min((e.minAngle??0)*Math.PI/180,j/Math.max(1,L)),w=k.map(V=>$>0?V.value/$*j:0);if(p>0)for(let V=0;V<k.length;V++){let U=k.map((_,W)=>_.value>0&&w[W]<p);if(!U.some(Boolean))break;let A=U.filter(Boolean).length*p,g=k.reduce((_,W,Q)=>_+(U[Q]||W.value<=0?0:W.value),0);if(k.forEach((_,W)=>{w[W]=U[W]?p:g>0?_.value/g*(j-A):0}),!k.some((_,W)=>_.value>0&&!U[W]&&w[W]<p))break}let M=On(e.selected),E=d+(v&&R?S/2:0),F=[],D=[],Z=[],B=k.map((V,U)=>{let A=$>0?V.value/$:0,g=E,_=E+w[U];A>0&&(E=_+S);let W=a(A),Q=`${V.name}: ${r(V.value)} (${W})`,G={label:Q,id:V.id??V.name,name:V.name,index:V.i,value:V.value},J=(g+_)/2;if(e.labels&&A>0){let ne=`${V.name} ${W}`;if(y){let pe=Math.sin(J),Te=i(b-(O+14)*Math.cos(J));Z.some(Ee=>Math.abs(Ee-Te)<12)||(Z.push(Te),D.push({kind:"line",part:"label-connector",x1:i(I+O*pe),y1:i(b-O*Math.cos(J)),x2:i(I+(O+12)*pe),y2:i(b-(O+12)*Math.cos(J)),stroke:Y.axis}),F.push(K(i(I+(O+16)*pe),Te,ne,{part:"slice-label",anchor:pe>.1?"start":pe<-.1?"end":"middle",baseline:"middle",fill:"var(--skdx-color-text-default)"})))}else if(A>.03){let pe=(O+z)/2;F.push(K(i(I+pe*Math.sin(J)),i(b-pe*Math.cos(J)),ne,{part:"slice-label",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-on-accent)"}))}}let te=wa(G,void 0,M)?Math.max(4,O*.06):0;return{kind:"path",part:"slice",d:A>0?Fi(I+te*Math.sin(J),b-te*Math.cos(J),O,z,g,_,o):"",fill:ee(e,V.i,V.color),title:Q,item:A>0?G:void 0}});e.centerLabel&&F.push(K(i(I),i(f?b-12:b),e.centerLabel,{part:"center-label",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-default)",weight:"bold"}));let H=le(e,s,c,e.data.map((V,U)=>({name:V.name,color:ee(e,U,V.color)})));return{...H,shapes:[...B,...D,...H.shapes,...F],issues:n}}var dt=2;function Ca(e){let n=Be(e.data),t=oe(e,n.length===0,120,32);if(t)return t;let r=re(e.format),{width:a,height:o}=se(e,120,32),s=e.data.length,c=n[0],l=n[n.length-1],d=e.lastValue?r(l):"",u=a-dt-(d?d.length*ue+6:0),h=e.variant??"area",f=h==="winloss",y=[...n,...e.band??[],...e.target!==void 0?[e.target]:[]],I=Je(f?[-1,1]:At(y,h==="bar"),[o-dt,dt]),x=e.x&&e.x.length>=s?e.x.map(je):void 0,[T,O]=x?ye(x):[0,1],b=Je([T,O],[dt,u]),z=S=>s<2?(dt+u)/2:x?O===T?(dt+u)/2:b(x[S]):dt+S/(s-1)*(u-dt),N=e.trend?l>=c?Y.positive:Y.negative:ee(e,0,e.color),k=[];if(e.band&&!f){let[S,v]=e.band,R=Math.min(I(S),I(v));k.push({kind:"rect",part:"band",x:dt,y:i(R),width:i(Math.max(0,u-dt)),height:i(Math.abs(I(v)-I(S))),fill:Y.axis,opacity:.12,title:`${r(Math.min(S,v))} \u2013 ${r(Math.max(S,v))}`})}e.target!==void 0&&P(e.target)&&!f&&k.push({kind:"line",part:"target",x1:dt,x2:i(u),y1:i(I(e.target)),y2:i(I(e.target)),stroke:Y.axis,dash:"3 2",title:`Target: ${r(e.target)}`});let $=e.data.flatMap((S,v)=>P(S)?[{x:i(z(v)),y:i(I(S)),v:S,i:v}]:[]),L=$[$.length-1];if(h==="bar"||f){let S=s>0?(u-dt)/s:0,v=i(I(0));e.data.forEach((R,j)=>{if(!P(R))return;let p=i(I(f?Math.sign(R):R));k.push({kind:"rect",part:"bar",x:i(dt+j*S+S*.1),y:Math.min(p,v),width:i(Math.max(1,S*.8)),height:i(Math.max(1,Math.abs(v-p))),fill:f?R<0?Y.negative:Y.positive:R<0&&e.trend?Y.negative:N,title:e.tooltip===!1?void 0:r(R)})})}else{let S=et($,e.curve),v=$[0];h==="area"&&k.push({kind:"path",part:"area",d:S&&v&&L?`${S}L${L.x} ${o-dt}L${v.x} ${o-dt}Z`:"",fill:N,fillOpacity:.15}),k.push({kind:"path",part:"line",d:S,stroke:N,strokeWidth:1.5});let R=e.markers??["last"];L&&R.includes("last")&&k.push(bt(L.x,L.y,2,N,void 0)),v&&R.includes("first")&&k.push({...bt(v.x,v.y,2,N,void 0),part:"first"})}if(e.extremes&&$.length>1){let S=$.reduce((R,j)=>j.v<R.v?j:R),v=$.reduce((R,j)=>j.v>R.v?j:R);k.push({...bt(S.x,S.y,2.5,Y.negative,r(S.v)),part:"min"},{...bt(v.x,v.y,2.5,Y.positive,r(v.v)),part:"max"})}return d&&L&&k.push(K(i(u+4),L.y,d,{part:"last-value",baseline:"middle",fill:"var(--skdx-color-text-default)"})),{...le(e,a,o),shapes:k}}function Aa(e){let n=e.metrics??(e.categories??[]).map(B=>({label:B})),t=oe(e,n.length===0||e.series.every(B=>Be(B.data).length===0),300,300);if(t)return t;let r=[],a=re(e.format),{width:o,height:s}=se(e,300,300),c=ie(e),l=o/2,d=c+(s-c)/2,u=Math.max(0,Math.min(o,s-c)/2-36),h=n.length,f=(e.startAngle??0)*Math.PI/180-Math.PI/2,y=B=>f+B*2*Math.PI/Math.max(1,h),I=e.series.filter(B=>!be(e,B.name)),x=e.normalize===!0?"series":e.normalize===!1||e.normalize===void 0?e.metrics?"metric":"none":e.normalize;x==="series"&&I.length>1&&r.push({code:"misleading-scale",severity:"warning",message:"normalize: 'series' scales each series to its own maximum, so polygons cannot be compared in magnitude; prefer 'metric' or 'none'."});let T=Math.max(1,Math.round(e.levels??4)),O=e.max??Math.max(0,ye(I.flatMap(B=>B.data))[1]),b=x==="none"?st(0,O,T):Array.from({length:T+1},(B,H)=>100*H/T),z=x==="none"?e.max??b[b.length-1]:100,N=n.map((B,H)=>{let V=I.map(W=>W.data[H]),[U,A]=ye(V),g=B.min??Math.min(0,U),_=st(g,B.max??A,T);return{min:g,max:B.max??_[_.length-1]}}),k=e.series.map(B=>Math.max(0,ye(B.data)[1])),$=(B,H,V)=>{if(x==="series")return k[B]>0?V/k[B]*100:0;if(x==="metric"){let U=N[H];return U.max>U.min?(V-U.min)/(U.max-U.min)*100:0}return V},L=(B,H)=>{let V=z>0?Math.max(0,Math.min(H,z))/z*u:0;return{x:i(l+V*Math.cos(y(B))),y:i(d+V*Math.sin(y(B)))}},S=B=>h===0?"":`M${n.map((H,V)=>{let U=L(V,B(V));return`${U.x} ${U.y}`}).join("L")}Z`,v=B=>{if(e.gridShape==="circle"){let H=z>0?B/z*u:0;return{kind:"circle",part:"grid",cx:i(l),cy:i(d),r:i(H),fill:"none",stroke:Y.grid}}return{kind:"path",part:"grid",d:S(()=>B),stroke:Y.grid}},R=b.filter(B=>B>0&&B<=z),j=B=>x==="none"?a(B):x==="series"?`${B}%`:(()=>{let H=N[0];return re(n[0]?.format??e.format)(H.min+(H.max-H.min)*B/100)})(),p=[...R.map(v),...n.map((B,H)=>{let V=L(H,z);return{kind:"line",part:"grid",x1:i(l),y1:i(d),x2:V.x,y2:V.y,stroke:Y.grid}}),...R.map(B=>K(i(l+4),L(0,B).y,j(B),{part:"y-label",baseline:"middle"})),...n.map((B,H)=>{let V=Math.cos(y(H)),U=u+14;return K(i(l+U*V),i(d+U*Math.sin(y(H))),B.label,{part:"x-label",anchor:V>.1?"start":V<-.1?"end":"middle",baseline:"middle"})})],w=[],M=[],E=[],F=e.markers??!0,D=e.markerSize??3;e.series.forEach((B,H)=>{if(be(e,B.name))return;let V=ee(e,H,B.color),U=A=>{let g=B.data[A];return P(g)?$(H,A,g):0};n.forEach((A,g)=>{let _=B.data[g];if(!P(_))return;let W=re(A.format??e.format),Q=L(g,$(H,g,_)),G=hr(B.name,A.label,_,W);w.push({...bt(Q.x,Q.y,F?D:.01,V,G,{label:G,id:A.id,series:B.name,seriesId:B.id,category:A.label,index:g,value:_}),part:F?"point":"anchor"}),e.labels&&E.push(K(Q.x,i(Q.y-7),W(_),{part:"value-label",anchor:"middle",fill:"var(--skdx-color-text-default)"}))}),M.push({kind:"path",part:"area",d:S(U),fill:e.fill??!0?V:void 0,fillOpacity:.25,stroke:V,strokeWidth:2,title:B.name,item:{label:B.name,series:B.name,seriesId:B.id}})});let Z=le(e,o,s,e.series.map((B,H)=>({name:B.name,color:ee(e,H,B.color)})));return{...Z,shapes:[...p,...M,...w,...E,...Z.shapes],issues:r}}var Vr={top:24,right:8,bottom:8,left:64},La=864e5,Oa=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];function Pi(e,n="monday"){let t=n==="sunday"?[Oa[6],...Oa.slice(0,6)]:Oa,r=e.map(x=>({day:Math.floor(new Date(x.date).getTime()/La),value:x.value})).filter(x=>Number.isFinite(x.day));if(r.length===0)return{rows:t,columns:[],data:t.map(()=>[]),dates:t.map(()=>[])};let[a,o]=ye(r.map(x=>x.day)),s=n==="sunday"?4:3,c=x=>((x+s)%7+7)%7,l=a-c(a),d=Math.floor((o-l)/7)+1,u=t.map(()=>new Array(d).fill(null)),h=t.map(()=>new Array(d).fill(void 0));for(let x of r){let T=Math.floor((x.day-l)/7);u[c(x.day)][T]=x.value,h[c(x.day)][T]=new Date(x.day*La).toISOString().slice(0,10)}let f=new Intl.DateTimeFormat(void 0,{month:"short"}),y=-1,I=Array.from({length:d},(x,T)=>{let O=new Date((l+T*7+6)*La),b=O.getUTCMonth();return b===y?"":(y=b,f.format(O))});return{rows:t,columns:I,data:u,dates:h}}var Vi=e=>e.colorScale??(e.diverging?{type:"diverging",steps:e.steps}:{type:"sequential",domain:e.domain,steps:e.steps}),Ms=(e,n)=>{let t=e.map((r,a)=>a);return n&&t.sort((r,a)=>(n==="asc"?1:-1)*(e[r]-e[a])),t};function Sa(e){let n=[],t=e.calendar?Pi(e.calendar,e.weekStart):void 0,r=t?.rows??e.rows??[],a=t?.columns??e.columns??[],o=t?.data??e.data??[];!t&&(o.length!==r.length||o.some(p=>p.length!==a.length))&&n.push({code:"ragged-matrix",severity:"warning",message:`The matrix is ${o.length} \xD7 ${o[0]?.length??0} but there are ${r.length} rows and ${a.length} columns; missing cells are blank.`});let s=o.flat().filter(p=>p!=null&&!P(p)).length;s&&n.push({code:"invalid-value",severity:"warning",message:`${s} cell${s===1?" is":"s are"} neither a number nor null; drawn as blank.`});let c=o.flat(),l=oe(e,r.length===0||a.length===0||!c.some(P));if(l)return{...l,issues:n};let d=re(e.format),{width:u,height:h}=se(e),f=Ln(e.colorLegend),y=$e(u,h,{...Vr,left:t?40:Vr.left,right:Vr.right+f.right,bottom:Vr.bottom+f.bottom}),I=p=>p.reduce((w,M)=>w+(P(M)?M:0),0),x=Ms(r.map((p,w)=>I(o[w]??[])),e.rowOrder),T=Ms(a.map((p,w)=>I(o.map(M=>M[w]))),e.columnOrder),O=x.map(p=>r[p]),b=T.map(p=>a[p]),z=y.width/Math.max(1,b.length),N=y.height/Math.max(1,O.length),k=gt(Vi(e),c,ee(e,0,e.color),e.negativeColor,d),$=[],L=[],S=e.cellGap??(t?1:0),v=e.cellRadius??(t?2:0);O.forEach((p,w)=>{b.forEach((M,E)=>{let F=o[x[w]]?.[T[E]],D=t?.dates[x[w]]?.[T[E]],Z=t?D??p:`${p}, ${M}`,B=i(y.x+E*z+S),H=i(y.y+w*N+S),V={x:B,y:H,width:i(Math.max(0,z-2*S)),height:i(Math.max(0,N-2*S)),rx:v||void 0};if(!P(F)){e.missingColor&&(!t||D)&&$.push({kind:"rect",part:"missing",...V,fill:e.missingColor,title:`${Z}: \u2014`});return}let U=k.color(F),A=`${Z}: ${d(F)}`;$.push({kind:"rect",part:"cell",...V,fill:U.fill,opacity:U.opacity,title:A,item:{label:A,id:t?D:`${p}:${M}`,category:M,name:p,index:E,value:F}}),e.labels&&z>24&&N>12&&L.push(K(i(y.x+(E+.5)*z),i(y.y+(w+.5)*N),d(F),{part:"cell-label",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-default)"}))})});let R=le(e,u,h),j=e.colorLegend?qn(k,f.right?{x:y.x+y.width+12,y:y.y,width:f.right,height:y.height}:{x:y.x,y:y.y+y.height+8,width:y.width,height:f.bottom},f.options):[];return{...R,shapes:[...O.map((p,w)=>K(y.x-8,i(y.y+(w+.5)*N),p,{part:"y-label",anchor:"end",baseline:"middle"})),...b.flatMap((p,w)=>p?[K(i(y.x+(w+.5)*z),y.y-8,p,{part:"x-label",anchor:t?"start":"middle"})]:[]),...$,...L,...j,...R.shapes],issues:n}}var Hr=8;function za(e){let n=e.variant==="pyramid",t=[],r=e.sort??(n?"asc":void 0),a=e.data.filter(w=>P(w.value)?!0:(t.push({code:"invalid-value",severity:"warning",message:`Stage "${w.name}" has no valid value and was dropped.`,itemId:w.id??w.name}),!1)).sort((w,M)=>r==="asc"?w.value-M.value:r==="desc"?M.value-w.value:0),o=oe(e,a.length===0,400,300);if(o)return{...o,issues:t};let s=re(e.format),{width:c,height:l}=se(e,400,300),d=a.length,u=e.orientation==="horizontal",h=Math.max(0,e.gap??4),f=e.labelPosition??"inside",y=Math.max(0,...a.map(w=>w.value)),I=a.reduce((w,M)=>w+Math.max(0,M.value),0),x=a[0]?.value??0,T=ie(e),O=u?c:l-T,b=u?l-T:c,z=f==="outside",N=Math.max(0,(z?b*2/3:b)-2*Hr),k=d===0?0:(O-2*Hr)/d,$=Math.max(0,Math.min(1,e.neckWidth??0)),L=w=>y>0?($+(1-$)*(Math.max(0,w)/y))*N:0,S=e.percentFormat?re(e.percentFormat):w=>`${Math.round(w*100)}%`,v=a.map((w,M)=>({name:w.name,color:ee(e,M,w.color)})),R=(u?T+(l-T)/2:c/2)-(z?b/6:0),j=a.flatMap((w,M)=>{let E=L(w.value),F=L(a[M+1]?.value??w.value),D=Hr+M*k+(u?0:T),Z=D+k-h,B=n?I>0?w.value/I:0:x>0?w.value/x:0,H=a[M-1]?.value,V=!n&&H!==void 0&&H>0?` \xB7 \u2212${S(1-w.value/H)} from ${a[M-1]?.name}`:"",U=`${w.name}: ${s(w.value)} (${S(B)})${V}`,g={kind:"path",part:"stage",d:u?`M${i(D)} ${i(R-E/2)}L${i(D)} ${i(R+E/2)}L${i(Z)} ${i(R+F/2)}L${i(Z)} ${i(R-F/2)}Z`:`M${i(R-E/2)} ${i(D)}L${i(R+E/2)} ${i(D)}L${i(R+F/2)} ${i(Z)}L${i(R-F/2)} ${i(Z)}Z`,fill:ee(e,M,w.color),title:U,item:{label:U,id:w.id??w.name,name:w.name,index:M,value:w.value}};if(f==="none")return[g];let _=`${w.name} \xB7 ${s(w.value)}`,W=(D+Z)/2;if(z){let Q=R+N/2+Hr;return[g,K(i(u?W:Q),i(u?Q:W),_,{part:"stage-label",anchor:u?"middle":"start",baseline:u?"hanging":"middle",fill:"var(--skdx-color-text-default)"})]}return[g,K(i(u?W:R),i(u?R:W),_,{part:"stage-label",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-on-accent)"})]}),p=le(e,c,l,v);return{...p,shapes:[...j,...p.shapes],issues:t}}var ws=e=>e*Math.PI/180;function Na(e){let n=e.data.filter(L=>P(L.value)),t=oe(e,n.length===0,300,300);if(t)return t;let r=re(e.format),{width:a,height:o}=se(e,300,300),s=ie(e),c=a/2,l=s+(o-s)/2,d=Math.max(0,Math.min(a,o-s)/2-(e.bands?20:8)),u=d*Math.min(.95,Math.max(0,e.innerRadius??.3)),h=ws(e.startAngle??0),f=ws(e.endAngle??(e.startAngle??0)+360),y=Math.max(0,Math.min(2*Math.PI,f-h)),I=e.max??Math.max(0,...n.map(L=>L.value)),x=n.length,T=Math.max(0,e.gap??.25),O=x===0?0:(d-u)/(x+T*(x-1)),b=e.rounded??!0,z=L=>I>0?Math.max(0,Math.min(1,L/I)):0,N=[],k=n.map((L,S)=>({name:L.name,color:ee(e,S,L.color)}));for(let L of e.bands??[]){let S=h+z(L.from)*y,v=h+z(L.to)*y;v<=S||N.push({kind:"path",part:"band",d:qe(c,l,d+14,d+6,S,v),fill:pt(L.variant),opacity:.6,title:`${r(L.from)} \u2013 ${r(L.to)}`})}if(n.forEach((L,S)=>{if(be(e,L.name))return;let v=d-S*O*(1+T),R=v-O,j=ee(e,S,L.color),p=h+z(L.value)*y,w=`${L.name}: ${r(L.value)} (${Math.round(z(L.value)*100)}%)`;if((e.track??!0)&&N.push({kind:"path",part:"track",d:qe(c,l,v,R,h,h+y),fill:Y.grid,opacity:.6}),p>h&&(N.push({kind:"path",part:"bar",d:qe(c,l,v,R,h,p),fill:j,title:w,item:{label:w,id:L.id,name:L.name,index:S,value:L.value}}),b&&y<2*Math.PI-1e-9)){let M=(R+v)/2;for(let E of[h,p])N.push({kind:"circle",part:"bar-cap",cx:i(c+M*Math.sin(E)),cy:i(l-M*Math.cos(E)),r:i(O/2),fill:j})}if(e.labels){let M=(R+v)/2;N.push(K(i(c+M*Math.sin(h)-6*Math.cos(h)),i(l-M*Math.cos(h)-6*Math.sin(h)),`${L.name} ${r(L.value)}`,{part:"bar-label",anchor:Math.cos(h)>=0?"end":"start",baseline:"middle"}))}}),e.target!==void 0&&P(e.target)){let L=h+z(e.target)*y,S=d-x*O*(1+T)+O*T;N.push({kind:"line",part:"target",x1:i(c+S*Math.sin(L)),y1:i(l-S*Math.cos(L)),x2:i(c+(d+4)*Math.sin(L)),y2:i(l-(d+4)*Math.cos(L)),stroke:"var(--skdx-color-text-default)",strokeWidth:2,title:`Target: ${r(e.target)}`})}e.centerLabel&&N.push(K(i(c),i(l),e.centerLabel,{part:"center-label",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-default)",weight:"bold"}));let $=le(e,a,o,k);return{...$,shapes:[...N,...$.shapes]}}var $s=e=>e*Math.PI/180;function Hi(e,n){let t=[0],r=[0],a=o=>{t.push(Math.sin(o)),r.push(-Math.cos(o))};a(e),a(n);for(let o=Math.ceil(e/(Math.PI/2));o*(Math.PI/2)<=n;o++)a(o*(Math.PI/2));return{x0:Math.min(...t),y0:Math.min(...r),x1:Math.max(...t),y1:Math.max(...r)}}function Ra(e){let n=oe(e,!P(e.value),300,300);if(n)return n;let t=re(e.format),{width:r,height:a}=se(e,300,300),o=ie(e),s=P(e.min)?e.min:0,c=P(e.max)?e.max:100,l=e.startAngle??-120,d=e.endAngle??120,u=$s(l),h=$s(Math.max(l,Math.min(l+360,d))),f=h-u,y=G=>c>s?Math.max(0,Math.min(1,(G-s)/(c-s))):0,I=G=>u+y(G)*f,x=e.variant==="solid",T=e.ticks===!1?0:e.ticks===!0||e.ticks===void 0?5:e.ticks,O=e.tickLabels??!0,b=Array.from({length:T},(G,J)=>T===1?s:s+(c-s)*J/(T-1)),z=T>0&&O,N=z?Math.max(...b.map(G=>t(G).length))*ue:0,k=z?14+N:10,$=z?26:10,L=Hi(u,h),S=Math.max(L.x1-L.x0,.2),v=Math.max(L.y1-L.y0,.2),R=Math.max(0,Math.min((r-2*k)/S,(a-o-2*$)/v)),j=r/2-(L.x0+L.x1)/2*R,p=o+(a-o)/2-(L.y0+L.y1)/2*R,w=R*Math.max(.04,Math.min(.6,e.thickness??.18)),M=R-w,E=(G,J)=>({x:i(j+G*Math.sin(J)),y:i(p-G*Math.cos(J))}),F=[],D=`${t(s)} \u2013 ${t(c)}`,Z=(e.bands??[]).filter(G=>P(G.from)&&P(G.to)),B=G=>Z.find(J=>G>=J.from&&G<=J.to),H=G=>G.color??pt(G.variant);F.push({kind:"path",part:"track",d:qe(j,p,R,M,u,h),fill:Y.grid,opacity:.6});for(let G of Z){let J=I(Math.min(G.from,G.to)),te=I(Math.max(G.from,G.to));if(te<=J)continue;let ne=`${G.label?`${G.label}: `:""}${t(G.from)} \u2013 ${t(G.to)}`;F.push(x?{kind:"path",part:"band",d:qe(j,p,R+6,R+2,J,te),fill:H(G),opacity:.7,title:ne}:{kind:"path",part:"band",d:qe(j,p,R,M,J,te),fill:H(G),opacity:.75,title:ne})}let V=`${e.caption??"Value"}: ${t(e.value)} (${D})`,U={label:V,name:e.caption,value:e.value},A=I(e.value);if(x){let G=B(e.value),J=G?H(G):ee(e,0);A>u+1e-6?F.push({kind:"path",part:"value",d:qe(j,p,R,M,u,A),fill:J,title:V,item:U}):F.push({..._i(j,p),title:V,item:U})}else{let G=E(M-4,A),J=4,te=E(J,A-Math.PI/2),ne=E(J,A+Math.PI/2);F.push({kind:"path",part:"needle",d:`M${te.x} ${te.y}L${G.x} ${G.y}L${ne.x} ${ne.y}Z`,fill:"var(--skdx-color-text-default)",title:V,item:U},{kind:"circle",part:"hub",cx:i(j),cy:i(p),r:5,fill:"var(--skdx-color-text-default)"})}for(let G of b){let J=I(G),te=E(R+2,J),ne=E(R+7,J);if(F.push({kind:"line",part:"tick",x1:te.x,y1:te.y,x2:ne.x,y2:ne.y,stroke:Y.axis}),O){let pe=E(R+12,J),Te=Math.sin(J);F.push(K(pe.x,pe.y,t(G),{part:"tick-label",anchor:Te>.3?"start":Te<-.3?"end":"middle",baseline:"middle"}))}}if(P(e.target)){let G=I(e.target),J=E(M-2,G),te=E(R+4,G);F.push({kind:"line",part:"target",x1:J.x,y1:J.y,x2:te.x,y2:te.y,stroke:"var(--skdx-color-text-default)",strokeWidth:2,title:`Target: ${t(e.target)}`})}let _=f<2*Math.PI-1e-6?L.y1<.2?p-M*.4:p+M*.45:p;F.push(K(i(j),i(_),e.centerLabel??t(e.value),{part:"center-label",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-default)",weight:"bold"})),e.caption&&F.push(K(i(j),i(_+16),e.caption,{part:"caption",anchor:"middle",baseline:"middle"}));let W=le(e,r,a),Q=P(e.target)?`, target ${t(e.target)}`:"";return{...W,description:e.description??`${e.caption??"Value"} ${t(e.value)} on a scale from ${t(s)} to ${t(c)}${Q}.`,shapes:[...F,...W.shapes]}}var _i=(e,n)=>({kind:"circle",part:"anchor",cx:i(e),cy:i(n),r:.01,fill:"none"});function Ea(e){let[n,t]=e.sizeRange??[4,24],r=re(e.zAxis?.format??e.format),a=e.zAxis?.label,o=e.xAxis?.label,s=e.yAxis?.label,c=(l,d)=>l?`${l} ${d}`:d;return fa({...e,series:e.series.map(l=>({name:l.name,id:l.id,color:l.color,data:l.data.filter(d=>P(d.x)&&P(d.y)).map(d=>({x:d.x,y:d.y,size:P(d.z)?Math.max(0,d.z):0,label:d.label,id:d.id,color:d.color,value:d.value??d.z}))}))},{part:"bubble",opacity:.7,radius:(l,[,d])=>d>0&&P(l)?Math.max(n,Math.sqrt(l/d)*t):n,describe:(l,d,u,h)=>`${l}${d.label?` ${d.label}`:""}: ${c(o,u.format(d.x))}, ${c(s,h.format(d.y))}, ${c(a,r(d.size??0))}`})}function Da(e){let n=Be(e.data),t=oe(e,n.length===0);if(t)return t;let r=Wn(n,{bins:e.bins,binWidth:e.binWidth,domain:e.domain,thresholds:e.thresholds}),a=Zn(n,r),o=a.reduce((x,T)=>x+T.count,0),s=e.mode??"count",c=re(e.xAxis?.format??e.format),l=re(s==="percent"?{style:"percent",digits:1}:s==="density"?{style:"decimal",digits:3}:e.format),d=e.name??(s==="density"?"Density":s==="percent"?"Share":"Count"),u=x=>s==="density"?o>0&&x.x1>x.x0?x.count/(o*(x.x1-x.x0)):0:s==="percent"?o>0?x.count/o:0:x.count,h=a.map(x=>`${c(x.x0)}\u2013${c(x.x1)}`),f=Ot({...e,format:l,series:[{name:d,data:a.map(u),color:e.color}],categories:h,xAxis:e.xAxis?.label?{label:e.xAxis.label}:void 0,barGap:e.barGap??.05,transform:void 0},"bar"),y=f.shapes.map((x,T)=>{if(x.part!=="bar"||!x.item||x.item.index===void 0)return x;let O=a[x.item.index];if(!O)return x;let b=o>0?` (${Math.round(O.count/o*1e3)/10}%)`:"",z=`${h[x.item.index]??String(T)}: ${O.count}${b}${s==="count"?"":` \xB7 ${d} ${l(u(O))}`}`;return{...x,title:x.title===void 0?void 0:z,item:{...x.item,label:z}}}),I=f.hit?.rows.map((x,T)=>{let O=a[T];return O?[x[0],`${d}: ${l(u(O))}`,`Observations: ${O.count}`]:x});return{...f,shapes:y,hit:f.hit&&I?{...f.hit,rows:I}:f.hit}}function ji(e,n){let t=[],r=n;for(let a of e??[]){let o=typeof a=="number"?{from:r,to:a}:a;P(o.to)&&(t.push(o),r=o.to)}return t}function br(e){let n=e.data.filter(k=>P(k.value)),t=oe(e,n.length===0,600,40+44*Math.max(1,e.data.length));if(t)return t;let r=re(e.format),a=e.orientation==="vertical",{width:o,height:s}=se(e,600,a?300:40+44*n.length),c=k=>k.ranges??e.ranges,l=n.flatMap(k=>[k.value,k.target,...(c(k)??[]).map($=>typeof $=="number"?$:$.to)]),[d,u]=ye(l),h=e.min??Math.min(0,d),f=Math.max(0,...n.map(k=>k.name.length))*ue,y=$e(o,s,{top:de.top+ie(e),right:e.labels&&!a?56:de.right,bottom:de.bottom,left:a?de.left:Math.max(de.left,f+16)}),I=a?[y.y+y.height,y.y]:[y.x,y.x+y.width],x=Ve([h,Math.max(h,u)],I,{min:h,max:e.max,ticks:e.ticks},e.format),T=Pe(n.length,a?[y.x,y.x+y.width]:[y.y,y.y+y.height],.3),O=le(e,o,s),b=n.map((k,$)=>({pos:i(T.center($)),label:k.name})),z=Ge({...O,plot:y,xTicks:a?ze(b,y.width):b,yTicks:a?x.ticks:ze(x.ticks,y.width),baseline:x.zero},{horizontal:!a}),N=(k,$,L,S,v)=>{let R=x.scale(k),j=x.scale($),p=Math.max(1,Math.abs(j-R));return a?{kind:"rect",x:i(L-S/2),y:i(Math.min(R,j)),width:i(S),height:i(p),...v}:{kind:"rect",x:i(Math.min(R,j)),y:i(L-S/2),width:i(p),height:i(S),...v}};return n.forEach((k,$)=>{if(be(e,k.name))return;let L=T.center($),S=T.bandwidth,v=ji(c(k),h);v.forEach((w,M)=>{let E=`${k.name} ${w.label??`range ${M+1}`}: ${r(w.from)} \u2013 ${r(w.to)}`;z.push(N(w.from,w.to,L,S,{part:"range",fill:w.color??(w.variant?pt(w.variant):Y.axis),opacity:w.variant||w.color?.25:Math.max(.1,.4-M*.1),title:E}))});let R=P(k.target)?` \xB7 target ${r(k.target)}`:"",j=v.find(w=>k.value>=w.from&&k.value<=w.to),p=`${k.name}: ${r(k.value)}${R}${j?.label?` (${j.label})`:""}`;if(z.push(N(Math.min(h,k.value),k.value,L,S/3,{part:"measure",fill:ee(e,$,k.color),title:p,item:{label:p,id:k.id,name:k.name,index:$,value:k.value}})),P(k.target)){let w=i(x.scale(k.target));z.push({kind:"line",part:"target",x1:a?i(L-S/2.5):w,x2:a?i(L+S/2.5):w,y1:a?w:i(L-S/2.5),y2:a?w:i(L+S/2.5),stroke:"var(--skdx-color-text-default)",strokeWidth:3,title:`${k.name} target: ${r(k.target)}`})}if(e.labels){let w=x.scale(P(k.target)?Math.max(k.value,k.target):k.value);z.push(a?K(i(L),i(w-6),r(k.value),{part:"value-label",anchor:"middle"}):K(i(w+6),i(L),r(k.value),{part:"value-label",baseline:"middle"}))}}),{...O,shapes:[...z,...O.shapes]}}var Ba=e=>Ot(e,"bar");function Fa(e){let n=e.variant??"area";return Ot({...e,series:e.series.map(t=>({type:"range",name:t.name,low:t.low,high:t.high,color:t.color,axis:t.axis,curve:t.curve,style:n}))},"bar")}var ks=60,Gi=500;function Pa(e){let n=[],t=new Map;for(let q of e.nodes)t.has(q.id)?n.push({code:"duplicate-id",severity:"warning",message:`Node id "${q.id}" is duplicated; the first definition is kept.`,itemId:q.id}):t.set(q.id,q);let r=q=>q.group,a=[...t.values()].filter(q=>!(q.group!==void 0&&be(e,q.group))),o=new Set(a.map(q=>q.id)),s=e.edges.filter(q=>{let ce=o.has(q.source)&&o.has(q.target);return!ce&&!(t.has(q.source)&&t.has(q.target))&&n.push({code:"unknown-node",severity:"warning",message:`Edge ${q.source} \u2192 ${q.target} names a node that does not exist and was dropped.`,itemId:q.id}),ce}),c=oe(e,a.length===0);if(c)return{...c,issues:n};let l=re(e.format),{width:d,height:u}=se(e),[h,f]=e.nodeRange??[5,16],y=e.labels??a.length<=ks,I=$e(d,u,{top:ie(e)+f+8,right:f+(y?48:8),bottom:f+8,left:f+8}),x=[...new Set(e.nodes.map(r).filter(q=>q!==void 0))],T=(q,ce)=>q.color??ee(e,q.group!==void 0?x.indexOf(q.group):ce),[,O]=ye(a.map(q=>q.value)),b=q=>P(q)&&O>0?h+Math.sqrt(Math.max(0,q)/O)*(f-h):h,z=new Map;for(let q of s)z.set(q.source,(z.get(q.source)??0)+1),q.target!==q.source&&z.set(q.target,(z.get(q.target)??0)+1);let N=a.length,k=new Map(a.map((q,ce)=>[q.id,ce])),$,L,S=e.arrange??"force";S==="manual"&&a.every(q=>P(q.x)&&P(q.y))?($=a.map(q=>q.x),L=a.map(q=>q.y)):S==="circular"||S==="manual"||N<3?($=a.map((q,ce)=>Math.cos(2*Math.PI*ce/N-Math.PI/2)),L=a.map((q,ce)=>Math.sin(2*Math.PI*ce/N-Math.PI/2))):{xs:$,ys:L}=Wi(N,s.map(q=>[k.get(q.source),k.get(q.target)]),e.iterations??Math.max(50,Math.min(300,Math.floor(3e4/N))));let[v,R]=ye($),[j,p]=ye(L),w=Math.max(R-v,p-j)||1,M=Math.min(I.width/w,I.height/w),E=I.x+(I.width-(R-v)*M)/2,F=I.y+(I.height-(p-j)*M)/2,D=a.map((q,ce)=>({node:q,index:ce,x:i(E+($[ce]-v)*M),y:i(F+(L[ce]-j)*M),r:i(b(q.value)),color:T(q,ce),degree:z.get(q.id)??0})),Z=new Map(D.map(q=>[q.node.id,q])),B=Vn(e.selected)[0],H=B!==void 0?Z.get(String(B)):void 0,V=new Set;if(H){V.add(H.node.id);for(let q of s)q.source===H.node.id&&V.add(q.target),q.target===H.node.id&&V.add(q.source)}let U=(q,ce=q)=>H&&!(V.has(q)&&V.has(ce))?.15:void 0,A=q=>!H||q.source===H.node.id||q.target===H.node.id,[,g]=ye(s.map(q=>q.value)),_=s.length<=Gi,W=[],Q=(q,ce,Se)=>W.some(Ze=>Math.abs(Ze.y-ce)<12&&q<Ze.x+Ze.w+4&&q+Se+4>Ze.x)?!1:(W.push({x:q,y:ce,w:Se}),!0),G=[],J=[],te=s.map(q=>{let ce=Z.get(q.source),Se=Z.get(q.target),Ze=P(q.value)&&g>0?1+3*Math.sqrt(Math.max(0,q.value)/g):1,un=`${ce.node.label??ce.node.id} \u2192 ${Se.node.label??Se.node.id}${q.label?` ${q.label}`:""}${P(q.value)?`: ${l(q.value)}`:""}`,tn=A(q)?U(q.source,q.target):.15,hn=_?{label:un,id:q.id,name:q.source,category:q.target,value:q.value}:void 0;if(ce===Se){let _e=ce.r*2.5;return{kind:"path",part:"edge",d:`M${i(ce.x)} ${i(ce.y-ce.r)}C${i(ce.x-_e)} ${i(ce.y-_e*1.5)} ${i(ce.x+_e)} ${i(ce.y-_e*1.5)} ${i(ce.x)} ${i(ce.y-ce.r)}`,stroke:Y.axis,strokeWidth:Ze,opacity:tn??.7,title:_?un:void 0,item:hn}}let fn=Math.hypot(Se.x-ce.x,Se.y-ce.y)||1,Gt=(Se.x-ce.x)/fn,Wt=(Se.y-ce.y)/fn;if(e.directed){let _e=Se.x-Gt*Se.r,Zt=Se.y-Wt*Se.r,nn=_e-Gt*6,ar=Zt-Wt*6;G.push({kind:"path",part:"arrow",d:`M${i(_e)} ${i(Zt)}L${i(nn-Wt*3)} ${i(ar+Gt*3)}L${i(nn+Wt*3)} ${i(ar-Gt*3)}Z`,fill:Y.axis,opacity:tn??.7})}let pn=`${q.label??""}${P(q.value)?`${q.label?": ":""}${l(q.value)}`:""}`;if(e.edgeLabels&&pn){let _e=(ce.x+Se.x)/2,Zt=(ce.y+Se.y)/2,nn=pn.length*ue;Q(_e-nn/2,Zt,nn)&&J.push(K(i(_e),i(Zt),pn,{part:"edge-label",anchor:"middle",baseline:"middle"}))}return{kind:"path",part:"edge",d:`M${i(ce.x)} ${i(ce.y)}L${i(Se.x)} ${i(Se.y)}`,stroke:Y.axis,strokeWidth:Ze,opacity:tn??.7,title:_?un:void 0,item:hn}}),ne=[],pe=[];for(let q of D){let ce=q.node.label??q.node.id,Se=P(q.node.value)?`: ${l(q.node.value)}`:"",Ze=q.node.group!==void 0?` \xB7 ${q.node.group}`:"",un=`${ce}${Se}${Ze} \xB7 ${q.degree} connection${q.degree===1?"":"s"}`;if(ne.push({kind:"circle",part:"node",cx:q.x,cy:q.y,r:q.r,fill:q.color,stroke:H?.node.id===q.node.id?"var(--skdx-color-text-default)":"var(--skdx-color-surface-default)",opacity:U(q.node.id),title:un,item:{label:un,name:q.node.id,category:q.node.group,index:q.index,value:q.node.value}}),!y)continue;let tn=ce.length*ue,hn=q.x+q.r+4,fn=q.y;Q(hn,fn,tn)&&pe.push(K(i(hn),i(fn),ce,{part:"node-label",baseline:"middle",fill:U(q.node.id)===void 0?"var(--skdx-color-text-default)":Y.grid}))}let Te=x.map((q,ce)=>({name:q,color:ee(e,ce)})),Ee=le(e,d,u,Te);return{...Ee,shapes:[...te,...G,...ne,...J,...pe,...Ee.shapes],issues:n}}function Wi(e,n,t){let r=Array.from({length:e},(l,d)=>Math.cos(2*Math.PI*d/e)),a=Array.from({length:e},(l,d)=>Math.sin(2*Math.PI*d/e)),o=Math.sqrt(4/e),s=new Array(e).fill(0),c=new Array(e).fill(0);for(let l=0;l<t;l++){let d=.1*(1-l/t)+.005;s.fill(0),c.fill(0);for(let u=0;u<e;u++)for(let h=u+1;h<e;h++){let f=r[u]-r[h],y=a[u]-a[h];f===0&&y===0&&(f=.001*(u%7+1),y=.001*(h%5+1));let I=f*f+y*y,x=o*o/I;s[u]=s[u]+f*x,c[u]=c[u]+y*x,s[h]=s[h]-f*x,c[h]=c[h]-y*x}for(let[u,h]of n){if(u===h)continue;let f=r[u]-r[h],y=a[u]-a[h],I=Math.hypot(f,y)||1e-6,x=I*I/o/I;s[u]=s[u]-f*x,c[u]=c[u]-y*x,s[h]=s[h]+f*x,c[h]=c[h]+y*x}for(let u=0;u<e;u++){let h=Math.hypot(s[u],c[u])||1e-6,f=Math.min(h,d);r[u]=r[u]+s[u]/h*f,a[u]=a[u]+c[u]/h*f}}return{xs:r,ys:a}}var Va=14;function Ha(e){let n=[],t=e.events.map((M,E)=>({event:M,index:E,time:new Date(M.date).getTime()})).filter(M=>Number.isFinite(M.time)?!(M.event.group!==void 0&&be(e,M.event.group)):(n.push({code:"invalid-value",severity:"warning",message:`Event "${M.event.label}" has an unparseable date and was dropped.`,itemId:M.event.id??M.event.label}),!1)).sort((M,E)=>M.time-E.time||M.index-E.index),r=oe(e,t.length===0);if(r)return{...r,issues:n};let{width:a,height:o}=se(e),s=e.orientation==="vertical",c=[...new Set(e.events.map(M=>M.group).filter(M=>M!==void 0))],l=c.length?c:[""],[d,u]=ye(t.map(M=>M.time)),h=e.xAxis?.format??{style:u-d<2*864e5?"time":"date"},f=M=>Dt(M,h),y=e.labels??!0,I=t.map(M=>{let E=M.event.group,F=M.event.color??(M.event.variant?pt(M.event.variant):ee(e,E===void 0?0:c.indexOf(E))),D=M.event.description?` \u2014 ${M.event.description}`:"";return{...M,lane:E===void 0?0:c.indexOf(E),color:F,text:`${M.event.label} \xB7 ${f(M.time)}${D}`}}),x=c.map((M,E)=>({name:M,color:ee(e,E)})),T=le(e,a,o,x),O=M=>({label:M.text,id:M.event.id,name:M.event.label,category:M.event.group,index:M.index,value:M.time}),b=[];if(s){let M=Math.max(...I.map(Z=>f(Z.time).length))*ue+16,E=$e(a,o,{top:8+ie(e),right:8,bottom:8,left:M+12}),F=Pe(I.length,[E.y,E.y+E.height],0),D=i(E.x);return b.push({kind:"line",part:"axis",x1:D,x2:D,y1:E.y,y2:E.y+E.height,stroke:Y.axis}),I.forEach((Z,B)=>{let H=i(F.center(B));if(b.push(K(i(E.x-12),H,f(Z.time),{part:"x-label",anchor:"end",baseline:"middle"}),{kind:"circle",part:"event",cx:D,cy:H,r:5,fill:Z.color,stroke:"var(--skdx-color-surface-default)",title:Z.text,item:O(Z)}),y){let V=Z.event.description,U=F.step>=2*Va&&V;b.push(K(i(E.x+12),U?i(H-7):H,Z.event.label,{part:"event-label",baseline:"middle",fill:"var(--skdx-color-text-default)"})),U&&b.push(K(i(E.x+12),i(H+7),V,{part:"event-description",baseline:"middle"}))}}),{...T,shapes:[...b,...T.shapes],issues:n}}let z=c.length?Math.max(...c.map(M=>M.length))*ue+16:8,N=Math.max(f(d).length,f(u).length)*ue/2+4,k=$e(a,o,{top:8+ie(e),right:Math.max(16,N),bottom:32+(e.xAxis?.label?14:0),left:Math.max(16,z,N)}),$=(u-d)*.04||36e5,L=Je([d-$,u+$],[k.x,k.x+k.width]),S=Gn(d-$,u+$).filter(M=>M>=d-$&&M<=u+$).map(M=>({pos:i(L(M)),label:f(M)}));for(let M of ze(S,k.width))b.push({kind:"line",part:"grid",x1:M.pos,x2:M.pos,y1:k.y,y2:k.y+k.height,stroke:Y.grid},K(M.pos,k.y+k.height+20,M.label,{part:"x-label",anchor:"middle"}));e.xAxis?.label&&b.push(K(i(k.x+k.width/2),o-4,e.xAxis.label,{part:"axis-title",anchor:"middle"}));let v=Pe(l.length,[k.y,k.y+k.height],0),R=Math.max(0,Math.floor((v.step/2-14)/Va));l.forEach((M,E)=>{let F=i(v.center(E));b.push({kind:"line",part:"axis",x1:k.x,x2:k.x+k.width,y1:F,y2:F,stroke:Y.axis}),M&&b.push(K(k.x-8,F,M,{part:"y-label",anchor:"end",baseline:"middle"}))});let j=l.map(()=>[]),p=[],w=[];for(let M of I){let E=i(L(M.time)),F=i(v.center(M.lane));if(w.push({kind:"circle",part:"event",cx:E,cy:F,r:5,fill:M.color,stroke:"var(--skdx-color-surface-default)",title:M.text,item:O(M)}),!y)continue;let D=M.event.label.length*ue,Z=E-D/2,B=j[M.lane],H=0;for(;H<=R&&(B[H]??-1/0)>Z-6;)H++;if(H>R)continue;B[H]=Z+D;let V=i(F-12-H*Va),U=i(Math.max(D/2+2,Math.min(a-D/2-2,E)));H>0&&p.push({kind:"line",part:"connector",x1:E,x2:E,y1:i(F-6),y2:i(V+4),stroke:Y.grid}),p.push(K(U,V,M.event.label,{part:"event-label",anchor:"middle",fill:"var(--skdx-color-text-default)"}))}return{...T,shapes:[...b,...p,...w,...T.shapes],issues:n}}function Kn(e,n,t,r,a){let o=e.getBoundingClientRect();return{x:o.width?(n-o.left)*r/o.width:n,y:o.height?(t-o.top)*a/o.height:t}}var _a=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function Is(e,n){let t=0,r=1/0;return e.xs.forEach((a,o)=>{let s=Math.abs(a-n);s<r&&(r=s,t=o)}),t}function gr(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=Is(t,n),a=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(a,r)??a}}function ja(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[Is(t,n)];return{kind:"line",part:"crosshair",x1:r,x2:r,y1:t.plot.y,y2:t.plot.y+t.plot.height,stroke:Y.axis,dash:"3 3"}}function Ga(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!_a(r.plot,n,t))return[];let a=ja(e,n),{rows:o}=gr(e,n),s=e.tooltipAnchored?r.plot.y+8:t;return[a,...Br(a.x1,s,o,e.width,e.height,e.tooltipPlacement)]}function Wa(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 a=t.xs[r];return Ga(e,a,t.plot.y+8)}function Za(e,n,t,r,a){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:l,y:d}=Kn(t,r,a,e.width,e.height);if(_a(e.hit.plot,l,d)){let u=gr(e,l),h=ja(e,l);if(u&&h)return{lines:u.rows,shapes:[h]}}}let o=n?.closest?.("[data-skdx-part]"),s=e.tooltipFormatter?zn(e,n)?.item:void 0,c=s&&e.tooltipFormatter?.(s)||o&&Array.from(o.children).find(l=>l.tagName.toLowerCase()==="title")?.textContent;return c?{lines:Array.isArray(c)?c:[c],shapes:[]}:{lines:[],shapes:[]}}function Ts(e,n,t,r,a,o,s){let c=e?.closest?.("[data-skdx-part]"),l=s&&s.tooltipFormatter?zn(s,e)?.item:void 0,d=l&&s?.tooltipFormatter?.(l)||c&&Array.from(c.children).find(I=>I.tagName.toLowerCase()==="title")?.textContent;if(!d)return[];let u=s?.tooltipAnchored?zn(s,e):void 0,h=u?s?.shapes[u.index]:void 0,{x:f,y}=h?xr(h):Kn(n,t,r,a,o);return Br(f,y,d,a,o,s?.tooltipPlacement)}function qa(e,n,t,r,a){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:s}=Kn(t,r,a,e.width,e.height),c=Ga(e,o,s);if(c.length>0)return c}return Ts(n,t,r,a,e.width,e.height,e)}function Ua(e,n){let t=zn(e,n);return t&&!t.item.legend?Sn(t.item):null}var Zi=(e,n)=>{let{x:t,y:r}=xr(e),a=e.kind==="circle"?e.cy:e.kind==="rect"?e.y+e.height/2:r;return t>=n.x&&t<=n.x+n.width&&a>=n.y&&a<=n.y+n.height};function Ya(e,n){let t=new Set,r=[];for(let a of e.shapes){if(!a.item||a.item.legend||a.part==="anchor"||!Zi(a,n))continue;let o=Sn(a.item),s=JSON.stringify(o);t.has(s)||(t.add(s),r.push(o))}return r}var Ka=e=>({kind:"rect",part:"selection-box",x:i(e.x),y:i(e.y),width:i(e.width),height:i(e.height),fill:Y.focus,opacity:.12,stroke:Y.focus}),jr=(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 Cs(e,n,t){let r=!1;for(let a=0,o=e.length-1;a<e.length;o=a++){let s=e[a],c=e[o];s.y>t!=c.y>t&&n<(c.x-s.x)*(t-s.y)/(c.y-s.y)+s.x&&(r=!r)}return r}function Xa(e,n){if(n.length<3)return[];let t=new Set,r=[];for(let a of e.shapes){if(!a.item||a.item.legend||a.part==="anchor")continue;let{x:o,y:s}=xr(a),c=a.kind==="circle"?a.cy:a.kind==="rect"?a.y+a.height/2:s;if(!Cs(n,o,c))continue;let l=Sn(a.item),d=JSON.stringify(l);t.has(d)||(t.add(d),r.push(l))}return r}var Qa=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${i(n.x)} ${i(n.y)}`).join("L")}`:"",fill:Y.focus,fillOpacity:.12,stroke:Y.focus,dash:"4 3"}),_r=6;function Ja(e,n,t){let r=e.edit;if(r){for(let a of r.bars)if(!(t<a.y||t>a.y+a.height||n<a.x0-_r||n>a.x1+_r))return Math.abs(n-a.x0)<=_r?{bar:a,mode:"start"}:Math.abs(n-a.x1)<=_r?{bar:a,mode:"end"}:{bar:a,mode:"move"}}}function eo(e,n,t){let r=e.edit;return As(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function to(e,n,t){let r=e.edit,a=t.key==="ArrowRight"?1:t.key==="ArrowLeft"?-1:0;if(!r||n===null||!a||!(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",c=r.snap??r.invert(o.x0+10)-r.invert(o.x0);return As(r,{bar:o,mode:s},a*c)}function As(e,{bar:n,mode:t},r){let a=c=>e.snap?Math.round(c/e.snap)*e.snap:c,o=n.start,s=n.end;return t==="move"?(o=a(n.start+r),s=o+(n.end-n.start)):t==="start"?o=Math.min(a(n.start+r),n.end):s=Math.max(a(n.end+r),n.start),{id:n.id,name:n.name,start:o,end:s}}function no(e,n,t){let r=e.edit,a=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:i(Math.min(a,o)),y:i(n.bar.y),width:i(Math.max(1,Math.abs(o-a))),height:i(n.bar.height),fill:Y.focus,opacity:.25,stroke:Y.focus,rx:2}}var qi=64,Ui=e=>Math.max(1,Math.min(qi,e));function ro(e,n,t,r){let a=n>0?.8:1.25,o=Ui(e.view.zoom*a);if(o===e.view.zoom)return e.view;let{plot:s,scale:c}=e,[l,d]=e.view.center,u=(t-(s.x+s.width/2))/c,h=(r-(s.y+s.height/2))/c,f=e.view.zoom/o;return{center:[l+u*(1-f),e.fromY(e.toY(d)-h*(1-f))],zoom:o}}function ao(e,n,t,r){let{scale:a}=e;return{center:[n.center[0]-t/a,e.fromY(e.toY(n.center[1])+r/a)],zoom:n.zoom}}function zn(e,n){let t=n?.closest?.("[data-skdx-i]"),r=Number(t?.getAttribute("data-skdx-i")),a=Number.isInteger(r)?e.shapes[r]?.item:void 0;return a?{index:r,item:a}:void 0}var Gr=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function xr(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 oo(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let r=Y.focus,a;switch(t.kind){case"rect":a={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":a={kind:"circle",part:"focus",cx:t.cx,cy:t.cy,r:t.r+3,fill:"none",stroke:r};break;case"line":a={kind:"line",part:"focus",x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:r,strokeWidth:4};break;case"text":a={kind:"rect",part:"focus",x:t.x-2,y:t.y-8,width:t.text.length*ue+4,height:16,fill:"none",stroke:r,rx:2};break;case"path":a={kind:"path",part:"focus",d:t.d,stroke:r,strokeWidth:2,fill:"none"};break}let{x:o,y:s}=xr(t),c=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[a,...c?Br(i(o),i(s),c,e.width,e.height):[]]}function so(e,n,t){let r=Gr(e);if(r.length===0)return;let a=n===null?-1:r.indexOf(n);switch(t){case"ArrowRight":case"ArrowDown":return r[Math.min(r.length-1,a+1)];case"ArrowLeft":case"ArrowUp":return r[Math.max(0,a<=0?0:a-1)];case"Home":return r[0];case"End":return r[r.length-1];case"Escape":return null;default:return}}var Un=2,Yn=(e,n,t)=>{let r=Math.max(Un,Math.min(t,Math.round(n))),a=Math.max(0,Math.min(t-r,Math.round(e)));return{start:a,end:a+r}},Ls=(e,n)=>!e||e.start<=0&&e.end>=n;function io(e,n,t){if(e.count<=Un||!e.plot.width)return;let{start:r,end:a}=e.zoom,o=a-r,s=n>0?1.25:.8,c=Math.max(Un,Math.min(e.count,Math.round(o*s)));if(c===o)return n>0&&!Ls(e.zoom,e.count)?Yn(r,c,e.count):void 0;let l=Math.max(0,Math.min(1,(t-e.plot.x)/e.plot.width)),d=r+l*o;return Yn(d-l*c,c,e.count)}function lo(e,n,t,r){let a=n.end-n.start,o=Math.max(Un,Math.min(e.count,Math.round(a/Math.max(.05,t)))),s=Math.max(0,Math.min(1,(r-e.plot.x)/Math.max(1,e.plot.width)));return Yn(n.start+s*a-s*o,o,e.count)}function co(e,n,t){let r=n.end-n.start,a=e.plot.width/Math.max(1,r);return Yn(n.start-t/a,r,e.count)}function mo(e,n,t){let r=e.brush;if(!r||!_a(r.box,n,t))return;let a=r.window;if(Math.abs(n-a.x)<=6)return{grab:"left",zoom:e.zoom};if(Math.abs(n-(a.x+a.width))<=6)return{grab:"right",zoom:e.zoom};if(n>a.x&&n<a.x+a.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:Yn(s-o/2,o,e.count)}}function uo(e,n,t,r){let a=e.brush;if(!a)return t;let o=r/Math.max(1,a.box.width)*e.count;if(n==="move")return Yn(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-Un,Math.round(t.start+o))),end:t.end};let s=Math.min(e.count,Math.max(t.start+Un,Math.round(t.end+o)));return{start:t.start,end:s}}function Zr(e,n){switch(n.type){case"svg":return Promise.resolve(Wr(e,n.label,n.resolve));case"csv":return Promise.resolve(qr(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=Wr(e,n.label,n.resolve);return zs(t,e.width,e.height,n.scale,n.background)}}}var bn=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;"),yr=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${bn(String(t))}"`).join("");function Os(e){let n=e.title?`<title>${bn(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${yr([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${yr([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${yr([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${yr([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${yr([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]])}>${bn(e.text)}</text>`}}function Ss(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${bn(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="${bn(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function Wr(e,n,t){let r=Ss(e)+e.shapes.map(Os).join("");return t&&(r=r.replace(/var\((--[\w-]+)\)/g,(a,o)=>t(o).trim()||a)),`<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="${bn(n)}" font-family="${bn(Y.fontFamily)}" font-size="${bn(Y.fontSize)}"><title>${bn(n)}</title>${r}</svg>`}function zs(e,n,t,r=2,a){return new Promise((o,s)=>{let c=URL.createObjectURL(new Blob([e],{type:"image/svg+xml;charset=utf-8"})),l=new Image;l.onload=()=>{URL.revokeObjectURL(c);let d=document.createElement("canvas");d.width=Math.round(n*r),d.height=Math.round(t*r);let u=d.getContext("2d");if(!u)return s(new Error("canvas 2d context unavailable"));a&&(u.fillStyle=a,u.fillRect(0,0,d.width,d.height)),u.drawImage(l,0,0,d.width,d.height),d.toBlob(h=>h?o(h):s(new Error("toBlob failed")),"image/png")},l.onerror=()=>{URL.revokeObjectURL(c),s(new Error("svg could not be decoded"))},l.src=c})}function qr(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 Ns(e,n=[]){let t=Math.max(n.length,...e.map(a=>a.data.length)),r=[["",...e.map(a=>a.name)]];for(let a=0;a<t;a++){let o=n[a];r.push([o instanceof Date?o.toISOString():o??a+1,...e.map(s=>s.data[a])])}return qr(r)}var Ne=e=>P(e.value)?e.value:(e.children??[]).reduce((n,t)=>n+Ne(t),0),vr=e=>e.length===0?0:1+Math.max(...e.map(n=>vr(n.children??[]))),mt=e=>e.id??e.name;function Rs(e,n){for(let t of e){if(mt(t)===n||t.name===n)return[t];let r=Rs(t.children??[],n);if(r)return[t,...r]}}var Xn=(e,n)=>n==="asc"||n==="desc"?[...e].sort((t,r)=>n==="asc"?Ne(t)-Ne(r):Ne(r)-Ne(t)):[...e];function qt(e,n,t=1){return n===void 0?[...e]:e.map(r=>t>=n?{...r,value:Ne(r),children:void 0}:{...r,children:r.children?qt(r.children,n,t+1):void 0})}function an(e,n){if(n===void 0)return{nodes:[...e],path:[]};let t=Rs(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 ho(e,n){if(!n)return;let t=typeof n=="object"?n.maxRows??500:500,r=e.hit;if(r&&r.rows.length>0){let c=r.rows[0];if(r.rows.length>t)return;let l=["",...c.slice(1).map(u=>u.replace(/:\s[^:]*$/,""))],d=r.rows.map(u=>[u[0],...u.slice(1).map(h=>h.slice(h.lastIndexOf(": ")+2))]);return[l,...d]}let a=e.shapes.flatMap(c=>c.item&&!c.item.legend&&!(c.part==="anchor"&&!c.title)?[c.item]:[]);if(a.length===0||a.length>t)return;let o=["series","name","category","value"].filter(c=>a.some(l=>l[c]!==void 0)),s=(c,l)=>c[l]===void 0?"":String(c[l]);return[o.map(c=>c[0]?.toUpperCase()+c.slice(1)),...a.map(c=>o.map(l=>s(c,l)))]}var fo=new Map;function Mr(e){let n=fo.get(e);if(n)return n.group;let t=new Set,r={},a={current:r,subscribe(o){return t.add(o),()=>{t.delete(o),t.size===0&&fo.delete(e)}},publish(o,s){Object.assign(r,o);for(let c of t)c(o,s)}};return fo.set(e,{group:a,listeners:t}),a}var Es='[data-skdx-part]:not([data-skdx-part^="tooltip"]):not([data-skdx-part="focus"]):not([data-skdx-part="crosshair"])',po=`@keyframes skdx-in{from{opacity:0}to{opacity:1}}${Es}{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){${Es}{animation:none;transition:none}}`;function bo(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}function go(e){let n=[],t=e.nodes?new Set(e.nodes.map(p=>p.id)):void 0,r=e.links.filter(p=>!P(p.value)||p.value<=0?(n.push({code:"invalid-value",severity:"warning",message:`Link ${p.source} \u2192 ${p.target} has no positive value and was dropped.`,itemId:p.id}),!1):p.source===p.target?(n.push({code:"self-link",severity:"warning",message:`Link ${p.source} \u2192 ${p.target} points at its own node and was dropped.`,itemId:p.id}),!1):t&&!(t.has(p.source)&&t.has(p.target))?(n.push({code:"unknown-node",severity:"warning",message:`Link ${p.source} \u2192 ${p.target} names a node not in \`nodes\` and was dropped.`,itemId:p.id}),!1):!0),{links:a,back:o}=Yi(r),s=e.cyclePolicy??"drop";for(let p of o)n.push({code:"cycle",severity:s==="error"?"error":"warning",message:`Link ${p.source} \u2192 ${p.target} closes a cycle and was ${s==="error"?"rejected":"dropped"}.`,itemId:p.id});let c=oe(s==="error"&&o.length>0?{...e,error:e.error??`${o.length} link${o.length===1?"":"s"} close a cycle`}:e,a.length===0);if(c)return{...c,issues:n};let l=re(e.format),d=Math.max(0,e.nodePadding??8),u=Math.max(1,e.nodeWidth??16),{width:h,height:f}=se(e),y=$e(h,f,{top:8+ie(e),right:96,bottom:8,left:8}),I=new Map,x=new Map((e.nodes??[]).map(p=>[p.id,p])),T=p=>{let w=I.get(p);if(!w){let M=x.get(p);w={id:p,name:M?.label??p,depth:0,value:0,color:ee(e,I.size,M?.color),x:0,y:0,height:0,outY:0,inY:0},I.set(p,w)}return w};for(let p of e.nodes??[])T(p.id);for(let p of a)T(p.source),T(p.target);for(let p=0,w=!0;w&&p<=I.size;p++){w=!1;for(let M of a){let E=T(M.source).depth+1;E>T(M.target).depth&&(T(M.target).depth=E,w=!0)}}let O=new Map,b=new Map;for(let p of a)O.set(p.source,(O.get(p.source)??0)+p.value),b.set(p.target,(b.get(p.target)??0)+p.value);if(e.align==="justify"){let p=Math.max(0,...[...I.values()].map(w=>w.depth));for(let w of I.values())O.has(w.id)||(w.depth=p)}let z=Vn(e.selected).map(String),N=p=>z.includes(p),k=p=>z.length===0||N(p)||a.some(w=>N(w.source)&&w.target===p||N(w.target)&&w.source===p);for(let p of I.values())p.value=Math.max(O.get(p.id)??0,b.get(p.id)??0);let $=new Map;for(let p of I.values())$.set(p.depth,[...$.get(p.depth)??[],p]);if(e.nodeSort)for(let p of $.values())p.sort((w,M)=>e.nodeSort==="asc"?w.value-M.value:M.value-w.value);let L=Math.max(0,...$.keys()),S=Math.min(...[...$.values()].map(p=>(y.height-d*(p.length-1))/p.reduce((w,M)=>w+M.value,0)));for(let[p,w]of $){let M=y.y;for(let E of w)E.x=y.x+(L===0?0:p*(y.width-u)/L),E.y=M,E.height=E.value*S,E.outY=E.inY=M,M+=E.height+d}let v=[...a];e.linkSort&&v.sort((p,w)=>e.linkSort==="asc"?p.value-w.value:w.value-p.value);let R=[],j=[];for(let p of v){let w=T(p.source),M=T(p.target),E=p.value*S,F=z.length===0||N(p.source)||N(p.target),D=w.x+u,Z=M.x,B=(D+Z)/2,H=w.outY,V=M.inY;w.outY+=E,M.inY+=E;let U=`${w.name} \u2192 ${M.name}: ${l(p.value)}`;R.push({kind:"path",part:"link",d:`M${i(D)} ${i(H)}C${i(B)} ${i(H)} ${i(B)} ${i(V)} ${i(Z)} ${i(V)}L${i(Z)} ${i(V+E)}C${i(B)} ${i(V+E)} ${i(B)} ${i(H+E)} ${i(D)} ${i(H+E)}Z`,fill:w.color,opacity:F?.4:.08,title:U,item:{label:U,id:p.id??`${p.source}\u2192${p.target}`,name:p.source,category:p.target,value:p.value}});let A=Z-D>(w.name.length+l(p.value).length)*ue+24;e.linkLabels&&E>=12&&F&&A&&j.push(K(i(B),i((H+V+E)/2),l(p.value),{part:"link-label",anchor:"middle",baseline:"middle"}))}for(let p of I.values()){let w=`${p.name}: ${l(p.value)}`;R.push({kind:"rect",part:"node",x:i(p.x),y:i(p.y),width:u,height:i(p.height),fill:p.color,opacity:k(p.id)?void 0:.3,title:w,item:{label:w,id:p.id,name:p.name,value:p.value}});let M=p.depth===L;(e.nodeLabels??!0)&&R.push(K(i(M?p.x-6:p.x+u+6),i(p.y+p.height/2),p.name,{anchor:M?"end":"start",baseline:"middle"}))}return{...le(e,h,f),shapes:[...R,...j],issues:n}}function Yi(e){let n=new Map;for(let o of e)n.set(o.source,[...n.get(o.source)??[],o]);let t=new Map,r=new Set,a=o=>{t.set(o,"active");for(let s of n.get(o)??[]){let c=t.get(s.target);c==="active"?r.add(s):c===void 0&&a(s.target)}t.set(o,"done")};for(let o of e)t.has(o.source)||a(o.source);return{links:e.filter(o=>!r.has(o)),back:[...r]}}function xo(e,n,t,r,a,o){if(e.length===0)return;let s=(h,f)=>{let y=h.reduce((T,O)=>T+O.area,0),I=Math.max(...h.map(T=>T.area)),x=Math.min(...h.map(T=>T.area));return Math.max(f*f*I/(y*y),y*y/(f*f*x))},c=Math.min(r,a),l=[],d=0;for(;d<e.length;){let h=[...l,e[d]];if(l.length===0||s(h,c)<=s(l,c))l=h,d++;else break}let u=l.reduce((h,f)=>h+f.area,0);if(r>=a){let h=u/a,f=t;for(let y of l){let I=y.area/h;o(y,[n,f,h,I]),f+=I}xo(e.slice(d),n+h,t,r-h,a,o)}else{let h=u/r,f=n;for(let y of l){let I=y.area/h;o(y,[f,t,I,h]),f+=I}xo(e.slice(d),n,t+h,r,a-h,o)}}function Ki(e,n,t,r,a,o,s){let c=e.reduce((d,u)=>d+u.area,0),l=s?t:n;for(let d of e){let u=c>0?d.area/c:0;if(s){let h=a*u;o(d,[n,l,r,h]),l+=h}else{let h=r*u;o(d,[l,t,h,a]),l+=h}}}function yo(e){let{nodes:n,path:t}=an(e.data,e.rootId),r=qt(n,e.maxDepth),a=oe(e,!r.some(k=>Ne(k)>0));if(a)return a;let o=re(e.format),{width:s,height:c}=se(e),l=e.breadcrumbs&&t.length>0,d=ie(e)+(l?20:0),u=Math.max(0,e.padding??2),h=e.sort??"desc",f=e.tiling??"squarify",y=e.labels??!0,I=[],x=r.map((k,$)=>({name:k.name,color:ee(e,$,k.color)})),T=[],O=k=>{for(let $ of k)$.children?.length?O($.children):T.push(Ne($))};O(r);let b=e.colorScale?gt(e.colorScale,T,ee(e,0),void 0,o):void 0,z=(k,$,L,S,v,R,j)=>{let p=k.reduce((E,F)=>E+Math.max(0,Ne(F)),0),w=Xn(k,h).map(E=>{let F=Ne(E),Z=!((E.children?.length??0)>0)&&b?b.color(F):void 0;return{node:E,value:F,color:Z?.fill??E.color??R??ee(e,k.indexOf(E)),opacity:Z?.opacity,area:p>0?Math.max(0,F)/p*S*v:0}}).filter(E=>E.area>0&&!(R===void 0&&be(e,E.node.name))),M=(E,[F,D,Z,B])=>{let H=`${E.node.name}: ${o(E.value)}`,V=(E.node.children?.length??0)>0;I.push({kind:"rect",part:V?"branch":"tile",x:i(F),y:i(D),width:i(Z),height:i(B),fill:E.color,opacity:V?.15:E.opacity,stroke:"var(--skdx-color-surface-default)",title:H,item:{label:H,id:mt(E.node),name:E.node.name,value:E.value}}),V?z(E.node.children,F+u,D+u,Math.max(0,Z-2*u),Math.max(0,B-2*u),E.color,j+1):y&&Z>40&&B>20&&I.push(K(i(F+6),i(D+6),E.node.name,{baseline:"hanging",fill:"var(--skdx-color-text-on-accent)"}))};f==="squarify"?xo(w,$,L,S,v,M):Ki(w,$,L,S,v,M,f==="slice"||f==="sliceDice"&&j%2===0)};z(r,0,d,s,c-d,void 0,0),l&&I.push(...Qn(t,8,ie(e)+10));let N=le(e,s,c,x);return{...N,shapes:[...I,...N.shapes]}}function Qn(e,n,t){let r=[],a=n;return e.forEach((o,s)=>{s>0&&(r.push(K(i(a),t,"\u203A",{part:"breadcrumb-separator",baseline:"middle"})),a+=ue+6),r.push(K(i(a),t,o.name,{part:"breadcrumb",baseline:"middle",fill:"var(--skdx-color-text-default)",title:o.name,item:{label:o.name,id:mt(o),name:o.name}})),a+=o.name.length*ue+6}),r}var Xi=.22,Qi=20,Ds=32,Bs=28,Ji=e=>P(e.open)&&P(e.high)&&P(e.low)&&P(e.close);function vo(e){let n=[],t=e.data.filter(g=>Ji(g)?!0:(n.push({code:"invalid-value",severity:"warning",message:`Candle "${String(g.label)}" has a non-finite open/high/low/close and was dropped.`,itemId:g.id}),!1)),r=oe(e,t.length===0);if(r)return{...r,issues:n};let a=e.upColor??Y.positive,o=e.downColor??Y.negative,s=re(e.format),c=t.length,l=Math.max(0,Math.min(c-2,Math.floor(e.zoom?.start??0))),d=e.zoom?Math.max(l+2,Math.min(c,Math.ceil(e.zoom.end))):c,u={start:l,end:d},h=t.slice(l,d),f=t.some(g=>P(g.volume)),{width:y,height:I}=se(e),x=e.brush?Ds+Bs:0,T=e.rangeSelector??[],O=$e(y,I,{...de,top:de.top+ie(e)+(T.length?Qi:0),bottom:de.bottom+x}),b=e.compare?h[0].close:void 0,z=g=>b!==void 0&&b!==0?g/b-1:g,N=b!==void 0?{style:"percent",digits:1}:void 0,k=re({style:"percent",digits:1}),$=f?O.height*Xi:0,L={...O,height:Math.max(0,O.height-$-(f?8:0))},S=t.map(g=>g.close),v=(e.overlays??[]).map((g,_)=>{let W=g.name??`${g.type.toUpperCase()} ${g.period}`,Q=g.type==="ema"?ps(S,g.period):ba(S,g.period);return{name:W,color:g.color??ee(e,_+2),values:Q.slice(l,d),hidden:be(e,W)}}),R=Ve(At([...h.flatMap(g=>[z(g.low),z(g.high)]),...v.filter(g=>!g.hidden).flatMap(g=>g.values.map(_=>P(_)?z(_):_))],!1),[L.y+L.height,L.y],{scale:e.scale==="log"?"log":"linear",format:N},e.format),j=h.map(g=>je(g.label)),p=e.xAxis?.type==="time"&&j.every(g=>Number.isFinite(g)),w=Pe(h.length,[L.x,L.x+L.width]),M;if(p){let g=[...j].sort((pe,Te)=>pe-Te),_=1/0;for(let pe=1;pe<g.length;pe++)_=Math.min(_,g[pe]-g[pe-1]);let[W,Q]=ye(j),G=_===1/0?Math.max(1,Math.abs(Q)*.05||1):_/2,J=Je([W-G,Q+G],[L.x,L.x+L.width]),te=Math.abs(J(W+(_===1/0?G:_))-J(W))*.8;w={step:te,bandwidth:te,start:pe=>J(j[pe])-te/2,center:pe=>J(j[pe])};let ne=e.xAxis?.format??{style:"date"};M=Gn(W-G,Q+G).filter(pe=>pe>=W-G&&pe<=Q+G).map(pe=>({pos:i(J(pe)),label:Dt(pe,ne)}))}let E=h.map(g=>Dt(g.label,e.xAxis?.format)),F=[{name:"Up",color:a},{name:"Down",color:o},...v.map(g=>({name:g.name,color:g.color}))],D=le(e,y,I,F),Z={...D,plot:L,xTicks:ze(M??h.map((g,_)=>({pos:i(w.center(_)),label:E[_]})),L.width),yTicks:R.ticks,baseline:L.y+L.height},B=Ge(Z),H={plot:L,x:g=>{let _=typeof g=="string"?g:je(g),W=h.findIndex((Q,G)=>typeof _=="string"?E[G]===_||Q.label===_:je(Q.label)===_);return W<0?void 0:w.center(W)},y:g=>R.scale(z(g))};B.push(...Lt(e.references,H)),T.forEach((g,_)=>{let W=g.candles>0?{start:Math.max(0,c-g.candles),end:c}:{start:0,end:c},Q=W.start===l&&W.end===d;B.push(K(i(L.x+_*40),i(O.y-8),g.label,{part:"range-button",baseline:"middle",fill:Q?"var(--skdx-color-text-default)":Y.label,weight:Q?"bold":void 0,title:`${g.label}: last ${g.candles>0?Math.min(g.candles,c):c} candles`,item:{label:g.label,name:g.label,range:W}}))});let V=e.variant==="ohlc",U=[];if(h.forEach((g,_)=>{let Q=g.close>=g.open?a:o,G=i(w.center(_)),J=b!==void 0?` (${k(z(g.close))})`:"",te=`${E[_]}: O ${s(g.open)} H ${s(g.high)} L ${s(g.low)} C ${s(g.close)}${J}${P(g.volume)?` V ${s(g.volume)}`:""}`,ne={label:te,id:g.id,category:E[_],index:l+_,value:g.close};U.push([E[_],`Open: ${s(g.open)}`,`High: ${s(g.high)}`,`Low: ${s(g.low)}`,`Close: ${s(g.close)}${J}`,...P(g.volume)?[`Volume: ${s(g.volume)}`]:[],...v.filter(Ee=>!Ee.hidden).map(Ee=>`${Ee.name}: ${P(Ee.values[_])?s(Ee.values[_]):"\u2014"}`)]);let pe=R.scale(z(Math.max(g.open,g.close))),Te=R.scale(z(Math.min(g.open,g.close)));if(V){let Ee=w.bandwidth/2;B.push({kind:"line",part:"wick",x1:G,x2:G,y1:i(R.scale(z(g.high))),y2:i(R.scale(z(g.low))),stroke:Q,strokeWidth:1.5,title:te,item:ne},{kind:"line",part:"open",x1:i(G-Ee),x2:G,y1:i(R.scale(z(g.open))),y2:i(R.scale(z(g.open))),stroke:Q,strokeWidth:1.5},{kind:"line",part:"close",x1:G,x2:i(G+Ee),y1:i(R.scale(z(g.close))),y2:i(R.scale(z(g.close))),stroke:Q,strokeWidth:1.5})}else B.push({kind:"line",part:"wick",x1:G,x2:G,y1:i(R.scale(z(g.high))),y2:i(R.scale(z(g.low))),stroke:Q,title:te},{kind:"rect",part:"candle",x:i(w.start(_)),y:i(pe),width:i(w.bandwidth),height:i(Math.max(1,Te-pe)),fill:Q,title:te,item:ne})}),f){let g=L.y+L.height+8,[,_]=ye(h.map(W=>W.volume));h.forEach((W,Q)=>{if(!P(W.volume))return;let G=_>0?W.volume/_*$:0;B.push({kind:"rect",part:"volume",x:i(w.start(Q)),y:i(g+$-G),width:i(w.bandwidth),height:i(Math.max(G,0)),fill:W.close>=W.open?a:o,opacity:.4,title:`${E[Q]}: volume ${s(W.volume)}`})})}for(let g of v){if(g.hidden)continue;let _=g.values.flatMap((W,Q)=>P(W)?[{x:i(w.center(Q)),y:i(R.scale(z(W)))}]:[]);_.length<2||B.push({kind:"path",part:"overlay",d:et(_),stroke:g.color,strokeWidth:1.5,strokeLinejoin:"round",title:g.name,item:{label:g.name,series:g.name}})}for(let g of e.flags??[]){let _=H.x(g.label);if(_===void 0)continue;let W=h.findIndex((te,ne)=>w.center(ne)===_),Q=h[W],G=R.scale(z(Q.high))-6,J=pt(g.variant??"primary");B.push({kind:"path",part:"flag",d:`M${i(_)} ${i(G)}V${i(G-10)}H${i(_+8)}L${i(_+5)} ${i(G-7)}L${i(_+8)} ${i(G-4)}H${i(_)}Z`,fill:J,stroke:J,title:g.text,item:{label:g.text,name:g.text,category:E[W],index:l+W}})}B.push(...An(e.annotations,H));let A={plot:O,xs:h.map((g,_)=>i(w.center(_))),rows:U,count:c,zoom:u,crosshair:Er(e)};if(e.brush){let g={x:O.x,y:O.y+O.height+Bs,width:O.width,height:Ds},_=t.map(ne=>ne.close),[W,Q]=ye(_),G=c>1?g.width/(c-1):0,J=_.map((ne,pe)=>({x:i(g.x+pe*G),y:i(g.y+g.height-(Q===W?.5:(ne-W)/(Q-W))*(g.height-4)-2)})),te={x:i(g.x+l/c*g.width),y:g.y,width:i((d-l)/c*g.width),height:g.height};B.push({kind:"rect",part:"brush",...g,fill:"var(--skdx-color-surface-sunken)",stroke:Y.grid},{kind:"path",part:"brush-series",d:J.length>1?`${et(J)}L${J[J.length-1]?.x} ${g.y+g.height}L${J[0]?.x} ${g.y+g.height}Z`:"",fill:"var(--skdx-color-primary-500)",fillOpacity:.3},{kind:"rect",part:"brush-window",...te,fill:"var(--skdx-color-primary-500)",opacity:.15,stroke:Y.axis},{kind:"rect",part:"brush-handle",x:i(te.x-3),y:g.y+8,width:6,height:g.height-16,fill:Y.axis,rx:2},{kind:"rect",part:"brush-handle",x:i(te.x+te.width-3),y:g.y+8,width:6,height:g.height-16,fill:Y.axis,rx:2}),A.brush={box:g,window:te}}return{...D,shapes:[...B,...D.shapes],hit:A,issues:n}}var el="var(--skdx-color-success-500)",tl="var(--skdx-color-danger-500)";function Mo(e){let n=[],t=e.data.filter($=>$.type==="subtotal"||$.type==="total"||$.subtotal||P($.value)?!0:(n.push({code:"invalid-value",severity:"warning",message:`Row "${$.name}" has no valid value and was dropped.`,itemId:$.id??$.name}),!1)),r=oe(e,t.length===0);if(r)return{...r,issues:n};let a=re(e.format),{width:o,height:s}=se(e),c=e.orientation==="horizontal",l=e.positiveColor??el,d=e.negativeColor??tl,u=e.totalColor??ee(e,0),h=[],f=P(e.start)?e.start:0,y=$=>`${$>=0?"+":""}${a($)}`;P(e.start)&&e.startLabel!==void 0&&h.push({id:void 0,name:e.startLabel,from:0,to:f,color:u,title:`${e.startLabel}: ${a(f)}`,flat:!0});for(let $ of t){if(($.type??($.subtotal?"subtotal":"change"))!=="change"){h.push({id:$.id,name:$.name,from:0,to:f,color:$.color??u,title:`${$.name}: ${a(f)}`,flat:!0});continue}let S=f;f+=$.value,h.push({id:$.id,name:$.name,from:S,to:f,color:$.color??($.value>=0?l:d),title:`${$.name}: ${y($.value)}`,flat:!1})}e.total!==void 0&&h.push({id:void 0,name:e.total,from:0,to:f,color:u,title:`${e.total}: ${a(f)}`,flat:!0});let I=c?Math.max(0,...h.map($=>$.name.length))*ue+16:0,x=$e(o,s,{...de,top:de.top+ie(e),left:Math.max(de.left,I),right:e.labels&&c?56:de.right}),T=h.flatMap($=>[$.from,$.to]),O=Ve([Math.min(0,...T),Math.max(0,...T)],c?[x.x,x.x+x.width]:[x.y+x.height,x.y],{},e.format),b=Pe(h.length,c?[x.y,x.y+x.height]:[x.x,x.x+x.width]),z=le(e,o,s,[{name:"Increase",color:l},{name:"Decrease",color:d}]),N=h.map(($,L)=>({pos:i(b.center(L)),label:$.name})),k=Ge({...z,plot:x,xTicks:c?N:ze(N,x.width),yTicks:c?ze(O.ticks,x.width):O.ticks,baseline:O.zero},{horizontal:c});return h.forEach(($,L)=>{let S=O.scale($.from),v=O.scale($.to),R=Math.min(S,v),j=Math.max(1,Math.abs(v-S));if(k.push({kind:"rect",part:"bar",x:i(c?R:b.start(L)),y:i(c?b.start(L):R),width:i(c?j:b.bandwidth),height:i(c?b.bandwidth:j),fill:$.color,title:$.title,item:{label:$.title,id:$.id??$.name,name:$.name,index:L,value:$.flat?$.to:$.to-$.from}}),e.labels){let w=$.flat?a($.to):y($.to-$.from),M=Math.max(S,v);k.push(c?K(i(M+6),i(b.center(L)),w,{part:"value-label",baseline:"middle"}):K(i(b.center(L)),i(R-4),w,{part:"value-label",anchor:"middle"}))}let p=h[L+1];if(p&&(e.connectors??!0)){let w=i(v),M=i(O.scale(p.flat?p.to:p.from));k.push(c?{kind:"line",part:"connector",x1:w,x2:M,y1:i(b.start(L)+b.bandwidth),y2:i(b.start(L+1)),stroke:Y.axis,dash:"4 3"}:{kind:"line",part:"connector",x1:i(b.start(L)+b.bandwidth),x2:i(b.start(L+1)),y1:w,y2:M,stroke:Y.axis,dash:"4 3"})}}),{...z,shapes:[...k,...z.shapes],issues:n}}function nl(e){let n=new Map;for(let l of e)l.id!==void 0&&!n.has(l.id)&&n.set(l.id,l),n.has(l.name)||n.set(l.name,l);let t=new Map,r=new Set,a=l=>{let d=t.get(l);if(d)return d;if(r.has(l))return{length:0,next:void 0};r.add(l);let u={length:0,next:void 0};for(let f of l.dependsOn??[]){let y=n.get(f);if(!y||y===l)continue;let I=a(y);I.length>u.length&&(u={length:I.length,next:y})}r.delete(l);let h={length:u.length+Math.max(0,l.end-l.start),next:u.next};return t.set(l,h),h},o,s=-1;for(let l of e){let d=a(l);d.length>s&&(s=d.length,o=l)}let c=new Set;for(let l=o;l&&!c.has(l);l=t.get(l)?.next)c.add(l);return c}function wo(e){let n=[],t=e.tasks.filter(A=>{let g=P(A.start)&&(A.milestone?!0:P(A.end));return g?!A.milestone&&A.end<A.start&&n.push({code:"inverted-range",severity:"warning",message:`Task "${A.name}" ends before it starts; the interval was normalized.`,itemId:A.id??A.name}):n.push({code:"invalid-value",severity:"warning",message:`Task "${A.name}" has no valid start/end and was dropped.`,itemId:A.id??A.name}),g}),r=oe(e,t.length===0);if(r)return{...r,issues:n};let{width:a,height:o}=se(e),s=e.criticalPath?nl(t):void 0,c=A=>A.id??A.name,l=new Map;for(let A of t)A.id!==void 0&&!l.has(A.id)&&l.set(A.id,A),l.has(A.name)||l.set(A.name,A);let d=new Map,u=[];for(let A of t){let g=A.parent===void 0?void 0:l.get(A.parent);g&&g!==A?d.set(g,[...d.get(g)??[],A]):u.push(A)}let h=new Set(e.collapsed??[]),f=A=>h.has(c(A))||h.has(A.name),y=[],I=(A,g,_)=>{if(!_.has(A)&&(_.add(A),y.push({task:A,depth:g}),!f(A)))for(let W of d.get(A)??[])I(W,g+1,_)},x=new Set;for(let A of u)I(A,0,x);let T=y.map(A=>A.task),O=new Map(y.map(A=>[A.task,A.depth])),b=A=>{let g=d.get(A)??[];if(g.length===0||P(A.end)&&A.end!==A.start)return{start:A.start,end:A.end};let _=g.map(b);return{start:Math.min(..._.map(W=>W.start)),end:Math.max(..._.map(W=>W.end))}},z=[...new Set(T.map(A=>A.group??A.name))],N=new Map;for(let A of T){let g=A.group??A.name;N.has(g)||N.set(g,O.get(A)??0)}let k=A=>T.some(g=>(g.group??g.name)===A&&f(g)&&(d.get(g)?.length??0)>0)?" +":"",$=Math.max(0,...z.map(A=>A.length+k(A).length))*ue+Math.max(0,...z.map(A=>(N.get(A)??0)*12)),L=$e(a,o,{top:8+ie(e),right:16,bottom:32+(e.xAxis?.label?14:0),left:Math.min(a/2,Math.max(64,$+16))}),S=re(e.xAxis?.format??e.format),v=e.today===void 0?void 0:je(e.today),[R,j]=ye([...T.flatMap(A=>{let g=b(A);return[...A.milestone?[A.start]:[g.start,g.end],...A.baseline?[A.baseline.start,A.baseline.end]:[]]}),...v!==void 0?[v]:[]]),p=Ve([R,j],[L.x,L.x+L.width],{ticks:e.xAxis?.ticks,format:e.xAxis?.format},e.format),w=Pe(z.length,[L.y,L.y+L.height]),M=[],E=[],F=A=>p.domain[0]+(A-L.x)/Math.max(1,L.width)*(p.domain[1]-p.domain[0]);for(let A of ze(p.ticks,L.width))M.push({kind:"line",part:"grid",x1:A.pos,x2:A.pos,y1:L.y,y2:L.y+L.height,stroke:Y.grid}),M.push(K(A.pos,L.y+L.height+20,A.label,{part:"x-label",anchor:"middle"}));z.forEach((A,g)=>{let _=T.find(W=>(W.group??W.name)===A);M.push(K(L.x-8,i(w.center(g)),`${A}${k(A)}`,{part:"y-label",anchor:"end",baseline:"middle",item:_&&(d.get(_)?.length??0)>0?{label:A,id:c(_),name:_.name}:void 0}))});for(let A of M){if(A.kind!=="text"||A.part!=="y-label")continue;let g=N.get(A.text.replace(/ \+$/,""))??0;g&&(A.x=i(A.x+g*12))}let D=864e5;if(e.nonWorkingDays?.length&&j-R<=400*D&&j>R){let A=new Set(e.nonWorkingDays);for(let g=Math.floor(R/D)*D;g<j;g+=D){if(!A.has(new Date(g).getUTCDay()))continue;let _=Math.max(R,g),W=Math.min(j,g+D);W<=_||M.push({kind:"rect",part:"non-working",x:i(p.scale(_)),y:L.y,width:i(Math.max(0,p.scale(W)-p.scale(_))),height:L.height,fill:Y.grid,opacity:.12})}}e.xAxis?.label&&M.push(K(i(L.x+L.width/2),o-4,e.xAxis.label,{part:"axis-title",anchor:"middle"}));let Z={plot:L,x:A=>p.scale(je(A)),y:A=>w.center(A)};M.push(...Lt([...e.references??[],...v!==void 0?[{x:v,label:"Today",variant:"primary"}]:[]],Z));let B=new Map,H=[];T.forEach(A=>{if(be(e,A.name))return;let g=t.indexOf(A),_=z.indexOf(A.group??A.name),W=b(A),Q=p.scale(Math.min(W.start,W.end)),G=A.milestone?Q:p.scale(Math.max(W.start,W.end)),J=(d.get(A)?.length??0)>0;if(A.baseline&&!A.milestone){let ce=p.scale(Math.min(A.baseline.start,A.baseline.end)),Se=p.scale(Math.max(A.baseline.start,A.baseline.end));M.push({kind:"rect",part:"baseline",x:i(ce),y:i(w.start(_)+w.bandwidth*.75),width:i(Math.max(1,Se-ce)),height:i(w.bandwidth/4),fill:Y.axis,opacity:.6,rx:1,title:`${A.name} planned: ${S(A.baseline.start)} \u2013 ${S(A.baseline.end)}`})}let te=w.center(_),ne=ee(e,g,A.color),pe=s&&!s.has(A)?.35:void 0;if(B.has(A.name)||B.set(A.name,{x0:Q,x1:G,mid:te}),A.id!==void 0&&!B.has(A.id)&&B.set(A.id,{x0:Q,x1:G,mid:te}),A.milestone){let ce=w.bandwidth/2,Se=`${A.name}: ${S(A.start)}`;M.push({kind:"path",part:"milestone",d:`M${i(Q)} ${i(te-ce)}L${i(Q+ce)} ${i(te)}L${i(Q)} ${i(te+ce)}L${i(Q-ce)} ${i(te)}Z`,fill:ne,opacity:pe,title:Se,item:{label:Se,id:A.id,name:A.name,category:A.group,index:g,value:A.start}});return}let Te=P(A.progress)?Math.max(0,Math.min(1,A.progress)):void 0,Ee=`${A.name}: ${S(W.start)} \u2013 ${S(W.end)}${Te!==void 0?` \xB7 ${Math.round(Te*100)}% done`:""}`;J||E.push({index:M.length,id:A.id??A.name,name:A.name,start:Math.min(A.start,A.end),end:Math.max(A.start,A.end),x0:i(Q),x1:i(G),y:i(w.start(_)),height:i(w.bandwidth)});let q=A.baseline?w.bandwidth*.7:w.bandwidth;M.push({kind:"rect",part:J?"summary":"bar",x:i(Q),y:i(w.start(_)),width:i(Math.max(1,G-Q)),height:i(J?w.bandwidth/3:q),fill:ne,rx:2,opacity:pe,title:Ee,item:{label:Ee,id:A.id,name:A.name,category:A.group,index:g,value:Math.abs(A.end-A.start)}}),Te!==void 0&&Te>0&&H.push({kind:"rect",part:"progress",x:i(Q),y:i(te-w.bandwidth/4),width:i(Math.max(1,(G-Q)*Te)),height:i(w.bandwidth/2),fill:"var(--skdx-color-text-default)",opacity:.35,rx:1})});let V=new Map;for(let A of t)A.id!==void 0&&!V.has(A.id)&&V.set(A.id,A),V.has(A.name)||V.set(A.name,A);for(let A of t)for(let g of A.dependsOn??[]){let _=B.get(g),W=B.get(A.id??A.name);if(!_){n.push({code:"unknown-node",severity:"warning",message:`Task "${A.name}" depends on "${String(g)}", which does not exist.`,itemId:A.id??A.name});continue}if(!W||_===W)continue;let Q=Math.max(_.x1+6,W.x0-6),G=V.get(g),J=s&&G&&s.has(G)&&s.has(A),te=`${G?.name??String(g)} \u2192 ${A.name}`;H.push({kind:"path",part:"dependency",d:`M${i(_.x1)} ${i(_.mid)}H${i(Q)}V${i(W.mid)}H${i(W.x0)}`,stroke:J?"var(--skdx-color-danger-500)":Y.axis,strokeWidth:J?2.5:1.5,opacity:s&&!J?.35:void 0,title:te,item:{label:te,name:G?.name??String(g),category:A.name}})}M.push(...H,...An(e.annotations,Z));let U=le(e,a,o,e.tasks.map((A,g)=>({name:A.name,color:ee(e,g,A.color)})));return{...U,shapes:[...M,...U.shapes],issues:n,edit:{scale:A=>p.scale(A),invert:F,bars:E}}}var $o=e=>{let n=e.length;return n===0?0:n%2?e[(n-1)/2]:(e[n/2-1]+e[n/2])/2},rl=(e,n)=>{if(e.length===0)return 0;let t=(e.length-1)*n,r=Math.floor(t),a=Math.ceil(t),o=e[r],s=e[a];return o+(s-o)*(t-r)},al=(e,n)=>{let t=e.length;if(t===0)return 0;let r=(t+1)*n-1;if(r<=0)return e[0];if(r>=t-1)return e[t-1];let a=Math.floor(r),o=e[a],s=e[a+1];return o+(s-o)*(r-a)};function ol(e,n="linear"){let t=$o(e),r=e.length;if(r===0)return{q1:0,median:0,q3:0};if(n==="tukey"){let o=Math.floor(r/2),s=e.slice(0,r%2?o+1:o),c=e.slice((r%2,o));return{q1:$o(s),median:t,q3:$o(c)}}let a=n==="exclusive"?al:rl;return{q1:a(e,.25),median:t,q3:a(e,.75)}}function sl(e,n="linear",t=1.5){let r=Be(e).sort((I,x)=>I-x),{q1:a,median:o,q3:s}=ol(r,n),c=s-a,l=a-t*c,d=s+t*c,u=r.filter(I=>I>=l&&I<=d),h=r.length?r.reduce((I,x)=>I+x,0)/r.length:0,f=u[0]??a,y=u[u.length-1]??s;return{name:"",q1:a,median:o,q3:s,min:f,max:y,low:f,high:y,mean:h,outliers:r.filter(I=>I<l||I>d),count:r.length}}var Fs=e=>"median"in e&&!("data"in e),Ps=e=>"data"in e&&Array.isArray(e.data[0]);function ko(e){let n=e.quartileMethod??"linear",t=e.whisker??1.5,r=[],a=e.categories,o=a!==void 0,s=(M,E)=>r.push({code:"invalid-value",severity:"warning",message:E,itemId:M.id??M.name}),c=[];e.series.forEach((M,E)=>{let F=ee(e,E,M.color),D=(Z,B,H)=>{let V=H??(B&&Be(B).length?sl(B,n,t):void 0);return!V||![V.min,V.q1,V.median,V.q3,V.max].every(P)?!1:(V.count!==void 0&&V.count<5&&r.push({code:"small-sample",severity:"warning",message:`Series "${M.name}"${o?` at "${a[Z]??Z}"`:""} has ${V.count} observation${V.count===1?"":"s"}; quartiles are not meaningful below 5.`,itemId:M.id??M.name}),c.push({si:E,ci:Z,name:M.name,id:M.id,color:F,st:{...V,name:M.name},raw:B}),!0)};if(!o){(Fs(M)?D(0,void 0,M):Ps(M)?D(0,M.data.flat()):D(0,M.data))||s(M,`Series "${M.name}" has no valid observations or summary and was skipped.`);return}if(Fs(M)){s(M,`Series "${M.name}" is a summary, which cannot be grouped by categories; it was skipped.`);return}if(!Ps(M)){s(M,`Series "${M.name}" is not grouped (its data is one sample, not one per category); it was drawn in the first category.`),D(0,M.data);return}a.forEach((Z,B)=>D(B,M.data[B]))});let l=oe(e,c.length===0);if(l)return{...l,issues:r};let d=re(e.yAxis?.format??e.format),{width:u,height:h}=se(e),f=e.orientation==="horizontal",y=o?a:e.series.map(M=>M.name),I=Math.max(0,...y.map(M=>M.length))*ue,x=$e(u,h,{...de,top:de.top+ie(e)+(e.yAxis?.label?12:0),left:f?Math.max(de.left,I+16):de.left,bottom:de.bottom+(f&&e.yAxis?.label?14:0)}),T=c.filter(M=>!be(e,M.name)),O=T.flatMap(M=>[M.st.min,M.st.max,...M.st.outliers??[],...P(M.st.mean)?[M.st.mean]:[]]),b=Ve(At(O,!1),f?[x.x,x.x+x.width]:[x.y+x.height,x.y],e.yAxis??{},e.format),z=Pe(y.length,f?[x.y,x.y+x.height]:[x.x,x.x+x.width]),N=o?[...new Set(T.map(M=>M.si))]:[],k=o?z.bandwidth/Math.max(1,N.length):z.bandwidth,$=M=>o?z.start(M.ci)+(N.indexOf(M.si)+.5)*k:z.center(M.si),L=le(e,u,h,e.series.map((M,E)=>({name:M.name,color:ee(e,E,M.color)}))),S=y.map((M,E)=>({pos:i(z.center(E)),label:M})),v=Ge({...L,plot:x,xTicks:f?S:ze(S,x.width),yTicks:f?ze(b.ticks,x.width):b.ticks,baseline:f?x.x:x.y+x.height},{horizontal:f,grid:Cn(e.yAxis),...f?{xLabel:e.yAxis?.label}:{yLabel:e.yAxis?.label}}),R=(M,E,F)=>{let D=i(b.scale(M)),Z=i(b.scale(E));return f?{x1:D,x2:Z,y1:F,y2:F}:{x1:F,x2:F,y1:D,y2:Z}},j=(M,E,F,D)=>{let Z=b.scale(M),B=b.scale(E),H=Math.max(1,Math.abs(B-Z));return f?{x:i(Math.min(Z,B)),y:i(F-D/2),width:i(H),height:i(D)}:{x:i(F-D/2),y:i(Math.min(Z,B)),width:i(D),height:i(H)}},p=(M,E)=>f?`${i(b.scale(M))} ${i(E)}`:`${i(E)} ${i(b.scale(M))}`,w=(M,E,F,D,Z,B,H)=>({kind:"circle",part:Z,cx:f?i(b.scale(M)):i(E),cy:f?i(E):i(b.scale(M)),r:F,fill:D,opacity:H,title:B});for(let M of T){let{st:E,color:F,name:D,raw:Z}=M,B=i($(M)),H=o?a[M.ci]:void 0,V=H!==void 0?`${D}, ${H}`:D,U=`${V}: min ${d(E.min)} Q1 ${d(E.q1)} median ${d(E.median)} Q3 ${d(E.q3)} max ${d(E.max)}${e.mean&&P(E.mean)?` mean ${d(E.mean)}`:""}`,A={label:U,id:M.id,series:D,seriesId:M.id??D,category:H,index:o?M.ci:M.si,value:E.median},g=k*.6,_=g/2,W=f?{x1:i(b.scale(E.median)),x2:i(b.scale(E.median)),y1:i(B-_),y2:i(B+_)}:{x1:i(B-_),x2:i(B+_),y1:i(b.scale(E.median)),y2:i(b.scale(E.median))},Q=E.count,G=e.notched&&Q?Math.min(1.58*(E.q3-E.q1)/Math.sqrt(Q),(E.q3-E.q1)/2):0,J=G?{kind:"path",part:"box",d:`M${[p(E.q1,B-_),p(E.median-G,B-_),p(E.median,B-_+g/4),p(E.median+G,B-_),p(E.q3,B-_),p(E.q3,B+_),p(E.median+G,B+_),p(E.median,B+_-g/4),p(E.median-G,B+_),p(E.q1,B+_)].join("L")}Z`,fill:F,stroke:F,fillOpacity:.5,title:U,item:A}:{kind:"rect",part:"box",...j(E.q1,E.q3,B,g),fill:F,stroke:F,opacity:.5,title:U,item:A};if(v.push({kind:"line",part:"whisker",...R(E.max,E.min,B),stroke:F,title:U},J,{kind:"line",part:"median",...W,stroke:F,title:U},...(E.outliers??[]).map(te=>w(te,B,3,F,"outlier",`${V}: ${d(te)}`))),e.mean&&P(E.mean)){let te=f?i(b.scale(E.mean)):B,ne=f?B:i(b.scale(E.mean));v.push({kind:"path",part:"mean",d:`M${te} ${i(ne-4)}L${i(te+4)} ${ne}L${te} ${i(ne+4)}L${i(te-4)} ${ne}Z`,fill:"var(--skdx-color-text-default)",title:`${V} mean: ${d(E.mean)}`})}e.points&&Z&&Be(Z).forEach((te,ne)=>{let pe=(ne*7919%97/96-.5)*g*.8;v.push(w(te,B+pe,2,F,"observation",`${V}: ${d(te)}`,.6))})}return{...L,shapes:[...v,...L.shapes],issues:r}}var Io=e=>e*Math.PI/180;function To(e){let{nodes:n,path:t}=an(e.data,e.rootId),r=qt(n,e.maxDepth),a=oe(e,!r.some(p=>Ne(p)>0),300,300);if(a)return a;let o=re(e.format),{width:s,height:c}=se(e,300,300),l=Math.min(.9,Math.max(0,e.innerRadius??0)),d=e.breadcrumbs&&t.length>0,u=d&&l===0,h=ie(e)+(u?20:0),f=s/2,y=h+(c-h)/2,I=Math.max(0,Math.min(s,c-h)/2-8),x=I*l,T=(I-x)/Math.max(1,vr(r)),O=Io(e.startAngle??0),b=Io(e.endAngle??(e.startAngle??0)+360),z=Math.max(0,Io(e.padAngle??0)),N=e.sort??"none",k=[],$=p=>{for(let w of p)w.children?.length?$(w.children):k.push(Ne(w))};$(r);let L=e.colorScale?gt(e.colorScale,k,ee(e,0),void 0,o):void 0,S=[],v=[],R=(p,w,M,E,F)=>{let D=A=>w===0&&be(e,A.name)?0:Math.max(0,Ne(A)),Z=Xn(p,N),B=Z.reduce((A,g)=>A+D(g),0),H=Math.max(0,Z.filter(A=>D(A)>0).length-1),V=Math.max(0,E-H*z),U=M;Z.forEach(A=>{let g=D(A),_=B>0?g/B*V:0,Q=!((A.children?.length??0)>0)&&L?L.color(g):void 0,G=Q?.fill??A.color??F??ee(e,p.indexOf(A));if(_>0){let J=x+T*w,te=J+T;if(e.labels&&_*((J+te)/2)>A.name.length*ue+4){let pe=U+_/2,Te=(J+te)/2;v.push(K(i(f+Te*Math.sin(pe)),i(y-Te*Math.cos(pe)),A.name,{part:"arc-label",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-on-accent)"}))}let ne=`${A.name}: ${o(g)}`;S.push({kind:"path",part:"arc",d:qe(f,y,te,J,U,U+_),fill:G,opacity:Q?Q.opacity:1-w*.2,stroke:"var(--skdx-color-surface-default)",title:ne,item:{label:ne,id:mt(A),name:A.name,value:g}}),R(A.children??[],w+1,U,_,G),U+=_+z}})};if(R(r,0,O,Math.max(0,Math.min(2*Math.PI,b-O)),void 0),e.centerLabel&&v.push(K(i(f),i(d&&!u?y-8:y),e.centerLabel,{part:"center-label",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-default)",weight:"bold"})),d){let p=t.reduce((w,M)=>w+M.name.length*ue+6,0)+(t.length-1)*(ue+6);v.push(...u?Qn(t,8,ie(e)+10):Qn(t,f-p/2,e.centerLabel?y+8:y))}let j=le(e,s,c,r.map((p,w)=>({name:p.name,color:ee(e,w,p.color)})));return{...j,shapes:[...S,...v,...j.shapes]}}var il=2*Math.PI,ll=12,wr=5;function cl(e){let n=[];if(e.links){let a=[...e.names??[]],o=new Set(a);for(let l of e.links)for(let d of[l.source,l.target])o.has(d)||(e.names&&n.push({code:"unknown-node",severity:"warning",message:`Link ${l.source} \u2192 ${l.target} names "${d}", which is not in \`names\`; it was added.`,itemId:l.id}),o.add(d),a.push(d));let s=new Map(a.map((l,d)=>[l,d])),c=a.map(()=>a.map(()=>0));for(let l of e.links){if(!P(l.value)||l.value<0){n.push({code:"invalid-value",severity:"warning",message:`Link ${l.source} \u2192 ${l.target} has no valid value and was dropped.`,itemId:l.id});continue}let d=c[s.get(l.source)];d[s.get(l.target)]=d[s.get(l.target)]+l.value}return{names:a,matrix:c,issues:n}}let t=e.names??[],r=e.matrix??[];return(r.length!==t.length||r.some(a=>a.length!==t.length))&&n.push({code:"ragged-matrix",severity:"warning",message:`The matrix is ${r.length} \xD7 ${r[0]?.length??0} but there are ${t.length} names; missing cells count as zero.`}),{names:t,matrix:r,issues:n}}function Co(e){let{names:n,matrix:t,issues:r}=cl(e),a=oe(e,n.length===0||!t.some(F=>F.some(D=>P(D)&&D>0)),300,300);if(a)return{...a,issues:r};let o=re(e.format),{width:s,height:c}=se(e,300,300),l=ie(e),d=s/2,u=l+(c-l)/2,h=Math.max(0,Math.min(s,c-l)/2-36),f=Math.max(0,h-ll),y=(e.padding??2.3)*Math.PI/180,I=(F,D)=>{let Z=t[F]?.[D];return P(Z)?Math.max(0,Z):0},x=F=>n.reduce((D,Z,B)=>D+I(F,B)+I(B,F),0),T=n.map((F,D)=>D);e.sort&&T.sort((F,D)=>e.sort==="asc"?x(F)-x(D):x(D)-x(F));let O=T.map(F=>n[F]),b=F=>ee(e,T[F]),z=O.length,N=Vn(e.selected)[0],k=N===void 0?-1:O.indexOf(String(N)),$=(F,D)=>be(e,O[F])||be(e,O[D])?0:I(T[F],T[D]),L=O.map((F,D)=>O.reduce((Z,B,H)=>Z+$(D,H),0)),S=L.reduce((F,D)=>F+D,0),v=S>0?(il-y*z)/S:0,R=(F,D)=>`${i(d+D*Math.sin(F))} ${i(u-D*Math.cos(F))}`,j=[],p=0;for(let F=0;F<z;F++){let D=p,Z=O.map((B,H)=>{let V=p;return p+=$(F,H)*v,{a0:V,a1:p}});j.push({a0:D,a1:p,sub:Z}),p+=y}let w=[],M=[];for(let F=0;F<z;F++)for(let D=F;D<z;D++){let Z=$(F,D),B=$(D,F);if(Z+B===0)continue;let H=j[F].sub[D],V=j[D].sub[F],U=Q=>Q.a1-Q.a0>Math.PI?1:0,A=F===D?`M${R(H.a0,f)}A${f} ${f} 0 ${U(H)} 1 ${R(H.a1,f)}Q${i(d)} ${i(u)} ${R(H.a0,f)}Z`:`M${R(H.a0,f)}A${f} ${f} 0 ${U(H)} 1 ${R(H.a1,f)}Q${i(d)} ${i(u)} ${R(V.a0,f)}A${f} ${f} 0 ${U(V)} 1 ${R(V.a1,f)}Q${i(d)} ${i(u)} ${R(H.a0,f)}Z`,g=Z>=B?F:D,_=k<0||F===k||D===k,W=F===D?`${O[F]}: ${o(Z)}`:`${O[F]} \u2192 ${O[D]}: ${o(Z)} \xB7 ${O[D]} \u2192 ${O[F]}: ${o(B)}`;w.push({kind:"path",part:"chord",d:A,fill:b(g),opacity:_?.5:.08,title:W,item:{label:W,id:`${O[F]}\u2192${O[D]}`,name:O[F],category:O[D],value:Z+B}})}j.forEach((F,D)=>{if(F.a1<=F.a0)return;let Z=`${O[D]}: ${o(L[D])}`;w.push({kind:"path",part:"group",d:qe(d,u,h,f,F.a0,F.a1),fill:b(D),opacity:k<0||D===k||$(D,k)+$(k,D)>0?void 0:.3,title:Z,item:{label:Z,id:O[D],name:O[D],index:D,value:L[D]}});let B=(F.a0+F.a1)/2,H=Math.sin(B),V=h+(e.ticks?8+wr+14:8);if(w.push(K(i(d+V*H),i(u-V*Math.cos(B)),O[D],{anchor:H>.1?"start":H<-.1?"end":"middle",baseline:"middle"})),!e.ticks)return;let U=L[D];st(0,U,4).filter(A=>A<=U).forEach((A,g)=>{let _=F.a0+A*v,W=Math.sin(_),Q=Math.cos(_);if(w.push({kind:"line",part:"tick",x1:i(d+h*W),y1:i(u-h*Q),x2:i(d+(h+wr)*W),y2:i(u-(h+wr)*Q),stroke:Y.axis}),g%2)return;let G=i(d+(h+wr+3)*W),J=i(u-(h+wr+3)*Q);M.some(te=>Math.abs(te.x-G)<12&&Math.abs(te.y-J)<12)||(M.push({x:G,y:J}),w.push(K(G,J,o(A),{part:"tick-label",anchor:W>.1?"start":W<-.1?"end":"middle",baseline:"middle"})))})});let E=le(e,s,c,O.map((F,D)=>({name:F,color:b(D)})));return{...E,shapes:[...w,...E.shapes],issues:r}}var Nn=8,Ao=e=>e.geometry.type==="Polygon"?e.geometry.coordinates:e.geometry.type==="MultiPolygon"?e.geometry.coordinates.flat():[],Hs=e=>e.geometry.type==="Point"?[e.geometry.coordinates]:e.geometry.type==="MultiPoint"?e.geometry.coordinates:[],_s=e=>e.geometry.type==="LineString"?[e.geometry.coordinates]:e.geometry.type==="MultiLineString"?e.geometry.coordinates:[],Vs=e=>[...Ao(e).flat(),...Hs(e),..._s(e).flat()],dl=e=>Math.log(Math.tan(Math.PI/4+Math.max(-85,Math.min(85,e))*Math.PI/360)),Jn=e=>e!==void 0&&Number.isFinite(e[0])&&Number.isFinite(e[1]);function Lo(e){let n=[],t=e.features.filter(g=>{let _=Vs(g).some(Jn);return _||n.push({code:"invalid-geometry",severity:"warning",message:`Feature "${g.name}" has no valid coordinates and was dropped.`,itemId:g.id??g.name}),_}),r=oe(e,t.length===0);if(r)return{...r,issues:n};let a=re(e.format),{width:o,height:s}=se(e),c=ie(e),l=Ln(e.colorLegend).bottom,d=Ln(e.colorLegend).right,u=e.projection==="mercator"?dl:g=>g,h=t.filter(g=>Ao(g).length>0),f=(h.length?h:t).flatMap(g=>Vs(g).filter(Jn)),[y,I]=f.length?ye(f.map(g=>g[0])):[0,1],[x,T]=f.length?ye(f.map(g=>u(g[1]))):[0,1],O=Math.min((o-d-2*Nn)/Math.max(1e-9,I-y),(s-c-l-2*Nn)/Math.max(1e-9,T-x)),b={x:Nn,y:c+Nn,width:o-d-2*Nn,height:s-c-l-2*Nn},z=Math.max(1,Math.min(64,e.view?.zoom??1)),N=O*z,k=e.view?.center?[e.view.center[0],u(e.view.center[1])]:[(y+I)/2,(x+T)/2],$=b.x+b.width/2-k[0]*N,L=b.y+b.height/2+k[1]*N,S=([g,_])=>({x:i($+g*N),y:i(L-u(_)*N)}),v=g=>{let{x:_,y:W}=S(g);return`${_} ${W}`},R=ee(e,0,e.color),j=gt(e.colorScale,t.map(g=>g.value),R,void 0,a),p=[],w=h.map(g=>{let _=Ao(g);if(e.labels&&_.length){let G=_.reduce((Te,Ee)=>Ee.length>Te.length?Ee:Te),[J,te]=ye(G.map(Te=>Te[0])),[ne,pe]=ye(G.map(Te=>u(Te[1])));p.push(K(i($+((J+te)/2-y)*N),i(L+(T-(ne+pe)/2)*N),g.name,{part:"region-label",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-default)"}))}let W=g.color!==void 0?{fill:g.color,opacity:1}:j.color(g.value),Q=`${g.name}${P(g.value)?`: ${a(g.value)}`:""}`;return{kind:"path",part:"region",d:_.map(G=>`M${G.filter(Jn).map(v).join("L")}Z`).join(""),fill:W?.fill??Y.grid,opacity:W?.opacity??.6,stroke:"var(--skdx-color-surface-default)",title:Q,item:{label:Q,id:g.id??g.name,name:g.name,value:g.value}}}),M=[...e.lines??[],...t.flatMap(g=>_s(g).map(_=>({id:g.id,name:g.name,coordinates:_,value:g.value,color:g.color??(P(g.value)?j.color(g.value)?.fill:void 0),dash:void 0})))].filter(g=>g.coordinates.filter(Jn).length>=2),[,E]=ye(M.map(g=>g.value)),F=M.map((g,_)=>{let W=`${g.name}${P(g.value)?`: ${a(g.value)}`:""}`;return{kind:"path",part:"route",d:`M${g.coordinates.filter(Jn).map(v).join("L")}`,stroke:g.color??ee(e,2),strokeWidth:P(g.value)&&E>0?1+3*Math.sqrt(Math.max(0,g.value)/E):1.5,strokeLinecap:"round",strokeLinejoin:"round",dash:g.dash,opacity:.85,title:W,item:{label:W,id:g.id??g.name,name:g.name,index:_,value:g.value}}}),D=[...e.points??[],...t.flatMap(g=>Hs(g).map(_=>({id:g.id,name:g.name,coordinates:_,value:g.value,color:g.color??(P(g.value)?j.color(g.value)?.fill:void 0)})))].filter(g=>Jn(g.coordinates)),[Z,B]=e.sizeRange??[3,14],[,H]=ye(D.map(g=>g.value)),V=D.map((g,_)=>{let{x:W,y:Q}=S(g.coordinates),G=Number.isFinite(g.value)&&H>0,J=`${g.name}${G?`: ${a(g.value)}`:""}`;return{kind:"circle",part:G?"bubble":"point",cx:W,cy:Q,r:i(G?Math.max(Z,Math.sqrt(Math.max(0,g.value)/H)*B):Z),fill:g.color??ee(e,1),stroke:"var(--skdx-color-surface-default)",opacity:.85,title:J,item:{label:J,id:g.id??g.name,name:g.name,index:_,value:g.value}}}),U=e.colorLegend?qn(j,d?{x:b.x+b.width+12,y:b.y,width:d,height:b.height}:{x:Nn,y:s-l+8,width:o-2*Nn,height:l},Ln(e.colorLegend).options):[],A=e.projection==="mercator"?g=>Math.atan(Math.exp(g))*360/Math.PI-90:g=>g;return{...le(e,o,s),shapes:[...w,...F,...p,...V,...U],issues:n,map:{view:{center:[k[0],A(k[1])],zoom:z},bounds:{minLon:y,maxLon:I,minLat:x,maxLat:T},plot:b,scale:N,toY:u,fromY:A}}}function Oo(e){let n=[],t=e.segments.map((S,v)=>typeof S=="string"?{name:S,id:S,color:ee(e,v)}:{name:S.name,id:S.id??S.name,color:ee(e,v,S.color)}),r=t.map(S=>!be(e,S.name)),a=(S,v)=>{let R=S.values[v];return R==null?0:!P(R)||R<0?(n.push({code:P(R)?"negative-value":"invalid-value",severity:"warning",message:`"${t[v]?.name}" in "${S.name}" is ${P(R)?"negative":"not a number"}; drawn as zero.`,itemId:S.id??S.name}),0):R},o=e.data.map((S,v)=>{let R=t.map((w,M)=>r[M]?a(S,M):0),j=R.reduce((w,M)=>w+M,0),p=P(S.total)&&S.total>=0?S.total:j;return{c:S,ci:v,values:R,sum:j,total:p}}),s=o.reduce((S,v)=>S+v.total,0),c=oe(e,s<=0);if(c)return{...c,issues:n};let l=re(e.format),d=re(e.xAxis?.format??e.format),{width:u,height:h}=se(e),f=$e(u,h,{...de,top:de.top+ie(e),bottom:de.bottom+(e.xAxis?.label?14:0)+(e.xAxis?.format?14:0)}),y=Math.max(0,Math.min(.2,e.gap??.01))*f.width,I=Math.max(0,o.length-1),x=Math.max(0,f.width-y*I),T=Ve([0,1],[f.y+f.height,f.y],{format:{style:"percent"}}),O=le(e,u,h,t.map(S=>({name:S.name,color:S.color}))),b=f.x,z=o.map(S=>{let v=S.total/s*x,R={x:b,w:v};return b+=v+y,{...S,...R}}),N=z.map(S=>({pos:i(S.x+S.w/2),label:S.c.name})),k=Ge({...O,plot:f,xTicks:ze(N,f.width),yTicks:T.ticks,baseline:T.zero},{xLabel:e.xAxis?.label,yLabel:void 0});if(e.xAxis?.format)for(let S of z)S.w>24&&k.push(K(i(S.x+S.w/2),f.y+f.height+34,d(S.total),{part:"x-total",anchor:"middle"}));let $=[],L=[];for(let S of z){let v=0;S.values.forEach((R,j)=>{let p=t[j];if(R<=0||S.sum<=0)return;let w=R/S.sum,M=T.scale(v+w),E=T.scale(v);v+=w;let F=`${Math.round(w*100)}%`,D=`${p.name}, ${S.c.name}: ${l(R)} (${F}) \xB7 column ${d(S.total)}`,Z=Math.max(0,E-M);$.push({kind:"rect",part:"cell",x:i(S.x),y:i(M),width:i(S.w),height:i(Z),fill:p.color,stroke:"var(--skdx-color-surface-default)",title:D,item:{label:D,id:`${S.c.id??S.c.name}:${p.name}`,series:p.name,seriesId:p.id,category:S.c.name,index:S.ci,value:R}}),e.labels&&Z>14&&S.w>24&&L.push(K(i(S.x+S.w/2),i(M+Z/2),F,{part:"cell-label",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-on-accent)"}))})}return{...O,shapes:[...k,...$,...L,...O.shapes],issues:n}}var js=500;function So(e){let n=[],t=e.dimensions,r=e.data.filter(N=>!(N.group!==void 0&&be(e,N.group))),a=oe(e,t.length===0||r.length===0);if(a)return{...a,issues:n};let{width:o,height:s}=se(e),c=[...new Set(e.data.map(N=>N.group).filter(N=>N!==void 0))],l=t[0],d=t[t.length-1],u=N=>(N.label??N.key).length*ue/2+8,h=$e(o,s,{top:28+ie(e),right:Math.max(16,u(d)),bottom:16,left:Math.max(48,u(l))}),f=(N,k)=>{let $=N.values[k];return $==null?null:P($)?$:(n.push({code:"invalid-value",severity:"warning",message:`"${N.name}" has a value on "${k}" that is not a number; drawn as a gap.`,itemId:N.id??N.name}),null)},y=t.map((N,k)=>{let[$,L]=ye(r.map(E=>f(E,N.key))),S=st(N.min??$,N.max??L),v=N.min??S[0],R=N.max??S[S.length-1],j=N.reversed?[h.y,h.y+h.height]:[h.y+h.height,h.y],p=Je([v,R],j),w=i(t.length===1?h.x+h.width/2:h.x+k*h.width/(t.length-1)),M=re(N.format??e.format);return{d:N,x:w,scale:E=>i(p(Math.max(v,Math.min(R,E)))),format:M,ticks:S.filter(E=>E>=v-1e-9&&E<=R+1e-9)}}),I=[];y.forEach((N,k)=>{I.push({kind:"line",part:"axis",x1:N.x,x2:N.x,y1:h.y,y2:h.y+h.height,stroke:Y.axis});let $=k===y.length-1&&y.length>1?"start":"end";for(let L of N.ticks)I.push(K(i($==="end"?N.x-6:N.x+6),N.scale(L),N.format(L),{part:"y-label",anchor:$,baseline:"middle"}));I.push(K(N.x,h.y-12,N.d.label??N.d.key,{part:"axis-title",anchor:"middle"}))});let x=r.length<=js,T=e.opacity??(r.length>200?.25:.6),O=N=>(e.filters??[]).every(k=>{let $=f(N,k.key);return $!==null&&$>=(k.min??-1/0)&&$<=(k.max??1/0)}),b=r.map((N,k)=>{let $=[],L=[];for(let v of y){let R=f(N,v.d.key);if(R===null){!e.connectNulls&&L.length&&($.push(L),L=[]);continue}L.push({x:v.x,y:v.scale(R)})}L.length&&$.push(L);let S=`${N.name}: ${y.map(v=>{let R=f(N,v.d.key);return`${v.d.label??v.d.key} ${R===null?"\u2014":v.format(R)}`}).join(" \xB7 ")}`;return{kind:"path",part:"row",d:$.map(v=>et(v,e.curve)).join(""),stroke:N.color??(N.group!==void 0?ee(e,c.indexOf(N.group)):ee(e,0)),strokeWidth:1.5,strokeLinejoin:"round",opacity:O(N)?T:.08,title:x?S:void 0,item:x?{label:S,id:N.id??N.name,name:N.name,category:N.group,index:k}:void 0}}),z=le(e,o,s,c.map((N,k)=>({name:N,color:ee(e,k)})));return{...z,shapes:[...I,...b,...z.shapes],issues:n}}function zo(e){let n=e.orientation==="vertical",t=oe(e,!P(e.value),600,n?300:64);if(t)return t;let r=re(e.format),a=e.min??0,o=(e.bands??[]).filter(d=>P(d.from)&&P(d.to)),s=e.max??Math.max(100,e.value,e.target??-1/0,...o.map(d=>d.to)),c=P(e.target)?`, target ${r(e.target)}`:"";return{...br({...e,height:e.height??(n?300:64),data:[{id:"value",name:e.caption??"",value:e.value,target:e.target,ranges:o}],min:a,max:s,labels:e.labels??!0,ticks:e.ticks}),description:e.description??`${e.caption??"Value"} ${r(e.value)} on a scale from ${r(a)} to ${r(s)}${c}.`}}function No(e){let n=[],t=e.data.filter(v=>{let R=P(v.start)||P(v.end);return R||n.push({code:"invalid-value",severity:"warning",message:`"${v.name}" has neither a valid start nor end and was dropped.`,itemId:v.id??v.name}),R}),r=oe(e,t.length===0);if(r)return{...r,issues:n};let a=re(e.xAxis?.format??e.format),{width:o,height:s}=se(e),c=e.orientation==="vertical",l=e.startLabel??"Start",d=e.endLabel??"End",u=[...t];if(e.sort){let v=R=>e.sort==="change"?(P(R.end)?R.end:0)-(P(R.start)?R.start:0):P(R.end)?R.end:-1/0;u.sort((R,j)=>e.sort==="asc"?v(R)-v(j):v(j)-v(R))}let h=Math.max(0,...u.map(v=>v.name.length))*ue,f=$e(o,s,{...de,top:de.top+ie(e)+(c&&e.xAxis?.label?12:0),right:e.labels&&!c?56:de.right,bottom:de.bottom+(!c&&e.xAxis?.label?14:0),left:c?de.left:Math.max(de.left,h+16)}),y=Ve(At(u.flatMap(v=>[v.start,v.end]),!1),c?[f.y+f.height,f.y]:[f.x,f.x+f.width],e.xAxis??{},e.format),I=Pe(u.length,c?[f.x,f.x+f.width]:[f.y,f.y+f.height]),x=ee(e,0),T=ee(e,1),O=le(e,o,s,[{name:l,color:x},{name:d,color:T}]),b=u.map((v,R)=>({pos:i(I.center(R)),label:v.name})),z=Ge({...O,plot:f,xTicks:c?ze(b,f.width):b,yTicks:c?y.ticks:ze(y.ticks,f.width),baseline:c?f.y+f.height:f.x},{horizontal:!c,grid:Cn(e.xAxis),...c?{yLabel:e.xAxis?.label}:{xLabel:e.xAxis?.label}});z.push(...Lt(e.references,{plot:f,horizontal:!c,x:v=>{let R=u.findIndex(j=>j.name===v);return R<0?void 0:I.center(R)},y:v=>y.scale(v)}));let N=e.markerSize??5,k=(v,R)=>c?{x:i(R),y:i(y.scale(v))}:{x:i(y.scale(v)),y:i(R)},$=[],L=[],S=[];return u.forEach((v,R)=>{let j=I.center(R),p=P(v.start)?a(v.start):"\u2014",w=P(v.end)?a(v.end):"\u2014",M=`${v.name}: ${p} \u2192 ${w}`,E={label:M,id:v.id??v.name,name:v.name,index:R,value:P(v.end)?v.end:void 0};if(P(v.start)&&P(v.end)){let F=k(v.start,j),D=k(v.end,j);$.push({kind:"line",part:"connector",x1:F.x,y1:F.y,x2:D.x,y2:D.y,stroke:v.color??Y.axis,strokeWidth:3,title:M,item:E})}for(let[F,D,Z,B]of[[v.start,"start",l,x],[v.end,"end",d,T]]){if(!P(F))continue;let H=k(F,j),V=`${v.name} \xB7 ${Z}: ${a(F)}`;L.push({kind:"circle",part:D,cx:H.x,cy:H.y,r:N,fill:B,stroke:"var(--skdx-color-surface-default)",title:V,item:{...E,label:V,series:Z}}),e.labels&&S.push(c?K(H.x,i(H.y+(D==="end"?-N-4:N+12)),a(F),{part:"value-label",anchor:"middle"}):K(i(H.x+(D==="end"?N+4:-N-4)),H.y,a(F),{part:"value-label",anchor:D==="end"?"start":"end",baseline:"middle"}))}}),{...O,shapes:[...z,...$,...L,...S,...O.shapes],issues:n}}function Ro(e){let n=[],r=e.data.filter(u=>{let h=P(u.value)&&u.value>=0;return h||n.push({code:"invalid-value",severity:"warning",message:`"${u.name}" has no valid non-negative value and was dropped.`,itemId:u.id??u.name}),h}).map((u,h)=>({d:u,i:h})).sort((u,h)=>h.d.value-u.d.value||u.i-h.i),a=r.reduce((u,{d:h})=>u+h.value,0),o=0,s=r.map(({d:u})=>a>0?(o+=u.value)/a:0),c=e.threshold,l=Ot({...e,categories:r.map(({d:u})=>u.name),series:[{name:e.name??"Value",type:"bar",data:r.map(({d:u})=>u.value),color:r[0]?.d.color},{name:e.cumulativeLabel??"Cumulative",type:"line",axis:"right",data:s,curve:"linear"}],rightAxis:{min:0,max:1,format:{style:"percent"}},references:c!==void 0&&P(c)?[{y:c,axis:"right",label:`${Math.round(c*100)}%`,variant:"primary"}]:void 0},"bar"),d=l.shapes.map(u=>{if(u.part!=="bar"||u.kind!=="rect"||!u.item||u.item.index===void 0)return u;let h=r[u.item.index]?.d;return h?{...u,fill:h.color??u.fill,item:{...u.item,id:h.id??h.name,name:h.name}}:u});return{...l,shapes:d,issues:[...n,...l.issues??[]]}}function Ur(e){let{nodes:n,path:t}=an(e.data,e.rootId),r=qt(n,e.maxDepth),a=oe(e,r.length===0);if(a)return a;let o=re(e.format),{width:s,height:c}=se(e),l=e.orientation!=="horizontal",d=e.nodeShape==="box",u=e.linkStyle??"curve",h=new Set(e.collapsed??[]),f=e.labels??!0,y=[],I=0,x=0,T=(H,V,U,A)=>{let g=h.has(mt(H))||h.has(H.name),_=g?[]:H.children??[],W=H.color??U?.color??ee(e,A),Q={node:H,depth:V,slot:0,parent:U,collapsed:g,color:W};if(x=Math.max(x,V),_.length===0)Q.slot=I++;else{let G=_.map((J,te)=>T(J,V+1,Q,te));Q.slot=(G[0].slot+G[G.length-1].slot)/2}return y.push(Q),Q};r.forEach((H,V)=>T(H,0,void 0,V));let O=H=>Math.max(H.name.length,H.subtitle?.length??0),b=Math.max(0,...y.map(H=>O(H.node)))*ue+16,z=e.nodeSize??36,N=e.nodeSize??5,k=d?b:2*N,$=d?z:2*N,L=!d&&f?b:0,S=$e(s,c,{top:ie(e)+$/2+4,bottom:$/2+4+(l&&!d?16:0),left:k/2+4,right:k/2+4+(l?0:L)}),v=Math.max(1,I),R=l?S.width:S.height,j=l?S.height:S.width,p=v===1?0:R/(v-1),w=x===0?0:j/x,M=H=>{let V=v===1?R/2:H.slot*p,U=H.depth*w;return l?{x:i(S.x+V),y:i(S.y+U)}:{x:i(S.x+U),y:i(S.y+V)}},E=[],F=[],D=[];for(let H of y){let{x:V,y:U}=M(H);if(H.parent){let W=M(H.parent),Q=d?l?$/2:k/2:N,G=l?W.x:i(W.x+Q),J=l?i(W.y+Q):W.y,te=l?V:i(V-Q),ne=l?i(U-Q):U,pe=i((G+te)/2),Te=i((J+ne)/2),Ee=u==="straight"?`M${G} ${J}L${te} ${ne}`:u==="elbow"?l?`M${G} ${J}V${Te}H${te}V${ne}`:`M${G} ${J}H${pe}V${ne}H${te}`:l?`M${G} ${J}C${G} ${Te} ${te} ${Te} ${te} ${ne}`:`M${G} ${J}C${pe} ${J} ${pe} ${ne} ${te} ${ne}`;E.push({kind:"path",part:"link",d:Ee,stroke:Y.axis,strokeWidth:1.5,title:`${H.parent.node.name} \u2192 ${H.node.name}`})}let A=Ne(H.node),g=`${H.node.name}${H.node.subtitle?` \xB7 ${H.node.subtitle}`:""}${P(H.node.value)||(H.node.children?.length??0)>0?`: ${o(A)}`:""}${H.collapsed?" (collapsed)":""}`,_={label:g,id:mt(H.node),name:H.node.name,value:A};if(d){if(F.push({kind:"rect",part:"node",x:i(V-k/2),y:i(U-$/2),width:i(k),height:i($),fill:H.color,rx:4,title:g,item:_}),f){let W=!!H.node.subtitle;D.push(K(V,i(W?U-7:U),H.node.name,{part:"node-label",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-on-accent)",weight:"bold"})),W&&D.push(K(V,i(U+8),H.node.subtitle,{part:"node-subtitle",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-on-accent)"}))}}else F.push({kind:"circle",part:"node",cx:V,cy:U,r:i(N),fill:H.color,stroke:"var(--skdx-color-surface-default)",title:g,item:_}),f&&D.push(l?K(V,i(U+N+12),H.node.name,{part:"node-label",anchor:"middle",fill:"var(--skdx-color-text-default)"}):K(i(V+N+4),U,H.node.name,{part:"node-label",baseline:"middle",fill:"var(--skdx-color-text-default)"}));H.collapsed&&D.push(K(i(d?V+k/2-8:V+N+(l?6:-2)),i(d?U-$/2+8:U-N-2),"+",{part:"collapsed",anchor:"middle",baseline:"middle",fill:Y.label,weight:"bold"}))}let Z=t.length?[K(8,ie(e)+10,t.map(H=>H.name).join(" \u203A "),{part:"breadcrumb",baseline:"middle"})]:[],B=le(e,s,c);return{...B,shapes:[...E,...F,...D,...Z,...B.shapes]}}var Eo=e=>Ur({...e,nodeShape:"box",linkStyle:"elbow"});function Gs(e,n){let t=[],r=e.map((f,y)=>({r:f,i:y})).sort((f,y)=>y.r-f.r),a=new Array(e.length);for(let{r:f,i:y}of r){let I;if(t.length===0)I={x:0,y:0,r:f};else{let T=Math.max(1,f/4);e:for(let O=0;O<1e6;O+=T)for(let b=0;b<24;b++){let z=b/24*2*Math.PI+O*.05,N={x:O*Math.cos(z),y:O*Math.sin(z),r:f};if(t.every(k=>Math.hypot(k.x-N.x,k.y-N.y)>=k.r+N.r+n)){I=N;break e}}}let x=I??{x:0,y:0,r:f};t.push(x),a[y]=x}let o=1/0,s=-1/0,c=1/0,l=-1/0;for(let f of t)o=Math.min(o,f.x-f.r),s=Math.max(s,f.x+f.r),c=Math.min(c,f.y-f.r),l=Math.max(l,f.y+f.r);let d=(o+s)/2,u=(c+l)/2,h=0;for(let f of a)f.x-=d,f.y-=u,h=Math.max(h,Math.hypot(f.x,f.y)+f.r);return{circles:a,enclosing:h}}function Do(e){let n=[],{nodes:t}=an(e.data,e.rootId),r=qt(t,e.maxDepth).filter(z=>!be(e,z.name)),a=oe(e,!r.some(z=>Ne(z)>0),300,300);if(a)return{...a,issues:n};let o=re(e.format),{width:s,height:c}=se(e,300,300),l=ie(e),d=e.padding??2,u=e.labels??!0,h=[],f=z=>{z.children?.length?z.children.forEach(f):h.push(Ne(z))};r.forEach(f);let y=gt(e.colorScale,h,ee(e,0),void 0,o),I=[],x=[],T=(z,N,k,$,L)=>{let S=z.filter(p=>{let w=Ne(p)>0;return w||n.push({code:"invalid-value",severity:"warning",message:`"${p.name}" has no positive value and was dropped.`,itemId:mt(p)}),w});if(S.length===0)return;let{circles:v,enclosing:R}=Gs(S.map(p=>Math.sqrt(Ne(p))),0),j=R>0?($-d)/R:0;S.forEach((p,w)=>{let M=v[w],E=i(N+M.x*j),F=i(k+M.y*j),D=Math.max(0,M.r*j-d/2),Z=Ne(p),B=(p.children?.length??0)>0,H=p.color??L??ee(e,w),V=B?H:e.colorScale?y.color(Z)?.fill??H:H,U=`${p.name}: ${o(Z)}`;I.push({kind:"circle",part:B?"branch":"leaf",cx:E,cy:F,r:i(D),fill:V,opacity:B?.15:e.colorScale&&!B?y.color(Z)?.opacity:void 0,stroke:"var(--skdx-color-surface-default)",title:U,item:{label:U,id:mt(p),name:p.name,value:Z}}),u&&!B&&D*2>p.name.length*ue+4&&x.push(K(E,F,p.name,{part:"leaf-label",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-on-accent)"})),u&&B&&D*2>p.name.length*ue+4&&x.push(K(E,i(F-D+10),p.name,{part:"branch-label",anchor:"middle",baseline:"middle"})),B&&T(p.children,E,F,D,H)})},O=Math.max(0,Math.min(s,c-l)/2-8);T(r,s/2,l+(c-l)/2,O,void 0);let b=le(e,s,c,r.map((z,N)=>({name:z.name,color:ee(e,N,z.color)})));return{...b,shapes:[...I,...x,...b.shapes],issues:n}}function Bo(e){let n=[],{nodes:t,path:r}=an(e.data,e.rootId),a=qt(t,e.maxDepth).filter(S=>!be(e,S.name)),o=oe(e,!a.some(S=>Ne(S)>0));if(o)return{...o,issues:n};let s=re(e.format),{width:c,height:l}=se(e),d=e.orientation==="horizontal",u=e.breadcrumbs&&r.length>0,h=ie(e)+(u?20:0),f=$e(c,l,{top:h,right:0,bottom:0,left:0}),y=e.padding??1,I=e.labels??!0,x=Math.max(1,vr(a)),T=(d?f.width:f.height)/x,O=[],b=S=>{S.children?.length?S.children.forEach(b):O.push(Ne(S))};a.forEach(b);let z=gt(e.colorScale,O,ee(e,0),void 0,s),N=[],k=[],$=(S,v,R,j,p)=>{let w=Xn(S,e.sort).filter(F=>{let D=Ne(F)>0;return D||n.push({code:"invalid-value",severity:"warning",message:`"${F.name}" has no positive value and was dropped.`,itemId:mt(F)}),D}),M=w.reduce((F,D)=>F+Ne(D),0),E=R;w.forEach((F,D)=>{let Z=Ne(F),B=M>0?Z/M*j:0,H=(F.children?.length??0)>0,V=F.color??p??ee(e,D),U=!H&&e.colorScale?z.color(Z):void 0,A=v*T,g=d?{x:f.x+A+y/2,y:E+y/2,width:T-y,height:B-y}:{x:E+y/2,y:f.y+A+y/2,width:B-y,height:T-y},_=`${F.name}: ${s(Z)}`;N.push({kind:"rect",part:"cell",x:i(g.x),y:i(g.y),width:i(Math.max(0,g.width)),height:i(Math.max(0,g.height)),fill:U?.fill??V,opacity:U?.opacity??(H?.7:void 0),title:_,item:{label:_,id:mt(F),name:F.name,value:Z}}),I&&g.width>F.name.length*ue+6&&g.height>12&&k.push(K(i(g.x+4),i(g.y+g.height/2),F.name,{part:"cell-label",baseline:"middle",fill:"var(--skdx-color-text-on-accent)"})),H&&$(F.children,v+1,E,B,V),E+=B})};$(a,0,d?f.y:f.x,d?f.height:f.width,void 0),u&&N.push(...Qn(r,8,ie(e)+10));let L=le(e,c,l,a.map((S,v)=>({name:S.name,color:ee(e,v,S.color)})));return{...L,shapes:[...N,...k,...L.shapes],issues:n}}function Fo(e){let n=[],t=e.series.map((v,R)=>({...v,index:R,hidden:be(e,v.name)})),r=Math.max(e.categories?.length??0,...t.map(v=>v.data.length)),a=oe(e,r===0||t.every(v=>v.hidden||Be(v.data).length===0));if(a)return{...a,issues:n};for(let v of t){let R=v.data.filter(j=>j!==null&&!P(j)).length;R&&n.push({code:"invalid-value",severity:"warning",message:`Series "${v.name}" has ${R} value${R===1?"":"s"} that ${R===1?"is":"are"} neither a number nor null; drawn as gaps.`,itemId:v.id??v.name})}let o=re(e.format),{width:s,height:c}=se(e),l=t.filter(v=>!v.hidden),d=l.map(()=>new Array(r).fill(null));for(let v=0;v<r;v++){if(e.ranked){l.forEach((j,p)=>{let w=j.data[v];d[p][v]=P(w)?w:null});continue}l.map((j,p)=>({si:p,v:j.data[v]})).filter(j=>P(j.v)).sort((j,p)=>p.v-j.v||j.si-p.si).forEach((j,p)=>{d[j.si][v]=p+1})}let u=e.topRank??Math.max(1,l.length),h=Array.from({length:r},(v,R)=>{let j=e.categories?.[R];return j===void 0?String(R+1):Dt(j,e.xAxis?.format)}),f=e.labels??!0,y=f?Math.max(0,...l.map(v=>v.name.length))*ue+12:0,I=$e(s,c,{...de,top:de.top+ie(e),right:Math.max(de.right,y),bottom:de.bottom+(e.xAxis?.label?14:0)}),x=Je([.5,u+.5],[I.y,I.y+I.height]),T=Pe(r,[I.x,I.x+I.width],0),O=le(e,s,c,e.series.map((v,R)=>({name:v.name,color:ee(e,R,v.color)}))),b=Array.from({length:u},(v,R)=>({pos:i(x(R+1)),label:`#${R+1}`})),z=Ge({...O,plot:I,xTicks:ze(h.map((v,R)=>({pos:i(T.center(R)),label:v})),I.width),yTicks:u>20?b.filter((v,R)=>R%Math.ceil(u/20)===0):b,baseline:I.y+I.height},{xLabel:e.xAxis?.label,grid:e.xAxis?.grid!==!1}),N=e.markerSize??5,k=[],$=[],L=[],S=[];return l.forEach((v,R)=>{let j=ee(e,v.index,v.color),p=[],w=[],M;for(let E=0;E<r;E++){let F=d[R][E];if(F==null||F>u||F<1){w.length&&p.push(w),w=[];continue}let D={x:i(T.center(E)),y:i(x(F))};w.push(D),M=D;let Z=v.data[E],B=`${v.name}, ${h[E]}: #${F}${e.ranked||!P(Z)?"":` (${o(Z)})`}`;$.push(bt(D.x,D.y,N,j,B,{label:B,id:v.id??v.name,series:v.name,seriesId:v.id??v.name,category:h[E],index:E,value:F}))}w.length&&p.push(w);for(let E of p)k.push({kind:"path",part:"line",d:et(E,e.curve??"monotone"),stroke:j,strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round",title:v.name,item:{label:v.name,id:v.id??v.name,series:v.name,seriesId:v.id??v.name}});f&&M&&!S.some(E=>Math.abs(E-M.y)<12)&&(S.push(M.y),L.push(K(i(M.x+N+4),M.y,v.name,{part:"series-label",baseline:"middle",fill:Y.label})))}),{...O,shapes:[...z,...k,...$,...L,...O.shapes],issues:n}}var Po=e=>e*Math.PI/180;function Vo(e){let n=[],t=e.data.map(p=>{let w=P(p.value);return w?p.value<0&&n.push({code:"negative-value",severity:"warning",message:`"${p.name}" is negative (${p.value}); a radius cannot be, so it is drawn as zero.`,itemId:p.id??p.name}):n.push({code:"invalid-value",severity:"warning",message:`"${p.name}" has no valid value and is drawn as zero.`,itemId:p.id??p.name}),{...p,value:w&&p.value>0?p.value:0}}),r=oe(e,!t.some(p=>p.value>0),300,300);if(r)return{...r,issues:n};let a=re(e.format),{width:o,height:s}=se(e,300,300),c=ie(e),l=o/2,d=c+(s-c)/2,u=Math.max(0,Math.min(o,s-c)/2-(e.labels?40:12)),h=u*Math.min(.9,Math.max(0,e.innerRadius??0)),f=Math.max(1,Math.round(e.levels??4)),y=Math.max(0,...t.map(p=>be(e,p.name)?0:p.value)),I=st(0,e.max??y,f).filter(p=>p>0),x=e.max??I[I.length-1],T=(e.scale??"sqrt")==="sqrt",O=p=>{let w=x>0?Math.max(0,Math.min(1,p/x)):0;return h+(u-h)*(T?Math.sqrt(w):w)},b=Po(e.startAngle??0),z=Po(e.endAngle??(e.startAngle??0)+360),N=Math.max(0,Math.min(2*Math.PI,z-b)),k=t.length,$=N/Math.max(1,k),L=Math.min($*.9,Po(Math.max(0,e.padAngle??0))),S=I.filter(p=>p<=x).flatMap(p=>[{kind:"circle",part:"grid",cx:i(l),cy:i(d),r:i(O(p)),fill:"none",stroke:Y.grid},K(i(l+4),i(d-O(p)),a(p),{part:"y-label",baseline:"middle"})]),v=[],R=[];t.forEach((p,w)=>{let M=b+w*$+L/2,E=M+$-L,F=be(e,p.name),D=`${p.name}: ${a(p.value)}`;if(!F&&p.value>0&&E>M&&v.push({kind:"path",part:"sector",d:qe(l,d,O(p.value),h,M,E),fill:ee(e,w,p.color),stroke:"var(--skdx-color-surface-default)",title:D,item:{label:D,id:p.id??p.name,name:p.name,index:w,value:p.value}}),e.labels&&!F){let Z=(M+E)/2,B=Math.sin(Z);R.push(K(i(l+(u+8)*B),i(d-(u+8)*Math.cos(Z)),p.name,{part:"sector-label",anchor:B>.1?"start":B<-.1?"end":"middle",baseline:"middle"}))}});let j=le(e,o,s,e.data.map((p,w)=>({name:p.name,color:ee(e,w,p.color)})));return{...j,shapes:[...S,...v,...R,...j.shapes],issues:n}}var Ws=2e3;function Zs(e,n,t){let r=[],a=[],o=(2*n)**2;for(let s of e){let c=[];for(let d=r.length-1;d>=0&&s-r[d].p<2*n;d--)c.push(r[d]);let l=0;for(let d=0;;d++){if(l=d===0?0:(d%2?1:-1)*Math.ceil(d/2),Math.abs(l)>t){l=Math.sign(l)*t;break}if(c.every(u=>(u.p-s)**2+(u.off-l)**2>=o))break}r.push({p:s,off:l}),a.push(l)}return a}function Ho(e){let n=[];for(let b of e.series){let z=b.data.filter(N=>N!==null&&!Number.isFinite(N)).length;z&&n.push({code:"invalid-value",severity:"warning",message:`Series "${b.name}" has ${z} value${z===1?"":"s"} that ${z===1?"is":"are"} neither a number nor null; skipped.`,itemId:b.id??b.name})}let t=e.series.map(b=>be(e,b.name)?[]:Be(b.data)),r=oe(e,t.every(b=>b.length===0));if(r)return{...r,issues:n};let a=re(e.yAxis?.format??e.format),{width:o,height:s}=se(e),c=e.orientation==="horizontal",l=Math.max(0,...e.series.map(b=>b.name.length))*ue,d=$e(o,s,{...de,top:de.top+ie(e)+(!c&&e.yAxis?.label?12:0),left:c?Math.max(de.left,l+16):de.left,bottom:de.bottom+(c&&e.yAxis?.label?14:0)}),u=Ve(At(t.flat(),!1),c?[d.x,d.x+d.width]:[d.y+d.height,d.y],e.yAxis??{},e.format),h=Pe(e.series.length,c?[d.y,d.y+d.height]:[d.x,d.x+d.width]),f=le(e,o,s,e.series.map((b,z)=>({name:b.name,color:ee(e,z,b.color)}))),y=e.series.map((b,z)=>({pos:i(h.center(z)),label:b.name})),I=Ge({...f,plot:d,xTicks:c?y:ze(y,d.width),yTicks:c?ze(u.ticks,d.width):u.ticks,baseline:c?d.x:d.y+d.height},{horizontal:c,grid:Cn(e.yAxis),...c?{xLabel:e.yAxis?.label}:{yLabel:e.yAxis?.label}});I.push(...Lt(e.references,{plot:d,horizontal:c,x:b=>{let z=e.series.findIndex(N=>N.name===b);return z<0?void 0:h.center(z)},y:b=>u.scale(b)}));let x=e.markerSize??3,T=Math.max(0,h.bandwidth/2-x),O=[];return e.series.forEach((b,z)=>{let N=ee(e,z,b.color),k=h.center(z),$=(be(e,b.name)?[]:b.data).map((v,R)=>({v,index:R})).filter(v=>P(v.v)).sort((v,R)=>u.scale(v.v)-u.scale(R.v)),L=Zs($.map(v=>u.scale(v.v)),x,T),S=$.length<=Ws;$.forEach((v,R)=>{let j=u.scale(v.v),p=L[R],w=`${b.name}: ${a(v.v)}`;O.push({kind:"circle",part:"dot",cx:i(c?j:k+p),cy:i(c?k+p:j),r:x,fill:N,title:S?w:void 0,item:S?{label:w,id:b.id??b.name,series:b.name,seriesId:b.id??b.name,index:v.index,value:v.v}:void 0})})}),{...f,shapes:[...I,...O,...f.shapes],issues:n}}var qs=8;function Us(e){let n=e.map(a=>Math.floor(a)),t=Math.round(e.reduce((a,o)=>a+o,0))-n.reduce((a,o)=>a+o,0),r=e.map((a,o)=>({i:o,frac:a-Math.floor(a)})).sort((a,o)=>o.frac-a.frac||a.i-o.i);for(let{i:a}of r){if(t<=0)break;n[a]++,t--}return n}function _o(e){let n=[],t=e.data.map(w=>{let M=P(w.value)&&w.value>=0;return M||n.push({code:P(w.value)?"negative-value":"invalid-value",severity:"warning",message:`"${w.name}" has no valid non-negative value and is drawn as zero.`,itemId:w.id??w.name}),{...w,value:M?w.value:0}}),r=t.reduce((w,M)=>w+(be(e,M.name)?0:M.value),0),a=oe(e,r<=0,300,300);if(a)return{...a,issues:n};let o=re(e.format),s=P(e.total)&&e.total>0?e.total:r,c=Math.max(1,Math.round(e.rows??10)),l=Math.max(1,Math.round(e.columns??10)),d=c*l,u=w=>s>0?w/s:0,h=Us(t.map(w=>be(e,w.name)?0:Math.min(1,u(w.value))*d)),{width:f,height:y}=se(e,300,300),I=ie(e),x=Math.max(0,e.cellGap??2),T=Math.max(1,Math.min((f-2*qs)/l,(y-I-2*qs)/c)),O=(f-T*l)/2,b=I+(y-I-T*c)/2,z=e.orientation==="horizontal",N=w=>z?{x:O+w%l*T,y:b+Math.floor(w/l)*T}:{x:O+Math.floor(w/c)*T,y:b+(c-1-w%c)*T},k=(w,M,E,F,D)=>{let{x:Z,y:B}=N(w);return{kind:"rect",part:"cell",x:i(Z+x/2),y:i(B+x/2),width:i(Math.max(.5,T-x)),height:i(Math.max(.5,T-x)),fill:M,opacity:D,rx:e.cellRadius??2,title:E,item:F}},$=[],L=0;t.forEach((w,M)=>{let E=h[M],F=`${w.name}: ${o(w.value)} (${Math.round(u(w.value)*100)}%)`,D={label:F,id:w.id??w.name,name:w.name,index:M,value:w.value};for(let Z=0;Z<E&&L<d;Z++,L++)$.push(k(L,ee(e,M,w.color),F,D))});let S=s-r,v=S>0?`Other: ${o(S)} (${Math.round(u(S)*100)}%)`:"Empty";for(;L<d;L++)$.push(k(L,Y.grid,v,void 0,.6));let R=new Map(t.map(w=>[w.name,`${Math.round(u(w.value)*100)}%`])),j=Pn(e),p=le(e.labels&&j?{...e,legend:{...j,formatter:w=>`${j.formatter?.(w)??w} ${R.get(w)??""}`}}:e,f,y,e.data.map((w,M)=>({name:w.name,color:ee(e,M,w.color)})));return{...p,shapes:[...$,...p.shapes],issues:n}}import{css as ml,html as Rn,LitElement as ul,nothing as We,svg as Bt}from"lit";import{property as fe,state as Ut}from"lit/decorators.js";import{ifDefined as Re}from"lit/directives/if-defined.js";var Le={fromAttribute:()=>!1},X=class extends ul{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 a=this.drag;if(a?.grab==="select"){let{x:o,y:s}=this.viewBox(t,r);this.overlay=[Ka(jr(a.x,a.y,o,s))];return}if(a?.grab==="lasso"){let{x:o,y:s}=this.viewBox(t,r);a.points=[...a.points??[],{x:o,y:s}],this.overlay=[Qa(a.points)];return}if(a?.grab==="edit"){if(!a.gantt)return;let{x:o}=this.viewBox(t,r);a.change=eo(r,a.gantt,o-a.x),this.overlay=[no(r,a.gantt,a.change)];return}if(a?.grab==="map"){if(!r.map||!a.view)return;let{x:o,y:s}=this.viewBox(t,r);this.setView(ao(r.map,a.view,o-a.x,s-a.y));return}if(a&&r.hit){if(a.grab==="pinch"){let[s,c]=[...this.pointers.values()];if(s===void 0||c===void 0||!a.distance)return;this.setZoom(lo(r.hit,a.zoom,Math.abs(s-c)/a.distance,(s+c)/2));return}let{x:o}=this.viewBox(t,r);this.setZoom(a.grab==="pan"?co(r.hit,a.zoom,o-a.x):uo(r.hit,a.grab,a.zoom,o-a.x));return}if(r.tooltipPortal){let{lines:o,shapes:s}=Za(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=qa(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(Ua(r,t.target)),this.syncId&&r.hit?.crosshair){let o=gr(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:a,y:o}=this.viewBox(t,r),s=zn(r,t.target)?.item.legend,c=this.canEdit(r)?Ja(r,a,o):void 0;if(c){this.drag={x:a,y:o,zoom:{start:0,end:0},grab:"edit",gantt:c},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.brushing()&&!s){this.drag={x:a,y:o,zoom:{start:0,end:0},grab:this.selectionMode==="lasso"?"lasso":"select",points:[{x:a,y:o}]},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.canPan(r)&&r.map){let d=r.map.plot;if(a<d.x||a>d.x+d.width||o<d.y||o>d.y+d.height)return;this.drag={x:a,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,a),this.pointers.size===2){let[d,u]=[...this.pointers.values()];this.drag={x:(d+u)/2,y:o,zoom:l.zoom,grab:"pinch",distance:Math.abs(d-u)||1}}else{let d=mo(l,a,o);if(d)this.drag={x:a,y:o,zoom:d.zoom,grab:d.grab},d.zoom!==l.zoom&&this.setZoom(d.zoom);else if(this.zoomable&&a>=l.plot.x&&a<=l.plot.x+l.plot.width&&o>=l.plot.y&&o<=l.plot.y+l.plot.height)this.drag={x:a,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 a=this.drag,o=this.layout;if(o&&(a?.grab==="select"||a?.grab==="lasso"||a?.grab==="edit"||a?.grab==="map")){this.overlay=[];let{x:s,y:c}=this.viewBox(t,o);if(Math.abs(s-a.x)>2||Math.abs(c-a.y)>2){a.grab==="select"?this.setSelected(Ya(o,jr(a.x,a.y,s,c))):a.grab==="lasso"?this.setSelected(Xa(o,a.points??[])):a.grab==="edit"&&a.change&&this.emit("skdx-task-change",a.change),this.drag={...a,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:a,y:o}=this.viewBox(t,r);if(r.map&&this.canPan(r)){let l=r.map.plot;if(a<l.x||a>l.x+l.width||o<l.y||o>l.y+l.height)return;t.preventDefault(),this.setView(ro(r.map,t.deltaY,a,o));return}let s=r.hit;if(!s||!this.canZoom(r)||o<s.plot.y||o>s.plot.y+s.plot.height)return;let c=io(s,t.deltaY,a);c&&(t.preventDefault(),this.setZoom(c))};this.onClick=t=>{if(!this.layout)return;if(this.drag?.distance===-1){this.drag=null;return}let r=zn(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 c=r.shapes[this.focused]?.item;c&&(t.preventDefault(),this.select(c),this.emit("skdx-item-click",c));return}let a=this.canEdit(r)?to(r,this.focused,t):void 0;if(a){t.preventDefault(),this.emit("skdx-task-change",a);return}let o=so(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?Sn(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:a,tooltip:o,format:s,palette:c,loading:l,error:d,emptyMessage:u,description:h,decorative:f,animated:y,responsive:I,highlighted:x,highlightScope:T,accessibleTable:O}=this;return{...typeof I=="object"&&this.measured!==void 0&&this.measured<(I.breakpoint??480)?I.compact:void 0,width:I&&this.measured?this.measured:t,height:r,animate:y,responsive:I,legend:a,tooltip:o,format:s,palette:c,loading:l,error:d,emptyMessage:u,description:h,decorative:f,highlighted:x===void 0?this.highlightState:x,highlightScope:T,accessibleTable:O,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&&Mr(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=Mr(this.syncId),r=a=>{"highlighted"in a&&(this.highlightState=a.highlighted??null),a.selected&&(this.selectedState=a.selected,this.crossFilter&&(this.highlightState=a.selected.length?a.selected:null)),"zoom"in a&&(this.zoomState=a.zoom),a.hiddenSeries&&(this.hiddenState=a.hiddenSeries),"crosshair"in a&&(this.crossState=a.crosshair??null)};r(t.current),this.leave=t.subscribe((a,o)=>{o!==this.token&&r(a)})}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,a=r.includes(t)?r.filter(o=>o!==t):[...r,t];this.hiddenState=a,this.emit("skdx-hidden-series-change",a),this.publish({hiddenSeries:a})}highlight(t){let r=this.hover;r===t||r&&t&&$a(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(ka(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 Kn(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 a=r.shapes.findIndex(o=>o.item&&!o.item.legend&&rn(o.item,t));return a<0?!1:(this.getSvgElement()?.focus(),this.focused=a,!0)}export(t){let r=this.layout;return r?Zr(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,a){this.join();let o=Ia(ma(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let O of o.issues??[])this.emit("skdx-data-issue",O)}let s=this.canZoom(o),c=this.canPan(o),l=this.canEdit(o),d=this.brushing(),u=s||c||l||d,h=!o.decorative&&Gr(o).length>0,f=o.description?`${r}-desc`:void 0,y=bo(o),I=ho(o,this.accessibleTable),x=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||a,T=this.portal;return Rn`<svg
1
+ var ui=Object.defineProperty;var hi=Object.getOwnPropertyDescriptor;var u=(e,n,t,r)=>{for(var a=r>1?void 0:r?hi(n,t):n,o=e.length-1,s;o>=0;o--)(s=e[o])&&(a=(r?s(n,t,a):s(a))||a);return r&&a&&ui(n,t,a),a};import{customElement as Tl}from"lit/decorators.js";var ms=e=>Number(e.toPrecision(12)),fi,ua=e=>(fi??(fi=new Intl.NumberFormat)).format(ms(e)),pi=e=>{let n=Math.round(Math.abs(e)),t=e<0?"-":"",r=Math.floor(n/3600),a=Math.floor(n%3600/60),o=s=>String(s).padStart(2,"0");return r>0?`${t}${r}h ${o(a)}m`:a>0?`${t}${a}m ${o(n%60)}s`:`${t}${n}s`};function ae(e){if(e===void 0)return ua;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:a="",timeZone:o}=e,s=m=>a?h=>m(h)+a:m,c=m=>r===void 0?m===void 0?{}:{maximumFractionDigits:m}:{minimumFractionDigits:r,maximumFractionDigits:r},l=m=>{let h=new Intl.NumberFormat(t,m);return s(f=>h.format(ms(f)))},d=m=>{let h=new Intl.DateTimeFormat(t,o?{...m,timeZone:o}:m);return f=>h.format(f)};switch(n){case"integer":return l({maximumFractionDigits:0});case"decimal":return l(c(2));case"percent":return l({style:"percent",...c(0)});case"currency":return l({style:"currency",currency:e.currency??"USD",...c()});case"compact":return l({notation:"compact",...c(1)});case"scientific":return l({notation:"scientific",...c(2)});case"date":return d({dateStyle:"medium"});case"time":return d({timeStyle:"short"});case"datetime":return d({dateStyle:"medium",timeStyle:"short"});case"duration":return s(pi)}}function _t(e,n){if(typeof e=="string")return e;let t=e instanceof Date?e.getTime():e;return n?ae(n)(t):e instanceof Date?new Intl.DateTimeFormat().format(e):ua(t)}var Ge=e=>{if(e instanceof Date)return e.getTime();if(typeof e=="number")return e;let n=Number(e);return Number.isFinite(n)&&e.trim()!==""?n:Date.parse(e)};function tt([e,n],[t,r]){let a=n-e;return o=>a===0?t:t+(o-e)/a*(r-t)}function ct(e,n,t=5){if(e===n)return[e];let r=(n-e)/Math.max(1,t),a=10**Math.floor(Math.log10(r)),o=r/a,s=(o<1.5?1:o<3.5?2:o<7.5?5:10)*a,c=Math.floor(e/s)*s,l=Math.ceil(n/s)*s,d=[];for(let m=c;m<=l+s/2;m+=s)d.push(us(m));return d}function Ve(e,[n,t],r=.2){let a=e===0?0:(t-n)/e,o=a*(1-Math.max(0,Math.min(.9,r)));return{step:a,bandwidth:o,start:s=>n+s*a+(a-o)/2,center:s=>n+(s+.5)*a}}var us=e=>Number(e.toPrecision(12)),i=e=>Number(e.toFixed(2)),P=e=>typeof e=="number"&&Number.isFinite(e),Pe=e=>e.filter(P);function Me(e){let n=1/0,t=-1/0;for(let r of e)P(r)&&(r<n&&(n=r),r>t&&(t=r));return n===1/0?[0,0]:[n,t]}function nt(e,n="linear"){if(e.length===0)return"";let t=e[0];if(n==="step"||n==="stepBefore"||n==="stepAfter"){let d=`M${t.x} ${t.y}`;for(let m=1;m<e.length;m++){let h=e[m-1],f=e[m];n==="stepAfter"?d+=`H${f.x}V${f.y}`:n==="stepBefore"?d+=`V${f.y}H${f.x}`:d+=`H${i((h.x+f.x)/2)}V${f.y}H${f.x}`}return d}if(n==="linear"||e.length<3)return`M${e.map(d=>`${d.x} ${d.y}`).join("L")}`;let r=e.length,a=e.slice(1).map((d,m)=>d.x-e[m].x),o=e.slice(1).map((d,m)=>d.y-e[m].y),s=a.map((d,m)=>d===0?0:o[m]/d),c=[s[0]];for(let d=1;d<r-1;d++){let m=s[d-1],h=s[d];c.push(m*h<=0?0:(m+h)/2)}c.push(s[r-2]);for(let d=0;d<r-1;d++){let m=s[d];if(m===0){c[d]=0,c[d+1]=0;continue}let h=c[d]/m,f=c[d+1]/m,M=Math.hypot(h,f);M>3&&(c[d]=3*h*m/M,c[d+1]=3*f*m/M)}let l=`M${t.x} ${t.y}`;for(let d=0;d<r-1;d++){let m=e[d],h=e[d+1],f=a[d]/3;l+=`C${i(m.x+f)} ${i(m.y+f*c[d])} ${i(h.x-f)} ${i(h.y-f*c[d+1])} ${h.x} ${h.y}`}return l}var ur=1e3,hr=60*ur,fr=60*hr,pr=24*fr,bi=[ur,5*ur,15*ur,30*ur,hr,5*hr,15*hr,30*hr,fr,3*fr,6*fr,12*fr,pr,2*pr,7*pr,14*pr];function Zn(e,n,t=6){if(!(n>e))return[e];let r=n-e,a=bi.find(h=>r/h<=t),o=[];if(a!==void 0){for(let h=Math.ceil(e/a)*a;h<=n;h+=a)o.push(h);return o.length?o:[e,n]}let s=r/(30*pr),c=[1,2,3,6,12,24,60,120].find(h=>s/h<=t)??240,l=new Date(e),d=l.getUTCFullYear(),m=Math.ceil((l.getUTCMonth()+(l.getUTCDate()>1?1:0))/c)*c;for(let h=Date.UTC(d,m,1);h<=n;)o.push(h),m+=c,m>=12&&(d+=Math.floor(m/12),m%=12),h=Date.UTC(d,m,1);return o.length?o:[e,n]}function hs(e,n){let t=Math.floor(Math.log10(e)),r=Math.ceil(Math.log10(n)),a=r-t<=1?[1,2,5]:[1],o=[];for(let s=t;s<=r;s++)for(let c of a)o.push(us(c*10**s));return o.filter(s=>s>=e/1.0001&&s<=n*1.0001)}function Un(e,n={}){if(n.thresholds&&n.thresholds.length>=2)return[...n.thresholds].filter(Number.isFinite).sort((l,d)=>l-d);let[t,r]=n.domain??Me(e),a=Math.max(1,e.length),o=Math.max(1,n.bins??Math.ceil(Math.log2(a)+1)),s=n.binWidth??(r>t?(r-t)/o:1),c=r>t?Math.max(1,Math.ceil((r-t)/s-1e-9)):1;return Array.from({length:c+1},(l,d)=>Number((t+d*s).toPrecision(12)))}function Yn(e,n){let t=[];for(let o=0;o+1<n.length;o++)t.push({x0:n[o],x1:n[o+1],count:0});if(t.length===0)return t;let r=n[0],a=n[n.length-1];for(let o of Pe(e)){if(o<r||o>a)continue;let s=0,c=t.length-1;for(;s<c;){let l=s+c+1>>1;t[l].x0<=o?s=l:c=l-1}t[s].count++}return t}var gi=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,xi=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,yi={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function vi(e,n,t){return e.replace(xi,(r,a,o)=>{let s=yi[a];if(s===void 0)return a+o;let l=(o.match(gi)??[]).map((d,m)=>{let h=Number(d);if(s===-1)return String(h+n);if(s===-2)return String(h+t);let f=m%s;return s===7?f===5?String(h+n):f===6?String(h+t):d:String(f%2===0?h+n:h+t)});return a+l.join(" ")})}var fs=(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:vi(r.d,n,t)}}});var ha=["primary","success","warning","danger","neutral"].flatMap(e=>[500,700].map(n=>`var(--skdx-color-${e}-${n})`)).sort((e,n)=>Number(e.endsWith("700)"))-Number(n.endsWith("700)"))),K={axis:"var(--skdx-color-border-strong)",grid:"var(--skdx-color-border-subtle)",label:"var(--skdx-color-text-muted)",focus:"var(--skdx-color-focus-ring)",positive:"var(--skdx-color-success-500)",negative:"var(--skdx-color-danger-500)",fontFamily:"var(--skdx-font-family)",fontSize:"var(--skdx-font-size-xs)"},vt=(e="neutral")=>e==="neutral"?K.axis:`var(--skdx-color-${e}-500)`,fa=(e="neutral")=>e==="neutral"?K.label:e==="primary"?"var(--skdx-color-text-accent)":`var(--skdx-color-text-${e})`,ps=(e,n)=>n??ha[e%ha.length];var he={top:16,right:16,bottom:32,left:48};function Ie(e,n,t=he){return{x:t.left,y:t.top,width:Math.max(0,e-t.left-t.right),height:Math.max(0,n-t.top-t.bottom)}}function Vn(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function ba(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var Fr=e=>e.crosshair===!0||ba(e).trigger==="axis",Pr=20,Mi=120,bs=e=>{let n=Vn(e);return n&&(n.position==="left"||n.position==="right")?n.width??Mi:0},ce=(e,n=600,t=300)=>({width:(e.width??n)-bs(e),height:(e.height??t)-(Vn(e)?.position==="bottom"?Pr:0)}),me=(e,n,t)=>{let r=Vn(e);return!r||!(r.position===void 0||r.position==="top")?0:(n?Math.max(1,gs(n,t??ce(e).width,r)):1)*Pr},ie=6.5;function ga(e,n){let t=Array.from(e),r=Math.max(0,Math.floor(n/ie));return t.length<=r?e:r===0?"":`${t.slice(0,r-1).join("")}\u2026`}var ne=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:ps(n)),xe=(e,n)=>e.hiddenSeries?.includes(n)??!1;function pa(e,n,t=[],r={},a=10,o=8,s=!1){let c=[],l=r.maxItems,d=l!==void 0&&l>=0&&e.length>l?e.slice(0,l):e,m=e.length-d.length,h=r.interactive??!0,f=o,M=a,$=(g,w,R,k)=>{let T=(w?18:4)+g.length*ie;f>o&&(s||f+T>n-8)&&(f=o,M+=Pr),w&&c.push({kind:"rect",part:"legend-swatch",x:f,y:M-5,width:10,height:10,fill:w,opacity:k?.3:void 0,item:R}),c.push({kind:"text",part:"legend-label",x:f+(w?14:0),y:M,text:g,baseline:"middle",fill:k?K.grid:K.label,item:R}),f+=T+12};for(let g of d){let w=t.includes(g.name),R=h?{label:g.name,series:g.name,legend:!0}:void 0;$(r.formatter?.(g.name)??g.name,g.color,R,w)}return m>0&&$(`+${m} more`,void 0,void 0,!1),r.align==="end"?wi(c,n):c}function wi(e,n){let t=new Map;for(let a of e){let o=a.kind==="rect"?a.y+5:a.y;t.set(o,[...t.get(o)??[],a])}let r=[];for(let a of t.values()){let o=Math.max(...a.map(c=>c.kind==="rect"?c.x+c.width:c.x+c.text.length*ie)),s=n-8-o;for(let c of a)r.push({...c,x:c.x+s})}return r}var gs=(e,n,t={})=>new Set(pa(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function ue(e,n,t,r=[]){let a=Vn(e),o=a&&e.direction==="rtl"&&a.align===void 0?{...a,align:"end"}:a,s=ba(e),c=o?.position==="bottom",l=bs(e),d=e.hiddenSeries??[],m=o?l?pa(r,1/0,d,o,10,(o.position==="right"?n:0)+8,!0):pa(r,n,d,o,c?t+10:10):[],h=c?gs(r,n,o):0;return{width:n+l,height:c?t+Math.max(1,h)*Pr: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:m}}function xa(e){let n=e.legendOffset;if(!n)return e;let t=[...fs(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}),a=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,c=e.map?{...e.map,plot:r(e.map.plot)}:void 0;return{...e,shapes:t,hit:a,edit:s,map:c,legendOffset:void 0}}function Hr(e,n,t,r,a,o="auto"){let s=Array.isArray(t)?t:[t],c=Math.max(1,Math.floor((r-12)/ie)),l=s.flatMap(w=>{let R=[],k=Array.from(w);for(;k.length>c;){let T=k.slice(0,c+1).lastIndexOf(" ");T<1&&(T=c),R.push(k.slice(0,T).join("")),k=k.slice(T),k[0]===" "&&k.shift()}return R.push(k.join("")),R}),d=Math.max(1,Math.floor((a-6)/16)),m=l.slice(0,d);l.length>d&&(m[d-1]=ga(`${m[d-1]}\u2026`,r-12));let h=Math.min(r,Math.max(0,...m.map(w=>Array.from(w).length))*ie+12),f=Math.min(a,6+m.length*16),M=o==="top"?{x:e-h/2,y:n-f-8}:o==="bottom"?{x:e-h/2,y:n+8}:o==="left"?{x:e-h-8,y:n-f/2}:o==="right"?{x:e+8,y:n-f/2}:{x:e+12,y:n-f-6},$=Math.max(0,Math.min(r-h,M.x)),g=Math.max(0,Math.min(a-f,M.y));return[{kind:"rect",part:"tooltip",title:s.join(`
2
+ `),x:i($),y:i(g),width:i(h),height:f,fill:"var(--skdx-color-surface-raised)",stroke:K.axis,rx:8},...m.map((w,R)=>({kind:"text",part:"tooltip-label",x:i($+6),y:i(g+11+R*16),text:w,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:m.length>1&&R===0?"bold":void 0}))]}function Nt(e,n){let[t,r]=Me(e);return n?[Math.min(0,t),Math.max(0,r)]:[t,r]}function _e([e,n],t,r=!1,a){let o=typeof r=="boolean"?{scale:r?"log":"linear"}:r,s=ae(o.format??a),c=o.min??e,l=o.max??n;o.reversed&&(t=[t[1],t[0]]);let d={id:o.id,position:o.position,options:o};if(o.scale==="sqrt"){let g=S=>Math.sign(S)*Math.sqrt(Math.abs(S)),w=o.nice===!1?[c,l]:ct(c,l,o.ticks),R=o.min??w[0],k=o.max??w[w.length-1],T=tt([g(R),g(k)],t),D=S=>T(g(S)),v=ct(R,k,o.ticks).filter(S=>S>=R-1e-9&&S<=k+1e-9);return{...d,scale:D,domain:[R,k],format:s,ticks:(v.length>=2?v:[R,k]).map(S=>({pos:i(D(S)),label:s(S)})),zero:i(D(Math.min(Math.max(0,R),k)))}}if(o.scale==="log"){let g=Math.max(c,Number.EPSILON),w=Math.max(l,g),R=hs(g,w),k=[Math.log10(g),Math.log10(w)],T=tt(k,t),D=v=>T(Math.log10(Math.max(v,Number.EPSILON)));return{...d,scale:D,domain:k,format:s,ticks:R.map(v=>({pos:i(D(v)),label:s(v)})),zero:i(t[0])}}let m=ct(c,l,o.ticks),h=[o.min??(o.nice===!1?c:m[0]),o.max??(o.nice===!1?l:m[m.length-1])],f=tt(h,t),M=m.filter(g=>g>=h[0]-1e-9&&g<=h[1]+1e-9),$=(M.length>=2?M:[h[0],h[1]]).map(g=>({pos:i(f(g)),label:s(g)}));return{...d,scale:f,domain:h,format:s,ticks:$,zero:i(f(Math.min(Math.max(0,h[0]),h[1])))}}var Vr=([e,n],t)=>Math.max(he.left,ct(e,n).reduce((r,a)=>Math.max(r,t(a).length),0)*ie+14),Cn=e=>e?.grid!==!1;function Se(e,n){if(e.length<2)return e;let t=e.reduce((a,o)=>Math.max(a,o.label.length),0)*ie+8,r=Math.max(1,Math.ceil(e.length*t/Math.max(1,n)));return r===1?e:e.filter((a,o)=>o%r===0)}var br=(e,n,t,r)=>`${e}, ${n}: ${r(t)}`;function le(e,n,t,r){let a=e.error!==void 0?"error":e.loading?"loading":n?"empty":null;if(!a)return null;let{width:o,height:s}=ce(e,t,r),c=a==="error"?e.error:a==="loading"?"Loading\u2026":e.emptyMessage??"No data available",l=[];return a==="loading"&&l.push({kind:"rect",part:"skeleton",x:0,y:0,width:o,height:s,fill:"var(--skdx-color-surface-sunken)",rx:8}),l.push({kind:"text",part:`state-${a}`,x:i(o/2),y:i(s/2),text:c,anchor:"middle",baseline:"middle",fill:a==="error"?"var(--skdx-color-text-danger)":K.label}),{...ue(e,o,s),shapes:l,tooltip:!1}}var Kn=(e,n,t)=>{let r=n.length*ie/2;return e+r>t?"end":e-r<0?"start":"middle"};function We(e,n={}){let{plot:t,xTicks:r,yTicks:a,baseline:o}=e,s=t.x+t.width,c=t.y+t.height,l=[],d=n.grid??!0,m=($,g)=>g?{kind:"line",part:"grid",x1:$.pos,x2:$.pos,y1:t.y,y2:c,stroke:K.grid}:{kind:"line",part:"grid",x1:t.x,x2:s,y1:$.pos,y2:$.pos,stroke:K.grid},h=n.x?.tickRotation??0,f=($,g,w,R)=>h?J($,g,w,{part:R,anchor:h<0?"end":"start",baseline:"middle",rotate:h}):_n($,g,w,e.width,{part:R,anchor:Kn($,w,e.width)}),M=($,g,w,R,k)=>{for(let T of $)l.push(g==="x"?{kind:"line",part:"tick",x1:T.pos,x2:T.pos,y1:w,y2:i(w+R*k),stroke:K.axis}:{kind:"line",part:"tick",x1:w,x2:i(w+R*k),y1:T.pos,y2:T.pos,stroke:K.axis})};if(n.categoryGrid)for(let $ of r)l.push(m($,!n.horizontal));if(n.horizontal){let $=n.axes??[{ticks:a,position:"bottom",offset:0,label:n.yLabel,...n.y}];if(d)for(let g of a)l.push(m(g,!0));$[0]?.showLine!==!1&&l.push({kind:"line",part:"axis",x1:o,x2:o,y1:t.y,y2:c,stroke:K.axis});for(let g of $){let w=g.position==="top"||g.position==="right",R=i(w?t.y-g.offset:c+g.offset),k=w||g.offset>0;g.showLine&&k&&l.push({kind:"line",part:"axis",x1:t.x,x2:s,y1:R,y2:R,stroke:K.axis}),g.showTicks&&M(g.ticks,"x",R,w?-1:1,g.tickSize??4);let T=i(w?R-8:R+20);for(let D of g.ticks)l.push(w?J(D.pos,T,D.label,{part:"x-label-top",anchor:Kn(D.pos,D.label,e.width)}):f(D.pos,T,D.label,"x-label"));g.label&&l.push(k?J(4,T,g.label,{part:"axis-title",anchor:"start",baseline:w?void 0:"middle"}):J(4,t.y-6,g.label,{part:"axis-title",anchor:"start"}))}n.x?.showLine&&l.push({kind:"line",part:"axis",x1:n.rtl?s:t.x,x2:n.rtl?s:t.x,y1:t.y,y2:c,stroke:K.axis}),n.x?.showTicks&&M(r,"y",n.rtl?s:t.x,n.rtl?1:-1,n.x.tickSize??4);for(let g of r)l.push(n.rtl?J(s+8,g.pos,g.label,{part:"y-label",anchor:"start",baseline:"middle"}):J(t.x-8,g.pos,g.label,{part:"y-label",anchor:"end",baseline:"middle"}))}else{if(d)for(let g of a)l.push(m(g,!1));n.y?.showLine!==!1&&l.push({kind:"line",part:"axis",x1:t.x,x2:s,y1:o,y2:o,stroke:K.axis});let $=n.axes??[{ticks:a,position:"left",offset:0,label:n.yLabel,...n.y},...n.rightTicks?[{ticks:n.rightTicks,position:"right",offset:0,label:n.rightLabel}]:[]];for(let g of $){let w=g.position==="left",R=w?t.x-g.offset:s+g.offset,k=w?"y-label":"y-label-right";g.showLine&&l.push({kind:"line",part:"axis",x1:i(R),x2:i(R),y1:t.y,y2:c,stroke:K.axis}),g.showTicks&&M(g.ticks,"y",i(R),w?-1:1,g.tickSize??4);for(let T of g.ticks)l.push(J(i(w?R-8:R+8),T.pos,T.label,{part:k,anchor:w?"end":"start",baseline:"middle"}));g.label&&l.push(J(i(w?g.offset===0?4:Math.max(4,R-40):g.offset===0?e.width-4:Math.min(e.width-4,R+40)),t.y-6,g.label,{part:"axis-title",anchor:w?"start":"end"}))}n.x?.showTicks&&M(r,"x",c,1,n.x.tickSize??4);for(let g of r)l.push(f(g.pos,c+(h?12:20),g.label,"x-label"))}return n.xLabel&&l.push(J(i(t.x+t.width/2),e.height-4,n.xLabel,{part:"axis-title",anchor:"middle"})),n.horizontal&&n.rightLabel&&l.push(J(e.width-4,t.y-6,n.rightLabel,{part:"axis-title",anchor:"end"})),l}var J=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:K.label,...r});function _n(e,n,t,r,a={}){let o=Math.max(4,Math.min(r-4,e)),s=a.anchor??"start",c=s==="middle"?2*Math.min(o-4,r-o-4):s==="end"?o-4:r-o-4,l=ga(t,c);return{kind:"text",part:"label",x:o,y:n,fill:K.label,...a,text:l,title:l===t?a.title:t}}function dt(e){return e.flatMap(n=>{if(n.kind!=="text"||n.fill!=="var(--skdx-color-text-on-accent)"&&n.part!=="reference-label")return[n];let t=n.text.length*ie+8,r=n.x-(n.anchor==="middle"?t/2:n.anchor==="end"?t-4:4),a=n.y-(n.baseline==="hanging"?2:n.baseline==="middle"?9:14);return[{kind:"rect",part:"label-background",x:r,y:a,width:t,height:18,rx:8,fill:"var(--skdx-color-surface-raised)"},{...n,fill:n.part==="reference-label"?n.fill:"var(--skdx-color-text-default)"}]})}var Mt=(e,n,t,r,a,o)=>({kind:"circle",part:"point",cx:e,cy:n,r:t,fill:r,title:a,item:o});function Rt(e,n){let t=[],{plot:r}=n,a=r.x+r.width,o=r.y+r.height,s=l=>Math.max(r.x,Math.min(a,l)),c=l=>Math.max(r.y,Math.min(o,l));for(let l of e??[]){let d=l.color??vt(l.variant),m=l.color??fa(l.variant),h={part:"reference-label",fill:m},f=n.horizontal===!0;if("y"in l){let M=i(n.y(l.y,l.axis??"left"));if(f){let $=s(M);t.push(...ys($,r.y,o,d,l.label,h))}else{let $=c(M);t.push(...xs(r.x,a,$,d,l.label,h))}}else if("x"in l){let M=n.x(l.x);if(M===void 0)continue;f?t.push(...xs(r.x,a,c(i(M)),d,l.label,h)):t.push(...ys(s(i(M)),r.y,o,d,l.label,h))}else if("y1"in l){let M=i(n.y(l.y1,l.axis??"left")),$=i(n.y(l.y2,l.axis??"left"));f?t.push(...Ms(s(Math.min(M,$)),s(Math.max(M,$)),r,d,l.label,m)):t.push(...vs(c(Math.min(M,$)),c(Math.max(M,$)),r,d,l.label,m))}else{let M=n.x(l.x1),$=n.x(l.x2);if(M===void 0||$===void 0)continue;let g=i(Math.min(M,$)),w=i(Math.max(M,$));f?t.push(...vs(c(g),c(w),r,d,l.label,m)):t.push(...Ms(s(g),s(w),r,d,l.label,m))}}return t}function xs(e,n,t,r,a,o){let s={kind:"line",part:"reference",x1:e,x2:n,y1:t,y2:t,stroke:r,dash:"6 4",strokeWidth:1.5,title:a};return a?[s,J(n-4,t-5,a,{...o,anchor:"end"})]:[s]}function ys(e,n,t,r,a,o){let s={kind:"line",part:"reference",x1:e,x2:e,y1:n,y2:t,stroke:r,dash:"6 4",strokeWidth:1.5,title:a};return a?[s,J(e+4,n+10,a,{...o,anchor:"start"})]:[s]}function vs(e,n,t,r,a,o){let s={kind:"rect",part:"reference-area",x:t.x,y:e,width:t.width,height:i(Math.max(0,n-e)),fill:r,opacity:.12,title:a};return a?[s,J(t.x+t.width-4,e+12,a,{part:"reference-label",fill:o,anchor:"end"})]:[s]}function Ms(e,n,t,r,a,o){let s={kind:"rect",part:"reference-area",x:e,y:t.y,width:i(Math.max(0,n-e)),height:t.height,fill:r,opacity:.12,title:a};return a?[s,J(e+4,t.y+12,a,{part:"reference-label",fill:o,anchor:"start"})]:[s]}function Ln(e,n){let t=[],{plot:r}=n,a=r.x+r.width,o=r.y+r.height;for(let s of e??[]){let c=s.color??vt(s.variant),l=s.color??fa(s.variant),d=($,g,w)=>{let R=n.x($);if(R===void 0)return;let k=n.y(g,w??"left");return n.horizontal?{x:i(k),y:i(R)}:{x:i(R),y:i(k)}},m=s.id??s.label,h=$=>({label:$,id:m,name:s.label});if(s.type==="line"||s.type==="band"){let{type:$,id:g,...w}=s;t.push(...Rt([w],n));continue}if(s.type==="rect"){let $=d(s.x1,s.y1,s.axis),g=d(s.x2,s.y2,s.axis);if(!$||!g)continue;let w=Math.max(r.x,Math.min($.x,g.x)),R=Math.max(r.y,Math.min($.y,g.y)),k=s.label??"";t.push({kind:"rect",part:"annotation-rect",x:i(w),y:i(R),width:i(Math.max(0,Math.min(a,Math.max($.x,g.x))-w)),height:i(Math.max(0,Math.min(o,Math.max($.y,g.y))-R)),fill:c,opacity:.12,stroke:c,title:k||void 0,item:k?h(k):void 0}),s.label&&t.push(J(i(w+4),i(R+12),s.label,{part:"annotation-label",fill:l}));continue}let f=d(s.x,s.y,s.axis);if(!f)continue;if(s.type==="text"){t.push(J(f.x,f.y,s.text,{part:"annotation-text",fill:l,anchor:"middle",baseline:"middle",title:s.label}));continue}let M=s.label??`${String(s.x)}, ${s.y}`;if(t.push({kind:"circle",part:"annotation-point",cx:f.x,cy:f.y,r:5,fill:c,stroke:"var(--skdx-color-surface-default)",title:M,item:h(M)}),s.type==="callout"&&s.label){let[$,g]=s.offset??[16,-16],w=i(Math.max(r.x,Math.min(a,f.x+$))),R=i(Math.max(r.y,Math.min(o,f.y+g)));t.push({kind:"line",part:"annotation-leader",x1:f.x,y1:f.y,x2:w,y2:R,stroke:c},J(w,R,s.label,{part:"annotation-label",fill:l,anchor:$>=0?"start":"end",baseline:"middle"}))}}return t}var ya=2e3;function ki(e){if(e!=="none")return e===void 0||e==="auto"?{strategy:"lttb",threshold:ya}:typeof e=="string"?{strategy:e,threshold:ya}:{strategy:e.strategy,threshold:e.threshold??ya}}function $i(e,n){let t=e.length;if(n>=t||n<3)return e.map((c,l)=>l);let r=[0],a=[],o=(t-2)/(n-2),s=0;for(let c=0;c<n-2;c++){let l=Math.floor((c+1)*o)+1,d=Math.min(t-1,Math.floor((c+2)*o)+1),m=0,h=0,f=0;for(let T=l;T<d;T++){let D=e[T];P(D)&&(m+=T,h+=D,f++)}m=f?m/f:(l+d)/2,h=f?h/f:0;let M=Math.floor(c*o)+1,$=Math.min(t-1,Math.floor((c+1)*o)+1),g=e[s],w=P(g)?g:0,R=-1,k=-1;for(let T=M;T<$;T++){let D=e[T];if(!P(D)){a.push(T);continue}let v=Math.abs((s-m)*(D-w)-(s-T)*(h-w));v>k&&(k=v,R=T)}R<0&&(R=M),r.push(R),s=R}return r.push(t-1),a.length?[...new Set([...r,...a])].sort((c,l)=>c-l):r}function Ii(e,n){let t=e.length,r=Math.max(1,Math.floor(n/2));if(r*2>=t)return e.map((s,c)=>c);let a=[],o=t/r;for(let s=0;s<r;s++){let c=Math.floor(s*o),l=s===r-1?t:Math.floor((s+1)*o),d=-1,m=-1;for(let h=c;h<l;h++){let f=e[h];if(!P(f)){a.push(h);continue}(d<0||f<e[d])&&(d=h),(m<0||f>e[m])&&(m=h)}d>=0&&a.push(Math.min(d,m)),m>=0&&m!==d&&a.push(Math.max(d,m))}return[...new Set(a)].sort((s,c)=>s-c)}function Ti(e,n){let t=e.length,r=Math.max(1,Math.floor(n/4));if(r*4>=t)return e.map((s,c)=>c);let a=[],o=t/r;for(let s=0;s<r;s++){let c=Math.floor(s*o),l=s===r-1?t:Math.floor((s+1)*o),d=-1,m=-1,h=-1,f=-1;for(let M=c;M<l;M++){let $=e[M];if(!P($)){a.push(M);continue}h<0&&(h=M),f=M,(d<0||$<e[d])&&(d=M),(m<0||$>e[m])&&(m=M)}for(let M of[h,d,m,f])M>=0&&a.push(M)}return[...new Set(a)].sort((s,c)=>s-c)}function ws(e,n,t){let r=ki(t);if(!r||n<=r.threshold||e.length===0)return;let a=r.strategy==="minmax"?Ii:r.strategy==="m4"?Ti:$i,o=new Set;for(let s of e)for(let c of a(s.slice(0,n),r.threshold))o.add(c);return[...o].sort((s,c)=>s-c)}var gr=e=>Math.max(0,Math.min(1,e));function ks(e){let n=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(n){let r=n[1],a=r.length===3?r.split("").map(o=>o+o).join(""):r;return[0,2,4].map(o=>parseInt(a.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 $s(e,n){if(e.length===0)return K.axis;if(e.length===1)return e[0];let t=gr(n)*(e.length-1),r=Math.min(e.length-2,Math.floor(t)),a=t-r,o=ks(e[r]),s=ks(e[r+1]);if(!o||!s)return e[Math.round(t)];let c=l=>Math.round(o[l]+(s[l]-o[l])*a);return`rgb(${c(0)}, ${c(1)}, ${c(2)})`}var Is=(e,n)=>n!==void 0&&n>=2?Math.min(n-1,Math.floor(gr(e)*n))/(n-1):gr(e);function wt(e,n,t,r=K.negative,a=String){let[o,s]=Me(n),c=e??{type:"sequential"},l=w=>i(.15+.85*w);if(c.type==="threshold"){let{thresholds:w,colors:R,labels:k}=c,T=v=>{if(typeof v!="number"||!Number.isFinite(v))return;let S=0;for(;S<w.length&&v>=w[S];)S++;return{fill:R[Math.min(S,R.length-1)]??t,opacity:1}},D=R.map((v,S)=>({fill:v,opacity:1,label:k?.[S]??(S===0?`< ${a(w[0]??0)}`:S===w.length?`\u2265 ${a(w[S-1])}`:`${a(w[S-1])} \u2013 ${a(w[S])}`)}));return{color:T,domain:[o,s],swatches:D,kind:"threshold"}}if(c.type==="ordinal"){let w=c.colors?.length?c.colors:[t];return{color:k=>typeof k=="number"&&Number.isFinite(k)?{fill:w[Math.abs(Math.round(k))%w.length],opacity:1}:void 0,domain:[o,s],swatches:w.map((k,T)=>({fill:k,opacity:1,label:String(T)})),kind:"ordinal"}}if(c.type==="diverging"){let[w,R,k]=c.domain??[-Math.max(Math.abs(o),Math.abs(s)),0,Math.max(Math.abs(o),Math.abs(s))],T=c.colors,D=z=>z<R?.5*(z-w)/Math.max(1e-12,R-w):.5+.5*(z-R)/Math.max(1e-12,k-R),v=z=>{let L=Is(c.reversed?1-gr(z):z,c.steps);if(T&&T.length>=2)return{fill:$s(T,L),opacity:1};let H=L<.5?r:t,b=Math.abs(L-.5)*2;return{fill:H,opacity:l(b)}},S=z=>typeof z=="number"&&Number.isFinite(z)?v(D(z)):void 0,O=c.steps??5,E=Array.from({length:O},(z,L)=>{let H=O===1?.5:L/(O-1),b=H<.5?w+(R-w)*(H*2):R+(k-R)*((H-.5)*2);return{...v(H),label:a(b)}});return{color:S,domain:[w,k],swatches:E,kind:"diverging"}}let[d,m]=c.domain??[o,s],h=c.colors,f=w=>{let R=Is(c.reversed?1-gr(w):w,c.steps);return h&&h.length>=2?{fill:$s(h,R),opacity:1}:{fill:h?.[0]??t,opacity:l(R)}},M=w=>typeof w!="number"||!Number.isFinite(w)?void 0:f(m===d?1:(w-d)/(m-d)),$=c.steps??5,g=Array.from({length:$},(w,R)=>{let k=$===1?1:R/($-1);return{...f(k),label:a(d+(m-d)*k)}});return{color:M,domain:[d,m],swatches:g,kind:"sequential"}}var Ai=34,Ci=72;function On(e){if(!e)return{bottom:0,right:0,options:{}};let n=e===!0?{}:e;return n.orientation==="vertical"?{bottom:0,right:Ci,options:n}:{bottom:Ai,right:0,options:n}}function Xn(e,n,t){let r=typeof t=="string"?{title:t}:t??{},a=r.title,o=e.swatches;if(o.length===0||n.width<=0)return[];if(r.orientation==="vertical"){let m=Math.max(0,n.height-(a?16:0)),h=Math.min(16,m/o.length),f=n.y+(a?16:0),M=o.map((g,w)=>({kind:"rect",part:"color-legend-swatch",x:i(n.x),y:i(f+w*h),width:10,height:i(h),fill:g.fill,opacity:g.opacity,title:g.label})),$=h>=12?1:2;return o.forEach((g,w)=>{w%$!==0&&w!==o.length-1||M.push({kind:"text",part:"color-legend-label",x:i(n.x+14),y:i(f+(w+.5)*h),text:g.label,baseline:"middle",fill:K.label})}),a&&M.push({kind:"text",part:"color-legend-title",x:i(n.x),y:i(n.y+6),text:a,baseline:"middle",fill:K.label}),M}let s=Math.min(n.width/o.length,96),c=n.x+(n.width-s*o.length)/2,l=o.map((m,h)=>({kind:"rect",part:"color-legend-swatch",x:i(c+h*s),y:i(n.y),width:i(s),height:10,fill:m.fill,opacity:m.opacity,title:m.label})),d=e.kind==="threshold"?1:Math.max(1,Math.ceil(o.length*7*ie/Math.max(1,s*o.length)));return o.forEach((m,h)=>{h%d!==0&&h!==o.length-1||l.push({kind:"text",part:"color-legend-label",x:i(c+(h+.5)*s),y:i(n.y+22),text:m.label,anchor:"middle",fill:K.label})}),a&&l.push({kind:"text",part:"color-legend-title",x:i(c-6),y:i(n.y+5),text:a,anchor:"end",baseline:"middle",fill:K.label}),l}var Li=1e4,Oi=e=>Array.isArray(e)?{x:e[0],y:e[1],size:e[2],label:void 0,id:void 0,color:void 0,value:void 0}:{x:e.x,y:e.y,size:e.size,label:e.label,id:e.id,color:e.color,value:e.value};function va(e,n,t,r,a,o,s,c){if(r==="circle")return{...Mt(e,n,t,a,o,s),part:c};let l=r==="square"?`M${i(e-t)} ${i(n-t)}h${i(2*t)}v${i(2*t)}h${i(-2*t)}Z`:r==="diamond"?`M${i(e)} ${i(n-t*1.3)}L${i(e+t*1.3)} ${i(n)}L${i(e)} ${i(n+t*1.3)}L${i(e-t*1.3)} ${i(n)}Z`:`M${i(e)} ${i(n-t*1.2)}L${i(e+t*1.15)} ${i(n+t*.9)}L${i(e-t*1.15)} ${i(n+t*.9)}Z`;return{kind:"path",part:c,d:l,fill:a,title:o,item:s}}function Ma(e,n){let t=[],r=e.series.map((F,_)=>({name:F.name,id:F.id,symbol:F.symbol??"circle",color:ne(e,_,F.color),data:xe(e,F.name)?[]:F.data.flatMap((W,ee)=>{let te=Oi(W);return P(te.x)&&P(te.y)?[{...te,index:ee}]:[]})})),a=e.sampling==="auto"?Li:typeof e.sampling=="object"?e.sampling.threshold:1/0,o=r.reduce((F,_)=>F+_.data.length,0),s=o>a?Math.ceil(o/a):1;s>1&&t.push({code:"sampled",severity:"warning",message:`${o} points exceed the sampling threshold of ${a}; every ${s}th point is drawn.`});let c=s>1?r.map(F=>({...F,data:F.data.filter((_,W)=>W%s===0)})):r,l=c.flatMap(F=>F.data),d=le(e,l.length===0);if(d)return{...d,issues:t};let{width:m,height:h}=ce(e),f=e.colorScale?On(e.colorLegend):{bottom:0,right:0,options:{}},M=e.series.map((F,_)=>({name:F.name,color:ne(e,_,F.color)})),$=Ie(m,h,{...he,top:he.top+me(e,M,m)+(e.yAxis?.label?12:0),right:he.right+f.right,bottom:he.bottom+(e.xAxis?.label?14:0)+f.bottom}),g=e.markerSize??3,w=Math.max(0,e.hitRadius??0),R=Math.max(0,e.jitter??0),k=Me(l.map(F=>F.size)),T=F=>F==="diamond"?1.3:F==="triangle"?1.2:1,D=(F,_)=>Math.max(0,_?n.radius(F.size,k):g),v=0;for(let F of c){let _=F.data.some(ee=>ee.size!==void 0),W=T(F.symbol);for(let ee of F.data)v=Math.max(v,D(ee,_)*W)}let S=Math.min(1,Math.min($.width,$.height)*.45/Math.max(1,v+R)),O=R*S,E=v*S+O,z=new Map,L=e.colorScale?wt(e.colorScale,l.map(F=>F.value),ne(e,0),void 0,ae(e.format)):void 0,H=_e(Nt(l.map(F=>F.x),!1),[$.x+E,$.x+$.width-E],e.xAxis??{},e.format),b=_e(Nt(l.map(F=>F.y),!1),[$.y+$.height-E,$.y+E],e.yAxis??{},e.format),x=ue(e,m,h,M),C=[],y=[],B=[],U=[];for(let F of c){let _=F.data.some(W=>W.size!==void 0);for(let W of F.data){let ee=W.index,te=n.describe(F.name,W,H,b),re=D(W,_)*S,de=i(H.scale(W.x)),pe=i(b.scale(W.y));if(O>0){let De=`${Math.round(de)},${Math.round(pe)}`,Be=z.get(De)??0;if(z.set(De,Be+1),Be>0){let ht=Be*2.399963;de=i(de+O*Math.cos(ht)),pe=i(pe+O*Math.sin(ht))}}let Z=L?.color(W.value),oe={label:te,id:W.id,series:F.name,seriesId:F.id??F.name,name:W.label,index:ee,value:W.y},we=W.color??Z?.fill??F.color;if(C.push(va(de,pe,i(re),F.symbol,we,te,oe,_?n.part:"point")),w>0&&C.push({kind:"circle",part:"hit",cx:de,cy:pe,r:i(re+w),fill:we,opacity:0,title:te,item:oe}),e.labels&&W.label){let De=W.label.length*ie,Be=de-De/2,ht=pe-re-4;U.some(ft=>Math.abs(ft.y-ht)<12&&Be<ft.x+ft.w+4&&Be+De+4>ft.x)||(U.push({x:Be,y:ht,w:De}),y.push(J(de,i(ht),W.label,{part:"point-label",anchor:"middle",fill:"var(--skdx-color-text-default)"})))}}if(e.trendline&&F.data.length>=2){let W=e.trendline===!0?"linear":e.trendline,ee=Si(F.data.map(te=>[te.x,te.y]),W);if(ee){let[te,re]=H.domain,de=`${F.name} trend${W==="linear"?"":` (${W})`}: r\xB2 ${ee.r2.toFixed(2)}`,pe=F.color;if(W==="linear")B.push({kind:"line",part:"trendline",x1:i(H.scale(te)),y1:i(b.scale(ee.predict(te))),x2:i(H.scale(re)),y2:i(b.scale(ee.predict(re))),stroke:pe,dash:"5 4",strokeWidth:1.5,title:de});else{let Z=Array.from({length:40},(oe,we)=>te+(re-te)*we/39).map(oe=>({v:oe,p:ee.predict(oe)})).filter(({p:oe})=>Number.isFinite(oe)).map(({v:oe,p:we})=>({x:i(H.scale(oe)),y:i(b.scale(we))}));Z.length>1&&B.push({kind:"path",part:"trendline",d:nt(Z),stroke:pe,dash:"5 4",strokeWidth:1.5,title:de})}}}}let Y=-1/0,j=Se(H.ticks,Math.max(1,$.width-2*E)),I=new Set;for(let F of[...j].sort((_,W)=>_.pos-W.pos)){let _=F.label.length*ie,W=e.xAxis?.tickRotation??0,ee=W?W<0?"end":"start":Kn(F.pos,F.label,m),te=-(ee==="end"?_:ee==="middle"?_/2:0),re=W*Math.PI/180,de=[te,te+_].flatMap(oe=>[-7,7].map(we=>F.pos+oe*Math.cos(re)-we*Math.sin(re))),pe=Math.min(...de),Z=Math.max(...de);pe<Y+4||(Y=Z,I.add(F))}let G=j.filter(F=>I.has(F)),V={...x,plot:$,xTicks:G,yTicks:b.ticks,baseline:b.zero},Q={plot:$,x:F=>H.scale(Ge(F)),y:F=>b.scale(F)},p=Rt(e.references,Q),q=L&&(f.bottom||f.right)?Xn(L,f.right?{x:$.x+$.width+12,y:$.y,width:f.right,height:$.height}:{x:$.x,y:h-f.bottom+8,width:$.width,height:f.bottom},f.options):[],N=n.opacity;return{...x,shapes:[...We({...V,height:V.height-f.bottom},{xLabel:e.xAxis?.label,x:e.xAxis,y:{showLine:e.yAxis?.showLine,showTicks:e.yAxis?.showTicks,tickSize:e.yAxis?.tickSize,tickRotation:e.yAxis?.tickRotation}}),...e.yAxis?.label?[J(4,$.y-14,e.yAxis.label,{part:"axis-title",anchor:"start"})]:[],...p,...N!==void 0&&C.some(F=>F.part===n.part)?C.map(F=>(F.kind==="circle"||F.kind==="path")&&F.part!=="hit"?{...F,opacity:N}:F):C,...B,...y,...Ln(e.annotations,Q),...q,...x.shapes],issues:t}}function Si(e,n="linear"){let t;if(n==="polynomial"){let l=0,d=0,m=0,h=0,f=0,M=0,$=0,g=0;for(let[S,O]of e)l+=1,d+=S,m+=S*S,h+=S**3,f+=S**4,M+=O,$+=S*O,g+=S*S*O;let w=S=>S[0]*(S[4]*S[8]-S[5]*S[7])-S[1]*(S[3]*S[8]-S[5]*S[6])+S[2]*(S[3]*S[7]-S[4]*S[6]),k=w([f,h,m,h,m,d,m,d,l]);if(Math.abs(k)<1e-12)return;let T=w([g,h,m,$,m,d,M,d,l])/k,D=w([f,g,m,h,$,d,m,M,l])/k,v=w([f,h,g,h,m,$,m,d,M])/k;t=S=>T*S*S+D*S+v}else{let l=n==="logarithmic"||n==="power"?Math.log:M=>M,d=n==="exponential"||n==="power"?Math.log:M=>M,m=e.filter(([M,$])=>Number.isFinite(l(M))&&Number.isFinite(d($))),h=zi(m.map(([M,$])=>[l(M),d($)]));if(!h)return;let f=n==="exponential"||n==="power"?Math.exp:M=>M;t=M=>f(h.intercept+h.slope*l(M))}let r=t,a=e.filter(([l])=>Number.isFinite(r(l)));if(a.length===0)return;let o=a.reduce((l,[,d])=>l+d,0)/a.length,s=0,c=0;for(let[l,d]of a)s+=(d-r(l))**2,c+=(d-o)**2;return{predict:r,r2:c===0?1:Math.max(0,1-s/c)}}function wa(e){let[n,t]=e.sizeRange??[3,18];return Ma(e,{part:"bubble",opacity:.7,radius:(r,[a,o])=>P(r)?o===a?(n+t)/2:n+Math.sqrt((r-a)/(o-a))*(t-n):3,describe:(r,a,o,s)=>`${r}${a.label?` ${a.label}`:""}: ${o.format(a.x)}, ${s.format(a.y)}${P(a.size)?` (${s.format(a.size)})`:""}`})}function zi(e){let n=e.length,t=e.reduce((d,m)=>d+m[0],0)/n,r=e.reduce((d,m)=>d+m[1],0)/n,a=0,o=0,s=0;for(let[d,m]of e)a+=(d-t)**2,o+=(d-t)*(m-r),s+=(m-r)**2;if(a===0)return;let c=o/a,l=s===0?1:o*o/(a*s);return{slope:c,intercept:r-c*t,r2:l}}var Ni=e=>{let n=0;return e.map(t=>P(t)?n+=t:null)},Ri=e=>e.map((n,t)=>{let r=e[t-1];return t>0&&P(n)&&P(r)?n-r:null}),Ei=e=>e.map((n,t)=>{let r=e[t-1];return t>0&&P(n)&&P(r)&&r!==0?(n-r)/Math.abs(r):null});function ka(e,n){let t=Math.max(1,Math.floor(n));return e.map((r,a)=>{if(a<t-1)return null;let o=0;for(let s=a-t+1;s<=a;s++){let c=e[s];if(!P(c))return null;o+=c}return o/t})}function Ts(e,n){let t=Math.max(1,Math.floor(n)),r=2/(t+1),a,o=0,s=0;return e.map(c=>P(c)?a===void 0?(o+=c,s++,s<t?null:(a=o/t,a)):(a=r*c+(1-r)*a,a):a??null)}function Di(e,n="max"){let t=0;for(let r of e)P(r)&&(t=n==="sum"?t+r:Math.max(t,r));return e.map(r=>P(r)?t===0?0:r/t:null)}function Bi(e,n="desc"){let t=e.filter(P).sort((r,a)=>n==="asc"?r-a:a-r);return e.map(r=>P(r)?t.indexOf(r)+1:null)}var Fi=(e,n=-1/0,t=1/0)=>e.map(r=>P(r)&&r>=n&&r<=t?r:null),Pi=(e,n="asc")=>[...e].sort((t,r)=>P(t)?P(r)?n==="asc"?t-r:r-t:-1:P(r)?1:0);function Hi(e,n,t="sum"){let r=Math.max(1,Math.floor(n)),a=[];for(let o=0;o<e.length;o+=r){let s=e.slice(o,o+r).filter(P);if(s.length===0){a.push(null);continue}let c=s.reduce((l,d)=>l+d,0);a.push(t==="sum"?c:t==="mean"?c/s.length:t==="min"?Math.min(...s):Math.max(...s))}return a}function Vi(e,n={}){let t=e.filter(P),r=Un(t,n);return{edges:r,counts:Yn(t,r).map(a=>a.count)}}function $a(e,n){let t=[...e];for(let r of n??[])switch(r.type){case"cumulative":t=Ni(t);break;case"difference":t=Ri(t);break;case"percentageChange":t=Ei(t);break;case"movingAverage":t=ka(t,r.window);break;case"normalize":t=Di(t,r.to);break;case"rank":t=Bi(t,r.order);break;case"filter":t=Fi(t,r.min,r.max);break;case"sort":t=Pi(t,r.order);break;case"aggregate":t=Hi(t,r.every,r.method);break;case"bin":t=Vi(t,r).counts;break}return t}var _i=100,ji=2e3,As=32,Cs=28,jr=e=>e.position==="right"||e.position==="top";function Gi(e){let t=(e.yAxis===void 0?[]:Array.isArray(e.yAxis)?e.yAxis:[e.yAxis]).map((a,o)=>({...a,id:a.id??(o===0?"left":o===1?"right":String(o)),position:a.position??(o===1?"right":"left")}));t.length===0&&t.push({id:"left",position:"left"});let r=t.some(a=>a.id==="right"||jr(a));return e.rightAxis?t.push({...e.rightAxis,id:"right",position:"right"}):!r&&e.series.some(a=>a.axis==="right")&&t.push({id:"right",position:"right"}),t}function Os(e,n){let t=e[0]?.id;return n===void 0||n==="left"?t:n==="right"?(e.find(r=>r.id==="right")??e.find(jr))?.id:e.find(r=>r.id===n)?.id}var _r=e=>e.kind==="bar"||e.kind==="range"&&e.style==="bar";function Et(e,n){let t=ae(e.format),{series:r,categories:a,issues:o,axes:s}=qi(e,n,t),c=e.direction==="rtl",l=e.baseline??0,d=Math.max(a.length,...r.map(A=>Math.max(A.data.length,A.low.length))),m=r.every(A=>Pe(A.data).length===0&&Pe(A.high).length===0),h=le(e,m);if(h)return{...h,issues:o};let f=e.xAxis?.type??"category",M=f!=="category"&&a.length>0&&a.every(A=>typeof A!="string"||f==="time"&&P(Ge(A))),$=M?a.map(Ge):[],[g,w]=Me($),R=e.xAxis?.format??(f==="time"?{style:w-g<2*864e5?"time":"date"}:void 0),k=Array.from({length:d},(A,se)=>{let fe=a[se];return fe===void 0?String(se+1):_t(fe,R)}),T=Wi(e.zoom,d),D=Array.from({length:T.end-T.start},(A,se)=>T.start+se),v=e.orientation==="horizontal",O=r.map(A=>({...A,hidden:A.hidden||v&&!_r(A)})).filter(A=>!A.hidden),E=O.some(A=>!_r(A))?ws(O.filter(A=>!_r(A)).map(A=>D.map(se=>(A.kind==="range"?A.high[se]:A.data[se])??null)),D.length,e.sampling):void 0,z=E?E.map(A=>D[A]):D,L=e.stacked==="percent"||e.stackOffset==="expand",H=e.stackOffset??"zero",b=new Map,x=new Map,C=new Map;for(let A of O)A.stack!==void 0&&A.kind!=="range"&&C.set(A.stack,[...C.get(A.stack)??[],A]);for(let A of C.values()){let se=new Array(d).fill(l),fe=new Array(d).fill(l),Ce=new Array(d).fill(0);if(L)for(let $e of A)$e.data.forEach((ve,Le)=>{P(ve)&&(Ce[Le]=Ce[Le]+Math.abs(ve))});for(let $e of A){let ve=[],Le=[];for(let ke=0;ke<d;ke++){let Ae=$e.data[ke];if(!P(Ae)){ve.push(null),Le.push(null);continue}let ye=Ce[ke],be=L?ye>0?Ae/ye:0:Ae,Oe=be>=0?se:fe;ve.push(Oe[ke]),Oe[ke]=Oe[ke]+be,Le.push(Oe[ke])}b.set($e,ve),x.set($e,Le)}if(H==="silhouette"||H==="wiggle"){let $e=new Array(d).fill(0);if(H==="silhouette")for(let ve=0;ve<d;ve++)$e[ve]=-(se[ve]-l)/2;else{let ve=0;for(let Le=0;Le<d;Le++){let ke=A.length,Ae=0;for(let be=0;be<ke;be++){let Oe=A[be],Re=Oe.data[Le],Fe=Oe.data[Le-1],lt=Le>0&&P(Re)&&P(Fe)?Re-Fe:0;Ae+=(ke-be-.5)*lt}let ye=se[Le]-l;ve=Le===0?-ye/2:ve-(ye>0?Ae/Math.max(1,ke):0),$e[Le]=ve}}for(let ve of A){let Le=b.get(ve),ke=x.get(ve);for(let Ae=0;Ae<d;Ae++){let ye=Le[Ae],be=ke[Ae];P(ye)&&(Le[Ae]=ye+$e[Ae]),P(be)&&(ke[Ae]=be+$e[Ae])}}}}let y=A=>A.kind==="range"?{from:A.low,to:A.high}:{from:b.get(A)??new Array(d).fill(l),to:x.get(A)??A.data},B=A=>{let se=[],fe=!1;for(let ve of O){if(ve.axis!==A)continue;let{from:Le,to:ke}=y(ve);for(let Ae of z){let ye=ke[Ae];if(P(ye)&&se.push(ye),ve.kind==="range"||ve.stack!==void 0){let be=Le[Ae];P(be)&&se.push(be)}}if(ve.errors)for(let Ae of z){let ye=Ls(ve.data[Ae],ve.errors[Ae]);ye&&se.push(ye[0],ye[1])}(ve.kind==="bar"||ve.kind==="area")&&H==="zero"&&(fe=!0)}let[Ce,$e]=Me(se);return fe?[Math.min(l,Ce),Math.max(l,$e)]:[Ce,$e]},{width:U,height:Y}=ce(e),j=e.brush?As+Cs:0,I=z.reduce((A,se)=>Math.max(A,k[se].length),0)*ie,G=L?{style:"percent"}:void 0,V=A=>{if(A.scale==="log")return he.left;let[se,fe]=B(A.id),Ce=ae(A.format??G??e.format);return Vr([A.min??se,A.max??fe],Ce)+(A.showTicks?A.tickSize??4:0)},Q=A=>v?jr(A)?"top":"bottom":jr(A)!==c?"right":"left",p=A=>v?24+(A.showTicks?A.tickSize??4:0):V(A),q=new Set(O.map(A=>A.axis)),N=s.filter(A=>q.has(A.id)||s.length>1),F=new Map,_={left:0,right:0,top:0,bottom:0};for(let A of N){let se=Q(A);F.set(A.id,_[se]),_[se]+=p(A)}let W=N.find(A=>Q(A)==="bottom"),ee=r.map(A=>({name:A.name,color:A.color})),te={top:he.top+me(e,ee,U)+(s.some(A=>A.label)?12:0)+_.top,right:v?c?Math.max(he.left,I+16):he.right:Math.max(he.right,_.right),bottom:he.bottom+j+(e.xAxis?.label?14:0)+(e.xAxis?.tickRotation?24:0)+_.bottom-(W?p(W):0),left:v?c?he.right:Math.max(he.left,I+16):Math.max(he.left,_.left)},re=Ie(U,Y,te),de=v?c?[re.x+re.width,re.x]:[re.x,re.x+re.width]:[re.y+re.height,re.y],pe=v?[re.y,re.y+re.height]:c?[re.x+re.width,re.x]:[re.x,re.x+re.width],Z=new Map(s.map(A=>[A.id,{..._e(B(A.id),de,{format:G,...A},e.format),position:Q(A),offset:F.get(A.id)??0}])),oe=s[0]?.id,we=Z.get(oe),De=A=>Z.get(Os(s,A)??oe)??we,Be=(A,se)=>De(se).scale(A),ht=A=>i(A.scale(Math.min(Math.max(l,Math.min(...A.domain)),Math.max(...A.domain)))),ft=Ve(z.length,pe,e.barGap),pn=z.map(A=>$[A]),Tn=[...pn].sort((A,se)=>A-se),Kt=1/0;for(let A=1;A<Tn.length;A++)Kt=Math.min(Kt,Tn[A]-Tn[A-1]);let[on,it]=Me(pn),pt=Kt===1/0?Math.max(1,Math.abs(it)*.05||1):Kt/2,Xt=tt([on-pt,it+pt],pe),Pn=A=>i(M?Xt(pn[A]):ft.center(A)),Xo=M?Math.abs(Xt(on+(Kt===1/0?pt:Kt))-Xt(on))*.8:ft.bandwidth,Qo=A=>M?Pn(A)-Xo/2:ft.start(A),ii=M?(f==="time"?Zn(on-pt,it+pt):ct(on-pt,it+pt)).filter(A=>A>=on-pt&&A<=it+pt).map(A=>({pos:i(Xt(A)),label:_t(A,R)})):Se(z.map((A,se)=>({pos:Pn(se),label:k[A]})),v?1/0:re.width/Math.max(.2,Math.abs(Math.cos((e.xAxis?.tickRotation??0)*Math.PI/180)))),ra={...ue(e,U,Y,ee),plot:re,xTicks:ii,yTicks:v?Se(we.ticks,re.width):we.ticks,baseline:ht(we)},li=s[0],Jo=We(ra,{horizontal:v,rtl:c,axes:N.map(A=>{let se=Z.get(A.id);return{ticks:v?Se(se.ticks,re.width):se.ticks,position:se.position,offset:se.offset??0,label:A.label,showLine:A.showLine,showTicks:A.showTicks,tickSize:A.tickSize}}),xLabel:e.xAxis?.label,grid:Cn(li),categoryGrid:e.xAxis?.grid===!0,x:e.xAxis}),ci=A=>{if(typeof A=="number"&&a.every(fe=>typeof fe=="string"))return A;let se=typeof A=="string"?A:Ge(A);for(let fe=0;fe<d;fe++){let Ce=a[fe];if(Ce!==void 0&&(typeof se=="string"?Ce===se||k[fe]===se:Ge(Ce)===se))return fe}},es={plot:re,horizontal:v,x:A=>{if(M&&(typeof A!="string"||P(Ge(A))))return Xt(Ge(A));let se=ci(A),fe=se===void 0?-1:z.indexOf(se);return fe<0?void 0:ft.center(fe)},y:(A,se)=>Be(A,se)},ts=Rt(e.references,es);Jo.push(...ts.filter(A=>A.part!=="reference-label"));let di=dt(ts.filter(A=>A.part==="reference-label")),aa=[],oa=new Map;for(let A of O){if(!_r(A))continue;let se=A.stack??A,fe=aa.indexOf(se);fe<0&&(fe=aa.push(se)-1),oa.set(A,fe)}let Nr=Xo/Math.max(1,aa.length),An=Math.min(Nr,e.barWidth??1/0),ns=(Nr-An)/2,sa=[],Rr=[],ia=[],la=[],ca=[],rs=[],Er=[],Dr=A=>De(A.axis).format,da=Math.max(0,e.minBarSize??0),mi=(A,se,fe)=>{let Ce=Math.abs(se-A);if(Ce>=da)return[Math.min(A,se),Ce];let ve=A+(v?fe?1:-1:fe?-1:1)*da;return[Math.min(A,ve),da]},lr=(A,se,fe,Ce)=>({label:Ce,series:A.name,seriesId:A.id??A.name,category:k[se],index:se,value:fe}),as=(A,se,fe,Ce)=>{let $e=Ls(Ce,A.errors?.[se]);if(!$e)return;let ve=i(Be($e[0],A.axis)),Le=i(Be($e[1],A.axis)),ke=4,Ae="var(--skdx-color-text-default)",ye=`${A.name}, ${k[se]}: ${Dr(A)($e[0])} \u2013 ${Dr(A)($e[1])}`;rs.push(v?{kind:"line",part:"error-bar",x1:ve,x2:Le,y1:fe,y2:fe,stroke:Ae,title:ye}:{kind:"line",part:"error-bar",x1:fe,x2:fe,y1:ve,y2:Le,stroke:Ae,title:ye},v?{kind:"line",part:"error-cap",x1:ve,x2:ve,y1:i(fe-ke),y2:i(fe+ke),stroke:Ae}:{kind:"line",part:"error-cap",x1:i(fe-ke),x2:i(fe+ke),y1:ve,y2:ve,stroke:Ae},v?{kind:"line",part:"error-cap",x1:Le,x2:Le,y1:i(fe-ke),y2:i(fe+ke),stroke:Ae}:{kind:"line",part:"error-cap",x1:i(fe-ke),x2:i(fe+ke),y1:Le,y2:Le,stroke:Ae})};for(let A of O){let{from:se,to:fe}=y(A),Ce=Dr(A),$e=z.length<=ji;if(A.kind==="bar"){let ye="";z.forEach((be,Oe)=>{let Re=A.data[be],Fe=se[be],lt=fe[be];if(!P(Re)||!P(Fe)||!P(lt))return;let qn=Be(Fe,A.axis),Hn=Be(lt,A.axis),[cr,dr]=mi(qn,Hn,lt>=Fe),mr=Qo(Oe)+oa.get(A)*Nr+ns,ss=i(v?cr:mr),is=i(v?mr:cr),ma=i(v?dr:An),ls=i(v?An:dr);if(!$e){ye+=`M${ss} ${is}h${ma}v${ls}h${-ma}Z`;return}let cs=br(A.name,k[be],L?lt-Fe:Re,Ce);if(Rr.push({kind:"rect",part:"bar",x:ss,y:is,width:ma,height:ls,fill:A.color,rx:e.radius,title:cs,item:lr(A,be,Re,cs)}),as(A,be,i(mr+An/2),Re),e.labels){let ds=Ce(L?lt-Fe:Re);ca.push(v?J(i(Math.max(qn,Hn)+4),i(mr+An/2),ds,{baseline:"middle"}):J(i(mr+An/2),i(Math.min(qn,Hn)-4),ds,{anchor:"middle"}))}}),ye&&Rr.push({kind:"path",part:"bars",d:ye,fill:A.color,title:A.name});continue}if(A.kind==="range"&&A.style==="bar"){z.forEach((ye,be)=>{let Oe=se[ye],Re=fe[ye];if(!P(Oe)||!P(Re))return;let Fe=Be(Math.min(Oe,Re),A.axis),lt=Be(Math.max(Oe,Re),A.axis),qn=Qo(be)+oa.get(A)*Nr+ns,Hn=`${A.name}, ${k[ye]}: ${Ce(Math.min(Oe,Re))} \u2013 ${Ce(Math.max(Oe,Re))}`,cr=lr(A,ye,Re,Hn),dr=Math.max(1,Math.abs(lt-Fe));Rr.push(v?{kind:"rect",part:"range",x:i(Math.min(Fe,lt)),y:i(qn),width:i(dr),height:i(An),fill:A.color,rx:e.radius,title:$e?Hn:void 0,item:cr}:{kind:"rect",part:"range",x:i(qn),y:i(Math.min(Fe,lt)),width:i(An),height:i(dr),fill:A.color,rx:e.radius,title:$e?Hn:void 0,item:cr})});continue}let ve=e.nulls==="connect"||e.nulls===void 0&&e.connectNulls,Le=[],ke=[];z.forEach((ye,be)=>{let Oe=se[ye],Re=fe[ye];if(!P(Re)||!P(Oe)){!ve&&ke.length&&(Le.push(ke),ke=[]);return}ke.push({x:Pn(be),y:i(Be(Re,A.axis)),y0:i(Be(Oe,A.axis)),i:ye})}),ke.length&&Le.push(ke);let Ae=A.markers??z.length<=_i;for(let ye of Le){let be=nt(ye,A.curve);if(A.kind==="range"&&A.style==="line"){ia.push({kind:"path",part:"range-high",d:be,stroke:A.color,strokeWidth:2,strokeLinejoin:"round"},{kind:"path",part:"range-low",d:nt(ye.map(Oe=>({x:Oe.x,y:Oe.y0})),A.curve),stroke:A.color,strokeWidth:2,strokeLinejoin:"round",dash:"4 3"});continue}if(A.kind==="range"){let Oe=nt([...ye].reverse().map(Re=>({x:Re.x,y:Re.y0})),A.curve);sa.push({kind:"path",part:"range",d:`${be}L${Oe.slice(1)}Z`,fill:A.color,fillOpacity:.2,title:A.name});continue}if(A.kind==="area"){let Oe=ht(De(A.axis)),Re=A.stack!==void 0?nt([...ye].reverse().map(lt=>({x:lt.x,y:lt.y0})),A.curve).slice(1):`${ye[ye.length-1]?.x} ${Oe}L${ye[0]?.x} ${Oe}`,Fe=`skdx-g-${A.index}`;A.gradient&&!Er.some(lt=>lt.id===Fe)&&Er.push({id:Fe,vertical:!0,stops:[{offset:0,color:A.color,opacity:A.fillOpacity},{offset:1,color:A.color,opacity:0}]}),sa.push({kind:"path",part:"area",d:`${be}L${Re}Z`,fill:A.gradient?`url(#${Fe})`:A.color,fillOpacity:A.gradient?void 0:A.fillOpacity})}ia.push({kind:"path",part:"line",d:be,stroke:A.color,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",dash:A.dash})}if(A.kind==="range"&&$e)for(let ye of Le)for(let be of ye){let Oe=A.low[be.i],Re=A.high[be.i],Fe=`${A.name}, ${k[be.i]}: ${Ce(Math.min(Oe,Re))} \u2013 ${Ce(Math.max(Oe,Re))}`;la.push({...Mt(be.x,be.y,.01,A.color,Fe,lr(A,be.i,Re,Fe)),part:"anchor"})}if(A.kind!=="range")for(let ye of Le)for(let be of ye){if(!Ae&&!$e&&!e.labels&&!A.errors)continue;let Oe=A.data[be.i],Re=L?fe[be.i]-se[be.i]:Oe,Fe=br(A.name,k[be.i],Re,Ce);(Ae||$e)&&la.push(Ae&&A.symbol!=="circle"?va(be.x,be.y,A.markerSize,A.symbol,A.color,$e?Fe:void 0,lr(A,be.i,Oe,Fe),"point"):{...Mt(be.x,be.y,Ae?A.markerSize:.01,A.color,$e?Fe:void 0,lr(A,be.i,Oe,Fe)),part:Ae?"point":"anchor"}),$e&&as(A,be.i,v?be.y:be.x,fe[be.i]),e.labels&&ca.push(J(be.x,be.y-8,Ce(Re),{anchor:"middle"}))}}let os={plot:re,xs:v?[]:z.map((A,se)=>Pn(se)),rows:z.map(A=>[k[A],...O.map(se=>{let fe=Dr(se);if(se.kind==="range"){let $e=se.low[A],ve=se.high[A];return`${se.name}: ${P($e)&&P(ve)?`${fe($e)} \u2013 ${fe(ve)}`:"\u2014"}`}let Ce=se.data[A];return`${se.name}: ${P(Ce)?fe(L?(x.get(se)?.[A]??0)-(b.get(se)?.[A]??0):Ce):"\u2014"}`})]),count:d,zoom:T,crosshair:Fr(e)},Br=[];if(e.brush&&!v){let A={x:re.x,y:re.y+re.height+Cs,width:re.width,height:As},se=O.find(Ce=>Ce.kind!=="range"),fe={x:i(A.x+T.start/Math.max(1,d)*A.width),y:A.y,width:i((T.end-T.start)/Math.max(1,d)*A.width),height:A.height};if(Br.push({kind:"rect",part:"brush",x:A.x,y:A.y,width:A.width,height:A.height,fill:"var(--skdx-color-surface-sunken)",stroke:K.grid}),se){let Ce=Pe(se.data),[$e,ve]=Me(Ce),Le=d>1?A.width/(d-1):0,ke=se.data.flatMap((ye,be)=>P(ye)?[{x:i(A.x+be*Le),y:i(A.y+A.height-(ve===$e?.5:(ye-$e)/(ve-$e))*(A.height-4)-2)}]:[]),Ae=nt(ke);ke.length>1&&Br.push({kind:"path",part:"brush-series",d:`${Ae}L${ke[ke.length-1]?.x} ${A.y+A.height}L${ke[0]?.x} ${A.y+A.height}Z`,fill:se.color,fillOpacity:.3})}Br.push({kind:"rect",part:"brush-window",...fe,fill:"var(--skdx-color-primary-500)",opacity:.15,stroke:K.axis},{kind:"rect",part:"brush-handle",x:i(fe.x-3),y:A.y+8,width:6,height:A.height-16,fill:K.axis,rx:8},{kind:"rect",part:"brush-handle",x:i(fe.x+fe.width-3),y:A.y+8,width:6,height:A.height-16,fill:K.axis,rx:8}),os.brush={box:A,window:fe}}return{...ra,shapes:[...Jo,...sa,...Rr,...ia,...rs,...la,...ca,...di,...Ln(e.annotations,es),...Br,...ra.shapes],hit:os,issues:o,defs:Er.length?Er:void 0}}function Ls(e,n){if(!(!P(e)||n===null||n===void 0))return typeof n=="number"?P(n)?[e-Math.abs(n),e+Math.abs(n)]:void 0:P(n[0])&&P(n[1])?[Math.min(n[0],n[1]),Math.max(n[0],n[1])]:void 0}function Wi(e,n){if(!e||n<2)return{start:0,end:n};let t=Math.max(0,Math.min(n-1,Math.floor(e.start))),r=Math.max(t+1,Math.min(n,Math.ceil(e.end)));return r-t<2&&n>=2?{start:Math.min(t,n-2),end:Math.min(t,n-2)+2}:{start:t,end:r}}function qi(e,n,t){let r=k=>k.type??n,a=[],o=Gi(e),s=e.categories??[],c=(e.transforms??[]).filter(k=>k.type==="sort"||k.type==="bin"||k.type==="aggregate"),l=(e.transforms??[]).filter(k=>!c.includes(k)),d=e.stacked||e.stackOffset!==void 0&&e.stackOffset!=="zero",m=(k,T,D)=>{let v=D.filter(S=>S!==null&&!(typeof S=="number"&&Number.isFinite(S))).length;v&&a.push({code:"invalid-value",severity:"warning",message:`Series "${k}" has ${v} value${v===1?"":"s"} that ${v===1?"is":"are"} neither a number nor null; drawn as gaps.`,itemId:T??k}),s.length&&D.length!==s.length&&!e.transform&&a.push({code:"length-mismatch",severity:"warning",message:`Series "${k}" has ${D.length} values for ${s.length} categories.`,itemId:T??k})},h=e.series.map((k,T)=>{let D=r(k),v=d?!0:void 0,S=k.type==="range"?void 0:k.stack,O=S===!1?void 0:S===!0||S===void 0&&v?`${D}`:S;k.type==="range"?(m(k.name,k.id,k.low),m(k.name,k.id,k.high)):m(k.name,k.id,k.data);let E=L=>e.nulls==="zero"?L.map(H=>P(H)?H:0):L,z=Os(o,k.axis);return z===void 0&&a.push({code:"unknown-axis",severity:"warning",message:`Series "${k.name}" names axis "${String(k.axis)}", which is not defined; drawn on the first axis.`,itemId:k.id??k.name}),{name:k.name,id:k.id,color:ne(e,T,k.color),axis:z??o[0]?.id,hidden:xe(e,k.name),index:T,kind:D,data:k.type==="range"?[]:E($a($a(k.data,l),k.transforms)),low:k.type==="range"?k.low:[],high:k.type==="range"?k.high:[],curve:k.curve??e.curve??"linear",dash:k.type==="range"?void 0:k.dash,markers:k.type==="range"?void 0:k.markers,symbol:k.type==="range"?"circle":k.symbol??"circle",markerSize:k.type==="range"?3:k.markerSize??3,errors:k.type==="range"?void 0:k.errors,stack:D==="range"||D==="line"?void 0:O,style:k.type==="range"?k.style??"area":"area",fillOpacity:(k.type==="range"?void 0:k.fillOpacity)??e.fillOpacity??.25,gradient:k.type!=="range"&&k.gradient===!0}}),f=()=>Math.max(s.length,...h.map(k=>Math.max(k.data.length,k.low.length))),M=k=>{let T=v=>v.length?k.map(S=>v[S]??null):v,D=Array.from({length:f()},(v,S)=>s[S]??String(S+1));s=k.map(v=>D[v]),h=h.map(v=>({...v,data:T(v.data),low:T(v.low),high:T(v.high)}))},$=(k,T)=>{let D=(T!==void 0?h.find(S=>S.name===T):void 0)??h.find(S=>!S.hidden&&S.kind!=="range")??h[0];T!==void 0&&!h.some(S=>S.name===T)&&a.push({code:"unknown-series",severity:"warning",message:`sort.by names "${T}", which is not a series; sorted by the first series.`});let v=Array.from({length:f()},(S,O)=>O).sort((S,O)=>{let E=D?.data[S]??D?.high[S],z=D?.data[O]??D?.high[O],L=P(E)?E:-1/0,H=P(z)?z:-1/0;return k==="asc"?L-H:H-L});M(v)},g=k=>{let T=h.flatMap(v=>Pe(v.data)),D=Un(T,k);s=D.slice(1).map((v,S)=>`${t(D[S])}\u2013${t(v)}`),h=h.map(v=>{let S=Pe(v.data),O=0,E=Yn(S,D).map(z=>e.binMode==="density"?S.length?z.count/(S.length*(z.x1-z.x0)):0:e.binMode==="cumulative"?O+=z.count:z.count);return{...v,data:E}})},w=(k,T)=>{let D=Math.max(1,Math.floor(k)),v=f(),S=E=>{if(!E.length)return E;let z=[];for(let L=0;L<v;L+=D){let H=Pe(E.slice(L,L+D));z.push(H.length===0?null:T==="sum"?H.reduce((b,x)=>b+x,0):T==="mean"?H.reduce((b,x)=>b+x,0)/H.length:T==="min"?Math.min(...H):Math.max(...H))}return z};s=Array.from({length:v},(E,z)=>s[z]??String(z+1)).filter((E,z)=>z%D===0),h=h.map(E=>({...E,data:S(E.data),low:S(E.low),high:S(E.high)}))};e.transform==="histogram"?g({bins:e.bins,binWidth:e.binWidth,domain:e.binDomain}):e.transform==="cumulative"&&(h=h.map(k=>{let T=0;return{...k,data:k.data.map(D=>P(D)?T+=D:T)}}));for(let k of c)k.type==="sort"?$(k.order??"desc"):k.type==="bin"?g(k):k.type==="aggregate"&&w(k.every,k.method??"sum");typeof e.sort=="string"?$(e.sort):e.sort&&$(e.sort.order,e.sort.by);let R=e.xAxis?.domain;if(R){let k=f(),T=Array.from({length:k},(O,E)=>s[E]??String(E+1)),D=O=>{let E=typeof O=="string"?O:Ge(O);return T.findIndex(z=>typeof E=="string"?z===E||_t(z)===E:Ge(z)===E)},v=R.map(D),S=O=>O.length?v.map(E=>E<0?null:O[E]??null):O;s=[...R],h=h.map(O=>({...O,data:S(O.data),low:S(O.low),high:S(O.high)}))}return{series:h,categories:s,issues:a,axes:o}}var Ia=e=>Et(e,"bar");var Ta=e=>Et(e,"line"),Aa=e=>Et(e,"area");function Sn(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var Ca=e=>e.id??e.name??e.series,Ss=e=>e.seriesId??e.series;function sn(e,n){let t=!1;return n.id!==void 0&&(t=!0,Ca(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,Ss(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}var La=(e,n,t=Sn(n))=>t.some(r=>sn(e,r)),jn=e=>Sn(e).flatMap(n=>n.id!==void 0?[n.id]:[]);function zn(e){let n={},t=Ca(e);t!==void 0&&(n.id=t);let r=Ss(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var Oa=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function Sa(e,n,t){let r=Sn(e),a=zn(n),o=r.some(s=>sn(n,s));return t==="single"?o?[]:[a]:o?r.filter(s=>!sn(n,s)):[...r,a]}var Zi=.2;function Ui(e){let n=K.focus;switch(e.kind){case"rect":return{kind:"rect",part:"selected",x:e.x-1.5,y:e.y-1.5,width:e.width+3,height:e.height+3,fill:"none",stroke:n,rx:e.rx};case"circle":return{kind:"circle",part:"selected",cx:e.cx,cy:e.cy,r:e.r+2.5,fill:"none",stroke:n};case"path":return{kind:"path",part:"selected",d:e.d,fill:"none",stroke:n,strokeWidth:2.5};case"line":return{...e,part:"selected",stroke:n,strokeWidth:(e.strokeWidth??1)+3,title:void 0,item:void 0};case"text":return}}var Yi=(e,n)=>e.kind==="text"?{...e,fill:K.grid}:{...e,opacity:(e.opacity??1)*n};function za(e,n){let t=Sn(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:Sn(n.highlighted),a=r[0];if(t.length===0&&!a)return e;let o={highlighted:n.highlightScope?.highlighted??"item",faded:n.highlightScope?.faded??"global"},s=[],c=m=>!a||r.some(h=>sn(m,h))?!0:o.highlighted==="series"?r.some(h=>h.series!==void 0&&sn(m,{series:h.series})):!1,l=m=>{if(!a||o.faded==="none"||c(m))return!1;if(o.faded==="series"){let h=a.series;return h!==void 0&&sn(m,{series:h})}return!0},d=e.shapes.map(m=>{let h=m.item;if(!h||h.legend)return m;if(t.some(f=>sn(h,f))){let f=Ui(m);f&&s.push(f)}return l(h)?Yi(m,Zi):m});return s.length?{...e,shapes:[...d,...s]}:{...e,shapes:d}}var xr=2*Math.PI;function Ze(e,n,t,r,a,o){let s=(d,m)=>`${i(e+d*Math.sin(m))} ${i(n-d*Math.cos(m))}`;if(o-a>=xr-1e-9){let d=a+xr/2;return`${Ze(e,n,t,r,a,d)}${Ze(e,n,t,r,d,o)}`}let c=o-a>Math.PI?1:0,l=`M${s(t,a)}A${t} ${t} 0 ${c} 1 ${s(t,o)}`;return r>0?`${l}L${s(r,o)}A${r} ${r} 0 ${c} 0 ${s(r,a)}Z`:`${l}L${i(e)} ${i(n)}Z`}function Ki(e,n,t,r,a,o,s){let c=o-a;if(s<=0||c>=xr-1e-9)return Ze(e,n,t,r,a,o);let l=Math.sin(Math.min(Math.PI/2,c/2)),d=Math.min(s,r>0?(t-r)/2:t/2,t*l/(1+l));if(r>0&&l<1&&(d=Math.min(d,r*l/(1-l))),d<=.25)return Ze(e,n,t,r,a,o);let m=(w,R)=>`${i(e+w*Math.sin(R))} ${i(n-w*Math.cos(R))}`,h=w=>`A${i(d)} ${i(d)} 0 0 1 ${w}`,f=Math.asin(d/(t-d)),M=Math.sqrt((t-d)**2-d*d),$=o-a-2*f>Math.PI?1:0,g=`M${m(M,a)}${h(m(t,a+f))}A${t} ${t} 0 ${$} 1 ${m(t,o-f)}${h(m(M,o))}`;if(r>0){let w=Math.asin(d/(r+d)),R=Math.sqrt((r+d)**2-d*d),k=o-a-2*w>Math.PI?1:0;g+=`L${m(R,o)}${h(m(r,o-w))}A${r} ${r} 0 ${k} 0 ${m(r,a+w)}${h(m(R,a))}Z`}else g+=`L${i(e)} ${i(n)}Z`;return g}function Na(e){let n=[];for(let V of e.data)P(V.value)&&V.value<0&&n.push({code:"negative-value",severity:"warning",message:`"${V.name}" is negative (${V.value}); a share of a whole cannot be, so it is drawn as zero.`,itemId:V.id??V.name});let t=le(e,!e.data.some(V=>P(V.value)&&V.value>0),300,300);if(t)return{...t,issues:n};let r=ae(e.format),a=e.percentFormat?ae(e.percentFormat):V=>`${Math.round(V*100)}%`,o=Math.max(0,e.cornerRadius??0),{width:s,height:c}=ce(e,300,300),l=e.data.map((V,Q)=>({name:V.name,color:ne(e,Q,V.color)})),d=me(e,l,s),m=(e.startAngle??0)*Math.PI/180,h=(e.endAngle??(e.startAngle??0)+360)*Math.PI/180,f=Math.max(0,Math.min(xr,h-m)),M=f<=Math.PI+1e-9&&Math.abs(Math.sin(m))>.99,$=e.labels&&e.labelPosition==="outside",g=s/2,w=Math.max(.2,Math.min(1,e.outerRadius??1)),R=$?40:8,k=(M?Math.max(0,Math.min(s/2,c-d)-R):Math.max(0,Math.min(s,c-d)/2-R))*w,T=M?m<0||m>Math.PI?c-R:d+R:d+(c-d)/2,D=k*Math.min(.95,Math.max(0,e.innerRadius??(e.variant==="donut"?.6:0))),v=e.data.map((V,Q)=>({...V,i:Q,value:P(V.value)&&!xe(e,V.name)?Math.max(0,V.value):0})),S=e.sort?[...v].sort((V,Q)=>e.sort==="asc"?V.value-Q.value:Q.value-V.value):v,O=S.reduce((V,Q)=>V+Q.value,0),E=S.filter(V=>V.value>0).length,z=Math.max(0,Math.min((e.padAngle??0)*Math.PI/180,f/Math.max(1,E)/2)),L=f>=xr-1e-9,H=E>1?L?E:E-1:0,b=f-H*z,x=Math.min((e.minAngle??0)*Math.PI/180,b/Math.max(1,E)),C=S.map(V=>O>0?V.value/O*b:0);if(x>0)for(let V=0;V<S.length;V++){let Q=S.map((N,F)=>N.value>0&&C[F]<x);if(!Q.some(Boolean))break;let p=Q.filter(Boolean).length*x,q=S.reduce((N,F,_)=>N+(Q[_]||F.value<=0?0:F.value),0);if(S.forEach((N,F)=>{C[F]=Q[F]?x:q>0?N.value/q*(b-p):0}),!S.some((N,F)=>N.value>0&&!Q[F]&&C[F]<x))break}let y=Sn(e.selected),B=m+(L&&H?z/2:0),U=[],Y=[],j=[],I=S.map((V,Q)=>{let p=O>0?V.value/O:0,q=B,N=B+C[Q];p>0&&(B=N+z);let F=a(p),_=`${V.name}: ${r(V.value)} (${F})`,W={label:_,id:V.id??V.name,name:V.name,index:V.i,value:V.value},ee=(q+N)/2;if(e.labels&&p>0){let re=`${V.name} ${F}`;if($){let de=Math.sin(ee),pe=i(T-(k+14)*Math.cos(ee));j.some(Z=>Math.abs(Z-pe)<12)||(j.push(pe),Y.push({kind:"line",part:"label-connector",x1:i(g+k*de),y1:i(T-k*Math.cos(ee)),x2:i(g+(k+12)*de),y2:i(T-(k+12)*Math.cos(ee)),stroke:K.axis}),U.push(_n(i(g+(k+16)*de),pe,re,s,{part:"slice-label",anchor:de>.1?"start":de<-.1?"end":"middle",baseline:"middle",fill:"var(--skdx-color-text-default)"})))}else if(p>.03){let de=(k+D)/2;U.push(_n(i(g+de*Math.sin(ee)),i(T-de*Math.cos(ee)),re,s,{part:"slice-label",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-on-accent)"}))}}let te=La(W,void 0,y)?Math.max(4,k*.06):0;return{kind:"path",part:"slice",d:p>0?Ki(g+te*Math.sin(ee),T-te*Math.cos(ee),k,D,q,N,o):"",fill:ne(e,V.i,V.color),title:_,item:p>0?W:void 0}});e.centerLabel&&U.push(J(i(g),i(M?T-12:T),e.centerLabel,{part:"center-label",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-default)",weight:"bold"}));let G=ue(e,s,c,l);return{...G,shapes:dt([...I,...Y,...G.shapes,...U]),issues:n}}var bt=2;function Ra(e){let n=Pe(e.data),t=le(e,n.length===0,120,32);if(t)return t;let r=ae(e.format),{width:a,height:o}=ce(e,120,32),s=e.data.length,c=n[0],l=n[n.length-1],d=e.lastValue?r(l):"",m=a-bt-(d?d.length*ie+6:0),h=e.variant??"area",f=h==="winloss",M=[...n,...e.band??[],...e.target!==void 0?[e.target]:[]],$=tt(f?[-1,1]:Nt(M,h==="bar"),[o-bt,bt]),g=e.x&&e.x.length>=s?e.x.map(Ge):void 0,[w,R]=g?Me(g):[0,1],k=tt([w,R],[bt,m]),T=E=>s<2?(bt+m)/2:g?R===w?(bt+m)/2:k(g[E]):bt+E/(s-1)*(m-bt),D=e.trend?l>=c?K.positive:K.negative:ne(e,0,e.color),v=[];if(e.band&&!f){let[E,z]=e.band,L=Math.min($(E),$(z));v.push({kind:"rect",part:"band",x:bt,y:i(L),width:i(Math.max(0,m-bt)),height:i(Math.abs($(z)-$(E))),fill:K.axis,opacity:.12,title:`${r(Math.min(E,z))} \u2013 ${r(Math.max(E,z))}`})}e.target!==void 0&&P(e.target)&&!f&&v.push({kind:"line",part:"target",x1:bt,x2:i(m),y1:i($(e.target)),y2:i($(e.target)),stroke:K.axis,dash:"3 2",title:`Target: ${r(e.target)}`});let S=e.data.flatMap((E,z)=>P(E)?[{x:i(T(z)),y:i($(E)),v:E,i:z}]:[]),O=S[S.length-1];if(h==="bar"||f){let E=s>0?(m-bt)/s:0,z=i($(0));e.data.forEach((L,H)=>{if(!P(L))return;let b=i($(f?Math.sign(L):L));v.push({kind:"rect",part:"bar",x:i(bt+H*E+E*.1),y:Math.min(b,z),width:i(Math.max(1,E*.8)),height:i(Math.max(1,Math.abs(z-b))),fill:f?L<0?K.negative:K.positive:L<0&&e.trend?K.negative:D,title:e.tooltip===!1?void 0:r(L)})})}else{let E=nt(S,e.curve),z=S[0];h==="area"&&v.push({kind:"path",part:"area",d:E&&z&&O?`${E}L${O.x} ${o-bt}L${z.x} ${o-bt}Z`:"",fill:D,fillOpacity:.15}),v.push({kind:"path",part:"line",d:E,stroke:D,strokeWidth:1.5});let L=e.markers??["last"];O&&L.includes("last")&&v.push(Mt(O.x,O.y,2,D,void 0)),z&&L.includes("first")&&v.push({...Mt(z.x,z.y,2,D,void 0),part:"first"})}if(e.extremes&&S.length>1){let E=S.reduce((L,H)=>H.v<L.v?H:L),z=S.reduce((L,H)=>H.v>L.v?H:L);v.push({...Mt(E.x,E.y,2.5,K.negative,r(E.v)),part:"min"},{...Mt(z.x,z.y,2.5,K.positive,r(z.v)),part:"max"})}return d&&O&&v.push(J(i(m+4),O.y,d,{part:"last-value",baseline:"middle",fill:"var(--skdx-color-text-default)"})),{...ue(e,a,o),shapes:v}}function Ea(e){let n=e.metrics??(e.categories??[]).map(I=>({label:I})),t=le(e,n.length===0||e.series.every(I=>Pe(I.data).length===0),300,300);if(t)return t;let r=[],a=ae(e.format),{width:o,height:s}=ce(e,300,300),c=e.series.map((I,G)=>({name:I.name,color:ne(e,G,I.color)})),l=me(e,c,o),d=o/2,m=l+(s-l)/2,h=Math.max(0,Math.min(o,s-l)/2-36),f=n.length,M=(e.startAngle??0)*Math.PI/180-Math.PI/2,$=I=>M+I*2*Math.PI/Math.max(1,f),g=e.series.filter(I=>!xe(e,I.name)),w=e.normalize===!0?"series":e.normalize===!1||e.normalize===void 0?e.metrics?"metric":"none":e.normalize;w==="series"&&g.length>1&&r.push({code:"misleading-scale",severity:"warning",message:"normalize: 'series' scales each series to its own maximum, so polygons cannot be compared in magnitude; prefer 'metric' or 'none'."});let R=Math.max(1,Math.round(e.levels??4)),k=e.max??Math.max(0,Me(g.flatMap(I=>I.data))[1]),T=w==="none"?ct(0,k,R):Array.from({length:R+1},(I,G)=>100*G/R),D=w==="none"?e.max??T[T.length-1]:100,v=n.map((I,G)=>{let V=g.map(F=>F.data[G]),[Q,p]=Me(V),q=I.min??Math.min(0,Q),N=ct(q,I.max??p,R);return{min:q,max:I.max??N[N.length-1]}}),S=e.series.map(I=>Math.max(0,Me(I.data)[1])),O=(I,G,V)=>{if(w==="series")return S[I]>0?V/S[I]*100:0;if(w==="metric"){let Q=v[G];return Q.max>Q.min?(V-Q.min)/(Q.max-Q.min)*100:0}return V},E=(I,G)=>{let V=D>0?Math.max(0,Math.min(G,D))/D*h:0;return{x:i(d+V*Math.cos($(I))),y:i(m+V*Math.sin($(I)))}},z=I=>f===0?"":`M${n.map((G,V)=>{let Q=E(V,I(V));return`${Q.x} ${Q.y}`}).join("L")}Z`,L=I=>{if(e.gridShape==="circle"){let G=D>0?I/D*h:0;return{kind:"circle",part:"grid",cx:i(d),cy:i(m),r:i(G),fill:"none",stroke:K.grid}}return{kind:"path",part:"grid",d:z(()=>I),stroke:K.grid}},H=T.filter(I=>I>0&&I<=D),b=I=>w==="none"?a(I):w==="series"?`${I}%`:(()=>{let G=v[0];return ae(n[0]?.format??e.format)(G.min+(G.max-G.min)*I/100)})(),x=[...H.map(L),...n.map((I,G)=>{let V=E(G,D);return{kind:"line",part:"grid",x1:i(d),y1:i(m),x2:V.x,y2:V.y,stroke:K.grid}}),...H.map(I=>J(i(d+4),E(0,I).y,b(I),{part:"y-label",baseline:"middle"})),...n.map((I,G)=>{let V=Math.cos($(G)),Q=h+14;return J(i(d+Q*V),i(m+Q*Math.sin($(G))),I.label,{part:"x-label",anchor:V>.1?"start":V<-.1?"end":"middle",baseline:"middle"})})],C=[],y=[],B=[],U=e.markers??!0,Y=e.markerSize??3;e.series.forEach((I,G)=>{if(xe(e,I.name))return;let V=ne(e,G,I.color),Q=p=>{let q=I.data[p];return P(q)?O(G,p,q):0};n.forEach((p,q)=>{let N=I.data[q];if(!P(N))return;let F=ae(p.format??e.format),_=E(q,O(G,q,N)),W=br(I.name,p.label,N,F);C.push({...Mt(_.x,_.y,U?Y:.01,V,W,{label:W,id:p.id,series:I.name,seriesId:I.id,category:p.label,index:q,value:N}),part:U?"point":"anchor"}),e.labels&&B.push(J(_.x,i(_.y-7),F(N),{part:"value-label",anchor:"middle",fill:"var(--skdx-color-text-default)"}))}),y.push({kind:"path",part:"area",d:z(Q),fill:e.fill??!0?V:void 0,fillOpacity:.25,stroke:V,strokeWidth:2,title:I.name,item:{label:I.name,series:I.name,seriesId:I.id}})});let j=ue(e,o,s,c);return{...j,shapes:[...x,...y,...C,...B,...j.shapes],issues:r}}var Gr={top:24,right:8,bottom:8,left:64},Da=864e5,Ba=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];function Xi(e,n="monday"){let t=n==="sunday"?[Ba[6],...Ba.slice(0,6)]:Ba,r=e.map(g=>({day:Math.floor(new Date(g.date).getTime()/Da),value:g.value})).filter(g=>Number.isFinite(g.day));if(r.length===0)return{rows:t,columns:[],data:t.map(()=>[]),dates:t.map(()=>[])};let[a,o]=Me(r.map(g=>g.day)),s=n==="sunday"?4:3,c=g=>((g+s)%7+7)%7,l=a-c(a),d=Math.floor((o-l)/7)+1,m=t.map(()=>new Array(d).fill(null)),h=t.map(()=>new Array(d).fill(void 0));for(let g of r){let w=Math.floor((g.day-l)/7);m[c(g.day)][w]=g.value,h[c(g.day)][w]=new Date(g.day*Da).toISOString().slice(0,10)}let f=new Intl.DateTimeFormat(void 0,{month:"short"}),M=-1,$=Array.from({length:d},(g,w)=>{let R=new Date((l+w*7+6)*Da),k=R.getUTCMonth();return k===M?"":(M=k,f.format(R))});return{rows:t,columns:$,data:m,dates:h}}var Qi=e=>e.colorScale??(e.diverging?{type:"diverging",steps:e.steps}:{type:"sequential",domain:e.domain,steps:e.steps}),zs=(e,n)=>{let t=e.map((r,a)=>a);return n&&t.sort((r,a)=>(n==="asc"?1:-1)*(e[r]-e[a])),t};function Fa(e){let n=[],t=e.calendar?Xi(e.calendar,e.weekStart):void 0,r=t?.rows??e.rows??[],a=t?.columns??e.columns??[],o=t?.data??e.data??[];!t&&(o.length!==r.length||o.some(b=>b.length!==a.length))&&n.push({code:"ragged-matrix",severity:"warning",message:`The matrix is ${o.length} \xD7 ${o[0]?.length??0} but there are ${r.length} rows and ${a.length} columns; missing cells are blank.`});let s=o.flat().filter(b=>b!=null&&!P(b)).length;s&&n.push({code:"invalid-value",severity:"warning",message:`${s} cell${s===1?" is":"s are"} neither a number nor null; drawn as blank.`});let c=o.flat(),l=le(e,r.length===0||a.length===0||!c.some(P));if(l)return{...l,issues:n};let d=ae(e.format),{width:m,height:h}=ce(e),f=On(e.colorLegend),M=Ie(m,h,{...Gr,left:t?40:Gr.left,right:Gr.right+f.right,bottom:Gr.bottom+f.bottom}),$=b=>b.reduce((x,C)=>x+(P(C)?C:0),0),g=zs(r.map((b,x)=>$(o[x]??[])),e.rowOrder),w=zs(a.map((b,x)=>$(o.map(C=>C[x]))),e.columnOrder),R=g.map(b=>r[b]),k=w.map(b=>a[b]),T=M.width/Math.max(1,k.length),D=M.height/Math.max(1,R.length),v=wt(Qi(e),c,ne(e,0,e.color),e.negativeColor,d),S=[],O=[],E=e.cellGap??(t?1:0),z=e.cellRadius??(t?2:0);R.forEach((b,x)=>{k.forEach((C,y)=>{let B=o[g[x]]?.[w[y]],U=t?.dates[g[x]]?.[w[y]],Y=t?U??b:`${b}, ${C}`,j=i(M.x+y*T+E),I=i(M.y+x*D+E),G={x:j,y:I,width:i(Math.max(0,T-2*E)),height:i(Math.max(0,D-2*E)),rx:z||void 0};if(!P(B)){e.missingColor&&(!t||U)&&S.push({kind:"rect",part:"missing",...G,fill:e.missingColor,title:`${Y}: \u2014`});return}let V=v.color(B),Q=`${Y}: ${d(B)}`;S.push({kind:"rect",part:"cell",...G,fill:V.fill,opacity:V.opacity,title:Q,item:{label:Q,id:t?U:`${b}:${C}`,category:C,name:b,index:y,value:B}}),e.labels&&T>24&&D>12&&O.push(J(i(M.x+(y+.5)*T),i(M.y+(x+.5)*D),d(B),{part:"cell-label",anchor:"middle",baseline:"middle",fill:V.opacity>=.5?"var(--skdx-color-text-on-accent)":"var(--skdx-color-text-default)"}))})});let L=ue(e,m,h),H=e.colorLegend?Xn(v,f.right?{x:M.x+M.width+12,y:M.y,width:f.right,height:M.height}:{x:M.x,y:M.y+M.height+8,width:M.width,height:f.bottom},f.options):[];return{...L,shapes:[...R.map((b,x)=>J(M.x-8,i(M.y+(x+.5)*D),b,{part:"y-label",anchor:"end",baseline:"middle"})),...k.flatMap((b,x)=>b?[J(i(M.x+(x+.5)*T),M.y-8,b,{part:"x-label",anchor:t?"start":"middle"})]:[]),...S,...O,...H,...L.shapes],issues:n}}var Wr=8;function Pa(e){let n=e.variant==="pyramid",t=[],r=e.sort??(n?"asc":void 0),a=e.data.filter(x=>P(x.value)?!0:(t.push({code:"invalid-value",severity:"warning",message:`Stage "${x.name}" has no valid value and was dropped.`,itemId:x.id??x.name}),!1)).sort((x,C)=>r==="asc"?x.value-C.value:r==="desc"?C.value-x.value:0),o=le(e,a.length===0,400,300);if(o)return{...o,issues:t};let s=ae(e.format),{width:c,height:l}=ce(e,400,300),d=a.length,m=e.orientation==="horizontal",h=Math.max(0,e.gap??4),f=e.labelPosition??"inside",M=Math.max(0,...a.map(x=>x.value)),$=a.reduce((x,C)=>x+Math.max(0,C.value),0),g=a[0]?.value??0,w=a.map((x,C)=>({name:x.name,color:ne(e,C,x.color)})),R=me(e,w,c),k=m?c:l-R,T=m?l-R:c,D=f==="outside",v=Math.max(0,(D?T*2/3:T)-2*Wr),S=d===0?0:(k-2*Wr)/d,O=Math.max(0,Math.min(1,e.neckWidth??0)),E=x=>M>0?(O+(1-O)*(Math.max(0,x)/M))*v:0,z=e.percentFormat?ae(e.percentFormat):x=>`${Math.round(x*100)}%`,L=(m?R+(l-R)/2:c/2)-(D?T/6:0),H=a.flatMap((x,C)=>{let y=E(x.value),B=E(a[C+1]?.value??x.value),U=Wr+C*S+(m?0:R),Y=U+S-h,j=n?$>0?x.value/$:0:g>0?x.value/g:0,I=a[C-1]?.value,G=I!==void 0&&I>0?x.value/I-1:0,V=!n&&I!==void 0&&I>0?` \xB7 ${G<0?"\u2212":G>0?"+":""}${z(Math.abs(G))} from ${a[C-1]?.name}`:"",Q=`${x.name}: ${s(x.value)} (${z(j)})${V}`,q={kind:"path",part:"stage",d:m?`M${i(U)} ${i(L-y/2)}L${i(U)} ${i(L+y/2)}L${i(Y)} ${i(L+B/2)}L${i(Y)} ${i(L-B/2)}Z`:`M${i(L-y/2)} ${i(U)}L${i(L+y/2)} ${i(U)}L${i(L+B/2)} ${i(Y)}L${i(L-B/2)} ${i(Y)}Z`,fill:ne(e,C,x.color),title:Q,item:{label:Q,id:x.id??x.name,name:x.name,index:C,value:x.value}};if(f==="none")return[q];let N=`${x.name} \xB7 ${s(x.value)}`,F=(U+Y)/2;if(D){let W=L+v/2+Wr;return[q,_n(i(m?F:W),i(m?W:F),N,c,{part:"stage-label",anchor:m?"middle":"start",baseline:m?"hanging":"middle",fill:"var(--skdx-color-text-default)"})]}let _=_n(i(m?F:L),i(m?L:F),N,c,{part:"stage-label",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-default)"});return[q,{kind:"rect",part:"stage-label-background",x:i(_.x-(_.text.length*ie+8)/2),y:i((m?L:F)-9),width:_.text.length*ie+8,height:18,rx:8,fill:"var(--skdx-color-surface-default)"},_]}),b=ue(e,c,l,w);return{...b,shapes:[...H,...b.shapes],issues:t}}var Ns=e=>e*Math.PI/180;function Ha(e){let n=e.data.filter(O=>P(O.value)),t=le(e,n.length===0,300,300);if(t)return t;let r=ae(e.format),{width:a,height:o}=ce(e,300,300),s=n.map((O,E)=>({name:O.name,color:ne(e,E,O.color)})),c=me(e,s,a),l=a/2,d=c+(o-c)/2,m=Math.max(0,Math.min(a,o-c)/2-(e.bands?20:8)),h=m*Math.min(.95,Math.max(0,e.innerRadius??.3)),f=Ns(e.startAngle??0),M=Ns(e.endAngle??(e.startAngle??0)+360),$=Math.max(0,Math.min(2*Math.PI,M-f)),g=e.max??Math.max(0,...n.map(O=>O.value)),w=n.length,R=Math.max(0,e.gap??.25),k=w===0?0:(m-h)/(w+R*(w-1)),T=e.rounded??!0,D=O=>g>0?Math.max(0,Math.min(1,O/g)):0,v=[];for(let O of e.bands??[]){let E=f+D(O.from)*$,z=f+D(O.to)*$;z<=E||v.push({kind:"path",part:"band",d:Ze(l,d,m+14,m+6,E,z),fill:vt(O.variant),opacity:.6,title:`${r(O.from)} \u2013 ${r(O.to)}`})}if(n.forEach((O,E)=>{if(xe(e,O.name))return;let z=m-E*k*(1+R),L=z-k,H=ne(e,E,O.color),b=f+D(O.value)*$,x=`${O.name}: ${r(O.value)} (${Math.round(D(O.value)*100)}%)`;if((e.track??!0)&&v.push({kind:"path",part:"track",d:Ze(l,d,z,L,f,f+$),fill:K.grid,opacity:.6}),b>f&&(v.push({kind:"path",part:"bar",d:Ze(l,d,z,L,f,b),fill:H,title:x,item:{label:x,id:O.id,name:O.name,index:E,value:O.value}}),T&&$<2*Math.PI-1e-9)){let C=(L+z)/2;for(let y of[f,b])v.push({kind:"circle",part:"bar-cap",cx:i(l+C*Math.sin(y)),cy:i(d-C*Math.cos(y)),r:i(k/2),fill:H})}if(e.labels){let C=(L+z)/2;v.push(J(i(l+C*Math.sin(f)-6*Math.cos(f)),i(d-C*Math.cos(f)-6*Math.sin(f)),`${O.name} ${r(O.value)}`,{part:"bar-label",anchor:Math.cos(f)>=0?"end":"start",baseline:"middle"}))}}),e.target!==void 0&&P(e.target)){let O=f+D(e.target)*$,E=m-w*k*(1+R)+k*R;v.push({kind:"line",part:"target",x1:i(l+E*Math.sin(O)),y1:i(d-E*Math.cos(O)),x2:i(l+(m+4)*Math.sin(O)),y2:i(d-(m+4)*Math.cos(O)),stroke:"var(--skdx-color-text-default)",strokeWidth:2,title:`Target: ${r(e.target)}`})}e.centerLabel&&v.push(J(i(l),i(d),e.centerLabel,{part:"center-label",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-default)",weight:"bold"}));let S=ue(e,a,o,s);return{...S,shapes:[...v,...S.shapes]}}var Rs=e=>e*Math.PI/180;function Ji(e,n){let t=[0],r=[0],a=o=>{t.push(Math.sin(o)),r.push(-Math.cos(o))};a(e),a(n);for(let o=Math.ceil(e/(Math.PI/2));o*(Math.PI/2)<=n;o++)a(o*(Math.PI/2));return{x0:Math.min(...t),y0:Math.min(...r),x1:Math.max(...t),y1:Math.max(...r)}}function Va(e){let n=le(e,!P(e.value),300,300);if(n)return n;let t=ae(e.format),{width:r,height:a}=ce(e,300,300),o=me(e),s=P(e.min)?e.min:0,c=P(e.max)?e.max:100,l=e.startAngle??-120,d=e.endAngle??120,m=Rs(l),h=Rs(Math.max(l,Math.min(l+360,d))),f=h-m,M=_=>c>s?Math.max(0,Math.min(1,(_-s)/(c-s))):0,$=_=>m+M(_)*f,g=e.variant==="solid",w=e.ticks===!1?0:e.ticks===!0||e.ticks===void 0?5:e.ticks,R=e.tickLabels??!0,k=Array.from({length:w},(_,W)=>w===1?s:s+(c-s)*W/(w-1)),T=w>0&&R,D=T?Math.max(...k.map(_=>t(_).length))*ie:0,v=T?14+D:10,S=T?26:10,O=Ji(m,h),E=Math.max(O.x1-O.x0,.2),z=Math.max(O.y1-O.y0,.2),L=Math.max(0,Math.min((r-2*v)/E,(a-o-2*S)/z)),H=r/2-(O.x0+O.x1)/2*L,b=o+(a-o)/2-(O.y0+O.y1)/2*L,x=L*Math.max(.04,Math.min(.6,e.thickness??.18)),C=L-x,y=(_,W)=>({x:i(H+_*Math.sin(W)),y:i(b-_*Math.cos(W))}),B=[],U=`${t(s)} \u2013 ${t(c)}`,Y=(e.bands??[]).filter(_=>P(_.from)&&P(_.to)),j=_=>Y.find(W=>_>=W.from&&_<=W.to),I=_=>_.color??vt(_.variant);B.push({kind:"path",part:"track",d:Ze(H,b,L,C,m,h),fill:K.grid,opacity:.6});for(let _ of Y){let W=$(Math.min(_.from,_.to)),ee=$(Math.max(_.from,_.to));if(ee<=W)continue;let te=`${_.label?`${_.label}: `:""}${t(_.from)} \u2013 ${t(_.to)}`;B.push(g?{kind:"path",part:"band",d:Ze(H,b,L+6,L+2,W,ee),fill:I(_),opacity:.7,title:te}:{kind:"path",part:"band",d:Ze(H,b,L,C,W,ee),fill:I(_),opacity:.75,title:te})}let G=`${e.caption??"Value"}: ${t(e.value)} (${U})`,V={label:G,name:e.caption,value:e.value},Q=$(e.value);if(g){let _=j(e.value),W=_?I(_):ne(e,0);Q>m+1e-6?B.push({kind:"path",part:"value",d:Ze(H,b,L,C,m,Q),fill:W,title:G,item:V}):B.push({...el(H,b),title:G,item:V})}else{let _=y(C-4,Q),W=4,ee=y(W,Q-Math.PI/2),te=y(W,Q+Math.PI/2);B.push({kind:"path",part:"needle",d:`M${ee.x} ${ee.y}L${_.x} ${_.y}L${te.x} ${te.y}Z`,fill:"var(--skdx-color-text-default)",title:G,item:V},{kind:"circle",part:"hub",cx:i(H),cy:i(b),r:5,fill:"var(--skdx-color-text-default)"})}for(let _ of k){let W=$(_),ee=y(L+2,W),te=y(L+7,W);if(B.push({kind:"line",part:"tick",x1:ee.x,y1:ee.y,x2:te.x,y2:te.y,stroke:K.axis}),R){let re=y(L+12,W),de=Math.sin(W);B.push(J(re.x,re.y,t(_),{part:"tick-label",anchor:de>.3?"start":de<-.3?"end":"middle",baseline:"middle"}))}}if(P(e.target)){let _=$(e.target),W=y(C-2,_),ee=y(L+4,_);B.push({kind:"line",part:"target",x1:W.x,y1:W.y,x2:ee.x,y2:ee.y,stroke:"var(--skdx-color-text-default)",strokeWidth:2,title:`Target: ${t(e.target)}`})}let q=f<2*Math.PI-1e-6?O.y1<.2?b-C*.4:b+C*.45:b;B.push(J(i(H),i(q),e.centerLabel??t(e.value),{part:"center-label",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-default)",weight:"bold"})),e.caption&&B.push(J(i(H),i(q+16),e.caption,{part:"caption",anchor:"middle",baseline:"middle"}));let N=ue(e,r,a),F=P(e.target)?`, target ${t(e.target)}`:"";return{...N,description:e.description??`${e.caption??"Value"} ${t(e.value)} on a scale from ${t(s)} to ${t(c)}${F}.`,shapes:[...B,...N.shapes]}}var el=(e,n)=>({kind:"circle",part:"anchor",cx:i(e),cy:i(n),r:.01,fill:"none"});function _a(e){let[n,t]=e.sizeRange??[4,24],r=ae(e.zAxis?.format??e.format),a=e.zAxis?.label,o=e.xAxis?.label,s=e.yAxis?.label,c=(l,d)=>l?`${l} ${d}`:d;return Ma({...e,series:e.series.map(l=>({name:l.name,id:l.id,color:l.color,data:l.data.filter(d=>P(d.x)&&P(d.y)).map(d=>({x:d.x,y:d.y,size:P(d.z)?Math.max(0,d.z):0,label:d.label,id:d.id,color:d.color,value:d.value??d.z}))}))},{part:"bubble",opacity:.7,radius:(l,[,d])=>d>0&&P(l)?Math.max(n,Math.sqrt(l/d)*t):n,describe:(l,d,m,h)=>`${l}${d.label?` ${d.label}`:""}: ${c(o,m.format(d.x))}, ${c(s,h.format(d.y))}, ${c(a,r(d.size??0))}`})}function ja(e){let n=Pe(e.data),t=le(e,n.length===0);if(t)return t;let r=Un(n,{bins:e.bins,binWidth:e.binWidth,domain:e.domain,thresholds:e.thresholds}),a=Yn(n,r),o=a.reduce((g,w)=>g+w.count,0),s=e.mode??"count",c=ae(e.xAxis?.format??e.format),l=ae(s==="percent"?{style:"percent",digits:1}:s==="density"?{style:"decimal",digits:3}:e.format),d=e.name??(s==="density"?"Density":s==="percent"?"Share":"Count"),m=g=>s==="density"?o>0&&g.x1>g.x0?g.count/(o*(g.x1-g.x0)):0:s==="percent"?o>0?g.count/o:0:g.count,h=a.map(g=>`${c(g.x0)}\u2013${c(g.x1)}`),f=Et({...e,format:l,series:[{name:d,data:a.map(m),color:e.color}],categories:h,xAxis:e.xAxis?.label?{label:e.xAxis.label}:void 0,barGap:e.barGap??.05,transform:void 0},"bar"),M=f.shapes.map((g,w)=>{if(g.part!=="bar"||!g.item||g.item.index===void 0)return g;let R=a[g.item.index];if(!R)return g;let k=o>0?` (${Math.round(R.count/o*1e3)/10}%)`:"",T=`${h[g.item.index]??String(w)}: ${R.count}${k}${s==="count"?"":` \xB7 ${d} ${l(m(R))}`}`;return{...g,title:g.title===void 0?void 0:T,item:{...g.item,label:T}}}),$=f.hit?.rows.map((g,w)=>{let R=a[w];return R?[g[0],`${d}: ${l(m(R))}`,`Observations: ${R.count}`]:g});return{...f,shapes:M,hit:f.hit&&$?{...f.hit,rows:$}:f.hit}}function tl(e,n){let t=[],r=n;for(let a of e??[]){let o=typeof a=="number"?{from:r,to:a}:a;P(o.to)&&(t.push(o),r=o.to)}return t}function yr(e){let n=e.data.filter(v=>P(v.value)),t=le(e,n.length===0,600,40+44*Math.max(1,e.data.length));if(t)return t;let r=ae(e.format),a=e.orientation==="vertical",{width:o,height:s}=ce(e,600,a?300:40+44*n.length),c=v=>v.ranges??e.ranges,l=n.flatMap(v=>[v.value,v.target,...(c(v)??[]).map(S=>typeof S=="number"?S:S.to)]),[d,m]=Me(l),h=e.min??Math.min(0,d),f=Math.max(0,...n.map(v=>v.name.length))*ie,M=Ie(o,s,{top:he.top+me(e),right:e.labels&&!a?56:he.right,bottom:he.bottom,left:a?he.left:Math.max(he.left,f+16)}),$=a?[M.y+M.height,M.y]:[M.x,M.x+M.width],g=_e([h,Math.max(h,m)],$,{min:h,max:e.max,ticks:e.ticks},e.format),w=Ve(n.length,a?[M.x,M.x+M.width]:[M.y,M.y+M.height],.3),R=ue(e,o,s),k=n.map((v,S)=>({pos:i(w.center(S)),label:v.name})),T=We({...R,plot:M,xTicks:a?Se(k,M.width):k,yTicks:a?g.ticks:Se(g.ticks,M.width),baseline:g.zero},{horizontal:!a}),D=(v,S,O,E,z)=>{let L=g.scale(v),H=g.scale(S),b=Math.max(1,Math.abs(H-L));return a?{kind:"rect",x:i(O-E/2),y:i(Math.min(L,H)),width:i(E),height:i(b),...z}:{kind:"rect",x:i(Math.min(L,H)),y:i(O-E/2),width:i(b),height:i(E),...z}};return n.forEach((v,S)=>{if(xe(e,v.name))return;let O=w.center(S),E=w.bandwidth,z=tl(c(v),h);z.forEach((x,C)=>{let y=`${v.name} ${x.label??`range ${C+1}`}: ${r(x.from)} \u2013 ${r(x.to)}`;T.push(D(x.from,x.to,O,E,{part:"range",fill:x.color??(x.variant?vt(x.variant):K.axis),opacity:x.variant||x.color?.25:Math.max(.1,.4-C*.1),title:y}))});let L=P(v.target)?` \xB7 target ${r(v.target)}`:"",H=z.find(x=>v.value>=x.from&&v.value<=x.to),b=`${v.name}: ${r(v.value)}${L}${H?.label?` (${H.label})`:""}`;if(T.push(D(Math.min(h,v.value),v.value,O,E/3,{part:"measure",fill:ne(e,S,v.color),title:b,item:{label:b,id:v.id,name:v.name,index:S,value:v.value}})),P(v.target)){let x=i(g.scale(v.target));T.push({kind:"line",part:"target",x1:a?i(O-E/2.5):x,x2:a?i(O+E/2.5):x,y1:a?x:i(O-E/2.5),y2:a?x:i(O+E/2.5),stroke:"var(--skdx-color-text-default)",strokeWidth:3,title:`${v.name} target: ${r(v.target)}`})}if(e.labels){let x=g.scale(P(v.target)?Math.max(v.value,v.target):v.value);T.push(a?J(i(O),i(x-6),r(v.value),{part:"value-label",anchor:"middle"}):J(i(x+6),i(O),r(v.value),{part:"value-label",baseline:"middle"}))}}),{...R,shapes:[...T,...R.shapes]}}var Ga=e=>Et(e,"bar");function Wa(e){let n=e.variant??"area";return Et({...e,series:e.series.map(t=>({type:"range",name:t.name,low:t.low,high:t.high,color:t.color,axis:t.axis,curve:t.curve,style:n}))},"bar")}var qr=e=>Math.round(e*1e6)/1e6,Es=60,nl=500;function qa(e){let n=[],t=new Map;for(let Z of e.nodes)t.has(Z.id)?n.push({code:"duplicate-id",severity:"warning",message:`Node id "${Z.id}" is duplicated; the first definition is kept.`,itemId:Z.id}):t.set(Z.id,Z);let r=Z=>Z.group,a=[...t.values()].filter(Z=>!(Z.group!==void 0&&xe(e,Z.group))),o=new Set(a.map(Z=>Z.id)),s=e.edges.filter(Z=>{let oe=o.has(Z.source)&&o.has(Z.target);return!oe&&!(t.has(Z.source)&&t.has(Z.target))&&n.push({code:"unknown-node",severity:"warning",message:`Edge ${Z.source} \u2192 ${Z.target} names a node that does not exist and was dropped.`,itemId:Z.id}),oe}),c=le(e,a.length===0);if(c)return{...c,issues:n};let l=ae(e.format),{width:d,height:m}=ce(e),[h,f]=e.nodeRange??[5,16],M=e.labels??a.length<=Es,$=[...new Set(e.nodes.map(r).filter(Z=>Z!==void 0))],g=$.map((Z,oe)=>({name:Z,color:ne(e,oe)})),w=Ie(d,m,{top:me(e,g,d)+f+8,right:f+(M?48:8),bottom:f+8,left:f+8}),R=(Z,oe)=>Z.color??ne(e,Z.group!==void 0?$.indexOf(Z.group):oe),[,k]=Me(a.map(Z=>Z.value)),T=Z=>P(Z)&&k>0?h+Math.sqrt(Math.max(0,Z)/k)*(f-h):h,D=new Map;for(let Z of s)D.set(Z.source,(D.get(Z.source)??0)+1),Z.target!==Z.source&&D.set(Z.target,(D.get(Z.target)??0)+1);let v=a.length,S=new Map(a.map((Z,oe)=>[Z.id,oe])),O,E,z=e.arrange??"force";z==="manual"&&a.every(Z=>P(Z.x)&&P(Z.y))?(O=a.map(Z=>Z.x),E=a.map(Z=>Z.y)):z==="circular"||z==="manual"||v<3?(O=a.map((Z,oe)=>qr(Math.cos(2*Math.PI*oe/v-Math.PI/2))),E=a.map((Z,oe)=>qr(Math.sin(2*Math.PI*oe/v-Math.PI/2)))):{xs:O,ys:E}=rl(v,s.map(Z=>[S.get(Z.source),S.get(Z.target)]),e.iterations??Math.max(50,Math.min(300,Math.floor(3e4/v))));let[L,H]=Me(O),[b,x]=Me(E),C=Math.max(H-L,x-b)||1,y=Math.min(w.width/C,w.height/C),B=w.x+(w.width-(H-L)*y)/2,U=w.y+(w.height-(x-b)*y)/2,Y=a.map((Z,oe)=>({node:Z,index:oe,x:i(B+(O[oe]-L)*y),y:i(U+(E[oe]-b)*y),r:i(T(Z.value)),color:R(Z,oe),degree:D.get(Z.id)??0})),j=new Map(Y.map(Z=>[Z.node.id,Z])),I=jn(e.selected)[0],G=I!==void 0?j.get(String(I)):void 0,V=new Set;if(G){V.add(G.node.id);for(let Z of s)Z.source===G.node.id&&V.add(Z.target),Z.target===G.node.id&&V.add(Z.source)}let Q=(Z,oe=Z)=>G&&!(V.has(Z)&&V.has(oe))?.15:void 0,p=Z=>!G||Z.source===G.node.id||Z.target===G.node.id,[,q]=Me(s.map(Z=>Z.value)),N=s.length<=nl,F=[],_=(Z,oe,we)=>F.some(De=>Math.abs(De.y-oe)<12&&Z<De.x+De.w+4&&Z+we+4>De.x)?!1:(F.push({x:Z,y:oe,w:we}),!0),W=[],ee=[],te=s.map(Z=>{let oe=j.get(Z.source),we=j.get(Z.target),De=P(Z.value)&&q>0?1+3*Math.sqrt(Math.max(0,Z.value)/q):1,Be=`${oe.node.label??oe.node.id} \u2192 ${we.node.label??we.node.id}${Z.label?` ${Z.label}`:""}${P(Z.value)?`: ${l(Z.value)}`:""}`,ht=p(Z)?Q(Z.source,Z.target):.15,ft=N?{label:Be,id:Z.id,name:Z.source,category:Z.target,value:Z.value}:void 0;if(oe===we){let it=oe.r*2.5;return{kind:"path",part:"edge",d:`M${i(oe.x)} ${i(oe.y-oe.r)}C${i(oe.x-it)} ${i(oe.y-it*1.5)} ${i(oe.x+it)} ${i(oe.y-it*1.5)} ${i(oe.x)} ${i(oe.y-oe.r)}`,stroke:K.axis,strokeWidth:De,opacity:ht??.7,title:N?Be:void 0,item:ft}}let pn=Math.sqrt((we.x-oe.x)*(we.x-oe.x)+(we.y-oe.y)*(we.y-oe.y))||1,Tn=(we.x-oe.x)/pn,Kt=(we.y-oe.y)/pn;if(e.directed){let it=we.x-Tn*we.r,pt=we.y-Kt*we.r,Xt=it-Tn*6,Pn=pt-Kt*6;W.push({kind:"path",part:"arrow",d:`M${i(it)} ${i(pt)}L${i(Xt-Kt*3)} ${i(Pn+Tn*3)}L${i(Xt+Kt*3)} ${i(Pn-Tn*3)}Z`,fill:K.axis,opacity:ht??.7})}let on=`${Z.label??""}${P(Z.value)?`${Z.label?": ":""}${l(Z.value)}`:""}`;if(e.edgeLabels&&on){let it=(oe.x+we.x)/2,pt=(oe.y+we.y)/2,Xt=on.length*ie;_(it-Xt/2,pt,Xt)&&ee.push(J(i(it),i(pt),on,{part:"edge-label",anchor:"middle",baseline:"middle"}))}return{kind:"path",part:"edge",d:`M${i(oe.x)} ${i(oe.y)}L${i(we.x)} ${i(we.y)}`,stroke:K.axis,strokeWidth:De,opacity:ht??.7,title:N?Be:void 0,item:ft}}),re=[],de=[];for(let Z of Y){let oe=Z.node.label??Z.node.id,we=P(Z.node.value)?`: ${l(Z.node.value)}`:"",De=Z.node.group!==void 0?` \xB7 ${Z.node.group}`:"",Be=`${oe}${we}${De} \xB7 ${Z.degree} connection${Z.degree===1?"":"s"}`;if(re.push({kind:"circle",part:"node",cx:Z.x,cy:Z.y,r:Z.r,fill:Z.color,stroke:G?.node.id===Z.node.id?"var(--skdx-color-text-default)":"var(--skdx-color-surface-default)",opacity:Q(Z.node.id),title:Be,item:{label:Be,name:Z.node.id,category:Z.node.group,index:Z.index,value:Z.node.value}}),!M)continue;let ht=oe.length*ie,ft=Z.x+Z.r+4,pn=Z.y;_(ft,pn,ht)&&de.push(J(i(ft),i(pn),oe,{part:"node-label",baseline:"middle",fill:Q(Z.node.id)===void 0?"var(--skdx-color-text-default)":K.grid}))}let pe=ue(e,d,m,g);return{...pe,shapes:[...te,...W,...re,...ee,...de,...pe.shapes],issues:n}}function rl(e,n,t){let r=Array.from({length:e},(l,d)=>qr(Math.cos(2*Math.PI*d/e))),a=Array.from({length:e},(l,d)=>qr(Math.sin(2*Math.PI*d/e))),o=Math.sqrt(4/e),s=new Array(e).fill(0),c=new Array(e).fill(0);for(let l=0;l<t;l++){let d=.1*(1-l/t)+.005;s.fill(0),c.fill(0);for(let m=0;m<e;m++)for(let h=m+1;h<e;h++){let f=r[m]-r[h],M=a[m]-a[h];f===0&&M===0&&(f=.001*(m%7+1),M=.001*(h%5+1));let $=f*f+M*M,g=o*o/$;s[m]=s[m]+f*g,c[m]=c[m]+M*g,s[h]=s[h]-f*g,c[h]=c[h]-M*g}for(let[m,h]of n){if(m===h)continue;let f=r[m]-r[h],M=a[m]-a[h],$=Math.sqrt(f*f+M*M)||1e-6,g=$*$/o/$;s[m]=s[m]-f*g,c[m]=c[m]-M*g,s[h]=s[h]+f*g,c[h]=c[h]+M*g}for(let m=0;m<e;m++){let h=Math.sqrt(s[m]*s[m]+c[m]*c[m])||1e-6,f=Math.min(h,d);r[m]=r[m]+s[m]/h*f,a[m]=a[m]+c[m]/h*f}}return{xs:r,ys:a}}var Za=14;function Ua(e){let n=[],t=e.events.map((C,y)=>({event:C,index:y,time:new Date(C.date).getTime()})).filter(C=>Number.isFinite(C.time)?!(C.event.group!==void 0&&xe(e,C.event.group)):(n.push({code:"invalid-value",severity:"warning",message:`Event "${C.event.label}" has an unparseable date and was dropped.`,itemId:C.event.id??C.event.label}),!1)).sort((C,y)=>C.time-y.time||C.index-y.index),r=le(e,t.length===0);if(r)return{...r,issues:n};let{width:a,height:o}=ce(e),s=e.orientation==="vertical",c=[...new Set(e.events.map(C=>C.group).filter(C=>C!==void 0))],l=c.length?c:[""],[d,m]=Me(t.map(C=>C.time)),h=e.xAxis?.format??{style:m-d<2*864e5?"time":"date"},f=C=>_t(C,h),M=e.labels??!0,$=t.map(C=>{let y=C.event.group,B=C.event.color??(C.event.variant?vt(C.event.variant):ne(e,y===void 0?0:c.indexOf(y))),U=C.event.description?` \u2014 ${C.event.description}`:"";return{...C,lane:y===void 0?0:c.indexOf(y),color:B,text:`${C.event.label} \xB7 ${f(C.time)}${U}`}}),g=c.map((C,y)=>({name:C,color:ne(e,y)})),w=ue(e,a,o,g),R=C=>({label:C.text,id:C.event.id,name:C.event.label,category:C.event.group,index:C.index,value:C.time}),k=[];if(s){let C=Math.max(...$.map(Y=>f(Y.time).length))*ie+16,y=Ie(a,o,{top:8+me(e,g,a),right:8,bottom:8,left:C+12}),B=Ve($.length,[y.y,y.y+y.height],0),U=i(y.x);return k.push({kind:"line",part:"axis",x1:U,x2:U,y1:y.y,y2:y.y+y.height,stroke:K.axis}),$.forEach((Y,j)=>{let I=i(B.center(j));if(k.push(J(i(y.x-12),I,f(Y.time),{part:"x-label",anchor:"end",baseline:"middle"}),{kind:"circle",part:"event",cx:U,cy:I,r:5,fill:Y.color,stroke:"var(--skdx-color-surface-default)",title:Y.text,item:R(Y)}),M){let G=Y.event.description,V=B.step>=2*Za&&G;k.push(J(i(y.x+12),V?i(I-7):I,Y.event.label,{part:"event-label",baseline:"middle",fill:"var(--skdx-color-text-default)"})),V&&k.push(J(i(y.x+12),i(I+7),G,{part:"event-description",baseline:"middle"}))}}),{...w,shapes:[...k,...w.shapes],issues:n}}let T=c.length?Math.max(...c.map(C=>C.length))*ie+16:8,D=Math.max(f(d).length,f(m).length)*ie/2+4,v=Ie(a,o,{top:8+me(e,g,a),right:Math.max(16,D),bottom:32+(e.xAxis?.label?14:0),left:Math.max(16,T,D)}),S=(m-d)*.04||36e5,O=tt([d-S,m+S],[v.x,v.x+v.width]),E=Zn(d-S,m+S).filter(C=>C>=d-S&&C<=m+S).map(C=>({pos:i(O(C)),label:f(C)}));for(let C of Se(E,v.width))k.push({kind:"line",part:"grid",x1:C.pos,x2:C.pos,y1:v.y,y2:v.y+v.height,stroke:K.grid},J(C.pos,v.y+v.height+20,C.label,{part:"x-label",anchor:"middle"}));e.xAxis?.label&&k.push(J(i(v.x+v.width/2),o-4,e.xAxis.label,{part:"axis-title",anchor:"middle"}));let z=Ve(l.length,[v.y,v.y+v.height],0),L=Math.max(0,Math.floor((z.step/2-14)/Za));l.forEach((C,y)=>{let B=i(z.center(y));k.push({kind:"line",part:"axis",x1:v.x,x2:v.x+v.width,y1:B,y2:B,stroke:K.axis}),C&&k.push(J(v.x-8,B,C,{part:"y-label",anchor:"end",baseline:"middle"}))});let H=l.map(()=>[]),b=[],x=[];for(let C of $){let y=i(O(C.time)),B=i(z.center(C.lane));if(x.push({kind:"circle",part:"event",cx:y,cy:B,r:5,fill:C.color,stroke:"var(--skdx-color-surface-default)",title:C.text,item:R(C)}),!M)continue;let U=C.event.label.length*ie,Y=y-U/2,j=H[C.lane],I=0;for(;I<=L&&(j[I]??-1/0)>Y-6;)I++;if(I>L)continue;j[I]=Y+U;let G=i(B-12-I*Za),V=i(Math.max(U/2+2,Math.min(a-U/2-2,y)));I>0&&b.push({kind:"line",part:"connector",x1:y,x2:y,y1:i(B-6),y2:i(G+4),stroke:K.grid}),b.push(J(V,G,C.event.label,{part:"event-label",anchor:"middle",fill:"var(--skdx-color-text-default)"}))}return{...w,shapes:[...k,...b,...x,...w.shapes],issues:n}}var Ds="var(--skdx-radius-default, var(--skdx-radius-md, 0.5rem))";function Zr(e){return["tooltip","skeleton","label-background","stage-label-background","brush-handle"].includes(e)?Ds:void 0}function er(e,n,t,r,a){let o=e.getBoundingClientRect();return{x:o.width?(n-o.left)*r/o.width:n,y:o.height?(t-o.top)*a/o.height:t}}var Ya=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function Bs(e,n){let t=0,r=1/0;return e.xs.forEach((a,o)=>{let s=Math.abs(a-n);s<r&&(r=s,t=o)}),t}function vr(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=Bs(t,n),a=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(a,r)??a}}function Ka(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[Bs(t,n)];return{kind:"line",part:"crosshair",x1:r,x2:r,y1:t.plot.y,y2:t.plot.y+t.plot.height,stroke:K.axis,dash:"3 3"}}function Xa(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!Ya(r.plot,n,t))return[];let a=Ka(e,n),{rows:o}=vr(e,n),s=e.tooltipAnchored?r.plot.y+8:t;return[a,...Hr(a.x1,s,o,e.width,e.height,e.tooltipPlacement)]}function Qa(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 a=t.xs[r];return Xa(e,a,t.plot.y+8)}function Ja(e,n,t,r,a){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:l,y:d}=er(t,r,a,e.width,e.height);if(Ya(e.hit.plot,l,d)){let m=vr(e,l),h=Ka(e,l);if(m&&h)return{lines:m.rows,shapes:[h]}}}let o=n?.closest?.("[data-skdx-part]"),s=e.tooltipFormatter?Nn(e,n)?.item:void 0,c=s&&e.tooltipFormatter?.(s)||o&&Array.from(o.children).find(l=>l.tagName.toLowerCase()==="title")?.textContent;return c?{lines:Array.isArray(c)?c:[c],shapes:[]}:{lines:[],shapes:[]}}function Fs(e,n,t,r,a,o,s){let c=e?.closest?.("[data-skdx-part]"),l=s&&s.tooltipFormatter?Nn(s,e)?.item:void 0,d=l&&s?.tooltipFormatter?.(l)||c&&Array.from(c.children).find($=>$.tagName.toLowerCase()==="title")?.textContent;if(!d)return[];let m=s?.tooltipAnchored?Nn(s,e):void 0,h=m?s?.shapes[m.index]:void 0,{x:f,y:M}=h?Mr(h):er(n,t,r,a,o);return Hr(f,M,d,a,o,s?.tooltipPlacement)}function eo(e,n,t,r,a){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:s}=er(t,r,a,e.width,e.height),c=Xa(e,o,s);if(c.length>0)return c}return Fs(n,t,r,a,e.width,e.height,e)}function to(e,n){let t=Nn(e,n);return t&&!t.item.legend?zn(t.item):null}var al=(e,n)=>{let{x:t,y:r}=Mr(e),a=e.kind==="circle"?e.cy:e.kind==="rect"?e.y+e.height/2:r;return t>=n.x&&t<=n.x+n.width&&a>=n.y&&a<=n.y+n.height};function no(e,n){let t=new Set,r=[];for(let a of e.shapes){if(!a.item||a.item.legend||a.part==="anchor"||!al(a,n))continue;let o=zn(a.item),s=JSON.stringify(o);t.has(s)||(t.add(s),r.push(o))}return r}var ro=e=>({kind:"rect",part:"selection-box",x:i(e.x),y:i(e.y),width:i(e.width),height:i(e.height),fill:K.focus,opacity:.12,stroke:K.focus}),Yr=(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 Ps(e,n,t){let r=!1;for(let a=0,o=e.length-1;a<e.length;o=a++){let s=e[a],c=e[o];s.y>t!=c.y>t&&n<(c.x-s.x)*(t-s.y)/(c.y-s.y)+s.x&&(r=!r)}return r}function ao(e,n){if(n.length<3)return[];let t=new Set,r=[];for(let a of e.shapes){if(!a.item||a.item.legend||a.part==="anchor")continue;let{x:o,y:s}=Mr(a),c=a.kind==="circle"?a.cy:a.kind==="rect"?a.y+a.height/2:s;if(!Ps(n,o,c))continue;let l=zn(a.item),d=JSON.stringify(l);t.has(d)||(t.add(d),r.push(l))}return r}var oo=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${i(n.x)} ${i(n.y)}`).join("L")}`:"",fill:K.focus,fillOpacity:.12,stroke:K.focus,dash:"4 3"}),Ur=6;function so(e,n,t){let r=e.edit;if(r){for(let a of r.bars)if(!(t<a.y||t>a.y+a.height||n<a.x0-Ur||n>a.x1+Ur))return Math.abs(n-a.x0)<=Ur?{bar:a,mode:"start"}:Math.abs(n-a.x1)<=Ur?{bar:a,mode:"end"}:{bar:a,mode:"move"}}}function io(e,n,t){let r=e.edit;return Hs(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function lo(e,n,t){let r=e.edit,a=t.key==="ArrowRight"?1:t.key==="ArrowLeft"?-1:0;if(!r||n===null||!a||!(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",c=r.snap??r.invert(o.x0+10)-r.invert(o.x0);return Hs(r,{bar:o,mode:s},a*c)}function Hs(e,{bar:n,mode:t},r){let a=c=>e.snap?Math.round(c/e.snap)*e.snap:c,o=n.start,s=n.end;return t==="move"?(o=a(n.start+r),s=o+(n.end-n.start)):t==="start"?o=Math.min(a(n.start+r),n.end):s=Math.max(a(n.end+r),n.start),{id:n.id,name:n.name,start:o,end:s}}function co(e,n,t){let r=e.edit,a=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:i(Math.min(a,o)),y:i(n.bar.y),width:i(Math.max(1,Math.abs(o-a))),height:i(n.bar.height),fill:K.focus,opacity:.25,stroke:K.focus,rx:2}}var ol=64,sl=e=>Math.max(1,Math.min(ol,e));function mo(e,n,t,r){let a=n>0?.8:1.25,o=sl(e.view.zoom*a);if(o===e.view.zoom)return e.view;let{plot:s,scale:c}=e,[l,d]=e.view.center,m=(t-(s.x+s.width/2))/c,h=(r-(s.y+s.height/2))/c,f=e.view.zoom/o;return{center:[l+m*(1-f),e.fromY(e.toY(d)-h*(1-f))],zoom:o}}function uo(e,n,t,r){let{scale:a}=e;return{center:[n.center[0]-t/a,e.fromY(e.toY(n.center[1])+r/a)],zoom:n.zoom}}function Nn(e,n){let t=n?.closest?.("[data-skdx-i]"),r=Number(t?.getAttribute("data-skdx-i")),a=Number.isInteger(r)?e.shapes[r]?.item:void 0;return a?{index:r,item:a}:void 0}var Kr=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function Mr(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 ho(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let r=K.focus,a;switch(t.kind){case"rect":a={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":a={kind:"circle",part:"focus",cx:t.cx,cy:t.cy,r:t.r+3,fill:"none",stroke:r};break;case"line":a={kind:"line",part:"focus",x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:r,strokeWidth:4};break;case"text":a={kind:"rect",part:"focus",x:t.x-2,y:t.y-8,width:t.text.length*ie+4,height:16,fill:"none",stroke:r,rx:2};break;case"path":a={kind:"path",part:"focus",d:t.d,stroke:r,strokeWidth:2,fill:"none"};break}let{x:o,y:s}=Mr(t),c=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[a,...c?Hr(i(o),i(s),c,e.width,e.height):[]]}function fo(e,n,t){let r=Kr(e);if(r.length===0)return;let a=n===null?-1:r.indexOf(n);switch(t){case"ArrowRight":case"ArrowDown":return r[Math.min(r.length-1,a+1)];case"ArrowLeft":case"ArrowUp":return r[Math.max(0,a<=0?0:a-1)];case"Home":return r[0];case"End":return r[r.length-1];case"Escape":return null;default:return}}var Qn=2,Jn=(e,n,t)=>{let r=Math.max(Qn,Math.min(t,Math.round(n))),a=Math.max(0,Math.min(t-r,Math.round(e)));return{start:a,end:a+r}},Vs=(e,n)=>!e||e.start<=0&&e.end>=n;function po(e,n,t){if(e.count<=Qn||!e.plot.width)return;let{start:r,end:a}=e.zoom,o=a-r,s=n>0?1.25:.8,c=Math.max(Qn,Math.min(e.count,Math.round(o*s)));if(c===o)return n>0&&!Vs(e.zoom,e.count)?Jn(r,c,e.count):void 0;let l=Math.max(0,Math.min(1,(t-e.plot.x)/e.plot.width)),d=r+l*o;return Jn(d-l*c,c,e.count)}function bo(e,n,t,r){let a=n.end-n.start,o=Math.max(Qn,Math.min(e.count,Math.round(a/Math.max(.05,t)))),s=Math.max(0,Math.min(1,(r-e.plot.x)/Math.max(1,e.plot.width)));return Jn(n.start+s*a-s*o,o,e.count)}function go(e,n,t){let r=n.end-n.start,a=e.plot.width/Math.max(1,r);return Jn(n.start-t/a,r,e.count)}function xo(e,n,t){let r=e.brush;if(!r||!Ya(r.box,n,t))return;let a=r.window;if(Math.abs(n-a.x)<=6)return{grab:"left",zoom:e.zoom};if(Math.abs(n-(a.x+a.width))<=6)return{grab:"right",zoom:e.zoom};if(n>a.x&&n<a.x+a.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:Jn(s-o/2,o,e.count)}}function yo(e,n,t,r){let a=e.brush;if(!a)return t;let o=r/Math.max(1,a.box.width)*e.count;if(n==="move")return Jn(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-Qn,Math.round(t.start+o))),end:t.end};let s=Math.min(e.count,Math.max(t.start+Qn,Math.round(t.end+o)));return{start:t.start,end:s}}function Qr(e,n){switch(n.type){case"svg":return Promise.resolve(Xr(e,n.label,n.resolve));case"csv":return Promise.resolve(Jr(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=Xr(e,n.label,n.resolve);return Gs(t,e.width,e.height,n.scale,n.background)}}}var bn=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;"),wr=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${bn(String(t))}"`).join("");function _s(e){let n=e.title?`<title>${bn(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${wr([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${wr([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${wr([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${wr([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${wr([t,["aria-label",e.title],["x",e.x],["y",e.y],["text-anchor",e.anchor],["dominant-baseline",e.baseline],["fill",e.fill],["font-weight",e.weight],["transform",e.rotate?`rotate(${e.rotate} ${e.x} ${e.y})`:void 0]])}>${bn(e.text)}</text>`}}function js(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${bn(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="${bn(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function Xr(e,n,t){let r=js(e)+e.shapes.map(_s).join("");return t&&(r=r.replace(/var\((--[\w-]+)\)/g,(a,o)=>t(o).trim()||a)),`<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="${bn(n)}" font-family="${bn(K.fontFamily)}" font-size="${bn(K.fontSize)}"><title>${bn(n)}</title>${r}</svg>`}function Gs(e,n,t,r=2,a){return new Promise((o,s)=>{let c=URL.createObjectURL(new Blob([e],{type:"image/svg+xml;charset=utf-8"})),l=new Image;l.onload=()=>{URL.revokeObjectURL(c);let d=document.createElement("canvas");d.width=Math.round(n*r),d.height=Math.round(t*r);let m=d.getContext("2d");if(!m)return s(new Error("canvas 2d context unavailable"));a&&(m.fillStyle=a,m.fillRect(0,0,d.width,d.height)),m.drawImage(l,0,0,d.width,d.height),d.toBlob(h=>h?o(h):s(new Error("toBlob failed")),"image/png")},l.onerror=()=>{URL.revokeObjectURL(c),s(new Error("svg could not be decoded"))},l.src=c})}function Jr(e){let n=t=>{let r=t==null?"":String(t);return/[",\n\r]/.test(r)?`"${r.replace(/"/g,'""')}"`:r};return e.map(t=>t.map(n).join(",")).join(`\r
3
+ `)}function Ws(e,n=[]){let t=Math.max(n.length,...e.map(a=>a.data.length)),r=[["",...e.map(a=>a.name)]];for(let a=0;a<t;a++){let o=n[a];r.push([o instanceof Date?o.toISOString():o??a+1,...e.map(s=>s.data[a])])}return Jr(r)}var Ee=e=>P(e.value)?e.value:(e.children??[]).reduce((n,t)=>n+Ee(t),0),vo=e=>P(e.value)||(e.children??[]).some(vo),kr=e=>e.length===0?0:1+Math.max(...e.map(n=>kr(n.children??[]))),Ke=e=>e.id??e.name;function qs(e,n){for(let t of e){if(Ke(t)===n||t.name===n)return[t];let r=qs(t.children??[],n);if(r)return[t,...r]}}var tr=(e,n)=>n==="asc"||n==="desc"?[...e].sort((t,r)=>n==="asc"?Ee(t)-Ee(r):Ee(r)-Ee(t)):[...e];function Qt(e,n,t=1){return n===void 0?[...e]:e.map(r=>t>=n?{...r,value:Ee(r),children:void 0}:{...r,children:r.children?Qt(r.children,n,t+1):void 0})}function ln(e,n){if(n===void 0)return{nodes:[...e],path:[]};let t=qs(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 Mo(e,n){if(!n)return;let t=typeof n=="object"?n.maxRows??500:500,r=e.hit;if(r&&r.rows.length>0){let c=r.rows[0];if(r.rows.length>t)return;let l=["",...c.slice(1).map(m=>m.replace(/:\s[^:]*$/,""))],d=r.rows.map(m=>[m[0],...m.slice(1).map(h=>h.slice(h.lastIndexOf(": ")+2))]);return[l,...d]}let a=e.shapes.flatMap(c=>c.item&&!c.item.legend&&!(c.part==="anchor"&&!c.title)?[c.item]:[]);if(a.length===0||a.length>t)return;let o=["series","name","category","value"].filter(c=>a.some(l=>l[c]!==void 0)),s=(c,l)=>c[l]===void 0?"":String(c[l]);return[o.map(c=>c[0]?.toUpperCase()+c.slice(1)),...a.map(c=>o.map(l=>s(c,l)))]}var wo=new Map;function $r(e){let n=wo.get(e);if(n)return n.group;let t=new Set,r={},a={current:r,subscribe(o){return t.add(o),()=>{t.delete(o),t.size===0&&wo.delete(e)}},publish(o,s){Object.assign(r,o);for(let c of t)c(o,s)}};return wo.set(e,{group:a,listeners:t}),a}var Zs='[data-skdx-part]:not([data-skdx-part^="tooltip"]):not([data-skdx-part="focus"]):not([data-skdx-part="crosshair"])',ko=`@keyframes skdx-in{from{opacity:0}to{opacity:1}}${Zs}{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){${Zs}{animation:none;transition:none}}`;function $o(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}function Io(e){let n=[],t=e.nodes?new Set(e.nodes.map(b=>b.id)):void 0,r=e.links.filter(b=>!P(b.value)||b.value<=0?(n.push({code:"invalid-value",severity:"warning",message:`Link ${b.source} \u2192 ${b.target} has no positive value and was dropped.`,itemId:b.id}),!1):b.source===b.target?(n.push({code:"self-link",severity:"warning",message:`Link ${b.source} \u2192 ${b.target} points at its own node and was dropped.`,itemId:b.id}),!1):t&&!(t.has(b.source)&&t.has(b.target))?(n.push({code:"unknown-node",severity:"warning",message:`Link ${b.source} \u2192 ${b.target} names a node not in \`nodes\` and was dropped.`,itemId:b.id}),!1):!0),{links:a,back:o}=il(r),s=e.cyclePolicy??"drop";for(let b of o)n.push({code:"cycle",severity:s==="error"?"error":"warning",message:`Link ${b.source} \u2192 ${b.target} closes a cycle and was ${s==="error"?"rejected":"dropped"}.`,itemId:b.id});let c=le(s==="error"&&o.length>0?{...e,error:e.error??`${o.length} link${o.length===1?"":"s"} close a cycle`}:e,a.length===0);if(c)return{...c,issues:n};let l=ae(e.format),d=Math.max(0,e.nodePadding??8),m=Math.max(1,e.nodeWidth??16),{width:h,height:f}=ce(e),M=Ie(h,f,{top:8+me(e),right:96,bottom:8,left:8}),$=new Map,g=new Map((e.nodes??[]).map(b=>[b.id,b])),w=b=>{let x=$.get(b);if(!x){let C=g.get(b);x={id:b,name:C?.label??b,depth:0,value:0,color:ne(e,$.size,C?.color),x:0,y:0,height:0,outY:0,inY:0},$.set(b,x)}return x};for(let b of e.nodes??[])w(b.id);for(let b of a)w(b.source),w(b.target);for(let b=0,x=!0;x&&b<=$.size;b++){x=!1;for(let C of a){let y=w(C.source).depth+1;y>w(C.target).depth&&(w(C.target).depth=y,x=!0)}}let R=new Map,k=new Map;for(let b of a)R.set(b.source,(R.get(b.source)??0)+b.value),k.set(b.target,(k.get(b.target)??0)+b.value);if(e.align==="justify"){let b=Math.max(0,...[...$.values()].map(x=>x.depth));for(let x of $.values())R.has(x.id)||(x.depth=b)}let T=jn(e.selected).map(String),D=b=>T.includes(b),v=b=>T.length===0||D(b)||a.some(x=>D(x.source)&&x.target===b||D(x.target)&&x.source===b);for(let b of $.values())b.value=Math.max(R.get(b.id)??0,k.get(b.id)??0);let S=new Map;for(let b of $.values())S.set(b.depth,[...S.get(b.depth)??[],b]);if(e.nodeSort)for(let b of S.values())b.sort((x,C)=>e.nodeSort==="asc"?x.value-C.value:C.value-x.value);let O=Math.max(0,...S.keys()),E=Math.min(...[...S.values()].map(b=>(M.height-d*(b.length-1))/b.reduce((x,C)=>x+C.value,0)));for(let[b,x]of S){let C=M.y;for(let y of x)y.x=M.x+(O===0?0:b*(M.width-m)/O),y.y=C,y.height=y.value*E,y.outY=y.inY=C,C+=y.height+d}let z=[...a];e.linkSort&&z.sort((b,x)=>e.linkSort==="asc"?b.value-x.value:x.value-b.value);let L=[],H=[];for(let b of z){let x=w(b.source),C=w(b.target),y=b.value*E,B=T.length===0||D(b.source)||D(b.target),U=x.x+m,Y=C.x,j=(U+Y)/2,I=x.outY,G=C.inY;x.outY+=y,C.inY+=y;let V=`${x.name} \u2192 ${C.name}: ${l(b.value)}`;L.push({kind:"path",part:"link",d:`M${i(U)} ${i(I)}C${i(j)} ${i(I)} ${i(j)} ${i(G)} ${i(Y)} ${i(G)}L${i(Y)} ${i(G+y)}C${i(j)} ${i(G+y)} ${i(j)} ${i(I+y)} ${i(U)} ${i(I+y)}Z`,fill:x.color,opacity:B?.4:.08,title:V,item:{label:V,id:b.id??`${b.source}\u2192${b.target}`,name:b.source,category:b.target,value:b.value}});let Q=Y-U>(x.name.length+l(b.value).length)*ie+24;e.linkLabels&&y>=12&&B&&Q&&H.push(J(i(j),i((I+G+y)/2),l(b.value),{part:"link-label",anchor:"middle",baseline:"middle"}))}for(let b of $.values()){let x=`${b.name}: ${l(b.value)}`;L.push({kind:"rect",part:"node",x:i(b.x),y:i(b.y),width:m,height:i(b.height),fill:b.color,opacity:v(b.id)?void 0:.3,title:x,item:{label:x,id:b.id,name:b.name,value:b.value}});let C=b.depth===O;(e.nodeLabels??!0)&&L.push(J(i(C?b.x-6:b.x+m+6),i(b.y+b.height/2),b.name,{anchor:C?"end":"start",baseline:"middle"}))}return{...ue(e,h,f),shapes:[...L,...H],issues:n}}function il(e){let n=new Map;for(let o of e)n.set(o.source,[...n.get(o.source)??[],o]);let t=new Map,r=new Set,a=o=>{t.set(o,"active");for(let s of n.get(o)??[]){let c=t.get(s.target);c==="active"?r.add(s):c===void 0&&a(s.target)}t.set(o,"done")};for(let o of e)t.has(o.source)||a(o.source);return{links:e.filter(o=>!r.has(o)),back:[...r]}}function To(e,n,t,r,a,o){if(e.length===0)return;let s=(h,f)=>{let M=h.reduce((w,R)=>w+R.area,0),$=Math.max(...h.map(w=>w.area)),g=Math.min(...h.map(w=>w.area));return Math.max(f*f*$/(M*M),M*M/(f*f*g))},c=Math.min(r,a),l=[],d=0;for(;d<e.length;){let h=[...l,e[d]];if(l.length===0||s(h,c)<=s(l,c))l=h,d++;else break}let m=l.reduce((h,f)=>h+f.area,0);if(r>=a){let h=m/a,f=t;for(let M of l){let $=M.area/h;o(M,[n,f,h,$]),f+=$}To(e.slice(d),n+h,t,r-h,a,o)}else{let h=m/r,f=n;for(let M of l){let $=M.area/h;o(M,[f,t,$,h]),f+=$}To(e.slice(d),n,t+h,r,a-h,o)}}function ll(e,n,t,r,a,o,s){let c=e.reduce((d,m)=>d+m.area,0),l=s?t:n;for(let d of e){let m=c>0?d.area/c:0;if(s){let h=a*m;o(d,[n,l,r,h]),l+=h}else{let h=r*m;o(d,[l,t,h,a]),l+=h}}}function Ao(e){let{nodes:n,path:t}=ln(e.data,e.rootId),r=Qt(n,e.maxDepth),a=le(e,!r.some(v=>Ee(v)>0));if(a)return a;let o=ae(e.format),{width:s,height:c}=ce(e),l=e.breadcrumbs&&t.length>0,d=r.map((v,S)=>({name:v.name,color:ne(e,S,v.color)})),m=me(e,d,s)+(l?20:0),h=Math.max(0,e.padding??2),f=e.sort??"desc",M=e.tiling??"squarify",$=e.labels??!0,g=[],w=[],R=v=>{for(let S of v)S.children?.length?R(S.children):w.push(Ee(S))};R(r);let k=e.colorScale?wt(e.colorScale,w,ne(e,0),void 0,o):void 0,T=(v,S,O,E,z,L,H)=>{let b=v.reduce((y,B)=>y+Math.max(0,Ee(B)),0),x=tr(v,f).map(y=>{let B=Ee(y),Y=!((y.children?.length??0)>0)&&k?k.color(B):void 0;return{node:y,value:B,color:Y?.fill??y.color??L??ne(e,v.indexOf(y)),opacity:Y?.opacity,area:b>0?Math.max(0,B)/b*E*z:0}}).filter(y=>y.area>0&&!(L===void 0&&xe(e,y.node.name))),C=(y,[B,U,Y,j])=>{let I=`${y.node.name}: ${o(y.value)}`,G=(y.node.children?.length??0)>0;if(g.push({kind:"rect",part:G?"branch":"tile",x:i(B),y:i(U),width:i(Y),height:i(j),fill:y.color,opacity:G?.15:y.opacity,stroke:"var(--skdx-color-surface-default)",title:I,item:{label:I,id:Ke(y.node),name:y.node.name,value:y.value}}),G)T(y.node.children,B+h,U+h,Math.max(0,Y-2*h),Math.max(0,j-2*h),y.color,H+1);else if($&&Y>40&&j>20){let V=Math.max(1,Math.floor((Y-12)/ie)),Q=y.node.name.length>V?`${y.node.name.slice(0,V-1)}\u2026`:y.node.name;g.push(J(i(B+6),i(U+6),Q,{baseline:"hanging",fill:"var(--skdx-color-text-on-accent)"}))}};M==="squarify"?To(x,S,O,E,z,C):ll(x,S,O,E,z,C,M==="slice"||M==="sliceDice"&&H%2===0)};T(r,0,m,s,c-m,void 0,0),l&&g.push(...nr(t,8,me(e,d,s)+10));let D=ue(e,s,c,d);return{...D,shapes:dt([...g,...D.shapes])}}function nr(e,n,t){let r=[],a=n;return e.forEach((o,s)=>{s>0&&(r.push(J(i(a),t,"\u203A",{part:"breadcrumb-separator",baseline:"middle"})),a+=ie+6),r.push(J(i(a),t,o.name,{part:"breadcrumb",baseline:"middle",fill:"var(--skdx-color-text-default)",title:o.name,item:{label:o.name,id:Ke(o),name:o.name}})),a+=o.name.length*ie+6}),r}var cl=.22,dl=20,Us=32,Ys=28,ml=e=>P(e.open)&&P(e.high)&&P(e.low)&&P(e.close);function Co(e){let n=[],t=e.data.filter(N=>ml(N)?!0:(n.push({code:"invalid-value",severity:"warning",message:`Candle "${String(N.label)}" has a non-finite open/high/low/close and was dropped.`,itemId:N.id}),!1)),r=le(e,t.length===0);if(r)return{...r,issues:n};let a=e.upColor??K.positive,o=e.downColor??K.negative,s=ae(e.format),c=ae(e.volumeFormat??{style:"integer"}),l=t.length,d=Math.max(0,Math.min(l-2,Math.floor(e.zoom?.start??0))),m=e.zoom?Math.max(d+2,Math.min(l,Math.ceil(e.zoom.end))):l,h={start:d,end:m},f=t.slice(d,m),M=t.some(N=>P(N.volume)),{width:$,height:g}=ce(e),w=e.brush?Us+Ys:0,R=e.rangeSelector??[],k=e.compare?f[0].close:void 0,T=N=>k!==void 0&&k!==0?N/k-1:N,D=k!==void 0?{style:"percent",digits:1}:void 0,v=ae({style:"percent",digits:1}),S=t.map(N=>N.close),O=(e.overlays??[]).map((N,F)=>{let _=N.name??`${N.type.toUpperCase()} ${N.period}`,W=N.type==="ema"?Ts(S,N.period):ka(S,N.period);return{name:_,color:N.color??ne(e,F+2),values:W.slice(d,m),hidden:xe(e,_)}}),E=Nt([...f.flatMap(N=>[T(N.low),T(N.high)]),...O.filter(N=>!N.hidden).flatMap(N=>N.values.map(F=>P(F)?T(F):F))],!1),z=[{name:"Up",color:a},{name:"Down",color:o},...O.map(N=>({name:N.name,color:N.color}))],L=Ie($,g,{...he,top:he.top+me(e,z,$)+(R.length?dl:0),bottom:he.bottom+w,left:e.scale==="log"?he.left:Vr(E,ae(D??e.yAxis?.format??e.format))}),H=M?L.height*cl:0,b={...L,height:Math.max(0,L.height-H-(M?8:0))},x=_e(E,[b.y+b.height,b.y],{scale:e.scale==="log"?"log":"linear",format:D??e.yAxis?.format},e.format),C=f.map(N=>Ge(N.label)),y=e.xAxis?.type==="time"&&C.every(N=>Number.isFinite(N)),B=Ve(f.length,[b.x,b.x+b.width]),U;if(y){let N=[...C].sort((pe,Z)=>pe-Z),F=1/0;for(let pe=1;pe<N.length;pe++)F=Math.min(F,N[pe]-N[pe-1]);let[_,W]=Me(C),ee=F===1/0?Math.max(1,Math.abs(W)*.05||1):F/2,te=tt([_-ee,W+ee],[b.x,b.x+b.width]),re=Math.abs(te(_+(F===1/0?ee:F))-te(_))*.8;B={step:re,bandwidth:re,start:pe=>te(C[pe])-re/2,center:pe=>te(C[pe])};let de=e.xAxis?.format??{style:"date"};U=Zn(_-ee,W+ee).filter(pe=>pe>=_-ee&&pe<=W+ee).map(pe=>({pos:i(te(pe)),label:_t(pe,de)}))}let Y=f.map(N=>_t(N.label,e.xAxis?.format)),j=ue(e,$,g,z),I={...j,plot:b,xTicks:Se(U??f.map((N,F)=>({pos:i(B.center(F)),label:Y[F]})),b.width),yTicks:x.ticks,baseline:b.y+b.height},G=We(I),V={plot:b,x:N=>{let F=typeof N=="string"?N:Ge(N),_=f.findIndex((W,ee)=>typeof F=="string"?Y[ee]===F||W.label===F:Ge(W.label)===F);return _<0?void 0:B.center(_)},y:N=>x.scale(T(N))};G.push(...Rt(e.references,V)),R.forEach((N,F)=>{let _=N.candles>0?{start:Math.max(0,l-N.candles),end:l}:{start:0,end:l},W=_.start===d&&_.end===m;G.push(J(i(b.x+F*40),i(L.y-8),N.label,{part:"range-button",baseline:"middle",fill:W?"var(--skdx-color-text-default)":K.label,weight:W?"bold":void 0,title:`${N.label}: last ${N.candles>0?Math.min(N.candles,l):l} candles`,item:{label:N.label,name:N.label,range:_}}))});let Q=e.variant==="ohlc",p=[];if(f.forEach((N,F)=>{let W=N.close>=N.open?a:o,ee=i(B.center(F)),te=k!==void 0?` (${v(T(N.close))})`:"",re=`${Y[F]}: O ${s(N.open)} H ${s(N.high)} L ${s(N.low)} C ${s(N.close)}${te}${P(N.volume)?` V ${c(N.volume)}`:""}`,de={label:re,id:N.id,category:Y[F],index:d+F,value:N.close};p.push([Y[F],`Open: ${s(N.open)}`,`High: ${s(N.high)}`,`Low: ${s(N.low)}`,`Close: ${s(N.close)}${te}`,...P(N.volume)?[`Volume: ${c(N.volume)}`]:[],...O.filter(oe=>!oe.hidden).map(oe=>`${oe.name}: ${P(oe.values[F])?s(oe.values[F]):"\u2014"}`)]);let pe=x.scale(T(Math.max(N.open,N.close))),Z=x.scale(T(Math.min(N.open,N.close)));if(Q){let oe=B.bandwidth/2;G.push({kind:"line",part:"wick",x1:ee,x2:ee,y1:i(x.scale(T(N.high))),y2:i(x.scale(T(N.low))),stroke:W,strokeWidth:1.5,title:re,item:de},{kind:"line",part:"open",x1:i(ee-oe),x2:ee,y1:i(x.scale(T(N.open))),y2:i(x.scale(T(N.open))),stroke:W,strokeWidth:1.5},{kind:"line",part:"close",x1:ee,x2:i(ee+oe),y1:i(x.scale(T(N.close))),y2:i(x.scale(T(N.close))),stroke:W,strokeWidth:1.5})}else G.push({kind:"line",part:"wick",x1:ee,x2:ee,y1:i(x.scale(T(N.high))),y2:i(x.scale(T(N.low))),stroke:W,title:re},{kind:"rect",part:"candle",x:i(B.start(F)),y:i(pe),width:i(B.bandwidth),height:i(Math.max(1,Z-pe)),fill:W,title:re,item:de})}),M){let N=b.y+b.height+8,[,F]=Me(f.map(_=>_.volume));f.forEach((_,W)=>{if(!P(_.volume))return;let ee=F>0?_.volume/F*H:0;G.push({kind:"rect",part:"volume",x:i(B.start(W)),y:i(N+H-ee),width:i(B.bandwidth),height:i(Math.max(ee,0)),fill:_.close>=_.open?a:o,opacity:.4,title:`${Y[W]}: volume ${c(_.volume)}`})})}for(let N of O){if(N.hidden)continue;let F=N.values.flatMap((_,W)=>P(_)?[{x:i(B.center(W)),y:i(x.scale(T(_)))}]:[]);F.length<2||G.push({kind:"path",part:"overlay",d:nt(F),stroke:N.color,strokeWidth:1.5,strokeLinejoin:"round",title:N.name,item:{label:N.name,series:N.name}})}for(let N of e.flags??[]){let F=V.x(N.label);if(F===void 0)continue;let _=f.findIndex((re,de)=>B.center(de)===F),W=f[_],ee=x.scale(T(W.high))-6,te=vt(N.variant??"primary");G.push({kind:"path",part:"flag",d:`M${i(F)} ${i(ee)}V${i(ee-10)}H${i(F+8)}L${i(F+5)} ${i(ee-7)}L${i(F+8)} ${i(ee-4)}H${i(F)}Z`,fill:te,stroke:te,title:N.text,item:{label:N.text,name:N.text,category:Y[_],index:d+_}})}G.push(...Ln(e.annotations,V));let q={plot:L,xs:f.map((N,F)=>i(B.center(F))),rows:p,count:l,zoom:h,crosshair:Fr(e)};if(e.brush){let N={x:L.x,y:L.y+L.height+Ys,width:L.width,height:Us},F=t.map(de=>de.close),[_,W]=Me(F),ee=l>1?N.width/(l-1):0,te=F.map((de,pe)=>({x:i(N.x+pe*ee),y:i(N.y+N.height-(W===_?.5:(de-_)/(W-_))*(N.height-4)-2)})),re={x:i(N.x+d/l*N.width),y:N.y,width:i((m-d)/l*N.width),height:N.height};G.push({kind:"rect",part:"brush",...N,fill:"var(--skdx-color-surface-sunken)",stroke:K.grid},{kind:"path",part:"brush-series",d:te.length>1?`${nt(te)}L${te[te.length-1]?.x} ${N.y+N.height}L${te[0]?.x} ${N.y+N.height}Z`:"",fill:"var(--skdx-color-primary-500)",fillOpacity:.3},{kind:"rect",part:"brush-window",...re,fill:"var(--skdx-color-primary-500)",opacity:.15,stroke:K.axis},{kind:"rect",part:"brush-handle",x:i(re.x-3),y:N.y+8,width:6,height:N.height-16,fill:K.axis,rx:8},{kind:"rect",part:"brush-handle",x:i(re.x+re.width-3),y:N.y+8,width:6,height:N.height-16,fill:K.axis,rx:8}),q.brush={box:N,window:re}}return{...j,shapes:[...G,...j.shapes],hit:q,issues:n}}var ul="var(--skdx-color-success-500)",hl="var(--skdx-color-danger-500)";function Lo(e){let n=[],t=e.data.filter(O=>O.type==="subtotal"||O.type==="total"||O.subtotal||P(O.value)?!0:(n.push({code:"invalid-value",severity:"warning",message:`Row "${O.name}" has no valid value and was dropped.`,itemId:O.id??O.name}),!1)),r=le(e,t.length===0);if(r)return{...r,issues:n};let a=ae(e.format),{width:o,height:s}=ce(e),c=e.orientation==="horizontal",l=e.positiveColor??ul,d=e.negativeColor??hl,m=e.totalColor??ne(e,0),h=[],f=P(e.start)?e.start:0,M=O=>`${O>=0?"+":""}${a(O)}`;P(e.start)&&e.startLabel!==void 0&&h.push({id:void 0,name:e.startLabel,from:0,to:f,color:m,title:`${e.startLabel}: ${a(f)}`,flat:!0});for(let O of t){if((O.type??(O.subtotal?"subtotal":"change"))!=="change"){h.push({id:O.id,name:O.name,from:0,to:f,color:O.color??m,title:`${O.name}: ${a(f)}`,flat:!0});continue}let z=f;f+=O.value,h.push({id:O.id,name:O.name,from:z,to:f,color:O.color??(O.value>=0?l:d),title:`${O.name}: ${M(O.value)}`,flat:!1})}e.total!==void 0&&h.push({id:void 0,name:e.total,from:0,to:f,color:m,title:`${e.total}: ${a(f)}`,flat:!0});let $=c?Math.max(0,...h.map(O=>O.name.length))*ie+16:0,g=[{name:"Increase",color:l},{name:"Decrease",color:d}],w=Ie(o,s,{...he,top:he.top+me(e,g,o),left:Math.max(he.left,$),right:e.labels&&c?56:he.right}),R=h.flatMap(O=>[O.from,O.to]),k=_e([Math.min(0,...R),Math.max(0,...R)],c?[w.x,w.x+w.width]:[w.y+w.height,w.y],{},e.format),T=Ve(h.length,c?[w.y,w.y+w.height]:[w.x,w.x+w.width]),D=ue(e,o,s,g),v=h.map((O,E)=>({pos:i(T.center(E)),label:O.name})),S=We({...D,plot:w,xTicks:c?v:Se(v,w.width),yTicks:c?Se(k.ticks,w.width):k.ticks,baseline:k.zero},{horizontal:c});return h.forEach((O,E)=>{let z=k.scale(O.from),L=k.scale(O.to),H=Math.min(z,L),b=Math.max(1,Math.abs(L-z));if(S.push({kind:"rect",part:"bar",x:i(c?H:T.start(E)),y:i(c?T.start(E):H),width:i(c?b:T.bandwidth),height:i(c?T.bandwidth:b),fill:O.color,title:O.title,item:{label:O.title,id:O.id??O.name,name:O.name,index:E,value:O.flat?O.to:O.to-O.from}}),e.labels){let C=O.flat?a(O.to):M(O.to-O.from),y=Math.max(z,L);S.push(c?J(i(y+6),i(T.center(E)),C,{part:"value-label",baseline:"middle"}):J(i(T.center(E)),i(H-4),C,{part:"value-label",anchor:"middle"}))}let x=h[E+1];if(x&&(e.connectors??!0)){let C=i(L),y=i(k.scale(x.flat?x.to:x.from));S.push(c?{kind:"line",part:"connector",x1:C,x2:y,y1:i(T.start(E)+T.bandwidth),y2:i(T.start(E+1)),stroke:K.axis,dash:"4 3"}:{kind:"line",part:"connector",x1:i(T.start(E)+T.bandwidth),x2:i(T.start(E+1)),y1:C,y2:y,stroke:K.axis,dash:"4 3"})}}),{...D,shapes:[...S,...D.shapes],issues:n}}function fl(e){let n=new Map;for(let l of e)l.id!==void 0&&!n.has(l.id)&&n.set(l.id,l),n.has(l.name)||n.set(l.name,l);let t=new Map,r=new Set,a=l=>{let d=t.get(l);if(d)return d;if(r.has(l))return{length:0,next:void 0};r.add(l);let m={length:0,next:void 0};for(let f of l.dependsOn??[]){let M=n.get(f);if(!M||M===l)continue;let $=a(M);$.length>m.length&&(m={length:$.length,next:M})}r.delete(l);let h={length:m.length+Math.max(0,l.end-l.start),next:m.next};return t.set(l,h),h},o,s=-1;for(let l of e){let d=a(l);d.length>s&&(s=d.length,o=l)}let c=new Set;for(let l=o;l&&!c.has(l);l=t.get(l)?.next)c.add(l);return c}function Oo(e){let n=[],t=e.tasks.filter(p=>{let q=P(p.start)&&(p.milestone?!0:P(p.end));return q?!p.milestone&&p.end<p.start&&n.push({code:"inverted-range",severity:"warning",message:`Task "${p.name}" ends before it starts; the interval was normalized.`,itemId:p.id??p.name}):n.push({code:"invalid-value",severity:"warning",message:`Task "${p.name}" has no valid start/end and was dropped.`,itemId:p.id??p.name}),q}),r=le(e,t.length===0);if(r)return{...r,issues:n};let{width:a,height:o}=ce(e),s=e.criticalPath?fl(t):void 0,c=p=>p.id??p.name,l=new Map;for(let p of t)p.id!==void 0&&!l.has(p.id)&&l.set(p.id,p),l.has(p.name)||l.set(p.name,p);let d=new Map,m=[];for(let p of t){let q=p.parent===void 0?void 0:l.get(p.parent);q&&q!==p?d.set(q,[...d.get(q)??[],p]):m.push(p)}let h=new Set(e.collapsed??[]),f=p=>h.has(c(p))||h.has(p.name),M=[],$=(p,q,N)=>{if(!N.has(p)&&(N.add(p),M.push({task:p,depth:q}),!f(p)))for(let F of d.get(p)??[])$(F,q+1,N)},g=new Set;for(let p of m)$(p,0,g);let w=M.map(p=>p.task),R=new Map(M.map(p=>[p.task,p.depth])),k=p=>{let q=d.get(p)??[];if(q.length===0||P(p.end)&&p.end!==p.start)return{start:p.start,end:p.end};let N=q.map(k);return{start:Math.min(...N.map(F=>F.start)),end:Math.max(...N.map(F=>F.end))}},T=[...new Set(w.map(p=>p.group??p.name))],D=new Map;for(let p of w){let q=p.group??p.name;D.has(q)||D.set(q,R.get(p)??0)}let v=p=>w.some(q=>(q.group??q.name)===p&&f(q)&&(d.get(q)?.length??0)>0)?" +":"",S=Math.max(0,...T.map(p=>p.length+v(p).length))*ie+Math.max(0,...T.map(p=>(D.get(p)??0)*12)),O=e.tasks.map((p,q)=>({name:p.name,color:ne(e,q,p.color)})),E=Ie(a,o,{top:8+me(e,O,a),right:16,bottom:32+(e.xAxis?.label?14:0),left:Math.min(a/2,Math.max(64,S+16))}),z=ae(e.xAxis?.format??e.format),L=e.today===void 0?void 0:Ge(e.today),[H,b]=Me([...w.flatMap(p=>{let q=k(p);return[...p.milestone?[p.start]:[q.start,q.end],...p.baseline?[p.baseline.start,p.baseline.end]:[]]}),...L!==void 0?[L]:[]]),x=_e([H,b],[E.x,E.x+E.width],{ticks:e.xAxis?.ticks,format:e.xAxis?.format},e.format),C=Ve(T.length,[E.y,E.y+E.height]),y=[],B=[],U=p=>x.domain[0]+(p-E.x)/Math.max(1,E.width)*(x.domain[1]-x.domain[0]);for(let p of Se(x.ticks,E.width))y.push({kind:"line",part:"grid",x1:p.pos,x2:p.pos,y1:E.y,y2:E.y+E.height,stroke:K.grid}),y.push(J(p.pos,E.y+E.height+20,p.label,{part:"x-label",anchor:Kn(p.pos,p.label,a)}));T.forEach((p,q)=>{let N=w.find(F=>(F.group??F.name)===p);y.push(J(E.x-8,i(C.center(q)),`${p}${v(p)}`,{part:"y-label",anchor:"end",baseline:"middle",item:N&&(d.get(N)?.length??0)>0?{label:p,id:c(N),name:N.name}:void 0}))});for(let p of y){if(p.kind!=="text"||p.part!=="y-label")continue;let q=D.get(p.text.replace(/ \+$/,""))??0;q&&(p.x=i(p.x+q*12))}let Y=864e5;if(e.nonWorkingDays?.length&&b-H<=400*Y&&b>H){let p=new Set(e.nonWorkingDays);for(let q=Math.floor(H/Y)*Y;q<b;q+=Y){if(!p.has(new Date(q).getUTCDay()))continue;let N=Math.max(H,q),F=Math.min(b,q+Y);F<=N||y.push({kind:"rect",part:"non-working",x:i(x.scale(N)),y:E.y,width:i(Math.max(0,x.scale(F)-x.scale(N))),height:E.height,fill:K.grid,opacity:.12})}}e.xAxis?.label&&y.push(J(i(E.x+E.width/2),o-4,e.xAxis.label,{part:"axis-title",anchor:"middle"}));let j={plot:E,x:p=>x.scale(Ge(p)),y:p=>C.center(p)};y.push(...Rt([...e.references??[],...L!==void 0?[{x:L,label:"Today",variant:"primary"}]:[]],j));let I=new Map,G=[];w.forEach(p=>{if(xe(e,p.name))return;let q=t.indexOf(p),N=T.indexOf(p.group??p.name),F=k(p),_=x.scale(Math.min(F.start,F.end)),W=p.milestone?_:x.scale(Math.max(F.start,F.end)),ee=(d.get(p)?.length??0)>0;if(p.baseline&&!p.milestone){let we=x.scale(Math.min(p.baseline.start,p.baseline.end)),De=x.scale(Math.max(p.baseline.start,p.baseline.end));y.push({kind:"rect",part:"baseline",x:i(we),y:i(C.start(N)+C.bandwidth*.75),width:i(Math.max(1,De-we)),height:i(C.bandwidth/4),fill:K.axis,opacity:.6,rx:1,title:`${p.name} planned: ${z(p.baseline.start)} \u2013 ${z(p.baseline.end)}`})}let te=C.center(N),re=ne(e,q,p.color),de=s&&!s.has(p)?.35:void 0;if(I.has(p.name)||I.set(p.name,{x0:_,x1:W,mid:te}),p.id!==void 0&&!I.has(p.id)&&I.set(p.id,{x0:_,x1:W,mid:te}),p.milestone){let we=C.bandwidth/2,De=`${p.name}: ${z(p.start)}`;y.push({kind:"path",part:"milestone",d:`M${i(_)} ${i(te-we)}L${i(_+we)} ${i(te)}L${i(_)} ${i(te+we)}L${i(_-we)} ${i(te)}Z`,fill:re,opacity:de,title:De,item:{label:De,id:p.id,name:p.name,category:p.group,index:q,value:p.start}});return}let pe=P(p.progress)?Math.max(0,Math.min(1,p.progress)):void 0,Z=`${p.name}: ${z(F.start)} \u2013 ${z(F.end)}${pe!==void 0?` \xB7 ${Math.round(pe*100)}% done`:""}`;ee||B.push({index:y.length,id:p.id??p.name,name:p.name,start:Math.min(p.start,p.end),end:Math.max(p.start,p.end),x0:i(_),x1:i(W),y:i(C.start(N)),height:i(C.bandwidth)});let oe=p.baseline?C.bandwidth*.7:C.bandwidth;y.push({kind:"rect",part:ee?"summary":"bar",x:i(_),y:i(C.start(N)),width:i(Math.max(1,W-_)),height:i(ee?C.bandwidth/3:oe),fill:re,rx:2,opacity:de,title:Z,item:{label:Z,id:p.id,name:p.name,category:p.group,index:q,value:Math.abs(p.end-p.start)}}),pe!==void 0&&pe>0&&G.push({kind:"rect",part:"progress",x:i(_),y:i(te-C.bandwidth/4),width:i(Math.max(1,(W-_)*pe)),height:i(C.bandwidth/2),fill:"var(--skdx-color-text-default)",opacity:.35,rx:1})});let V=new Map;for(let p of t)p.id!==void 0&&!V.has(p.id)&&V.set(p.id,p),V.has(p.name)||V.set(p.name,p);for(let p of t)for(let q of p.dependsOn??[]){let N=I.get(q),F=I.get(p.id??p.name);if(!N){n.push({code:"unknown-node",severity:"warning",message:`Task "${p.name}" depends on "${String(q)}", which does not exist.`,itemId:p.id??p.name});continue}if(!F||N===F)continue;let _=Math.max(N.x1+6,F.x0-6),W=V.get(q),ee=s&&W&&s.has(W)&&s.has(p),te=`${W?.name??String(q)} \u2192 ${p.name}`;G.push({kind:"path",part:"dependency",d:`M${i(N.x1)} ${i(N.mid)}H${i(_)}V${i(F.mid)}H${i(F.x0)}`,stroke:ee?"var(--skdx-color-danger-500)":K.axis,strokeWidth:ee?2.5:1.5,opacity:s&&!ee?.35:void 0,title:te,item:{label:te,name:W?.name??String(q),category:p.name}})}y.push(...G,...Ln(e.annotations,j));let Q=ue(e,a,o,O);return{...Q,shapes:[...y,...Q.shapes],issues:n,edit:{scale:p=>x.scale(p),invert:U,bars:B}}}var So=e=>{let n=e.length;return n===0?0:n%2?e[(n-1)/2]:(e[n/2-1]+e[n/2])/2},pl=(e,n)=>{if(e.length===0)return 0;let t=(e.length-1)*n,r=Math.floor(t),a=Math.ceil(t),o=e[r],s=e[a];return o+(s-o)*(t-r)},bl=(e,n)=>{let t=e.length;if(t===0)return 0;let r=(t+1)*n-1;if(r<=0)return e[0];if(r>=t-1)return e[t-1];let a=Math.floor(r),o=e[a],s=e[a+1];return o+(s-o)*(r-a)};function gl(e,n="linear"){let t=So(e),r=e.length;if(r===0)return{q1:0,median:0,q3:0};if(n==="tukey"){let o=Math.floor(r/2),s=e.slice(0,r%2?o+1:o),c=e.slice((r%2,o));return{q1:So(s),median:t,q3:So(c)}}let a=n==="exclusive"?bl:pl;return{q1:a(e,.25),median:t,q3:a(e,.75)}}function xl(e,n="linear",t=1.5){let r=Pe(e).sort(($,g)=>$-g),{q1:a,median:o,q3:s}=gl(r,n),c=s-a,l=a-t*c,d=s+t*c,m=r.filter($=>$>=l&&$<=d),h=r.length?r.reduce(($,g)=>$+g,0)/r.length:0,f=m[0]??a,M=m[m.length-1]??s;return{name:"",q1:a,median:o,q3:s,min:f,max:M,low:f,high:M,mean:h,outliers:r.filter($=>$<l||$>d),count:r.length}}var Ks=e=>"median"in e&&!("data"in e),Xs=e=>"data"in e&&Array.isArray(e.data[0]);function zo(e){let n=e.quartileMethod??"linear",t=e.whisker??1.5,r=[],a=e.categories,o=a!==void 0,s=(y,B)=>r.push({code:"invalid-value",severity:"warning",message:B,itemId:y.id??y.name}),c=[];e.series.forEach((y,B)=>{let U=ne(e,B,y.color),Y=(j,I,G)=>{let V=G??(I&&Pe(I).length?xl(I,n,t):void 0);return!V||![V.min,V.q1,V.median,V.q3,V.max].every(P)?!1:(V.count!==void 0&&V.count<5&&r.push({code:"small-sample",severity:"warning",message:`Series "${y.name}"${o?` at "${a[j]??j}"`:""} has ${V.count} observation${V.count===1?"":"s"}; quartiles are not meaningful below 5.`,itemId:y.id??y.name}),c.push({si:B,ci:j,name:y.name,id:y.id,color:U,st:{...V,name:y.name},raw:I}),!0)};if(!o){(Ks(y)?Y(0,void 0,y):Xs(y)?Y(0,y.data.flat()):Y(0,y.data))||s(y,`Series "${y.name}" has no valid observations or summary and was skipped.`);return}if(Ks(y)){s(y,`Series "${y.name}" is a summary, which cannot be grouped by categories; it was skipped.`);return}if(!Xs(y)){s(y,`Series "${y.name}" is not grouped (its data is one sample, not one per category); it was drawn in the first category.`),Y(0,y.data);return}a.forEach((j,I)=>Y(I,y.data[I]))});let l=le(e,c.length===0);if(l)return{...l,issues:r};let d=ae(e.yAxis?.format??e.format),{width:m,height:h}=ce(e),f=e.orientation==="horizontal",M=o?a:e.series.map(y=>y.name),$=Math.max(0,...M.map(y=>y.length))*ie,g=e.series.map((y,B)=>({name:y.name,color:ne(e,B,y.color)})),w=Ie(m,h,{...he,top:he.top+me(e,g,m)+(e.yAxis?.label?12:0),left:f?Math.max(he.left,$+16):he.left,bottom:he.bottom+(f&&e.yAxis?.label?14:0)}),R=c.filter(y=>!xe(e,y.name)),k=R.flatMap(y=>[y.st.min,y.st.max,...y.st.outliers??[],...P(y.st.mean)?[y.st.mean]:[]]),T=_e(Nt(k,!1),f?[w.x,w.x+w.width]:[w.y+w.height,w.y],e.yAxis??{},e.format),D=Ve(M.length,f?[w.y,w.y+w.height]:[w.x,w.x+w.width]),v=o?[...new Set(R.map(y=>y.si))]:[],S=o?D.bandwidth/Math.max(1,v.length):D.bandwidth,O=y=>o?D.start(y.ci)+(v.indexOf(y.si)+.5)*S:D.center(y.si),E=ue(e,m,h,g),z=M.map((y,B)=>({pos:i(D.center(B)),label:y})),L=We({...E,plot:w,xTicks:f?z:Se(z,w.width),yTicks:f?Se(T.ticks,w.width):T.ticks,baseline:f?w.x:w.y+w.height},{horizontal:f,grid:Cn(e.yAxis),...f?{xLabel:e.yAxis?.label}:{yLabel:e.yAxis?.label}}),H=(y,B,U)=>{let Y=i(T.scale(y)),j=i(T.scale(B));return f?{x1:Y,x2:j,y1:U,y2:U}:{x1:U,x2:U,y1:Y,y2:j}},b=(y,B,U,Y)=>{let j=T.scale(y),I=T.scale(B),G=Math.max(1,Math.abs(I-j));return f?{x:i(Math.min(j,I)),y:i(U-Y/2),width:i(G),height:i(Y)}:{x:i(U-Y/2),y:i(Math.min(j,I)),width:i(Y),height:i(G)}},x=(y,B)=>f?`${i(T.scale(y))} ${i(B)}`:`${i(B)} ${i(T.scale(y))}`,C=(y,B,U,Y,j,I,G)=>({kind:"circle",part:j,cx:f?i(T.scale(y)):i(B),cy:f?i(B):i(T.scale(y)),r:U,fill:Y,opacity:G,title:I});for(let y of R){let{st:B,color:U,name:Y,raw:j}=y,I=i(O(y)),G=o?a[y.ci]:void 0,V=G!==void 0?`${Y}, ${G}`:Y,Q=`${V}: min ${d(B.min)} Q1 ${d(B.q1)} median ${d(B.median)} Q3 ${d(B.q3)} max ${d(B.max)}${e.mean&&P(B.mean)?` mean ${d(B.mean)}`:""}`,p={label:Q,id:y.id,series:Y,seriesId:y.id??Y,category:G,index:o?y.ci:y.si,value:B.median},q=S*.6,N=q/2,F=f?{x1:i(T.scale(B.median)),x2:i(T.scale(B.median)),y1:i(I-N),y2:i(I+N)}:{x1:i(I-N),x2:i(I+N),y1:i(T.scale(B.median)),y2:i(T.scale(B.median))},_=B.count,W=e.notched&&_?Math.min(1.58*(B.q3-B.q1)/Math.sqrt(_),(B.q3-B.q1)/2):0,ee=W?{kind:"path",part:"box",d:`M${[x(B.q1,I-N),x(B.median-W,I-N),x(B.median,I-N+q/4),x(B.median+W,I-N),x(B.q3,I-N),x(B.q3,I+N),x(B.median+W,I+N),x(B.median,I+N-q/4),x(B.median-W,I+N),x(B.q1,I+N)].join("L")}Z`,fill:U,stroke:U,fillOpacity:.5,title:Q,item:p}:{kind:"rect",part:"box",...b(B.q1,B.q3,I,q),fill:U,stroke:U,opacity:.5,title:Q,item:p};if(L.push({kind:"line",part:"whisker",...H(B.max,B.min,I),stroke:U,title:Q},ee,{kind:"line",part:"median",...F,stroke:U,title:Q},...(B.outliers??[]).map(te=>C(te,I,3,U,"outlier",`${V}: ${d(te)}`))),e.mean&&P(B.mean)){let te=f?i(T.scale(B.mean)):I,re=f?I:i(T.scale(B.mean));L.push({kind:"path",part:"mean",d:`M${te} ${i(re-4)}L${i(te+4)} ${re}L${te} ${i(re+4)}L${i(te-4)} ${re}Z`,fill:"var(--skdx-color-text-default)",title:`${V} mean: ${d(B.mean)}`})}e.points&&j&&Pe(j).forEach((te,re)=>{let de=(re*7919%97/96-.5)*q*.8;L.push(C(te,I+de,2,U,"observation",`${V}: ${d(te)}`,.6))})}return{...E,shapes:[...L,...E.shapes],issues:r}}var No=e=>e*Math.PI/180;function Ro(e){let{nodes:n,path:t}=ln(e.data,e.rootId),r=Qt(n,e.maxDepth),a=le(e,!r.some(x=>Ee(x)>0),300,300);if(a)return a;let o=ae(e.format),{width:s,height:c}=ce(e,300,300),l=Math.min(.9,Math.max(0,e.innerRadius??0)),d=e.breadcrumbs&&t.length>0,m=d&&l===0,h=r.map((x,C)=>({name:x.name,color:ne(e,C,x.color)})),f=me(e,h,s)+(m?20:0),M=s/2,$=f+(c-f)/2,g=Math.max(0,Math.min(s,c-f)/2-8),w=g*l,R=(g-w)/Math.max(1,kr(r)),k=No(e.startAngle??0),T=No(e.endAngle??(e.startAngle??0)+360),D=Math.max(0,No(e.padAngle??0)),v=e.sort??"none",S=[],O=x=>{for(let C of x)C.children?.length?O(C.children):S.push(Ee(C))};O(r);let E=e.colorScale?wt(e.colorScale,S,ne(e,0),void 0,o):void 0,z=[],L=[],H=(x,C,y,B,U)=>{let Y=p=>C===0&&xe(e,p.name)?0:Math.max(0,Ee(p)),j=tr(x,v),I=j.reduce((p,q)=>p+Y(q),0),G=Math.max(0,j.filter(p=>Y(p)>0).length-1),V=Math.max(0,B-G*D),Q=y;j.forEach(p=>{let q=Y(p),N=I>0?q/I*V:0,_=!((p.children?.length??0)>0)&&E?E.color(q):void 0,W=_?.fill??p.color??U??ne(e,x.indexOf(p));if(N>0){let ee=w+R*C,te=ee+R;if(e.labels&&N*((ee+te)/2)>p.name.length*ie+4){let de=Q+N/2,pe=(ee+te)/2;L.push(J(i(M+pe*Math.sin(de)),i($-pe*Math.cos(de)),p.name,{part:"arc-label",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-on-accent)"}))}let re=`${p.name}: ${o(q)}`;z.push({kind:"path",part:"arc",d:Ze(M,$,te,ee,Q,Q+N),fill:W,opacity:_?_.opacity:1-C*.2,stroke:"var(--skdx-color-surface-default)",title:re,item:{label:re,id:Ke(p),name:p.name,value:q}}),H(p.children??[],C+1,Q,N,W),Q+=N+D}})};if(H(r,0,k,Math.max(0,Math.min(2*Math.PI,T-k)),void 0),e.centerLabel&&L.push(J(i(M),i(d&&!m?$-8:$),e.centerLabel,{part:"center-label",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-default)",weight:"bold"})),d){let x=t.reduce((C,y)=>C+y.name.length*ie+6,0)+(t.length-1)*(ie+6);L.push(...m?nr(t,8,me(e,h,s)+10):nr(t,M-x/2,e.centerLabel?$+8:$))}let b=ue(e,s,c,h);return{...b,shapes:dt([...z,...L,...b.shapes])}}var yl=2*Math.PI,vl=12,Ir=5;function Ml(e){let n=[];if(e.links){let a=[...e.names??[]],o=new Set(a);for(let l of e.links)for(let d of[l.source,l.target])o.has(d)||(e.names&&n.push({code:"unknown-node",severity:"warning",message:`Link ${l.source} \u2192 ${l.target} names "${d}", which is not in \`names\`; it was added.`,itemId:l.id}),o.add(d),a.push(d));let s=new Map(a.map((l,d)=>[l,d])),c=a.map(()=>a.map(()=>0));for(let l of e.links){if(!P(l.value)||l.value<0){n.push({code:"invalid-value",severity:"warning",message:`Link ${l.source} \u2192 ${l.target} has no valid value and was dropped.`,itemId:l.id});continue}let d=c[s.get(l.source)];d[s.get(l.target)]=d[s.get(l.target)]+l.value}return{names:a,matrix:c,issues:n}}let t=e.names??[],r=e.matrix??[];return(r.length!==t.length||r.some(a=>a.length!==t.length))&&n.push({code:"ragged-matrix",severity:"warning",message:`The matrix is ${r.length} \xD7 ${r[0]?.length??0} but there are ${t.length} names; missing cells count as zero.`}),{names:t,matrix:r,issues:n}}function Eo(e){let{names:n,matrix:t,issues:r}=Ml(e),a=le(e,n.length===0||!t.some(j=>j.some(I=>P(I)&&I>0)),300,300);if(a)return{...a,issues:r};let o=ae(e.format),{width:s,height:c}=ce(e,300,300),l=(j,I)=>{let G=t[j]?.[I];return P(G)?Math.max(0,G):0},d=j=>n.reduce((I,G,V)=>I+l(j,V)+l(V,j),0),m=n.map((j,I)=>I);e.sort&&m.sort((j,I)=>e.sort==="asc"?d(j)-d(I):d(I)-d(j));let h=m.map(j=>n[j]),f=j=>ne(e,m[j]),M=h.map((j,I)=>({name:j,color:f(I)})),$=me(e,M,s),g=s/2,w=$+(c-$)/2,R=e.ticks?8+Ir+14:8,k=R+Math.max(0,...n.map(j=>j.length))*ie+4,T=Math.max(0,Math.min(s/2-k,(c-$)/2-36)),D=Math.max(0,T-vl),v=(e.padding??2.3)*Math.PI/180,S=h.length,O=jn(e.selected)[0],E=O===void 0?-1:h.indexOf(String(O)),z=(j,I)=>xe(e,h[j])||xe(e,h[I])?0:l(m[j],m[I]),L=h.map((j,I)=>h.reduce((G,V,Q)=>G+z(I,Q),0)),H=L.reduce((j,I)=>j+I,0),b=H>0?(yl-v*S)/H:0,x=(j,I)=>`${i(g+I*Math.sin(j))} ${i(w-I*Math.cos(j))}`,C=[],y=0;for(let j=0;j<S;j++){let I=y,G=h.map((V,Q)=>{let p=y;return y+=z(j,Q)*b,{a0:p,a1:y}});C.push({a0:I,a1:y,sub:G}),y+=v}let B=[],U=[];for(let j=0;j<S;j++)for(let I=j;I<S;I++){let G=z(j,I),V=z(I,j);if(G+V===0)continue;let Q=C[j].sub[I],p=C[I].sub[j],q=ee=>ee.a1-ee.a0>Math.PI?1:0,N=j===I?`M${x(Q.a0,D)}A${D} ${D} 0 ${q(Q)} 1 ${x(Q.a1,D)}Q${i(g)} ${i(w)} ${x(Q.a0,D)}Z`:`M${x(Q.a0,D)}A${D} ${D} 0 ${q(Q)} 1 ${x(Q.a1,D)}Q${i(g)} ${i(w)} ${x(p.a0,D)}A${D} ${D} 0 ${q(p)} 1 ${x(p.a1,D)}Q${i(g)} ${i(w)} ${x(Q.a0,D)}Z`,F=G>=V?j:I,_=E<0||j===E||I===E,W=j===I?`${h[j]}: ${o(G)}`:`${h[j]} \u2192 ${h[I]}: ${o(G)} \xB7 ${h[I]} \u2192 ${h[j]}: ${o(V)}`;B.push({kind:"path",part:"chord",d:N,fill:f(F),opacity:_?.5:.08,title:W,item:{label:W,id:`${h[j]}\u2192${h[I]}`,name:h[j],category:h[I],value:G+V}})}C.forEach((j,I)=>{if(j.a1<=j.a0)return;let G=`${h[I]}: ${o(L[I])}`;B.push({kind:"path",part:"group",d:Ze(g,w,T,D,j.a0,j.a1),fill:f(I),opacity:E<0||I===E||z(I,E)+z(E,I)>0?void 0:.3,title:G,item:{label:G,id:h[I],name:h[I],index:I,value:L[I]}});let V=(j.a0+j.a1)/2,Q=Math.sin(V),p=T+R;if(B.push(J(i(g+p*Q),i(w-p*Math.cos(V)),h[I],{anchor:Q>.1?"start":Q<-.1?"end":"middle",baseline:"middle"})),!e.ticks)return;let q=L[I];ct(0,q,4).filter(N=>N<=q).forEach((N,F)=>{let _=j.a0+N*b,W=Math.sin(_),ee=Math.cos(_);if(B.push({kind:"line",part:"tick",x1:i(g+T*W),y1:i(w-T*ee),x2:i(g+(T+Ir)*W),y2:i(w-(T+Ir)*ee),stroke:K.axis}),F%2)return;let te=i(g+(T+Ir+3)*W),re=i(w-(T+Ir+3)*ee);U.some(de=>Math.abs(de.x-te)<12&&Math.abs(de.y-re)<12)||(U.push({x:te,y:re}),B.push(J(te,re,o(N),{part:"tick-label",anchor:W>.1?"start":W<-.1?"end":"middle",baseline:"middle"})))})});let Y=ue(e,s,c,M);return{...Y,shapes:[...B,...Y.shapes],issues:r}}var Rn=8,Do=e=>e.geometry.type==="Polygon"?e.geometry.coordinates:e.geometry.type==="MultiPolygon"?e.geometry.coordinates.flat():[],Js=e=>e.geometry.type==="Point"?[e.geometry.coordinates]:e.geometry.type==="MultiPoint"?e.geometry.coordinates:[],ei=e=>e.geometry.type==="LineString"?[e.geometry.coordinates]:e.geometry.type==="MultiLineString"?e.geometry.coordinates:[],Qs=e=>[...Do(e).flat(),...Js(e),...ei(e).flat()],wl=e=>Math.log(Math.tan(Math.PI/4+Math.max(-85,Math.min(85,e))*Math.PI/360)),rr=e=>e!==void 0&&Number.isFinite(e[0])&&Number.isFinite(e[1]);function Bo(e){let n=[],t=e.features.filter(p=>{let q=Qs(p).some(rr);return q||n.push({code:"invalid-geometry",severity:"warning",message:`Feature "${p.name}" has no valid coordinates and was dropped.`,itemId:p.id??p.name}),q}),r=le(e,t.length===0);if(r)return{...r,issues:n};let a=ae(e.format),{width:o,height:s}=ce(e),c=me(e),l=On(e.colorLegend).bottom,d=On(e.colorLegend).right,m=e.projection==="mercator"?wl:p=>p,h=t.filter(p=>Do(p).length>0),f=(h.length?h:t).flatMap(p=>Qs(p).filter(rr)),[M,$]=f.length?Me(f.map(p=>p[0])):[0,1],[g,w]=f.length?Me(f.map(p=>m(p[1]))):[0,1],R=Math.min((o-d-2*Rn)/Math.max(1e-9,$-M),(s-c-l-2*Rn)/Math.max(1e-9,w-g)),k={x:Rn,y:c+Rn,width:o-d-2*Rn,height:s-c-l-2*Rn},T=Math.max(1,Math.min(64,e.view?.zoom??1)),D=R*T,v=e.view?.center?[e.view.center[0],m(e.view.center[1])]:[(M+$)/2,(g+w)/2],S=k.x+k.width/2-v[0]*D,O=k.y+k.height/2+v[1]*D,E=([p,q])=>({x:i(S+p*D),y:i(O-m(q)*D)}),z=p=>{let{x:q,y:N}=E(p);return`${q} ${N}`},L=ne(e,0,e.color),H=wt(e.colorScale,t.map(p=>p.value),L,void 0,a),b=[],x=h.map(p=>{let q=Do(p);if(e.labels&&q.length){let _=q.reduce((de,pe)=>pe.length>de.length?pe:de),[W,ee]=Me(_.map(de=>de[0])),[te,re]=Me(_.map(de=>m(de[1])));b.push(J(i(S+((W+ee)/2-M)*D),i(O+(w-(te+re)/2)*D),p.name,{part:"region-label",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-default)"}))}let N=p.color!==void 0?{fill:p.color,opacity:1}:H.color(p.value),F=`${p.name}${P(p.value)?`: ${a(p.value)}`:""}`;return{kind:"path",part:"region",d:q.map(_=>`M${_.filter(rr).map(z).join("L")}Z`).join(""),fill:N?.fill??K.grid,opacity:N?.opacity??.6,stroke:"var(--skdx-color-surface-default)",title:F,item:{label:F,id:p.id??p.name,name:p.name,value:p.value}}}),C=[...e.lines??[],...t.flatMap(p=>ei(p).map(q=>({id:p.id,name:p.name,coordinates:q,value:p.value,color:p.color??(P(p.value)?H.color(p.value)?.fill:void 0),dash:void 0})))].filter(p=>p.coordinates.filter(rr).length>=2),[,y]=Me(C.map(p=>p.value)),B=C.map((p,q)=>{let N=`${p.name}${P(p.value)?`: ${a(p.value)}`:""}`;return{kind:"path",part:"route",d:`M${p.coordinates.filter(rr).map(z).join("L")}`,stroke:p.color??ne(e,2),strokeWidth:P(p.value)&&y>0?1+3*Math.sqrt(Math.max(0,p.value)/y):1.5,strokeLinecap:"round",strokeLinejoin:"round",dash:p.dash,opacity:.85,title:N,item:{label:N,id:p.id??p.name,name:p.name,index:q,value:p.value}}}),U=[...e.points??[],...t.flatMap(p=>Js(p).map(q=>({id:p.id,name:p.name,coordinates:q,value:p.value,color:p.color??(P(p.value)?H.color(p.value)?.fill:void 0)})))].filter(p=>rr(p.coordinates)),[Y,j]=e.sizeRange??[3,14],[,I]=Me(U.map(p=>p.value)),G=U.map((p,q)=>{let{x:N,y:F}=E(p.coordinates),_=Number.isFinite(p.value)&&I>0,W=`${p.name}${_?`: ${a(p.value)}`:""}`;return{kind:"circle",part:_?"bubble":"point",cx:N,cy:F,r:i(_?Math.max(Y,Math.sqrt(Math.max(0,p.value)/I)*j):Y),fill:p.color??ne(e,1),stroke:"var(--skdx-color-surface-default)",opacity:.85,title:W,item:{label:W,id:p.id??p.name,name:p.name,index:q,value:p.value}}}),V=e.colorLegend?Xn(H,d?{x:k.x+k.width+12,y:k.y,width:d,height:k.height}:{x:Rn,y:s-l+8,width:o-2*Rn,height:l},On(e.colorLegend).options):[],Q=e.projection==="mercator"?p=>Math.atan(Math.exp(p))*360/Math.PI-90:p=>p;return{...ue(e,o,s),shapes:[...x,...B,...b,...G,...V],issues:n,map:{view:{center:[v[0],Q(v[1])],zoom:T},bounds:{minLon:M,maxLon:$,minLat:g,maxLat:w},plot:k,scale:D,toY:m,fromY:Q}}}function Fo(e){let n=[],t=e.segments.map((z,L)=>typeof z=="string"?{name:z,id:z,color:ne(e,L)}:{name:z.name,id:z.id??z.name,color:ne(e,L,z.color)}),r=t.map(z=>!xe(e,z.name)),a=(z,L)=>{let H=z.values[L];return H==null?0:!P(H)||H<0?(n.push({code:P(H)?"negative-value":"invalid-value",severity:"warning",message:`"${t[L]?.name}" in "${z.name}" is ${P(H)?"negative":"not a number"}; drawn as zero.`,itemId:z.id??z.name}),0):H},o=e.data.map((z,L)=>{let H=t.map((C,y)=>r[y]?a(z,y):0),b=H.reduce((C,y)=>C+y,0),x=P(z.total)&&z.total>=0?z.total:b;return{c:z,ci:L,values:H,sum:b,total:x}}),s=o.reduce((z,L)=>z+L.total,0),c=le(e,s<=0);if(c)return{...c,issues:n};let l=ae(e.format),d=ae(e.xAxis?.format??e.format),{width:m,height:h}=ce(e),f=t.map(z=>({name:z.name,color:z.color})),M=Ie(m,h,{...he,top:he.top+me(e,f,m),bottom:he.bottom+(e.xAxis?.label?14:0)+(e.xAxis?.format?14:0)}),$=Math.max(0,Math.min(.2,e.gap??.01))*M.width,g=Math.max(0,o.length-1),w=Math.max(0,M.width-$*g),R=_e([0,1],[M.y+M.height,M.y],{format:{style:"percent"}}),k=ue(e,m,h,f),T=M.x,D=o.map(z=>{let L=z.total/s*w,H={x:T,w:L};return T+=L+$,{...z,...H}}),v=D.map(z=>({pos:i(z.x+z.w/2),label:z.c.name})),S=We({...k,plot:M,xTicks:Se(v,M.width),yTicks:R.ticks,baseline:R.zero},{xLabel:e.xAxis?.label,yLabel:void 0});if(e.xAxis?.format)for(let z of D)z.w>24&&S.push(J(i(z.x+z.w/2),M.y+M.height+34,d(z.total),{part:"x-total",anchor:"middle"}));let O=[],E=[];for(let z of D){let L=0;z.values.forEach((H,b)=>{let x=t[b];if(H<=0||z.sum<=0)return;let C=H/z.sum,y=R.scale(L+C),B=R.scale(L);L+=C;let U=`${Math.round(C*100)}%`,Y=`${x.name}, ${z.c.name}: ${l(H)} (${U}) \xB7 column ${d(z.total)}`,j=Math.max(0,B-y);O.push({kind:"rect",part:"cell",x:i(z.x),y:i(y),width:i(z.w),height:i(j),fill:x.color,stroke:"var(--skdx-color-surface-default)",title:Y,item:{label:Y,id:`${z.c.id??z.c.name}:${x.name}`,series:x.name,seriesId:x.id,category:z.c.name,index:z.ci,value:H}}),e.labels&&j>14&&z.w>24&&E.push(J(i(z.x+z.w/2),i(y+j/2),U,{part:"cell-label",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-on-accent)"}))})}return{...k,shapes:dt([...S,...O,...E,...k.shapes]),issues:n}}var ti=500;function Po(e){let n=[],t=e.dimensions,r=e.data.filter(v=>!(v.group!==void 0&&xe(e,v.group))),a=le(e,t.length===0||r.length===0);if(a)return{...a,issues:n};let{width:o,height:s}=ce(e),c=[...new Set(e.data.map(v=>v.group).filter(v=>v!==void 0))],l=t[0],d=t[t.length-1],m=v=>(v.label??v.key).length*ie/2+8,h=c.map((v,S)=>({name:v,color:ne(e,S)})),f=Ie(o,s,{top:28+me(e,h,o),right:Math.max(16,m(d)),bottom:16,left:Math.max(48,m(l))}),M=(v,S)=>{let O=v.values[S];return O==null?null:P(O)?O:(n.push({code:"invalid-value",severity:"warning",message:`"${v.name}" has a value on "${S}" that is not a number; drawn as a gap.`,itemId:v.id??v.name}),null)},$=t.map((v,S)=>{let[O,E]=Me(r.map(B=>M(B,v.key))),z=ct(v.min??O,v.max??E),L=v.min??z[0],H=v.max??z[z.length-1],b=v.reversed?[f.y,f.y+f.height]:[f.y+f.height,f.y],x=tt([L,H],b),C=i(t.length===1?f.x+f.width/2:f.x+S*f.width/(t.length-1)),y=ae(v.format??e.format);return{d:v,x:C,scale:B=>i(x(Math.max(L,Math.min(H,B)))),format:y,ticks:z.filter(B=>B>=L-1e-9&&B<=H+1e-9)}}),g=[];$.forEach((v,S)=>{g.push({kind:"line",part:"axis",x1:v.x,x2:v.x,y1:f.y,y2:f.y+f.height,stroke:K.axis});let O=S===$.length-1&&$.length>1?"start":"end";for(let E of v.ticks)g.push(J(i(O==="end"?v.x-6:v.x+6),v.scale(E),v.format(E),{part:"y-label",anchor:O,baseline:"middle"}));g.push(J(v.x,f.y-12,v.d.label??v.d.key,{part:"axis-title",anchor:"middle"}))});let w=r.length<=ti,R=e.opacity??(r.length>200?.25:.6),k=v=>(e.filters??[]).every(S=>{let O=M(v,S.key);return O!==null&&O>=(S.min??-1/0)&&O<=(S.max??1/0)}),T=r.map((v,S)=>{let O=[],E=[];for(let L of $){let H=M(v,L.d.key);if(H===null){!e.connectNulls&&E.length&&(O.push(E),E=[]);continue}E.push({x:L.x,y:L.scale(H)})}E.length&&O.push(E);let z=`${v.name}: ${$.map(L=>{let H=M(v,L.d.key);return`${L.d.label??L.d.key} ${H===null?"\u2014":L.format(H)}`}).join(" \xB7 ")}`;return{kind:"path",part:"row",d:O.map(L=>nt(L,e.curve)).join(""),stroke:v.color??(v.group!==void 0?ne(e,c.indexOf(v.group)):ne(e,0)),strokeWidth:1.5,strokeLinejoin:"round",opacity:k(v)?R:.08,title:w?z:void 0,item:w?{label:z,id:v.id??v.name,name:v.name,category:v.group,index:S}:void 0}}),D=ue(e,o,s,h);return{...D,shapes:[...g,...T,...D.shapes],issues:n}}function Ho(e){let n=e.orientation==="vertical",t=le(e,!P(e.value),600,n?300:64);if(t)return t;let r=ae(e.format),a=e.min??0,o=(e.bands??[]).filter(d=>P(d.from)&&P(d.to)),s=e.max??Math.max(100,e.value,e.target??-1/0,...o.map(d=>d.to)),c=P(e.target)?`, target ${r(e.target)}`:"";return{...yr({...e,height:e.height??(n?300:64),data:[{id:"value",name:e.caption??"",value:e.value,target:e.target,ranges:o}],min:a,max:s,labels:e.labels??!0,ticks:e.ticks}),description:e.description??`${e.caption??"Value"} ${r(e.value)} on a scale from ${r(a)} to ${r(s)}${c}.`}}function Vo(e){let n=[],t=e.data.filter(b=>{let x=P(b.start)||P(b.end);return x||n.push({code:"invalid-value",severity:"warning",message:`"${b.name}" has neither a valid start nor end and was dropped.`,itemId:b.id??b.name}),x}),r=le(e,t.length===0);if(r)return{...r,issues:n};let a=ae(e.xAxis?.format??e.format),{width:o,height:s}=ce(e),c=e.orientation==="vertical",l=e.startLabel??"Start",d=e.endLabel??"End",m=xe(e,l),h=xe(e,d),f=[...t];if(e.sort){let b=x=>e.sort==="change"?(P(x.end)?x.end:0)-(P(x.start)?x.start:0):P(x.end)?x.end:-1/0;f.sort((x,C)=>e.sort==="asc"?b(x)-b(C):b(C)-b(x))}let M=Math.max(0,...f.map(b=>b.name.length))*ie,$=ne(e,0),g=ne(e,1),w=[{name:l,color:$},{name:d,color:g}],R=Ie(o,s,{...he,top:he.top+me(e,w,o)+(c&&e.xAxis?.label?12:0),right:e.labels&&!c?56:he.right,bottom:he.bottom+(!c&&e.xAxis?.label?14:0),left:c?he.left:Math.max(he.left,M+16)}),k=_e(Nt(f.flatMap(b=>[m?void 0:b.start,h?void 0:b.end]),!1),c?[R.y+R.height,R.y]:[R.x,R.x+R.width],e.xAxis??{},e.format),T=Ve(f.length,c?[R.x,R.x+R.width]:[R.y,R.y+R.height]),D=ue(e,o,s,w),v=f.map((b,x)=>({pos:i(T.center(x)),label:b.name})),S=We({...D,plot:R,xTicks:c?Se(v,R.width):v,yTicks:c?k.ticks:Se(k.ticks,R.width),baseline:c?R.y+R.height:R.x},{horizontal:!c,grid:Cn(e.xAxis),...c?{yLabel:e.xAxis?.label}:{xLabel:e.xAxis?.label}});S.push(...Rt(e.references,{plot:R,horizontal:!c,x:b=>{let x=f.findIndex(C=>C.name===b);return x<0?void 0:T.center(x)},y:b=>k.scale(b)}));let O=e.markerSize??5,E=(b,x)=>c?{x:i(x),y:i(k.scale(b))}:{x:i(k.scale(b)),y:i(x)},z=[],L=[],H=[];return f.forEach((b,x)=>{let C=T.center(x),y=P(b.start)?a(b.start):"\u2014",B=P(b.end)?a(b.end):"\u2014",U=`${b.name}: ${y} \u2192 ${B}`,Y={label:U,id:b.id??b.name,name:b.name,index:x,value:P(b.end)?b.end:void 0};if(!m&&!h&&P(b.start)&&P(b.end)){let j=E(b.start,C),I=E(b.end,C);z.push({kind:"line",part:"connector",x1:j.x,y1:j.y,x2:I.x,y2:I.y,stroke:b.color??K.axis,strokeWidth:3,title:U,item:Y})}for(let[j,I,G,V,Q]of[[b.start,"start",l,$,m],[b.end,"end",d,g,h]]){if(Q||!P(j))continue;let p=E(j,C),q=`${b.name} \xB7 ${G}: ${a(j)}`;L.push({kind:"circle",part:I,cx:p.x,cy:p.y,r:O,fill:V,stroke:"var(--skdx-color-surface-default)",title:q,item:{...Y,label:q,series:G}}),e.labels&&H.push(c?J(p.x,i(p.y+(I==="end"?-O-4:O+12)),a(j),{part:"value-label",anchor:"middle"}):J(i(p.x+(I==="end"?O+4:-O-4)),p.y,a(j),{part:"value-label",anchor:I==="end"?"start":"end",baseline:"middle"}))}}),{...D,shapes:[...S,...z,...L,...H,...D.shapes],issues:n}}function _o(e){let n=[],r=e.data.filter(m=>{let h=P(m.value)&&m.value>=0;return h||n.push({code:"invalid-value",severity:"warning",message:`"${m.name}" has no valid non-negative value and was dropped.`,itemId:m.id??m.name}),h}).map((m,h)=>({d:m,i:h})).sort((m,h)=>h.d.value-m.d.value||m.i-h.i),a=r.reduce((m,{d:h})=>m+h.value,0),o=0,s=r.map(({d:m})=>a>0?(o+=m.value)/a:0),c=e.threshold,l=Et({...e,categories:r.map(({d:m})=>m.name),series:[{name:e.name??"Value",type:"bar",data:r.map(({d:m})=>m.value),color:r[0]?.d.color},{name:e.cumulativeLabel??"Cumulative",type:"line",axis:"right",data:s,curve:"linear"}],rightAxis:{min:0,max:1,format:{style:"percent"}},references:c!==void 0&&P(c)?[{y:c,axis:"right",label:`${Math.round(c*100)}%`,variant:"primary"}]:void 0},"bar"),d=l.shapes.map(m=>{if(m.part!=="bar"||m.kind!=="rect"||!m.item||m.item.index===void 0)return m;let h=r[m.item.index]?.d;return h?{...m,fill:h.color??m.fill,item:{...m.item,id:h.id??h.name,name:h.name}}:m});return{...l,shapes:d,issues:[...n,...l.issues??[]]}}function ea(e){let{nodes:n,path:t}=ln(e.data,e.rootId),r=Qt(n,e.maxDepth),a=le(e,r.length===0);if(a)return a;let o=ae(e.format),{width:s,height:c}=ce(e),l=e.orientation!=="horizontal",d=e.nodeShape==="box",m=e.linkStyle??"curve",h=new Set(e.collapsed??[]),f=e.labels??!0,M=[],$=0,g=0,w=(I,G,V,Q)=>{let p=h.has(Ke(I))||h.has(I.name),q=p?[]:I.children??[],N=I.color??V?.color??ne(e,Q),F={node:I,depth:G,slot:0,parent:V,collapsed:p,color:N};if(g=Math.max(g,G),q.length===0)F.slot=$++;else{let _=q.map((W,ee)=>w(W,G+1,F,ee));F.slot=(_[0].slot+_[_.length-1].slot)/2}return M.push(F),F};r.forEach((I,G)=>w(I,0,void 0,G));let R=I=>Math.max(I.name.length,I.subtitle?.length??0),k=Math.max(0,...M.map(I=>R(I.node)))*ie+16,T=e.nodeSize??36,D=e.nodeSize??5,v=d?k:2*D,S=d?T:2*D,O=!d&&f?k:0,E=Ie(s,c,{top:me(e)+S/2+4,bottom:S/2+4+(l&&!d?16:0),left:v/2+4,right:v/2+4+(l?0:O)}),z=Math.max(1,$),L=l?E.width:E.height,H=l?E.height:E.width,b=z===1?0:L/(z-1),x=g===0?0:H/g,C=I=>{let G=z===1?L/2:I.slot*b,V=I.depth*x;return l?{x:i(E.x+G),y:i(E.y+V)}:{x:i(E.x+V),y:i(E.y+G)}},y=[],B=[],U=[];for(let I of M){let{x:G,y:V}=C(I);if(I.parent){let N=C(I.parent),F=d?l?S/2:v/2:D,_=l?N.x:i(N.x+F),W=l?i(N.y+F):N.y,ee=l?G:i(G-F),te=l?i(V-F):V,re=i((_+ee)/2),de=i((W+te)/2),pe=m==="straight"?`M${_} ${W}L${ee} ${te}`:m==="elbow"?l?`M${_} ${W}V${de}H${ee}V${te}`:`M${_} ${W}H${re}V${te}H${ee}`:l?`M${_} ${W}C${_} ${de} ${ee} ${de} ${ee} ${te}`:`M${_} ${W}C${re} ${W} ${re} ${te} ${ee} ${te}`;y.push({kind:"path",part:"link",d:pe,stroke:K.axis,strokeWidth:1.5,title:`${I.parent.node.name} \u2192 ${I.node.name}`})}let Q=Ee(I.node),p=`${I.node.name}${I.node.subtitle?` \xB7 ${I.node.subtitle}`:""}${vo(I.node)?`: ${o(Q)}`:""}${I.collapsed?" (collapsed)":""}`,q={label:p,id:Ke(I.node),name:I.node.name,value:Q};if(d){if(B.push({kind:"rect",part:"node",x:i(G-v/2),y:i(V-S/2),width:i(v),height:i(S),fill:I.color,rx:4,title:p,item:q}),f){let N=!!I.node.subtitle;U.push(J(G,i(N?V-7:V),I.node.name,{part:"node-label",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-on-accent)",weight:"bold"})),N&&U.push(J(G,i(V+8),I.node.subtitle,{part:"node-subtitle",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-on-accent)"}))}}else B.push({kind:"circle",part:"node",cx:G,cy:V,r:i(D),fill:I.color,stroke:"var(--skdx-color-surface-default)",title:p,item:q}),f&&U.push(l?J(G,i(V+D+12),I.node.name,{part:"node-label",anchor:"middle",fill:"var(--skdx-color-text-default)"}):J(i(G+D+4),V,I.node.name,{part:"node-label",baseline:"middle",fill:"var(--skdx-color-text-default)"}));I.collapsed&&U.push(J(i(d?G+v/2-8:G+D+(l?6:-2)),i(d?V-S/2+8:V-D-2),"+",{part:"collapsed",anchor:"middle",baseline:"middle",fill:K.label,weight:"bold"}))}let Y=t.length?[J(8,me(e)+10,t.map(I=>I.name).join(" \u203A "),{part:"breadcrumb",baseline:"middle"})]:[],j=ue(e,s,c);return{...j,shapes:dt([...y,...B,...U,...Y,...j.shapes])}}var jo=e=>ea({...e,nodeShape:"box",linkStyle:"elbow"});function ni(e,n){let t=[],r=e.map((f,M)=>({r:f,i:M})).sort((f,M)=>M.r-f.r),a=new Array(e.length);for(let{r:f,i:M}of r){let $;if(t.length===0)$={x:0,y:0,r:f};else{let w=Math.max(1,f/4);e:for(let R=0;R<1e6;R+=w)for(let k=0;k<24;k++){let T=k/24*2*Math.PI+R*.05,D={x:R*Math.cos(T),y:R*Math.sin(T),r:f};if(t.every(v=>Math.hypot(v.x-D.x,v.y-D.y)>=v.r+D.r+n)){$=D;break e}}}let g=$??{x:0,y:0,r:f};t.push(g),a[M]=g}let o=1/0,s=-1/0,c=1/0,l=-1/0;for(let f of t)o=Math.min(o,f.x-f.r),s=Math.max(s,f.x+f.r),c=Math.min(c,f.y-f.r),l=Math.max(l,f.y+f.r);let d=(o+s)/2,m=(c+l)/2,h=0;for(let f of a)f.x-=d,f.y-=m,h=Math.max(h,Math.hypot(f.x,f.y)+f.r);return{circles:a,enclosing:h}}function Go(e){let n=[],{nodes:t}=ln(e.data,e.rootId),r=Qt(t,e.maxDepth),a=new Map(r.map((S,O)=>[Ke(S),ne(e,O,S.color)])),o=r.filter(S=>!xe(e,S.name)),s=le(e,!o.some(S=>Ee(S)>0),300,300);if(s)return{...s,issues:n};let c=ae(e.format),{width:l,height:d}=ce(e,300,300),m=r.map(S=>({name:S.name,color:a.get(Ke(S))})),h=me(e,m,l),f=e.padding??2,M=e.labels??!0,$=[],g=S=>{S.children?.length?S.children.forEach(g):$.push(Ee(S))};o.forEach(g);let w=wt(e.colorScale,$,ne(e,0),void 0,c),R=[],k=[],T=(S,O,E,z,L)=>{let H=S.filter(y=>{let B=Ee(y)>0;return B||n.push({code:"invalid-value",severity:"warning",message:`"${y.name}" has no positive value and was dropped.`,itemId:Ke(y)}),B});if(H.length===0)return;let{circles:b,enclosing:x}=ni(H.map(y=>Math.sqrt(Ee(y))),0),C=x>0?(z-f)/x:0;H.forEach((y,B)=>{let U=b[B],Y=i(O+U.x*C),j=i(E+U.y*C),I=Math.max(0,U.r*C-f/2),G=Ee(y),V=(y.children?.length??0)>0,Q=y.color??L??a.get(Ke(y))??ne(e,B),p=V?Q:e.colorScale?w.color(G)?.fill??Q:Q,q=`${y.name}: ${c(G)}`;R.push({kind:"circle",part:V?"branch":"leaf",cx:Y,cy:j,r:i(I),fill:p,opacity:V?.15:e.colorScale&&!V?w.color(G)?.opacity:void 0,stroke:"var(--skdx-color-surface-default)",title:q,item:{label:q,id:Ke(y),name:y.name,value:G}}),M&&!V&&I*2>y.name.length*ie+4&&k.push(J(Y,j,y.name,{part:"leaf-label",anchor:"middle",baseline:"middle",fill:"var(--skdx-color-text-on-accent)"})),M&&V&&I*2>y.name.length*ie+4&&k.push(J(Y,i(j-I+10),y.name,{part:"branch-label",anchor:"middle",baseline:"middle"})),V&&T(y.children,Y,j,I,Q)})},D=Math.max(0,Math.min(l,d-h)/2-8);T(o,l/2,h+(d-h)/2,D,void 0);let v=ue(e,l,d,m);return{...v,shapes:dt([...R,...k,...v.shapes]),issues:n}}function Wo(e){let n=[],{nodes:t,path:r}=ln(e.data,e.rootId),a=Qt(t,e.maxDepth).filter(z=>!xe(e,z.name)),o=le(e,!a.some(z=>Ee(z)>0));if(o)return{...o,issues:n};let s=ae(e.format),{width:c,height:l}=ce(e),d=e.orientation==="horizontal",m=e.breadcrumbs&&r.length>0,h=a.map((z,L)=>({name:z.name,color:ne(e,L,z.color)})),f=me(e,h,c)+(m?20:0),M=Ie(c,l,{top:f,right:0,bottom:0,left:0}),$=e.padding??1,g=e.labels??!0,w=Math.max(1,kr(a)),R=(d?M.width:M.height)/w,k=[],T=z=>{z.children?.length?z.children.forEach(T):k.push(Ee(z))};a.forEach(T);let D=wt(e.colorScale,k,ne(e,0),void 0,s),v=[],S=[],O=(z,L,H,b,x)=>{let C=tr(z,e.sort).filter(U=>{let Y=Ee(U)>0;return Y||n.push({code:"invalid-value",severity:"warning",message:`"${U.name}" has no positive value and was dropped.`,itemId:Ke(U)}),Y}),y=C.reduce((U,Y)=>U+Ee(Y),0),B=H;C.forEach((U,Y)=>{let j=Ee(U),I=y>0?j/y*b:0,G=(U.children?.length??0)>0,V=U.color??x??ne(e,Y),Q=!G&&e.colorScale?D.color(j):void 0,p=L*R,q=d?{x:M.x+p+$/2,y:B+$/2,width:R-$,height:I-$}:{x:B+$/2,y:M.y+p+$/2,width:I-$,height:R-$},N=`${U.name}: ${s(j)}`;v.push({kind:"rect",part:"cell",x:i(q.x),y:i(q.y),width:i(Math.max(0,q.width)),height:i(Math.max(0,q.height)),fill:Q?.fill??V,opacity:Q?.opacity??(G?.7:void 0),title:N,item:{label:N,id:Ke(U),name:U.name,value:j}}),g&&q.width>U.name.length*ie+6&&q.height>12&&S.push(J(i(q.x+4),i(q.y+q.height/2),U.name,{part:"cell-label",baseline:"middle",fill:"var(--skdx-color-text-on-accent)"})),G&&O(U.children,L+1,B,I,V),B+=I})};O(a,0,d?M.y:M.x,d?M.height:M.width,void 0),m&&v.push(...nr(r,8,me(e,h,c)+10));let E=ue(e,c,l,h);return{...E,shapes:dt([...v,...S,...E.shapes]),issues:n}}function qo(e){let n=[],t=e.series.map((L,H)=>({...L,index:H,hidden:xe(e,L.name)})),r=Math.max(e.categories?.length??0,...t.map(L=>L.data.length)),a=le(e,r===0||t.every(L=>L.hidden||Pe(L.data).length===0));if(a)return{...a,issues:n};for(let L of t){let H=L.data.filter(b=>b!==null&&!P(b)).length;H&&n.push({code:"invalid-value",severity:"warning",message:`Series "${L.name}" has ${H} value${H===1?"":"s"} that ${H===1?"is":"are"} neither a number nor null; drawn as gaps.`,itemId:L.id??L.name})}let o=ae(e.format),{width:s,height:c}=ce(e),l=t.filter(L=>!L.hidden),d=l.map(()=>new Array(r).fill(null));for(let L=0;L<r;L++){if(e.ranked){l.forEach((b,x)=>{let C=b.data[L];d[x][L]=P(C)?C:null});continue}l.map((b,x)=>({si:x,v:b.data[L]})).filter(b=>P(b.v)).sort((b,x)=>x.v-b.v||b.si-x.si).forEach((b,x)=>{d[b.si][L]=x+1})}let m=e.topRank??Math.max(1,l.length),h=Array.from({length:r},(L,H)=>{let b=e.categories?.[H];return b===void 0?String(H+1):_t(b,e.xAxis?.format)}),f=e.labels??!0,M=f?Math.max(0,...l.map(L=>L.name.length))*ie+12:0,$=e.series.map((L,H)=>({name:L.name,color:ne(e,H,L.color)})),g=Ie(s,c,{...he,top:he.top+me(e,$,s),right:Math.max(he.right,M),bottom:he.bottom+(e.xAxis?.label?14:0)}),w=tt([.5,m+.5],[g.y,g.y+g.height]),R=Ve(r,[g.x,g.x+g.width],0),k=ue(e,s,c,$),T=Array.from({length:m},(L,H)=>({pos:i(w(H+1)),label:`#${H+1}`})),D=We({...k,plot:g,xTicks:Se(h.map((L,H)=>({pos:i(R.center(H)),label:L})),g.width),yTicks:m>20?T.filter((L,H)=>H%Math.ceil(m/20)===0):T,baseline:g.y+g.height},{xLabel:e.xAxis?.label,grid:e.xAxis?.grid!==!1}),v=e.markerSize??5,S=[],O=[],E=[],z=[];return l.forEach((L,H)=>{let b=ne(e,L.index,L.color),x=[],C=[],y;for(let B=0;B<r;B++){let U=d[H][B];if(U==null||U>m||U<1){C.length&&x.push(C),C=[];continue}let Y={x:i(R.center(B)),y:i(w(U))};C.push(Y),y=Y;let j=L.data[B],I=`${L.name}, ${h[B]}: #${U}${e.ranked||!P(j)?"":` (${o(j)})`}`;O.push(Mt(Y.x,Y.y,v,b,I,{label:I,id:L.id??L.name,series:L.name,seriesId:L.id??L.name,category:h[B],index:B,value:U}))}C.length&&x.push(C);for(let B of x)S.push({kind:"path",part:"line",d:nt(B,e.curve??"monotone"),stroke:b,strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round",title:L.name,item:{label:L.name,id:L.id??L.name,series:L.name,seriesId:L.id??L.name}});f&&y&&!z.some(B=>Math.abs(B-y.y)<12)&&(z.push(y.y),E.push(J(i(y.x+v+4),y.y,L.name,{part:"series-label",baseline:"middle",fill:K.label})))}),{...k,shapes:[...D,...S,...O,...E,...k.shapes],issues:n}}var Zo=e=>e*Math.PI/180;function Uo(e){let n=[],t=e.data.map(x=>{let C=P(x.value);return C?x.value<0&&n.push({code:"negative-value",severity:"warning",message:`"${x.name}" is negative (${x.value}); a radius cannot be, so it is drawn as zero.`,itemId:x.id??x.name}):n.push({code:"invalid-value",severity:"warning",message:`"${x.name}" has no valid value and is drawn as zero.`,itemId:x.id??x.name}),{...x,value:C&&x.value>0?x.value:0}}),r=le(e,!t.some(x=>x.value>0),300,300);if(r)return{...r,issues:n};let a=ae(e.format),{width:o,height:s}=ce(e,300,300),c=e.data.map((x,C)=>({name:x.name,color:ne(e,C,x.color)})),l=me(e,c,o),d=o/2,m=l+(s-l)/2,h=Math.max(0,Math.min(o,s-l)/2-(e.labels?40:12)),f=h*Math.min(.9,Math.max(0,e.innerRadius??0)),M=Math.max(1,Math.round(e.levels??4)),$=Math.max(0,...t.map(x=>xe(e,x.name)?0:x.value)),g=ct(0,e.max??$,M).filter(x=>x>0),w=e.max??g[g.length-1],R=(e.scale??"sqrt")==="sqrt",k=x=>{let C=w>0?Math.max(0,Math.min(1,x/w)):0;return f+(h-f)*(R?Math.sqrt(C):C)},T=Zo(e.startAngle??0),D=Zo(e.endAngle??(e.startAngle??0)+360),v=Math.max(0,Math.min(2*Math.PI,D-T)),S=t.length,O=v/Math.max(1,S),E=Math.min(O*.9,Zo(Math.max(0,e.padAngle??0))),z=g.filter(x=>x<=w).flatMap(x=>[{kind:"circle",part:"grid",cx:i(d),cy:i(m),r:i(k(x)),fill:"none",stroke:K.grid},J(i(d+4),i(m-k(x)),a(x),{part:"y-label",baseline:"middle"})]),L=[],H=[];t.forEach((x,C)=>{let y=T+C*O+E/2,B=y+O-E,U=xe(e,x.name),Y=`${x.name}: ${a(x.value)}`;if(!U&&x.value>0&&B>y&&L.push({kind:"path",part:"sector",d:Ze(d,m,k(x.value),f,y,B),fill:ne(e,C,x.color),stroke:"var(--skdx-color-surface-default)",title:Y,item:{label:Y,id:x.id??x.name,name:x.name,index:C,value:x.value}}),e.labels&&!U){let j=(y+B)/2,I=Math.sin(j);H.push(J(i(d+(h+8)*I),i(m-(h+8)*Math.cos(j)),x.name,{part:"sector-label",anchor:I>.1?"start":I<-.1?"end":"middle",baseline:"middle"}))}});let b=ue(e,o,s,c);return{...b,shapes:[...z,...L,...H,...b.shapes],issues:n}}var ri=2e3;function ai(e,n,t){let r=[],a=[],o=(2*n)**2;for(let s of e){let c=[];for(let d=r.length-1;d>=0&&s-r[d].p<2*n;d--)c.push(r[d]);let l=0;for(let d=0;;d++){if(l=d===0?0:(d%2?1:-1)*Math.ceil(d/2),Math.abs(l)>t){l=Math.sign(l)*t;break}if(c.every(m=>(m.p-s)**2+(m.off-l)**2>=o))break}r.push({p:s,off:l}),a.push(l)}return a}function Yo(e){let n=[];for(let T of e.series){let D=T.data.filter(v=>v!==null&&!Number.isFinite(v)).length;D&&n.push({code:"invalid-value",severity:"warning",message:`Series "${T.name}" has ${D} value${D===1?"":"s"} that ${D===1?"is":"are"} neither a number nor null; skipped.`,itemId:T.id??T.name})}let t=e.series.map(T=>xe(e,T.name)?[]:Pe(T.data)),r=le(e,t.every(T=>T.length===0));if(r)return{...r,issues:n};let a=ae(e.yAxis?.format??e.format),{width:o,height:s}=ce(e),c=e.orientation==="horizontal",l=Math.max(0,...e.series.map(T=>T.name.length))*ie,d=e.series.map((T,D)=>({name:T.name,color:ne(e,D,T.color)})),m=Ie(o,s,{...he,top:he.top+me(e,d,o)+(!c&&e.yAxis?.label?12:0),left:c?Math.max(he.left,l+16):he.left,bottom:he.bottom+(c&&e.yAxis?.label?14:0)}),h=_e(Nt(t.flat(),!1),c?[m.x,m.x+m.width]:[m.y+m.height,m.y],e.yAxis??{},e.format),f=Ve(e.series.length,c?[m.y,m.y+m.height]:[m.x,m.x+m.width]),M=ue(e,o,s,d),$=e.series.map((T,D)=>({pos:i(f.center(D)),label:T.name})),g=We({...M,plot:m,xTicks:c?$:Se($,m.width),yTicks:c?Se(h.ticks,m.width):h.ticks,baseline:c?m.x:m.y+m.height},{horizontal:c,grid:Cn(e.yAxis),...c?{xLabel:e.yAxis?.label}:{yLabel:e.yAxis?.label}});g.push(...Rt(e.references,{plot:m,horizontal:c,x:T=>{let D=e.series.findIndex(v=>v.name===T);return D<0?void 0:f.center(D)},y:T=>h.scale(T)}));let w=e.markerSize??3,R=Math.max(0,f.bandwidth/2-w),k=[];return e.series.forEach((T,D)=>{let v=ne(e,D,T.color),S=f.center(D),O=(xe(e,T.name)?[]:T.data).map((L,H)=>({v:L,index:H})).filter(L=>P(L.v)).sort((L,H)=>h.scale(L.v)-h.scale(H.v)),E=ai(O.map(L=>h.scale(L.v)),w,R),z=O.length<=ri;O.forEach((L,H)=>{let b=h.scale(L.v),x=E[H],C=`${T.name}: ${a(L.v)}`;k.push({kind:"circle",part:"dot",cx:i(c?b:S+x),cy:i(c?S+x:b),r:w,fill:v,title:z?C:void 0,item:z?{label:C,id:T.id??T.name,series:T.name,seriesId:T.id??T.name,index:L.index,value:L.v}:void 0})})}),{...M,shapes:[...g,...k,...M.shapes],issues:n}}var oi=8;function si(e){let n=e.map(a=>Math.floor(a)),t=Math.round(e.reduce((a,o)=>a+o,0))-n.reduce((a,o)=>a+o,0),r=e.map((a,o)=>({i:o,frac:a-Math.floor(a)})).sort((a,o)=>o.frac-a.frac||a.i-o.i);for(let{i:a}of r){if(t<=0)break;n[a]++,t--}return n}function Ko(e){let n=[],t=e.data.map(y=>{let B=P(y.value)&&y.value>=0;return B||n.push({code:P(y.value)?"negative-value":"invalid-value",severity:"warning",message:`"${y.name}" has no valid non-negative value and is drawn as zero.`,itemId:y.id??y.name}),{...y,value:B?y.value:0}}),r=t.reduce((y,B)=>y+(xe(e,B.name)?0:B.value),0),a=le(e,r<=0,300,300);if(a)return{...a,issues:n};let o=ae(e.format),s=P(e.total)&&e.total>0?e.total:r,c=Math.max(1,Math.round(e.rows??10)),l=Math.max(1,Math.round(e.columns??10)),d=c*l,m=y=>s>0?y/s:0,h=si(t.map(y=>xe(e,y.name)?0:Math.min(1,m(y.value))*d)),{width:f,height:M}=ce(e,300,300),$=new Map(t.map(y=>[y.name,`${Math.round(m(y.value)*100)}%`])),g=Vn(e),w=e.data.map((y,B)=>({name:y.name,color:ne(e,B,y.color)})),R=e.labels&&g?{...e,legend:{...g,formatter:y=>`${g.formatter?.(y)??y} ${$.get(y)??""}`}}:e,k=me(R,w,f),T=Math.max(0,e.cellGap??2),D=Math.max(1,Math.min((f-2*oi)/l,(M-k-2*oi)/c)),v=(f-D*l)/2,S=k+(M-k-D*c)/2,O=e.orientation==="horizontal",E=y=>O?{x:v+y%l*D,y:S+Math.floor(y/l)*D}:{x:v+Math.floor(y/c)*D,y:S+(c-1-y%c)*D},z=(y,B,U,Y,j,I)=>{let{x:G,y:V}=E(y);return{kind:"rect",part:"cell",x:i(G+T/2),y:i(V+T/2),width:i(Math.max(.5,D-T)),height:i(Math.max(.5,D-T)),fill:B,stroke:I,opacity:j,rx:e.cellRadius??2,title:U,item:Y}},L=[],H=0;t.forEach((y,B)=>{let U=h[B],Y=`${y.name}: ${o(y.value)} (${Math.round(m(y.value)*100)}%)`,j={label:Y,id:y.id??y.name,name:y.name,index:B,value:y.value};for(let I=0;I<U&&H<d;I++,H++)L.push(z(H,ne(e,B,y.color),Y,j))});let b=s-r,x=b>0?`Other: ${o(b)} (${Math.round(m(b)*100)}%)`:"Empty";for(;H<d;H++)L.push(z(H,K.grid,x,void 0,.6,K.axis));let C=ue(R,f,M,w);return{...C,shapes:[...L,...C.shapes],issues:n}}import{css as kl,html as En,LitElement as $l,nothing as qe,svg as jt}from"lit";import{property as ge,state as Jt}from"lit/decorators.js";import{ifDefined as ze}from"lit/directives/if-defined.js";var Ne={fromAttribute:()=>!1},X=class extends $l{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 a=this.drag;if(a?.grab==="select"){let{x:o,y:s}=this.viewBox(t,r);this.overlay=[ro(Yr(a.x,a.y,o,s))];return}if(a?.grab==="lasso"){let{x:o,y:s}=this.viewBox(t,r);a.points=[...a.points??[],{x:o,y:s}],this.overlay=[oo(a.points)];return}if(a?.grab==="edit"){if(!a.gantt)return;let{x:o}=this.viewBox(t,r);a.change=io(r,a.gantt,o-a.x),this.overlay=[co(r,a.gantt,a.change)];return}if(a?.grab==="map"){if(!r.map||!a.view)return;let{x:o,y:s}=this.viewBox(t,r);this.setView(uo(r.map,a.view,o-a.x,s-a.y));return}if(a&&r.hit){if(a.grab==="pinch"){let[s,c]=[...this.pointers.values()];if(s===void 0||c===void 0||!a.distance)return;this.setZoom(bo(r.hit,a.zoom,Math.abs(s-c)/a.distance,(s+c)/2));return}let{x:o}=this.viewBox(t,r);this.setZoom(a.grab==="pan"?go(r.hit,a.zoom,o-a.x):yo(r.hit,a.grab,a.zoom,o-a.x));return}if(r.tooltipPortal){let{lines:o,shapes:s}=Ja(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=eo(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(to(r,t.target)),this.syncId&&r.hit?.crosshair){let o=vr(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:a,y:o}=this.viewBox(t,r),s=Nn(r,t.target)?.item.legend,c=this.canEdit(r)?so(r,a,o):void 0;if(c){this.drag={x:a,y:o,zoom:{start:0,end:0},grab:"edit",gantt:c},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.brushing()&&!s){this.drag={x:a,y:o,zoom:{start:0,end:0},grab:this.selectionMode==="lasso"?"lasso":"select",points:[{x:a,y:o}]},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.canPan(r)&&r.map){let d=r.map.plot;if(a<d.x||a>d.x+d.width||o<d.y||o>d.y+d.height)return;this.drag={x:a,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,a),this.pointers.size===2){let[d,m]=[...this.pointers.values()];this.drag={x:(d+m)/2,y:o,zoom:l.zoom,grab:"pinch",distance:Math.abs(d-m)||1}}else{let d=xo(l,a,o);if(d)this.drag={x:a,y:o,zoom:d.zoom,grab:d.grab},d.zoom!==l.zoom&&this.setZoom(d.zoom);else if(this.zoomable&&a>=l.plot.x&&a<=l.plot.x+l.plot.width&&o>=l.plot.y&&o<=l.plot.y+l.plot.height)this.drag={x:a,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 a=this.drag,o=this.layout;if(o&&(a?.grab==="select"||a?.grab==="lasso"||a?.grab==="edit"||a?.grab==="map")){this.overlay=[];let{x:s,y:c}=this.viewBox(t,o);if(Math.abs(s-a.x)>2||Math.abs(c-a.y)>2){a.grab==="select"?this.setSelected(no(o,Yr(a.x,a.y,s,c))):a.grab==="lasso"?this.setSelected(ao(o,a.points??[])):a.grab==="edit"&&a.change&&this.emit("skdx-task-change",a.change),this.drag={...a,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:a,y:o}=this.viewBox(t,r);if(r.map&&this.canPan(r)){let l=r.map.plot;if(a<l.x||a>l.x+l.width||o<l.y||o>l.y+l.height)return;t.preventDefault(),this.setView(mo(r.map,t.deltaY,a,o));return}let s=r.hit;if(!s||!this.canZoom(r)||o<s.plot.y||o>s.plot.y+s.plot.height)return;let c=po(s,t.deltaY,a);c&&(t.preventDefault(),this.setZoom(c))};this.onClick=t=>{if(!this.layout)return;if(this.drag?.distance===-1){this.drag=null;return}let r=Nn(this.layout,t.target);r&&(r.item.range?this.setZoom(r.item.range):r.item.legend&&r.item.series!==void 0?this.toggle(r.item.series):(this.select(r.item),this.emit("skdx-item-click",r.item)))};this.onKeyDown=t=>{if(t.key==="Escape"){t.preventDefault(),this.focused=null,this.clearTip(),this.crossState=null,this.highlight(null);return}let r=this.layout;if(!r)return;if((t.key==="Enter"||t.key===" ")&&this.focused!==null){let c=r.shapes[this.focused]?.item;c&&(t.preventDefault(),this.select(c),this.emit("skdx-item-click",c));return}let a=this.canEdit(r)?lo(r,this.focused,t):void 0;if(a){t.preventDefault(),this.emit("skdx-task-change",a);return}let o=fo(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?zn(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:a,tooltip:o,format:s,palette:c,loading:l,error:d,emptyMessage:m,description:h,decorative:f,animated:M,responsive:$,highlighted:g,highlightScope:w,accessibleTable:R}=this;return{...typeof $=="object"&&this.measured!==void 0&&this.measured<($.breakpoint??480)?$.compact:void 0,width:$&&this.measured?this.measured:t,height:r,animate:M,responsive:$,legend:a,tooltip:o,format:s,palette:c,loading:l,error:d,emptyMessage:m,description:h,decorative:f,highlighted:g===void 0?this.highlightState:g,highlightScope:w,accessibleTable:R,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&&$r(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=$r(this.syncId),r=a=>{"highlighted"in a&&(this.highlightState=a.highlighted??null),a.selected&&(this.selectedState=a.selected,this.crossFilter&&(this.highlightState=a.selected.length?a.selected:null)),"zoom"in a&&(this.zoomState=a.zoom),a.hiddenSeries&&(this.hiddenState=a.hiddenSeries),"crosshair"in a&&(this.crossState=a.crosshair??null)};r(t.current),this.leave=t.subscribe((a,o)=>{o!==this.token&&r(a)})}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,a=r.includes(t)?r.filter(o=>o!==t):[...r,t];this.hiddenState=a,this.emit("skdx-hidden-series-change",a),this.publish({hiddenSeries:a})}highlight(t){let r=this.hover;r===t||r&&t&&Oa(r,t)||(this.hover=t,this.emit("skdx-highlighted-change",t),this.highlightState=t,this.syncId&&this.publish({highlighted:t}))}select(t){let r=this.selectionMode;r!=="none"&&this.setSelected(Sa(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 er(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 a=r.shapes.findIndex(o=>o.item&&!o.item.legend&&sn(o.item,t));return a<0?!1:(this.getSvgElement()?.focus(),this.focused=a,!0)}export(t){let r=this.layout;return r?Qr(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,a){this.join();let o=za(xa(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let w of o.issues??[])this.emit("skdx-data-issue",w)}let s=this.canZoom(o),c=this.canPan(o),l=this.canEdit(o),d=this.brushing(),m=s||c||l||d,h=!o.decorative&&Kr(o).length>0,f=$o(o),M=Mo(o,this.accessibleTable),$=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||a,g=this.portal;return En`<svg
3
4
  xmlns="http://www.w3.org/2000/svg"
4
5
  viewBox="0 0 ${o.width} ${o.height}"
5
6
  width=${o.width}
6
7
  height=${o.height}
7
8
  role=${o.decorative?"presentation":"img"}
8
- aria-hidden=${o.decorative?"true":We}
9
- aria-label=${o.decorative?We:a}
10
- aria-describedby=${Re(f)}
11
- tabindex=${h?0:We}
9
+ aria-hidden=${o.decorative?"true":qe}
10
+ aria-label=${o.decorative?qe:a}
11
+ aria-description=${ze(o.description)}
12
+ tabindex=${h?0:qe}
12
13
  data-skdx-chart=${r}
13
- data-zoomable=${s||c?"":We}
14
- data-brushing=${d&&!(s||c)?"":We}
15
- data-editable=${l?"":We}
16
- style=${y?`--skdx-chart-duration:${y}`:We}
17
- font-family=${Y.fontFamily}
18
- font-size=${Y.fontSize}
19
- @pointermove=${o.tooltip||u?this.onPointerMove:We}
14
+ data-zoomable=${s||c?"":qe}
15
+ data-brushing=${d&&!(s||c)?"":qe}
16
+ data-editable=${l?"":qe}
17
+ style=${f?`--skdx-chart-duration:${f}`:qe}
18
+ font-family=${K.fontFamily}
19
+ font-size=${K.fontSize}
20
+ @pointermove=${o.tooltip||m?this.onPointerMove:qe}
20
21
  @pointerleave=${()=>{this.clearTip(),this.highlight(null)}}
21
- @pointerdown=${u?this.onPointerDown:We}
22
- @pointerup=${u?this.onPointerUp:We}
23
- @pointercancel=${u?this.onPointerUp:We}
24
- @wheel=${s||c?this.onWheel:We}
25
- @dblclick=${s||c?()=>c?this.setView(void 0):this.setZoom(void 0):We}
22
+ @pointerdown=${m?this.onPointerDown:qe}
23
+ @pointerup=${m?this.onPointerUp:qe}
24
+ @pointercancel=${m?this.onPointerUp:qe}
25
+ @wheel=${s||c?this.onWheel:qe}
26
+ @dblclick=${s||c?()=>c?this.setView(void 0):this.setZoom(void 0):qe}
26
27
  @click=${this.onClick}
27
- @keydown=${h?this.onKeyDown:We}
28
+ @keydown=${h?this.onKeyDown:qe}
28
29
  @blur=${()=>{this.focused=null,this.highlight(null)}}
29
30
  >
30
31
  <title>${a}</title>
31
- ${o.description?Bt`<desc id=${Re(f)}>${o.description}</desc>`:We}
32
- ${y?Bt`<style>${po}</style>`:We} ${hl(o)}
33
- ${Yr(o.shapes)}
34
- ${Yr(this.tip.length||!this.crossState?this.tip:Wa(o,this.crossState))}
35
- ${Yr(oo(o,this.focused))} ${Yr(this.overlay)}
32
+ ${o.description?jt`<desc>${o.description}</desc>`:qe}
33
+ ${f?jt`<style>${ko}</style>`:qe} ${Il(o)}
34
+ ${ta(o.shapes)}
35
+ ${ta(this.tip.length||!this.crossState?this.tip:Qa(o,this.crossState))}
36
+ ${ta(ho(o,this.focused))} ${ta(this.overlay)}
36
37
  </svg>
37
- ${T?Rn`<div
38
+ ${g?En`<div
38
39
  role="tooltip"
39
40
  data-skdx-tooltip=${r}
40
- style="left:${T.x+12}px;top:${T.y+12}px"
41
+ style="left:${g.x+12}px;top:${g.y+12}px"
41
42
  >
42
- ${T.lines.map(O=>Rn`<div>${O}</div>`)}
43
- </div>`:We}
44
- ${I?Rn`<table data-skdx-table=${r}>
43
+ ${g.lines.map(w=>En`<div>${w}</div>`)}
44
+ </div>`:qe}
45
+ ${M?En`<table data-skdx-table=${r}>
45
46
  <caption>
46
- ${x}
47
+ ${$}
47
48
  </caption>
48
49
  <thead>
49
50
  <tr>
50
- ${(I[0]??[]).map(O=>Rn`<th scope="col">${O}</th>`)}
51
+ ${(M[0]??[]).map(w=>En`<th scope="col">${w}</th>`)}
51
52
  </tr>
52
53
  </thead>
53
54
  <tbody>
54
- ${I.slice(1).map(O=>Rn`<tr>
55
- ${O.map((b,z)=>z===0?Rn`<th scope="row">${b}</th>`:Rn`<td>${b}</td>`)}
55
+ ${M.slice(1).map(w=>En`<tr>
56
+ ${w.map((R,k)=>k===0?En`<th scope="row">${R}</th>`:En`<td>${R}</td>`)}
56
57
  </tr>`)}
57
58
  </tbody>
58
- </table>`:We}`}};X.styles=ml`
59
+ </table>`:qe}`}};X.styles=kl`
59
60
  :host {
60
61
  display: inline-block;
61
62
  }
@@ -63,7 +64,6 @@ var Js=Object.defineProperty;var ei=Object.getOwnPropertyDescriptor;var m=(e,n,t
63
64
  display: block;
64
65
  max-width: 100%;
65
66
  height: auto;
66
- outline: none;
67
67
  }
68
68
  svg[data-zoomable] {
69
69
  cursor: grab;
@@ -78,6 +78,9 @@ var Js=Object.defineProperty;var ei=Object.getOwnPropertyDescriptor;var m=(e,n,t
78
78
  }
79
79
  :host([responsive]) {
80
80
  display: block;
81
+ /* Keep centered flex/grid hosts independent of the previous SVG's intrinsic width. */
82
+ width: 100%;
83
+ min-width: 0;
81
84
  }
82
85
  table {
83
86
  position: absolute;
@@ -97,7 +100,7 @@ var Js=Object.defineProperty;var ei=Object.getOwnPropertyDescriptor;var m=(e,n,t
97
100
  background: var(--skdx-color-surface-raised);
98
101
  color: var(--skdx-color-text-default);
99
102
  border: 1px solid var(--skdx-color-border-strong);
100
- border-radius: 3px;
103
+ border-radius: var(--skdx-radius-default, var(--skdx-radius-md, 0.5rem));
101
104
  padding: 4px 8px;
102
105
  font-family: var(--skdx-font-family);
103
106
  font-size: var(--skdx-font-size-xs);
@@ -106,4 +109,4 @@ var Js=Object.defineProperty;var ei=Object.getOwnPropertyDescriptor;var m=(e,n,t
106
109
  [role='tooltip'] > :first-child:not(:only-child) {
107
110
  font-weight: bold;
108
111
  }
109
- `,m([fe({type:Number})],X.prototype,"width",2),m([fe({type:Number})],X.prototype,"height",2),m([fe()],X.prototype,"label",2),m([fe({type:Boolean,reflect:!0})],X.prototype,"legend",2),m([fe({type:Boolean,attribute:"no-tooltip",converter:Le})],X.prototype,"tooltip",2),m([fe({attribute:!1})],X.prototype,"format",2),m([fe({attribute:!1})],X.prototype,"palette",2),m([fe({attribute:!1})],X.prototype,"hiddenSeries",2),m([fe({attribute:!1})],X.prototype,"selected",2),m([fe({attribute:"selection-mode"})],X.prototype,"selectionMode",2),m([fe({attribute:!1})],X.prototype,"highlighted",2),m([fe({attribute:!1})],X.prototype,"highlightScope",2),m([fe({type:Boolean,reflect:!0})],X.prototype,"loading",2),m([fe()],X.prototype,"error",2),m([fe({attribute:"empty-message"})],X.prototype,"emptyMessage",2),m([fe()],X.prototype,"description",2),m([fe({type:Boolean,reflect:!0})],X.prototype,"decorative",2),m([fe({type:Boolean,attribute:"accessible-table"})],X.prototype,"accessibleTable",2),m([fe({attribute:!1})],X.prototype,"zoom",2),m([fe({attribute:!1})],X.prototype,"view",2),m([fe({type:Boolean,reflect:!0})],X.prototype,"zoomable",2),m([fe({type:Boolean,reflect:!0})],X.prototype,"editable",2),m([fe({attribute:"sync-id"})],X.prototype,"syncId",2),m([fe({type:Boolean,attribute:"cross-filter"})],X.prototype,"crossFilter",2),m([fe({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],X.prototype,"animated",2),m([fe({type:Boolean,reflect:!0})],X.prototype,"responsive",2),m([Ut()],X.prototype,"tip",2),m([Ut()],X.prototype,"overlay",2),m([Ut()],X.prototype,"portal",2),m([Ut()],X.prototype,"measured",2),m([Ut()],X.prototype,"viewState",2),m([Ut()],X.prototype,"highlightState",2),m([Ut()],X.prototype,"crossState",2),m([Ut()],X.prototype,"focused",2),m([Ut()],X.prototype,"hiddenState",2),m([Ut()],X.prototype,"zoomState",2),m([Ut()],X.prototype,"selectedState",2);var ke=class extends X{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:a,yAxis:o,rightAxis:s,references:c,annotations:l,labels:d,curve:u,connectNulls:h,nulls:f,stacked:y,stackOffset:I,orientation:x,radius:T,barGap:O,barWidth:b,sort:z,transform:N,transforms:k,bins:$,binWidth:L,binDomain:S,binMode:v,sampling:R,brush:j,crosshair:p}=this;return{...this.sized(),series:t,categories:r,xAxis:a,yAxis:o,rightAxis:s,references:c,annotations:l,labels:d,curve:u,connectNulls:h,nulls:f,stacked:y,stackOffset:I,orientation:x,radius:T,barGap:O,barWidth:b,sort:z,transform:N,transforms:k,bins:$,binWidth:L,binDomain:S,binMode:v,sampling:R,brush:j,crosshair:p}}};m([fe({attribute:!1})],ke.prototype,"series",2),m([fe({attribute:!1})],ke.prototype,"categories",2),m([fe({attribute:!1})],ke.prototype,"xAxis",2),m([fe({attribute:!1})],ke.prototype,"yAxis",2),m([fe({attribute:!1})],ke.prototype,"rightAxis",2),m([fe({attribute:!1})],ke.prototype,"references",2),m([fe({attribute:!1})],ke.prototype,"annotations",2),m([fe({type:Boolean,reflect:!0})],ke.prototype,"labels",2),m([fe()],ke.prototype,"curve",2),m([fe({type:Boolean,attribute:"connect-nulls"})],ke.prototype,"connectNulls",2),m([fe()],ke.prototype,"nulls",2),m([fe({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],ke.prototype,"stacked",2),m([fe({attribute:"stack-offset"})],ke.prototype,"stackOffset",2),m([fe()],ke.prototype,"orientation",2),m([fe({type:Number})],ke.prototype,"radius",2),m([fe({type:Number,attribute:"bar-gap"})],ke.prototype,"barGap",2),m([fe({type:Number,attribute:"bar-width"})],ke.prototype,"barWidth",2),m([fe()],ke.prototype,"sort",2),m([fe()],ke.prototype,"transform",2),m([fe({attribute:!1})],ke.prototype,"transforms",2),m([fe({type:Number})],ke.prototype,"bins",2),m([fe({type:Number,attribute:"bin-width"})],ke.prototype,"binWidth",2),m([fe({attribute:!1})],ke.prototype,"binDomain",2),m([fe({attribute:"bin-mode"})],ke.prototype,"binMode",2),m([fe({attribute:!1})],ke.prototype,"sampling",2),m([fe({type:Boolean,reflect:!0})],ke.prototype,"brush",2),m([fe({type:Boolean,reflect:!0})],ke.prototype,"crosshair",2);var hl=e=>e.defs&&e.defs.length?Bt`<defs>${e.defs.map(n=>Bt`<linearGradient id=${n.id} x1="0" y1="0" x2=${n.vertical===!1?1:0} y2=${n.vertical===!1?0:1}>${n.stops.map(t=>Bt`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${Re(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:We,Yr=e=>Bt`${e.map((n,t)=>{let r=n.title?Bt`<title>${n.title}</title>`:We,a=n.item?t:void 0;switch(n.kind){case"path":return Bt`<path data-skdx-part=${n.part} data-skdx-i=${Re(a)} d=${n.d} fill=${n.fill??"none"} stroke=${Re(n.stroke)} stroke-width=${Re(n.strokeWidth)} stroke-linecap=${Re(n.strokeLinecap)} stroke-linejoin=${Re(n.strokeLinejoin)} stroke-dasharray=${Re(n.dash)} opacity=${Re(n.opacity)} fill-opacity=${Re(n.fillOpacity)}>${r}</path>`;case"rect":return Bt`<rect data-skdx-part=${n.part} data-skdx-i=${Re(a)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${Re(n.rx)} fill=${n.fill} stroke=${Re(n.stroke)} fill-opacity=${Re(n.opacity)}>${r}</rect>`;case"line":return Bt`<line data-skdx-part=${n.part} data-skdx-i=${Re(a)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${Re(n.strokeWidth)} stroke-dasharray=${Re(n.dash)} opacity=${Re(n.opacity)}>${r}</line>`;case"circle":return Bt`<circle data-skdx-part=${n.part} data-skdx-i=${Re(a)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${Re(n.stroke)} opacity=${Re(n.opacity)}>${r}</circle>`;case"text":return Bt`<text data-skdx-part=${n.part} data-skdx-i=${Re(a)} x=${n.x} y=${n.y} text-anchor=${Re(n.anchor)} dominant-baseline=${Re(n.baseline)} fill=${Re(n.fill)} font-weight=${Re(n.weight)} pointer-events=${Re(a===void 0?"none":void 0)} transform=${Re(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var $r=class extends ke{render(){return this.root(xa(this.input()),"bar",this.label??"Bar chart")}};$r=m([fl("skdx-bar-chart")],$r);import{customElement as pl}from"lit/decorators.js";var kr=class extends ke{render(){return this.root(ya(this.input()),"line",this.label??"Line chart")}};kr=m([pl("skdx-line-chart")],kr);import{customElement as bl}from"lit/decorators.js";var Ir=class extends ke{render(){return this.root(va(this.input()),"area",this.label??"Area chart")}};Ir=m([bl("skdx-area-chart")],Ir);import{customElement as gl,property as Yt}from"lit/decorators.js";var it=class extends X{constructor(){super(...arguments);this.data=[];this.labels=!1}render(){let{data:t,variant:r,innerRadius:a,outerRadius:o,labels:s,labelPosition:c,padAngle:l,sort:d,startAngle:u,endAngle:h,centerLabel:f}=this;return this.root(Ta({...this.sized(),data:t,variant:r,innerRadius:a,outerRadius:o,labels:s,labelPosition:c,padAngle:l,sort:d,startAngle:u,endAngle:h,centerLabel:f}),"pie",this.label??"Pie chart")}};m([Yt({attribute:!1})],it.prototype,"data",2),m([Yt()],it.prototype,"variant",2),m([Yt({type:Number,attribute:"inner-radius"})],it.prototype,"innerRadius",2),m([Yt({type:Number,attribute:"outer-radius"})],it.prototype,"outerRadius",2),m([Yt({type:Boolean,reflect:!0})],it.prototype,"labels",2),m([Yt({attribute:"label-position"})],it.prototype,"labelPosition",2),m([Yt({type:Number,attribute:"pad-angle"})],it.prototype,"padAngle",2),m([Yt()],it.prototype,"sort",2),m([Yt({type:Number,attribute:"start-angle"})],it.prototype,"startAngle",2),m([Yt({type:Number,attribute:"end-angle"})],it.prototype,"endAngle",2),m([Yt({attribute:"center-label"})],it.prototype,"centerLabel",2),it=m([gl("skdx-pie-chart")],it);import{customElement as xl,property as St}from"lit/decorators.js";var Ke=class extends X{constructor(){super(...arguments);this.series=[];this.labels=!1}render(){let{series:t,sizeRange:r,labels:a,xAxis:o,yAxis:s,references:c,annotations:l,colorScale:d,colorLegend:u,hitRadius:h,jitter:f,trendline:y,sampling:I}=this;return this.root(pa({...this.sized(),series:t,sizeRange:r,labels:a,xAxis:o,yAxis:s,references:c,annotations:l,colorScale:d,colorLegend:u,hitRadius:h,jitter:f,trendline:y,sampling:I}),"scatter",this.label??"Scatter chart")}};m([St({attribute:!1})],Ke.prototype,"series",2),m([St({attribute:!1})],Ke.prototype,"sizeRange",2),m([St({type:Boolean,reflect:!0})],Ke.prototype,"labels",2),m([St({attribute:!1})],Ke.prototype,"xAxis",2),m([St({attribute:!1})],Ke.prototype,"yAxis",2),m([St({attribute:!1})],Ke.prototype,"references",2),m([St({attribute:!1})],Ke.prototype,"annotations",2),m([St({attribute:!1})],Ke.prototype,"colorScale",2),m([St({attribute:!1})],Ke.prototype,"colorLegend",2),m([St({type:Number,attribute:"hit-radius"})],Ke.prototype,"hitRadius",2),m([St({type:Number})],Ke.prototype,"jitter",2),m([St({attribute:!1})],Ke.prototype,"trendline",2),m([St({attribute:!1})],Ke.prototype,"sampling",2),Ke=m([xl("skdx-scatter-chart")],Ke);import{customElement as yl,property as on}from"lit/decorators.js";var ut=class extends X{constructor(){super(...arguments);this.data=[];this.trend=!1;this.extremes=!1;this.lastValue=!1}render(){let{data:t,color:r,curve:a,variant:o,trend:s,extremes:c,lastValue:l,target:d,band:u,markers:h}=this;return this.root(Ca({...this.sized(),data:t,color:r,curve:a,variant:o,trend:s,extremes:c,lastValue:l,target:d,band:u,markers:h}),"sparkline",this.label??"Sparkline")}};m([on({attribute:!1})],ut.prototype,"data",2),m([on()],ut.prototype,"color",2),m([on()],ut.prototype,"curve",2),m([on()],ut.prototype,"variant",2),m([on({type:Boolean,reflect:!0})],ut.prototype,"trend",2),m([on({type:Boolean,reflect:!0})],ut.prototype,"extremes",2),m([on({type:Boolean,reflect:!0,attribute:"last-value"})],ut.prototype,"lastValue",2),m([on({type:Number})],ut.prototype,"target",2),m([on({attribute:!1})],ut.prototype,"band",2),m([on({attribute:!1})],ut.prototype,"markers",2),ut=m([yl("skdx-sparkline")],ut);import{customElement as vl,property as Ft}from"lit/decorators.js";var tt=class extends X{constructor(){super(...arguments);this.series=[];this.fill=!0;this.markers=!0;this.labels=!1}render(){let{series:t,categories:r,metrics:a,normalized:o,max:s,fill:c,levels:l,markers:d,markerSize:u,labels:h,startAngle:f,gridShape:y}=this;return this.root(Aa({...this.sized(),series:t,categories:r,metrics:a,normalize:o,max:s,fill:c,levels:l,markers:d,markerSize:u,labels:h,startAngle:f,gridShape:y}),"radar",this.label??"Radar chart")}};m([Ft({attribute:!1})],tt.prototype,"series",2),m([Ft({attribute:!1})],tt.prototype,"categories",2),m([Ft({attribute:!1})],tt.prototype,"metrics",2),m([Ft({attribute:!1})],tt.prototype,"normalized",2),m([Ft({type:Number})],tt.prototype,"max",2),m([Ft({type:Boolean,attribute:"no-fill",converter:Le})],tt.prototype,"fill",2),m([Ft({type:Number})],tt.prototype,"levels",2),m([Ft({type:Boolean,attribute:"no-markers",converter:Le})],tt.prototype,"markers",2),m([Ft({type:Number,attribute:"marker-size"})],tt.prototype,"markerSize",2),m([Ft({type:Boolean,reflect:!0})],tt.prototype,"labels",2),m([Ft({type:Number,attribute:"start-angle"})],tt.prototype,"startAngle",2),m([Ft({attribute:"grid-shape"})],tt.prototype,"gridShape",2),tt=m([vl("skdx-radar-chart")],tt);import{customElement as Ml,property as Xe}from"lit/decorators.js";var Fe=class extends X{constructor(){super(...arguments);this.diverging=!1;this.labels=!1}render(){let{rows:t,columns:r,data:a,calendar:o,color:s,diverging:c,negativeColor:l,labels:d,domain:u,steps:h,weekStart:f,colorScale:y,colorLegend:I,missingColor:x,cellGap:T,cellRadius:O,rowOrder:b,columnOrder:z}=this;return this.root(Sa({...this.sized(),rows:t,columns:r,data:a,calendar:o,color:s,diverging:c,negativeColor:l,labels:d,domain:u,steps:h,weekStart:f,colorScale:y,colorLegend:I,missingColor:x,cellGap:T,cellRadius:O,rowOrder:b,columnOrder:z}),"heatmap",this.label??"Heatmap")}};m([Xe({attribute:!1})],Fe.prototype,"rows",2),m([Xe({attribute:!1})],Fe.prototype,"columns",2),m([Xe({attribute:!1})],Fe.prototype,"data",2),m([Xe({attribute:!1})],Fe.prototype,"calendar",2),m([Xe()],Fe.prototype,"color",2),m([Xe({type:Boolean,reflect:!0})],Fe.prototype,"diverging",2),m([Xe({attribute:"negative-color"})],Fe.prototype,"negativeColor",2),m([Xe({type:Boolean,reflect:!0})],Fe.prototype,"labels",2),m([Xe({attribute:!1})],Fe.prototype,"domain",2),m([Xe({type:Number})],Fe.prototype,"steps",2),m([Xe({attribute:"week-start"})],Fe.prototype,"weekStart",2),m([Xe({attribute:!1})],Fe.prototype,"colorScale",2),m([Xe({attribute:!1})],Fe.prototype,"colorLegend",2),m([Xe({attribute:"missing-color"})],Fe.prototype,"missingColor",2),m([Xe({type:Number,attribute:"cell-gap"})],Fe.prototype,"cellGap",2),m([Xe({type:Number,attribute:"cell-radius"})],Fe.prototype,"cellRadius",2),m([Xe({attribute:"row-order"})],Fe.prototype,"rowOrder",2),m([Xe({attribute:"column-order"})],Fe.prototype,"columnOrder",2),Fe=m([Ml("skdx-heatmap")],Fe);import{customElement as wl,property as er}from"lit/decorators.js";var Kt=class extends X{constructor(){super(...arguments);this.data=[]}render(){let{data:t,orientation:r,variant:a,gap:o,labelPosition:s,sort:c}=this;return this.root(za({...this.sized(),data:t,orientation:r,variant:a,gap:o,labelPosition:s,sort:c}),"funnel",this.label??"Funnel chart")}};m([er({attribute:!1})],Kt.prototype,"data",2),m([er()],Kt.prototype,"orientation",2),m([er()],Kt.prototype,"variant",2),m([er({type:Number})],Kt.prototype,"gap",2),m([er({attribute:"label-position"})],Kt.prototype,"labelPosition",2),m([er()],Kt.prototype,"sort",2),Kt=m([wl("skdx-funnel-chart")],Kt);import{customElement as $l,property as sn}from"lit/decorators.js";var ht=class extends X{constructor(){super(...arguments);this.links=[];this.nodeLabels=!0;this.linkLabels=!1}render(){let{links:t,nodes:r,align:a,nodeWidth:o,nodePadding:s,nodeSort:c,linkSort:l,nodeLabels:d,linkLabels:u,cyclePolicy:h}=this;return this.root(go({...this.sized(),links:t,nodes:r,align:a,nodeWidth:o,nodePadding:s,nodeSort:c,linkSort:l,nodeLabels:d,linkLabels:u,cyclePolicy:h}),"sankey",this.label??"Sankey chart")}};m([sn({attribute:!1})],ht.prototype,"links",2),m([sn({attribute:!1})],ht.prototype,"nodes",2),m([sn()],ht.prototype,"align",2),m([sn({type:Number,attribute:"node-width"})],ht.prototype,"nodeWidth",2),m([sn({type:Number,attribute:"node-padding"})],ht.prototype,"nodePadding",2),m([sn({attribute:"node-sort"})],ht.prototype,"nodeSort",2),m([sn({attribute:"link-sort"})],ht.prototype,"linkSort",2),m([sn({type:Boolean,attribute:"no-node-labels",converter:Le})],ht.prototype,"nodeLabels",2),m([sn({type:Boolean,reflect:!0,attribute:"link-labels"})],ht.prototype,"linkLabels",2),m([sn({attribute:"cycle-policy"})],ht.prototype,"cyclePolicy",2),ht=m([$l("skdx-sankey-chart")],ht);import{customElement as kl,property as gn}from"lit/decorators.js";var xt=class extends X{constructor(){super(...arguments);this.data=[];this.breadcrumbs=!1;this.labels=!0}render(){let{data:t,rootId:r,breadcrumbs:a,maxDepth:o,sort:s,padding:c,tiling:l,colorScale:d,labels:u}=this;return this.root(yo({...this.sized(),data:t,rootId:r,breadcrumbs:a,maxDepth:o,sort:s,padding:c,tiling:l,colorScale:d,labels:u}),"treemap",this.label??"Treemap")}};m([gn({attribute:!1})],xt.prototype,"data",2),m([gn({attribute:!1})],xt.prototype,"rootId",2),m([gn({type:Boolean,reflect:!0})],xt.prototype,"breadcrumbs",2),m([gn({type:Number,attribute:"max-depth"})],xt.prototype,"maxDepth",2),m([gn()],xt.prototype,"sort",2),m([gn({type:Number})],xt.prototype,"padding",2),m([gn()],xt.prototype,"tiling",2),m([gn({attribute:!1})],xt.prototype,"colorScale",2),m([gn({type:Boolean,attribute:"no-labels",converter:Le})],xt.prototype,"labels",2),xt=m([kl("skdx-treemap")],xt);import{customElement as Il,property as Xt}from"lit/decorators.js";var lt=class extends X{constructor(){super(...arguments);this.data=[];this.brush=!1;this.crosshair=!1}render(){let{data:t,scale:r,variant:a,xAxis:o,references:s,annotations:c,overlays:l,upColor:d,downColor:u,brush:h,crosshair:f}=this;return this.root(vo({...this.sized(),data:t,scale:r,variant:a,xAxis:o,references:s,annotations:c,overlays:l,upColor:d,downColor:u,brush:h,crosshair:f}),"candlestick",this.label??"Candlestick chart")}};m([Xt({attribute:!1})],lt.prototype,"data",2),m([Xt()],lt.prototype,"scale",2),m([Xt()],lt.prototype,"variant",2),m([Xt({attribute:!1})],lt.prototype,"xAxis",2),m([Xt({attribute:!1})],lt.prototype,"references",2),m([Xt({attribute:!1})],lt.prototype,"annotations",2),m([Xt({attribute:!1})],lt.prototype,"overlays",2),m([Xt({attribute:"up-color"})],lt.prototype,"upColor",2),m([Xt({attribute:"down-color"})],lt.prototype,"downColor",2),m([Xt({type:Boolean,reflect:!0})],lt.prototype,"brush",2),m([Xt({type:Boolean,reflect:!0})],lt.prototype,"crosshair",2),lt=m([Il("skdx-candlestick-chart")],lt);import{customElement as Tl,property as ln}from"lit/decorators.js";var ft=class extends X{constructor(){super(...arguments);this.data=[];this.connectors=!0;this.labels=!1}render(){let{data:t,total:r,start:a,startLabel:o,orientation:s,connectors:c,labels:l,positiveColor:d,negativeColor:u,totalColor:h}=this;return this.root(Mo({...this.sized(),data:t,total:r,start:a,startLabel:o,orientation:s,connectors:c,labels:l,positiveColor:d,negativeColor:u,totalColor:h}),"waterfall",this.label??"Waterfall chart")}};m([ln({attribute:!1})],ft.prototype,"data",2),m([ln()],ft.prototype,"total",2),m([ln({type:Number})],ft.prototype,"start",2),m([ln({attribute:"start-label"})],ft.prototype,"startLabel",2),m([ln()],ft.prototype,"orientation",2),m([ln({type:Boolean,attribute:"no-connectors",converter:Le})],ft.prototype,"connectors",2),m([ln({type:Boolean,reflect:!0})],ft.prototype,"labels",2),m([ln({attribute:"positive-color"})],ft.prototype,"positiveColor",2),m([ln({attribute:"negative-color"})],ft.prototype,"negativeColor",2),m([ln({attribute:"total-color"})],ft.prototype,"totalColor",2),ft=m([Tl("skdx-waterfall-chart")],ft);import{customElement as Cl,property as tr}from"lit/decorators.js";var Qt=class extends X{constructor(){super(...arguments);this.tasks=[];this.criticalPath=!1}render(){let{tasks:t,references:r,annotations:a,today:o,criticalPath:s,xAxis:c}=this;return this.root(wo({...this.sized(),tasks:t,references:r,annotations:a,today:o,criticalPath:s,xAxis:c}),"gantt",this.label??"Gantt chart")}};m([tr({attribute:!1})],Qt.prototype,"tasks",2),m([tr({attribute:!1})],Qt.prototype,"references",2),m([tr({attribute:!1})],Qt.prototype,"annotations",2),m([tr({attribute:!1})],Qt.prototype,"today",2),m([tr({type:Boolean,reflect:!0,attribute:"critical-path"})],Qt.prototype,"criticalPath",2),m([tr({attribute:!1})],Qt.prototype,"xAxis",2),Qt=m([Cl("skdx-gantt-chart")],Qt);import{customElement as Al,property as xn}from"lit/decorators.js";var yt=class extends X{constructor(){super(...arguments);this.series=[];this.mean=!1;this.points=!1;this.notched=!1}render(){let{series:t,orientation:r,quartileMethod:a,whisker:o,mean:s,points:c,notched:l,categories:d,yAxis:u}=this;return this.root(ko({...this.sized(),series:t,orientation:r,quartileMethod:a,whisker:o,mean:s,points:c,notched:l,categories:d,yAxis:u}),"boxplot",this.label??"Box plot")}};m([xn({attribute:!1})],yt.prototype,"series",2),m([xn()],yt.prototype,"orientation",2),m([xn({attribute:"quartile-method"})],yt.prototype,"quartileMethod",2),m([xn({type:Number})],yt.prototype,"whisker",2),m([xn({type:Boolean,reflect:!0})],yt.prototype,"mean",2),m([xn({type:Boolean,reflect:!0})],yt.prototype,"points",2),m([xn({type:Boolean,reflect:!0})],yt.prototype,"notched",2),m([xn({attribute:!1})],yt.prototype,"categories",2),m([xn({attribute:!1})],yt.prototype,"yAxis",2),yt=m([Al("skdx-boxplot")],yt);import{customElement as Ll,property as Pt}from"lit/decorators.js";var nt=class extends X{constructor(){super(...arguments);this.data=[];this.labels=!1;this.breadcrumbs=!1}render(){let{data:t,innerRadius:r,centerLabel:a,labels:o,rootId:s,breadcrumbs:c,maxDepth:l,sort:d,startAngle:u,endAngle:h,padAngle:f,colorScale:y}=this;return this.root(To({...this.sized(),data:t,innerRadius:r,centerLabel:a,labels:o,rootId:s,breadcrumbs:c,maxDepth:l,sort:d,startAngle:u,endAngle:h,padAngle:f,colorScale:y}),"sunburst",this.label??"Sunburst chart")}};m([Pt({attribute:!1})],nt.prototype,"data",2),m([Pt({type:Number,attribute:"inner-radius"})],nt.prototype,"innerRadius",2),m([Pt({attribute:"center-label"})],nt.prototype,"centerLabel",2),m([Pt({type:Boolean,reflect:!0})],nt.prototype,"labels",2),m([Pt({attribute:!1})],nt.prototype,"rootId",2),m([Pt({type:Boolean,reflect:!0})],nt.prototype,"breadcrumbs",2),m([Pt({type:Number,attribute:"max-depth"})],nt.prototype,"maxDepth",2),m([Pt()],nt.prototype,"sort",2),m([Pt({type:Number,attribute:"start-angle"})],nt.prototype,"startAngle",2),m([Pt({type:Number,attribute:"end-angle"})],nt.prototype,"endAngle",2),m([Pt({type:Number,attribute:"pad-angle"})],nt.prototype,"padAngle",2),m([Pt({attribute:!1})],nt.prototype,"colorScale",2),nt=m([Ll("skdx-sunburst-chart")],nt);import{customElement as Ol,property as Tr}from"lit/decorators.js";var cn=class extends X{render(){let{names:n,matrix:t,links:r,padding:a,sort:o}=this;return this.root(Co({...this.sized(),names:n,matrix:t,links:r,padding:a,sort:o}),"chord",this.label??"Chord chart")}};m([Tr({attribute:!1})],cn.prototype,"names",2),m([Tr({attribute:!1})],cn.prototype,"matrix",2),m([Tr({attribute:!1})],cn.prototype,"links",2),m([Tr({type:Number})],cn.prototype,"padding",2),m([Tr()],cn.prototype,"sort",2),cn=m([Ol("skdx-chord-chart")],cn);import{customElement as Sl,property as yn}from"lit/decorators.js";var vt=class extends X{constructor(){super(...arguments);this.features=[];this.labels=!1}render(){let{features:t,color:r,colorScale:a,colorLegend:o,projection:s,points:c,lines:l,sizeRange:d,labels:u}=this;return this.root(Lo({...this.sized(),features:t,color:r,colorScale:a,colorLegend:o,projection:s,points:c,lines:l,sizeRange:d,labels:u}),"map",this.label??"Map")}};m([yn({attribute:!1})],vt.prototype,"features",2),m([yn()],vt.prototype,"color",2),m([yn({attribute:!1})],vt.prototype,"colorScale",2),m([yn({attribute:!1})],vt.prototype,"colorLegend",2),m([yn()],vt.prototype,"projection",2),m([yn({attribute:!1})],vt.prototype,"points",2),m([yn({attribute:!1})],vt.prototype,"lines",2),m([yn({attribute:!1})],vt.prototype,"sizeRange",2),m([yn({type:Boolean,reflect:!0})],vt.prototype,"labels",2),vt=m([Sl("skdx-map-chart")],vt);import{customElement as zl,property as Vt}from"lit/decorators.js";var rt=class extends X{constructor(){super(...arguments);this.data=[];this.track=!0;this.rounded=!0;this.labels=!1}render(){let{data:t,max:r,startAngle:a,endAngle:o,innerRadius:s,gap:c,track:l,rounded:d,labels:u,bands:h,target:f,centerLabel:y}=this;return this.root(Na({...this.sized(),data:t,max:r,startAngle:a,endAngle:o,innerRadius:s,gap:c,track:l,rounded:d,labels:u,bands:h,target:f,centerLabel:y}),"radial",this.label??"Radial bar chart")}};m([Vt({attribute:!1})],rt.prototype,"data",2),m([Vt({type:Number})],rt.prototype,"max",2),m([Vt({type:Number,attribute:"start-angle"})],rt.prototype,"startAngle",2),m([Vt({type:Number,attribute:"end-angle"})],rt.prototype,"endAngle",2),m([Vt({type:Number,attribute:"inner-radius"})],rt.prototype,"innerRadius",2),m([Vt({type:Number})],rt.prototype,"gap",2),m([Vt({type:Boolean,attribute:"no-track",converter:Le})],rt.prototype,"track",2),m([Vt({type:Boolean,attribute:"no-rounded",converter:Le})],rt.prototype,"rounded",2),m([Vt({type:Boolean,reflect:!0})],rt.prototype,"labels",2),m([Vt({attribute:!1})],rt.prototype,"bands",2),m([Vt({type:Number})],rt.prototype,"target",2),m([Vt({attribute:"center-label"})],rt.prototype,"centerLabel",2),rt=m([zl("skdx-radial-bar-chart")],rt);import{customElement as Nl,property as zt}from"lit/decorators.js";var Qe=class extends X{constructor(){super(...arguments);this.value=Number.NaN;this.tickLabels=!0}render(){let{value:t,min:r,max:a,variant:o,startAngle:s,endAngle:c,thickness:l,bands:d,target:u,ticks:h,tickLabels:f,centerLabel:y,caption:I}=this;return this.root(Ra({...this.sized(),value:t,min:r,max:a,variant:o,startAngle:s,endAngle:c,thickness:l,bands:d,target:u,ticks:h,tickLabels:f,centerLabel:y,caption:I}),"gauge",this.label??"Gauge chart")}};m([zt({type:Number})],Qe.prototype,"value",2),m([zt({type:Number})],Qe.prototype,"min",2),m([zt({type:Number})],Qe.prototype,"max",2),m([zt()],Qe.prototype,"variant",2),m([zt({type:Number,attribute:"start-angle"})],Qe.prototype,"startAngle",2),m([zt({type:Number,attribute:"end-angle"})],Qe.prototype,"endAngle",2),m([zt({type:Number})],Qe.prototype,"thickness",2),m([zt({attribute:!1})],Qe.prototype,"bands",2),m([zt({type:Number})],Qe.prototype,"target",2),m([zt({attribute:!1})],Qe.prototype,"ticks",2),m([zt({type:Boolean,attribute:"no-tick-labels",converter:Le})],Qe.prototype,"tickLabels",2),m([zt({attribute:"center-label"})],Qe.prototype,"centerLabel",2),m([zt()],Qe.prototype,"caption",2),Qe=m([Nl("skdx-gauge-chart")],Qe);import{customElement as Rl,property as Mt}from"lit/decorators.js";var Ue=class extends X{constructor(){super(...arguments);this.series=[];this.labels=!1}render(){let{series:t,sizeRange:r,labels:a,xAxis:o,yAxis:s,zAxis:c,references:l,annotations:d,colorScale:u,colorLegend:h,hitRadius:f,jitter:y,trendline:I,sampling:x}=this;return this.root(Ea({...this.sized(),series:t,sizeRange:r,labels:a,xAxis:o,yAxis:s,zAxis:c,references:l,annotations:d,colorScale:u,colorLegend:h,hitRadius:f,jitter:y,trendline:I,sampling:x}),"bubble",this.label??"Bubble chart")}};m([Mt({attribute:!1})],Ue.prototype,"series",2),m([Mt({attribute:!1})],Ue.prototype,"sizeRange",2),m([Mt({type:Boolean,reflect:!0})],Ue.prototype,"labels",2),m([Mt({attribute:!1})],Ue.prototype,"xAxis",2),m([Mt({attribute:!1})],Ue.prototype,"yAxis",2),m([Mt({attribute:!1})],Ue.prototype,"zAxis",2),m([Mt({attribute:!1})],Ue.prototype,"references",2),m([Mt({attribute:!1})],Ue.prototype,"annotations",2),m([Mt({attribute:!1})],Ue.prototype,"colorScale",2),m([Mt({attribute:!1})],Ue.prototype,"colorLegend",2),m([Mt({type:Number,attribute:"hit-radius"})],Ue.prototype,"hitRadius",2),m([Mt({type:Number})],Ue.prototype,"jitter",2),m([Mt({attribute:!1})],Ue.prototype,"trendline",2),m([Mt({attribute:!1})],Ue.prototype,"sampling",2),Ue=m([Rl("skdx-bubble-chart")],Ue);import{customElement as El,property as wt}from"lit/decorators.js";var Ye=class extends X{constructor(){super(...arguments);this.data=[];this.labels=!1}render(){let{data:t,name:r,color:a,bins:o,binWidth:s,thresholds:c,domain:l,mode:d,xAxis:u,yAxis:h,references:f,annotations:y,labels:I,barGap:x}=this;return this.root(Da({...this.sized(),data:t,name:r,color:a,bins:o,binWidth:s,thresholds:c,domain:l,mode:d,xAxis:u,yAxis:h,references:f,annotations:y,labels:I,barGap:x}),"histogram",this.label??"Histogram")}};m([wt({attribute:!1})],Ye.prototype,"data",2),m([wt()],Ye.prototype,"name",2),m([wt()],Ye.prototype,"color",2),m([wt({type:Number})],Ye.prototype,"bins",2),m([wt({type:Number,attribute:"bin-width"})],Ye.prototype,"binWidth",2),m([wt({attribute:!1})],Ye.prototype,"thresholds",2),m([wt({attribute:!1})],Ye.prototype,"domain",2),m([wt()],Ye.prototype,"mode",2),m([wt({attribute:!1})],Ye.prototype,"xAxis",2),m([wt({attribute:!1})],Ye.prototype,"yAxis",2),m([wt({attribute:!1})],Ye.prototype,"references",2),m([wt({attribute:!1})],Ye.prototype,"annotations",2),m([wt({type:Boolean,reflect:!0})],Ye.prototype,"labels",2),m([wt({type:Number,attribute:"bar-gap"})],Ye.prototype,"barGap",2),Ye=m([El("skdx-histogram")],Ye);import{customElement as Dl,property as Hn}from"lit/decorators.js";var Ht=class extends X{constructor(){super(...arguments);this.data=[];this.labels=!1}render(){let{data:t,orientation:r,ranges:a,min:o,max:s,labels:c,ticks:l}=this;return this.root(br({...this.sized(),data:t,orientation:r,ranges:a,min:o,max:s,labels:c,ticks:l}),"bullet",this.label??"Bullet chart")}};m([Hn({attribute:!1})],Ht.prototype,"data",2),m([Hn()],Ht.prototype,"orientation",2),m([Hn({attribute:!1})],Ht.prototype,"ranges",2),m([Hn({type:Number})],Ht.prototype,"min",2),m([Hn({type:Number})],Ht.prototype,"max",2),m([Hn({type:Boolean,reflect:!0})],Ht.prototype,"labels",2),m([Hn({type:Number})],Ht.prototype,"ticks",2),Ht=m([Dl("skdx-bullet-chart")],Ht);import{customElement as Bl}from"lit/decorators.js";var Cr=class extends ke{render(){return this.root(Ba(this.input()),"combo",this.label??"Combo chart")}};Cr=m([Bl("skdx-combo-chart")],Cr);import{customElement as Fl,property as ct}from"lit/decorators.js";var He=class extends X{constructor(){super(...arguments);this.series=[];this.connectNulls=!1;this.brush=!1;this.crosshair=!1}render(){let{series:t,variant:r,categories:a,xAxis:o,yAxis:s,rightAxis:c,references:l,annotations:d,curve:u,connectNulls:h,orientation:f,radius:y,barGap:I,barWidth:x,brush:T,crosshair:O}=this;return this.root(Fa({...this.sized(),series:t,variant:r,categories:a,xAxis:o,yAxis:s,rightAxis:c,references:l,annotations:d,curve:u,connectNulls:h,orientation:f,radius:y,barGap:I,barWidth:x,brush:T,crosshair:O}),"range",this.label??"Range chart")}};m([ct({attribute:!1})],He.prototype,"series",2),m([ct()],He.prototype,"variant",2),m([ct({attribute:!1})],He.prototype,"categories",2),m([ct({attribute:!1})],He.prototype,"xAxis",2),m([ct({attribute:!1})],He.prototype,"yAxis",2),m([ct({attribute:!1})],He.prototype,"rightAxis",2),m([ct({attribute:!1})],He.prototype,"references",2),m([ct({attribute:!1})],He.prototype,"annotations",2),m([ct()],He.prototype,"curve",2),m([ct({type:Boolean,reflect:!0,attribute:"connect-nulls"})],He.prototype,"connectNulls",2),m([ct()],He.prototype,"orientation",2),m([ct({type:Number})],He.prototype,"radius",2),m([ct({type:Number,attribute:"bar-gap"})],He.prototype,"barGap",2),m([ct({type:Number,attribute:"bar-width"})],He.prototype,"barWidth",2),m([ct({type:Boolean,reflect:!0})],He.prototype,"brush",2),m([ct({type:Boolean,reflect:!0})],He.prototype,"crosshair",2),He=m([Fl("skdx-range-chart")],He);import{customElement as Pl,property as En}from"lit/decorators.js";var Nt=class extends X{constructor(){super(...arguments);this.nodes=[];this.edges=[];this.labels=!0;this.directed=!1;this.edgeLabels=!1}render(){let{nodes:t,edges:r,arrange:a,labels:o,nodeRange:s,iterations:c,directed:l,edgeLabels:d}=this;return this.root(Pa({...this.sized(),nodes:t,edges:r,arrange:a,labels:o,nodeRange:s,iterations:c,directed:l,edgeLabels:d}),"network",this.label??"Network chart")}};m([En({attribute:!1})],Nt.prototype,"nodes",2),m([En({attribute:!1})],Nt.prototype,"edges",2),m([En()],Nt.prototype,"arrange",2),m([En({type:Boolean,attribute:"no-labels",converter:Le})],Nt.prototype,"labels",2),m([En({attribute:!1})],Nt.prototype,"nodeRange",2),m([En({type:Number})],Nt.prototype,"iterations",2),m([En({type:Boolean,reflect:!0})],Nt.prototype,"directed",2),m([En({type:Boolean,reflect:!0,attribute:"edge-labels"})],Nt.prototype,"edgeLabels",2),Nt=m([Pl("skdx-network-chart")],Nt);import{customElement as Vl,property as Kr}from"lit/decorators.js";var vn=class extends X{constructor(){super(...arguments);this.events=[];this.labels=!0}render(){let{events:t,orientation:r,xAxis:a,labels:o}=this;return this.root(Ha({...this.sized(),events:t,orientation:r,xAxis:a,labels:o}),"timeline",this.label??"Timeline chart")}};m([Kr({attribute:!1})],vn.prototype,"events",2),m([Kr()],vn.prototype,"orientation",2),m([Kr({attribute:!1})],vn.prototype,"xAxis",2),m([Kr({type:Boolean,attribute:"no-labels",converter:Le})],vn.prototype,"labels",2),vn=m([Vl("skdx-timeline-chart")],vn);import{customElement as Hl,property as Ar}from"lit/decorators.js";var dn=class extends X{constructor(){super(...arguments);this.segments=[];this.data=[];this.labels=!1}render(){let{segments:t,data:r,labels:a,gap:o,xAxis:s}=this;return this.root(Oo({...this.sized(),segments:t,data:r,labels:a,gap:o,xAxis:s}),"marimekko",this.label??"Marimekko chart")}};m([Ar({attribute:!1})],dn.prototype,"segments",2),m([Ar({attribute:!1})],dn.prototype,"data",2),m([Ar({type:Boolean,reflect:!0})],dn.prototype,"labels",2),m([Ar({type:Number})],dn.prototype,"gap",2),m([Ar({attribute:!1})],dn.prototype,"xAxis",2),dn=m([Hl("skdx-marimekko-chart")],dn);import{customElement as _l,property as nr}from"lit/decorators.js";var Jt=class extends X{constructor(){super(...arguments);this.dimensions=[];this.data=[];this.connectNulls=!1}render(){let{dimensions:t,data:r,opacity:a,curve:o,connectNulls:s,filters:c}=this;return this.root(So({...this.sized(),dimensions:t,data:r,opacity:a,curve:o,connectNulls:s,filters:c}),"parallel",this.label??"Parallel coordinates chart")}};m([nr({attribute:!1})],Jt.prototype,"dimensions",2),m([nr({attribute:!1})],Jt.prototype,"data",2),m([nr({type:Number})],Jt.prototype,"opacity",2),m([nr()],Jt.prototype,"curve",2),m([nr({type:Boolean,reflect:!0,attribute:"connect-nulls"})],Jt.prototype,"connectNulls",2),m([nr({attribute:!1})],Jt.prototype,"filters",2),Jt=m([_l("skdx-parallel-coordinates-chart")],Jt);import{customElement as jl,property as Mn}from"lit/decorators.js";var $t=class extends X{constructor(){super(...arguments);this.value=Number.NaN;this.labels=!0}render(){let{value:t,min:r,max:a,target:o,bands:s,orientation:c,caption:l,labels:d,ticks:u}=this;return this.root(zo({...this.sized(),value:t,min:r,max:a,target:o,bands:s,orientation:c,caption:l,labels:d,ticks:u}),"linear-gauge",this.label??"Linear gauge")}};m([Mn({type:Number})],$t.prototype,"value",2),m([Mn({type:Number})],$t.prototype,"min",2),m([Mn({type:Number})],$t.prototype,"max",2),m([Mn({type:Number})],$t.prototype,"target",2),m([Mn({attribute:!1})],$t.prototype,"bands",2),m([Mn()],$t.prototype,"orientation",2),m([Mn()],$t.prototype,"caption",2),m([Mn({type:Boolean,attribute:"no-labels",converter:Le})],$t.prototype,"labels",2),m([Mn({type:Number})],$t.prototype,"ticks",2),$t=m([jl("skdx-linear-gauge")],$t);import{customElement as Gl,property as wn}from"lit/decorators.js";var kt=class extends X{constructor(){super(...arguments);this.data=[];this.labels=!1}render(){let{data:t,startLabel:r,endLabel:a,orientation:o,labels:s,sort:c,markerSize:l,xAxis:d,references:u}=this;return this.root(No({...this.sized(),data:t,startLabel:r,endLabel:a,orientation:o,labels:s,sort:c,markerSize:l,xAxis:d,references:u}),"dumbbell",this.label??"Dumbbell chart")}};m([wn({attribute:!1})],kt.prototype,"data",2),m([wn({attribute:"start-label"})],kt.prototype,"startLabel",2),m([wn({attribute:"end-label"})],kt.prototype,"endLabel",2),m([wn()],kt.prototype,"orientation",2),m([wn({type:Boolean,reflect:!0})],kt.prototype,"labels",2),m([wn()],kt.prototype,"sort",2),m([wn({type:Number,attribute:"marker-size"})],kt.prototype,"markerSize",2),m([wn({attribute:!1})],kt.prototype,"xAxis",2),m([wn({attribute:!1})],kt.prototype,"references",2),kt=m([Gl("skdx-dumbbell-chart")],kt);import{customElement as Wl,property as _t}from"lit/decorators.js";var at=class extends X{constructor(){super(...arguments);this.data=[];this.labels=!1;this.brush=!1;this.crosshair=!1}render(){let{data:t,threshold:r,cumulativeLabel:a,name:o,labels:s,radius:c,barGap:l,barWidth:d,xAxis:u,yAxis:h,brush:f,crosshair:y}=this;return this.root(Ro({...this.sized(),data:t,threshold:r,cumulativeLabel:a,name:o,labels:s,radius:c,barGap:l,barWidth:d,xAxis:u,yAxis:h,brush:f,crosshair:y}),"pareto",this.label??"Pareto chart")}};m([_t({attribute:!1})],at.prototype,"data",2),m([_t({type:Number})],at.prototype,"threshold",2),m([_t({attribute:"cumulative-label"})],at.prototype,"cumulativeLabel",2),m([_t()],at.prototype,"name",2),m([_t({type:Boolean,reflect:!0})],at.prototype,"labels",2),m([_t({type:Number})],at.prototype,"radius",2),m([_t({type:Number,attribute:"bar-gap"})],at.prototype,"barGap",2),m([_t({type:Number,attribute:"bar-width"})],at.prototype,"barWidth",2),m([_t({attribute:!1})],at.prototype,"xAxis",2),m([_t({attribute:!1})],at.prototype,"yAxis",2),m([_t({type:Boolean,reflect:!0})],at.prototype,"brush",2),m([_t({type:Boolean,reflect:!0})],at.prototype,"crosshair",2),at=m([Wl("skdx-pareto-chart")],at);import{customElement as Zl,property as Dn}from"lit/decorators.js";var Rt=class extends X{constructor(){super(...arguments);this.series=[];this.ranked=!1;this.labels=!0}render(){let{series:t,categories:r,ranked:a,topRank:o,curve:s,labels:c,markerSize:l,xAxis:d}=this;return this.root(Fo({...this.sized(),series:t,categories:r,ranked:a,topRank:o,curve:s,labels:c,markerSize:l,xAxis:d}),"bump",this.label??"Bump chart")}};m([Dn({attribute:!1})],Rt.prototype,"series",2),m([Dn({attribute:!1})],Rt.prototype,"categories",2),m([Dn({type:Boolean,reflect:!0})],Rt.prototype,"ranked",2),m([Dn({type:Number,attribute:"top-rank"})],Rt.prototype,"topRank",2),m([Dn()],Rt.prototype,"curve",2),m([Dn({type:Boolean,attribute:"no-labels",converter:Le})],Rt.prototype,"labels",2),m([Dn({type:Number,attribute:"marker-size"})],Rt.prototype,"markerSize",2),m([Dn({attribute:!1})],Rt.prototype,"xAxis",2),Rt=m([Zl("skdx-bump-chart")],Rt);import{customElement as ql,property as $n}from"lit/decorators.js";var It=class extends X{constructor(){super(...arguments);this.data=[];this.labels=!1}render(){let{data:t,scale:r,max:a,startAngle:o,endAngle:s,padAngle:c,innerRadius:l,levels:d,labels:u}=this;return this.root(Vo({...this.sized(),data:t,scale:r,max:a,startAngle:o,endAngle:s,padAngle:c,innerRadius:l,levels:d,labels:u}),"polar-area",this.label??"Polar area chart")}};m([$n({attribute:!1})],It.prototype,"data",2),m([$n()],It.prototype,"scale",2),m([$n({type:Number})],It.prototype,"max",2),m([$n({type:Number,attribute:"start-angle"})],It.prototype,"startAngle",2),m([$n({type:Number,attribute:"end-angle"})],It.prototype,"endAngle",2),m([$n({type:Number,attribute:"pad-angle"})],It.prototype,"padAngle",2),m([$n({type:Number,attribute:"inner-radius"})],It.prototype,"innerRadius",2),m([$n({type:Number})],It.prototype,"levels",2),m([$n({type:Boolean,reflect:!0})],It.prototype,"labels",2),It=m([ql("skdx-polar-area-chart")],It);import{customElement as Ul,property as Lr}from"lit/decorators.js";var mn=class extends X{constructor(){super(...arguments);this.series=[]}render(){let{series:t,orientation:r,markerSize:a,yAxis:o,references:s}=this;return this.root(Ho({...this.sized(),series:t,orientation:r,markerSize:a,yAxis:o,references:s}),"swarm",this.label??"Swarm plot")}};m([Lr({attribute:!1})],mn.prototype,"series",2),m([Lr()],mn.prototype,"orientation",2),m([Lr({type:Number,attribute:"marker-size"})],mn.prototype,"markerSize",2),m([Lr({attribute:!1})],mn.prototype,"yAxis",2),m([Lr({attribute:!1})],mn.prototype,"references",2),mn=m([Ul("skdx-swarm-plot")],mn);import{customElement as Yl,property as Bn}from"lit/decorators.js";var Et=class extends X{constructor(){super(...arguments);this.data=[];this.labels=!1}render(){let{data:t,total:r,rows:a,columns:o,orientation:s,cellGap:c,cellRadius:l,labels:d}=this;return this.root(_o({...this.sized(),data:t,total:r,rows:a,columns:o,orientation:s,cellGap:c,cellRadius:l,labels:d}),"waffle",this.label??"Waffle chart")}};m([Bn({attribute:!1})],Et.prototype,"data",2),m([Bn({type:Number})],Et.prototype,"total",2),m([Bn({type:Number})],Et.prototype,"rows",2),m([Bn({type:Number})],Et.prototype,"columns",2),m([Bn()],Et.prototype,"orientation",2),m([Bn({type:Number,attribute:"cell-gap"})],Et.prototype,"cellGap",2),m([Bn({type:Number,attribute:"cell-radius"})],Et.prototype,"cellRadius",2),m([Bn({type:Boolean,reflect:!0})],Et.prototype,"labels",2),Et=m([Yl("skdx-waffle-chart")],Et);import{customElement as Kl,property as kn}from"lit/decorators.js";var Tt=class extends X{constructor(){super(...arguments);this.data=[];this.labels=!0}render(){let{data:t,orientation:r,nodeShape:a,linkStyle:o,rootId:s,collapsed:c,maxDepth:l,labels:d,nodeSize:u}=this;return this.root(Ur({...this.sized(),data:t,orientation:r,nodeShape:a,linkStyle:o,rootId:s,collapsed:c,maxDepth:l,labels:d,nodeSize:u}),"tree",this.label??"Tree chart")}};m([kn({attribute:!1})],Tt.prototype,"data",2),m([kn()],Tt.prototype,"orientation",2),m([kn({attribute:"node-shape"})],Tt.prototype,"nodeShape",2),m([kn({attribute:"link-style"})],Tt.prototype,"linkStyle",2),m([kn({attribute:!1})],Tt.prototype,"rootId",2),m([kn({attribute:!1})],Tt.prototype,"collapsed",2),m([kn({type:Number,attribute:"max-depth"})],Tt.prototype,"maxDepth",2),m([kn({type:Boolean,attribute:"no-labels",converter:Le})],Tt.prototype,"labels",2),m([kn({type:Number,attribute:"node-size"})],Tt.prototype,"nodeSize",2),Tt=m([Kl("skdx-tree-chart")],Tt);import{customElement as Xl,property as _n}from"lit/decorators.js";var jt=class extends X{constructor(){super(...arguments);this.data=[];this.labels=!0}render(){let{data:t,orientation:r,rootId:a,collapsed:o,maxDepth:s,labels:c,nodeSize:l}=this;return this.root(Eo({...this.sized(),data:t,orientation:r,rootId:a,collapsed:o,maxDepth:s,labels:c,nodeSize:l}),"organization",this.label??"Organization chart")}};m([_n({attribute:!1})],jt.prototype,"data",2),m([_n()],jt.prototype,"orientation",2),m([_n({attribute:!1})],jt.prototype,"rootId",2),m([_n({attribute:!1})],jt.prototype,"collapsed",2),m([_n({type:Number,attribute:"max-depth"})],jt.prototype,"maxDepth",2),m([_n({type:Boolean,attribute:"no-labels",converter:Le})],jt.prototype,"labels",2),m([_n({type:Number,attribute:"node-size"})],jt.prototype,"nodeSize",2),jt=m([Xl("skdx-organization-chart")],jt);import{customElement as Ql,property as rr}from"lit/decorators.js";var en=class extends X{constructor(){super(...arguments);this.data=[];this.labels=!0}render(){let{data:t,rootId:r,maxDepth:a,labels:o,padding:s,colorScale:c}=this;return this.root(Do({...this.sized(),data:t,rootId:r,maxDepth:a,labels:o,padding:s,colorScale:c}),"circle-packing",this.label??"Circle packing chart")}};m([rr({attribute:!1})],en.prototype,"data",2),m([rr({attribute:!1})],en.prototype,"rootId",2),m([rr({type:Number,attribute:"max-depth"})],en.prototype,"maxDepth",2),m([rr({type:Boolean,attribute:"no-labels",converter:Le})],en.prototype,"labels",2),m([rr({type:Number})],en.prototype,"padding",2),m([rr({attribute:!1})],en.prototype,"colorScale",2),en=m([Ql("skdx-circle-packing-chart")],en);import{customElement as Jl,property as In}from"lit/decorators.js";var Ct=class extends X{constructor(){super(...arguments);this.data=[];this.breadcrumbs=!1;this.labels=!0}render(){let{data:t,orientation:r,rootId:a,breadcrumbs:o,maxDepth:s,sort:c,labels:l,padding:d,colorScale:u}=this;return this.root(Bo({...this.sized(),data:t,orientation:r,rootId:a,breadcrumbs:o,maxDepth:s,sort:c,labels:l,padding:d,colorScale:u}),"icicle",this.label??"Icicle chart")}};m([In({attribute:!1})],Ct.prototype,"data",2),m([In()],Ct.prototype,"orientation",2),m([In({attribute:!1})],Ct.prototype,"rootId",2),m([In({type:Boolean,reflect:!0})],Ct.prototype,"breadcrumbs",2),m([In({type:Number,attribute:"max-depth"})],Ct.prototype,"maxDepth",2),m([In()],Ct.prototype,"sort",2),m([In({type:Boolean,attribute:"no-labels",converter:Le})],Ct.prototype,"labels",2),m([In({type:Number})],Ct.prototype,"padding",2),m([In({attribute:!1})],Ct.prototype,"colorScale",2),Ct=m([Jl("skdx-icicle-chart")],Ct);export{Ir as SkdxAreaChart,$r as SkdxBarChart,yt as SkdxBoxplot,Ue as SkdxBubbleChart,Ht as SkdxBulletChart,Rt as SkdxBumpChart,lt as SkdxCandlestickChart,cn as SkdxChordChart,en as SkdxCirclePackingChart,Cr as SkdxComboChart,kt as SkdxDumbbellChart,Kt as SkdxFunnelChart,Qt as SkdxGanttChart,Qe as SkdxGaugeChart,Fe as SkdxHeatmap,Ye as SkdxHistogram,Ct as SkdxIcicleChart,kr as SkdxLineChart,$t as SkdxLinearGauge,vt as SkdxMapChart,dn as SkdxMarimekkoChart,Nt as SkdxNetworkChart,jt as SkdxOrganizationChart,Jt as SkdxParallelCoordinatesChart,at as SkdxParetoChart,it as SkdxPieChart,It as SkdxPolarAreaChart,tt as SkdxRadarChart,rt as SkdxRadialBarChart,He as SkdxRangeChart,ht as SkdxSankeyChart,Ke as SkdxScatterChart,ut as SkdxSparkline,nt as SkdxSunburstChart,mn as SkdxSwarmPlot,vn as SkdxTimelineChart,Tt as SkdxTreeChart,xt as SkdxTreemap,Et as SkdxWaffleChart,ft as SkdxWaterfallChart,qr as csv,Zr as exportChart,re as makeFormatter,Ns as seriesCsv,Wr as svgMarkup,Mr as syncGroup};
112
+ `,u([ge({type:Number})],X.prototype,"width",2),u([ge({type:Number})],X.prototype,"height",2),u([ge()],X.prototype,"label",2),u([ge({type:Boolean,reflect:!0})],X.prototype,"legend",2),u([ge({type:Boolean,attribute:"no-tooltip",converter:Ne})],X.prototype,"tooltip",2),u([ge({attribute:!1})],X.prototype,"format",2),u([ge({attribute:!1})],X.prototype,"palette",2),u([ge({attribute:!1})],X.prototype,"hiddenSeries",2),u([ge({attribute:!1})],X.prototype,"selected",2),u([ge({attribute:"selection-mode"})],X.prototype,"selectionMode",2),u([ge({attribute:!1})],X.prototype,"highlighted",2),u([ge({attribute:!1})],X.prototype,"highlightScope",2),u([ge({type:Boolean,reflect:!0})],X.prototype,"loading",2),u([ge()],X.prototype,"error",2),u([ge({attribute:"empty-message"})],X.prototype,"emptyMessage",2),u([ge()],X.prototype,"description",2),u([ge({type:Boolean,reflect:!0})],X.prototype,"decorative",2),u([ge({type:Boolean,attribute:"accessible-table"})],X.prototype,"accessibleTable",2),u([ge({attribute:!1})],X.prototype,"zoom",2),u([ge({attribute:!1})],X.prototype,"view",2),u([ge({type:Boolean,reflect:!0})],X.prototype,"zoomable",2),u([ge({type:Boolean,reflect:!0})],X.prototype,"editable",2),u([ge({attribute:"sync-id"})],X.prototype,"syncId",2),u([ge({type:Boolean,attribute:"cross-filter"})],X.prototype,"crossFilter",2),u([ge({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],X.prototype,"animated",2),u([ge({type:Boolean,reflect:!0})],X.prototype,"responsive",2),u([Jt()],X.prototype,"tip",2),u([Jt()],X.prototype,"overlay",2),u([Jt()],X.prototype,"portal",2),u([Jt()],X.prototype,"measured",2),u([Jt()],X.prototype,"viewState",2),u([Jt()],X.prototype,"highlightState",2),u([Jt()],X.prototype,"crossState",2),u([Jt()],X.prototype,"focused",2),u([Jt()],X.prototype,"hiddenState",2),u([Jt()],X.prototype,"zoomState",2),u([Jt()],X.prototype,"selectedState",2);var Te=class extends X{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:a,yAxis:o,rightAxis:s,references:c,annotations:l,labels:d,curve:m,connectNulls:h,nulls:f,stacked:M,stackOffset:$,orientation:g,radius:w,barGap:R,barWidth:k,sort:T,transform:D,transforms:v,bins:S,binWidth:O,binDomain:E,binMode:z,sampling:L,brush:H,crosshair:b}=this;return{...this.sized(),series:t,categories:r,xAxis:a,yAxis:o,rightAxis:s,references:c,annotations:l,labels:d,curve:m,connectNulls:h,nulls:f,stacked:M,stackOffset:$,orientation:g,radius:w,barGap:R,barWidth:k,sort:T,transform:D,transforms:v,bins:S,binWidth:O,binDomain:E,binMode:z,sampling:L,brush:H,crosshair:b}}};u([ge({attribute:!1})],Te.prototype,"series",2),u([ge({attribute:!1})],Te.prototype,"categories",2),u([ge({attribute:!1})],Te.prototype,"xAxis",2),u([ge({attribute:!1})],Te.prototype,"yAxis",2),u([ge({attribute:!1})],Te.prototype,"rightAxis",2),u([ge({attribute:!1})],Te.prototype,"references",2),u([ge({attribute:!1})],Te.prototype,"annotations",2),u([ge({type:Boolean,reflect:!0})],Te.prototype,"labels",2),u([ge()],Te.prototype,"curve",2),u([ge({type:Boolean,attribute:"connect-nulls"})],Te.prototype,"connectNulls",2),u([ge()],Te.prototype,"nulls",2),u([ge({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],Te.prototype,"stacked",2),u([ge({attribute:"stack-offset"})],Te.prototype,"stackOffset",2),u([ge()],Te.prototype,"orientation",2),u([ge({type:Number})],Te.prototype,"radius",2),u([ge({type:Number,attribute:"bar-gap"})],Te.prototype,"barGap",2),u([ge({type:Number,attribute:"bar-width"})],Te.prototype,"barWidth",2),u([ge()],Te.prototype,"sort",2),u([ge()],Te.prototype,"transform",2),u([ge({attribute:!1})],Te.prototype,"transforms",2),u([ge({type:Number})],Te.prototype,"bins",2),u([ge({type:Number,attribute:"bin-width"})],Te.prototype,"binWidth",2),u([ge({attribute:!1})],Te.prototype,"binDomain",2),u([ge({attribute:"bin-mode"})],Te.prototype,"binMode",2),u([ge({attribute:!1})],Te.prototype,"sampling",2),u([ge({type:Boolean,reflect:!0})],Te.prototype,"brush",2),u([ge({type:Boolean,reflect:!0})],Te.prototype,"crosshair",2);var Il=e=>e.defs&&e.defs.length?jt`<defs>${e.defs.map(n=>jt`<linearGradient id=${n.id} x1="0" y1="0" x2=${n.vertical===!1?1:0} y2=${n.vertical===!1?0:1}>${n.stops.map(t=>jt`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${ze(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:qe,ta=e=>jt`${e.map((n,t)=>{let r=n.title?jt`<title>${n.title}</title>`:qe,a=n.item?t:void 0;switch(n.kind){case"path":return jt`<path data-skdx-part=${n.part} data-skdx-i=${ze(a)} d=${n.d} fill=${n.fill??"none"} stroke=${ze(n.stroke)} stroke-width=${ze(n.strokeWidth)} stroke-linecap=${ze(n.strokeLinecap)} stroke-linejoin=${ze(n.strokeLinejoin)} stroke-dasharray=${ze(n.dash)} opacity=${ze(n.opacity)} fill-opacity=${ze(n.fillOpacity)}>${r}</path>`;case"rect":return jt`<rect data-skdx-part=${n.part} data-skdx-i=${ze(a)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${ze(n.rx)} style=${ze(Zr(n.part)?`rx:${Zr(n.part)}`:void 0)} fill=${n.fill} stroke=${ze(n.stroke)} fill-opacity=${ze(n.opacity)} pointer-events=${ze(n.part==="stage-label-background"||n.part==="label-background"?"none":void 0)}>${r}</rect>`;case"line":return jt`<line data-skdx-part=${n.part} data-skdx-i=${ze(a)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${ze(n.strokeWidth)} stroke-dasharray=${ze(n.dash)} opacity=${ze(n.opacity)}>${r}</line>`;case"circle":return jt`<circle data-skdx-part=${n.part} data-skdx-i=${ze(a)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${ze(n.stroke)} opacity=${ze(n.opacity)}>${r}</circle>`;case"text":return jt`<text aria-label=${ze(n.title)} data-skdx-part=${n.part} data-skdx-i=${ze(a)} x=${n.x} y=${n.y} text-anchor=${ze(n.anchor)} dominant-baseline=${ze(n.baseline)} fill=${ze(n.fill)} font-weight=${ze(n.weight)} pointer-events=${ze(a===void 0?"none":void 0)} transform=${ze(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var Tr=class extends Te{render(){return this.root(Ia(this.input()),"bar",this.label??"Bar chart")}};Tr=u([Tl("skdx-bar-chart")],Tr);import{customElement as Al}from"lit/decorators.js";var Ar=class extends Te{render(){return this.root(Ta(this.input()),"line",this.label??"Line chart")}};Ar=u([Al("skdx-line-chart")],Ar);import{customElement as Cl}from"lit/decorators.js";var Cr=class extends Te{render(){return this.root(Aa(this.input()),"area",this.label??"Area chart")}};Cr=u([Cl("skdx-area-chart")],Cr);import{customElement as Ll,property as en}from"lit/decorators.js";var mt=class extends X{constructor(){super(...arguments);this.data=[];this.labels=!1}render(){let{data:t,variant:r,innerRadius:a,outerRadius:o,labels:s,labelPosition:c,padAngle:l,sort:d,startAngle:m,endAngle:h,centerLabel:f}=this;return this.root(Na({...this.sized(),data:t,variant:r,innerRadius:a,outerRadius:o,labels:s,labelPosition:c,padAngle:l,sort:d,startAngle:m,endAngle:h,centerLabel:f}),"pie",this.label??"Pie chart")}};u([en({attribute:!1})],mt.prototype,"data",2),u([en()],mt.prototype,"variant",2),u([en({type:Number,attribute:"inner-radius"})],mt.prototype,"innerRadius",2),u([en({type:Number,attribute:"outer-radius"})],mt.prototype,"outerRadius",2),u([en({type:Boolean,reflect:!0})],mt.prototype,"labels",2),u([en({attribute:"label-position"})],mt.prototype,"labelPosition",2),u([en({type:Number,attribute:"pad-angle"})],mt.prototype,"padAngle",2),u([en()],mt.prototype,"sort",2),u([en({type:Number,attribute:"start-angle"})],mt.prototype,"startAngle",2),u([en({type:Number,attribute:"end-angle"})],mt.prototype,"endAngle",2),u([en({attribute:"center-label"})],mt.prototype,"centerLabel",2),mt=u([Ll("skdx-pie-chart")],mt);import{customElement as Ol,property as Dt}from"lit/decorators.js";var Xe=class extends X{constructor(){super(...arguments);this.series=[];this.labels=!1}render(){let{series:t,sizeRange:r,labels:a,xAxis:o,yAxis:s,references:c,annotations:l,colorScale:d,colorLegend:m,hitRadius:h,jitter:f,trendline:M,sampling:$}=this;return this.root(wa({...this.sized(),series:t,sizeRange:r,labels:a,xAxis:o,yAxis:s,references:c,annotations:l,colorScale:d,colorLegend:m,hitRadius:h,jitter:f,trendline:M,sampling:$}),"scatter",this.label??"Scatter chart")}};u([Dt({attribute:!1})],Xe.prototype,"series",2),u([Dt({attribute:!1})],Xe.prototype,"sizeRange",2),u([Dt({type:Boolean,reflect:!0})],Xe.prototype,"labels",2),u([Dt({attribute:!1})],Xe.prototype,"xAxis",2),u([Dt({attribute:!1})],Xe.prototype,"yAxis",2),u([Dt({attribute:!1})],Xe.prototype,"references",2),u([Dt({attribute:!1})],Xe.prototype,"annotations",2),u([Dt({attribute:!1})],Xe.prototype,"colorScale",2),u([Dt({attribute:!1})],Xe.prototype,"colorLegend",2),u([Dt({type:Number,attribute:"hit-radius"})],Xe.prototype,"hitRadius",2),u([Dt({type:Number})],Xe.prototype,"jitter",2),u([Dt({attribute:!1})],Xe.prototype,"trendline",2),u([Dt({attribute:!1})],Xe.prototype,"sampling",2),Xe=u([Ol("skdx-scatter-chart")],Xe);import{customElement as Sl,property as cn}from"lit/decorators.js";var gt=class extends X{constructor(){super(...arguments);this.data=[];this.trend=!1;this.extremes=!1;this.lastValue=!1}render(){let{data:t,color:r,curve:a,variant:o,trend:s,extremes:c,lastValue:l,target:d,band:m,markers:h}=this;return this.root(Ra({...this.sized(),data:t,color:r,curve:a,variant:o,trend:s,extremes:c,lastValue:l,target:d,band:m,markers:h}),"sparkline",this.label??"Sparkline")}};u([cn({attribute:!1})],gt.prototype,"data",2),u([cn()],gt.prototype,"color",2),u([cn()],gt.prototype,"curve",2),u([cn()],gt.prototype,"variant",2),u([cn({type:Boolean,reflect:!0})],gt.prototype,"trend",2),u([cn({type:Boolean,reflect:!0})],gt.prototype,"extremes",2),u([cn({type:Boolean,reflect:!0,attribute:"last-value"})],gt.prototype,"lastValue",2),u([cn({type:Number})],gt.prototype,"target",2),u([cn({attribute:!1})],gt.prototype,"band",2),u([cn({attribute:!1})],gt.prototype,"markers",2),gt=u([Sl("skdx-sparkline")],gt);import{customElement as zl,property as Gt}from"lit/decorators.js";var rt=class extends X{constructor(){super(...arguments);this.series=[];this.fill=!0;this.markers=!0;this.labels=!1}render(){let{series:t,categories:r,metrics:a,normalized:o,max:s,fill:c,levels:l,markers:d,markerSize:m,labels:h,startAngle:f,gridShape:M}=this;return this.root(Ea({...this.sized(),series:t,categories:r,metrics:a,normalize:o,max:s,fill:c,levels:l,markers:d,markerSize:m,labels:h,startAngle:f,gridShape:M}),"radar",this.label??"Radar chart")}};u([Gt({attribute:!1})],rt.prototype,"series",2),u([Gt({attribute:!1})],rt.prototype,"categories",2),u([Gt({attribute:!1})],rt.prototype,"metrics",2),u([Gt({attribute:!1})],rt.prototype,"normalized",2),u([Gt({type:Number})],rt.prototype,"max",2),u([Gt({type:Boolean,attribute:"no-fill",converter:Ne})],rt.prototype,"fill",2),u([Gt({type:Number})],rt.prototype,"levels",2),u([Gt({type:Boolean,attribute:"no-markers",converter:Ne})],rt.prototype,"markers",2),u([Gt({type:Number,attribute:"marker-size"})],rt.prototype,"markerSize",2),u([Gt({type:Boolean,reflect:!0})],rt.prototype,"labels",2),u([Gt({type:Number,attribute:"start-angle"})],rt.prototype,"startAngle",2),u([Gt({attribute:"grid-shape"})],rt.prototype,"gridShape",2),rt=u([zl("skdx-radar-chart")],rt);import{customElement as Nl,property as Qe}from"lit/decorators.js";var He=class extends X{constructor(){super(...arguments);this.diverging=!1;this.labels=!1}render(){let{rows:t,columns:r,data:a,calendar:o,color:s,diverging:c,negativeColor:l,labels:d,domain:m,steps:h,weekStart:f,colorScale:M,colorLegend:$,missingColor:g,cellGap:w,cellRadius:R,rowOrder:k,columnOrder:T}=this;return this.root(Fa({...this.sized(),rows:t,columns:r,data:a,calendar:o,color:s,diverging:c,negativeColor:l,labels:d,domain:m,steps:h,weekStart:f,colorScale:M,colorLegend:$,missingColor:g,cellGap:w,cellRadius:R,rowOrder:k,columnOrder:T}),"heatmap",this.label??"Heatmap")}};u([Qe({attribute:!1})],He.prototype,"rows",2),u([Qe({attribute:!1})],He.prototype,"columns",2),u([Qe({attribute:!1})],He.prototype,"data",2),u([Qe({attribute:!1})],He.prototype,"calendar",2),u([Qe()],He.prototype,"color",2),u([Qe({type:Boolean,reflect:!0})],He.prototype,"diverging",2),u([Qe({attribute:"negative-color"})],He.prototype,"negativeColor",2),u([Qe({type:Boolean,reflect:!0})],He.prototype,"labels",2),u([Qe({attribute:!1})],He.prototype,"domain",2),u([Qe({type:Number})],He.prototype,"steps",2),u([Qe({attribute:"week-start"})],He.prototype,"weekStart",2),u([Qe({attribute:!1})],He.prototype,"colorScale",2),u([Qe({attribute:!1})],He.prototype,"colorLegend",2),u([Qe({attribute:"missing-color"})],He.prototype,"missingColor",2),u([Qe({type:Number,attribute:"cell-gap"})],He.prototype,"cellGap",2),u([Qe({type:Number,attribute:"cell-radius"})],He.prototype,"cellRadius",2),u([Qe({attribute:"row-order"})],He.prototype,"rowOrder",2),u([Qe({attribute:"column-order"})],He.prototype,"columnOrder",2),He=u([Nl("skdx-heatmap")],He);import{customElement as Rl,property as ar}from"lit/decorators.js";var tn=class extends X{constructor(){super(...arguments);this.data=[]}render(){let{data:t,orientation:r,variant:a,gap:o,labelPosition:s,sort:c}=this;return this.root(Pa({...this.sized(),data:t,orientation:r,variant:a,gap:o,labelPosition:s,sort:c}),"funnel",this.label??"Funnel chart")}};u([ar({attribute:!1})],tn.prototype,"data",2),u([ar()],tn.prototype,"orientation",2),u([ar()],tn.prototype,"variant",2),u([ar({type:Number})],tn.prototype,"gap",2),u([ar({attribute:"label-position"})],tn.prototype,"labelPosition",2),u([ar()],tn.prototype,"sort",2),tn=u([Rl("skdx-funnel-chart")],tn);import{customElement as El,property as dn}from"lit/decorators.js";var xt=class extends X{constructor(){super(...arguments);this.links=[];this.nodeLabels=!0;this.linkLabels=!1}render(){let{links:t,nodes:r,align:a,nodeWidth:o,nodePadding:s,nodeSort:c,linkSort:l,nodeLabels:d,linkLabels:m,cyclePolicy:h}=this;return this.root(Io({...this.sized(),links:t,nodes:r,align:a,nodeWidth:o,nodePadding:s,nodeSort:c,linkSort:l,nodeLabels:d,linkLabels:m,cyclePolicy:h}),"sankey",this.label??"Sankey chart")}};u([dn({attribute:!1})],xt.prototype,"links",2),u([dn({attribute:!1})],xt.prototype,"nodes",2),u([dn()],xt.prototype,"align",2),u([dn({type:Number,attribute:"node-width"})],xt.prototype,"nodeWidth",2),u([dn({type:Number,attribute:"node-padding"})],xt.prototype,"nodePadding",2),u([dn({attribute:"node-sort"})],xt.prototype,"nodeSort",2),u([dn({attribute:"link-sort"})],xt.prototype,"linkSort",2),u([dn({type:Boolean,attribute:"no-node-labels",converter:Ne})],xt.prototype,"nodeLabels",2),u([dn({type:Boolean,reflect:!0,attribute:"link-labels"})],xt.prototype,"linkLabels",2),u([dn({attribute:"cycle-policy"})],xt.prototype,"cyclePolicy",2),xt=u([El("skdx-sankey-chart")],xt);import{customElement as Dl,property as gn}from"lit/decorators.js";var kt=class extends X{constructor(){super(...arguments);this.data=[];this.breadcrumbs=!1;this.labels=!0}render(){let{data:t,rootId:r,breadcrumbs:a,maxDepth:o,sort:s,padding:c,tiling:l,colorScale:d,labels:m}=this;return this.root(Ao({...this.sized(),data:t,rootId:r,breadcrumbs:a,maxDepth:o,sort:s,padding:c,tiling:l,colorScale:d,labels:m}),"treemap",this.label??"Treemap")}};u([gn({attribute:!1})],kt.prototype,"data",2),u([gn({attribute:!1})],kt.prototype,"rootId",2),u([gn({type:Boolean,reflect:!0})],kt.prototype,"breadcrumbs",2),u([gn({type:Number,attribute:"max-depth"})],kt.prototype,"maxDepth",2),u([gn()],kt.prototype,"sort",2),u([gn({type:Number})],kt.prototype,"padding",2),u([gn()],kt.prototype,"tiling",2),u([gn({attribute:!1})],kt.prototype,"colorScale",2),u([gn({type:Boolean,attribute:"no-labels",converter:Ne})],kt.prototype,"labels",2),kt=u([Dl("skdx-treemap")],kt);import{customElement as Bl,property as Bt}from"lit/decorators.js";var Je=class extends X{constructor(){super(...arguments);this.data=[];this.brush=!1;this.crosshair=!1}render(){let{data:t,scale:r,variant:a,xAxis:o,yAxis:s,volumeFormat:c,references:l,annotations:d,overlays:m,upColor:h,downColor:f,brush:M,crosshair:$}=this;return this.root(Co({...this.sized(),data:t,scale:r,variant:a,xAxis:o,yAxis:s,volumeFormat:c,references:l,annotations:d,overlays:m,upColor:h,downColor:f,brush:M,crosshair:$}),"candlestick",this.label??"Candlestick chart")}};u([Bt({attribute:!1})],Je.prototype,"data",2),u([Bt()],Je.prototype,"scale",2),u([Bt()],Je.prototype,"variant",2),u([Bt({attribute:!1})],Je.prototype,"xAxis",2),u([Bt({attribute:!1})],Je.prototype,"yAxis",2),u([Bt({attribute:!1})],Je.prototype,"volumeFormat",2),u([Bt({attribute:!1})],Je.prototype,"references",2),u([Bt({attribute:!1})],Je.prototype,"annotations",2),u([Bt({attribute:!1})],Je.prototype,"overlays",2),u([Bt({attribute:"up-color"})],Je.prototype,"upColor",2),u([Bt({attribute:"down-color"})],Je.prototype,"downColor",2),u([Bt({type:Boolean,reflect:!0})],Je.prototype,"brush",2),u([Bt({type:Boolean,reflect:!0})],Je.prototype,"crosshair",2),Je=u([Bl("skdx-candlestick-chart")],Je);import{customElement as Fl,property as mn}from"lit/decorators.js";var yt=class extends X{constructor(){super(...arguments);this.data=[];this.connectors=!0;this.labels=!1}render(){let{data:t,total:r,start:a,startLabel:o,orientation:s,connectors:c,labels:l,positiveColor:d,negativeColor:m,totalColor:h}=this;return this.root(Lo({...this.sized(),data:t,total:r,start:a,startLabel:o,orientation:s,connectors:c,labels:l,positiveColor:d,negativeColor:m,totalColor:h}),"waterfall",this.label??"Waterfall chart")}};u([mn({attribute:!1})],yt.prototype,"data",2),u([mn()],yt.prototype,"total",2),u([mn({type:Number})],yt.prototype,"start",2),u([mn({attribute:"start-label"})],yt.prototype,"startLabel",2),u([mn()],yt.prototype,"orientation",2),u([mn({type:Boolean,attribute:"no-connectors",converter:Ne})],yt.prototype,"connectors",2),u([mn({type:Boolean,reflect:!0})],yt.prototype,"labels",2),u([mn({attribute:"positive-color"})],yt.prototype,"positiveColor",2),u([mn({attribute:"negative-color"})],yt.prototype,"negativeColor",2),u([mn({attribute:"total-color"})],yt.prototype,"totalColor",2),yt=u([Fl("skdx-waterfall-chart")],yt);import{customElement as Pl,property as or}from"lit/decorators.js";var nn=class extends X{constructor(){super(...arguments);this.tasks=[];this.criticalPath=!1}render(){let{tasks:t,references:r,annotations:a,today:o,criticalPath:s,xAxis:c}=this;return this.root(Oo({...this.sized(),tasks:t,references:r,annotations:a,today:o,criticalPath:s,xAxis:c}),"gantt",this.label??"Gantt chart")}};u([or({attribute:!1})],nn.prototype,"tasks",2),u([or({attribute:!1})],nn.prototype,"references",2),u([or({attribute:!1})],nn.prototype,"annotations",2),u([or({attribute:!1})],nn.prototype,"today",2),u([or({type:Boolean,reflect:!0,attribute:"critical-path"})],nn.prototype,"criticalPath",2),u([or({attribute:!1})],nn.prototype,"xAxis",2),nn=u([Pl("skdx-gantt-chart")],nn);import{customElement as Hl,property as xn}from"lit/decorators.js";var $t=class extends X{constructor(){super(...arguments);this.series=[];this.mean=!1;this.points=!1;this.notched=!1}render(){let{series:t,orientation:r,quartileMethod:a,whisker:o,mean:s,points:c,notched:l,categories:d,yAxis:m}=this;return this.root(zo({...this.sized(),series:t,orientation:r,quartileMethod:a,whisker:o,mean:s,points:c,notched:l,categories:d,yAxis:m}),"boxplot",this.label??"Box plot")}};u([xn({attribute:!1})],$t.prototype,"series",2),u([xn()],$t.prototype,"orientation",2),u([xn({attribute:"quartile-method"})],$t.prototype,"quartileMethod",2),u([xn({type:Number})],$t.prototype,"whisker",2),u([xn({type:Boolean,reflect:!0})],$t.prototype,"mean",2),u([xn({type:Boolean,reflect:!0})],$t.prototype,"points",2),u([xn({type:Boolean,reflect:!0})],$t.prototype,"notched",2),u([xn({attribute:!1})],$t.prototype,"categories",2),u([xn({attribute:!1})],$t.prototype,"yAxis",2),$t=u([Hl("skdx-boxplot")],$t);import{customElement as Vl,property as Wt}from"lit/decorators.js";var at=class extends X{constructor(){super(...arguments);this.data=[];this.labels=!1;this.breadcrumbs=!1}render(){let{data:t,innerRadius:r,centerLabel:a,labels:o,rootId:s,breadcrumbs:c,maxDepth:l,sort:d,startAngle:m,endAngle:h,padAngle:f,colorScale:M}=this;return this.root(Ro({...this.sized(),data:t,innerRadius:r,centerLabel:a,labels:o,rootId:s,breadcrumbs:c,maxDepth:l,sort:d,startAngle:m,endAngle:h,padAngle:f,colorScale:M}),"sunburst",this.label??"Sunburst chart")}};u([Wt({attribute:!1})],at.prototype,"data",2),u([Wt({type:Number,attribute:"inner-radius"})],at.prototype,"innerRadius",2),u([Wt({attribute:"center-label"})],at.prototype,"centerLabel",2),u([Wt({type:Boolean,reflect:!0})],at.prototype,"labels",2),u([Wt({attribute:!1})],at.prototype,"rootId",2),u([Wt({type:Boolean,reflect:!0})],at.prototype,"breadcrumbs",2),u([Wt({type:Number,attribute:"max-depth"})],at.prototype,"maxDepth",2),u([Wt()],at.prototype,"sort",2),u([Wt({type:Number,attribute:"start-angle"})],at.prototype,"startAngle",2),u([Wt({type:Number,attribute:"end-angle"})],at.prototype,"endAngle",2),u([Wt({type:Number,attribute:"pad-angle"})],at.prototype,"padAngle",2),u([Wt({attribute:!1})],at.prototype,"colorScale",2),at=u([Vl("skdx-sunburst-chart")],at);import{customElement as _l,property as Lr}from"lit/decorators.js";var un=class extends X{render(){let{names:n,matrix:t,links:r,padding:a,sort:o}=this;return this.root(Eo({...this.sized(),names:n,matrix:t,links:r,padding:a,sort:o}),"chord",this.label??"Chord chart")}};u([Lr({attribute:!1})],un.prototype,"names",2),u([Lr({attribute:!1})],un.prototype,"matrix",2),u([Lr({attribute:!1})],un.prototype,"links",2),u([Lr({type:Number})],un.prototype,"padding",2),u([Lr()],un.prototype,"sort",2),un=u([_l("skdx-chord-chart")],un);import{customElement as jl,property as yn}from"lit/decorators.js";var It=class extends X{constructor(){super(...arguments);this.features=[];this.labels=!1}render(){let{features:t,color:r,colorScale:a,colorLegend:o,projection:s,points:c,lines:l,sizeRange:d,labels:m}=this;return this.root(Bo({...this.sized(),features:t,color:r,colorScale:a,colorLegend:o,projection:s,points:c,lines:l,sizeRange:d,labels:m}),"map",this.label??"Map")}};u([yn({attribute:!1})],It.prototype,"features",2),u([yn()],It.prototype,"color",2),u([yn({attribute:!1})],It.prototype,"colorScale",2),u([yn({attribute:!1})],It.prototype,"colorLegend",2),u([yn()],It.prototype,"projection",2),u([yn({attribute:!1})],It.prototype,"points",2),u([yn({attribute:!1})],It.prototype,"lines",2),u([yn({attribute:!1})],It.prototype,"sizeRange",2),u([yn({type:Boolean,reflect:!0})],It.prototype,"labels",2),It=u([jl("skdx-map-chart")],It);import{customElement as Gl,property as qt}from"lit/decorators.js";var ot=class extends X{constructor(){super(...arguments);this.data=[];this.track=!0;this.rounded=!0;this.labels=!1}render(){let{data:t,max:r,startAngle:a,endAngle:o,innerRadius:s,gap:c,track:l,rounded:d,labels:m,bands:h,target:f,centerLabel:M}=this;return this.root(Ha({...this.sized(),data:t,max:r,startAngle:a,endAngle:o,innerRadius:s,gap:c,track:l,rounded:d,labels:m,bands:h,target:f,centerLabel:M}),"radial",this.label??"Radial bar chart")}};u([qt({attribute:!1})],ot.prototype,"data",2),u([qt({type:Number})],ot.prototype,"max",2),u([qt({type:Number,attribute:"start-angle"})],ot.prototype,"startAngle",2),u([qt({type:Number,attribute:"end-angle"})],ot.prototype,"endAngle",2),u([qt({type:Number,attribute:"inner-radius"})],ot.prototype,"innerRadius",2),u([qt({type:Number})],ot.prototype,"gap",2),u([qt({type:Boolean,attribute:"no-track",converter:Ne})],ot.prototype,"track",2),u([qt({type:Boolean,attribute:"no-rounded",converter:Ne})],ot.prototype,"rounded",2),u([qt({type:Boolean,reflect:!0})],ot.prototype,"labels",2),u([qt({attribute:!1})],ot.prototype,"bands",2),u([qt({type:Number})],ot.prototype,"target",2),u([qt({attribute:"center-label"})],ot.prototype,"centerLabel",2),ot=u([Gl("skdx-radial-bar-chart")],ot);import{customElement as Wl,property as Ft}from"lit/decorators.js";var et=class extends X{constructor(){super(...arguments);this.value=Number.NaN;this.tickLabels=!0}render(){let{value:t,min:r,max:a,variant:o,startAngle:s,endAngle:c,thickness:l,bands:d,target:m,ticks:h,tickLabels:f,centerLabel:M,caption:$}=this;return this.root(Va({...this.sized(),value:t,min:r,max:a,variant:o,startAngle:s,endAngle:c,thickness:l,bands:d,target:m,ticks:h,tickLabels:f,centerLabel:M,caption:$}),"gauge",this.label??"Gauge chart")}};u([Ft({type:Number})],et.prototype,"value",2),u([Ft({type:Number})],et.prototype,"min",2),u([Ft({type:Number})],et.prototype,"max",2),u([Ft()],et.prototype,"variant",2),u([Ft({type:Number,attribute:"start-angle"})],et.prototype,"startAngle",2),u([Ft({type:Number,attribute:"end-angle"})],et.prototype,"endAngle",2),u([Ft({type:Number})],et.prototype,"thickness",2),u([Ft({attribute:!1})],et.prototype,"bands",2),u([Ft({type:Number})],et.prototype,"target",2),u([Ft({attribute:!1})],et.prototype,"ticks",2),u([Ft({type:Boolean,attribute:"no-tick-labels",converter:Ne})],et.prototype,"tickLabels",2),u([Ft({attribute:"center-label"})],et.prototype,"centerLabel",2),u([Ft()],et.prototype,"caption",2),et=u([Wl("skdx-gauge-chart")],et);import{customElement as ql,property as Tt}from"lit/decorators.js";var Ue=class extends X{constructor(){super(...arguments);this.series=[];this.labels=!1}render(){let{series:t,sizeRange:r,labels:a,xAxis:o,yAxis:s,zAxis:c,references:l,annotations:d,colorScale:m,colorLegend:h,hitRadius:f,jitter:M,trendline:$,sampling:g}=this;return this.root(_a({...this.sized(),series:t,sizeRange:r,labels:a,xAxis:o,yAxis:s,zAxis:c,references:l,annotations:d,colorScale:m,colorLegend:h,hitRadius:f,jitter:M,trendline:$,sampling:g}),"bubble",this.label??"Bubble chart")}};u([Tt({attribute:!1})],Ue.prototype,"series",2),u([Tt({attribute:!1})],Ue.prototype,"sizeRange",2),u([Tt({type:Boolean,reflect:!0})],Ue.prototype,"labels",2),u([Tt({attribute:!1})],Ue.prototype,"xAxis",2),u([Tt({attribute:!1})],Ue.prototype,"yAxis",2),u([Tt({attribute:!1})],Ue.prototype,"zAxis",2),u([Tt({attribute:!1})],Ue.prototype,"references",2),u([Tt({attribute:!1})],Ue.prototype,"annotations",2),u([Tt({attribute:!1})],Ue.prototype,"colorScale",2),u([Tt({attribute:!1})],Ue.prototype,"colorLegend",2),u([Tt({type:Number,attribute:"hit-radius"})],Ue.prototype,"hitRadius",2),u([Tt({type:Number})],Ue.prototype,"jitter",2),u([Tt({attribute:!1})],Ue.prototype,"trendline",2),u([Tt({attribute:!1})],Ue.prototype,"sampling",2),Ue=u([ql("skdx-bubble-chart")],Ue);import{customElement as Zl,property as At}from"lit/decorators.js";var Ye=class extends X{constructor(){super(...arguments);this.data=[];this.labels=!1}render(){let{data:t,name:r,color:a,bins:o,binWidth:s,thresholds:c,domain:l,mode:d,xAxis:m,yAxis:h,references:f,annotations:M,labels:$,barGap:g}=this;return this.root(ja({...this.sized(),data:t,name:r,color:a,bins:o,binWidth:s,thresholds:c,domain:l,mode:d,xAxis:m,yAxis:h,references:f,annotations:M,labels:$,barGap:g}),"histogram",this.label??"Histogram")}};u([At({attribute:!1})],Ye.prototype,"data",2),u([At()],Ye.prototype,"name",2),u([At()],Ye.prototype,"color",2),u([At({type:Number})],Ye.prototype,"bins",2),u([At({type:Number,attribute:"bin-width"})],Ye.prototype,"binWidth",2),u([At({attribute:!1})],Ye.prototype,"thresholds",2),u([At({attribute:!1})],Ye.prototype,"domain",2),u([At()],Ye.prototype,"mode",2),u([At({attribute:!1})],Ye.prototype,"xAxis",2),u([At({attribute:!1})],Ye.prototype,"yAxis",2),u([At({attribute:!1})],Ye.prototype,"references",2),u([At({attribute:!1})],Ye.prototype,"annotations",2),u([At({type:Boolean,reflect:!0})],Ye.prototype,"labels",2),u([At({type:Number,attribute:"bar-gap"})],Ye.prototype,"barGap",2),Ye=u([Zl("skdx-histogram")],Ye);import{customElement as Ul,property as Gn}from"lit/decorators.js";var Zt=class extends X{constructor(){super(...arguments);this.data=[];this.labels=!1}render(){let{data:t,orientation:r,ranges:a,min:o,max:s,labels:c,ticks:l}=this;return this.root(yr({...this.sized(),data:t,orientation:r,ranges:a,min:o,max:s,labels:c,ticks:l}),"bullet",this.label??"Bullet chart")}};u([Gn({attribute:!1})],Zt.prototype,"data",2),u([Gn()],Zt.prototype,"orientation",2),u([Gn({attribute:!1})],Zt.prototype,"ranges",2),u([Gn({type:Number})],Zt.prototype,"min",2),u([Gn({type:Number})],Zt.prototype,"max",2),u([Gn({type:Boolean,reflect:!0})],Zt.prototype,"labels",2),u([Gn({type:Number})],Zt.prototype,"ticks",2),Zt=u([Ul("skdx-bullet-chart")],Zt);import{customElement as Yl}from"lit/decorators.js";var Or=class extends Te{render(){return this.root(Ga(this.input()),"combo",this.label??"Combo chart")}};Or=u([Yl("skdx-combo-chart")],Or);import{customElement as Kl,property as ut}from"lit/decorators.js";var je=class extends X{constructor(){super(...arguments);this.series=[];this.connectNulls=!1;this.brush=!1;this.crosshair=!1}render(){let{series:t,variant:r,categories:a,xAxis:o,yAxis:s,rightAxis:c,references:l,annotations:d,curve:m,connectNulls:h,orientation:f,radius:M,barGap:$,barWidth:g,brush:w,crosshair:R}=this;return this.root(Wa({...this.sized(),series:t,variant:r,categories:a,xAxis:o,yAxis:s,rightAxis:c,references:l,annotations:d,curve:m,connectNulls:h,orientation:f,radius:M,barGap:$,barWidth:g,brush:w,crosshair:R}),"range",this.label??"Range chart")}};u([ut({attribute:!1})],je.prototype,"series",2),u([ut()],je.prototype,"variant",2),u([ut({attribute:!1})],je.prototype,"categories",2),u([ut({attribute:!1})],je.prototype,"xAxis",2),u([ut({attribute:!1})],je.prototype,"yAxis",2),u([ut({attribute:!1})],je.prototype,"rightAxis",2),u([ut({attribute:!1})],je.prototype,"references",2),u([ut({attribute:!1})],je.prototype,"annotations",2),u([ut()],je.prototype,"curve",2),u([ut({type:Boolean,reflect:!0,attribute:"connect-nulls"})],je.prototype,"connectNulls",2),u([ut()],je.prototype,"orientation",2),u([ut({type:Number})],je.prototype,"radius",2),u([ut({type:Number,attribute:"bar-gap"})],je.prototype,"barGap",2),u([ut({type:Number,attribute:"bar-width"})],je.prototype,"barWidth",2),u([ut({type:Boolean,reflect:!0})],je.prototype,"brush",2),u([ut({type:Boolean,reflect:!0})],je.prototype,"crosshair",2),je=u([Kl("skdx-range-chart")],je);import{customElement as Xl,property as Dn}from"lit/decorators.js";var Pt=class extends X{constructor(){super(...arguments);this.nodes=[];this.edges=[];this.labels=!0;this.directed=!1;this.edgeLabels=!1}render(){let{nodes:t,edges:r,arrange:a,labels:o,nodeRange:s,iterations:c,directed:l,edgeLabels:d}=this;return this.root(qa({...this.sized(),nodes:t,edges:r,arrange:a,labels:o,nodeRange:s,iterations:c,directed:l,edgeLabels:d}),"network",this.label??"Network chart")}};u([Dn({attribute:!1})],Pt.prototype,"nodes",2),u([Dn({attribute:!1})],Pt.prototype,"edges",2),u([Dn()],Pt.prototype,"arrange",2),u([Dn({type:Boolean,attribute:"no-labels",converter:Ne})],Pt.prototype,"labels",2),u([Dn({attribute:!1})],Pt.prototype,"nodeRange",2),u([Dn({type:Number})],Pt.prototype,"iterations",2),u([Dn({type:Boolean,reflect:!0})],Pt.prototype,"directed",2),u([Dn({type:Boolean,reflect:!0,attribute:"edge-labels"})],Pt.prototype,"edgeLabels",2),Pt=u([Xl("skdx-network-chart")],Pt);import{customElement as Ql,property as na}from"lit/decorators.js";var vn=class extends X{constructor(){super(...arguments);this.events=[];this.labels=!0}render(){let{events:t,orientation:r,xAxis:a,labels:o}=this;return this.root(Ua({...this.sized(),events:t,orientation:r,xAxis:a,labels:o}),"timeline",this.label??"Timeline chart")}};u([na({attribute:!1})],vn.prototype,"events",2),u([na()],vn.prototype,"orientation",2),u([na({attribute:!1})],vn.prototype,"xAxis",2),u([na({type:Boolean,attribute:"no-labels",converter:Ne})],vn.prototype,"labels",2),vn=u([Ql("skdx-timeline-chart")],vn);import{customElement as Jl,property as Sr}from"lit/decorators.js";var hn=class extends X{constructor(){super(...arguments);this.segments=[];this.data=[];this.labels=!1}render(){let{segments:t,data:r,labels:a,gap:o,xAxis:s}=this;return this.root(Fo({...this.sized(),segments:t,data:r,labels:a,gap:o,xAxis:s}),"marimekko",this.label??"Marimekko chart")}};u([Sr({attribute:!1})],hn.prototype,"segments",2),u([Sr({attribute:!1})],hn.prototype,"data",2),u([Sr({type:Boolean,reflect:!0})],hn.prototype,"labels",2),u([Sr({type:Number})],hn.prototype,"gap",2),u([Sr({attribute:!1})],hn.prototype,"xAxis",2),hn=u([Jl("skdx-marimekko-chart")],hn);import{customElement as ec,property as sr}from"lit/decorators.js";var rn=class extends X{constructor(){super(...arguments);this.dimensions=[];this.data=[];this.connectNulls=!1}render(){let{dimensions:t,data:r,opacity:a,curve:o,connectNulls:s,filters:c}=this;return this.root(Po({...this.sized(),dimensions:t,data:r,opacity:a,curve:o,connectNulls:s,filters:c}),"parallel",this.label??"Parallel coordinates chart")}};u([sr({attribute:!1})],rn.prototype,"dimensions",2),u([sr({attribute:!1})],rn.prototype,"data",2),u([sr({type:Number})],rn.prototype,"opacity",2),u([sr()],rn.prototype,"curve",2),u([sr({type:Boolean,reflect:!0,attribute:"connect-nulls"})],rn.prototype,"connectNulls",2),u([sr({attribute:!1})],rn.prototype,"filters",2),rn=u([ec("skdx-parallel-coordinates-chart")],rn);import{customElement as tc,property as Mn}from"lit/decorators.js";var Ct=class extends X{constructor(){super(...arguments);this.value=Number.NaN;this.labels=!0}render(){let{value:t,min:r,max:a,target:o,bands:s,orientation:c,caption:l,labels:d,ticks:m}=this;return this.root(Ho({...this.sized(),value:t,min:r,max:a,target:o,bands:s,orientation:c,caption:l,labels:d,ticks:m}),"linear-gauge",this.label??"Linear gauge")}};u([Mn({type:Number})],Ct.prototype,"value",2),u([Mn({type:Number})],Ct.prototype,"min",2),u([Mn({type:Number})],Ct.prototype,"max",2),u([Mn({type:Number})],Ct.prototype,"target",2),u([Mn({attribute:!1})],Ct.prototype,"bands",2),u([Mn()],Ct.prototype,"orientation",2),u([Mn()],Ct.prototype,"caption",2),u([Mn({type:Boolean,attribute:"no-labels",converter:Ne})],Ct.prototype,"labels",2),u([Mn({type:Number})],Ct.prototype,"ticks",2),Ct=u([tc("skdx-linear-gauge")],Ct);import{customElement as nc,property as wn}from"lit/decorators.js";var Lt=class extends X{constructor(){super(...arguments);this.data=[];this.labels=!1}render(){let{data:t,startLabel:r,endLabel:a,orientation:o,labels:s,sort:c,markerSize:l,xAxis:d,references:m}=this;return this.root(Vo({...this.sized(),data:t,startLabel:r,endLabel:a,orientation:o,labels:s,sort:c,markerSize:l,xAxis:d,references:m}),"dumbbell",this.label??"Dumbbell chart")}};u([wn({attribute:!1})],Lt.prototype,"data",2),u([wn({attribute:"start-label"})],Lt.prototype,"startLabel",2),u([wn({attribute:"end-label"})],Lt.prototype,"endLabel",2),u([wn()],Lt.prototype,"orientation",2),u([wn({type:Boolean,reflect:!0})],Lt.prototype,"labels",2),u([wn()],Lt.prototype,"sort",2),u([wn({type:Number,attribute:"marker-size"})],Lt.prototype,"markerSize",2),u([wn({attribute:!1})],Lt.prototype,"xAxis",2),u([wn({attribute:!1})],Lt.prototype,"references",2),Lt=u([nc("skdx-dumbbell-chart")],Lt);import{customElement as rc,property as Ut}from"lit/decorators.js";var st=class extends X{constructor(){super(...arguments);this.data=[];this.labels=!1;this.brush=!1;this.crosshair=!1}render(){let{data:t,threshold:r,cumulativeLabel:a,name:o,labels:s,radius:c,barGap:l,barWidth:d,xAxis:m,yAxis:h,brush:f,crosshair:M}=this;return this.root(_o({...this.sized(),data:t,threshold:r,cumulativeLabel:a,name:o,labels:s,radius:c,barGap:l,barWidth:d,xAxis:m,yAxis:h,brush:f,crosshair:M}),"pareto",this.label??"Pareto chart")}};u([Ut({attribute:!1})],st.prototype,"data",2),u([Ut({type:Number})],st.prototype,"threshold",2),u([Ut({attribute:"cumulative-label"})],st.prototype,"cumulativeLabel",2),u([Ut()],st.prototype,"name",2),u([Ut({type:Boolean,reflect:!0})],st.prototype,"labels",2),u([Ut({type:Number})],st.prototype,"radius",2),u([Ut({type:Number,attribute:"bar-gap"})],st.prototype,"barGap",2),u([Ut({type:Number,attribute:"bar-width"})],st.prototype,"barWidth",2),u([Ut({attribute:!1})],st.prototype,"xAxis",2),u([Ut({attribute:!1})],st.prototype,"yAxis",2),u([Ut({type:Boolean,reflect:!0})],st.prototype,"brush",2),u([Ut({type:Boolean,reflect:!0})],st.prototype,"crosshair",2),st=u([rc("skdx-pareto-chart")],st);import{customElement as ac,property as Bn}from"lit/decorators.js";var Ht=class extends X{constructor(){super(...arguments);this.series=[];this.ranked=!1;this.labels=!0}render(){let{series:t,categories:r,ranked:a,topRank:o,curve:s,labels:c,markerSize:l,xAxis:d}=this;return this.root(qo({...this.sized(),series:t,categories:r,ranked:a,topRank:o,curve:s,labels:c,markerSize:l,xAxis:d}),"bump",this.label??"Bump chart")}};u([Bn({attribute:!1})],Ht.prototype,"series",2),u([Bn({attribute:!1})],Ht.prototype,"categories",2),u([Bn({type:Boolean,reflect:!0})],Ht.prototype,"ranked",2),u([Bn({type:Number,attribute:"top-rank"})],Ht.prototype,"topRank",2),u([Bn()],Ht.prototype,"curve",2),u([Bn({type:Boolean,attribute:"no-labels",converter:Ne})],Ht.prototype,"labels",2),u([Bn({type:Number,attribute:"marker-size"})],Ht.prototype,"markerSize",2),u([Bn({attribute:!1})],Ht.prototype,"xAxis",2),Ht=u([ac("skdx-bump-chart")],Ht);import{customElement as oc,property as kn}from"lit/decorators.js";var Ot=class extends X{constructor(){super(...arguments);this.data=[];this.labels=!1}render(){let{data:t,scale:r,max:a,startAngle:o,endAngle:s,padAngle:c,innerRadius:l,levels:d,labels:m}=this;return this.root(Uo({...this.sized(),data:t,scale:r,max:a,startAngle:o,endAngle:s,padAngle:c,innerRadius:l,levels:d,labels:m}),"polar-area",this.label??"Polar area chart")}};u([kn({attribute:!1})],Ot.prototype,"data",2),u([kn()],Ot.prototype,"scale",2),u([kn({type:Number})],Ot.prototype,"max",2),u([kn({type:Number,attribute:"start-angle"})],Ot.prototype,"startAngle",2),u([kn({type:Number,attribute:"end-angle"})],Ot.prototype,"endAngle",2),u([kn({type:Number,attribute:"pad-angle"})],Ot.prototype,"padAngle",2),u([kn({type:Number,attribute:"inner-radius"})],Ot.prototype,"innerRadius",2),u([kn({type:Number})],Ot.prototype,"levels",2),u([kn({type:Boolean,reflect:!0})],Ot.prototype,"labels",2),Ot=u([oc("skdx-polar-area-chart")],Ot);import{customElement as sc,property as zr}from"lit/decorators.js";var fn=class extends X{constructor(){super(...arguments);this.series=[]}render(){let{series:t,orientation:r,markerSize:a,yAxis:o,references:s}=this;return this.root(Yo({...this.sized(),series:t,orientation:r,markerSize:a,yAxis:o,references:s}),"swarm",this.label??"Swarm plot")}};u([zr({attribute:!1})],fn.prototype,"series",2),u([zr()],fn.prototype,"orientation",2),u([zr({type:Number,attribute:"marker-size"})],fn.prototype,"markerSize",2),u([zr({attribute:!1})],fn.prototype,"yAxis",2),u([zr({attribute:!1})],fn.prototype,"references",2),fn=u([sc("skdx-swarm-plot")],fn);import{customElement as ic,property as Fn}from"lit/decorators.js";var Vt=class extends X{constructor(){super(...arguments);this.data=[];this.labels=!1}render(){let{data:t,total:r,rows:a,columns:o,orientation:s,cellGap:c,cellRadius:l,labels:d}=this;return this.root(Ko({...this.sized(),data:t,total:r,rows:a,columns:o,orientation:s,cellGap:c,cellRadius:l,labels:d}),"waffle",this.label??"Waffle chart")}};u([Fn({attribute:!1})],Vt.prototype,"data",2),u([Fn({type:Number})],Vt.prototype,"total",2),u([Fn({type:Number})],Vt.prototype,"rows",2),u([Fn({type:Number})],Vt.prototype,"columns",2),u([Fn()],Vt.prototype,"orientation",2),u([Fn({type:Number,attribute:"cell-gap"})],Vt.prototype,"cellGap",2),u([Fn({type:Number,attribute:"cell-radius"})],Vt.prototype,"cellRadius",2),u([Fn({type:Boolean,reflect:!0})],Vt.prototype,"labels",2),Vt=u([ic("skdx-waffle-chart")],Vt);import{customElement as lc,property as $n}from"lit/decorators.js";var St=class extends X{constructor(){super(...arguments);this.data=[];this.labels=!0}render(){let{data:t,orientation:r,nodeShape:a,linkStyle:o,rootId:s,collapsed:c,maxDepth:l,labels:d,nodeSize:m}=this;return this.root(ea({...this.sized(),data:t,orientation:r,nodeShape:a,linkStyle:o,rootId:s,collapsed:c,maxDepth:l,labels:d,nodeSize:m}),"tree",this.label??"Tree chart")}};u([$n({attribute:!1})],St.prototype,"data",2),u([$n()],St.prototype,"orientation",2),u([$n({attribute:"node-shape"})],St.prototype,"nodeShape",2),u([$n({attribute:"link-style"})],St.prototype,"linkStyle",2),u([$n({attribute:!1})],St.prototype,"rootId",2),u([$n({attribute:!1})],St.prototype,"collapsed",2),u([$n({type:Number,attribute:"max-depth"})],St.prototype,"maxDepth",2),u([$n({type:Boolean,attribute:"no-labels",converter:Ne})],St.prototype,"labels",2),u([$n({type:Number,attribute:"node-size"})],St.prototype,"nodeSize",2),St=u([lc("skdx-tree-chart")],St);import{customElement as cc,property as Wn}from"lit/decorators.js";var Yt=class extends X{constructor(){super(...arguments);this.data=[];this.labels=!0}render(){let{data:t,orientation:r,rootId:a,collapsed:o,maxDepth:s,labels:c,nodeSize:l}=this;return this.root(jo({...this.sized(),data:t,orientation:r,rootId:a,collapsed:o,maxDepth:s,labels:c,nodeSize:l}),"organization",this.label??"Organization chart")}};u([Wn({attribute:!1})],Yt.prototype,"data",2),u([Wn()],Yt.prototype,"orientation",2),u([Wn({attribute:!1})],Yt.prototype,"rootId",2),u([Wn({attribute:!1})],Yt.prototype,"collapsed",2),u([Wn({type:Number,attribute:"max-depth"})],Yt.prototype,"maxDepth",2),u([Wn({type:Boolean,attribute:"no-labels",converter:Ne})],Yt.prototype,"labels",2),u([Wn({type:Number,attribute:"node-size"})],Yt.prototype,"nodeSize",2),Yt=u([cc("skdx-organization-chart")],Yt);import{customElement as dc,property as ir}from"lit/decorators.js";var an=class extends X{constructor(){super(...arguments);this.data=[];this.labels=!0}render(){let{data:t,rootId:r,maxDepth:a,labels:o,padding:s,colorScale:c}=this;return this.root(Go({...this.sized(),data:t,rootId:r,maxDepth:a,labels:o,padding:s,colorScale:c}),"circle-packing",this.label??"Circle packing chart")}};u([ir({attribute:!1})],an.prototype,"data",2),u([ir({attribute:!1})],an.prototype,"rootId",2),u([ir({type:Number,attribute:"max-depth"})],an.prototype,"maxDepth",2),u([ir({type:Boolean,attribute:"no-labels",converter:Ne})],an.prototype,"labels",2),u([ir({type:Number})],an.prototype,"padding",2),u([ir({attribute:!1})],an.prototype,"colorScale",2),an=u([dc("skdx-circle-packing-chart")],an);import{customElement as mc,property as In}from"lit/decorators.js";var zt=class extends X{constructor(){super(...arguments);this.data=[];this.breadcrumbs=!1;this.labels=!0}render(){let{data:t,orientation:r,rootId:a,breadcrumbs:o,maxDepth:s,sort:c,labels:l,padding:d,colorScale:m}=this;return this.root(Wo({...this.sized(),data:t,orientation:r,rootId:a,breadcrumbs:o,maxDepth:s,sort:c,labels:l,padding:d,colorScale:m}),"icicle",this.label??"Icicle chart")}};u([In({attribute:!1})],zt.prototype,"data",2),u([In()],zt.prototype,"orientation",2),u([In({attribute:!1})],zt.prototype,"rootId",2),u([In({type:Boolean,reflect:!0})],zt.prototype,"breadcrumbs",2),u([In({type:Number,attribute:"max-depth"})],zt.prototype,"maxDepth",2),u([In()],zt.prototype,"sort",2),u([In({type:Boolean,attribute:"no-labels",converter:Ne})],zt.prototype,"labels",2),u([In({type:Number})],zt.prototype,"padding",2),u([In({attribute:!1})],zt.prototype,"colorScale",2),zt=u([mc("skdx-icicle-chart")],zt);export{Cr as SkdxAreaChart,Tr as SkdxBarChart,$t as SkdxBoxplot,Ue as SkdxBubbleChart,Zt as SkdxBulletChart,Ht as SkdxBumpChart,Je as SkdxCandlestickChart,un as SkdxChordChart,an as SkdxCirclePackingChart,Or as SkdxComboChart,Lt as SkdxDumbbellChart,tn as SkdxFunnelChart,nn as SkdxGanttChart,et as SkdxGaugeChart,He as SkdxHeatmap,Ye as SkdxHistogram,zt as SkdxIcicleChart,Ar as SkdxLineChart,Ct as SkdxLinearGauge,It as SkdxMapChart,hn as SkdxMarimekkoChart,Pt as SkdxNetworkChart,Yt as SkdxOrganizationChart,rn as SkdxParallelCoordinatesChart,st as SkdxParetoChart,mt as SkdxPieChart,Ot as SkdxPolarAreaChart,rt as SkdxRadarChart,ot as SkdxRadialBarChart,je as SkdxRangeChart,xt as SkdxSankeyChart,Xe as SkdxScatterChart,gt as SkdxSparkline,at as SkdxSunburstChart,fn as SkdxSwarmPlot,vn as SkdxTimelineChart,St as SkdxTreeChart,kt as SkdxTreemap,Vt as SkdxWaffleChart,yt as SkdxWaterfallChart,Jr as csv,Qr as exportChart,ae as makeFormatter,Ws as seriesCsv,Xr as svgMarkup,$r as syncGroup};