@awc-ui/core 1.0.0-beta → 1.0.0-beta.1

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 (79) hide show
  1. package/dist/components/p-6wZSqm_2.js +2 -0
  2. package/dist/components/{p-Bx5sxRqa.js.map → p-6wZSqm_2.js.map} +1 -1
  3. package/dist/components/p-7fN_yCXW.js +2 -0
  4. package/dist/components/{p-CJdqKSuf.js.map → p-7fN_yCXW.js.map} +1 -1
  5. package/dist/components/{p-G5m2pHZ2.js → p-B0Opn6dK.js} +2 -2
  6. package/dist/components/{p-pDrTJmeT.js → p-B3MWYEEJ.js} +2 -2
  7. package/dist/components/{p-DGGkdSZk.js → p-BwXpiUsu.js} +2 -2
  8. package/dist/{md3/p-B0NLeNWu.js → components/p-Bx6--dQF.js} +2 -2
  9. package/dist/components/{p-BIIp3Qod.js → p-C8EP4S21.js} +2 -2
  10. package/dist/components/{p-CWM3KSti.js → p-C_ogF68H.js} +2 -2
  11. package/dist/components/{p-BlwGYUkt.js → p-Ch2-tttM.js} +2 -2
  12. package/dist/components/p-DXXUoRSH.js +2 -0
  13. package/dist/components/{p-DWUCvzfU.js.map → p-DXXUoRSH.js.map} +1 -1
  14. package/dist/components/p-Dp-w93ot.js +2 -0
  15. package/dist/components/{p-BUYYCrGa.js.map → p-Dp-w93ot.js.map} +1 -1
  16. package/dist/{md3/p-CGStn3Iq.js → components/p-DvOKnoqK.js} +2 -2
  17. package/dist/components/{p-B7yMxWo-.js → p-DzPKu-Ma.js} +2 -2
  18. package/dist/components/{p-CXpXrhQH.js → p-RLxbNqRv.js} +2 -2
  19. package/dist/components/p-UdGDg2oJ.js +2 -0
  20. package/dist/components/{p-BujtL9xW.js.map → p-UdGDg2oJ.js.map} +1 -1
  21. package/dist/components/p-e2HRV63Y.js +2 -0
  22. package/dist/components/{p-CrlkPxeB.js.map → p-e2HRV63Y.js.map} +1 -1
  23. package/dist/components/p-stybaFzj.js +2 -0
  24. package/dist/components/{p-JbwZ84YK.js.map → p-stybaFzj.js.map} +1 -1
  25. package/dist/components/p-uTEkf0sE.js +2 -0
  26. package/dist/components/{p-BXwh1zjF.js.map → p-uTEkf0sE.js.map} +1 -1
  27. package/dist/esm/{a11y-C9_cZAF_.js → a11y-C6CRqodW.js} +3 -3
  28. package/dist/esm/{a11y-C9_cZAF_.js.map → a11y-C6CRqodW.js.map} +1 -1
  29. package/dist/esm/{bar-chart-IvBgAmmF.js → bar-chart-ZZrajEkM.js} +4 -4
  30. package/dist/esm/{bar-chart-IvBgAmmF.js.map → bar-chart-ZZrajEkM.js.map} +1 -1
  31. package/dist/esm/{chart-D1kP9gfW.js → chart-32olae06.js} +4 -4
  32. package/dist/esm/{chart-D1kP9gfW.js.map → chart-32olae06.js.map} +1 -1
  33. package/dist/esm/{hit-test-DFfwlMb9.js → hit-test-DHldf5Lm.js} +3 -3
  34. package/dist/esm/{hit-test-DFfwlMb9.js.map → hit-test-DHldf5Lm.js.map} +1 -1
  35. package/dist/esm/{rtl-CGStn3Iq.js → rtl-DvOKnoqK.js} +3 -3
  36. package/dist/esm/{rtl-CGStn3Iq.js.map → rtl-DvOKnoqK.js.map} +1 -1
  37. package/dist/md3/p-04e97f5d.entry.js +2 -0
  38. package/dist/md3/{p-ec14eaca.entry.js.map → p-04e97f5d.entry.js.map} +1 -1
  39. package/dist/md3/p-3cce1de3.entry.js +2 -0
  40. package/dist/md3/{p-2121c939.entry.js.map → p-3cce1de3.entry.js.map} +1 -1
  41. package/dist/md3/p-4d82132d.entry.js +2 -0
  42. package/dist/md3/{p-fe78659d.entry.js.map → p-4d82132d.entry.js.map} +1 -1
  43. package/dist/{components/p-Bu-m4Gm2.js → md3/p-Bx6--dQF.js} +2 -2
  44. package/dist/md3/{p-B0NLeNWu.js.map → p-Bx6--dQF.js.map} +1 -1
  45. package/dist/md3/{p-CWM3KSti.js → p-C_ogF68H.js} +2 -2
  46. package/dist/md3/{p-CWM3KSti.js.map → p-C_ogF68H.js.map} +1 -1
  47. package/dist/{components/p-CGStn3Iq.js → md3/p-DvOKnoqK.js} +2 -2
  48. package/dist/md3/{p-CGStn3Iq.js.map → p-DvOKnoqK.js.map} +1 -1
  49. package/dist/md3/{p-B7yMxWo-.js → p-DzPKu-Ma.js} +2 -2
  50. package/dist/md3/{p-B7yMxWo-.js.map → p-DzPKu-Ma.js.map} +1 -1
  51. package/dist/md3/{p-CXpXrhQH.js → p-RLxbNqRv.js} +2 -2
  52. package/dist/md3/{p-CXpXrhQH.js.map → p-RLxbNqRv.js.map} +1 -1
  53. package/dist/md3/{p-f6373c6c.entry.js → p-aaec2698.entry.js} +2 -2
  54. package/dist/md3/{p-9ff2d5d1.entry.js → p-c063c823.entry.js} +2 -2
  55. package/main-llm.md +2 -2
  56. package/package.json +24 -3
  57. package/dist/components/p-BUYYCrGa.js +0 -2
  58. package/dist/components/p-BXwh1zjF.js +0 -2
  59. package/dist/components/p-BujtL9xW.js +0 -2
  60. package/dist/components/p-Bx5sxRqa.js +0 -2
  61. package/dist/components/p-CJdqKSuf.js +0 -2
  62. package/dist/components/p-CrlkPxeB.js +0 -2
  63. package/dist/components/p-DWUCvzfU.js +0 -2
  64. package/dist/components/p-JbwZ84YK.js +0 -2
  65. package/dist/md3/p-2121c939.entry.js +0 -2
  66. package/dist/md3/p-ec14eaca.entry.js +0 -2
  67. package/dist/md3/p-fe78659d.entry.js +0 -2
  68. /package/dist/components/{p-G5m2pHZ2.js.map → p-B0Opn6dK.js.map} +0 -0
  69. /package/dist/components/{p-pDrTJmeT.js.map → p-B3MWYEEJ.js.map} +0 -0
  70. /package/dist/components/{p-DGGkdSZk.js.map → p-BwXpiUsu.js.map} +0 -0
  71. /package/dist/components/{p-Bu-m4Gm2.js.map → p-Bx6--dQF.js.map} +0 -0
  72. /package/dist/components/{p-BIIp3Qod.js.map → p-C8EP4S21.js.map} +0 -0
  73. /package/dist/components/{p-CWM3KSti.js.map → p-C_ogF68H.js.map} +0 -0
  74. /package/dist/components/{p-BlwGYUkt.js.map → p-Ch2-tttM.js.map} +0 -0
  75. /package/dist/components/{p-CGStn3Iq.js.map → p-DvOKnoqK.js.map} +0 -0
  76. /package/dist/components/{p-B7yMxWo-.js.map → p-DzPKu-Ma.js.map} +0 -0
  77. /package/dist/components/{p-CXpXrhQH.js.map → p-RLxbNqRv.js.map} +0 -0
  78. /package/dist/md3/{p-f6373c6c.entry.js.map → p-aaec2698.entry.js.map} +0 -0
  79. /package/dist/md3/{p-9ff2d5d1.entry.js.map → p-c063c823.entry.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{t as n,d as t}from"./p-CGStn3Iq.js";function o(n){return n!=null&&typeof n==="object"&&!(n instanceof Date)}function r(n){if(n==null)return null;if(typeof n==="number")return n;if(!o(n))return null;return("y"in n?n.y:n[1])??null}function e(n){if(!o(n))return undefined;return"x"in n?n.x:n[0]}function c(n){return o(n?.find((n=>n!=null)))}function s(t,o,s){const u=t.some((n=>c(n.data)));if(!u){return{xValues:o??[],data:t.map((n=>n.data??[])),toMerged:t.map((()=>null)),toOwn:t.map((()=>null)),hasPointX:false}}const i=s==="category";const f=t=>i?`c${String(t)}`:`n${n(t,s)}`;const l=new Map;const a=t=>{const o=f(t);if(!l.has(o))l.set(o,{sort:i?l.size:n(t,s),value:t})};o?.forEach(a);for(const n of t){if(!c(n.data))continue;for(const t of n.data??[]){const n=e(t);if(n!==undefined)a(n)}}const d=[...l.values()].sort(((n,t)=>n.sort-t.sort)).map((n=>n.value));const h=new Map(d.map(((n,t)=>[f(n),t])));const p=d.length;const w=[];const $=[];const g=[];t.forEach((n=>{const t=n.data??[];if(!c(t)){if(!o?.length){const n=new Array(p).fill(undefined);for(let o=0;o<t.length&&o<p;o++)n[o]=r(t[o]);w.push(n);$.push(null);g.push(null);return}const n=new Array(p).fill(undefined);const e=new Array(t.length).fill(-1);const c=new Array(p).fill(-1);for(let s=0;s<t.length;s++){const u=s<o.length?h.get(f(o[s])):undefined;if(u===undefined)continue;n[u]=r(t[s]);e[s]=u;c[u]=s}w.push(n);$.push(e);g.push(c);return}const s=new Array(p).fill(undefined);const u=new Array(t.length).fill(-1);const i=new Array(p).fill(-1);for(let n=0;n<t.length;n++){const o=e(t[n]);if(o===undefined)continue;const c=h.get(f(o));if(c===undefined)continue;s[c]=r(t[n]);u[n]=c;i[c]=n}w.push(s);$.push(u);g.push(i)}));return{xValues:d,data:w,toMerged:$,toOwn:g,hasPointX:true}}function u(n,t){if(!n||!t)return n;const o={};for(const[r,e]of Object.entries(n)){const n=t[Number(r)];if(n!=null&&n>=0)o[n]=e}return o}function i(n){if(n==null)return null;const t=Array.isArray(n)?n[0]:n.low;const o=Array.isArray(n)?n[1]:n.high;if(t==null||o==null||!Number.isFinite(t)||!Number.isFinite(o))return null;return[Math.min(t,o),Math.max(t,o)]}function f(n){const o=n.labels??{};const r=n.chartType==="pie"?o.pie??"Pie chart":n.chartType==="bar"?o.bar??"Bar chart":n.chartType==="area"?o.area??"Area chart":n.chartType==="sparkline"?o.sparkline??"Sparkline":o.line??"Line chart";const e=[];if(n.title)e.push(n.title);e.push(r);if(n.chartType==="pie"){if(n.seriesCount>0){const t=o.slices??(n.seriesCount===1?"with %count% slice":"with %count% slices");e.push(t.replace("%count%",String(n.seriesCount)))}}else if(n.seriesCount>1){e.push((o.series??"with %count% series").replace("%count%",String(n.seriesCount)))}if(n.xMin!=null&&n.xMax!=null&&n.chartType!=="pie"){e.push((o.range??"from %min% to %max%").replace("%min%",t(n.xMin,n.locale)).replace("%max%",t(n.xMax,n.locale)))}return e.join(", ")+"."}function l(n){const o=200;const r=n.labels??{};const e=n.xValueFormatter??(o=>t(o,n.locale));const c=n.valueFormatter??(t=>t==null?"—":t.toLocaleString(n.locale||undefined));const s=(n.xAxisData?.length??0)>0;const u=s?n.xAxisData.length:Math.max(0,...n.series.map((n=>n.range?n.range.length:n.data.length)));const f=Math.min(u,o);const l=[];for(let t=0;t<f;t++){const o=n.series.map((n=>{if(n.range){const o=i(n.range[t]);return`<td>${a(o?`${c(o[0])}–${c(o[1])}`:c(null))}</td>`}return`<td>${a(c(n.data[t]??null))}</td>`})).join("");const r=s?e(n.xAxisData[t]):String(t+1);l.push(`<tr><th scope="row">${a(r)}</th>${o}</tr>`)}const d=l.join("");const h=n.series.map((n=>`<th scope="col">${a(n.label??r.series??"Series")}</th>`)).join("");const p=n.title?`<caption>${a(n.title)}</caption>`:"";const w=u>o?`<tfoot><tr><td colspan="${1+n.series.length}">${a((r.truncated??"Showing first %shown% of %total% rows.").replace("%shown%",String(o)).replace("%total%",String(u)))}</td></tr></tfoot>`:"";return`<table>\n ${p}\n <thead><tr><th scope="col">${a(n.xAxisLabel??(s?r.x??"X":r.index??"#"))}</th>${h}</tr></thead>\n <tbody>${d}</tbody>\n ${w}\n </table>`}function a(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}export{f as a,l as b,s as c,r as d,i as n,u as r};
2
- //# sourceMappingURL=p-CWM3KSti.js.map
1
+ import{t as n,d as t}from"./p-DvOKnoqK.js";function o(n){return n!=null&&typeof n==="object"&&!(n instanceof Date)}function r(n){if(n==null)return null;if(typeof n==="number")return n;if(!o(n))return null;return("y"in n?n.y:n[1])??null}function e(n){if(!o(n))return undefined;return"x"in n?n.x:n[0]}function c(n){return o(n?.find((n=>n!=null)))}function s(t,o,s){const u=t.some((n=>c(n.data)));if(!u){return{xValues:o??[],data:t.map((n=>n.data??[])),toMerged:t.map((()=>null)),toOwn:t.map((()=>null)),hasPointX:false}}const i=s==="category";const f=t=>i?`c${String(t)}`:`n${n(t,s)}`;const l=new Map;const a=t=>{const o=f(t);if(!l.has(o))l.set(o,{sort:i?l.size:n(t,s),value:t})};o?.forEach(a);for(const n of t){if(!c(n.data))continue;for(const t of n.data??[]){const n=e(t);if(n!==undefined)a(n)}}const d=[...l.values()].sort(((n,t)=>n.sort-t.sort)).map((n=>n.value));const h=new Map(d.map(((n,t)=>[f(n),t])));const p=d.length;const w=[];const $=[];const g=[];t.forEach((n=>{const t=n.data??[];if(!c(t)){if(!o?.length){const n=new Array(p).fill(undefined);for(let o=0;o<t.length&&o<p;o++)n[o]=r(t[o]);w.push(n);$.push(null);g.push(null);return}const n=new Array(p).fill(undefined);const e=new Array(t.length).fill(-1);const c=new Array(p).fill(-1);for(let s=0;s<t.length;s++){const u=s<o.length?h.get(f(o[s])):undefined;if(u===undefined)continue;n[u]=r(t[s]);e[s]=u;c[u]=s}w.push(n);$.push(e);g.push(c);return}const s=new Array(p).fill(undefined);const u=new Array(t.length).fill(-1);const i=new Array(p).fill(-1);for(let n=0;n<t.length;n++){const o=e(t[n]);if(o===undefined)continue;const c=h.get(f(o));if(c===undefined)continue;s[c]=r(t[n]);u[n]=c;i[c]=n}w.push(s);$.push(u);g.push(i)}));return{xValues:d,data:w,toMerged:$,toOwn:g,hasPointX:true}}function u(n,t){if(!n||!t)return n;const o={};for(const[r,e]of Object.entries(n)){const n=t[Number(r)];if(n!=null&&n>=0)o[n]=e}return o}function i(n){if(n==null)return null;const t=Array.isArray(n)?n[0]:n.low;const o=Array.isArray(n)?n[1]:n.high;if(t==null||o==null||!Number.isFinite(t)||!Number.isFinite(o))return null;return[Math.min(t,o),Math.max(t,o)]}function f(n){const o=n.labels??{};const r=n.chartType==="pie"?o.pie??"Pie chart":n.chartType==="bar"?o.bar??"Bar chart":n.chartType==="area"?o.area??"Area chart":n.chartType==="sparkline"?o.sparkline??"Sparkline":o.line??"Line chart";const e=[];if(n.title)e.push(n.title);e.push(r);if(n.chartType==="pie"){if(n.seriesCount>0){const t=o.slices??(n.seriesCount===1?"with %count% slice":"with %count% slices");e.push(t.replace("%count%",String(n.seriesCount)))}}else if(n.seriesCount>1){e.push((o.series??"with %count% series").replace("%count%",String(n.seriesCount)))}if(n.xMin!=null&&n.xMax!=null&&n.chartType!=="pie"){e.push((o.range??"from %min% to %max%").replace("%min%",t(n.xMin,n.locale)).replace("%max%",t(n.xMax,n.locale)))}return e.join(", ")+"."}function l(n){const o=200;const r=n.labels??{};const e=n.xValueFormatter??(o=>t(o,n.locale));const c=n.valueFormatter??(t=>t==null?"—":t.toLocaleString(n.locale||undefined));const s=(n.xAxisData?.length??0)>0;const u=s?n.xAxisData.length:Math.max(0,...n.series.map((n=>n.range?n.range.length:n.data.length)));const f=Math.min(u,o);const l=[];for(let t=0;t<f;t++){const o=n.series.map((n=>{if(n.range){const o=i(n.range[t]);return`<td>${a(o?`${c(o[0])}–${c(o[1])}`:c(null))}</td>`}return`<td>${a(c(n.data[t]??null))}</td>`})).join("");const r=s?e(n.xAxisData[t]):String(t+1);l.push(`<tr><th scope="row">${a(r)}</th>${o}</tr>`)}const d=l.join("");const h=n.series.map((n=>`<th scope="col">${a(n.label??r.series??"Series")}</th>`)).join("");const p=n.title?`<caption>${a(n.title)}</caption>`:"";const w=u>o?`<tfoot><tr><td colspan="${1+n.series.length}">${a((r.truncated??"Showing first %shown% of %total% rows.").replace("%shown%",String(o)).replace("%total%",String(u)))}</td></tr></tfoot>`:"";return`<table>\n ${p}\n <thead><tr><th scope="col">${a(n.xAxisLabel??(s?r.x??"X":r.index??"#"))}</th>${h}</tr></thead>\n <tbody>${d}</tbody>\n ${w}\n </table>`}function a(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}export{f as a,l as b,s as c,r as d,i as n,u as r};
2
+ //# sourceMappingURL=p-C_ogF68H.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"p-CWM3KSti.js","sources":["src/utils/charts/xy.ts","src/utils/charts/a11y.ts"],"sourcesContent":["/*\n * Per-point x values — irregular / independent series data\n * ===========================================================\n * A series is normally a bare list of y values positioned by INDEX against\n * `xAxis.data`. Real time series rarely line up like that: two sensors sample\n * at different moments, three winters are measured on entirely different dates.\n * Those series carry their own x per point (`{ x, y }` or `[x, y]`).\n *\n * The engine draws every series against ONE shared x array, so this module\n * merges all the x values into a single sorted axis and re-aligns each series\n * onto it. A slot a series has no sample for becomes a HOLE (`undefined`),\n * which is deliberately distinct from an authored `null`:\n *\n * • hole (`undefined`) — \"this series wasn't measured here\". The line is\n * drawn straight through it to the series' next real sample.\n * • gap (`null`) — \"measured, no value\". Breaks the line (unless\n * `connectNulls`), exactly as it always has.\n *\n * Everything downstream stays index-aligned to the merged axis, so tooltips,\n * the zoom window, markers and the screen-reader table keep working unchanged.\n * ===========================================================\n */\n\nimport { toNumeric } from './engine/scale';\nimport type {\n MdChartAxisValue,\n MdChartDataPoint,\n MdChartDatum,\n MdChartRangeDatum,\n MdChartScaleType,\n MdChartXYPoint,\n MdChartXYTuple,\n} from './types';\n\n/** A value aligned to the merged axis: a number, a `null` gap, or a hole. */\nexport type MdChartAlignedValue = MdChartDataPoint | undefined;\n\nexport interface NormalizedSeriesX {\n /** The merged x axis every series' data is aligned to. */\n xValues: MdChartAxisValue[];\n /** Per series, values aligned to `xValues` (`undefined` = no sample here). */\n data: MdChartAlignedValue[][];\n /**\n * Per series, that series' own datum index → merged index. `null` when the\n * series was already index-aligned (own index *is* the merged index).\n */\n toMerged: (number[] | null)[];\n /** Per series, merged index → own datum index (`-1` where it has no sample). */\n toOwn: (number[] | null)[];\n /** True when at least one series carried its own x values. */\n hasPointX: boolean;\n}\n\n/** Does this datum carry its own x? */\nexport function isPointDatum(d: MdChartDatum | undefined): d is MdChartXYPoint | MdChartXYTuple {\n return d != null && typeof d === 'object' && !(d instanceof Date);\n}\n\n/** The y value of any datum shape. */\nexport function datumY(d: MdChartDatum | undefined): MdChartDataPoint {\n if (d == null) return null;\n if (typeof d === 'number') return d;\n if (!isPointDatum(d)) return null;\n // `in` rather than Array.isArray: the tuple form is readonly, which\n // Array.isArray does not narrow.\n return ('y' in d ? d.y : d[1]) ?? null;\n}\n\n/** The x value of a point datum, or `undefined` for a bare value. */\nexport function datumX(d: MdChartDatum | undefined): MdChartAxisValue | undefined {\n if (!isPointDatum(d)) return undefined;\n return 'x' in d ? d.x : d[0];\n}\n\n/** Does this series carry its own x values? Reads the first non-empty datum —\n * a series is all points or all bare values, never a mix. */\nfunction seriesHasPointX(data: readonly MdChartDatum[] | undefined): boolean {\n return isPointDatum(data?.find((d) => d != null));\n}\n\n/**\n * Merge every series onto one x axis.\n *\n * With no point-carrying series this is a pass-through: the original arrays are\n * handed straight back, so the common (and possibly very large) index-aligned\n * case allocates nothing.\n *\n * @param series the series to align (only `data` is read)\n * @param axisData the consumer's `xAxis.data`, if any\n * @param scale the x scale — decides the merge order (numeric/chronological\n * for value/time/log, first-seen for category)\n */\nexport function normalizeSeriesX(\n series: readonly { data?: readonly MdChartDatum[] }[],\n axisData: readonly MdChartAxisValue[] | undefined,\n scale: MdChartScaleType,\n): NormalizedSeriesX {\n const hasPointX = series.some((s) => seriesHasPointX(s.data));\n if (!hasPointX) {\n return {\n xValues: (axisData as MdChartAxisValue[] | undefined) ?? [],\n // Safe: no datum in any series is a point, so the array already IS\n // (number | null)[] — no copy, which keeps 100k-point feeds cheap.\n data: series.map((s) => (s.data ?? []) as MdChartAlignedValue[]),\n toMerged: series.map(() => null),\n toOwn: series.map(() => null),\n hasPointX: false,\n };\n }\n\n // ── build the merged axis ──\n // Category x values have no numeric order, so they merge in first-seen order\n // (axis data first, then whatever the series introduce). Everything else\n // sorts by its numeric / epoch value, which is what makes uneven gaps render\n // proportionally rather than evenly.\n const category = scale === 'category';\n const keyOf = (v: MdChartAxisValue) => (category ? `c${String(v)}` : `n${toNumeric(v, scale)}`);\n const slots = new Map<string, { sort: number; value: MdChartAxisValue }>();\n const add = (v: MdChartAxisValue) => {\n const k = keyOf(v);\n if (!slots.has(k)) slots.set(k, { sort: category ? slots.size : toNumeric(v, scale), value: v });\n };\n axisData?.forEach(add);\n for (const s of series) {\n if (!seriesHasPointX(s.data)) continue;\n for (const d of s.data ?? []) {\n const x = datumX(d);\n if (x !== undefined) add(x);\n }\n }\n const xValues = [...slots.values()].sort((a, b) => a.sort - b.sort).map((s) => s.value);\n const indexOf = new Map<string, number>(xValues.map((v, i) => [keyOf(v), i]));\n const n = xValues.length;\n\n // ── align each series onto it ──\n const data: MdChartAlignedValue[][] = [];\n const toMerged: (number[] | null)[] = [];\n const toOwn: (number[] | null)[] = [];\n\n series.forEach((s) => {\n const own = s.data ?? [];\n if (!seriesHasPointX(own)) {\n // Index-aligned series: it borrows x from `xAxis.data`, so it lands on\n // whatever merged slots those values took. Without an axis to borrow\n // from, its index is its position.\n if (!axisData?.length) {\n const row: MdChartAlignedValue[] = new Array(n).fill(undefined);\n for (let j = 0; j < own.length && j < n; j++) row[j] = datumY(own[j]);\n data.push(row);\n toMerged.push(null);\n toOwn.push(null);\n return;\n }\n const row: MdChartAlignedValue[] = new Array(n).fill(undefined);\n const fwd: number[] = new Array(own.length).fill(-1);\n const back: number[] = new Array(n).fill(-1);\n for (let j = 0; j < own.length; j++) {\n const at = j < axisData.length ? indexOf.get(keyOf(axisData[j])) : undefined;\n if (at === undefined) continue;\n row[at] = datumY(own[j]);\n fwd[j] = at;\n back[at] = j;\n }\n data.push(row);\n toMerged.push(fwd);\n toOwn.push(back);\n return;\n }\n\n const row: MdChartAlignedValue[] = new Array(n).fill(undefined);\n const fwd: number[] = new Array(own.length).fill(-1);\n const back: number[] = new Array(n).fill(-1);\n for (let j = 0; j < own.length; j++) {\n const x = datumX(own[j]);\n // A bare value inside a point series has no x to sit at — drop it rather\n // than inventing a position for it.\n if (x === undefined) continue;\n const at = indexOf.get(keyOf(x));\n if (at === undefined) continue;\n // Duplicate x within one series: the last one wins.\n row[at] = datumY(own[j]);\n fwd[j] = at;\n back[at] = j;\n }\n data.push(row);\n toMerged.push(fwd);\n toOwn.push(back);\n });\n\n return { xValues, data, toMerged, toOwn, hasPointX: true };\n}\n\n/** Remap an index-keyed record (e.g. `pointSymbols`) from a series' own indices\n * onto the merged axis. Entries with no merged slot are dropped. */\nexport function remapIndexRecord<T>(\n rec: Record<number, T> | undefined,\n toMerged: number[] | null,\n): Record<number, T> | undefined {\n if (!rec || !toMerged) return rec;\n const out: Record<number, T> = {};\n for (const [k, v] of Object.entries(rec)) {\n const at = toMerged[Number(k)];\n if (at != null && at >= 0) out[at] = v;\n }\n return out;\n}\n\n/**\n * Flatten a {@link MdChartRangeDatum} to a `[low, high]` pair, or `null` for a\n * gap. Both the tuple and the `{ low, high }` object forms are accepted, and\n * the edges are ordered — a caller who writes `[max, min]` still gets a band\n * rather than an inverted one that draws backwards.\n */\nexport function normalizeRange(d: MdChartRangeDatum | undefined): [number, number] | null {\n if (d == null) return null;\n const lo = Array.isArray(d) ? d[0] : (d as { low: number | null }).low;\n const hi = Array.isArray(d) ? d[1] : (d as { high: number | null }).high;\n if (lo == null || hi == null || !Number.isFinite(lo) || !Number.isFinite(hi)) return null;\n return [Math.min(lo, hi), Math.max(lo, hi)];\n}\n","/*\n * Chart accessibility helpers\n * ===========================================================\n * Charts are a tricky a11y surface because:\n * • SVG nodes carry no inherent semantics to screen readers;\n * a bare `<svg>` of a line chart announces as \"graphic\"\n * with no values.\n * • Sighted users get visual tooltips on hover; SR users\n * need text equivalents triggered by keyboard focus.\n * • Data tables are the WCAG-required fallback for visual\n * charts (SC 1.3.1, 1.1.1); even with rich SVG semantics,\n * a screen-reader-only table is the most-reliable backstop.\n *\n * Our pattern (matches BBC, GOV.UK, and Highcharts' a11y\n * module):\n * • Host element gets `role=\"img\"` + an aria-label summary.\n * • A visually-hidden `<table>` mirrors the chart data,\n * announced when the user tabs into it.\n * • An aria-live region narrates hover / focus events so\n * keyboard + SR users get the same tooltip text as\n * pointer users.\n * ===========================================================\n */\n\nimport type { MdChartAxisValue, MdChartRangeDatum, MdChartSeries } from './types';\nimport { defaultValueFormatter } from './options';\nimport { normalizeRange } from './xy';\n\n/**\n * Compose the chart's `aria-label` summary. Keep it under\n * ~120 chars — screen readers truncate long labels and the\n * full data lives in the SR-only table anyway.\n */\n/**\n * Translatable strings for the generated chart summary. Each is a plain string\n * a consumer hands over from their own dictionary — the components stay\n * i18n-engine-agnostic. `%count%` / `%min%` / `%max%` are substituted.\n */\nexport interface MdChartSummaryLabels {\n line?: string;\n area?: string;\n bar?: string;\n pie?: string;\n sparkline?: string;\n /** e.g. `'with %count% series'`. */\n series?: string;\n /** A pie's parts are slices, not series — e.g. `'with %count% slices'`. Used\n * in place of `series` for `chartType: 'pie'`. */\n slices?: string;\n /** e.g. `'from %min% to %max%'`. */\n range?: string;\n}\n\nexport function buildChartSummary(opts: {\n title?: string;\n chartType: 'line' | 'area' | 'bar' | 'pie' | 'sparkline';\n seriesCount: number;\n xMin?: MdChartAxisValue;\n xMax?: MdChartAxisValue;\n /** BCP-47 locale for the formatted range. */\n locale?: string;\n labels?: MdChartSummaryLabels;\n}): string {\n const l = opts.labels ?? {};\n const verb =\n opts.chartType === 'pie'\n ? l.pie ?? 'Pie chart'\n : opts.chartType === 'bar'\n ? l.bar ?? 'Bar chart'\n : opts.chartType === 'area'\n ? l.area ?? 'Area chart'\n : opts.chartType === 'sparkline'\n ? l.sparkline ?? 'Sparkline'\n : l.line ?? 'Line chart';\n const parts: string[] = [];\n if (opts.title) parts.push(opts.title);\n parts.push(verb);\n if (opts.chartType === 'pie') {\n // A pie has slices, and its count is worth saying even at one — \"Pie chart.\"\n // alone tells a screen-reader user nothing about how much is in it.\n if (opts.seriesCount > 0) {\n const tpl = l.slices ?? (opts.seriesCount === 1 ? 'with %count% slice' : 'with %count% slices');\n parts.push(tpl.replace('%count%', String(opts.seriesCount)));\n }\n } else if (opts.seriesCount > 1) {\n parts.push((l.series ?? 'with %count% series').replace('%count%', String(opts.seriesCount)));\n }\n if (opts.xMin != null && opts.xMax != null && opts.chartType !== 'pie') {\n parts.push(\n (l.range ?? 'from %min% to %max%')\n .replace('%min%', defaultValueFormatter(opts.xMin, opts.locale))\n .replace('%max%', defaultValueFormatter(opts.xMax, opts.locale)),\n );\n }\n return parts.join(', ') + '.';\n}\n\n/**\n * Build the screen-reader-only HTML data table for the chart.\n * Returns an HTML string so the host can inject it with\n * `innerHTML` on a hidden node; no per-cell DOM manipulation\n * needed.\n *\n * Caveats:\n * • Series with > 200 rows are truncated to 200 (an SR user\n * reading row-by-row past 200 is rare enough that we trade\n * completeness for performance). The full data is still\n * accessible programmatically via the component instance.\n * • Categorical / time / numeric x-axes all flatten to\n * strings via the user formatter (or the default).\n */\nexport function buildDataTableHtml(opts: {\n title?: string;\n xAxisLabel?: string;\n xAxisData?: readonly MdChartAxisValue[];\n xValueFormatter?: (v: MdChartAxisValue) => string;\n /** `undefined` in `data` is a slot this series has no sample for (see\n * `utils/charts/xy.ts`) and prints the same as a `null` gap. A series with\n * `range` is a band: its cells print `low–high`, since `data` holds no\n * reading for it. */\n series: readonly {\n label?: string;\n data: readonly (number | null | undefined)[];\n range?: readonly MdChartRangeDatum[];\n }[];\n valueFormatter?: (v: number | null) => string;\n /** BCP-47 locale for the default number / date formatting. */\n locale?: string;\n /** Translatable table chrome. `%shown%` / `%total%` are substituted. */\n labels?: {\n /** Header over the x column when the chart has an x axis. Default `X`. */\n x?: string;\n /** Header over the row-number column when it doesn't. Default `#`. */\n index?: string;\n /** Fallback header for a series with no label. Default `Series`. */\n series?: string;\n /** Default `Showing first %shown% of %total% rows.` */\n truncated?: string;\n };\n}): string {\n const MAX = 200;\n const lb = opts.labels ?? {};\n const fmtX = opts.xValueFormatter ?? ((v: MdChartAxisValue) => defaultValueFormatter(v, opts.locale));\n const fmtY =\n opts.valueFormatter ??\n ((v: number | null) => (v == null ? '—' : v.toLocaleString(opts.locale || undefined)));\n // Charts render fine without an explicit x-axis (points/bars plot by data\n // index), so the SR table must too: fall back to the series' own length and\n // number the rows, otherwise a visually-populated chart has an empty table.\n const hasX = (opts.xAxisData?.length ?? 0) > 0;\n const total = hasX\n ? opts.xAxisData!.length\n : Math.max(0, ...opts.series.map(s => (s.range ? s.range.length : s.data.length)));\n const n = Math.min(total, MAX);\n const rowsArr: string[] = [];\n for (let i = 0; i < n; i++) {\n const cells = opts.series\n .map(s => {\n if (s.range) {\n const b = normalizeRange(s.range[i]);\n // En dash, not a hyphen: a screen reader reads \"3 to 9\" for a range\n // and \"3 minus 9\" for a hyphen between two numbers.\n return `<td>${escapeHtml(b ? `${fmtY(b[0])}–${fmtY(b[1])}` : fmtY(null))}</td>`;\n }\n return `<td>${escapeHtml(fmtY(s.data[i] ?? null))}</td>`;\n })\n .join('');\n const rowHeader = hasX ? fmtX(opts.xAxisData![i]) : String(i + 1);\n rowsArr.push(`<tr><th scope=\"row\">${escapeHtml(rowHeader)}</th>${cells}</tr>`);\n }\n const rows = rowsArr.join('');\n const head = opts.series\n .map(s => `<th scope=\"col\">${escapeHtml(s.label ?? lb.series ?? 'Series')}</th>`)\n .join('');\n const caption = opts.title ? `<caption>${escapeHtml(opts.title)}</caption>` : '';\n const truncatedNote =\n total > MAX\n ? `<tfoot><tr><td colspan=\"${1 + opts.series.length}\">${escapeHtml(\n (lb.truncated ?? 'Showing first %shown% of %total% rows.')\n .replace('%shown%', String(MAX))\n .replace('%total%', String(total)),\n )}</td></tr></tfoot>`\n : '';\n return `<table>\n ${caption}\n <thead><tr><th scope=\"col\">${escapeHtml(\n opts.xAxisLabel ?? (hasX ? lb.x ?? 'X' : lb.index ?? '#'),\n )}</th>${head}</tr></thead>\n <tbody>${rows}</tbody>\n ${truncatedNote}\n </table>`;\n}\n\nfunction escapeHtml(s: string): string {\n return s\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n .replace(/'/g, '&#39;');\n}\n"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;;;AAqBG;AAgCH;AACM,SAAU,YAAY,CAAC,CAA2B,EAAA;AACtD,IAAA,OAAO,CAAC,IAAI,IAAI,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,EAAE,CAAC,YAAY,IAAI,CAAC;AACnE;AAEA;AACM,SAAU,MAAM,CAAC,CAA2B,EAAA;IAChD,IAAI,CAAC,IAAI,IAAI;AA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AAA,OAAO,CAAC,IAAI,EAAE,OAAO;AACrB,SAAA,OAAO,CAAC,IAAI,EAAE,MAAM;AACpB,SAAA,OAAO,CAAC,IAAI,EAAE,MAAM;AACpB,SAAA,OAAO,CAAC,IAAI,EAAE,QAAQ;AACtB,SAAA,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;AAC3B;;;;"}
1
+ {"version":3,"file":"p-C_ogF68H.js","sources":["src/utils/charts/xy.ts","src/utils/charts/a11y.ts"],"sourcesContent":["/*\n * Per-point x values — irregular / independent series data\n * ===========================================================\n * A series is normally a bare list of y values positioned by INDEX against\n * `xAxis.data`. Real time series rarely line up like that: two sensors sample\n * at different moments, three winters are measured on entirely different dates.\n * Those series carry their own x per point (`{ x, y }` or `[x, y]`).\n *\n * The engine draws every series against ONE shared x array, so this module\n * merges all the x values into a single sorted axis and re-aligns each series\n * onto it. A slot a series has no sample for becomes a HOLE (`undefined`),\n * which is deliberately distinct from an authored `null`:\n *\n * • hole (`undefined`) — \"this series wasn't measured here\". The line is\n * drawn straight through it to the series' next real sample.\n * • gap (`null`) — \"measured, no value\". Breaks the line (unless\n * `connectNulls`), exactly as it always has.\n *\n * Everything downstream stays index-aligned to the merged axis, so tooltips,\n * the zoom window, markers and the screen-reader table keep working unchanged.\n * ===========================================================\n */\n\nimport { toNumeric } from './engine/scale';\nimport type {\n MdChartAxisValue,\n MdChartDataPoint,\n MdChartDatum,\n MdChartRangeDatum,\n MdChartScaleType,\n MdChartXYPoint,\n MdChartXYTuple,\n} from './types';\n\n/** A value aligned to the merged axis: a number, a `null` gap, or a hole. */\nexport type MdChartAlignedValue = MdChartDataPoint | undefined;\n\nexport interface NormalizedSeriesX {\n /** The merged x axis every series' data is aligned to. */\n xValues: MdChartAxisValue[];\n /** Per series, values aligned to `xValues` (`undefined` = no sample here). */\n data: MdChartAlignedValue[][];\n /**\n * Per series, that series' own datum index → merged index. `null` when the\n * series was already index-aligned (own index *is* the merged index).\n */\n toMerged: (number[] | null)[];\n /** Per series, merged index → own datum index (`-1` where it has no sample). */\n toOwn: (number[] | null)[];\n /** True when at least one series carried its own x values. */\n hasPointX: boolean;\n}\n\n/** Does this datum carry its own x? */\nexport function isPointDatum(d: MdChartDatum | undefined): d is MdChartXYPoint | MdChartXYTuple {\n return d != null && typeof d === 'object' && !(d instanceof Date);\n}\n\n/** The y value of any datum shape. */\nexport function datumY(d: MdChartDatum | undefined): MdChartDataPoint {\n if (d == null) return null;\n if (typeof d === 'number') return d;\n if (!isPointDatum(d)) return null;\n // `in` rather than Array.isArray: the tuple form is readonly, which\n // Array.isArray does not narrow.\n return ('y' in d ? d.y : d[1]) ?? null;\n}\n\n/** The x value of a point datum, or `undefined` for a bare value. */\nexport function datumX(d: MdChartDatum | undefined): MdChartAxisValue | undefined {\n if (!isPointDatum(d)) return undefined;\n return 'x' in d ? d.x : d[0];\n}\n\n/** Does this series carry its own x values? Reads the first non-empty datum —\n * a series is all points or all bare values, never a mix. */\nfunction seriesHasPointX(data: readonly MdChartDatum[] | undefined): boolean {\n return isPointDatum(data?.find((d) => d != null));\n}\n\n/**\n * Merge every series onto one x axis.\n *\n * With no point-carrying series this is a pass-through: the original arrays are\n * handed straight back, so the common (and possibly very large) index-aligned\n * case allocates nothing.\n *\n * @param series the series to align (only `data` is read)\n * @param axisData the consumer's `xAxis.data`, if any\n * @param scale the x scale — decides the merge order (numeric/chronological\n * for value/time/log, first-seen for category)\n */\nexport function normalizeSeriesX(\n series: readonly { data?: readonly MdChartDatum[] }[],\n axisData: readonly MdChartAxisValue[] | undefined,\n scale: MdChartScaleType,\n): NormalizedSeriesX {\n const hasPointX = series.some((s) => seriesHasPointX(s.data));\n if (!hasPointX) {\n return {\n xValues: (axisData as MdChartAxisValue[] | undefined) ?? [],\n // Safe: no datum in any series is a point, so the array already IS\n // (number | null)[] — no copy, which keeps 100k-point feeds cheap.\n data: series.map((s) => (s.data ?? []) as MdChartAlignedValue[]),\n toMerged: series.map(() => null),\n toOwn: series.map(() => null),\n hasPointX: false,\n };\n }\n\n // ── build the merged axis ──\n // Category x values have no numeric order, so they merge in first-seen order\n // (axis data first, then whatever the series introduce). Everything else\n // sorts by its numeric / epoch value, which is what makes uneven gaps render\n // proportionally rather than evenly.\n const category = scale === 'category';\n const keyOf = (v: MdChartAxisValue) => (category ? `c${String(v)}` : `n${toNumeric(v, scale)}`);\n const slots = new Map<string, { sort: number; value: MdChartAxisValue }>();\n const add = (v: MdChartAxisValue) => {\n const k = keyOf(v);\n if (!slots.has(k)) slots.set(k, { sort: category ? slots.size : toNumeric(v, scale), value: v });\n };\n axisData?.forEach(add);\n for (const s of series) {\n if (!seriesHasPointX(s.data)) continue;\n for (const d of s.data ?? []) {\n const x = datumX(d);\n if (x !== undefined) add(x);\n }\n }\n const xValues = [...slots.values()].sort((a, b) => a.sort - b.sort).map((s) => s.value);\n const indexOf = new Map<string, number>(xValues.map((v, i) => [keyOf(v), i]));\n const n = xValues.length;\n\n // ── align each series onto it ──\n const data: MdChartAlignedValue[][] = [];\n const toMerged: (number[] | null)[] = [];\n const toOwn: (number[] | null)[] = [];\n\n series.forEach((s) => {\n const own = s.data ?? [];\n if (!seriesHasPointX(own)) {\n // Index-aligned series: it borrows x from `xAxis.data`, so it lands on\n // whatever merged slots those values took. Without an axis to borrow\n // from, its index is its position.\n if (!axisData?.length) {\n const row: MdChartAlignedValue[] = new Array(n).fill(undefined);\n for (let j = 0; j < own.length && j < n; j++) row[j] = datumY(own[j]);\n data.push(row);\n toMerged.push(null);\n toOwn.push(null);\n return;\n }\n const row: MdChartAlignedValue[] = new Array(n).fill(undefined);\n const fwd: number[] = new Array(own.length).fill(-1);\n const back: number[] = new Array(n).fill(-1);\n for (let j = 0; j < own.length; j++) {\n const at = j < axisData.length ? indexOf.get(keyOf(axisData[j])) : undefined;\n if (at === undefined) continue;\n row[at] = datumY(own[j]);\n fwd[j] = at;\n back[at] = j;\n }\n data.push(row);\n toMerged.push(fwd);\n toOwn.push(back);\n return;\n }\n\n const row: MdChartAlignedValue[] = new Array(n).fill(undefined);\n const fwd: number[] = new Array(own.length).fill(-1);\n const back: number[] = new Array(n).fill(-1);\n for (let j = 0; j < own.length; j++) {\n const x = datumX(own[j]);\n // A bare value inside a point series has no x to sit at — drop it rather\n // than inventing a position for it.\n if (x === undefined) continue;\n const at = indexOf.get(keyOf(x));\n if (at === undefined) continue;\n // Duplicate x within one series: the last one wins.\n row[at] = datumY(own[j]);\n fwd[j] = at;\n back[at] = j;\n }\n data.push(row);\n toMerged.push(fwd);\n toOwn.push(back);\n });\n\n return { xValues, data, toMerged, toOwn, hasPointX: true };\n}\n\n/** Remap an index-keyed record (e.g. `pointSymbols`) from a series' own indices\n * onto the merged axis. Entries with no merged slot are dropped. */\nexport function remapIndexRecord<T>(\n rec: Record<number, T> | undefined,\n toMerged: number[] | null,\n): Record<number, T> | undefined {\n if (!rec || !toMerged) return rec;\n const out: Record<number, T> = {};\n for (const [k, v] of Object.entries(rec)) {\n const at = toMerged[Number(k)];\n if (at != null && at >= 0) out[at] = v;\n }\n return out;\n}\n\n/**\n * Flatten a {@link MdChartRangeDatum} to a `[low, high]` pair, or `null` for a\n * gap. Both the tuple and the `{ low, high }` object forms are accepted, and\n * the edges are ordered — a caller who writes `[max, min]` still gets a band\n * rather than an inverted one that draws backwards.\n */\nexport function normalizeRange(d: MdChartRangeDatum | undefined): [number, number] | null {\n if (d == null) return null;\n const lo = Array.isArray(d) ? d[0] : (d as { low: number | null }).low;\n const hi = Array.isArray(d) ? d[1] : (d as { high: number | null }).high;\n if (lo == null || hi == null || !Number.isFinite(lo) || !Number.isFinite(hi)) return null;\n return [Math.min(lo, hi), Math.max(lo, hi)];\n}\n","/*\n * Chart accessibility helpers\n * ===========================================================\n * Charts are a tricky a11y surface because:\n * • SVG nodes carry no inherent semantics to screen readers;\n * a bare `<svg>` of a line chart announces as \"graphic\"\n * with no values.\n * • Sighted users get visual tooltips on hover; SR users\n * need text equivalents triggered by keyboard focus.\n * • Data tables are the WCAG-required fallback for visual\n * charts (SC 1.3.1, 1.1.1); even with rich SVG semantics,\n * a screen-reader-only table is the most-reliable backstop.\n *\n * Our pattern (matches BBC, GOV.UK, and Highcharts' a11y\n * module):\n * • Host element gets `role=\"img\"` + an aria-label summary.\n * • A visually-hidden `<table>` mirrors the chart data,\n * announced when the user tabs into it.\n * • An aria-live region narrates hover / focus events so\n * keyboard + SR users get the same tooltip text as\n * pointer users.\n * ===========================================================\n */\n\nimport type { MdChartAxisValue, MdChartRangeDatum, MdChartSeries } from './types';\nimport { defaultValueFormatter } from './options';\nimport { normalizeRange } from './xy';\n\n/**\n * Compose the chart's `aria-label` summary. Keep it under\n * ~120 chars — screen readers truncate long labels and the\n * full data lives in the SR-only table anyway.\n */\n/**\n * Translatable strings for the generated chart summary. Each is a plain string\n * a consumer hands over from their own dictionary — the components stay\n * i18n-engine-agnostic. `%count%` / `%min%` / `%max%` are substituted.\n */\nexport interface MdChartSummaryLabels {\n line?: string;\n area?: string;\n bar?: string;\n pie?: string;\n sparkline?: string;\n /** e.g. `'with %count% series'`. */\n series?: string;\n /** A pie's parts are slices, not series — e.g. `'with %count% slices'`. Used\n * in place of `series` for `chartType: 'pie'`. */\n slices?: string;\n /** e.g. `'from %min% to %max%'`. */\n range?: string;\n}\n\nexport function buildChartSummary(opts: {\n title?: string;\n chartType: 'line' | 'area' | 'bar' | 'pie' | 'sparkline';\n seriesCount: number;\n xMin?: MdChartAxisValue;\n xMax?: MdChartAxisValue;\n /** BCP-47 locale for the formatted range. */\n locale?: string;\n labels?: MdChartSummaryLabels;\n}): string {\n const l = opts.labels ?? {};\n const verb =\n opts.chartType === 'pie'\n ? l.pie ?? 'Pie chart'\n : opts.chartType === 'bar'\n ? l.bar ?? 'Bar chart'\n : opts.chartType === 'area'\n ? l.area ?? 'Area chart'\n : opts.chartType === 'sparkline'\n ? l.sparkline ?? 'Sparkline'\n : l.line ?? 'Line chart';\n const parts: string[] = [];\n if (opts.title) parts.push(opts.title);\n parts.push(verb);\n if (opts.chartType === 'pie') {\n // A pie has slices, and its count is worth saying even at one — \"Pie chart.\"\n // alone tells a screen-reader user nothing about how much is in it.\n if (opts.seriesCount > 0) {\n const tpl = l.slices ?? (opts.seriesCount === 1 ? 'with %count% slice' : 'with %count% slices');\n parts.push(tpl.replace('%count%', String(opts.seriesCount)));\n }\n } else if (opts.seriesCount > 1) {\n parts.push((l.series ?? 'with %count% series').replace('%count%', String(opts.seriesCount)));\n }\n if (opts.xMin != null && opts.xMax != null && opts.chartType !== 'pie') {\n parts.push(\n (l.range ?? 'from %min% to %max%')\n .replace('%min%', defaultValueFormatter(opts.xMin, opts.locale))\n .replace('%max%', defaultValueFormatter(opts.xMax, opts.locale)),\n );\n }\n return parts.join(', ') + '.';\n}\n\n/**\n * Build the screen-reader-only HTML data table for the chart.\n * Returns an HTML string so the host can inject it with\n * `innerHTML` on a hidden node; no per-cell DOM manipulation\n * needed.\n *\n * Caveats:\n * • Series with > 200 rows are truncated to 200 (an SR user\n * reading row-by-row past 200 is rare enough that we trade\n * completeness for performance). The full data is still\n * accessible programmatically via the component instance.\n * • Categorical / time / numeric x-axes all flatten to\n * strings via the user formatter (or the default).\n */\nexport function buildDataTableHtml(opts: {\n title?: string;\n xAxisLabel?: string;\n xAxisData?: readonly MdChartAxisValue[];\n xValueFormatter?: (v: MdChartAxisValue) => string;\n /** `undefined` in `data` is a slot this series has no sample for (see\n * `utils/charts/xy.ts`) and prints the same as a `null` gap. A series with\n * `range` is a band: its cells print `low–high`, since `data` holds no\n * reading for it. */\n series: readonly {\n label?: string;\n data: readonly (number | null | undefined)[];\n range?: readonly MdChartRangeDatum[];\n }[];\n valueFormatter?: (v: number | null) => string;\n /** BCP-47 locale for the default number / date formatting. */\n locale?: string;\n /** Translatable table chrome. `%shown%` / `%total%` are substituted. */\n labels?: {\n /** Header over the x column when the chart has an x axis. Default `X`. */\n x?: string;\n /** Header over the row-number column when it doesn't. Default `#`. */\n index?: string;\n /** Fallback header for a series with no label. Default `Series`. */\n series?: string;\n /** Default `Showing first %shown% of %total% rows.` */\n truncated?: string;\n };\n}): string {\n const MAX = 200;\n const lb = opts.labels ?? {};\n const fmtX = opts.xValueFormatter ?? ((v: MdChartAxisValue) => defaultValueFormatter(v, opts.locale));\n const fmtY =\n opts.valueFormatter ??\n ((v: number | null) => (v == null ? '—' : v.toLocaleString(opts.locale || undefined)));\n // Charts render fine without an explicit x-axis (points/bars plot by data\n // index), so the SR table must too: fall back to the series' own length and\n // number the rows, otherwise a visually-populated chart has an empty table.\n const hasX = (opts.xAxisData?.length ?? 0) > 0;\n const total = hasX\n ? opts.xAxisData!.length\n : Math.max(0, ...opts.series.map(s => (s.range ? s.range.length : s.data.length)));\n const n = Math.min(total, MAX);\n const rowsArr: string[] = [];\n for (let i = 0; i < n; i++) {\n const cells = opts.series\n .map(s => {\n if (s.range) {\n const b = normalizeRange(s.range[i]);\n // En dash, not a hyphen: a screen reader reads \"3 to 9\" for a range\n // and \"3 minus 9\" for a hyphen between two numbers.\n return `<td>${escapeHtml(b ? `${fmtY(b[0])}–${fmtY(b[1])}` : fmtY(null))}</td>`;\n }\n return `<td>${escapeHtml(fmtY(s.data[i] ?? null))}</td>`;\n })\n .join('');\n const rowHeader = hasX ? fmtX(opts.xAxisData![i]) : String(i + 1);\n rowsArr.push(`<tr><th scope=\"row\">${escapeHtml(rowHeader)}</th>${cells}</tr>`);\n }\n const rows = rowsArr.join('');\n const head = opts.series\n .map(s => `<th scope=\"col\">${escapeHtml(s.label ?? lb.series ?? 'Series')}</th>`)\n .join('');\n const caption = opts.title ? `<caption>${escapeHtml(opts.title)}</caption>` : '';\n const truncatedNote =\n total > MAX\n ? `<tfoot><tr><td colspan=\"${1 + opts.series.length}\">${escapeHtml(\n (lb.truncated ?? 'Showing first %shown% of %total% rows.')\n .replace('%shown%', String(MAX))\n .replace('%total%', String(total)),\n )}</td></tr></tfoot>`\n : '';\n return `<table>\n ${caption}\n <thead><tr><th scope=\"col\">${escapeHtml(\n opts.xAxisLabel ?? (hasX ? lb.x ?? 'X' : lb.index ?? '#'),\n )}</th>${head}</tr></thead>\n <tbody>${rows}</tbody>\n ${truncatedNote}\n </table>`;\n}\n\nfunction escapeHtml(s: string): string {\n return s\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n .replace(/'/g, '&#39;');\n}\n"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;;;AAqBG;AAgCH;AACM,SAAU,YAAY,CAAC,CAA2B,EAAA;AACtD,IAAA,OAAO,CAAC,IAAI,IAAI,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,EAAE,CAAC,YAAY,IAAI,CAAC;AACnE;AAEA;AACM,SAAU,MAAM,CAAC,CAA2B,EAAA;IAChD,IAAI,CAAC,IAAI,IAAI;AAAE,QAAA,OAAO,IAAI;IAC1B,IAAI,OAAO,CAAC,KAAK,QAAQ;AAAE,QAAA,OAAO,CAAC;AACnC,IAAA,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;AAAE,QAAA,OAAO,IAAI;;;IAGjC,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI;AACxC;AAEA;AACM,SAAU,MAAM,CAAC,CAA2B,EAAA;AAChD,IAAA,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;AAAE,QAAA,OAAO,SAAS;AACtC,IAAA,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC9B;AAEA;AAC8D;AAC9D,SAAS,eAAe,CAAC,IAAyC,EAAA;AAChE,IAAA,OAAO,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC;AACnD;AAEA;;;;;;;;;;;AAWG;SACa,gBAAgB,CAC9B,MAAqD,EACrD,QAAiD,EACjD,KAAuB,EA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,EAAA,EAAK,UAAU,CAC9D,CAAC,EAAE,CAAC,SAAS,IAAI,wCAAwC;AACtD,aAAA,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC;aAC9B,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CACrC,CAAA,kBAAA;UACD,EAAE;IACR,OAAO,CAAA;MACH,OAAO;iCACoB,UAAU,CACrC,IAAI,CAAC,UAAU,KAAK,IAAI,GAAG,EAAE,CAAC,CAAC,IAAI,GAAG,GAAG,EAAE,CAAC,KAAK,IAAI,GAAG,CAAC,CAC1D,CAAA,KAAA,EAAQ,IAAI,CAAA;aACJ,IAAI,CAAA;MACX,aAAa;WACR;AACX;AAEA,SAAS,UAAU,CAAC,CAAS,EAAA;AAC3B,IAAA,OAAO;AACJ,SAAA,OAAO,CAAC,IAAI,EAAE,OAAO;AACrB,SAAA,OAAO,CAAC,IAAI,EAAE,MAAM;AACpB,SAAA,OAAO,CAAC,IAAI,EAAE,MAAM;AACpB,SAAA,OAAO,CAAC,IAAI,EAAE,QAAQ;AACtB,SAAA,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;AAC3B;;;;"}
@@ -1,2 +1,2 @@
1
- function t(t){return!!t&&typeof t==="object"&&typeof t.nodeType==="number"&&typeof t.nodeName==="string"}function n(t){if(t.startsWith("#")){let n=t.slice(1);if(n.length===3)n=n.split("").map((t=>t+t)).join("");if(n.length===4)n=n.split("").map((t=>t+t)).join("");if(n.length<6)return null;const o=parseInt(n.slice(0,2),16)/255;const e=parseInt(n.slice(2,4),16)/255;const s=parseInt(n.slice(4,6),16)/255;const c=n.length>=8?parseInt(n.slice(6,8),16)/255:1;if(Number.isNaN(o)||Number.isNaN(e)||Number.isNaN(s))return null;return[o,e,s,c]}const n=t.match(/rgba?\(([^)]+)\)/);if(n){const t=n[1].split(/[,/]/).map((t=>t.trim()));const o=t=>t.endsWith("%")?parseFloat(t)/100*255:parseFloat(t);const e=o(t[0])/255;const s=o(t[1])/255;const c=o(t[2])/255;const r=t[3]!=null?t[3].endsWith("%")?parseFloat(t[3])/100:parseFloat(t[3]):1;return[e,s,c,Number.isNaN(r)?1:r]}return null}let o;function e(t){if(o===undefined){try{o=typeof document!=="undefined"?document.createElement("canvas").getContext("2d"):null}catch{o=null}}if(!o)return null;try{o.fillStyle="#000000";o.fillStyle=t;const n=o.fillStyle;if(typeof n!=="string")return null;if(n==="#000000"&&t.trim().toLowerCase()!=="black"&&t.trim()!=="#000000"&&t.trim()!=="#000"){return null}return n}catch{return null}}function s(t,n){const[o,e,s,r]=c(t);const i=Math.round(r*n*1e3)/1e3;return`rgba(${Math.round(o*255)}, ${Math.round(e*255)}, ${Math.round(s*255)}, ${i})`}function c(t){const o=t.trim();const s=n(o);if(s)return s;const c=e(o);if(c){const t=n(c);if(t)return t}return[.5,.5,.5,1]}function r(t){const[n,o,e]=c(t);return.299*n+.587*o+.114*e>.62?"#000000":"#ffffff"}function i(t,n,o){const e=c(t);const s=c(n);const r=Math.max(0,Math.min(1,o));const i=t=>Math.round((e[t]+(s[t]-e[t])*r)*255);return`rgba(${i(0)}, ${i(1)}, ${i(2)}, ${e[3]})`}const a=["primary","tertiary","secondary","error","primary-container","tertiary-container","secondary-container","error-container"];const f={primary:"--md-sys-color-primary",secondary:"--md-sys-color-secondary",tertiary:"--md-sys-color-tertiary",error:"--md-sys-color-error","primary-container":"--md-sys-color-primary-container","secondary-container":"--md-sys-color-secondary-container","tertiary-container":"--md-sys-color-tertiary-container","error-container":"--md-sys-color-error-container","surface-variant":"--md-sys-color-surface-variant",success:"--md-sys-color-success",warning:"--md-sys-color-warning",info:"--md-sys-color-info","success-container":"--md-sys-color-success-container","warning-container":"--md-sys-color-warning-container","info-container":"--md-sys-color-info-container"};const l={primary:"#6750A4",secondary:"#625B71",tertiary:"#7D5260",error:"#B3261E","primary-container":"#EADDFF","secondary-container":"#E8DEF8","tertiary-container":"#FFD8E4","error-container":"#F9DEDC","surface-variant":"#E7E0EC",success:"#2E6B4F",warning:"#7A5900",info:"#38608F","success-container":"#B8F0CE","warning-container":"#FFDF9B","info-container":"#D3E4FF"};function u(t,n,o){const e=o??getComputedStyle(t);const s=e.getPropertyValue(f[n]).trim();return s||l[n]}function d(t,n,o){const e=t.filter(Boolean);if(n<=0||e.length===0)return[];if(e.length===1)return Array.from({length:n},(()=>e[0]));const s=[];for(let t=0;t<n;t++){if(n===1){s.push(e[0]);continue}const o=t/(n-1)*(e.length-1);const c=Math.floor(o);const r=Math.min(e.length-1,c+1);const a=o-c;s.push(a===0?e[c]:a===1?e[r]:i(e[c],e[r],a))}if(!o||n<=e.length)return s;return s.map(((t,n)=>n%2===0?t:i(t,n%4===1?o.dark:o.light,.22)))}function h(t,n,o,e){if(!n)return o;if(n in f){return u(t,n,e)}if(!x(n)){console.warn(`[md-chart] "${n}" is not a colour role or a valid CSS colour — falling back. `+`Roles: ${Object.keys(f).join(", ")}.`);return o}return n}function x(t){if(typeof CSS==="undefined"||typeof CSS.supports!=="function")return true;return CSS.supports("color",t)}function p(t,n){if(!/var\(|color-mix\(/i.test(n))return n;const o=t.ownerDocument;const e=t.shadowRoot??t;if(!o||typeof getComputedStyle!=="function")return n;const s=o.createElement("span");s.style.cssText="position:absolute;inline-size:0;block-size:0;visibility:hidden";s.style.color=n;e.appendChild(s);const c=getComputedStyle(s).color;s.remove();return c||n}function y(t,n){if(!n?.length)return undefined;return n.map((n=>({from:n.from,to:n.to,color:n.color!=null?p(t,h(t,n.color,n.color)):undefined,label:n.label,labelAlign:n.labelAlign,labelColor:n.labelColor!=null?p(t,h(t,n.labelColor,n.labelColor)):undefined})))}function g(t){const n=t.match(/\d*\.?\d+(?:px|rem|em|pt|%)(?:\s*\/\s*\S+)?\s+(.+)$/);return(n?n[1]:t).trim()}function b(t,n,o){const e=t.getPropertyValue(n).trim();return e||o}function m(t,n,o){const e=t.getPropertyValue(n).trim();if(!e)return o;const s=parseFloat(e);return Number.isFinite(s)?s:o}function M(t){if(!t)return"cubicOut";const n=t.match(/cubic-bezier\(([^)]+)\)/);if(!n)return"cubicOut";const[o,e,s,c]=n[1].split(",").map((t=>parseFloat(t.trim())));if(o<.25&&c>.95)return"cubicOut";if(o>=.3&&e<.1)return"cubicIn";if(Math.abs(o-(1-c))<.15&&Math.abs(e-(1-s))<.15)return"cubicInOut";return"cubicOut"}function w(t){const n=getComputedStyle(t);const o=a.map((o=>u(t,o,n)));const e=m(n,"--md-sys-motion-duration-medium2",300);const c=b(n,"--md-sys-motion-easing-emphasized","cubic-bezier(0.2, 0, 0, 1)");const r=typeof window!=="undefined"&&typeof window.matchMedia==="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;const i=typeof window!=="undefined"&&typeof window.matchMedia==="function"&&window.matchMedia("(forced-colors: active)").matches;return{background:"transparent",textColor:b(n,"--md-sys-color-on-surface","#1C1B1F"),textColorMuted:b(n,"--md-sys-color-on-surface-variant","#49454F"),gridColor:(()=>{const t=b(n,"--md-chart-grid-color","");return t||s(b(n,"--md-sys-color-outline-variant","#CAC4D0"),.5)})(),axisLineColor:b(n,"--md-chart-axis-color",b(n,"--md-sys-color-outline-variant","#CAC4D0")),surface:b(n,"--md-sys-color-surface","#FFFBFE"),tooltipSurface:b(n,"--md-sys-color-inverse-surface",b(n,"--md-sys-color-on-surface","#322F35")),tooltipTextColor:b(n,"--md-sys-color-inverse-on-surface",b(n,"--md-sys-color-surface","#F5EFF7")),tooltipBorderColor:"transparent",tooltipShadow:b(n,"--md-sys-elevation-2","0px 1px 2px rgba(0,0,0,0.3), 0px 2px 6px 2px rgba(0,0,0,0.15)"),tooltipRadius:m(n,"--md-sys-shape-corner-small",8),palette:o,fontFamily:g(b(n,"--md-sys-typescale-label-medium-font",'"Roboto", system-ui, sans-serif')),labelSize:Math.max(9,m(n,"--md-sys-typescale-label-small-size",11)+m(n,"--md-sys-density-scale",0)*.5),titleSize:Math.max(11,m(n,"--md-sys-typescale-title-small-size",14)+m(n,"--md-sys-density-scale",0)*.5),motionDuration:r?0:e,motionEasing:M(c),reducedMotion:r,forcedColors:i}}function $(t,n){return t[n%t.length]}function v(t,n){if(t==null)return"";const o=n||undefined;if(t instanceof Date)return t.toLocaleString(o);if(typeof t==="number")return t.toLocaleString(o);return String(t)}function k(t,n){if(n==="category")return typeof t==="number"?t:0;if(t instanceof Date)return t.getTime();if(typeof t==="number")return t;const o=Number(t);if(!Number.isNaN(o)&&n!=="time")return o;const e=Date.parse(t);return Number.isNaN(e)?0:e}function z(t,n,o="value"){let[e,s]=t;if(e===s){e-=1;s+=1}const c=s-e;return{type:o,size:n,domain:[e,s],bandwidth:0,scale:t=>(t-e)/c*n,invert:t=>e+t/n*c}}function S(t,n){const o=t[1]>0?t[1]:1;const e=t[0]>0?t[0]:Math.max(o/1e6,Number.MIN_VALUE);const s=Math.log10(e);const c=Math.log10(Math.max(o,e*10));const r=c-s||1;return{type:"log",size:n,domain:[e,Math.pow(10,c)],bandwidth:0,scale:t=>(Math.log10(t<=0?e:t)-s)/r*n,invert:t=>Math.pow(10,s+t/n*r)}}function I(t,n,o=true){const e=Math.max(t,1);const s=n/e;const c=o?s/2:0;return{type:"category",size:n,domain:[0,e-1],bandwidth:s,scale:t=>c+t*s,invert:t=>Math.round((t-c)/s)}}const F=14;function A(t,n){const[o,e]=n[0]<=n[1]?n:[n[1],n[0]];const s=t.map((t=>({from:Math.max(o,Math.min(t.from,t.to)),to:Math.min(e,Math.max(t.from,t.to)),gap:t.gap??F}))).filter((t=>t.to>t.from&&t.from>o&&t.to<=e)).sort(((t,n)=>t.from-n.from));const c=[];for(const t of s){const n=c[c.length-1];if(n&&t.from<=n.to){n.to=Math.max(n.to,t.to);n.gap=Math.max(n.gap,t.gap)}else{c.push({...t})}}return c}function C(t,n,o){const e=t.map((t=>({...t})));if(!e.length||o==="log")return e;const s=e[e.length-1];if(n[1]-s.to>1e-9)return e;const c=e.length>1?e[e.length-2].to:n[0];const r=s.from-c;if(!(r>0))return e;const i=L(0,n[1],6);const a=i.length>1?i[1]-i[0]:0;const f=Math.max(r,a);const l=n[1]-f;if(l>s.from+1e-9)s.to=l;return e}function N(t,n={}){const o=n.minGap??8;const e=n.maxBreaks??2;const s=[...new Set(t.filter((t=>Number.isFinite(t))))].sort(((t,n)=>t-n));if(s.length<4)return[];const c=[];for(let t=1;t<s.length;t++){c.push({from:s[t-1],to:s[t],size:s[t]-s[t-1]})}const r=c.map((t=>t.size)).sort(((t,n)=>t-n));const i=r[Math.floor(r.length/2)]||0;if(i<=0)return[];const a=c.filter((t=>t.size>=i*o)).sort(((t,n)=>n.size-t.size)).slice(0,e);return a.map((t=>({from:t.from,to:t.to,gap:n.gap??F}))).sort(((t,n)=>t.from-n.from))}function E(t,n,o,e,s="equal"){const c=o==="log"?S(t,n):z(t,n,o);const r=A(e,c.domain);if(!r.length)return{...c,breaks:[]};const i=r.map((t=>({...t,fromPx:c.scale(t.from),toPx:c.scale(t.to)})));const a=i.reduce(((t,n)=>t+n.gap),0);const f=[];let l=0;for(const t of i){f.push({from:l,to:t.fromPx});l=t.toPx}f.push({from:l,to:n});const u=Math.max(0,n-a);const d=f.reduce(((t,n)=>t+Math.max(0,n.to-n.from)),0);const h=f.map((t=>{const n=Math.max(0,t.to-t.from);const o=s==="equal"?u/f.length:d>0?n/d*u:u/f.length;return{...t,width:n,out:o}}));let x=0;const p=h.map(((t,n)=>{const o=x;x+=t.out+(i[n]?.gap??0);return{...t,outStart:o}}));const y=i.map(((t,n)=>({from:t.from,to:t.to,gap:t.gap,px:p[n].outStart+p[n].out})));return{type:o,size:n,domain:c.domain,bandwidth:0,breaks:y,scale:t=>{const o=c.scale(t);for(let t=0;t<p.length;t++){const n=p[t];if(o<=n.to||t===p.length-1){if(o<n.from)return t>0?p[t-1].outStart+p[t-1].out:n.outStart;const e=n.width>0?(o-n.from)/n.width:1;return n.outStart+e*n.out}}return n},invert:t=>{for(let n=0;n<p.length;n++){const o=p[n];const e=o.outStart+o.out;if(t<=e||n===p.length-1){const n=o.out>0?(Math.max(t,o.outStart)-o.outStart)/o.out:0;return c.invert(o.from+n*o.width)}}return c.domain[1]}}}function P(t,n,o){if(!t)return{ranges:[],sizing:"equal"};const e=t==="auto"?{auto:true}:Array.isArray(t)?{ranges:t}:t;const s=e.gap??F;const c=(e.ranges??[]).map((t=>({from:k(t.from,o),to:k(t.to,o),gap:t.gap??s})));const r=e.auto?N(n,{minGap:e.minGap,maxBreaks:e.maxBreaks,gap:s}):[];return{ranges:[...c,...r],sizing:e.sizing??"equal"}}const B=3;function D(t,n,o,e=6){const s=(t,n,e)=>o==="log"?q(t,n):o==="time"?j(t,n,e):L(t,n,e);const c=A(n,t);if(!c.length)return s(t[0],t[1],e);const r=[];let i=t[0];for(const t of c){r.push([i,t.from]);i=t.to}r.push([i,t[1]]);const a=Math.max(3,Math.round(e/r.length));const f=(t,n)=>{let e=[];for(const c of[a,a*2,a*4]){e=s(t,n,c).filter((o=>o>=t-1e-9&&o<=n+1e-9));if(e.length>=B||o==="log")break}return e};const l=[];for(const[t,n]of r){if(n<=t)continue;l.push(...f(t,n))}return[...new Set(l)].sort(((t,n)=>t-n))}function _(t,n){return t.some((t=>n>t.from&&n<t.to))}function L(t,n,o=6){const e=Math.min(t,n);const s=Math.max(t,n);if(e===s)return[e];const c=O((s-e)/Math.max(o-1,1));const r=Math.floor(e/c)*c;const i=Math.ceil(s/c)*c;const a=[];const f=Math.round((i-r)/c)+1;for(let t=0;t<f;t++){const n=r+t*c;a.push(Math.abs(n)<c/1e6?0:n)}return a.filter((t=>t>=e-c/1e6&&t<=s+c/1e6))}function O(t,n){const o=Math.floor(Math.log10(t));const e=t/Math.pow(10,o);let s;{s=e<1.5?1:e<3?2:e<7?5:10}return s*Math.pow(10,o)}function q(t,n){const o=Math.floor(Math.log10(t>0?t:n/1e6));const e=Math.ceil(Math.log10(n));const s=[];for(let t=o;t<=e;t++)s.push(Math.pow(10,t));return s.filter((o=>o>=t&&o<=n))}function j(t,n,o=6){const e=n-t;if(e<=0)return[t];const s=1e3,c=60*s,r=60*c,i=24*r;const a=[s,5*s,15*s,30*s,c,5*c,15*c,30*c,r,3*r,6*r,12*r,i,2*i,7*i,14*i,30*i,90*i,180*i,365*i];const f=e/Math.max(o-1,1);const l=a.findIndex((t=>t>=f));let u=l===-1?a[a.length-1]:a[l];const d=l>0?a[l-1]:undefined;if(d&&e/d<=Math.max(o-1,1)*1.4)u=d;const h=Math.ceil(t/u)*u;const x=[];for(let t=h;t<=n;t+=u)x.push(t);return x}function R(t,n={scale:"value"}){const o=n.scale==="log";let e=Infinity;let s=-Infinity;let c=false;for(let n=0;n<t.length;n++){const r=t[n];if(!Number.isFinite(r))continue;if(o&&r<=0)continue;c=true;if(r<e)e=r;if(r>s)s=r}if(!c){e=o?1:0;s=o?10:1}const r=n.min!=null&&Number.isFinite(n.min);const i=n.max!=null&&Number.isFinite(n.max);let a=r?n.min:e;let f=i?n.max:s;if(o){if(!r&&a>0)a=Math.pow(10,Math.floor(Math.log10(a)));if(!i&&f>0)f=Math.pow(10,Math.ceil(Math.log10(f)));if(a===f){a/=10;f*=10}return[a,f]}if(n.includeZero){if(!r&&a>0)a=0;if(!i&&f<0)f=0}if(a===f){a-=1;f+=1}return[a,f]}const V={square:[45,135,225,315],diamond:[0,90,180,270],triangle:[-90,150,30],"triangle-down":[90,-30,210]};function Y(t,n,o,e){const s=t?V[t]:undefined;if(!s)return null;return s.map((t=>{const s=t*Math.PI/180;return{x:n+e*Math.cos(s),y:o+e*Math.sin(s)}}))}const W=20;const T=4;function X(t,n){const o=Math.max(1,Math.floor(n));if(t.length<=o*T)return t;const e=[];let s=Math.round(t[0].x);let c=0;let r=0;let i=0;let a=0;const f=()=>{const n=[c,i<a?i:a,i<a?a:i,r];let o=-1;for(const s of n){if(s!==o)e.push(t[s]);o=s}};for(let n=1;n<t.length;n++){const o=Math.round(t[n].x);if(o!==s){f();s=o;c=i=a=n}else{if(t[n].y<t[i].y)i=n;if(t[n].y>t[a].y)a=n}r=n}f();return e}function Z(t,n,o,e,s){const c=n+e;const r=o+s;let i=false;for(const e of t){if(e.x<n||e.x>c||e.y<o||e.y>r){i=true;break}}if(!i)return t;return t.map((t=>({x:t.x<n?n:t.x>c?c:t.x,y:t.y<o?o:t.y>r?r:t.y})))}function G(t,n){if(t.length<2)return t.slice();switch(n){case"linear":return t.slice();case"step":case"step-before":case"step-middle":return H(t,n);case"monotone":return K(t);case"smooth":default:return J(t)}}function H(t,n){const o=[t[0]];for(let e=1;e<t.length;e++){const s=t[e-1];const c=t[e];if(n==="step"){o.push({x:c.x,y:s.y},c)}else if(n==="step-before"){o.push({x:s.x,y:c.y},c)}else{const t=(s.x+c.x)/2;o.push({x:t,y:s.y},{x:t,y:c.y},c)}}return o}function J(t){const n=[t[0]];for(let o=0;o<t.length-1;o++){const e=t[o-1]??t[o];const s=t[o];const c=t[o+1];const r=t[o+2]??c;for(let t=1;t<=W;t++){const o=t/W;const i=o*o;const a=i*o;const f=.5*(2*s.x+(-e.x+c.x)*o+(2*e.x-5*s.x+4*c.x-r.x)*i+(-e.x+3*s.x-3*c.x+r.x)*a);const l=.5*(2*s.y+(-e.y+c.y)*o+(2*e.y-5*s.y+4*c.y-r.y)*i+(-e.y+3*s.y-3*c.y+r.y)*a);n.push({x:f,y:l})}}return n}function K(t){const n=t.length;const o=[];const e=[];for(let s=0;s<n-1;s++){const n=t[s+1].x-t[s].x||1e-6;o.push(n);e.push((t[s+1].y-t[s].y)/n)}const s=[e[0]];for(let t=1;t<n-1;t++){if(e[t-1]*e[t]<=0){s.push(0)}else{const n=2*o[t]+o[t-1];const c=o[t]+2*o[t-1];s.push((n+c)/(n/e[t-1]+c/e[t]))}}s.push(e[n-2]);const c=[t[0]];for(let e=0;e<n-1;e++){const n=t[e];const r=t[e+1];const i=o[e];for(let t=1;t<=W;t++){const o=t/W;const a=o*o;const f=a*o;const l=2*f-3*a+1;const u=f-2*a+o;const d=-2*f+3*a;const h=f-a;c.push({x:n.x+o*i,y:l*n.y+u*i*s[e]+d*r.y+h*i*s[e+1]})}}return c}function Q(t,n){const o=[];let e=[];for(let s=0;s<t.length;s++){const c=t[s];if(c===undefined)continue;if(c==null||!Number.isFinite(c)){if(n)continue;if(e.length){o.push(e);e=[]}continue}e.push({index:s,value:c})}if(e.length)o.push(e);return o}function U(t,n,o){const e=Math.max(0,...t.map((t=>t.length)));const s=t.map((()=>[]));const c=n==="silhouette"||n==="wiggle";for(let r=0;r<e;r++){const e=new Map;const i=new Map;const a=new Map;const f=(t,n,o)=>t.set(n,(t.get(n)??0)+o);for(let n=0;n<t.length;n++){const s=t[n][r];const c=o[n]??"stacked";if(c==="__unstacked__"||s==null||!Number.isFinite(s))continue;f(e,c,s);if(s>=0)f(i,c,s);else f(a,c,-s)}const l=new Map;const u=new Map;for(let f=0;f<t.length;f++){const d=t[f][r];if(d===undefined){s[f][r]=undefined;continue}if(d==null||!Number.isFinite(d)){s[f][r]=null;continue}const h=o[f]??"stacked";const x=n!=="none"&&h!=="__unstacked__";if(!x){s[f][r]=[0,d];continue}const p=c?-(e.get(h)??0)/2:0;if(!l.has(h))l.set(h,p);if(!u.has(h))u.set(h,p);const y=i.get(h)??0;const g=a.get(h)??0;let b=d;if(n==="percentage"){b=d>=0?y>0?d/y*100:0:g>0?d/g*100:0}if(b>=0){const t=l.get(h);s[f][r]=[t,t+b];l.set(h,t+b)}else{const t=u.get(h);s[f][r]=[t+b,t];u.set(h,t+b)}}}return s}function tt(t){const n=!t.range&&t.stroke!==false;const o=t.showMarks||!!t.markIndices?.length||!!t.pointSymbols;return n||o}const nt=5;function ot(t,n){return t.length*n*.58}function et(t,n,o){let e=1;let s=0;for(const c of t){const t=ot(c,n)+28;if(s>0&&s+t>o){e++;s=t}else{s+=t}}return e}function st(t,n=1){if(t==="dashed")return[n*3.5,n*3];if(t==="dotted")return[Math.max(1,n*.4),n*2.6];return undefined}const ct=30;const rt=3;const it=4;function at(t,n,o,e,s,c){const r=[];const i=s-e;if(i<=0)return r;const a=(n+o)/2;const f=Math.min(it,(o-n)/2);const l=Math.max(4,Math.round(i/rt));const u=t=>{const n=e+i*t/l;return{p:n,off:a+f*Math.sin(n/ct*Math.PI*2)}};let d=u(0);for(let n=1;n<=l;n++){const o=u(n);r.push(t==="y"?{x1:d.p,y1:d.off,x2:o.p,y2:o.off,color:c,width:1.5}:{x1:d.off,y1:d.p,x2:o.off,y2:o.p,color:c,width:1.5});d=o}return r}function ft(t,n,o,e,s,c,r){const i=[];let a=n;const f=(n,o)=>t==="y"?{x1:e,y1:n,x2:e,y2:o,color:c,width:1,dash:r}:{x1:n,y1:e,x2:o,y2:e,color:c,width:1,dash:r};for(const t of s){const o=n+t.px;if(o>a)i.push(f(a,o));a=o+t.gap}if(o>a)i.push(f(a,o));return i}const lt=8;function ut(t,n,o,e,s,c){const r=[];const i=[];if(!t?.length)return{rects:r,labels:i};const a=n==="y";const f=a?e.y:e.x;const l=a?e.y+e.height:e.x+e.width;t.forEach(((t,n)=>{const u=o(t.from);const d=o(t.to);if(!Number.isFinite(u)||!Number.isFinite(d))return;const h=Math.max(f,Math.min(u,d));const x=Math.min(l,Math.max(u,d));if(x<=h)return;const p=t.color??dt(s.axisLineColor,.07);r.push(a?{x:e.x,y:h,w:e.width,h:x-h,color:p}:{x:h,y:e.y,w:x-h,h:e.height,color:p});if(!t.label)return;const y=t.labelAlign??"start";const g=y==="center"?a?e.x+e.width/2:e.y+e.height/2:y==="end"?a?e.x+e.width-lt:e.y+e.height-lt:a?e.x+lt:e.y+lt;i.push({x:a?g:h+lt,y:a?h+lt:g,text:t.label,color:t.labelColor??s.textColorMuted,fontSize:s.labelSize,align:a?y==="center"?"center":y:"start",baseline:a?"top":y==="center"?"middle":y==="end"?"bottom":"top",key:`${c}-${n}`})}));return{rects:r,labels:i}}function dt(t,n){if(t.startsWith("#")){let o=t.slice(1);if(o.length===3)o=o.split("").map((t=>t+t)).join("");const e=parseInt(o.slice(0,2),16);const s=parseInt(o.slice(2,4),16);const c=parseInt(o.slice(4,6),16);return`rgba(${e}, ${s}, ${c}, ${n})`}if(t.startsWith("rgb("))return t.replace(/^rgb\(/,"rgba(").replace(/\)$/,`, ${n})`);return t}function ht(t,n,o,e){if(t.inverted)return pt(t,n,o,e);if(t.yAxes&&t.yAxes.length>0)return xt(t,n,o,e);t.series.filter((t=>!t.hidden));const s=t.xValues.length||Math.max(0,...t.series.map((t=>t.data.length)));const c=t.series.map((n=>t.stack!=="none"&&!n.range?"stacked":"__unstacked__"));const r=U(t.series.map((t=>t.hidden?[]:t.data)),t.stack,c);t.series.forEach(((t,n)=>{if(!t.range||t.hidden)return;r[n]=t.range.map((t=>t?[Math.min(t[0],t[1]),Math.max(t[0],t[1])]:t))}));const i=[];t.series.forEach(((t,n)=>{if(t.hidden)return;r[n].forEach((t=>{if(t){i.push(t[0],t[1])}}))}));const a=R(i,{min:t.yMin,max:t.yMax,scale:t.yScale,includeZero:t.stack!=="none"||t.yScale==="value"});const f=t.xValues.map((n=>k(n,t.xScale)));const l=R(f,{scale:t.xScale});const u={ranges:[],sizing:"equal"};const d=t.compact?u:P(t.yBreaks,i,t.yScale);const h=t.compact||t.xScale==="category"?u:P(t.xBreaks,f,t.xScale);const x={...d,ranges:A(d.ranges,a)};const p={...h,ranges:A(h.ranges,l)};const y=D(a,x.ranges,t.yScale,6).filter((t=>!_(x.ranges,t)));const g=y.map((n=>(t.yTickFormatter??t.yFormatter)(n)));const b=t.yHidden||t.yHideTicks?0:Math.max(0,...g.map((t=>ot(t,n.labelSize))));const m=t.subtitle?n.labelSize+4:0;const M=t.title?n.titleSize+10+m:0;const w=t.xHidden||t.xHideTicks?0:n.labelSize+8;const $=t.yLabel?n.labelSize+6:0;const v=t.xLabel?n.labelSize+6:0;const z=!!t.legend&&t.legend!=="none"&&t.series.length>1;const S=z&&(t.legend==="left"||t.legend==="right");const F=z&&!S&&t.legend.startsWith("bottom");const C=z&&!S&&!F;const N=C||F?et(t.series.map((t=>t.label)),n.labelSize,o*.86):1;const B=t.legendExtent!=null&&(C||F)?t.legendExtent+8:N*(n.labelSize+8)+6;const L=C?B:0;const O=F?B:0;const q=S?t.legendExtent!=null?t.legendExtent+16:Math.max(0,...t.series.map((t=>ot(t.label,n.labelSize))))+34:0;const j=t.seriesLabels?Math.max(0,...t.series.filter((t=>!t.hidden)).map((t=>ot(t.label,n.labelSize))))+20:0;const V=!!t.compact;const Y=V?Math.max(2,...t.series.filter((t=>!t.hidden&&(t.showMarks||(t.markIndices?.length??0)>0||t.pointSymbols))).map((t=>mt(t.symbol,t.markSize)+2))):0;const W=V?Y:M+8+L;const T=V?Y:12+ot(g[g.length-1]??"",n.labelSize)/2+(t.legend==="right"?q:0)+j;const H=V?Y:w+v+6+O;const J=V?Y:b+10+$+(t.legend==="left"?q:0);const K={x:J,y:W,width:Math.max(1,o-J-T),height:Math.max(1,e-W-H)};const ct=t.xScale==="category"?I(s,K.width,true):E(l,K.width,t.xScale,p.ranges,p.sizing);const rt=E(a,K.height,t.yScale,x.ranges,x.sizing);const it=t=>K.y+K.height-rt.scale(t);const lt=n=>K.x+(t.xScale==="category"?ct.scale(n):ct.scale(k(t.xValues[n],t.xScale)));const ht=[];const gt=[];if(!V){const o=ut(t.yBands,"y",(n=>it(k(n,t.yScale))),K,n,"yband");const e=ut(t.xBands,"x",(n=>K.x+ct.scale(t.xScale==="category"?Number(n):k(n,t.xScale))),K,n,"xband");gt.push(...o.rects,...e.rects);ht.push(...o.labels,...e.labels)}const wt=[];const $t=[];const vt=st(t.yGridDash,1);const kt=st(t.xGridDash,1);const zt=st(t.yDash,1);const St=st(t.xDash,1);if(!t.yHidden&&!V){for(const o of y){const e=it(o);if(t.gridY!==false){wt.push({x1:K.x,y1:e,x2:K.x+K.width,y2:e,color:n.gridLineColor,width:1,dash:vt})}if(t.axisTicks){$t.push({x1:K.x-nt,y1:e,x2:K.x,y2:e,color:n.axisLineColor,width:1,dash:zt})}}const o=(rt.breaks??[]).map((t=>({px:K.height-t.px-t.gap,gap:t.gap})));$t.push(...ft("y",K.y,K.y+K.height,K.x,o,n.axisLineColor,zt));for(const t of o){$t.push(...at("y",K.y+t.px,K.y+t.px+t.gap,K.x,K.x+K.width,n.axisLineColor))}}if(!t.xHidden&&!V){const t=K.y+K.height;const o=(ct.breaks??[]).map((t=>({px:t.px,gap:t.gap})));$t.push(...ft("x",K.x,K.x+K.width,t,o,n.axisLineColor,St));for(const t of o){$t.push(...at("x",K.x+t.px,K.x+t.px+t.gap,K.y,K.y+K.height,n.axisLineColor))}}const It=[];const Ft=[];const At=[];const Ct=[];const Nt=[];const Et=[];const Pt=it(Math.max(a[0],0));const Bt=t=>{if(!x.ranges.length&&!p.ranges.length)return[t];const n=[];let o=[];let e="";for(const s of t){const t=f[s.index];if(_(x.ranges,s.value)||t!==undefined&&_(p.ranges,t)){if(o.length)n.push(o);o=[];e="";continue}const c=x.ranges.filter((t=>s.value>=t.to)).length+":"+p.ranges.filter((n=>t!==undefined&&t>=n.to)).length;if(e&&c!==e&&o.length){n.push(o);o=[]}e=c;o.push(s)}if(o.length)n.push(o);return n};t.series.forEach(((o,e)=>{if(o.hidden)return;const s=Q(r[e].map((t=>t===undefined?undefined:t?t[1]:null)),o.connectNulls).flatMap(Bt);const c={};let i;for(const a of s){if(!a.length)continue;const s=a.map((t=>({x:lt(t.index),y:it(t.value)})));i=s[s.length-1];a.forEach(((t,n)=>{const i=o.pointSymbols?.[t.index]??(o.symbol&&o.symbol!=="none"?o.symbol:"circle");const a=o.range?r[e][t.index]:undefined;c[t.index]={x:s[n].x,y:s[n].y,value:o.data[t.index]??t.value,symbol:i,...a?{low:a[0],high:a[1]}:{}}}));const f=Z(G(X(s,K.width),o.curve),K.x,K.y,K.width,K.height);const l=o.dashAfter!=null?a.findIndex((t=>t.index>=o.dashAfter)):-1;const u=o.lineWidth??2.5;if(o.range||o.stroke===false);else if(l>0&&l<a.length){It.push({points:Z(G(X(s.slice(0,l+1),K.width),o.curve),K.x,K.y,K.width,K.height),color:o.color,width:u,dash:st(o.dash,u),seriesIndex:e});It.push({points:Z(G(X(s.slice(l),K.width),o.curve),K.x,K.y,K.width,K.height),color:o.color,width:u,dash:st("dotted",u),seriesIndex:e})}else if(l===0){It.push({points:f,color:o.color,width:u,dash:st("dotted",u),seriesIndex:e})}else{It.push({points:f,color:o.color,width:u,dash:st(o.dash,u),seriesIndex:e})}if(t.area&&o.fill!==false){const n=t.fillOpacity??.35;const s=t.stack!=="none"||o.range?Z(G(a.map((t=>({x:lt(t.index),y:it(r[e][t.index][0])}))),o.curve),K.x,K.y,K.width,K.height):undefined;Ft.push({points:f,baselineY:Pt,colorTop:dt(o.color,n),colorBottom:s?dt(o.color,n):dt(o.color,Math.max(.02,n*.06)),basePoints:s,seriesIndex:e})}const d=o.markIndices?new Set(o.markIndices):null;a.forEach(((t,c)=>{const r=t.index;const i=o.pointSymbols?.[r];const a=d?d.has(r):o.showMarks;const f=i??(a?o.symbol??"circle":undefined);if(!f||f==="none")return;const l=s[c];if(bt(f)){At.push({x:l.x,y:l.y,r:mt(f,o.markSize),color:o.color,symbol:f,seriesIndex:e,hollow:o.hollow,fill:o.hollow?n.surface:undefined})}else{Ct.push({x:l.x,y:l.y,text:f,size:yt})}}));if(t.showLabels&&!V){a.forEach(((e,c)=>{const r=s[c].y-9-n.labelSize>=K.y;Ct.push({x:s[c].x,y:s[c].y,text:t.yFormatter(o.data[e.index]??e.value),size:n.labelSize,label:{color:n.textColor,weight:600,dx:0,dy:r?-9:9,anchorX:"-50%",anchorY:r?"-100%":"0"}})}))}}if(t.seriesLabels&&i&&!V){At.push({x:i.x,y:i.y,r:4,color:o.color,symbol:"circle",seriesIndex:e});Nt.push({key:`sl-${e}`,x:i.x,y:i.y,text:o.label,color:n.textColor,size:n.labelSize+1,visible:true})}Et.push({seriesIndex:e,color:o.color,label:o.label,byIndex:c,values:o.data,unanchored:!tt(o)})}));if(Nt.length>1){const t=n.labelSize+5;let o=-Infinity;for(const n of[...Nt].sort(((t,n)=>t.y-n.y))){n.visible=n.y-o>=t;if(n.visible)o=n.y}}const Dt=[];if(t.refBands){for(const n of t.refBands){const t=lt(n.from);const o=lt(n.to);const e=Math.min(t,o);const s=Math.abs(o-t);if(s<=0)continue;Dt.push({x:e,y:K.y,w:s,h:K.height,color:n.color,radius:[0,0,0,0],seriesIndex:-1,dataIndex:-1})}}const _t=[...ht];if(t.title&&!V){const o=Mt(t.titleAlign,K.x,K.width);_t.push({x:o.x,y:L+6,text:t.title,color:n.textColor,fontSize:n.titleSize,fontWeight:600,align:o.align,baseline:"top",key:"title"});if(t.subtitle){_t.push({x:o.x,y:L+6+n.titleSize+4,text:t.subtitle,color:n.textColorMuted,fontSize:n.labelSize,align:o.align,baseline:"top",key:"subtitle"})}}if(t.markLines&&!V){for(const o of t.markLines){const e=t.xScale==="category"?Number(o.value):k(o.value,t.xScale);const s=K.x+ct.scale(e);if(!Number.isFinite(s)||s<K.x-1||s>K.x+K.width+1)continue;wt.push({x1:s,y1:K.y,x2:s,y2:K.y+K.height,color:o.color??n.axisLineColor,width:1.5,dash:st(o.dash??"dashed",1.5)});if(o.label){_t.push({x:s+4,y:K.y+2,text:o.label,color:n.textColorMuted,fontSize:n.labelSize,align:"start",baseline:"top",key:`markline-${Math.round(s)}`})}}}if(!t.yHidden&&!t.yHideTicks&&!V){y.forEach(((t,o)=>{_t.push({x:K.x-8,y:it(t),text:g[o],color:n.textColorMuted,fontSize:n.labelSize,align:"end",baseline:"middle",key:`yt-${o}`})}))}const Lt=[];for(let t=0;t<s;t++)Lt.push(lt(t));const Ot=[];if(t.xScale==="category"){const n=Math.max(1,Math.ceil(s/Math.max(1,Math.floor(K.width/60))));for(let o=0;o<s;o+=n){Ot.push({px:Lt[o],text:t.xFormatter(t.xValues[o]??o),key:`xt-${o}`})}}else if(s){const n=R(f,{scale:t.xScale});const o=Math.max(2,Math.floor(K.width/90));const e=D(n,p.ranges,t.xScale,o).filter((t=>!_(p.ranges,t)));for(const n of e){const o=K.x+ct.scale(n);if(o<K.x-1||o>K.x+K.width+1)continue;Ot.push({px:o,text:t.xFormatter(t.xScale==="time"?new Date(n):n),key:`xt-${n}`})}}if(!V){for(const o of Ot){if(t.gridX&&o.px>K.x+.5){wt.push({x1:o.px,y1:K.y,x2:o.px,y2:K.y+K.height,color:n.gridLineColor,width:1,dash:kt})}if(t.axisTicks&&!t.xHidden){const t=K.y+K.height;$t.push({x1:o.px,y1:t,x2:o.px,y2:t+nt,color:n.axisLineColor,width:1,dash:St})}if(t.xHidden||t.xHideTicks)continue;_t.push({x:o.px,y:K.y+K.height+6,text:o.text,color:n.textColorMuted,fontSize:n.labelSize,align:"center",baseline:"top",key:o.key})}}if(t.xLabel&&!V){_t.push({x:K.x+K.width/2,y:e-O-2,text:t.xLabel,color:n.textColor,fontSize:n.labelSize,align:"center",baseline:"bottom",key:"x-axis-title"})}if(t.yLabel&&!V){_t.push({x:4,y:K.y+K.height/2,text:t.yLabel,color:n.textColor,fontSize:n.labelSize,align:"center",baseline:"top",rotate:-90,key:"y-axis-title"})}const qt=t.legend==="none"||V?[]:t.series.map(((t,n)=>({label:t.label,color:t.color,seriesIndex:n,hidden:t.hidden,x:0,y:0})));const jt=[];for(let n=0;n<s;n++)jt.push(t.xFormatter(t.xValues[n]??n));return{width:o,height:e,plot:K,background:n.background==="transparent"?undefined:n.background,bands:gt,gridlines:wt,axisLines:$t,areas:Ft,bars:Dt,slices:[],lines:It,markers:At,glyphs:Ct,endLabels:Nt,texts:_t,legend:qt,legendPosition:t.legend,xPositions:Lt,xValues:t.xValues,xLabels:jt,hoverPoints:Et}}function xt(t,n,o,e){const s=t.yAxes??[];const c=t.xValues.length||Math.max(0,...t.series.map((t=>t.data.length)));const r=t=>{const n=t.yAxisIndex??0;return n>=0&&n<s.length?n:0};const i=s.map(((o,e)=>{const s=t.series.filter((t=>!t.hidden&&r(t)===e));const c=[];for(const t of s)for(const n of t.data)if(typeof n==="number"&&Number.isFinite(n))c.push(n);const i=R(c,{min:o.min,max:o.max,scale:o.scale,includeZero:o.scale==="value"});const a=o.scale==="log"?q(i[0],i[1]):L(i[0],i[1],6);const f=a.map((t=>o.formatter(t)));const l=o.position??(e===0?"left":"right");const u=o.hidden||o.hideTicks?0:Math.max(0,...f.map((t=>ot(t,n.labelSize))));const d=o.label?n.labelSize+6:0;const h=o.hidden?4:u+12+d;const x=o.color??null;return{spec:o,domain:i,tickVals:a,tickLabels:f,side:l,gutterW:h,tint:x,hasData:s.length>0}}));const a=i.filter((t=>t.side==="left"));const f=i.filter((t=>t.side==="right"));const l=t=>t.reduce(((t,n)=>t+n.gutterW),0);const u=t.title?n.titleSize+10+(t.subtitle?n.labelSize+4:0):0;const d=t.xHidden||t.xHideTicks?0:n.labelSize+8;const h=t.xLabel?n.labelSize+6:0;const x=!!t.legend&&t.legend!=="none"&&t.series.length>1;const p=x&&(t.legend==="left"||t.legend==="right");const y=x&&!p&&t.legend.startsWith("bottom");const g=x&&!p&&!y;const b=g||y?et(t.series.map((t=>t.label)),n.labelSize,o*.86):1;const m=t.legendExtent!=null&&(g||y)?t.legendExtent+8:b*(n.labelSize+8)+6;const M=g?m:0;const w=y?m:0;const $=p?t.legendExtent!=null?t.legendExtent+16:Math.max(0,...t.series.map((t=>ot(t.label,n.labelSize))))+34:0;const v=t.xHidden||t.xHideTicks?"":t.xFormatter(t.xValues[c-1]??c-1);const F=f.length===0?ot(v,n.labelSize)/2:0;const A=u+8+M;const C=d+h+6+w;const N=l(a)+8+(t.legend==="left"?$:0);const E=l(f)+8+F+(t.legend==="right"?$:0);const P={x:N,y:A,width:Math.max(1,o-N-E),height:Math.max(1,e-A-C)};const B=t.xScale==="category"?I(c,P.width,true):t.xScale==="log"?S(R(t.xValues.map((n=>k(n,t.xScale))),{scale:"log"}),P.width):z(R(t.xValues.map((n=>k(n,t.xScale))),{scale:t.xScale}),P.width,t.xScale);const D=n=>P.x+(t.xScale==="category"?B.scale(n):B.scale(k(t.xValues[n],t.xScale)));const _=t=>{t.scale=t.spec.scale==="log"?S(t.domain,P.height):z(t.domain,P.height,t.spec.scale);t.toPxY=n=>P.y+P.height-t.scale.scale(n)};let O=0;for(const t of a){t.axisX=P.x-O;_(t);O+=t.gutterW}let V=0;for(const t of f){t.axisX=P.x+P.width+V;_(t);V+=t.gutterW}const Y=[];const W=[];i.forEach(((t,o)=>{const e=ut(t.spec.bands,"y",(n=>t.toPxY(k(n,t.spec.scale))),P,n,`yband-${o}`);Y.push(...e.rects);W.push(...e.labels)}));{const o=ut(t.xBands,"x",(n=>P.x+B.scale(t.xScale==="category"?Number(n):k(n,t.xScale))),P,n,"xband");Y.push(...o.rects);W.push(...o.labels)}const T=[];const H=[];const J=i.find((t=>!t.spec.hidden&&t.hasData))??i.find((t=>t.hasData));const K=st(t.xDash,1);const U=st(t.xGridDash,1);if(J&&t.gridY!==false){const o=st(J.spec.gridDash,1);for(const e of J.tickVals){const s=J.toPxY(e);T.push({x1:P.x,y1:s,x2:P.x+P.width,y2:s,color:n.gridLineColor,width:1,dash:o});if(t.axisTicks)H.push({x1:P.x-nt,y1:s,x2:P.x,y2:s,color:n.axisLineColor,width:1,dash:st(J.spec.dash,1)})}}for(const o of i){if(o.spec.hidden)continue;const e=o.tint??n.axisLineColor;const s=st(o.spec.dash,1);H.push({x1:o.axisX,y1:P.y,x2:o.axisX,y2:P.y+P.height,color:e,width:1,dash:s});if(t.axisTicks&&!o.spec.hideTicks){const t=o.side==="left"?-1:1;for(const n of o.tickVals){const c=o.toPxY(n);H.push({x1:o.axisX,y1:c,x2:o.axisX+t*nt,y2:c,color:e,width:1,dash:s})}}}if(!t.xHidden){H.push({x1:P.x,y1:P.y+P.height,x2:P.x+P.width,y2:P.y+P.height,color:n.axisLineColor,width:1,dash:K})}const ct=[];const rt=[];const it=[];const at=[];const ft=[];t.series.forEach(((o,e)=>{if(o.hidden)return;const s=i[r(o)];const c=s.toPxY;const a=s.domain[0]<=0&&s.domain[1]>=0;const f=c(a?0:s.domain[0]);const l=Q(o.data.map((t=>t===undefined?undefined:typeof t==="number"?t:null)),o.connectNulls);const u={};for(const r of l){if(!r.length)continue;const i=r.map((t=>({x:D(t.index),y:c(t.value)})));r.forEach(((t,n)=>{const e=o.pointSymbols?.[t.index]??(o.symbol&&o.symbol!=="none"?o.symbol:"circle");u[t.index]={x:i[n].x,y:i[n].y,value:o.data[t.index]??t.value,symbol:e}}));const a=Z(G(X(i,P.width),o.curve),P.x,P.y,P.width,P.height);ct.push({points:a,color:o.color,width:2.5,dash:st(o.dash,2.5),seriesIndex:e});if(t.area&&o.fill!==false){const n=t.fillOpacity??.35;rt.push({points:a,baselineY:f,colorTop:dt(o.color,n),colorBottom:dt(o.color,Math.max(.02,n*.06)),seriesIndex:e})}const l=o.markIndices?new Set(o.markIndices):null;r.forEach(((t,n)=>{const s=t.index;const c=o.pointSymbols?.[s];const r=l?l.has(s):o.showMarks;const a=c??(r?o.symbol??"circle":undefined);if(!a||a==="none")return;const f=i[n];if(bt(a))it.push({x:f.x,y:f.y,r:mt(a,o.markSize),color:o.color,symbol:a,seriesIndex:e});else at.push({x:f.x,y:f.y,text:a,size:yt})}));if(t.showLabels){r.forEach(((t,e)=>{const c=i[e].y-9-n.labelSize>=P.y;at.push({x:i[e].x,y:i[e].y,text:s.spec.formatter(o.data[t.index]??t.value),size:n.labelSize,label:{color:n.textColor,weight:600,dx:0,dy:c?-9:9,anchorX:"-50%",anchorY:c?"-100%":"0"}})}))}}ft.push({seriesIndex:e,color:o.color,label:o.label,byIndex:u,values:o.data,valueFormat:s.spec.formatter,unanchored:!tt(o)})}));const lt=[...W];if(t.title){const o=Mt(t.titleAlign,P.x,P.width);lt.push({x:o.x,y:M+6,text:t.title,color:n.textColor,fontSize:n.titleSize,fontWeight:600,align:o.align,baseline:"top",key:"title"});if(t.subtitle){lt.push({x:o.x,y:M+6+n.titleSize+4,text:t.subtitle,color:n.textColorMuted,fontSize:n.labelSize,align:o.align,baseline:"top",key:"subtitle"})}}i.forEach(((t,o)=>{if(t.spec.hidden)return;const e=t.tint??n.textColorMuted;if(!t.spec.hideTicks){t.tickVals.forEach(((s,c)=>{lt.push({x:t.side==="left"?t.axisX-8:t.axisX+8,y:t.toPxY(s),text:t.tickLabels[c],color:e,fontSize:n.labelSize,align:t.side==="left"?"end":"start",baseline:"middle",key:`yt-${o}-${c}`})}))}if(t.spec.label){const e=t.side==="left"?t.axisX-t.gutterW+n.labelSize:t.axisX+t.gutterW-n.labelSize;lt.push({x:e,y:P.y+P.height/2,text:t.spec.label,color:t.tint??n.textColor,fontSize:n.labelSize,align:"center",baseline:"top",rotate:-90,key:`yaxis-title-${o}`})}}));const ht=[];for(let t=0;t<c;t++)ht.push(D(t));const xt=P.y+P.height;const pt=[];if(t.xScale==="category"){const n=Math.max(1,Math.ceil(c/Math.max(1,Math.floor(P.width/60))));for(let o=0;o<c;o++){if(o%n!==0)continue;pt.push({px:ht[o],text:t.xFormatter(t.xValues[o]??o),key:`xt-${o}`})}}else{const n=R(t.xValues.map((n=>k(n,t.xScale))),{scale:t.xScale});const o=t.xScale==="log"?q(n[0],n[1]):t.xScale==="time"?j(n[0],n[1],Math.max(2,Math.floor(P.width/90))):L(n[0],n[1],Math.max(2,Math.floor(P.width/90)));for(const n of o){const o=P.x+B.scale(n);if(o<P.x-1||o>P.x+P.width+1)continue;pt.push({px:o,text:t.xFormatter(t.xScale==="time"?new Date(n):n),key:`xt-${n}`})}}if(t.gridX)for(const t of pt)T.push({x1:t.px,y1:P.y,x2:t.px,y2:xt,color:n.gridLineColor,width:1,dash:U});if(!t.xHidden&&!t.xHideTicks){for(const o of pt){if(t.axisTicks)H.push({x1:o.px,y1:xt,x2:o.px,y2:xt+nt,color:n.axisLineColor,width:1,dash:K});lt.push({x:o.px,y:xt+6,text:o.text,color:n.textColorMuted,fontSize:n.labelSize,align:"center",baseline:"top",key:o.key})}}if(t.xLabel){lt.push({x:P.x+P.width/2,y:e-w-2,text:t.xLabel,color:n.textColor,fontSize:n.labelSize,align:"center",baseline:"bottom",key:"x-axis-title"})}const gt=t.legend==="none"?[]:t.series.map(((t,n)=>({label:t.label,color:t.color,seriesIndex:n,hidden:t.hidden,x:0,y:0})));const wt=[];for(let n=0;n<c;n++)wt.push(t.xFormatter(t.xValues[n]??n));return{width:o,height:e,plot:P,background:n.background==="transparent"?undefined:n.background,bands:Y,gridlines:T,axisLines:H,areas:rt,bars:[],slices:[],lines:ct,markers:it,glyphs:at,endLabels:[],texts:lt,legend:gt,legendPosition:t.legend,xPositions:ht,xValues:t.xValues,xLabels:wt,hoverPoints:ft}}function pt(t,n,o,e){const s=t.xValues.length||Math.max(0,...t.series.map((t=>t.data.length)));const c=!!t.compact;const r=t.xScale==="category";const i=t.series.map((n=>t.stack!=="none"&&!n.range?"stacked":"__unstacked__"));const a=U(t.series.map((t=>t.hidden?[]:t.data)),t.stack,i);t.series.forEach(((t,n)=>{if(!t.range||t.hidden)return;a[n]=t.range.map((t=>t?[Math.min(t[0],t[1]),Math.max(t[0],t[1])]:t))}));const f=[];t.series.forEach(((t,n)=>{if(t.hidden)return;for(const t of a[n])if(t)f.push(t[0],t[1])}));const l=R(f,{min:t.yMin,max:t.yMax,scale:t.yScale,includeZero:false});const u=t.yScale==="log"?q(l[0],l[1]):L(l[0],l[1],8);const d=u.map((n=>(t.yTickFormatter??t.yFormatter)(n)));const h=r?[0,Math.max(1,s-1)]:R(t.xValues.map((n=>k(n,t.xScale))),{scale:t.xScale});const x=r?Array.from({length:s},((t,n)=>n)):L(h[0],h[1],6);const p=x.map((n=>r?t.xFormatter(t.xValues[n]??n):t.xFormatter(n)));const y=!!t.legend&&t.legend!=="none"&&t.series.length>1;const g=y&&(t.legend==="left"||t.legend==="right");const b=y&&!g&&t.legend.startsWith("bottom");const m=y&&!g&&!b;const M=m||b?et(t.series.map((t=>t.label)),n.labelSize,o*.86):1;const w=t.legendExtent!=null&&(m||b)?t.legendExtent+8:M*(n.labelSize+8)+6;const $=m?w:0;const v=b?w:0;const F=g?t.legendExtent!=null?t.legendExtent+16:Math.max(0,...t.series.map((t=>ot(t.label,n.labelSize))))+34:0;const A=t.title?n.titleSize+10+(t.subtitle?n.labelSize+4:0):0;const C=t.xHidden||t.xHideTicks?0:Math.max(0,...p.map((t=>ot(t,n.labelSize))));const N=t.yHidden||t.yHideTicks?0:n.labelSize+8;const E=t.xLabel?n.labelSize+6:0;const P=t.yLabel?n.labelSize+6:0;const B=c?2:A+8+$;const D=c?2:12+ot(d[d.length-1]??"",n.labelSize)/2+(t.legend==="right"?F:0);const _=c?2:N+P+6+v;const O=c?2:C+10+E+(t.legend==="left"?F:0);const j={x:O,y:B,width:Math.max(1,o-O-D),height:Math.max(1,e-B-_)};const V=t.yScale==="log"?S(l,j.width):z(l,j.width,t.yScale);const Y=r?I(s,j.height,true):t.xScale==="log"?S(h,j.height):z(h,j.height,t.xScale);const W=t=>j.x+V.scale(t);const T=t=>j.y+j.height-Y.scale(t);const H=n=>T(r?n:k(t.xValues[n],t.xScale));const J=[];const K=[];const ct=j.y+j.height;const rt=st(t.yDash,1);const it=st(t.yGridDash,1);const at=st(t.xDash,1);const ft=st(t.xGridDash,1);if(!t.yHidden&&!c){for(const o of u){const e=W(o);if(t.gridY!==false)J.push({x1:e,y1:j.y,x2:e,y2:ct,color:n.gridLineColor,width:1,dash:it});if(t.axisTicks)K.push({x1:e,y1:ct,x2:e,y2:ct+nt,color:n.axisLineColor,width:1,dash:rt})}K.push({x1:j.x,y1:ct,x2:j.x+j.width,y2:ct,color:n.axisLineColor,width:1,dash:rt})}if(!t.xHidden&&!c){for(const o of x){const e=T(o);if(t.gridX)J.push({x1:j.x,y1:e,x2:j.x+j.width,y2:e,color:n.gridLineColor,width:1,dash:ft});if(t.axisTicks)K.push({x1:j.x-nt,y1:e,x2:j.x,y2:e,color:n.axisLineColor,width:1,dash:at})}K.push({x1:j.x,y1:j.y,x2:j.x,y2:j.y+j.height,color:n.axisLineColor,width:1,dash:at})}const lt=[];const ut=[];const ht=[];const xt=[];const pt=[];const gt=W(Math.max(l[0],Math.min(l[1],0)));t.series.forEach(((o,e)=>{if(o.hidden)return;const s={};for(const r of Q(a[e].map((t=>t===undefined?undefined:t?t[1]:null)),o.connectNulls)){if(!r.length)continue;const i=r.map((t=>({x:W(t.value),y:H(t.index)})));r.forEach(((t,n)=>{const e=o.pointSymbols?.[t.index]??(o.symbol&&o.symbol!=="none"?o.symbol:"circle");s[t.index]={x:i[n].x,y:i[n].y,value:o.data[t.index]??t.value,symbol:e}}));const f=Z(G(X(i,j.width),o.curve),j.x,j.y,j.width,j.height);if(!o.range&&o.stroke!==false){lt.push({points:f,color:o.color,width:2.5,dash:st(o.dash,2.5),seriesIndex:e})}if(t.area&&o.fill!==false){const n=t.fillOpacity??.35;const s=t.stack!=="none"||!!o.range;ut.push({points:f,baselineY:gt,colorTop:dt(o.color,n),colorBottom:s?dt(o.color,n):dt(o.color,Math.max(.02,n*.06)),basePoints:t.stack!=="none"||o.range?Z(G(r.map((t=>({x:W(a[e][t.index][0]),y:H(t.index)}))),o.curve),j.x,j.y,j.width,j.height):f.map((t=>({x:gt,y:t.y}))),horizontal:true,seriesIndex:e})}const l=o.markIndices?new Set(o.markIndices):null;r.forEach(((t,n)=>{const s=o.pointSymbols?.[t.index];const c=s??((l?l.has(t.index):o.showMarks)?o.symbol??"circle":undefined);if(!c||c==="none")return;const r=i[n];if(bt(c))ht.push({x:r.x,y:r.y,r:mt(c,o.markSize),color:o.color,symbol:c,seriesIndex:e});else xt.push({x:r.x,y:r.y,text:c,size:yt})}));if(t.showLabels&&!c){r.forEach(((e,s)=>{xt.push({x:i[s].x,y:i[s].y,text:t.yFormatter(o.data[e.index]??e.value),size:n.labelSize,label:{color:n.textColor,weight:600,dx:9,dy:0,anchorX:"0",anchorY:"-50%"}})}))}}pt.push({seriesIndex:e,color:o.color,label:o.label,byIndex:s,values:o.data,unanchored:!tt(o)})}));const wt=[];if(t.title&&!c){const o=Mt(t.titleAlign,j.x,j.width);wt.push({x:o.x,y:$+6,text:t.title,color:n.textColor,fontSize:n.titleSize,fontWeight:600,align:o.align,baseline:"top",key:"title"});if(t.subtitle){wt.push({x:o.x,y:$+6+n.titleSize+4,text:t.subtitle,color:n.textColorMuted,fontSize:n.labelSize,align:o.align,baseline:"top",key:"subtitle"})}}if(!t.xHidden&&!t.xHideTicks&&!c){x.forEach(((t,o)=>{wt.push({x:j.x-8,y:T(t),text:p[o],color:n.textColorMuted,fontSize:n.labelSize,align:"end",baseline:"middle",key:`mt-${o}`})}))}if(!t.yHidden&&!t.yHideTicks&&!c){u.forEach(((t,o)=>{wt.push({x:W(t),y:ct+6,text:d[o],color:n.textColorMuted,fontSize:n.labelSize,align:"center",baseline:"top",key:`vt-${o}`})}))}if(t.xLabel&&!c){wt.push({x:4,y:j.y+j.height/2,text:t.xLabel,color:n.textColor,fontSize:n.labelSize,align:"center",baseline:"top",rotate:-90,key:"x-axis-title"})}if(t.yLabel&&!c){wt.push({x:j.x+j.width/2,y:e-v-2,text:t.yLabel,color:n.textColor,fontSize:n.labelSize,align:"center",baseline:"bottom",key:"y-axis-title"})}const $t=t.legend==="none"||c?[]:t.series.map(((t,n)=>({label:t.label,color:t.color,seriesIndex:n,hidden:t.hidden,x:0,y:0})));const vt=[];const kt=[];for(let n=0;n<s;n++){vt.push(H(n));kt.push(t.xFormatter(t.xValues[n]??n))}return{width:o,height:e,plot:j,background:n.background==="transparent"?undefined:n.background,gridlines:J,axisLines:K,areas:ut,bars:[],slices:[],lines:lt,markers:ht,glyphs:xt,texts:wt,legend:$t,legendPosition:t.legend,inverted:true,xPositions:vt,xValues:t.xValues,xLabels:kt,hoverPoints:pt}}const yt=18;const gt=new Set(["circle","square","diamond","triangle","triangle-down"]);function bt(t){return gt.has(t)}function mt(t,n){if(n!=null&&n>0)return n;if(t==="square"||t==="diamond")return 4.2;if(t==="triangle"||t==="triangle-down")return 4.6;return 3.5}function Mt(t,n,o){if(t==="center")return{x:n+o/2,align:"center"};if(t==="end")return{x:n+o,align:"end"};return{x:n,align:"start"}}const wt=32;function $t(t){return Math.min(t*.3,wt)}function vt(t,n){const o=n.horizontal??n.w>n.h;const e=$t(o?n.h:n.w);const s=n.notch===false?0:e;if(o){const o=n.y+n.h/2;if(n.arrow===1){t.moveTo(n.x,n.y);t.lineTo(n.x+n.w,n.y);t.lineTo(n.x+n.w+e,o);t.lineTo(n.x+n.w,n.y+n.h);t.lineTo(n.x,n.y+n.h);if(s)t.lineTo(n.x+s,o)}else{t.moveTo(n.x+n.w,n.y);t.lineTo(n.x,n.y);t.lineTo(n.x-e,o);t.lineTo(n.x,n.y+n.h);t.lineTo(n.x+n.w,n.y+n.h);if(s)t.lineTo(n.x+n.w-s,o)}}else{const o=n.x+n.w/2;if(n.arrow===1){t.moveTo(n.x,n.y+n.h);t.lineTo(n.x,n.y);t.lineTo(o,n.y-e);t.lineTo(n.x+n.w,n.y);t.lineTo(n.x+n.w,n.y+n.h);if(s)t.lineTo(o,n.y+n.h-s)}else{t.moveTo(n.x,n.y);t.lineTo(n.x,n.y+n.h);t.lineTo(o,n.y+n.h+e);t.lineTo(n.x+n.w,n.y+n.h);t.lineTo(n.x+n.w,n.y);if(s)t.lineTo(o,n.y+s)}}t.closePath()}function kt(t,n,o=true){const{cx:e,cy:s,innerR:c,outerR:r,startAngle:i,endAngle:a}=n;const f=a<i;const l=f?-1:1;const u=Math.abs(a-i);const d=(t,n)=>({x:e+Math.cos(n)*t,y:s+Math.sin(n)*t});const h=u>=Math.PI*2-.01;const x=h?0:Math.min((n.gap??0)/2,r*Math.sin(u/2)*.4);const p=t=>x>0&&t>x?Math.asin(Math.min(1,x/t)):0;const y=i+l*p(r);const g=a-l*p(r);if(l*(g-y)<=0)return;const b=(t,n,o)=>{const e=(i+a)/2;const s=t+n*p(o);return n*l>0?Math.min(s*l,e*l)*l:Math.max(s*l,e*l)*l};const m=Math.min(Math.abs(g-y),Math.PI/2)/4;const M=(r-c)/2;const w=r*Math.tan(m);const $=c>0?c*Math.tan(m):Infinity;const v=Math.max(0,Math.min(n.cornerRadius??0,M,w,$));const k=b(i,l,Math.max(c,.01));const z=b(a,-l,Math.max(c,.01));if(o)t.beginPath();if(v<.5){const n=d(c,k);t.moveTo(n.x,n.y);const o=d(r,y);t.lineTo(o.x,o.y);t.arc(e,s,r,y,g,f);const i=d(c,z);t.lineTo(i.x,i.y);if(c>0&&l*(z-k)>0)t.arc(e,s,c,z,k,!f);t.closePath();return}const S=r-v;const I=Math.asin(Math.min(1,v/S))*l;const F=Math.sqrt(Math.max(0,S*S-v*v));const A=y+I;const C=g-I;const N=c>0;const E=c+v;const P=Math.asin(Math.min(1,v/E))*l;const B=Math.sqrt(Math.max(0,E*E-v*v));const D=b(i,l,E);const _=b(a,-l,E);const L=D+P;const O=_-P;const q=y+(f?Math.PI/2:-Math.PI/2);const j=g+(f?-Math.PI/2:Math.PI/2);const R=d(N?B:0,D);t.moveTo(R.x,R.y);const V=d(F,y);t.lineTo(V.x,V.y);t.arc(d(S,A).x,d(S,A).y,v,q,A,f);t.arc(e,s,r,A,C,f);t.arc(d(S,C).x,d(S,C).y,v,C,j,f);const Y=d(F,g);t.lineTo(Y.x,Y.y);if(N){const n=d(B,_);t.lineTo(n.x,n.y);t.arc(d(E,O).x,d(E,O).y,v,j,O+Math.PI,f);if(l*(O-L)>0)t.arc(e,s,c,O,L,!f);t.arc(d(E,L).x,d(E,L).y,v,L+Math.PI,q,f)}else{const n=d(0,_);t.lineTo(n.x,n.y)}t.closePath()}function zt(t,n,o){const e=!!n.horizontal;const s=t=>e?t.x:t.y;const c=n.points.map(s);if(o)c.push(...n.basePoints.map(s));c.push(n.baselineY);const r=Math.min(...c);const i=Math.max(...c);const a=e?t.createLinearGradient(r,0,i,0):t.createLinearGradient(0,r,0,i);const f=i-r;if(f<1e-6){a.addColorStop(0,n.colorTop);a.addColorStop(1,n.colorBottom);return a}const l=(n.baselineY-r)/f;if(l<=1e-4){a.addColorStop(0,n.colorBottom);a.addColorStop(1,n.colorTop)}else if(l>=1-1e-4){a.addColorStop(0,n.colorTop);a.addColorStop(1,n.colorBottom)}else{a.addColorStop(0,n.colorTop);a.addColorStop(l,n.colorBottom);a.addColorStop(1,n.colorTop)}return a}const St="#010203";function It(t,n,o=true){if(o)t.clearRect(0,0,n.width,n.height);if(n.background){t.fillStyle=n.background;t.fillRect(0,0,n.width,n.height)}for(const o of n.bands??[]){t.fillStyle=St;t.fillStyle=o.color;if(t.fillStyle===St)continue;t.fillRect(o.x,o.y,o.w,o.h)}for(const o of n.gridlines){t.beginPath();t.strokeStyle=o.color;t.lineWidth=o.width;if(o.dash)t.setLineDash(o.dash);t.moveTo(o.x1,o.y1);t.lineTo(o.x2,o.y2);t.stroke();if(o.dash)t.setLineDash([])}for(const o of n.areas){if(o.points.length<2)continue;const n=!!(o.basePoints&&o.basePoints.length);t.beginPath();t.moveTo(o.points[0].x,o.points[0].y);for(let n=1;n<o.points.length;n++)t.lineTo(o.points[n].x,o.points[n].y);if(n){for(let n=o.basePoints.length-1;n>=0;n--)t.lineTo(o.basePoints[n].x,o.basePoints[n].y)}else{t.lineTo(o.points[o.points.length-1].x,o.baselineY);t.lineTo(o.points[0].x,o.baselineY)}t.closePath();t.fillStyle=zt(t,o,n);t.fill()}for(const o of n.axisLines){t.beginPath();t.strokeStyle=o.color;t.lineWidth=o.width;if(o.dash)t.setLineDash(o.dash);t.moveTo(o.x1,o.y1);t.lineTo(o.x2,o.y2);t.stroke();if(o.dash)t.setLineDash([])}for(const o of n.bars){if(o.w<=0||o.h<=0)continue;t.beginPath();t.fillStyle=o.color;if(o.arrow){vt(t,o);t.fill();continue}const n=Math.min(o.w,o.h)/2;const e=o.radius.map((t=>Math.max(0,Math.min(t,n))));if(typeof t.roundRect==="function"){t.roundRect(o.x,o.y,o.w,o.h,e)}else{t.rect(o.x,o.y,o.w,o.h)}t.fill()}const e=n.slices.filter((t=>!t.pill&&t.gap&&t.gapColor&&t.endAngle!==t.startAngle));if(e.length){t.beginPath();for(const n of e)kt(t,{...n,gap:0},false);t.fillStyle=e[0].gapColor;t.fill()}for(const o of n.slices){if(o.endAngle===o.startAngle)continue;if(o.pill){const n=(o.innerR+o.outerR)/2;const e=Math.abs(o.outerR-o.innerR);if(e<=0||n<=0)continue;const s=o.capStart!==undefined||o.capEnd!==undefined;t.beginPath();t.fillStyle=o.color;t.strokeStyle=o.color;t.lineWidth=e;t.lineCap=s?"butt":"round";t.arc(o.cx,o.cy,n,o.startAngle,o.endAngle,o.endAngle<o.startAngle);t.stroke();if(s){const s=s=>{t.beginPath();t.arc(o.cx+n*Math.cos(s),o.cy+n*Math.sin(s),e/2,0,Math.PI*2);t.fill()};if(o.capStart)s(o.startAngle);if(o.capEnd)s(o.endAngle)}t.lineCap="butt";continue}if(o.gradient){const n=(o.startAngle+o.endAngle)/2;const e=t.createLinearGradient(o.cx+Math.cos(n)*o.innerR,o.cy+Math.sin(n)*o.innerR,o.cx+Math.cos(n)*o.outerR,o.cy+Math.sin(n)*o.outerR);e.addColorStop(0,o.gradient.from);e.addColorStop(1,o.gradient.to);t.fillStyle=e}else{t.fillStyle=o.color}kt(t,o);t.fill()}const s=n.ripple;if(s&&s.alpha>0&&s.radius>0){const o=n.slices.find((t=>!t.pill&&t.dataIndex===s.dataIndex));if(o){t.save();kt(t,o);t.clip();t.globalAlpha*=s.alpha;t.fillStyle=s.color;t.beginPath();t.arc(s.x,s.y,s.radius,0,Math.PI*2);t.fill();t.restore()}}t.lineJoin="round";t.lineCap="round";for(const o of n.lines){if(o.points.length<2){if(o.points.length===1){t.beginPath();t.fillStyle=o.color;t.arc(o.points[0].x,o.points[0].y,o.width,0,Math.PI*2);t.fill()}continue}t.beginPath();t.strokeStyle=o.color;t.lineWidth=o.width;t.lineCap=o.cap??"round";t.setLineDash(o.dash??[]);t.moveTo(o.points[0].x,o.points[0].y);for(let n=1;n<o.points.length;n++)t.lineTo(o.points[n].x,o.points[n].y);t.stroke()}t.setLineDash([]);t.lineCap="round";for(const o of n.markers){t.beginPath();const n=Y(o.symbol,o.x,o.y,o.r);if(n){t.moveTo(n[0].x,n[0].y);for(let o=1;o<n.length;o++)t.lineTo(n[o].x,n[o].y);t.closePath()}else{t.arc(o.x,o.y,o.r,0,Math.PI*2)}if(o.hollow){t.fillStyle=o.fill??"rgba(0,0,0,0)";t.fill();t.lineWidth=2;t.strokeStyle=o.color;t.stroke()}else{t.fillStyle=o.color;t.fill();t.lineWidth=1.5;t.strokeStyle="rgba(255,255,255,0.9)";t.stroke()}}}const Ft=.3;const At={start:"0",center:"-50%",end:"-100%"};const Ct={top:"0",middle:"-50%",bottom:"-100%"};function Nt(t){return t.includes("-")}function Et(t,n=[],o="sans-serif"){const e=new Set;for(const s of n){e.add(s.key);let n=t.querySelector(`[data-k="${s.key}"]`);if(!n){n=document.createElement("span");n.dataset.k=s.key;n.style.cssText="position:absolute;white-space:nowrap;pointer-events:none;user-select:none;font-weight:500;opacity:0;transition:opacity 240ms ease";t.appendChild(n);n.getBoundingClientRect()}n.textContent=s.text;const c=s.side==="end";n.style.transform=c?"translate(-100%,-50%)":"translate(0,-50%)";n.style.left=`${c?s.x-12:s.x+12}px`;n.style.top=`${s.y}px`;n.style.fontSize=`${s.size}px`;n.style.color=s.color;n.style.fontFamily=o;n.style.opacity=s.visible?"1":"0"}for(const n of Array.from(t.children)){if(!e.has(n.dataset.k??"")){n.style.opacity="0";n.dataset.gone="1";setTimeout((()=>{if(n.dataset.gone==="1")n.remove()}),280)}else{n.removeAttribute("data-gone")}}}function Pt(t,n=[],o="sans-serif"){t.textContent="";for(const e of n){const n=document.createElement("span");n.textContent=e.text;const s=e.label;n.style.cssText=s?["position:absolute",`left:${e.x+s.dx}px`,`top:${e.y+s.dy}px`,`transform:translate(${s.anchorX},${s.anchorY})`,`font:${s.weight} ${e.size}px ${o}`,`color:${s.color}`,"line-height:1","white-space:nowrap","pointer-events:none","user-select:none"].join(";"):["position:absolute",`left:${e.x}px`,`top:${e.y}px`,"transform:translate(-50%,-50%)",`font-size:${e.size}px`,"line-height:1","pointer-events:none","user-select:none"].join(";");t.appendChild(n)}}function Bt(t,n,o="sans-serif"){t.textContent="";const e=n.barLabels;if(!e?.length)return;for(const s of e){const e=n.bars.filter((t=>t.seriesIndex===s.seriesIndex&&t.dataIndex===s.dataIndex));if(!e.length)continue;const c=!!e[0].horizontal;let r=Infinity;let i=-Infinity;let a=Infinity;let f=-Infinity;for(const t of e){r=Math.min(r,t.x);i=Math.max(i,t.x+t.w);a=Math.min(a,t.y);f=Math.max(f,t.y+t.h)}let l;let u;let d;let h;if(s.inside){l=(r+i)/2;u=(a+f)/2;d="center";h="middle";const t=e[0].arrow;if(t){const n=$t(c?f-a:i-r);const o=e[0].notch===false?0:n;const s=t*(n+o)/2;if(c)l+=s;else u-=s}}else if(c){u=(a+f)/2;h="middle";l=s.atLowEnd?r-4:i+4;d=s.atLowEnd?"end":"start"}else{l=(r+i)/2;d="center";u=s.atLowEnd?f+4:a-4;h=s.atLowEnd?"top":"bottom"}const x=document.createElement("span");x.textContent=s.text;x.style.cssText=["position:absolute",`left:${l}px`,`top:${u}px`,`transform:translate(${At[d]},${Ct[h]})`,`color:${s.color}`,`font:${s.fontWeight??400} ${s.size}px ${o}`,"white-space:nowrap","pointer-events:none","user-select:none"].join(";");t.appendChild(x)}}const Dt=new WeakMap;const _t=new WeakMap;function Lt(t,n,o,e={},s=false,c=t){const r=Array.from(c.children).find((t=>t.getAttribute("part")==="legend"))??null;for(const n of Array.from(t.childNodes)){if(n!==r)n.remove()}for(const e of n.texts){const n=document.createElement("span");n.textContent=e.text;if(e.key)n.dataset.key=e.key;n.style.cssText=["position:absolute",`left:${e.x}px`,`top:${e.y}px`,`transform:translate(${At[e.align]},${Ct[e.baseline]})${e.rotate?` rotate(${e.rotate}deg)`:""}`,`color:${e.color}`,`font:${e.fontWeight??400} ${e.fontSize}px ${o}`,"white-space:nowrap","pointer-events:none"].join(";");t.insertBefore(n,r?.parentNode===t?r:null)}const i=n.legend.filter((t=>n.legend.length>1));if(i.length){const t=n.legendPosition??"top-end";const a=t==="left"||t==="right";const f=t.startsWith("bottom");const l=t.endsWith("start")||t.endsWith("end")?t.endsWith("start")!==s:t==="left";const u=l;const d=r??document.createElement("div");d.setAttribute("part","legend");if(!_t.has(d)){d.addEventListener("click",(t=>{const n=t.target?.closest?.("button[data-series-index]");const o=n?Dt.get(n):undefined;if(o)_t.get(d)?.onLegendClick?.(o)}))}_t.set(d,e);if(a){d.style.cssText=["position:absolute","top:50%",t==="left"?"left:12px":"right:12px","transform:translateY(-50%)","display:flex","flex-direction:column","align-items:flex-start","gap:6px","max-height:92%",`max-width:${Ft*100}%`,"box-sizing:border-box","padding:6px","overflow:hidden","pointer-events:auto"].join(";")}else if(Nt(t)){d.style.cssText=["position:absolute",f?"bottom:2px":"top:2px",u?"left:12px":"right:12px","display:flex","flex-wrap:wrap","gap:4px 12px",u?"justify-content:flex-start":"justify-content:flex-end","max-width:88%","pointer-events:auto"].join(";")}else{d.style.cssText=["position:absolute",f?"bottom:2px":"top:2px","left:12px","right:12px","display:flex","flex-wrap:wrap","gap:4px 12px","justify-content:center","pointer-events:auto"].join(";")}const h=new Map;for(const t of Array.from(d.children)){h.set(t.dataset.seriesIndex??"",t)}i.forEach(((t,e)=>{const s=String(t.seriesIndex);let c=h.get(s);if(!c){c=document.createElement("button");c.type="button";c.dataset.seriesIndex=s;c.append(document.createElement("span"),document.createElement("span"))}h.delete(s);Dt.set(c,t);c.style.cssText=["display:inline-flex","align-items:center","gap:6px","background:none","border:none","padding:2px 4px","cursor:pointer","white-space:nowrap",a?"flex:0 1 auto":"flex:none","min-width:0","max-width:100%",`font:400 ${n.texts[0]?.fontSize??11}px ${o}`,`color:${t.hidden?"var(--md-sys-color-outline, #79747E)":"var(--md-sys-color-on-surface-variant, #49454F)"}`,t.hidden?"text-decoration:line-through":""].join(";");c.setAttribute("aria-pressed",String(!t.hidden));const[r,i]=Array.from(c.children);r.style.cssText=`width:10px;height:10px;border-radius:3px;background:${t.color};opacity:${t.hidden?.4:1};flex:none`;i.style.cssText="overflow:hidden;text-overflow:ellipsis;min-width:0";if(i.textContent!==t.label)i.textContent=t.label;if(c.title!==t.label)c.title=t.label;if(d.children[e]!==c)d.insertBefore(c,d.children[e]??null)}));for(const t of h.values())t.remove();if(d.parentNode!==c)c.appendChild(d)}else{r?.remove()}}const Ot=700;const qt=t=>t<0?0:t>1?1:t;function jt(t){if(t<=0)return 0;if(t>=1)return 1;return 1-Math.exp(-7*t)*Math.cos(6*t)}function Rt(t){const n=qt(t);return 1-Math.pow(1-n,3)}function Vt(t){const n=qt(t);return n<.5?4*n*n*n:1-Math.pow(-2*n+2,3)/2}function Yt(t,n,o,e){const s=3*t;const c=3*(o-t)-s;const r=1-s-c;const i=3*n;const a=3*(e-n)-i;const f=1-i-a;const l=t=>((r*t+c)*t+s)*t;const u=t=>((f*t+a)*t+i)*t;const d=t=>(3*r*t+2*c)*t+s;return t=>{if(t<=0)return 0;if(t>=1)return 1;let n=t;for(let o=0;o<8;o++){const o=l(n)-t;if(Math.abs(o)<1e-6)return u(n);const e=d(n);if(Math.abs(e)<1e-6)break;n-=o/e}let o=0;let e=1;n=t;for(let s=0;s<24;s++){const s=l(n)-t;if(Math.abs(s)<1e-6)break;if(s>0)e=n;else o=n;n=(o+e)/2}return u(n)}}const Wt=Yt(.05,.7,.1,1);function Tt(t){switch(t){case"draw":case"stagger":return Vt;case"expressive":case"grow":case"fade":default:return Wt}}function Xt(){return typeof window!=="undefined"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function Zt(t){return t.horizontal??t.w>t.h}function Gt(t,n,o){if(Zt(t)){const e=o??t.x;const s=e+(t.x-e)*n;const c=e+(t.x+t.w-e)*n;return{...t,x:Math.min(s,c),w:Math.abs(c-s)}}const e=o??t.y+t.h;const s=e+(t.y-e)*n;const c=e+(t.y+t.h-e)*n;return{...t,y:Math.min(s,c),h:Math.abs(c-s)}}function Ht(t,n){if(t.polar){const o=new Map;for(const n of t.slices){const t=o.get(n.dataIndex);if(t===undefined||n.startAngle<t)o.set(n.dataIndex,n.startAngle)}return t.slices.map((t=>{const e=o.get(t.dataIndex);return{...t,startAngle:e+(t.startAngle-e)*n,endAngle:e+(t.endAngle-e)*n}}))}const o=qt(n);return t.slices.map((t=>({...t,innerR:t.innerR*o,outerR:t.outerR*o})))}function Jt(t,n){const o=t.plot.y+t.plot.height;const e=t=>o+(t-o)*n;const s=t=>t.map((t=>({x:t.x,y:e(t.y)})));return{...t,lines:t.lines.map((o=>{if(!o.radial)return{...o,points:s(o.points)};const e=t.plot.x+t.plot.width/2;const c=t.plot.y+t.plot.height/2;const r=qt(n);return{...o,points:o.points.map((t=>({x:e+(t.x-e)*r,y:c+(t.y-c)*r})))}})),areas:t.areas.map((t=>({...t,points:s(t.points),basePoints:t.basePoints?s(t.basePoints):undefined}))),markers:t.markers.map((t=>({...t,y:e(t.y)}))),glyphs:t.glyphs?.map((t=>({...t,y:e(t.y)}))),endLabels:t.endLabels?.map((t=>({...t,y:e(t.y)}))),bars:t.bars.map((o=>Gt(o,n,t.barBaseline))),slices:Ht(t,n)}}const Kt=.5;function Qt(t){return t.slices.filter((t=>!t.pill&&t.endAngle!==t.startAngle))}function Ut(t,n,o,e){const s=qt(e);const c=Qt(t);const r=Qt(n);if(!c.length||!r.length)return null;const i=c.find((t=>t.dataIndex===o))??c[0];const a=c[0].startAngle;const f=c.reduce(((t,n)=>t+(n.endAngle-n.startAngle)),0);const l=i.endAngle-i.startAngle;const u=f-l;const d=l+u*s;const h=i.startAngle+(a-i.startAngle)*s;const x=Math.abs(u)<1e-9?0:(f-d)/u;const p=[...c.slice(c.indexOf(i)+1),...c.slice(0,c.indexOf(i))];let y=h+d;const g=p.map((t=>{const n=(t.endAngle-t.startAngle)*x;const o=y;y+=n;return{...t,startAngle:o,endAngle:y}}));g.push({...i,startAngle:h,endAngle:h+d});const b=r[0].startAngle;const m=r.reduce(((t,n)=>t+(n.endAngle-n.startAngle)),0)||1;const M=t=>h+(t-b)/m*d;const w=r.map((t=>({...t,startAngle:M(t.startAngle),endAngle:M(t.endAngle)})));return{base:{...t,slices:g,lines:[],gridlines:[],texts:[]},over:{...n,slices:w,lines:[],gridlines:[],texts:[],background:undefined},overAlpha:qt(s/Kt)}}function tn(t,n){if(!t.length)return t;const o=[];for(let e=0;e<t.length;e++){const s=t[e];if(s.x<=n){o.push(s)}else{if(e>0){const c=t[e-1];const r=s.x-c.x||1;const i=(n-c.x)/r;o.push({x:n,y:c.y+(s.y-c.y)*i})}break}}return o}const nn=.3;function on(t,n,o,e,s=false){const c=qt(e);const r=s?Math.max(0,...t.bars.map((t=>t.dataIndex))):0;return{...t,bars:t.bars.map((n=>{const o=s&&r>0?n.dataIndex/r*nn:0;const e=Wt(qt((c-o)/(1-o||1)));return Gt(n,e,t.barBaseline)}))}}function en(t,n){const o=t.plot;const e=qt(n);const s=o.x+e*o.width;const c=o.y+e*o.height;return{...t,lines:t.lines.map((t=>t.radial?t:{...t,points:tn(t.points,s)})),areas:t.areas.map((t=>({...t,points:tn(t.points,s),basePoints:t.basePoints?tn(t.basePoints,s):undefined}))),markers:t.markers.filter((t=>t.x<=s)),glyphs:t.glyphs?.filter((t=>t.x<=s)),bars:t.bars.map((n=>{const o=Zt(n)?qt((c-n.y)/Math.max(n.h,1)):qt((s-n.x)/Math.max(n.w,1));return Gt(n,o,t.barBaseline)})),slices:t.slices.map((t=>({...t,endAngle:t.startAngle+(t.endAngle-t.startAngle)*e})))}}function sn(t){const n=new Set;for(const o of t.lines)n.add(o.seriesIndex??0);return[...n].sort(((t,n)=>t-n))}function cn(t,n){const o=sn(t);const e=o.length||1;const s=new Map(o.map(((t,n)=>[t,n])));const c=t.plot;const r=t=>{const o=s.get(t??0)??0;return c.x+Vt(qt(n*e-o))*c.width};const i=c.x+Vt(qt(n))*c.width;return{...t,lines:t.lines.map((t=>t.radial?t:{...t,points:tn(t.points,r(t.seriesIndex))})),areas:t.areas.map((t=>({...t,points:tn(t.points,r(t.seriesIndex)),basePoints:t.basePoints?tn(t.basePoints,r(t.seriesIndex)):undefined}))),markers:t.markers.filter((t=>t.x<=r(t.seriesIndex))),glyphs:t.glyphs?.filter((t=>t.x<=i)),bars:t.bars.map((n=>Gt(n,qt((i-n.x)/Math.max(n.w,1)),t.barBaseline))),slices:t.slices.map((t=>({...t,endAngle:t.startAngle+(t.endAngle-t.startAngle)*qt(n)})))}}function rn(t){let n=t.animation??(t.animate===false?"none":"expressive");const o=t.animationDuration!=null?t.animationDuration:Ot;const e=Number.isFinite(o)&&o>0;if(!e)n="none";return{variant:n,duration:e?o:Ot}}function an(t,n){const o=qt(n*2);if(o>=1)return t.gridlines;return t.gridlines.map((t=>({...t,color:s(t.color,o)})))}function fn(t,n,o){const e=Tt(t)(qt(o));switch(t){case"fade":return{scene:n,alpha:qt(e)};case"draw":return{scene:{...en(n,e),gridlines:an(n,e)},alpha:1};case"stagger":{const t=qt(o);return{scene:{...cn(n,t),gridlines:an(n,t)},alpha:1}}case"grow":case"expressive":default:return{scene:Jt(n,e),alpha:qt(e)}}}function ln(t){t.textContent="";delete t.dataset.hoverIndex}const un="var(--md-sys-color-surface, #FFFBFE)";const dn=new Set(["circle","square","diamond","triangle","triangle-down"]);const hn={diamond:"polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)",triangle:"polygon(50% 0%, 100% 100%, 0% 100%)","triangle-down":"polygon(0% 0%, 100% 0%, 50% 100%)"};function xn(t,n,o,e){const s=document.createElement("div");const c=`position:absolute;left:${o}px;top:${e}px;transform:translate(-50%,-50%);pointer-events:none`;if(t&&!dn.has(t)){s.textContent=t;s.style.cssText=`${c};font-size:22px;line-height:1;user-select:none`;return s}const r=t&&t!=="circle"?11:13;s.style.cssText=`${c};width:${r}px;height:${r}px;filter:drop-shadow(0 1px 2px rgba(0,0,0,0.3))`;if(!t||t==="circle"){s.style.cssText+=`;box-sizing:border-box;border-radius:50%;background:${n};border:2px solid ${un}`;return s}const i=hn[t]??"none";const a=document.createElement("div");a.style.cssText=`position:absolute;inset:-2px;background:${un};clip-path:${i}`;const f=document.createElement("div");f.style.cssText=`position:absolute;inset:0;background:${n};clip-path:${i}`;s.append(a,f);return s}function pn(t){if(typeof t.animate!=="function")return;t.animate([{transform:"translate(-50%,-50%) scale(0.4)",offset:0},{transform:"translate(-50%,-50%) scale(1.25)",offset:.45},{transform:"translate(-50%,-50%) scale(0.94)",offset:.72},{transform:"translate(-50%,-50%) scale(1)",offset:1}],{duration:320,easing:"cubic-bezier(0.2, 0, 0, 1)"})}function yn(t,n){return["position:absolute","pointer-events:none","background:var(--md-sys-color-surface-container-high, #ECE6F0)","color:var(--md-sys-color-on-surface, #1C1B1F)","border-radius:8px","padding:8px 10px","box-shadow:0 2px 6px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.2)",`font:400 ${t}px ${n}`]}function gn(n,o){if(t(o)){n.appendChild(o);return}if(typeof o==="object"&&typeof o.unsafeHtml==="string"){n.innerHTML=o.unsafeHtml;return}n.textContent=String(o)}function bn(t,n,o,e,s,c,r="vertical",i=-1,a={}){const f=t.dataset.hoverIndex!==String(o);t.textContent="";if(o<0){delete t.dataset.hoverIndex;return}const l=n.xPositions[o];if(l==null)return;t.dataset.hoverIndex=String(o);const u=f&&!Xt();const d=n.plot;let h=r==="horizontal"?d.x:d.y;let x=h+(r==="horizontal"?d.width:d.height);if(r!=="none"){for(const t of n.hoverPoints){const n=t.byIndex?.[o];if(!n)continue;const e=r==="horizontal"?n.x:n.y;h=Math.min(h,e);x=Math.max(x,e)}}const p=document.createElement("div");p.style.cssText=["position:absolute","box-sizing:border-box",r==="horizontal"?`left:${h}px;top:${l}px;width:${x-h}px;height:1px;transform:translateY(-50%)`:`left:${l}px;top:${h}px;height:${x-h}px;width:1px;transform:translateX(-50%)`,"background:var(--md-sys-color-on-surface, #1C1B1F)","box-shadow:0 0 0 1px var(--md-sys-color-surface, #FFFBFE)","opacity:0.7"].join(";");if(r!=="none")t.appendChild(p);const y=!!a.render;const g=[];const b=[];const m=[];const M=a.trigger==="item"&&i>=0;for(const s of n.hoverPoints){if(M&&s.seriesIndex!==i)continue;const n=s.valueFormat??e;const c=s.seriesIndex===i;const f=s.byIndex[o];if(f){const o=f.color??s.color;if(!s.unanchored&&r!=="none"){const n=xn(f.symbol,o,f.x,f.y);const e=i>=0&&!c;if(e)n.style.opacity="0.4";t.appendChild(n);if(u&&!e)pn(n)}const e=f.low!=null&&f.high!=null?`${n(f.low)} – ${n(f.high)}`:n(f.value);m.push({color:o,label:s.label,value:e});if(y)g.push({seriesIndex:s.seriesIndex,label:s.label,color:s.color,value:f.value,formattedValue:e,focused:c,missing:false});continue}if(!y&&!a.missingFormatter)continue;const l=s.values?.[o];const d=typeof l==="number"?null:l;const h=a.missingFormatter?a.missingFormatter(d):"";if(y)b.push({seriesIndex:s.seriesIndex,label:s.label,color:s.color,value:d,formattedValue:h,focused:c,missing:true});if(h)m.push({label:s.label,value:h})}const w=n.texts[0]?.fontSize??12;if(a.render){const e={dataIndex:o,axisValue:n.xValues[o],axisLabel:n.xLabels[o]??"",series:g,missing:b,focusedSeriesIndex:i};let f;try{f=a.render(e)}catch(t){console.error("[md-chart] tooltipRenderer threw; falling back to the default tooltip",t);f=undefined}if(f===null)return;if(f!==undefined){const o=document.createElement("div");o.setAttribute("part","tooltip");o.style.cssText=[...yn(w,s),"z-index:2","box-sizing:border-box",`max-width:${Math.max(0,n.width-8)}px`].join(";");gn(o,f);mn(o,t,n,c,r,l);return}}if(!m.length)return;const $=document.createElement("div");$.setAttribute("part","tooltip");$.style.cssText=[...yn(w,s),"min-width:96px","z-index:2","white-space:nowrap"].join(";");const v=document.createElement("div");v.textContent=n.xLabels[o]??"";v.style.cssText="font-weight:600;margin-bottom:4px";$.appendChild(v);for(const t of m){const n=document.createElement("div");n.style.cssText=`display:flex;align-items:center;gap:8px;line-height:1.5${t.color?"":";opacity:0.62"}`;const o=document.createElement("span");o.style.cssText=t.color?`width:10px;height:10px;border-radius:3px;background:${t.color};flex:none`:"width:10px;height:10px;flex:none";const e=document.createElement("span");e.textContent=t.label;e.style.cssText="flex:1";const s=document.createElement(t.color?"strong":"span");s.textContent=t.value;n.append(o,e,s);$.appendChild(n)}mn($,t,n,c,r,l,a.rtl)}function mn(t,n,o,e,s,c,r=false){n.appendChild(t);const i=t.offsetWidth||120;const a=t.offsetHeight||60;if(a+8>o.height){n.style.overflow="visible";const s=Math.max(24-i,Math.min(e.x-i/2,o.width-24));t.style.left=`${Math.round(s)}px`;const c=n.getBoundingClientRect();const r=c.top-a-6>=0;const f=o.plot?o.plot.y+o.plot.height:o.height;t.style.top=r?`${Math.round(-a-6)}px`:`${Math.round(f+6)}px`;return}let f;let l;if(s==="none"){f=e.x+14;if(f+i>o.width-4)f=e.x-i-14;f=Math.max(4,Math.min(f,o.width-i-4));l=e.y+14;if(l+a>o.height-4)l=e.y-a-14;l=Math.max(4,Math.min(l,o.height-a-4))}else if(s==="horizontal"){l=c+14;if(l+a>o.height-4)l=c-a-14;l=Math.max(4,l);f=r?Math.max(4,Math.min(e.x-i-14,o.width-i-4)):Math.max(4,Math.min(e.x+14,o.width-i-4))}else{f=r?c-i-14:c+14;if(r?f<4:f+i>o.width-4)f=r?c+14:c-i-14;f=Math.max(4,Math.min(f,o.width-i-4));l=Math.max(4,Math.min(e.y-a/2,o.height-a-4))}t.style.left=`${f}px`;t.style.top=`${l}px`}function Mn(t){let n=null;let o=null;let e=0;const s=()=>{if(typeof window==="undefined"||!window.matchMedia)return;const s=window.devicePixelRatio||1;if(s===e&&n)return;if(n&&o)n.removeEventListener?.("change",o);e=s;n=window.matchMedia(`(resolution: ${s}dppx)`);o=t;n.addEventListener?.("change",o)};const c=()=>{if(n&&o)n.removeEventListener?.("change",o);n=null;o=null;e=0};return{update:s,dispose:c}}function wn(t){switch(t){case"left":return"right";case"right":return"left";case"top-start":return"top-end";case"top-end":return"top-start";case"bottom-start":return"bottom-end";case"bottom-end":return"bottom-start";default:return t}}function $n(t){return t==="start"?"end":t==="end"?"start":"center"}function vn(t){const n=t.width;const o=t=>n-t;const e=t=>t.map((t=>({...t,x:o(t.x)})));const s=t=>({...t,x1:o(t.x1),x2:o(t.x2)});return{...t,plot:{...t.plot,x:o(t.plot.x+t.plot.width)},bands:t.bands?.map((t=>({...t,x:o(t.x+t.w)}))),gridlines:t.gridlines.map(s),axisLines:t.axisLines.map(s),areas:t.areas.map((t=>({...t,points:e(t.points),basePoints:t.basePoints?e(t.basePoints):undefined}))),bars:t.bars.map((t=>({...t,x:o(t.x+t.w)}))),barBaseline:t.barBaseline!=null&&t.bars[0]?.horizontal?o(t.barBaseline):t.barBaseline,slices:t.slices.map((t=>({...t,cx:o(t.cx),startAngle:Math.PI-t.endAngle,endAngle:Math.PI-t.startAngle}))),lines:t.lines.map((t=>({...t,points:e(t.points)}))),markers:t.markers.map((t=>({...t,x:o(t.x)}))),glyphs:t.glyphs?.map((t=>({...t,x:o(t.x)}))),endLabels:t.endLabels?.map((t=>({...t,x:o(t.x),side:t.side==="end"?"start":"end"}))),texts:t.texts.map((t=>({...t,x:o(t.x),align:$n(t.align),rotate:t.rotate?-t.rotate:t.rotate}))),legend:t.legend.map((t=>({...t,x:o(t.x)}))),xPositions:t.xPositions.map(o),hoverPoints:t.hoverPoints.map((t=>({...t,byIndex:Object.fromEntries(Object.entries(t.byIndex).map((([t,n])=>[t,{...n,x:o(n.x)}])))})))}}function kn(t){if(!t||typeof getComputedStyle!=="function")return false;try{return getComputedStyle(t).direction==="rtl"}catch{return false}}const zn=new Set;let Sn=null;function In(t){if(typeof MutationObserver==="undefined"||typeof document==="undefined"){return{dispose:()=>undefined}}zn.add(t);if(!Sn){Sn=new MutationObserver((()=>{for(const t of zn)t()}));Sn.observe(document.documentElement,{attributes:true,attributeFilter:["dir"],subtree:true})}return{dispose:()=>{zn.delete(t);if(!zn.size){Sn?.disconnect();Sn=null}}}}function Fn(t){const n=t.length;if(n<2||t[0][0]<=t[n-1][0])return t;return[...t].reverse()}export{at as A,Mt as B,U as C,R as D,P as E,C as F,A as G,D as H,_ as I,et as J,$t as K,on as L,Bt as M,i as N,c as O,Ft as P,Vt as Q,Ut as R,Rt as S,gn as T,jt as U,d as V,wn as W,h as a,w as b,In as c,v as d,bn as e,ln as f,Xt as g,rn as h,kn as i,Pt as j,Et as k,It as l,vn as m,fn as n,ht as o,$ as p,s as q,y as r,Lt as s,k as t,Fn as u,E as v,Mn as w,r as x,st as y,ft as z};
2
- //# sourceMappingURL=p-CGStn3Iq.js.map
1
+ function t(t){return!!t&&typeof t==="object"&&typeof t.nodeType==="number"&&typeof t.nodeName==="string"}function n(t){if(t.startsWith("#")){let n=t.slice(1);if(n.length===3)n=n.split("").map((t=>t+t)).join("");if(n.length===4)n=n.split("").map((t=>t+t)).join("");if(n.length<6)return null;const o=parseInt(n.slice(0,2),16)/255;const e=parseInt(n.slice(2,4),16)/255;const s=parseInt(n.slice(4,6),16)/255;const c=n.length>=8?parseInt(n.slice(6,8),16)/255:1;if(Number.isNaN(o)||Number.isNaN(e)||Number.isNaN(s))return null;return[o,e,s,c]}const n=t.match(/rgba?\(([^)]+)\)/);if(n){const t=n[1].split(/[,/]/).map((t=>t.trim()));const o=t=>t.endsWith("%")?parseFloat(t)/100*255:parseFloat(t);const e=o(t[0])/255;const s=o(t[1])/255;const c=o(t[2])/255;const r=t[3]!=null?t[3].endsWith("%")?parseFloat(t[3])/100:parseFloat(t[3]):1;return[e,s,c,Number.isNaN(r)?1:r]}return null}let o;function e(t){if(o===undefined){try{o=typeof document!=="undefined"?document.createElement("canvas").getContext("2d"):null}catch{o=null}}if(!o)return null;try{o.fillStyle="#000000";o.fillStyle=t;const n=o.fillStyle;if(typeof n!=="string")return null;if(n==="#000000"&&t.trim().toLowerCase()!=="black"&&t.trim()!=="#000000"&&t.trim()!=="#000"){return null}return n}catch{return null}}function s(t,n){const[o,e,s,r]=c(t);const i=Math.round(r*n*1e3)/1e3;return`rgba(${Math.round(o*255)}, ${Math.round(e*255)}, ${Math.round(s*255)}, ${i})`}function c(t){const o=t.trim();const s=n(o);if(s)return s;const c=e(o);if(c){const t=n(c);if(t)return t}return[.5,.5,.5,1]}function r(t){const[n,o,e]=c(t);return.299*n+.587*o+.114*e>.62?"#000000":"#ffffff"}function i(t,n,o){const e=c(t);const s=c(n);const r=Math.max(0,Math.min(1,o));const i=t=>Math.round((e[t]+(s[t]-e[t])*r)*255);return`rgba(${i(0)}, ${i(1)}, ${i(2)}, ${e[3]})`}const a=["primary","tertiary","secondary","error","primary-container","tertiary-container","secondary-container","error-container"];const f={primary:"--md-sys-color-primary",secondary:"--md-sys-color-secondary",tertiary:"--md-sys-color-tertiary",error:"--md-sys-color-error","primary-container":"--md-sys-color-primary-container","secondary-container":"--md-sys-color-secondary-container","tertiary-container":"--md-sys-color-tertiary-container","error-container":"--md-sys-color-error-container","surface-variant":"--md-sys-color-surface-variant",success:"--md-sys-color-success",warning:"--md-sys-color-warning",info:"--md-sys-color-info","success-container":"--md-sys-color-success-container","warning-container":"--md-sys-color-warning-container","info-container":"--md-sys-color-info-container"};const l={primary:"#6750A4",secondary:"#625B71",tertiary:"#7D5260",error:"#B3261E","primary-container":"#EADDFF","secondary-container":"#E8DEF8","tertiary-container":"#FFD8E4","error-container":"#F9DEDC","surface-variant":"#E7E0EC",success:"#2E6B4F",warning:"#7A5900",info:"#38608F","success-container":"#B8F0CE","warning-container":"#FFDF9B","info-container":"#D3E4FF"};function u(t,n,o){const e=o??getComputedStyle(t);const s=e.getPropertyValue(f[n]).trim();return s||l[n]}function d(t,n,o){const e=t.filter(Boolean);if(n<=0||e.length===0)return[];if(e.length===1)return Array.from({length:n},(()=>e[0]));const s=[];for(let t=0;t<n;t++){if(n===1){s.push(e[0]);continue}const o=t/(n-1)*(e.length-1);const c=Math.floor(o);const r=Math.min(e.length-1,c+1);const a=o-c;s.push(a===0?e[c]:a===1?e[r]:i(e[c],e[r],a))}if(!o||n<=e.length)return s;return s.map(((t,n)=>n%2===0?t:i(t,n%4===1?o.dark:o.light,.22)))}function h(t,n,o,e){if(!n)return o;if(n in f){return u(t,n,e)}if(!x(n)){console.warn(`[md-chart] "${n}" is not a colour role or a valid CSS colour — falling back. `+`Roles: ${Object.keys(f).join(", ")}.`);return o}return n}function x(t){if(typeof CSS==="undefined"||typeof CSS.supports!=="function")return true;return CSS.supports("color",t)}function p(t,n){if(!/var\(|color-mix\(/i.test(n))return n;const o=t.ownerDocument;const e=t.shadowRoot??t;if(!o||typeof getComputedStyle!=="function")return n;const s=o.createElement("span");s.style.cssText="position:absolute;inline-size:0;block-size:0;visibility:hidden";s.style.color=n;e.appendChild(s);const c=getComputedStyle(s).color;s.remove();return c||n}function y(t,n){if(!n?.length)return undefined;return n.map((n=>({from:n.from,to:n.to,color:n.color!=null?p(t,h(t,n.color,n.color)):undefined,label:n.label,labelAlign:n.labelAlign,labelColor:n.labelColor!=null?p(t,h(t,n.labelColor,n.labelColor)):undefined})))}function g(t){const n=t.match(/\d*\.?\d+(?:px|rem|em|pt|%)(?:\s*\/\s*\S+)?\s+(.+)$/);return(n?n[1]:t).trim()}function b(t,n,o){const e=t.getPropertyValue(n).trim();return e||o}function m(t,n,o){const e=t.getPropertyValue(n).trim();if(!e)return o;const s=parseFloat(e);return Number.isFinite(s)?s:o}function M(t){if(!t)return"cubicOut";const n=t.match(/cubic-bezier\(([^)]+)\)/);if(!n)return"cubicOut";const[o,e,s,c]=n[1].split(",").map((t=>parseFloat(t.trim())));if(o<.25&&c>.95)return"cubicOut";if(o>=.3&&e<.1)return"cubicIn";if(Math.abs(o-(1-c))<.15&&Math.abs(e-(1-s))<.15)return"cubicInOut";return"cubicOut"}function w(t){const n=getComputedStyle(t);const o=a.map((o=>u(t,o,n)));const e=m(n,"--md-sys-motion-duration-medium2",300);const c=b(n,"--md-sys-motion-easing-emphasized","cubic-bezier(0.2, 0, 0, 1)");const r=typeof window!=="undefined"&&typeof window.matchMedia==="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;const i=typeof window!=="undefined"&&typeof window.matchMedia==="function"&&window.matchMedia("(forced-colors: active)").matches;return{background:"transparent",textColor:b(n,"--md-sys-color-on-surface","#1C1B1F"),textColorMuted:b(n,"--md-sys-color-on-surface-variant","#49454F"),gridColor:(()=>{const t=b(n,"--md-chart-grid-color","");return t||s(b(n,"--md-sys-color-outline-variant","#CAC4D0"),.5)})(),axisLineColor:b(n,"--md-chart-axis-color",b(n,"--md-sys-color-outline-variant","#CAC4D0")),surface:b(n,"--md-sys-color-surface","#FFFBFE"),tooltipSurface:b(n,"--md-sys-color-inverse-surface",b(n,"--md-sys-color-on-surface","#322F35")),tooltipTextColor:b(n,"--md-sys-color-inverse-on-surface",b(n,"--md-sys-color-surface","#F5EFF7")),tooltipBorderColor:"transparent",tooltipShadow:b(n,"--md-sys-elevation-2","0px 1px 2px rgba(0,0,0,0.3), 0px 2px 6px 2px rgba(0,0,0,0.15)"),tooltipRadius:m(n,"--md-sys-shape-corner-small",8),palette:o,fontFamily:g(b(n,"--md-sys-typescale-label-medium-font",'"Roboto", system-ui, sans-serif')),labelSize:Math.max(9,m(n,"--md-sys-typescale-label-small-size",11)+m(n,"--md-sys-density-scale",0)*.5),titleSize:Math.max(11,m(n,"--md-sys-typescale-title-small-size",14)+m(n,"--md-sys-density-scale",0)*.5),motionDuration:r?0:e,motionEasing:M(c),reducedMotion:r,forcedColors:i}}function $(t,n){return t[n%t.length]}function v(t,n){if(t==null)return"";const o=n||undefined;if(t instanceof Date)return t.toLocaleString(o);if(typeof t==="number")return t.toLocaleString(o);return String(t)}function k(t,n){if(n==="category")return typeof t==="number"?t:0;if(t instanceof Date)return t.getTime();if(typeof t==="number")return t;const o=Number(t);if(!Number.isNaN(o)&&n!=="time")return o;const e=Date.parse(t);return Number.isNaN(e)?0:e}function z(t,n,o="value"){let[e,s]=t;if(e===s){e-=1;s+=1}const c=s-e;return{type:o,size:n,domain:[e,s],bandwidth:0,scale:t=>(t-e)/c*n,invert:t=>e+t/n*c}}function S(t,n){const o=t[1]>0?t[1]:1;const e=t[0]>0?t[0]:Math.max(o/1e6,Number.MIN_VALUE);const s=Math.log10(e);const c=Math.log10(Math.max(o,e*10));const r=c-s||1;return{type:"log",size:n,domain:[e,Math.pow(10,c)],bandwidth:0,scale:t=>(Math.log10(t<=0?e:t)-s)/r*n,invert:t=>Math.pow(10,s+t/n*r)}}function I(t,n,o=true){const e=Math.max(t,1);const s=n/e;const c=o?s/2:0;return{type:"category",size:n,domain:[0,e-1],bandwidth:s,scale:t=>c+t*s,invert:t=>Math.round((t-c)/s)}}const F=14;function A(t,n){const[o,e]=n[0]<=n[1]?n:[n[1],n[0]];const s=t.map((t=>({from:Math.max(o,Math.min(t.from,t.to)),to:Math.min(e,Math.max(t.from,t.to)),gap:t.gap??F}))).filter((t=>t.to>t.from&&t.from>o&&t.to<=e)).sort(((t,n)=>t.from-n.from));const c=[];for(const t of s){const n=c[c.length-1];if(n&&t.from<=n.to){n.to=Math.max(n.to,t.to);n.gap=Math.max(n.gap,t.gap)}else{c.push({...t})}}return c}function C(t,n,o){const e=t.map((t=>({...t})));if(!e.length||o==="log")return e;const s=e[e.length-1];if(n[1]-s.to>1e-9)return e;const c=e.length>1?e[e.length-2].to:n[0];const r=s.from-c;if(!(r>0))return e;const i=L(0,n[1],6);const a=i.length>1?i[1]-i[0]:0;const f=Math.max(r,a);const l=n[1]-f;if(l>s.from+1e-9)s.to=l;return e}function N(t,n={}){const o=n.minGap??8;const e=n.maxBreaks??2;const s=[...new Set(t.filter((t=>Number.isFinite(t))))].sort(((t,n)=>t-n));if(s.length<4)return[];const c=[];for(let t=1;t<s.length;t++){c.push({from:s[t-1],to:s[t],size:s[t]-s[t-1]})}const r=c.map((t=>t.size)).sort(((t,n)=>t-n));const i=r[Math.floor(r.length/2)]||0;if(i<=0)return[];const a=c.filter((t=>t.size>=i*o)).sort(((t,n)=>n.size-t.size)).slice(0,e);return a.map((t=>({from:t.from,to:t.to,gap:n.gap??F}))).sort(((t,n)=>t.from-n.from))}function E(t,n,o,e,s="equal"){const c=o==="log"?S(t,n):z(t,n,o);const r=A(e,c.domain);if(!r.length)return{...c,breaks:[]};const i=r.map((t=>({...t,fromPx:c.scale(t.from),toPx:c.scale(t.to)})));const a=i.reduce(((t,n)=>t+n.gap),0);const f=[];let l=0;for(const t of i){f.push({from:l,to:t.fromPx});l=t.toPx}f.push({from:l,to:n});const u=Math.max(0,n-a);const d=f.reduce(((t,n)=>t+Math.max(0,n.to-n.from)),0);const h=f.map((t=>{const n=Math.max(0,t.to-t.from);const o=s==="equal"?u/f.length:d>0?n/d*u:u/f.length;return{...t,width:n,out:o}}));let x=0;const p=h.map(((t,n)=>{const o=x;x+=t.out+(i[n]?.gap??0);return{...t,outStart:o}}));const y=i.map(((t,n)=>({from:t.from,to:t.to,gap:t.gap,px:p[n].outStart+p[n].out})));return{type:o,size:n,domain:c.domain,bandwidth:0,breaks:y,scale:t=>{const o=c.scale(t);for(let t=0;t<p.length;t++){const n=p[t];if(o<=n.to||t===p.length-1){if(o<n.from)return t>0?p[t-1].outStart+p[t-1].out:n.outStart;const e=n.width>0?(o-n.from)/n.width:1;return n.outStart+e*n.out}}return n},invert:t=>{for(let n=0;n<p.length;n++){const o=p[n];const e=o.outStart+o.out;if(t<=e||n===p.length-1){const n=o.out>0?(Math.max(t,o.outStart)-o.outStart)/o.out:0;return c.invert(o.from+n*o.width)}}return c.domain[1]}}}function P(t,n,o){if(!t)return{ranges:[],sizing:"equal"};const e=t==="auto"?{auto:true}:Array.isArray(t)?{ranges:t}:t;const s=e.gap??F;const c=(e.ranges??[]).map((t=>({from:k(t.from,o),to:k(t.to,o),gap:t.gap??s})));const r=e.auto?N(n,{minGap:e.minGap,maxBreaks:e.maxBreaks,gap:s}):[];return{ranges:[...c,...r],sizing:e.sizing??"equal"}}const B=3;function D(t,n,o,e=6){const s=(t,n,e)=>o==="log"?q(t,n):o==="time"?j(t,n,e):L(t,n,e);const c=A(n,t);if(!c.length)return s(t[0],t[1],e);const r=[];let i=t[0];for(const t of c){r.push([i,t.from]);i=t.to}r.push([i,t[1]]);const a=Math.max(3,Math.round(e/r.length));const f=(t,n)=>{let e=[];for(const c of[a,a*2,a*4]){e=s(t,n,c).filter((o=>o>=t-1e-9&&o<=n+1e-9));if(e.length>=B||o==="log")break}return e};const l=[];for(const[t,n]of r){if(n<=t)continue;l.push(...f(t,n))}return[...new Set(l)].sort(((t,n)=>t-n))}function _(t,n){return t.some((t=>n>t.from&&n<t.to))}function L(t,n,o=6){const e=Math.min(t,n);const s=Math.max(t,n);if(e===s)return[e];const c=O((s-e)/Math.max(o-1,1));const r=Math.floor(e/c)*c;const i=Math.ceil(s/c)*c;const a=[];const f=Math.round((i-r)/c)+1;for(let t=0;t<f;t++){const n=r+t*c;a.push(Math.abs(n)<c/1e6?0:n)}return a.filter((t=>t>=e-c/1e6&&t<=s+c/1e6))}function O(t,n){const o=Math.floor(Math.log10(t));const e=t/Math.pow(10,o);let s;{s=e<1.5?1:e<3?2:e<7?5:10}return s*Math.pow(10,o)}function q(t,n){const o=Math.floor(Math.log10(t>0?t:n/1e6));const e=Math.ceil(Math.log10(n));const s=[];for(let t=o;t<=e;t++)s.push(Math.pow(10,t));return s.filter((o=>o>=t&&o<=n))}function j(t,n,o=6){const e=n-t;if(e<=0)return[t];const s=1e3,c=60*s,r=60*c,i=24*r;const a=[s,5*s,15*s,30*s,c,5*c,15*c,30*c,r,3*r,6*r,12*r,i,2*i,7*i,14*i,30*i,90*i,180*i,365*i];const f=e/Math.max(o-1,1);const l=a.findIndex((t=>t>=f));let u=l===-1?a[a.length-1]:a[l];const d=l>0?a[l-1]:undefined;if(d&&e/d<=Math.max(o-1,1)*1.4)u=d;const h=Math.ceil(t/u)*u;const x=[];for(let t=h;t<=n;t+=u)x.push(t);return x}function R(t,n={scale:"value"}){const o=n.scale==="log";let e=Infinity;let s=-Infinity;let c=false;for(let n=0;n<t.length;n++){const r=t[n];if(!Number.isFinite(r))continue;if(o&&r<=0)continue;c=true;if(r<e)e=r;if(r>s)s=r}if(!c){e=o?1:0;s=o?10:1}const r=n.min!=null&&Number.isFinite(n.min);const i=n.max!=null&&Number.isFinite(n.max);let a=r?n.min:e;let f=i?n.max:s;if(o){if(!r&&a>0)a=Math.pow(10,Math.floor(Math.log10(a)));if(!i&&f>0)f=Math.pow(10,Math.ceil(Math.log10(f)));if(a===f){a/=10;f*=10}return[a,f]}if(n.includeZero){if(!r&&a>0)a=0;if(!i&&f<0)f=0}if(a===f){a-=1;f+=1}return[a,f]}const V={square:[45,135,225,315],diamond:[0,90,180,270],triangle:[-90,150,30],"triangle-down":[90,-30,210]};function Y(t,n,o,e){const s=t?V[t]:undefined;if(!s)return null;return s.map((t=>{const s=t*Math.PI/180;return{x:n+e*Math.cos(s),y:o+e*Math.sin(s)}}))}const W=20;const T=4;function X(t,n){const o=Math.max(1,Math.floor(n));if(t.length<=o*T)return t;const e=[];let s=Math.round(t[0].x);let c=0;let r=0;let i=0;let a=0;const f=()=>{const n=[c,i<a?i:a,i<a?a:i,r];let o=-1;for(const s of n){if(s!==o)e.push(t[s]);o=s}};for(let n=1;n<t.length;n++){const o=Math.round(t[n].x);if(o!==s){f();s=o;c=i=a=n}else{if(t[n].y<t[i].y)i=n;if(t[n].y>t[a].y)a=n}r=n}f();return e}function Z(t,n,o,e,s){const c=n+e;const r=o+s;let i=false;for(const e of t){if(e.x<n||e.x>c||e.y<o||e.y>r){i=true;break}}if(!i)return t;return t.map((t=>({x:t.x<n?n:t.x>c?c:t.x,y:t.y<o?o:t.y>r?r:t.y})))}function G(t,n){if(t.length<2)return t.slice();switch(n){case"linear":return t.slice();case"step":case"step-before":case"step-middle":return H(t,n);case"monotone":return K(t);case"smooth":default:return J(t)}}function H(t,n){const o=[t[0]];for(let e=1;e<t.length;e++){const s=t[e-1];const c=t[e];if(n==="step"){o.push({x:c.x,y:s.y},c)}else if(n==="step-before"){o.push({x:s.x,y:c.y},c)}else{const t=(s.x+c.x)/2;o.push({x:t,y:s.y},{x:t,y:c.y},c)}}return o}function J(t){const n=[t[0]];for(let o=0;o<t.length-1;o++){const e=t[o-1]??t[o];const s=t[o];const c=t[o+1];const r=t[o+2]??c;for(let t=1;t<=W;t++){const o=t/W;const i=o*o;const a=i*o;const f=.5*(2*s.x+(-e.x+c.x)*o+(2*e.x-5*s.x+4*c.x-r.x)*i+(-e.x+3*s.x-3*c.x+r.x)*a);const l=.5*(2*s.y+(-e.y+c.y)*o+(2*e.y-5*s.y+4*c.y-r.y)*i+(-e.y+3*s.y-3*c.y+r.y)*a);n.push({x:f,y:l})}}return n}function K(t){const n=t.length;const o=[];const e=[];for(let s=0;s<n-1;s++){const n=t[s+1].x-t[s].x||1e-6;o.push(n);e.push((t[s+1].y-t[s].y)/n)}const s=[e[0]];for(let t=1;t<n-1;t++){if(e[t-1]*e[t]<=0){s.push(0)}else{const n=2*o[t]+o[t-1];const c=o[t]+2*o[t-1];s.push((n+c)/(n/e[t-1]+c/e[t]))}}s.push(e[n-2]);const c=[t[0]];for(let e=0;e<n-1;e++){const n=t[e];const r=t[e+1];const i=o[e];for(let t=1;t<=W;t++){const o=t/W;const a=o*o;const f=a*o;const l=2*f-3*a+1;const u=f-2*a+o;const d=-2*f+3*a;const h=f-a;c.push({x:n.x+o*i,y:l*n.y+u*i*s[e]+d*r.y+h*i*s[e+1]})}}return c}function Q(t,n){const o=[];let e=[];for(let s=0;s<t.length;s++){const c=t[s];if(c===undefined)continue;if(c==null||!Number.isFinite(c)){if(n)continue;if(e.length){o.push(e);e=[]}continue}e.push({index:s,value:c})}if(e.length)o.push(e);return o}function U(t,n,o){const e=Math.max(0,...t.map((t=>t.length)));const s=t.map((()=>[]));const c=n==="silhouette"||n==="wiggle";for(let r=0;r<e;r++){const e=new Map;const i=new Map;const a=new Map;const f=(t,n,o)=>t.set(n,(t.get(n)??0)+o);for(let n=0;n<t.length;n++){const s=t[n][r];const c=o[n]??"stacked";if(c==="__unstacked__"||s==null||!Number.isFinite(s))continue;f(e,c,s);if(s>=0)f(i,c,s);else f(a,c,-s)}const l=new Map;const u=new Map;for(let f=0;f<t.length;f++){const d=t[f][r];if(d===undefined){s[f][r]=undefined;continue}if(d==null||!Number.isFinite(d)){s[f][r]=null;continue}const h=o[f]??"stacked";const x=n!=="none"&&h!=="__unstacked__";if(!x){s[f][r]=[0,d];continue}const p=c?-(e.get(h)??0)/2:0;if(!l.has(h))l.set(h,p);if(!u.has(h))u.set(h,p);const y=i.get(h)??0;const g=a.get(h)??0;let b=d;if(n==="percentage"){b=d>=0?y>0?d/y*100:0:g>0?d/g*100:0}if(b>=0){const t=l.get(h);s[f][r]=[t,t+b];l.set(h,t+b)}else{const t=u.get(h);s[f][r]=[t+b,t];u.set(h,t+b)}}}return s}function tt(t){const n=!t.range&&t.stroke!==false;const o=t.showMarks||!!t.markIndices?.length||!!t.pointSymbols;return n||o}const nt=5;function ot(t,n){return t.length*n*.58}function et(t,n,o){let e=1;let s=0;for(const c of t){const t=ot(c,n)+28;if(s>0&&s+t>o){e++;s=t}else{s+=t}}return e}function st(t,n=1){if(t==="dashed")return[n*3.5,n*3];if(t==="dotted")return[Math.max(1,n*.4),n*2.6];return undefined}const ct=30;const rt=3;const it=4;function at(t,n,o,e,s,c){const r=[];const i=s-e;if(i<=0)return r;const a=(n+o)/2;const f=Math.min(it,(o-n)/2);const l=Math.max(4,Math.round(i/rt));const u=t=>{const n=e+i*t/l;return{p:n,off:a+f*Math.sin(n/ct*Math.PI*2)}};let d=u(0);for(let n=1;n<=l;n++){const o=u(n);r.push(t==="y"?{x1:d.p,y1:d.off,x2:o.p,y2:o.off,color:c,width:1.5}:{x1:d.off,y1:d.p,x2:o.off,y2:o.p,color:c,width:1.5});d=o}return r}function ft(t,n,o,e,s,c,r){const i=[];let a=n;const f=(n,o)=>t==="y"?{x1:e,y1:n,x2:e,y2:o,color:c,width:1,dash:r}:{x1:n,y1:e,x2:o,y2:e,color:c,width:1,dash:r};for(const t of s){const o=n+t.px;if(o>a)i.push(f(a,o));a=o+t.gap}if(o>a)i.push(f(a,o));return i}const lt=8;function ut(t,n,o,e,s,c){const r=[];const i=[];if(!t?.length)return{rects:r,labels:i};const a=n==="y";const f=a?e.y:e.x;const l=a?e.y+e.height:e.x+e.width;t.forEach(((t,n)=>{const u=o(t.from);const d=o(t.to);if(!Number.isFinite(u)||!Number.isFinite(d))return;const h=Math.max(f,Math.min(u,d));const x=Math.min(l,Math.max(u,d));if(x<=h)return;const p=t.color??dt(s.axisLineColor,.07);r.push(a?{x:e.x,y:h,w:e.width,h:x-h,color:p}:{x:h,y:e.y,w:x-h,h:e.height,color:p});if(!t.label)return;const y=t.labelAlign??"start";const g=y==="center"?a?e.x+e.width/2:e.y+e.height/2:y==="end"?a?e.x+e.width-lt:e.y+e.height-lt:a?e.x+lt:e.y+lt;i.push({x:a?g:h+lt,y:a?h+lt:g,text:t.label,color:t.labelColor??s.textColorMuted,fontSize:s.labelSize,align:a?y==="center"?"center":y:"start",baseline:a?"top":y==="center"?"middle":y==="end"?"bottom":"top",key:`${c}-${n}`})}));return{rects:r,labels:i}}function dt(t,n){if(t.startsWith("#")){let o=t.slice(1);if(o.length===3)o=o.split("").map((t=>t+t)).join("");const e=parseInt(o.slice(0,2),16);const s=parseInt(o.slice(2,4),16);const c=parseInt(o.slice(4,6),16);return`rgba(${e}, ${s}, ${c}, ${n})`}if(t.startsWith("rgb("))return t.replace(/^rgb\(/,"rgba(").replace(/\)$/,`, ${n})`);return t}function ht(t,n,o,e){if(t.inverted)return pt(t,n,o,e);if(t.yAxes&&t.yAxes.length>0)return xt(t,n,o,e);t.series.filter((t=>!t.hidden));const s=t.xValues.length||Math.max(0,...t.series.map((t=>t.data.length)));const c=t.series.map((n=>t.stack!=="none"&&!n.range?"stacked":"__unstacked__"));const r=U(t.series.map((t=>t.hidden?[]:t.data)),t.stack,c);t.series.forEach(((t,n)=>{if(!t.range||t.hidden)return;r[n]=t.range.map((t=>t?[Math.min(t[0],t[1]),Math.max(t[0],t[1])]:t))}));const i=[];t.series.forEach(((t,n)=>{if(t.hidden)return;r[n].forEach((t=>{if(t){i.push(t[0],t[1])}}))}));const a=R(i,{min:t.yMin,max:t.yMax,scale:t.yScale,includeZero:t.stack!=="none"||t.yScale==="value"});const f=t.xValues.map((n=>k(n,t.xScale)));const l=R(f,{scale:t.xScale});const u={ranges:[],sizing:"equal"};const d=t.compact?u:P(t.yBreaks,i,t.yScale);const h=t.compact||t.xScale==="category"?u:P(t.xBreaks,f,t.xScale);const x={...d,ranges:A(d.ranges,a)};const p={...h,ranges:A(h.ranges,l)};const y=D(a,x.ranges,t.yScale,6).filter((t=>!_(x.ranges,t)));const g=y.map((n=>(t.yTickFormatter??t.yFormatter)(n)));const b=t.yHidden||t.yHideTicks?0:Math.max(0,...g.map((t=>ot(t,n.labelSize))));const m=t.subtitle?n.labelSize+4:0;const M=t.title?n.titleSize+10+m:0;const w=t.xHidden||t.xHideTicks?0:n.labelSize+8;const $=t.yLabel?n.labelSize+6:0;const v=t.xLabel?n.labelSize+6:0;const z=!!t.legend&&t.legend!=="none"&&t.series.length>1;const S=z&&(t.legend==="left"||t.legend==="right");const F=z&&!S&&t.legend.startsWith("bottom");const C=z&&!S&&!F;const N=C||F?et(t.series.map((t=>t.label)),n.labelSize,o*.86):1;const B=t.legendExtent!=null&&(C||F)?t.legendExtent+8:N*(n.labelSize+8)+6;const L=C?B:0;const O=F?B:0;const q=S?t.legendExtent!=null?t.legendExtent+16:Math.max(0,...t.series.map((t=>ot(t.label,n.labelSize))))+34:0;const j=t.seriesLabels?Math.max(0,...t.series.filter((t=>!t.hidden)).map((t=>ot(t.label,n.labelSize))))+20:0;const V=!!t.compact;const Y=V?Math.max(2,...t.series.filter((t=>!t.hidden&&(t.showMarks||(t.markIndices?.length??0)>0||t.pointSymbols))).map((t=>mt(t.symbol,t.markSize)+2))):0;const W=V?Y:M+8+L;const T=V?Y:12+ot(g[g.length-1]??"",n.labelSize)/2+(t.legend==="right"?q:0)+j;const H=V?Y:w+v+6+O;const J=V?Y:b+10+$+(t.legend==="left"?q:0);const K={x:J,y:W,width:Math.max(1,o-J-T),height:Math.max(1,e-W-H)};const ct=t.xScale==="category"?I(s,K.width,true):E(l,K.width,t.xScale,p.ranges,p.sizing);const rt=E(a,K.height,t.yScale,x.ranges,x.sizing);const it=t=>K.y+K.height-rt.scale(t);const lt=n=>K.x+(t.xScale==="category"?ct.scale(n):ct.scale(k(t.xValues[n],t.xScale)));const ht=[];const gt=[];if(!V){const o=ut(t.yBands,"y",(n=>it(k(n,t.yScale))),K,n,"yband");const e=ut(t.xBands,"x",(n=>K.x+ct.scale(t.xScale==="category"?Number(n):k(n,t.xScale))),K,n,"xband");gt.push(...o.rects,...e.rects);ht.push(...o.labels,...e.labels)}const wt=[];const $t=[];const vt=st(t.yGridDash,1);const kt=st(t.xGridDash,1);const zt=st(t.yDash,1);const St=st(t.xDash,1);if(!t.yHidden&&!V){for(const o of y){const e=it(o);if(t.gridY!==false){wt.push({x1:K.x,y1:e,x2:K.x+K.width,y2:e,color:n.gridLineColor,width:1,dash:vt})}if(t.axisTicks){$t.push({x1:K.x-nt,y1:e,x2:K.x,y2:e,color:n.axisLineColor,width:1,dash:zt})}}const o=(rt.breaks??[]).map((t=>({px:K.height-t.px-t.gap,gap:t.gap})));$t.push(...ft("y",K.y,K.y+K.height,K.x,o,n.axisLineColor,zt));for(const t of o){$t.push(...at("y",K.y+t.px,K.y+t.px+t.gap,K.x,K.x+K.width,n.axisLineColor))}}if(!t.xHidden&&!V){const t=K.y+K.height;const o=(ct.breaks??[]).map((t=>({px:t.px,gap:t.gap})));$t.push(...ft("x",K.x,K.x+K.width,t,o,n.axisLineColor,St));for(const t of o){$t.push(...at("x",K.x+t.px,K.x+t.px+t.gap,K.y,K.y+K.height,n.axisLineColor))}}const It=[];const Ft=[];const At=[];const Ct=[];const Nt=[];const Et=[];const Pt=it(Math.max(a[0],0));const Bt=t=>{if(!x.ranges.length&&!p.ranges.length)return[t];const n=[];let o=[];let e="";for(const s of t){const t=f[s.index];if(_(x.ranges,s.value)||t!==undefined&&_(p.ranges,t)){if(o.length)n.push(o);o=[];e="";continue}const c=x.ranges.filter((t=>s.value>=t.to)).length+":"+p.ranges.filter((n=>t!==undefined&&t>=n.to)).length;if(e&&c!==e&&o.length){n.push(o);o=[]}e=c;o.push(s)}if(o.length)n.push(o);return n};t.series.forEach(((o,e)=>{if(o.hidden)return;const s=Q(r[e].map((t=>t===undefined?undefined:t?t[1]:null)),o.connectNulls).flatMap(Bt);const c={};let i;for(const a of s){if(!a.length)continue;const s=a.map((t=>({x:lt(t.index),y:it(t.value)})));i=s[s.length-1];a.forEach(((t,n)=>{const i=o.pointSymbols?.[t.index]??(o.symbol&&o.symbol!=="none"?o.symbol:"circle");const a=o.range?r[e][t.index]:undefined;c[t.index]={x:s[n].x,y:s[n].y,value:o.data[t.index]??t.value,symbol:i,...a?{low:a[0],high:a[1]}:{}}}));const f=Z(G(X(s,K.width),o.curve),K.x,K.y,K.width,K.height);const l=o.dashAfter!=null?a.findIndex((t=>t.index>=o.dashAfter)):-1;const u=o.lineWidth??2.5;if(o.range||o.stroke===false);else if(l>0&&l<a.length){It.push({points:Z(G(X(s.slice(0,l+1),K.width),o.curve),K.x,K.y,K.width,K.height),color:o.color,width:u,dash:st(o.dash,u),seriesIndex:e});It.push({points:Z(G(X(s.slice(l),K.width),o.curve),K.x,K.y,K.width,K.height),color:o.color,width:u,dash:st("dotted",u),seriesIndex:e})}else if(l===0){It.push({points:f,color:o.color,width:u,dash:st("dotted",u),seriesIndex:e})}else{It.push({points:f,color:o.color,width:u,dash:st(o.dash,u),seriesIndex:e})}if(t.area&&o.fill!==false){const n=t.fillOpacity??.35;const s=t.stack!=="none"||o.range?Z(G(a.map((t=>({x:lt(t.index),y:it(r[e][t.index][0])}))),o.curve),K.x,K.y,K.width,K.height):undefined;Ft.push({points:f,baselineY:Pt,colorTop:dt(o.color,n),colorBottom:s?dt(o.color,n):dt(o.color,Math.max(.02,n*.06)),basePoints:s,seriesIndex:e})}const d=o.markIndices?new Set(o.markIndices):null;a.forEach(((t,c)=>{const r=t.index;const i=o.pointSymbols?.[r];const a=d?d.has(r):o.showMarks;const f=i??(a?o.symbol??"circle":undefined);if(!f||f==="none")return;const l=s[c];if(bt(f)){At.push({x:l.x,y:l.y,r:mt(f,o.markSize),color:o.color,symbol:f,seriesIndex:e,hollow:o.hollow,fill:o.hollow?n.surface:undefined})}else{Ct.push({x:l.x,y:l.y,text:f,size:yt})}}));if(t.showLabels&&!V){a.forEach(((e,c)=>{const r=s[c].y-9-n.labelSize>=K.y;Ct.push({x:s[c].x,y:s[c].y,text:t.yFormatter(o.data[e.index]??e.value),size:n.labelSize,label:{color:n.textColor,weight:600,dx:0,dy:r?-9:9,anchorX:"-50%",anchorY:r?"-100%":"0"}})}))}}if(t.seriesLabels&&i&&!V){At.push({x:i.x,y:i.y,r:4,color:o.color,symbol:"circle",seriesIndex:e});Nt.push({key:`sl-${e}`,x:i.x,y:i.y,text:o.label,color:n.textColor,size:n.labelSize+1,visible:true})}Et.push({seriesIndex:e,color:o.color,label:o.label,byIndex:c,values:o.data,unanchored:!tt(o)})}));if(Nt.length>1){const t=n.labelSize+5;let o=-Infinity;for(const n of[...Nt].sort(((t,n)=>t.y-n.y))){n.visible=n.y-o>=t;if(n.visible)o=n.y}}const Dt=[];if(t.refBands){for(const n of t.refBands){const t=lt(n.from);const o=lt(n.to);const e=Math.min(t,o);const s=Math.abs(o-t);if(s<=0)continue;Dt.push({x:e,y:K.y,w:s,h:K.height,color:n.color,radius:[0,0,0,0],seriesIndex:-1,dataIndex:-1})}}const _t=[...ht];if(t.title&&!V){const o=Mt(t.titleAlign,K.x,K.width);_t.push({x:o.x,y:L+6,text:t.title,color:n.textColor,fontSize:n.titleSize,fontWeight:600,align:o.align,baseline:"top",key:"title"});if(t.subtitle){_t.push({x:o.x,y:L+6+n.titleSize+4,text:t.subtitle,color:n.textColorMuted,fontSize:n.labelSize,align:o.align,baseline:"top",key:"subtitle"})}}if(t.markLines&&!V){for(const o of t.markLines){const e=t.xScale==="category"?Number(o.value):k(o.value,t.xScale);const s=K.x+ct.scale(e);if(!Number.isFinite(s)||s<K.x-1||s>K.x+K.width+1)continue;wt.push({x1:s,y1:K.y,x2:s,y2:K.y+K.height,color:o.color??n.axisLineColor,width:1.5,dash:st(o.dash??"dashed",1.5)});if(o.label){_t.push({x:s+4,y:K.y+2,text:o.label,color:n.textColorMuted,fontSize:n.labelSize,align:"start",baseline:"top",key:`markline-${Math.round(s)}`})}}}if(!t.yHidden&&!t.yHideTicks&&!V){y.forEach(((t,o)=>{_t.push({x:K.x-8,y:it(t),text:g[o],color:n.textColorMuted,fontSize:n.labelSize,align:"end",baseline:"middle",key:`yt-${o}`})}))}const Lt=[];for(let t=0;t<s;t++)Lt.push(lt(t));const Ot=[];if(t.xScale==="category"){const n=Math.max(1,Math.ceil(s/Math.max(1,Math.floor(K.width/60))));for(let o=0;o<s;o+=n){Ot.push({px:Lt[o],text:t.xFormatter(t.xValues[o]??o),key:`xt-${o}`})}}else if(s){const n=R(f,{scale:t.xScale});const o=Math.max(2,Math.floor(K.width/90));const e=D(n,p.ranges,t.xScale,o).filter((t=>!_(p.ranges,t)));for(const n of e){const o=K.x+ct.scale(n);if(o<K.x-1||o>K.x+K.width+1)continue;Ot.push({px:o,text:t.xFormatter(t.xScale==="time"?new Date(n):n),key:`xt-${n}`})}}if(!V){for(const o of Ot){if(t.gridX&&o.px>K.x+.5){wt.push({x1:o.px,y1:K.y,x2:o.px,y2:K.y+K.height,color:n.gridLineColor,width:1,dash:kt})}if(t.axisTicks&&!t.xHidden){const t=K.y+K.height;$t.push({x1:o.px,y1:t,x2:o.px,y2:t+nt,color:n.axisLineColor,width:1,dash:St})}if(t.xHidden||t.xHideTicks)continue;_t.push({x:o.px,y:K.y+K.height+6,text:o.text,color:n.textColorMuted,fontSize:n.labelSize,align:"center",baseline:"top",key:o.key})}}if(t.xLabel&&!V){_t.push({x:K.x+K.width/2,y:e-O-2,text:t.xLabel,color:n.textColor,fontSize:n.labelSize,align:"center",baseline:"bottom",key:"x-axis-title"})}if(t.yLabel&&!V){_t.push({x:4,y:K.y+K.height/2,text:t.yLabel,color:n.textColor,fontSize:n.labelSize,align:"center",baseline:"top",rotate:-90,key:"y-axis-title"})}const qt=t.legend==="none"||V?[]:t.series.map(((t,n)=>({label:t.label,color:t.color,seriesIndex:n,hidden:t.hidden,x:0,y:0})));const jt=[];for(let n=0;n<s;n++)jt.push(t.xFormatter(t.xValues[n]??n));return{width:o,height:e,plot:K,background:n.background==="transparent"?undefined:n.background,bands:gt,gridlines:wt,axisLines:$t,areas:Ft,bars:Dt,slices:[],lines:It,markers:At,glyphs:Ct,endLabels:Nt,texts:_t,legend:qt,legendPosition:t.legend,xPositions:Lt,xValues:t.xValues,xLabels:jt,hoverPoints:Et}}function xt(t,n,o,e){const s=t.yAxes??[];const c=t.xValues.length||Math.max(0,...t.series.map((t=>t.data.length)));const r=t=>{const n=t.yAxisIndex??0;return n>=0&&n<s.length?n:0};const i=s.map(((o,e)=>{const s=t.series.filter((t=>!t.hidden&&r(t)===e));const c=[];for(const t of s)for(const n of t.data)if(typeof n==="number"&&Number.isFinite(n))c.push(n);const i=R(c,{min:o.min,max:o.max,scale:o.scale,includeZero:o.scale==="value"});const a=o.scale==="log"?q(i[0],i[1]):L(i[0],i[1],6);const f=a.map((t=>o.formatter(t)));const l=o.position??(e===0?"left":"right");const u=o.hidden||o.hideTicks?0:Math.max(0,...f.map((t=>ot(t,n.labelSize))));const d=o.label?n.labelSize+6:0;const h=o.hidden?4:u+12+d;const x=o.color??null;return{spec:o,domain:i,tickVals:a,tickLabels:f,side:l,gutterW:h,tint:x,hasData:s.length>0}}));const a=i.filter((t=>t.side==="left"));const f=i.filter((t=>t.side==="right"));const l=t=>t.reduce(((t,n)=>t+n.gutterW),0);const u=t.title?n.titleSize+10+(t.subtitle?n.labelSize+4:0):0;const d=t.xHidden||t.xHideTicks?0:n.labelSize+8;const h=t.xLabel?n.labelSize+6:0;const x=!!t.legend&&t.legend!=="none"&&t.series.length>1;const p=x&&(t.legend==="left"||t.legend==="right");const y=x&&!p&&t.legend.startsWith("bottom");const g=x&&!p&&!y;const b=g||y?et(t.series.map((t=>t.label)),n.labelSize,o*.86):1;const m=t.legendExtent!=null&&(g||y)?t.legendExtent+8:b*(n.labelSize+8)+6;const M=g?m:0;const w=y?m:0;const $=p?t.legendExtent!=null?t.legendExtent+16:Math.max(0,...t.series.map((t=>ot(t.label,n.labelSize))))+34:0;const v=t.xHidden||t.xHideTicks?"":t.xFormatter(t.xValues[c-1]??c-1);const F=f.length===0?ot(v,n.labelSize)/2:0;const A=u+8+M;const C=d+h+6+w;const N=l(a)+8+(t.legend==="left"?$:0);const E=l(f)+8+F+(t.legend==="right"?$:0);const P={x:N,y:A,width:Math.max(1,o-N-E),height:Math.max(1,e-A-C)};const B=t.xScale==="category"?I(c,P.width,true):t.xScale==="log"?S(R(t.xValues.map((n=>k(n,t.xScale))),{scale:"log"}),P.width):z(R(t.xValues.map((n=>k(n,t.xScale))),{scale:t.xScale}),P.width,t.xScale);const D=n=>P.x+(t.xScale==="category"?B.scale(n):B.scale(k(t.xValues[n],t.xScale)));const _=t=>{t.scale=t.spec.scale==="log"?S(t.domain,P.height):z(t.domain,P.height,t.spec.scale);t.toPxY=n=>P.y+P.height-t.scale.scale(n)};let O=0;for(const t of a){t.axisX=P.x-O;_(t);O+=t.gutterW}let V=0;for(const t of f){t.axisX=P.x+P.width+V;_(t);V+=t.gutterW}const Y=[];const W=[];i.forEach(((t,o)=>{const e=ut(t.spec.bands,"y",(n=>t.toPxY(k(n,t.spec.scale))),P,n,`yband-${o}`);Y.push(...e.rects);W.push(...e.labels)}));{const o=ut(t.xBands,"x",(n=>P.x+B.scale(t.xScale==="category"?Number(n):k(n,t.xScale))),P,n,"xband");Y.push(...o.rects);W.push(...o.labels)}const T=[];const H=[];const J=i.find((t=>!t.spec.hidden&&t.hasData))??i.find((t=>t.hasData));const K=st(t.xDash,1);const U=st(t.xGridDash,1);if(J&&t.gridY!==false){const o=st(J.spec.gridDash,1);for(const e of J.tickVals){const s=J.toPxY(e);T.push({x1:P.x,y1:s,x2:P.x+P.width,y2:s,color:n.gridLineColor,width:1,dash:o});if(t.axisTicks)H.push({x1:P.x-nt,y1:s,x2:P.x,y2:s,color:n.axisLineColor,width:1,dash:st(J.spec.dash,1)})}}for(const o of i){if(o.spec.hidden)continue;const e=o.tint??n.axisLineColor;const s=st(o.spec.dash,1);H.push({x1:o.axisX,y1:P.y,x2:o.axisX,y2:P.y+P.height,color:e,width:1,dash:s});if(t.axisTicks&&!o.spec.hideTicks){const t=o.side==="left"?-1:1;for(const n of o.tickVals){const c=o.toPxY(n);H.push({x1:o.axisX,y1:c,x2:o.axisX+t*nt,y2:c,color:e,width:1,dash:s})}}}if(!t.xHidden){H.push({x1:P.x,y1:P.y+P.height,x2:P.x+P.width,y2:P.y+P.height,color:n.axisLineColor,width:1,dash:K})}const ct=[];const rt=[];const it=[];const at=[];const ft=[];t.series.forEach(((o,e)=>{if(o.hidden)return;const s=i[r(o)];const c=s.toPxY;const a=s.domain[0]<=0&&s.domain[1]>=0;const f=c(a?0:s.domain[0]);const l=Q(o.data.map((t=>t===undefined?undefined:typeof t==="number"?t:null)),o.connectNulls);const u={};for(const r of l){if(!r.length)continue;const i=r.map((t=>({x:D(t.index),y:c(t.value)})));r.forEach(((t,n)=>{const e=o.pointSymbols?.[t.index]??(o.symbol&&o.symbol!=="none"?o.symbol:"circle");u[t.index]={x:i[n].x,y:i[n].y,value:o.data[t.index]??t.value,symbol:e}}));const a=Z(G(X(i,P.width),o.curve),P.x,P.y,P.width,P.height);ct.push({points:a,color:o.color,width:2.5,dash:st(o.dash,2.5),seriesIndex:e});if(t.area&&o.fill!==false){const n=t.fillOpacity??.35;rt.push({points:a,baselineY:f,colorTop:dt(o.color,n),colorBottom:dt(o.color,Math.max(.02,n*.06)),seriesIndex:e})}const l=o.markIndices?new Set(o.markIndices):null;r.forEach(((t,n)=>{const s=t.index;const c=o.pointSymbols?.[s];const r=l?l.has(s):o.showMarks;const a=c??(r?o.symbol??"circle":undefined);if(!a||a==="none")return;const f=i[n];if(bt(a))it.push({x:f.x,y:f.y,r:mt(a,o.markSize),color:o.color,symbol:a,seriesIndex:e});else at.push({x:f.x,y:f.y,text:a,size:yt})}));if(t.showLabels){r.forEach(((t,e)=>{const c=i[e].y-9-n.labelSize>=P.y;at.push({x:i[e].x,y:i[e].y,text:s.spec.formatter(o.data[t.index]??t.value),size:n.labelSize,label:{color:n.textColor,weight:600,dx:0,dy:c?-9:9,anchorX:"-50%",anchorY:c?"-100%":"0"}})}))}}ft.push({seriesIndex:e,color:o.color,label:o.label,byIndex:u,values:o.data,valueFormat:s.spec.formatter,unanchored:!tt(o)})}));const lt=[...W];if(t.title){const o=Mt(t.titleAlign,P.x,P.width);lt.push({x:o.x,y:M+6,text:t.title,color:n.textColor,fontSize:n.titleSize,fontWeight:600,align:o.align,baseline:"top",key:"title"});if(t.subtitle){lt.push({x:o.x,y:M+6+n.titleSize+4,text:t.subtitle,color:n.textColorMuted,fontSize:n.labelSize,align:o.align,baseline:"top",key:"subtitle"})}}i.forEach(((t,o)=>{if(t.spec.hidden)return;const e=t.tint??n.textColorMuted;if(!t.spec.hideTicks){t.tickVals.forEach(((s,c)=>{lt.push({x:t.side==="left"?t.axisX-8:t.axisX+8,y:t.toPxY(s),text:t.tickLabels[c],color:e,fontSize:n.labelSize,align:t.side==="left"?"end":"start",baseline:"middle",key:`yt-${o}-${c}`})}))}if(t.spec.label){const e=t.side==="left"?t.axisX-t.gutterW+n.labelSize:t.axisX+t.gutterW-n.labelSize;lt.push({x:e,y:P.y+P.height/2,text:t.spec.label,color:t.tint??n.textColor,fontSize:n.labelSize,align:"center",baseline:"top",rotate:-90,key:`yaxis-title-${o}`})}}));const ht=[];for(let t=0;t<c;t++)ht.push(D(t));const xt=P.y+P.height;const pt=[];if(t.xScale==="category"){const n=Math.max(1,Math.ceil(c/Math.max(1,Math.floor(P.width/60))));for(let o=0;o<c;o++){if(o%n!==0)continue;pt.push({px:ht[o],text:t.xFormatter(t.xValues[o]??o),key:`xt-${o}`})}}else{const n=R(t.xValues.map((n=>k(n,t.xScale))),{scale:t.xScale});const o=t.xScale==="log"?q(n[0],n[1]):t.xScale==="time"?j(n[0],n[1],Math.max(2,Math.floor(P.width/90))):L(n[0],n[1],Math.max(2,Math.floor(P.width/90)));for(const n of o){const o=P.x+B.scale(n);if(o<P.x-1||o>P.x+P.width+1)continue;pt.push({px:o,text:t.xFormatter(t.xScale==="time"?new Date(n):n),key:`xt-${n}`})}}if(t.gridX)for(const t of pt)T.push({x1:t.px,y1:P.y,x2:t.px,y2:xt,color:n.gridLineColor,width:1,dash:U});if(!t.xHidden&&!t.xHideTicks){for(const o of pt){if(t.axisTicks)H.push({x1:o.px,y1:xt,x2:o.px,y2:xt+nt,color:n.axisLineColor,width:1,dash:K});lt.push({x:o.px,y:xt+6,text:o.text,color:n.textColorMuted,fontSize:n.labelSize,align:"center",baseline:"top",key:o.key})}}if(t.xLabel){lt.push({x:P.x+P.width/2,y:e-w-2,text:t.xLabel,color:n.textColor,fontSize:n.labelSize,align:"center",baseline:"bottom",key:"x-axis-title"})}const gt=t.legend==="none"?[]:t.series.map(((t,n)=>({label:t.label,color:t.color,seriesIndex:n,hidden:t.hidden,x:0,y:0})));const wt=[];for(let n=0;n<c;n++)wt.push(t.xFormatter(t.xValues[n]??n));return{width:o,height:e,plot:P,background:n.background==="transparent"?undefined:n.background,bands:Y,gridlines:T,axisLines:H,areas:rt,bars:[],slices:[],lines:ct,markers:it,glyphs:at,endLabels:[],texts:lt,legend:gt,legendPosition:t.legend,xPositions:ht,xValues:t.xValues,xLabels:wt,hoverPoints:ft}}function pt(t,n,o,e){const s=t.xValues.length||Math.max(0,...t.series.map((t=>t.data.length)));const c=!!t.compact;const r=t.xScale==="category";const i=t.series.map((n=>t.stack!=="none"&&!n.range?"stacked":"__unstacked__"));const a=U(t.series.map((t=>t.hidden?[]:t.data)),t.stack,i);t.series.forEach(((t,n)=>{if(!t.range||t.hidden)return;a[n]=t.range.map((t=>t?[Math.min(t[0],t[1]),Math.max(t[0],t[1])]:t))}));const f=[];t.series.forEach(((t,n)=>{if(t.hidden)return;for(const t of a[n])if(t)f.push(t[0],t[1])}));const l=R(f,{min:t.yMin,max:t.yMax,scale:t.yScale,includeZero:false});const u=t.yScale==="log"?q(l[0],l[1]):L(l[0],l[1],8);const d=u.map((n=>(t.yTickFormatter??t.yFormatter)(n)));const h=r?[0,Math.max(1,s-1)]:R(t.xValues.map((n=>k(n,t.xScale))),{scale:t.xScale});const x=r?Array.from({length:s},((t,n)=>n)):L(h[0],h[1],6);const p=x.map((n=>r?t.xFormatter(t.xValues[n]??n):t.xFormatter(n)));const y=!!t.legend&&t.legend!=="none"&&t.series.length>1;const g=y&&(t.legend==="left"||t.legend==="right");const b=y&&!g&&t.legend.startsWith("bottom");const m=y&&!g&&!b;const M=m||b?et(t.series.map((t=>t.label)),n.labelSize,o*.86):1;const w=t.legendExtent!=null&&(m||b)?t.legendExtent+8:M*(n.labelSize+8)+6;const $=m?w:0;const v=b?w:0;const F=g?t.legendExtent!=null?t.legendExtent+16:Math.max(0,...t.series.map((t=>ot(t.label,n.labelSize))))+34:0;const A=t.title?n.titleSize+10+(t.subtitle?n.labelSize+4:0):0;const C=t.xHidden||t.xHideTicks?0:Math.max(0,...p.map((t=>ot(t,n.labelSize))));const N=t.yHidden||t.yHideTicks?0:n.labelSize+8;const E=t.xLabel?n.labelSize+6:0;const P=t.yLabel?n.labelSize+6:0;const B=c?2:A+8+$;const D=c?2:12+ot(d[d.length-1]??"",n.labelSize)/2+(t.legend==="right"?F:0);const _=c?2:N+P+6+v;const O=c?2:C+10+E+(t.legend==="left"?F:0);const j={x:O,y:B,width:Math.max(1,o-O-D),height:Math.max(1,e-B-_)};const V=t.yScale==="log"?S(l,j.width):z(l,j.width,t.yScale);const Y=r?I(s,j.height,true):t.xScale==="log"?S(h,j.height):z(h,j.height,t.xScale);const W=t=>j.x+V.scale(t);const T=t=>j.y+j.height-Y.scale(t);const H=n=>T(r?n:k(t.xValues[n],t.xScale));const J=[];const K=[];const ct=j.y+j.height;const rt=st(t.yDash,1);const it=st(t.yGridDash,1);const at=st(t.xDash,1);const ft=st(t.xGridDash,1);if(!t.yHidden&&!c){for(const o of u){const e=W(o);if(t.gridY!==false)J.push({x1:e,y1:j.y,x2:e,y2:ct,color:n.gridLineColor,width:1,dash:it});if(t.axisTicks)K.push({x1:e,y1:ct,x2:e,y2:ct+nt,color:n.axisLineColor,width:1,dash:rt})}K.push({x1:j.x,y1:ct,x2:j.x+j.width,y2:ct,color:n.axisLineColor,width:1,dash:rt})}if(!t.xHidden&&!c){for(const o of x){const e=T(o);if(t.gridX)J.push({x1:j.x,y1:e,x2:j.x+j.width,y2:e,color:n.gridLineColor,width:1,dash:ft});if(t.axisTicks)K.push({x1:j.x-nt,y1:e,x2:j.x,y2:e,color:n.axisLineColor,width:1,dash:at})}K.push({x1:j.x,y1:j.y,x2:j.x,y2:j.y+j.height,color:n.axisLineColor,width:1,dash:at})}const lt=[];const ut=[];const ht=[];const xt=[];const pt=[];const gt=W(Math.max(l[0],Math.min(l[1],0)));t.series.forEach(((o,e)=>{if(o.hidden)return;const s={};for(const r of Q(a[e].map((t=>t===undefined?undefined:t?t[1]:null)),o.connectNulls)){if(!r.length)continue;const i=r.map((t=>({x:W(t.value),y:H(t.index)})));r.forEach(((t,n)=>{const e=o.pointSymbols?.[t.index]??(o.symbol&&o.symbol!=="none"?o.symbol:"circle");s[t.index]={x:i[n].x,y:i[n].y,value:o.data[t.index]??t.value,symbol:e}}));const f=Z(G(X(i,j.width),o.curve),j.x,j.y,j.width,j.height);if(!o.range&&o.stroke!==false){lt.push({points:f,color:o.color,width:2.5,dash:st(o.dash,2.5),seriesIndex:e})}if(t.area&&o.fill!==false){const n=t.fillOpacity??.35;const s=t.stack!=="none"||!!o.range;ut.push({points:f,baselineY:gt,colorTop:dt(o.color,n),colorBottom:s?dt(o.color,n):dt(o.color,Math.max(.02,n*.06)),basePoints:t.stack!=="none"||o.range?Z(G(r.map((t=>({x:W(a[e][t.index][0]),y:H(t.index)}))),o.curve),j.x,j.y,j.width,j.height):f.map((t=>({x:gt,y:t.y}))),horizontal:true,seriesIndex:e})}const l=o.markIndices?new Set(o.markIndices):null;r.forEach(((t,n)=>{const s=o.pointSymbols?.[t.index];const c=s??((l?l.has(t.index):o.showMarks)?o.symbol??"circle":undefined);if(!c||c==="none")return;const r=i[n];if(bt(c))ht.push({x:r.x,y:r.y,r:mt(c,o.markSize),color:o.color,symbol:c,seriesIndex:e});else xt.push({x:r.x,y:r.y,text:c,size:yt})}));if(t.showLabels&&!c){r.forEach(((e,s)=>{xt.push({x:i[s].x,y:i[s].y,text:t.yFormatter(o.data[e.index]??e.value),size:n.labelSize,label:{color:n.textColor,weight:600,dx:9,dy:0,anchorX:"0",anchorY:"-50%"}})}))}}pt.push({seriesIndex:e,color:o.color,label:o.label,byIndex:s,values:o.data,unanchored:!tt(o)})}));const wt=[];if(t.title&&!c){const o=Mt(t.titleAlign,j.x,j.width);wt.push({x:o.x,y:$+6,text:t.title,color:n.textColor,fontSize:n.titleSize,fontWeight:600,align:o.align,baseline:"top",key:"title"});if(t.subtitle){wt.push({x:o.x,y:$+6+n.titleSize+4,text:t.subtitle,color:n.textColorMuted,fontSize:n.labelSize,align:o.align,baseline:"top",key:"subtitle"})}}if(!t.xHidden&&!t.xHideTicks&&!c){x.forEach(((t,o)=>{wt.push({x:j.x-8,y:T(t),text:p[o],color:n.textColorMuted,fontSize:n.labelSize,align:"end",baseline:"middle",key:`mt-${o}`})}))}if(!t.yHidden&&!t.yHideTicks&&!c){u.forEach(((t,o)=>{wt.push({x:W(t),y:ct+6,text:d[o],color:n.textColorMuted,fontSize:n.labelSize,align:"center",baseline:"top",key:`vt-${o}`})}))}if(t.xLabel&&!c){wt.push({x:4,y:j.y+j.height/2,text:t.xLabel,color:n.textColor,fontSize:n.labelSize,align:"center",baseline:"top",rotate:-90,key:"x-axis-title"})}if(t.yLabel&&!c){wt.push({x:j.x+j.width/2,y:e-v-2,text:t.yLabel,color:n.textColor,fontSize:n.labelSize,align:"center",baseline:"bottom",key:"y-axis-title"})}const $t=t.legend==="none"||c?[]:t.series.map(((t,n)=>({label:t.label,color:t.color,seriesIndex:n,hidden:t.hidden,x:0,y:0})));const vt=[];const kt=[];for(let n=0;n<s;n++){vt.push(H(n));kt.push(t.xFormatter(t.xValues[n]??n))}return{width:o,height:e,plot:j,background:n.background==="transparent"?undefined:n.background,gridlines:J,axisLines:K,areas:ut,bars:[],slices:[],lines:lt,markers:ht,glyphs:xt,texts:wt,legend:$t,legendPosition:t.legend,inverted:true,xPositions:vt,xValues:t.xValues,xLabels:kt,hoverPoints:pt}}const yt=18;const gt=new Set(["circle","square","diamond","triangle","triangle-down"]);function bt(t){return gt.has(t)}function mt(t,n){if(n!=null&&n>0)return n;if(t==="square"||t==="diamond")return 4.2;if(t==="triangle"||t==="triangle-down")return 4.6;return 3.5}function Mt(t,n,o){if(t==="center")return{x:n+o/2,align:"center"};if(t==="end")return{x:n+o,align:"end"};return{x:n,align:"start"}}const wt=32;function $t(t){return Math.min(t*.3,wt)}function vt(t,n){const o=n.horizontal??n.w>n.h;const e=$t(o?n.h:n.w);const s=n.notch===false?0:e;if(o){const o=n.y+n.h/2;if(n.arrow===1){t.moveTo(n.x,n.y);t.lineTo(n.x+n.w,n.y);t.lineTo(n.x+n.w+e,o);t.lineTo(n.x+n.w,n.y+n.h);t.lineTo(n.x,n.y+n.h);if(s)t.lineTo(n.x+s,o)}else{t.moveTo(n.x+n.w,n.y);t.lineTo(n.x,n.y);t.lineTo(n.x-e,o);t.lineTo(n.x,n.y+n.h);t.lineTo(n.x+n.w,n.y+n.h);if(s)t.lineTo(n.x+n.w-s,o)}}else{const o=n.x+n.w/2;if(n.arrow===1){t.moveTo(n.x,n.y+n.h);t.lineTo(n.x,n.y);t.lineTo(o,n.y-e);t.lineTo(n.x+n.w,n.y);t.lineTo(n.x+n.w,n.y+n.h);if(s)t.lineTo(o,n.y+n.h-s)}else{t.moveTo(n.x,n.y);t.lineTo(n.x,n.y+n.h);t.lineTo(o,n.y+n.h+e);t.lineTo(n.x+n.w,n.y+n.h);t.lineTo(n.x+n.w,n.y);if(s)t.lineTo(o,n.y+s)}}t.closePath()}function kt(t,n,o=true){const{cx:e,cy:s,innerR:c,outerR:r,startAngle:i,endAngle:a}=n;const f=a<i;const l=f?-1:1;const u=Math.abs(a-i);const d=(t,n)=>({x:e+Math.cos(n)*t,y:s+Math.sin(n)*t});const h=u>=Math.PI*2-.01;const x=h?0:Math.min((n.gap??0)/2,r*Math.sin(u/2)*.4);const p=t=>x>0&&t>x?Math.asin(Math.min(1,x/t)):0;const y=i+l*p(r);const g=a-l*p(r);if(l*(g-y)<=0)return;const b=(t,n,o)=>{const e=(i+a)/2;const s=t+n*p(o);return n*l>0?Math.min(s*l,e*l)*l:Math.max(s*l,e*l)*l};const m=Math.min(Math.abs(g-y),Math.PI/2)/4;const M=(r-c)/2;const w=r*Math.tan(m);const $=c>0?c*Math.tan(m):Infinity;const v=Math.max(0,Math.min(n.cornerRadius??0,M,w,$));const k=b(i,l,Math.max(c,.01));const z=b(a,-l,Math.max(c,.01));if(o)t.beginPath();if(v<.5){const n=d(c,k);t.moveTo(n.x,n.y);const o=d(r,y);t.lineTo(o.x,o.y);t.arc(e,s,r,y,g,f);const i=d(c,z);t.lineTo(i.x,i.y);if(c>0&&l*(z-k)>0)t.arc(e,s,c,z,k,!f);t.closePath();return}const S=r-v;const I=Math.asin(Math.min(1,v/S))*l;const F=Math.sqrt(Math.max(0,S*S-v*v));const A=y+I;const C=g-I;const N=c>0;const E=c+v;const P=Math.asin(Math.min(1,v/E))*l;const B=Math.sqrt(Math.max(0,E*E-v*v));const D=b(i,l,E);const _=b(a,-l,E);const L=D+P;const O=_-P;const q=y+(f?Math.PI/2:-Math.PI/2);const j=g+(f?-Math.PI/2:Math.PI/2);const R=d(N?B:0,D);t.moveTo(R.x,R.y);const V=d(F,y);t.lineTo(V.x,V.y);t.arc(d(S,A).x,d(S,A).y,v,q,A,f);t.arc(e,s,r,A,C,f);t.arc(d(S,C).x,d(S,C).y,v,C,j,f);const Y=d(F,g);t.lineTo(Y.x,Y.y);if(N){const n=d(B,_);t.lineTo(n.x,n.y);t.arc(d(E,O).x,d(E,O).y,v,j,O+Math.PI,f);if(l*(O-L)>0)t.arc(e,s,c,O,L,!f);t.arc(d(E,L).x,d(E,L).y,v,L+Math.PI,q,f)}else{const n=d(0,_);t.lineTo(n.x,n.y)}t.closePath()}function zt(t,n,o){const e=!!n.horizontal;const s=t=>e?t.x:t.y;const c=n.points.map(s);if(o)c.push(...n.basePoints.map(s));c.push(n.baselineY);const r=Math.min(...c);const i=Math.max(...c);const a=e?t.createLinearGradient(r,0,i,0):t.createLinearGradient(0,r,0,i);const f=i-r;if(f<1e-6){a.addColorStop(0,n.colorTop);a.addColorStop(1,n.colorBottom);return a}const l=(n.baselineY-r)/f;if(l<=1e-4){a.addColorStop(0,n.colorBottom);a.addColorStop(1,n.colorTop)}else if(l>=1-1e-4){a.addColorStop(0,n.colorTop);a.addColorStop(1,n.colorBottom)}else{a.addColorStop(0,n.colorTop);a.addColorStop(l,n.colorBottom);a.addColorStop(1,n.colorTop)}return a}const St="#010203";function It(t,n,o=true){if(o)t.clearRect(0,0,n.width,n.height);if(n.background){t.fillStyle=n.background;t.fillRect(0,0,n.width,n.height)}for(const o of n.bands??[]){t.fillStyle=St;t.fillStyle=o.color;if(t.fillStyle===St)continue;t.fillRect(o.x,o.y,o.w,o.h)}for(const o of n.gridlines){t.beginPath();t.strokeStyle=o.color;t.lineWidth=o.width;if(o.dash)t.setLineDash(o.dash);t.moveTo(o.x1,o.y1);t.lineTo(o.x2,o.y2);t.stroke();if(o.dash)t.setLineDash([])}for(const o of n.areas){if(o.points.length<2)continue;const n=!!(o.basePoints&&o.basePoints.length);t.beginPath();t.moveTo(o.points[0].x,o.points[0].y);for(let n=1;n<o.points.length;n++)t.lineTo(o.points[n].x,o.points[n].y);if(n){for(let n=o.basePoints.length-1;n>=0;n--)t.lineTo(o.basePoints[n].x,o.basePoints[n].y)}else{t.lineTo(o.points[o.points.length-1].x,o.baselineY);t.lineTo(o.points[0].x,o.baselineY)}t.closePath();t.fillStyle=zt(t,o,n);t.fill()}for(const o of n.axisLines){t.beginPath();t.strokeStyle=o.color;t.lineWidth=o.width;if(o.dash)t.setLineDash(o.dash);t.moveTo(o.x1,o.y1);t.lineTo(o.x2,o.y2);t.stroke();if(o.dash)t.setLineDash([])}for(const o of n.bars){if(o.w<=0||o.h<=0)continue;t.beginPath();t.fillStyle=o.color;if(o.arrow){vt(t,o);t.fill();continue}const n=Math.min(o.w,o.h)/2;const e=o.radius.map((t=>Math.max(0,Math.min(t,n))));if(typeof t.roundRect==="function"){t.roundRect(o.x,o.y,o.w,o.h,e)}else{t.rect(o.x,o.y,o.w,o.h)}t.fill()}const e=n.slices.filter((t=>!t.pill&&t.gap&&t.gapColor&&t.endAngle!==t.startAngle));if(e.length){t.beginPath();for(const n of e)kt(t,{...n,gap:0},false);t.fillStyle=e[0].gapColor;t.fill()}for(const o of n.slices){if(o.endAngle===o.startAngle)continue;if(o.pill){const n=(o.innerR+o.outerR)/2;const e=Math.abs(o.outerR-o.innerR);if(e<=0||n<=0)continue;const s=o.capStart!==undefined||o.capEnd!==undefined;t.beginPath();t.fillStyle=o.color;t.strokeStyle=o.color;t.lineWidth=e;t.lineCap=s?"butt":"round";t.arc(o.cx,o.cy,n,o.startAngle,o.endAngle,o.endAngle<o.startAngle);t.stroke();if(s){const s=s=>{t.beginPath();t.arc(o.cx+n*Math.cos(s),o.cy+n*Math.sin(s),e/2,0,Math.PI*2);t.fill()};if(o.capStart)s(o.startAngle);if(o.capEnd)s(o.endAngle)}t.lineCap="butt";continue}if(o.gradient){const n=(o.startAngle+o.endAngle)/2;const e=t.createLinearGradient(o.cx+Math.cos(n)*o.innerR,o.cy+Math.sin(n)*o.innerR,o.cx+Math.cos(n)*o.outerR,o.cy+Math.sin(n)*o.outerR);e.addColorStop(0,o.gradient.from);e.addColorStop(1,o.gradient.to);t.fillStyle=e}else{t.fillStyle=o.color}kt(t,o);t.fill()}const s=n.ripple;if(s&&s.alpha>0&&s.radius>0){const o=n.slices.find((t=>!t.pill&&t.dataIndex===s.dataIndex));if(o){t.save();kt(t,o);t.clip();t.globalAlpha*=s.alpha;t.fillStyle=s.color;t.beginPath();t.arc(s.x,s.y,s.radius,0,Math.PI*2);t.fill();t.restore()}}t.lineJoin="round";t.lineCap="round";for(const o of n.lines){if(o.points.length<2){if(o.points.length===1){t.beginPath();t.fillStyle=o.color;t.arc(o.points[0].x,o.points[0].y,o.width,0,Math.PI*2);t.fill()}continue}t.beginPath();t.strokeStyle=o.color;t.lineWidth=o.width;t.lineCap=o.cap??"round";t.setLineDash(o.dash??[]);t.moveTo(o.points[0].x,o.points[0].y);for(let n=1;n<o.points.length;n++)t.lineTo(o.points[n].x,o.points[n].y);t.stroke()}t.setLineDash([]);t.lineCap="round";for(const o of n.markers){t.beginPath();const n=Y(o.symbol,o.x,o.y,o.r);if(n){t.moveTo(n[0].x,n[0].y);for(let o=1;o<n.length;o++)t.lineTo(n[o].x,n[o].y);t.closePath()}else{t.arc(o.x,o.y,o.r,0,Math.PI*2)}if(o.hollow){t.fillStyle=o.fill??"rgba(0,0,0,0)";t.fill();t.lineWidth=2;t.strokeStyle=o.color;t.stroke()}else{t.fillStyle=o.color;t.fill();t.lineWidth=1.5;t.strokeStyle="rgba(255,255,255,0.9)";t.stroke()}}}const Ft=.3;const At={start:"0",center:"-50%",end:"-100%"};const Ct={top:"0",middle:"-50%",bottom:"-100%"};function Nt(t){return t.includes("-")}function Et(t,n=[],o="sans-serif"){const e=new Set;for(const s of n){e.add(s.key);let n=t.querySelector(`[data-k="${s.key}"]`);if(!n){n=document.createElement("span");n.dataset.k=s.key;n.style.cssText="position:absolute;white-space:nowrap;pointer-events:none;user-select:none;font-weight:500;opacity:0;transition:opacity 240ms ease";t.appendChild(n);n.getBoundingClientRect()}n.textContent=s.text;const c=s.side==="end";n.style.transform=c?"translate(-100%,-50%)":"translate(0,-50%)";n.style.left=`${c?s.x-12:s.x+12}px`;n.style.top=`${s.y}px`;n.style.fontSize=`${s.size}px`;n.style.color=s.color;n.style.fontFamily=o;n.style.opacity=s.visible?"1":"0"}for(const n of Array.from(t.children)){if(!e.has(n.dataset.k??"")){n.style.opacity="0";n.dataset.gone="1";setTimeout((()=>{if(n.dataset.gone==="1")n.remove()}),280)}else{n.removeAttribute("data-gone")}}}function Pt(t,n=[],o="sans-serif"){t.textContent="";for(const e of n){const n=document.createElement("span");n.textContent=e.text;const s=e.label;n.style.cssText=s?["position:absolute",`left:${e.x+s.dx}px`,`top:${e.y+s.dy}px`,`transform:translate(${s.anchorX},${s.anchorY})`,`font:${s.weight} ${e.size}px ${o}`,`color:${s.color}`,"line-height:1","white-space:nowrap","pointer-events:none","user-select:none"].join(";"):["position:absolute",`left:${e.x}px`,`top:${e.y}px`,"transform:translate(-50%,-50%)",`font-size:${e.size}px`,"line-height:1","pointer-events:none","user-select:none"].join(";");t.appendChild(n)}}function Bt(t,n,o="sans-serif"){t.textContent="";const e=n.barLabels;if(!e?.length)return;for(const s of e){const e=n.bars.filter((t=>t.seriesIndex===s.seriesIndex&&t.dataIndex===s.dataIndex));if(!e.length)continue;const c=!!e[0].horizontal;let r=Infinity;let i=-Infinity;let a=Infinity;let f=-Infinity;for(const t of e){r=Math.min(r,t.x);i=Math.max(i,t.x+t.w);a=Math.min(a,t.y);f=Math.max(f,t.y+t.h)}let l;let u;let d;let h;if(s.inside){l=(r+i)/2;u=(a+f)/2;d="center";h="middle";const t=e[0].arrow;if(t){const n=$t(c?f-a:i-r);const o=e[0].notch===false?0:n;const s=t*(n+o)/2;if(c)l+=s;else u-=s}}else if(c){u=(a+f)/2;h="middle";l=s.atLowEnd?r-4:i+4;d=s.atLowEnd?"end":"start"}else{l=(r+i)/2;d="center";u=s.atLowEnd?f+4:a-4;h=s.atLowEnd?"top":"bottom"}const x=document.createElement("span");x.textContent=s.text;x.style.cssText=["position:absolute",`left:${l}px`,`top:${u}px`,`transform:translate(${At[d]},${Ct[h]})`,`color:${s.color}`,`font:${s.fontWeight??400} ${s.size}px ${o}`,"white-space:nowrap","pointer-events:none","user-select:none"].join(";");t.appendChild(x)}}const Dt=new WeakMap;const _t=new WeakMap;function Lt(t,n,o,e={},s=false,c=t){const r=Array.from(c.children).find((t=>t.getAttribute("part")==="legend"))??null;for(const n of Array.from(t.childNodes)){if(n!==r)n.remove()}for(const e of n.texts){const n=document.createElement("span");n.textContent=e.text;if(e.key)n.dataset.key=e.key;n.style.cssText=["position:absolute",`left:${e.x}px`,`top:${e.y}px`,`transform:translate(${At[e.align]},${Ct[e.baseline]})${e.rotate?` rotate(${e.rotate}deg)`:""}`,`color:${e.color}`,`font:${e.fontWeight??400} ${e.fontSize}px ${o}`,"white-space:nowrap","pointer-events:none"].join(";");t.insertBefore(n,r?.parentNode===t?r:null)}const i=n.legend.filter((t=>n.legend.length>1));if(i.length){const t=n.legendPosition??"top-end";const a=t==="left"||t==="right";const f=t.startsWith("bottom");const l=t.endsWith("start")||t.endsWith("end")?t.endsWith("start")!==s:t==="left";const u=l;const d=r??document.createElement("div");d.setAttribute("part","legend");if(!_t.has(d)){d.addEventListener("click",(t=>{const n=t.target?.closest?.("button[data-series-index]");const o=n?Dt.get(n):undefined;if(o)_t.get(d)?.onLegendClick?.(o)}))}_t.set(d,e);if(a){d.style.cssText=["position:absolute","top:50%",t==="left"?"left:12px":"right:12px","transform:translateY(-50%)","display:flex","flex-direction:column","align-items:flex-start","gap:6px","max-height:92%",`max-width:${Ft*100}%`,"box-sizing:border-box","padding:6px","overflow:hidden","pointer-events:auto"].join(";")}else if(Nt(t)){d.style.cssText=["position:absolute",f?"bottom:2px":"top:2px",u?"left:12px":"right:12px","display:flex","flex-wrap:wrap","gap:4px 12px",u?"justify-content:flex-start":"justify-content:flex-end","max-width:88%","pointer-events:auto"].join(";")}else{d.style.cssText=["position:absolute",f?"bottom:2px":"top:2px","left:12px","right:12px","display:flex","flex-wrap:wrap","gap:4px 12px","justify-content:center","pointer-events:auto"].join(";")}const h=new Map;for(const t of Array.from(d.children)){h.set(t.dataset.seriesIndex??"",t)}i.forEach(((t,e)=>{const s=String(t.seriesIndex);let c=h.get(s);if(!c){c=document.createElement("button");c.type="button";c.dataset.seriesIndex=s;c.append(document.createElement("span"),document.createElement("span"))}h.delete(s);Dt.set(c,t);c.style.cssText=["display:inline-flex","align-items:center","gap:6px","background:none","border:none","padding:2px 4px","cursor:pointer","white-space:nowrap",a?"flex:0 1 auto":"flex:none","min-width:0","max-width:100%",`font:400 ${n.texts[0]?.fontSize??11}px ${o}`,`color:${t.hidden?"var(--md-sys-color-outline, #79747E)":"var(--md-sys-color-on-surface-variant, #49454F)"}`,t.hidden?"text-decoration:line-through":""].join(";");c.setAttribute("aria-pressed",String(!t.hidden));const[r,i]=Array.from(c.children);r.style.cssText=`width:10px;height:10px;border-radius:3px;background:${t.color};opacity:${t.hidden?.4:1};flex:none`;i.style.cssText="overflow:hidden;text-overflow:ellipsis;min-width:0";if(i.textContent!==t.label)i.textContent=t.label;if(c.title!==t.label)c.title=t.label;if(d.children[e]!==c)d.insertBefore(c,d.children[e]??null)}));for(const t of h.values())t.remove();if(d.parentNode!==c)c.appendChild(d)}else{r?.remove()}}const Ot=700;const qt=t=>t<0?0:t>1?1:t;function jt(t){if(t<=0)return 0;if(t>=1)return 1;return 1-Math.exp(-7*t)*Math.cos(6*t)}function Rt(t){const n=qt(t);return 1-Math.pow(1-n,3)}function Vt(t){const n=qt(t);return n<.5?4*n*n*n:1-Math.pow(-2*n+2,3)/2}function Yt(t,n,o,e){const s=3*t;const c=3*(o-t)-s;const r=1-s-c;const i=3*n;const a=3*(e-n)-i;const f=1-i-a;const l=t=>((r*t+c)*t+s)*t;const u=t=>((f*t+a)*t+i)*t;const d=t=>(3*r*t+2*c)*t+s;return t=>{if(t<=0)return 0;if(t>=1)return 1;let n=t;for(let o=0;o<8;o++){const o=l(n)-t;if(Math.abs(o)<1e-6)return u(n);const e=d(n);if(Math.abs(e)<1e-6)break;n-=o/e}let o=0;let e=1;n=t;for(let s=0;s<24;s++){const s=l(n)-t;if(Math.abs(s)<1e-6)break;if(s>0)e=n;else o=n;n=(o+e)/2}return u(n)}}const Wt=Yt(.05,.7,.1,1);function Tt(t){switch(t){case"draw":case"stagger":return Vt;case"expressive":case"grow":case"fade":default:return Wt}}function Xt(){return typeof window!=="undefined"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function Zt(t){return t.horizontal??t.w>t.h}function Gt(t,n,o){if(Zt(t)){const e=o??t.x;const s=e+(t.x-e)*n;const c=e+(t.x+t.w-e)*n;return{...t,x:Math.min(s,c),w:Math.abs(c-s)}}const e=o??t.y+t.h;const s=e+(t.y-e)*n;const c=e+(t.y+t.h-e)*n;return{...t,y:Math.min(s,c),h:Math.abs(c-s)}}function Ht(t,n){if(t.polar){const o=new Map;for(const n of t.slices){const t=o.get(n.dataIndex);if(t===undefined||n.startAngle<t)o.set(n.dataIndex,n.startAngle)}return t.slices.map((t=>{const e=o.get(t.dataIndex);return{...t,startAngle:e+(t.startAngle-e)*n,endAngle:e+(t.endAngle-e)*n}}))}const o=qt(n);return t.slices.map((t=>({...t,innerR:t.innerR*o,outerR:t.outerR*o})))}function Jt(t,n){const o=t.plot.y+t.plot.height;const e=t=>o+(t-o)*n;const s=t=>t.map((t=>({x:t.x,y:e(t.y)})));return{...t,lines:t.lines.map((o=>{if(!o.radial)return{...o,points:s(o.points)};const e=t.plot.x+t.plot.width/2;const c=t.plot.y+t.plot.height/2;const r=qt(n);return{...o,points:o.points.map((t=>({x:e+(t.x-e)*r,y:c+(t.y-c)*r})))}})),areas:t.areas.map((t=>({...t,points:s(t.points),basePoints:t.basePoints?s(t.basePoints):undefined}))),markers:t.markers.map((t=>({...t,y:e(t.y)}))),glyphs:t.glyphs?.map((t=>({...t,y:e(t.y)}))),endLabels:t.endLabels?.map((t=>({...t,y:e(t.y)}))),bars:t.bars.map((o=>Gt(o,n,t.barBaseline))),slices:Ht(t,n)}}const Kt=.5;function Qt(t){return t.slices.filter((t=>!t.pill&&t.endAngle!==t.startAngle))}function Ut(t,n,o,e){const s=qt(e);const c=Qt(t);const r=Qt(n);if(!c.length||!r.length)return null;const i=c.find((t=>t.dataIndex===o))??c[0];const a=c[0].startAngle;const f=c.reduce(((t,n)=>t+(n.endAngle-n.startAngle)),0);const l=i.endAngle-i.startAngle;const u=f-l;const d=l+u*s;const h=i.startAngle+(a-i.startAngle)*s;const x=Math.abs(u)<1e-9?0:(f-d)/u;const p=[...c.slice(c.indexOf(i)+1),...c.slice(0,c.indexOf(i))];let y=h+d;const g=p.map((t=>{const n=(t.endAngle-t.startAngle)*x;const o=y;y+=n;return{...t,startAngle:o,endAngle:y}}));g.push({...i,startAngle:h,endAngle:h+d});const b=r[0].startAngle;const m=r.reduce(((t,n)=>t+(n.endAngle-n.startAngle)),0)||1;const M=t=>h+(t-b)/m*d;const w=r.map((t=>({...t,startAngle:M(t.startAngle),endAngle:M(t.endAngle)})));return{base:{...t,slices:g,lines:[],gridlines:[],texts:[]},over:{...n,slices:w,lines:[],gridlines:[],texts:[],background:undefined},overAlpha:qt(s/Kt)}}function tn(t,n){if(!t.length)return t;const o=[];for(let e=0;e<t.length;e++){const s=t[e];if(s.x<=n){o.push(s)}else{if(e>0){const c=t[e-1];const r=s.x-c.x||1;const i=(n-c.x)/r;o.push({x:n,y:c.y+(s.y-c.y)*i})}break}}return o}const nn=.3;function on(t,n,o,e,s=false){const c=qt(e);const r=s?Math.max(0,...t.bars.map((t=>t.dataIndex))):0;return{...t,bars:t.bars.map((n=>{const o=s&&r>0?n.dataIndex/r*nn:0;const e=Wt(qt((c-o)/(1-o||1)));return Gt(n,e,t.barBaseline)}))}}function en(t,n){const o=t.plot;const e=qt(n);const s=o.x+e*o.width;const c=o.y+e*o.height;return{...t,lines:t.lines.map((t=>t.radial?t:{...t,points:tn(t.points,s)})),areas:t.areas.map((t=>({...t,points:tn(t.points,s),basePoints:t.basePoints?tn(t.basePoints,s):undefined}))),markers:t.markers.filter((t=>t.x<=s)),glyphs:t.glyphs?.filter((t=>t.x<=s)),bars:t.bars.map((n=>{const o=Zt(n)?qt((c-n.y)/Math.max(n.h,1)):qt((s-n.x)/Math.max(n.w,1));return Gt(n,o,t.barBaseline)})),slices:t.slices.map((t=>({...t,endAngle:t.startAngle+(t.endAngle-t.startAngle)*e})))}}function sn(t){const n=new Set;for(const o of t.lines)n.add(o.seriesIndex??0);return[...n].sort(((t,n)=>t-n))}function cn(t,n){const o=sn(t);const e=o.length||1;const s=new Map(o.map(((t,n)=>[t,n])));const c=t.plot;const r=t=>{const o=s.get(t??0)??0;return c.x+Vt(qt(n*e-o))*c.width};const i=c.x+Vt(qt(n))*c.width;return{...t,lines:t.lines.map((t=>t.radial?t:{...t,points:tn(t.points,r(t.seriesIndex))})),areas:t.areas.map((t=>({...t,points:tn(t.points,r(t.seriesIndex)),basePoints:t.basePoints?tn(t.basePoints,r(t.seriesIndex)):undefined}))),markers:t.markers.filter((t=>t.x<=r(t.seriesIndex))),glyphs:t.glyphs?.filter((t=>t.x<=i)),bars:t.bars.map((n=>Gt(n,qt((i-n.x)/Math.max(n.w,1)),t.barBaseline))),slices:t.slices.map((t=>({...t,endAngle:t.startAngle+(t.endAngle-t.startAngle)*qt(n)})))}}function rn(t){let n=t.animation??(t.animate===false?"none":"expressive");const o=t.animationDuration!=null?t.animationDuration:Ot;const e=Number.isFinite(o)&&o>0;if(!e)n="none";return{variant:n,duration:e?o:Ot}}function an(t,n){const o=qt(n*2);if(o>=1)return t.gridlines;return t.gridlines.map((t=>({...t,color:s(t.color,o)})))}function fn(t,n,o){const e=Tt(t)(qt(o));switch(t){case"fade":return{scene:n,alpha:qt(e)};case"draw":return{scene:{...en(n,e),gridlines:an(n,e)},alpha:1};case"stagger":{const t=qt(o);return{scene:{...cn(n,t),gridlines:an(n,t)},alpha:1}}case"grow":case"expressive":default:return{scene:Jt(n,e),alpha:qt(e)}}}function ln(t){t.textContent="";delete t.dataset.hoverIndex}const un="var(--md-sys-color-surface, #FFFBFE)";const dn=new Set(["circle","square","diamond","triangle","triangle-down"]);const hn={diamond:"polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)",triangle:"polygon(50% 0%, 100% 100%, 0% 100%)","triangle-down":"polygon(0% 0%, 100% 0%, 50% 100%)"};function xn(t,n,o,e){const s=document.createElement("div");const c=`position:absolute;left:${o}px;top:${e}px;transform:translate(-50%,-50%);pointer-events:none`;if(t&&!dn.has(t)){s.textContent=t;s.style.cssText=`${c};font-size:22px;line-height:1;user-select:none`;return s}const r=t&&t!=="circle"?11:13;s.style.cssText=`${c};width:${r}px;height:${r}px;filter:drop-shadow(0 1px 2px rgba(0,0,0,0.3))`;if(!t||t==="circle"){s.style.cssText+=`;box-sizing:border-box;border-radius:50%;background:${n};border:2px solid ${un}`;return s}const i=hn[t]??"none";const a=document.createElement("div");a.style.cssText=`position:absolute;inset:-2px;background:${un};clip-path:${i}`;const f=document.createElement("div");f.style.cssText=`position:absolute;inset:0;background:${n};clip-path:${i}`;s.append(a,f);return s}function pn(t){if(typeof t.animate!=="function")return;t.animate([{transform:"translate(-50%,-50%) scale(0.4)",offset:0},{transform:"translate(-50%,-50%) scale(1.25)",offset:.45},{transform:"translate(-50%,-50%) scale(0.94)",offset:.72},{transform:"translate(-50%,-50%) scale(1)",offset:1}],{duration:320,easing:"cubic-bezier(0.2, 0, 0, 1)"})}function yn(t,n){return["position:absolute","pointer-events:none","background:var(--md-sys-color-surface-container-high, #ECE6F0)","color:var(--md-sys-color-on-surface, #1C1B1F)","border-radius:8px","padding:8px 10px","box-shadow:0 2px 6px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.2)",`font:400 ${t}px ${n}`]}function gn(n,o){if(t(o)){n.appendChild(o);return}if(typeof o==="object"&&typeof o.unsafeHtml==="string"){n.innerHTML=o.unsafeHtml;return}n.textContent=String(o)}function bn(t,n,o,e,s,c,r="vertical",i=-1,a={}){const f=t.dataset.hoverIndex!==String(o);t.textContent="";if(o<0){delete t.dataset.hoverIndex;return}const l=n.xPositions[o];if(l==null)return;t.dataset.hoverIndex=String(o);const u=f&&!Xt();const d=n.plot;let h=r==="horizontal"?d.x:d.y;let x=h+(r==="horizontal"?d.width:d.height);if(r!=="none"){for(const t of n.hoverPoints){const n=t.byIndex?.[o];if(!n)continue;const e=r==="horizontal"?n.x:n.y;h=Math.min(h,e);x=Math.max(x,e)}}const p=document.createElement("div");p.style.cssText=["position:absolute","box-sizing:border-box",r==="horizontal"?`left:${h}px;top:${l}px;width:${x-h}px;height:1px;transform:translateY(-50%)`:`left:${l}px;top:${h}px;height:${x-h}px;width:1px;transform:translateX(-50%)`,"background:var(--md-sys-color-on-surface, #1C1B1F)","box-shadow:0 0 0 1px var(--md-sys-color-surface, #FFFBFE)","opacity:0.7"].join(";");if(r!=="none")t.appendChild(p);const y=!!a.render;const g=[];const b=[];const m=[];const M=a.trigger==="item"&&i>=0;for(const s of n.hoverPoints){if(M&&s.seriesIndex!==i)continue;const n=s.valueFormat??e;const c=s.seriesIndex===i;const f=s.byIndex[o];if(f){const o=f.color??s.color;if(!s.unanchored&&r!=="none"){const n=xn(f.symbol,o,f.x,f.y);const e=i>=0&&!c;if(e)n.style.opacity="0.4";t.appendChild(n);if(u&&!e)pn(n)}const e=f.low!=null&&f.high!=null?`${n(f.low)} – ${n(f.high)}`:n(f.value);m.push({color:o,label:s.label,value:e});if(y)g.push({seriesIndex:s.seriesIndex,label:s.label,color:s.color,value:f.value,formattedValue:e,focused:c,missing:false});continue}if(!y&&!a.missingFormatter)continue;const l=s.values?.[o];const d=typeof l==="number"?null:l;const h=a.missingFormatter?a.missingFormatter(d):"";if(y)b.push({seriesIndex:s.seriesIndex,label:s.label,color:s.color,value:d,formattedValue:h,focused:c,missing:true});if(h)m.push({label:s.label,value:h})}const w=n.texts[0]?.fontSize??12;if(a.render){const e={dataIndex:o,axisValue:n.xValues[o],axisLabel:n.xLabels[o]??"",series:g,missing:b,focusedSeriesIndex:i};let f;try{f=a.render(e)}catch(t){console.error("[md-chart] tooltipRenderer threw; falling back to the default tooltip",t);f=undefined}if(f===null)return;if(f!==undefined){const o=document.createElement("div");o.setAttribute("part","tooltip");o.style.cssText=[...yn(w,s),"z-index:2","box-sizing:border-box",`max-width:${Math.max(0,n.width-8)}px`].join(";");gn(o,f);mn(o,t,n,c,r,l);return}}if(!m.length)return;const $=document.createElement("div");$.setAttribute("part","tooltip");$.style.cssText=[...yn(w,s),"min-width:96px","z-index:2","white-space:nowrap"].join(";");const v=document.createElement("div");v.textContent=n.xLabels[o]??"";v.style.cssText="font-weight:600;margin-bottom:4px";$.appendChild(v);for(const t of m){const n=document.createElement("div");n.style.cssText=`display:flex;align-items:center;gap:8px;line-height:1.5${t.color?"":";opacity:0.62"}`;const o=document.createElement("span");o.style.cssText=t.color?`width:10px;height:10px;border-radius:3px;background:${t.color};flex:none`:"width:10px;height:10px;flex:none";const e=document.createElement("span");e.textContent=t.label;e.style.cssText="flex:1";const s=document.createElement(t.color?"strong":"span");s.textContent=t.value;n.append(o,e,s);$.appendChild(n)}mn($,t,n,c,r,l,a.rtl)}function mn(t,n,o,e,s,c,r=false){n.appendChild(t);const i=t.offsetWidth||120;const a=t.offsetHeight||60;if(a+8>o.height){n.style.overflow="visible";const s=Math.max(24-i,Math.min(e.x-i/2,o.width-24));t.style.left=`${Math.round(s)}px`;const c=n.getBoundingClientRect();const r=c.top-a-6>=0;const f=o.plot?o.plot.y+o.plot.height:o.height;t.style.top=r?`${Math.round(-a-6)}px`:`${Math.round(f+6)}px`;return}let f;let l;if(s==="none"){f=e.x+14;if(f+i>o.width-4)f=e.x-i-14;f=Math.max(4,Math.min(f,o.width-i-4));l=e.y+14;if(l+a>o.height-4)l=e.y-a-14;l=Math.max(4,Math.min(l,o.height-a-4))}else if(s==="horizontal"){l=c+14;if(l+a>o.height-4)l=c-a-14;l=Math.max(4,l);f=r?Math.max(4,Math.min(e.x-i-14,o.width-i-4)):Math.max(4,Math.min(e.x+14,o.width-i-4))}else{f=r?c-i-14:c+14;if(r?f<4:f+i>o.width-4)f=r?c+14:c-i-14;f=Math.max(4,Math.min(f,o.width-i-4));l=Math.max(4,Math.min(e.y-a/2,o.height-a-4))}t.style.left=`${f}px`;t.style.top=`${l}px`}function Mn(t){let n=null;let o=null;let e=0;const s=()=>{if(typeof window==="undefined"||!window.matchMedia)return;const s=window.devicePixelRatio||1;if(s===e&&n)return;if(n&&o)n.removeEventListener?.("change",o);e=s;n=window.matchMedia(`(resolution: ${s}dppx)`);o=t;n.addEventListener?.("change",o)};const c=()=>{if(n&&o)n.removeEventListener?.("change",o);n=null;o=null;e=0};return{update:s,dispose:c}}function wn(t){switch(t){case"left":return"right";case"right":return"left";case"top-start":return"top-end";case"top-end":return"top-start";case"bottom-start":return"bottom-end";case"bottom-end":return"bottom-start";default:return t}}function $n(t){return t==="start"?"end":t==="end"?"start":"center"}function vn(t){const n=t.width;const o=t=>n-t;const e=t=>t.map((t=>({...t,x:o(t.x)})));const s=t=>({...t,x1:o(t.x1),x2:o(t.x2)});return{...t,plot:{...t.plot,x:o(t.plot.x+t.plot.width)},bands:t.bands?.map((t=>({...t,x:o(t.x+t.w)}))),gridlines:t.gridlines.map(s),axisLines:t.axisLines.map(s),areas:t.areas.map((t=>({...t,points:e(t.points),basePoints:t.basePoints?e(t.basePoints):undefined}))),bars:t.bars.map((t=>({...t,x:o(t.x+t.w)}))),barBaseline:t.barBaseline!=null&&t.bars[0]?.horizontal?o(t.barBaseline):t.barBaseline,slices:t.slices.map((t=>({...t,cx:o(t.cx),startAngle:Math.PI-t.endAngle,endAngle:Math.PI-t.startAngle}))),lines:t.lines.map((t=>({...t,points:e(t.points)}))),markers:t.markers.map((t=>({...t,x:o(t.x)}))),glyphs:t.glyphs?.map((t=>({...t,x:o(t.x)}))),endLabels:t.endLabels?.map((t=>({...t,x:o(t.x),side:t.side==="end"?"start":"end"}))),texts:t.texts.map((t=>({...t,x:o(t.x),align:$n(t.align),rotate:t.rotate?-t.rotate:t.rotate}))),legend:t.legend.map((t=>({...t,x:o(t.x)}))),xPositions:t.xPositions.map(o),hoverPoints:t.hoverPoints.map((t=>({...t,byIndex:Object.fromEntries(Object.entries(t.byIndex).map((([t,n])=>[t,{...n,x:o(n.x)}])))})))}}function kn(t){if(!t||typeof getComputedStyle!=="function")return false;try{return getComputedStyle(t).direction==="rtl"}catch{return false}}const zn=new Set;let Sn=null;function In(t){if(typeof MutationObserver==="undefined"||typeof document==="undefined"){return{dispose:()=>undefined}}zn.add(t);if(!Sn){Sn=new MutationObserver((()=>{for(const t of zn)t()}));Sn.observe(document.documentElement,{attributes:true,attributeFilter:["dir"],subtree:true})}return{dispose:()=>{zn.delete(t);if(!zn.size){Sn?.disconnect();Sn=null}}}}function Fn(t){const n=t.length;if(n<2||t[0][0]<=t[n-1][0])return t;return[...t].reverse()}export{at as A,Mt as B,U as C,P as D,C as E,A as F,R as G,D as H,_ as I,et as J,$t as K,on as L,Bt as M,i as N,c as O,Ft as P,Ut as Q,Rt as R,gn as S,jt as T,Vt as U,d as V,wn as W,h as a,w as b,In as c,v as d,bn as e,ln as f,Xt as g,rn as h,kn as i,Pt as j,Et as k,It as l,vn as m,fn as n,ht as o,$ as p,s as q,y as r,Lt as s,k as t,Fn as u,E as v,Mn as w,r as x,st as y,ft as z};
2
+ //# sourceMappingURL=p-DvOKnoqK.js.map