@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.
- package/dist/components/p-6wZSqm_2.js +2 -0
- package/dist/components/{p-Bx5sxRqa.js.map → p-6wZSqm_2.js.map} +1 -1
- package/dist/components/p-7fN_yCXW.js +2 -0
- package/dist/components/{p-CJdqKSuf.js.map → p-7fN_yCXW.js.map} +1 -1
- package/dist/components/{p-G5m2pHZ2.js → p-B0Opn6dK.js} +2 -2
- package/dist/components/{p-pDrTJmeT.js → p-B3MWYEEJ.js} +2 -2
- package/dist/components/{p-DGGkdSZk.js → p-BwXpiUsu.js} +2 -2
- package/dist/{md3/p-B0NLeNWu.js → components/p-Bx6--dQF.js} +2 -2
- package/dist/components/{p-BIIp3Qod.js → p-C8EP4S21.js} +2 -2
- package/dist/components/{p-CWM3KSti.js → p-C_ogF68H.js} +2 -2
- package/dist/components/{p-BlwGYUkt.js → p-Ch2-tttM.js} +2 -2
- package/dist/components/p-DXXUoRSH.js +2 -0
- package/dist/components/{p-DWUCvzfU.js.map → p-DXXUoRSH.js.map} +1 -1
- package/dist/components/p-Dp-w93ot.js +2 -0
- package/dist/components/{p-BUYYCrGa.js.map → p-Dp-w93ot.js.map} +1 -1
- package/dist/{md3/p-CGStn3Iq.js → components/p-DvOKnoqK.js} +2 -2
- package/dist/components/{p-B7yMxWo-.js → p-DzPKu-Ma.js} +2 -2
- package/dist/components/{p-CXpXrhQH.js → p-RLxbNqRv.js} +2 -2
- package/dist/components/p-UdGDg2oJ.js +2 -0
- package/dist/components/{p-BujtL9xW.js.map → p-UdGDg2oJ.js.map} +1 -1
- package/dist/components/p-e2HRV63Y.js +2 -0
- package/dist/components/{p-CrlkPxeB.js.map → p-e2HRV63Y.js.map} +1 -1
- package/dist/components/p-stybaFzj.js +2 -0
- package/dist/components/{p-JbwZ84YK.js.map → p-stybaFzj.js.map} +1 -1
- package/dist/components/p-uTEkf0sE.js +2 -0
- package/dist/components/{p-BXwh1zjF.js.map → p-uTEkf0sE.js.map} +1 -1
- package/dist/esm/{a11y-C9_cZAF_.js → a11y-C6CRqodW.js} +3 -3
- package/dist/esm/{a11y-C9_cZAF_.js.map → a11y-C6CRqodW.js.map} +1 -1
- package/dist/esm/{bar-chart-IvBgAmmF.js → bar-chart-ZZrajEkM.js} +4 -4
- package/dist/esm/{bar-chart-IvBgAmmF.js.map → bar-chart-ZZrajEkM.js.map} +1 -1
- package/dist/esm/{chart-D1kP9gfW.js → chart-32olae06.js} +4 -4
- package/dist/esm/{chart-D1kP9gfW.js.map → chart-32olae06.js.map} +1 -1
- package/dist/esm/{hit-test-DFfwlMb9.js → hit-test-DHldf5Lm.js} +3 -3
- package/dist/esm/{hit-test-DFfwlMb9.js.map → hit-test-DHldf5Lm.js.map} +1 -1
- package/dist/esm/{rtl-CGStn3Iq.js → rtl-DvOKnoqK.js} +3 -3
- package/dist/esm/{rtl-CGStn3Iq.js.map → rtl-DvOKnoqK.js.map} +1 -1
- package/dist/md3/p-04e97f5d.entry.js +2 -0
- package/dist/md3/{p-ec14eaca.entry.js.map → p-04e97f5d.entry.js.map} +1 -1
- package/dist/md3/p-3cce1de3.entry.js +2 -0
- package/dist/md3/{p-2121c939.entry.js.map → p-3cce1de3.entry.js.map} +1 -1
- package/dist/md3/p-4d82132d.entry.js +2 -0
- package/dist/md3/{p-fe78659d.entry.js.map → p-4d82132d.entry.js.map} +1 -1
- package/dist/{components/p-Bu-m4Gm2.js → md3/p-Bx6--dQF.js} +2 -2
- package/dist/md3/{p-B0NLeNWu.js.map → p-Bx6--dQF.js.map} +1 -1
- package/dist/md3/{p-CWM3KSti.js → p-C_ogF68H.js} +2 -2
- package/dist/md3/{p-CWM3KSti.js.map → p-C_ogF68H.js.map} +1 -1
- package/dist/{components/p-CGStn3Iq.js → md3/p-DvOKnoqK.js} +2 -2
- package/dist/md3/{p-CGStn3Iq.js.map → p-DvOKnoqK.js.map} +1 -1
- package/dist/md3/{p-B7yMxWo-.js → p-DzPKu-Ma.js} +2 -2
- package/dist/md3/{p-B7yMxWo-.js.map → p-DzPKu-Ma.js.map} +1 -1
- package/dist/md3/{p-CXpXrhQH.js → p-RLxbNqRv.js} +2 -2
- package/dist/md3/{p-CXpXrhQH.js.map → p-RLxbNqRv.js.map} +1 -1
- package/dist/md3/{p-f6373c6c.entry.js → p-aaec2698.entry.js} +2 -2
- package/dist/md3/{p-9ff2d5d1.entry.js → p-c063c823.entry.js} +2 -2
- package/main-llm.md +2 -2
- package/package.json +24 -3
- package/dist/components/p-BUYYCrGa.js +0 -2
- package/dist/components/p-BXwh1zjF.js +0 -2
- package/dist/components/p-BujtL9xW.js +0 -2
- package/dist/components/p-Bx5sxRqa.js +0 -2
- package/dist/components/p-CJdqKSuf.js +0 -2
- package/dist/components/p-CrlkPxeB.js +0 -2
- package/dist/components/p-DWUCvzfU.js +0 -2
- package/dist/components/p-JbwZ84YK.js +0 -2
- package/dist/md3/p-2121c939.entry.js +0 -2
- package/dist/md3/p-ec14eaca.entry.js +0 -2
- package/dist/md3/p-fe78659d.entry.js +0 -2
- /package/dist/components/{p-G5m2pHZ2.js.map → p-B0Opn6dK.js.map} +0 -0
- /package/dist/components/{p-pDrTJmeT.js.map → p-B3MWYEEJ.js.map} +0 -0
- /package/dist/components/{p-DGGkdSZk.js.map → p-BwXpiUsu.js.map} +0 -0
- /package/dist/components/{p-Bu-m4Gm2.js.map → p-Bx6--dQF.js.map} +0 -0
- /package/dist/components/{p-BIIp3Qod.js.map → p-C8EP4S21.js.map} +0 -0
- /package/dist/components/{p-CWM3KSti.js.map → p-C_ogF68H.js.map} +0 -0
- /package/dist/components/{p-BlwGYUkt.js.map → p-Ch2-tttM.js.map} +0 -0
- /package/dist/components/{p-CGStn3Iq.js.map → p-DvOKnoqK.js.map} +0 -0
- /package/dist/components/{p-B7yMxWo-.js.map → p-DzPKu-Ma.js.map} +0 -0
- /package/dist/components/{p-CXpXrhQH.js.map → p-RLxbNqRv.js.map} +0 -0
- /package/dist/md3/{p-f6373c6c.entry.js.map → p-aaec2698.entry.js.map} +0 -0
- /package/dist/md3/{p-9ff2d5d1.entry.js.map → p-c063c823.entry.js.map} +0 -0
|
@@ -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-
|
|
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
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{q as t,u as n}from"./p-
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{q as t,u as n}from"./p-DvOKnoqK.js";const i=.22;const s=260;const e=4;function r(t,n,i){const s=t.length;if(!s)return Infinity;const e=t[0];const r=t[s-1];if(n<=e[0])return Math.hypot(e[0]-n,e[1]-i);if(n>=r[0])return Math.hypot(r[0]-n,r[1]-i);let o=0;let c=s-1;while(c-o>1){const i=o+c>>1;if(t[i][0]<=n)o=i;else c=i}const[f,u]=t[o];const[l,a]=t[c];const h=l===f?0:(n-f)/(l-f);return Math.abs(u+(a-u)*h-i)}function o(t,n,i=e){let s=-1;let r=Infinity;let o=Infinity;for(const i of t){if(i.seriesIndex===n)o=i.distance;if(i.distance<r){r=i.distance;s=i.seriesIndex}}if(n>=0&&r>o-i)return n;return s}const c=140;class f{constructor(t=e,n=c){this.stick=t;this.dwellMs=n;this.held=-1;this.candidate=-1;this.since=0}pick(t,n){const i=o(t,this.held,this.stick);if(i!==this.candidate){this.candidate=i;this.since=n}if(this.held<0){this.held=i}else if(i!==this.held&&n-this.since>=this.dwellMs){this.held=i}return this.held}reset(){this.held=-1;this.candidate=-1;this.since=0}}function u(n,s,e){if(s<0||e<=0)return n;const r=1-(1-i)*Math.min(1,e);const o=t=>t!=null&&t!==s;return{...n,lines:n.lines.map((n=>o(n.seriesIndex)?{...n,color:t(n.color,r)}:n)),areas:n.areas.map((n=>o(n.seriesIndex)?{...n,colorTop:t(n.colorTop,r),colorBottom:t(n.colorBottom,r)}:n)),markers:n.markers.map((n=>o(n.seriesIndex)?{...n,color:t(n.color,r)}:n))}}const l=26;const a=8;function h(t,n){if(!t.length)return-1;let i=0;let s=Infinity;for(let e=0;e<t.length;e++){const r=Math.abs(t[e]-n);if(r<s){s=r;i=e}}return i}function d(t){const i=!!t.inverted;return t.hoverPoints.map((t=>n(Object.keys(t.byIndex).map((n=>{const s=t.byIndex[Number(n)];return i?[s.y,s.x]:[s.x,s.y]})))))}function I(t,n){return t.hoverPoints.map((t=>({seriesIndex:t.seriesIndex,label:t.label,value:t.byIndex[n]?.value??null})))}function x(t,n,i){return n>=t.x&&n<=t.x+t.width&&i>=t.y&&i<=t.y+t.height}function M(t,n){const i=t.length;if(!i)return null;const s=i>1&&t[0].x>t[i-1].x?[...t].reverse():t;if(n<s[0].x||n>s[i-1].x)return null;if(i===1)return s[0].y;let e=0;let r=i-1;while(r-e>1){const t=e+r>>1;if(s[t].x<=n)e=t;else r=t}const o=s[e];const c=s[r];return c.x===o.x?o.y:o.y+(c.y-o.y)*(n-o.x)/(c.x-o.x)}function y(t,n,i){const s=M(t.points,n);if(s==null)return false;const e=(t.basePoints?M(t.basePoints,n):null)??t.baselineY;return i>=Math.min(s,e)&&i<=Math.max(s,e)}function k(t,n,i){if(!x(t.plot,n,i))return-1;let s=-1;let e=Infinity;for(const r of t.areas){if(r.seriesIndex==null||!y(r,n,i))continue;const t=M(r.points,n);const o=t==null?Infinity:Math.abs(i-t);if(o<e){e=o;s=r.seriesIndex}}return s}function m(t,n,i,s=d(t)){const e=!!t.inverted;const o=e?i:n;const c=e?n:i;const f=h(t.xPositions,o);if(f<0)return null;let u=-1;let I=Infinity;for(const s of t.hoverPoints){const t=s.byIndex[f];if(!t)continue;const e=Math.hypot(t.x-n,t.y-i);if(e<I){I=e;u=s.seriesIndex}}if(u>=0&&I<=l)return{kind:"mark",seriesIndex:u,dataIndex:f};if(!x(t.plot,n,i))return null;let k=-1;let m=Infinity;t.hoverPoints.forEach(((t,n)=>{const i=r(s[n]??[],o,c);if(i<m){m=i;k=t.seriesIndex}}));if(k>=0&&m<=a)return{kind:"line",seriesIndex:k,dataIndex:f};let p=-1;let b=Infinity;for(const s of t.areas){if(s.seriesIndex==null||!y(s,n,i))continue;const t=Math.abs(i-M(s.points,n));if(t<b){b=t;p=s.seriesIndex}}if(p>=0)return{kind:"area",seriesIndex:p,dataIndex:f};return{kind:"axis",dataIndex:f}}export{s as E,f as H,I as a,k as b,r as d,u as e,m as h,h as n,d as s};
|
|
2
|
+
//# sourceMappingURL=p-DzPKu-Ma.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{w as t,c as i,e as s,f as h,i as n,s as e,g as o,h as r,m as a,j as c,k as l,l as f,n as u,o as m}from"./p-
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{w as t,c as i,e as s,f as h,i as n,s as e,g as o,h as r,m as a,j as c,k as l,l as f,n as u,o as m}from"./p-DvOKnoqK.js";import{H as p,n as d,h as v,a as w,e as F,s as g,b as y,d as A,E as b}from"./p-DzPKu-Ma.js";const M=()=>typeof performance!=="undefined"?performance.now():Date.now();const k=8;class x{constructor(e){this.container=e;this.ctx=null;this.spec=null;this.theme=null;this.scene=null;this.cb={};this.hoverRaf=0;this.lastHoverIndex=-2;this.hoverEnabled=true;this.hoverOpts={};this.hasRendered=false;this.introRaf=0;this.lastW=0;this.lastH=0;this.lastDpr=1;this.emphasisSeries=-1;this.emphasisT=0;this.emphasisTarget=0;this.emphasisRaf=0;this.focusLines=null;this.focus=new p;this.downAt=null;this.dragged=false;this.rtl=false;this.sceneLtr=null;this.dprWatch=t((()=>this.render()));this.dirWatch=i((()=>{if(n(this.container)!==this.rtl)this.render()}));this.handlePointerDown=t=>{this.downAt={x:t.clientX,y:t.clientY};this.dragged=false};this.handlePointerMove=t=>{if(this.downAt&&Math.hypot(t.clientX-this.downAt.x,t.clientY-this.downAt.y)>k){this.dragged=true}if(!this.scene||!this.hoverEnabled)return;const i=this.canvas.getBoundingClientRect();const h=t.clientX-i.left;const n=t.clientY-i.top;const e=!!this.scene.inverted;const o=d(this.scene.xPositions,e?n:h);if(this.hoverRaf)cancelAnimationFrame(this.hoverRaf);this.hoverRaf=requestAnimationFrame((()=>{this.hoverRaf=0;if(!this.scene||!this.spec||!this.theme)return;const t=this.scene.hoverPoints.length>1?this.nearestSeries(h,n):-1;s(this.hoverLayer,this.scene,o,this.spec.yFormatter,this.theme.fontFamily,{x:h,y:n},e?"horizontal":"vertical",t,{...this.hoverOpts,rtl:this.rtl});this.setFocus(t);if(o!==this.lastHoverIndex){this.lastHoverIndex=o;this.cb.onHover?.(o)}}))};this.handlePointerLeave=()=>{if(this.hoverRaf){cancelAnimationFrame(this.hoverRaf);this.hoverRaf=0}h(this.hoverLayer);this.focus.reset();this.setFocus(-1);if(this.lastHoverIndex!==-1){this.lastHoverIndex=-1;this.cb.onHover?.(-1)}};this.handleClick=t=>{const i=this.dragged;this.dragged=false;this.downAt=null;if(!this.scene)return;const s=this.canvas.getBoundingClientRect();const h=t.clientX-s.left;const n=t.clientY-s.top;const e=v(this.scene,h,n,this.seriesLines(this.scene));if(!e)return;const o=t;if(e.kind==="mark"){this.cb.onPointClick?.(e.seriesIndex,e.dataIndex,o);return}if(i)return;if(e.kind==="line")this.cb.onLineClick?.(e.seriesIndex,e.dataIndex,o);else if(e.kind==="area")this.cb.onAreaClick?.(e.seriesIndex,e.dataIndex,o);else this.cb.onAxisClick?.(e.dataIndex,w(this.scene,e.dataIndex),o)};this.onLegendToggle=t=>{if(this.spec){this.spec.series[t.seriesIndex].hidden=!this.spec.series[t.seriesIndex].hidden;this.hasRendered=false;this.render();this.cb.onLegendClick?.({...t,hidden:this.spec.series[t.seriesIndex].hidden})}else{this.cb.onLegendClick?.(t)}};if(getComputedStyle(e).position==="static")e.style.position="relative";this.canvas=document.createElement("canvas");this.canvas.style.cssText="position:absolute;inset:0;width:100%;height:100%;display:block";this.canvas.setAttribute("part","plot-canvas");this.overlay=document.createElement("div");this.overlay.style.cssText="position:absolute;inset:0;pointer-events:none;overflow:hidden";this.legendLayer=document.createElement("div");this.legendLayer.style.cssText="position:absolute;inset:0;pointer-events:none;overflow:visible";this.glyphLayer=document.createElement("div");this.glyphLayer.style.cssText="position:absolute;inset:0;pointer-events:none;overflow:hidden";this.endLabelLayer=document.createElement("div");this.endLabelLayer.style.cssText="position:absolute;inset:0;pointer-events:none;overflow:hidden";this.hoverLayer=document.createElement("div");this.hoverLayer.style.cssText="position:absolute;inset:0;pointer-events:none;overflow:hidden";e.append(this.canvas,this.overlay,this.legendLayer,this.glyphLayer,this.endLabelLayer,this.hoverLayer);this.ctx=this.canvas.getContext("2d");this.canvas.addEventListener("pointerdown",this.handlePointerDown);this.canvas.addEventListener("pointermove",this.handlePointerMove);this.canvas.addEventListener("pointerleave",this.handlePointerLeave);this.canvas.addEventListener("click",this.handleClick)}getScene(){return this.scene}setHoverEnabled(t){this.hoverEnabled=t;if(!t)h(this.hoverLayer)}setTooltip(t){this.hoverOpts=t}setSpec(t,i,s={}){this.spec=t;this.theme=i;this.cb=s;cancelAnimationFrame(this.emphasisRaf);this.focus.reset();this.emphasisSeries=-1;this.emphasisT=0;this.emphasisTarget=0;this.render()}resize(){const t=this.container.getBoundingClientRect();if(Math.round(t.width)===this.lastW&&Math.round(t.height)===this.lastH)return;this.render()}toDataURL(t="image/png"){return typeof this.canvas.toDataURL==="function"?this.canvas.toDataURL(t):""}dispose(){if(this.hoverRaf)cancelAnimationFrame(this.hoverRaf);this.stopIntro();cancelAnimationFrame(this.emphasisRaf);this.canvas.removeEventListener("pointerdown",this.handlePointerDown);this.canvas.removeEventListener("pointermove",this.handlePointerMove);this.canvas.removeEventListener("pointerleave",this.handlePointerLeave);this.canvas.removeEventListener("click",this.handleClick);this.dprWatch.dispose();this.dirWatch.dispose();this.canvas.remove();this.overlay.remove();this.glyphLayer.remove();this.endLabelLayer.remove();this.hoverLayer.remove();this.spec=null;this.scene=null;this.sceneLtr=null}render(){if(!this.spec||!this.theme)return;this.dprWatch.update();const t=this.container.getBoundingClientRect();const i=Math.round(t.width);const s=Math.round(t.height);if(i<2||s<2)return;this.lastW=i;this.lastH=s;const h=Math.min(window.devicePixelRatio||1,4);this.lastDpr=h;this.canvas.width=i*h;this.canvas.height=s*h;this.rtl=n(this.container);const a=()=>{this.sceneLtr=m(this.spec,this.theme,i,s);return this.mirrored(this.sceneLtr)};this.scene=a();e(this.overlay,this.scene,this.theme.fontFamily,{onLegendClick:this.onLegendToggle},this.rtl,this.legendLayer);const c=this.overlay.querySelector('[part="legend"]');if(c&&this.spec.legend&&this.spec.legend!=="none"){const t=this.spec.legend==="left"||this.spec.legend==="right";const i=t?c.offsetWidth:c.offsetHeight;if(i>0&&Math.abs((this.spec.legendExtent??-1)-i)>2){this.spec.legendExtent=i;this.scene=a();e(this.overlay,this.scene,this.theme.fontFamily,{onLegendClick:this.onLegendToggle},this.rtl,this.legendLayer)}}const{variant:l,duration:f}=r(this.spec);const u=!this.hasRendered&&l!=="none"&&!o();const p=this.sceneLtr?this.sceneLtr.lines.length>0||this.sceneLtr.areas.length>0||this.sceneLtr.markers.length>0:false;if(u){this.hasRendered=p;this.playIntro(h,l,f);return}this.hasRendered=this.hasRendered||p;this.stopIntro();this.paintGeometry(F(this.scene,this.emphasisSeries,this.emphasisT),h)}clearIntroOpacity(){this.canvas.style.opacity="";this.glyphLayer.style.opacity=""}stopIntro(){cancelAnimationFrame(this.introRaf);this.introRaf=0;this.clearIntroOpacity()}mirrored(t){return this.rtl?a(t):t}paintGeometry(t,i){this.drawGeometry(t,i);c(this.glyphLayer,t.glyphs??[],this.theme?.fontFamily);l(this.endLabelLayer,t.endLabels??[],this.theme?.fontFamily)}paintEmphasis(){if(this.scene)this.drawGeometry(F(this.scene,this.emphasisSeries,this.emphasisT),this.lastDpr)}setFocus(t){const i=t>=0?1:0;const s=t>=0?t:this.emphasisSeries;if(i===this.emphasisTarget&&s===this.emphasisSeries)return;this.emphasisSeries=s;this.emphasisTarget=i;if(o()){cancelAnimationFrame(this.emphasisRaf);this.emphasisT=i;if(i===0)this.emphasisSeries=-1;this.paintEmphasis();return}cancelAnimationFrame(this.emphasisRaf);let h=0;const n=t=>{if(!h)h=t;const i=t-h;h=t;const s=this.emphasisTarget>this.emphasisT?1:-1;this.emphasisT+=s*(i/b);if(s>0&&this.emphasisT>=this.emphasisTarget||s<0&&this.emphasisT<=this.emphasisTarget){this.emphasisT=this.emphasisTarget;if(this.emphasisTarget===0)this.emphasisSeries=-1;this.paintEmphasis();return}this.paintEmphasis();this.emphasisRaf=requestAnimationFrame(n)};this.emphasisRaf=requestAnimationFrame(n)}replay(){this.hasRendered=false;this.render()}drawGeometry(t,i){if(!this.ctx)return;this.ctx.setTransform(i,0,0,i,0,0);f(this.ctx,t)}playIntro(t,i,s){const h=this.sceneLtr;if(!h)return;let n=s;if(i==="stagger"){const t=new Set(h.lines.map((t=>t.seriesIndex??0))).size||1;n=Math.min(s*t,5200)}this.stopIntro();const e=t=>{const i=t<1?String(t):"";this.canvas.style.opacity=i;this.glyphLayer.style.opacity=i};const o=u(i,h,0);e(o.alpha);this.drawGeometry(o.scene,t);let r=0;const a=s=>{if(!r)r=s;const o=(s-r)/n;if(o>=1){e(1);this.paintGeometry(this.mirrored(h),t);return}const{scene:c,alpha:l}=u(i,h,o);e(l);this.paintGeometry(this.mirrored(c),t);this.introRaf=requestAnimationFrame(a)};this.introRaf=requestAnimationFrame(a)}focusIndex(t){if(!this.scene||!this.spec||!this.theme)return;if(t<0){h(this.hoverLayer);this.focus.reset();this.setFocus(-1);return}const i=!!this.scene.inverted;const n=this.scene.hoverPoints.map((i=>i.byIndex[t])).find(Boolean);const e=this.scene.xPositions[t]??0;const o=n?{x:n.x,y:n.y}:{x:i?this.scene.plot.x:e,y:i?e:this.scene.plot.y};s(this.hoverLayer,this.scene,t,this.spec.yFormatter,this.theme.fontFamily,o,i?"horizontal":"vertical",-1,{...this.hoverOpts,rtl:this.rtl})}seriesLines(t){if(this.focusLines?.scene===t)return this.focusLines.points;const i=g(t);this.focusLines={scene:t,points:i};return i}nearestSeries(t,i){if(!this.scene)return-1;if(this.scene.areas.length>0&&this.hoverOpts.trigger!=="item"){this.focus.reset();return-1}const s=y(this.scene,t,i);if(s>=0){this.focus.reset();return s}const h=!!this.scene.inverted;const n=h?i:t;const e=h?t:i;const o=this.seriesLines(this.scene);const r=this.scene.hoverPoints.map(((t,i)=>({seriesIndex:t.seriesIndex,distance:A(o[i],n,e)})));return this.focus.pick(r,M())}}export{x as L};
|
|
2
|
+
//# sourceMappingURL=p-RLxbNqRv.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{p as t,H as s,c as i,f as e,h as a,d as n,t as r}from"./p-MWBNn6Lj.js";import{V as o,i as l,n as h,r as d,c,l as m}from"./p-BEWIC0pC.js";import{s as p,a as u,g as f,c as g,r as y}from"./p-DWxN44zD.js";import{p as b}from"./p-CxhZdOPw.js";import{d as _}from"./p-6wZSqm_2.js";import{d as x}from"./p-BwXpiUsu.js";import{d as v}from"./p-B0Opn6dK.js";import{d as w}from"./p-7fN_yCXW.js";import{d as k}from"./p-e2HRV63Y.js";import{d as z}from"./p-stybaFzj.js";import{d as C}from"./p-B3MWYEEJ.js";const V=()=>`:host{--md-text-field-padding-inline-end:var(--md-sys-spacing-inset-lg, 16px);display:inline-block;inline-size:var(--md-select-width, 100%);min-inline-size:var(--md-select-min-width, 0);box-sizing:border-box;font-family:var(--md-sys-typescale-body-large-font-family, Roboto, sans-serif)}.md-select__field{inline-size:100%;cursor:pointer;--md-text-field-cursor:pointer}.md-select__field::part(input){cursor:pointer}:host(.md-select--disabled) .md-select__field::part(input){cursor:not-allowed}.md-select__field .md-select__trailing{display:inline-flex;align-items:center;gap:var(--md-select-trailing-gap, 2px);width:auto;height:auto}.md-select__caret{font-size:var(--md-select-caret-size, 24px);line-height:1;color:var(--md-select-caret-color, var(--md-sys-color-on-surface-variant, #49454F));transition:transform var(--md-sys-motion-duration-short4, 200ms) var(--md-sys-motion-easing-standard, cubic-bezier(0.2, 0, 0, 1))}:host(.md-select--open) .md-select__caret{transform:rotate(180deg)}@media (prefers-reduced-motion: reduce){.md-select__caret{transition:none}}.md-select__loader{display:inline-flex;align-items:center;justify-content:center;inline-size:24px;block-size:24px;--md-loading-indicator-size:var(--md-select-spinner-size, 22px);--md-loading-indicator-shape-size:var(--md-select-spinner-size, 22px)}:host([full-width]){display:block;inline-size:100%}.md-select__loading{display:flex;align-items:center;padding-block:var(--md-sys-spacing-inset-lg, 16px);padding-inline:var(--md-sys-spacing-inset-lg, 16px)}.md-select__loading md-progress-indicator{inline-size:100%}.md-select__field .md-select__clear{--_clear-color:var(--md-select-clear-color, var(--md-select-caret-color, var(--md-sys-color-on-surface-variant, #49454F)));--md-icon-button-container-width:24px;--md-icon-button-container-height:24px;--md-icon-button-icon-size:18px;--md-icon-button-icon-color:var(--_clear-color);--md-icon-button-state-layer-color:var(--_clear-color)}.md-select__option-icon{font-size:20px;line-height:1;color:var(--md-select-option-icon-color, var(--md-sys-color-on-surface-variant, #49454F))}:host(.md-select--disabled){cursor:default}:host(.md-select--disabled) .md-select__field{--md-text-field-cursor:not-allowed}.material-symbols-outlined{font-family:var(--md-sys-icon-font-family, 'Material Symbols Outlined', 'Material Icons');font-weight:normal;font-style:normal;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;overflow-wrap:normal;direction:ltr;font-feature-settings:'liga';-webkit-font-smoothing:antialiased}.md-select__vspacer{display:block;flex:none;pointer-events:none}.md-select__search-wrap{position:relative;display:block}.md-select__search{box-sizing:border-box;width:100%;border:none;outline:none;padding:12px 44px 12px 16px;font:inherit;color:var(--md-sys-color-on-surface, #1d1b20);background:var(--md-sys-color-surface-container, #f3edf7);border-bottom:1px solid var(--md-sys-color-outline-variant, #cac4d0)}.md-select__search::placeholder{color:var(--md-sys-color-on-surface-variant, #49454f)}.md-select__search-spinner{position:absolute;inset-block-start:50%;inset-inline-end:12px;margin-block-start:-12px;--md-loading-indicator-size:24px;--md-loading-indicator-shape-size:18px;pointer-events:none}:host([density='-1']){--md-sys-density-scale:-1}:host([density='-2']){--md-sys-density-scale:-2}:host([density='-3']){--md-sys-density-scale:-3}:host([density='-4']){--md-sys-density-scale:-4}`;let M=0;const O=200;const j=180;const E=t(class t extends s{constructor(t){super();if(t!==false){this.__registerHost()}this.__attachShadow();this.mdChange=i(this,"mdChange",7);this.mdOpen=i(this,"mdOpen",7);this.mdClose=i(this,"mdClose",7);this.mdValidityChange=i(this,"mdValidityChange",5);this.internals=this.attachInternals();this.valueMissingLabel="Please select an item in the list.";this.reserveSupportingSpace=false;this.customValidityMessage="";this.variant="outlined";this.label="";this.placeholder="";this.value="";this.disabled=false;this.required=false;this.error=false;this.errorText="";this.supportingText="";this.density=0;this.clearable=false;this.matchTriggerWidth=true;this.placement="bottom-start";this.options=[];this.virtualize="auto";this.filterable=false;this.filterMode="substring";this.name="";this.searchPlaceholder="Search…";this.filterLabel="";this.noResultsText="No results";this.noOptionsText="No options";this.clearLabel="Clear selection";this.searchingLabel="Searching";this.loadingText="Loading…";this.clearIcon="close";this.dropdownIcon="arrow_drop_down";this.loading=false;this.fullWidth=false;this.open=false;this.optionsData=[];this.triggerId=`md-select-${++M}`;this.vc=new o({queryItem:t=>this.el.shadowRoot?.querySelector(`md-menu-item[data-vindex="${t}"]`)??null,requestRender:()=>e(this)});this.providerSet=false;this.selectedLabel="";this.query="";this.searching=false;this.queryText=null;this.defaultValue="";this.lastValidityKey=null;this._syncGuard=false;this._lastEmit=null;this.toggleOpen=()=>{if(this.disabled)return;this.open=!this.open};this.selectValue=t=>{if(this.value===t){this.open=false;return}this.value=t;this.mdChange.emit(t);this.open=false;this.fieldEl?.focus?.()};this.clearValue=t=>{t.stopPropagation();if(this.disabled||!this.value)return;this.value="";this.mdChange.emit("")};this.vpWired=false;this.handleMenuOpen=()=>{this._syncGuard=true;this.open=true;this._syncGuard=false;if(this._lastEmit!=="open"){this._lastEmit="open";this.mdOpen.emit()}if(this.vc.active){this.wireViewport();if(this.filterable){requestAnimationFrame((()=>{const t=this.el.shadowRoot?.querySelector(".md-select__search");t?.focus();void this.menuEl?.setComboboxElement?.(t)}))}}};this.handleMenuClose=()=>{this._syncGuard=true;this.open=false;this._syncGuard=false;if(this.query)this.query="";if(this._lastEmit!=="close"){this._lastEmit="close";this.mdClose.emit()}void this.menuEl?.setComboboxElement?.(null);this.vc.detachViewport();this.vpWired=false};this.onSearchInput=t=>{const s=t.target.value;this.queryText=null;if(!this.vc.active){this.query=s;return}if(!this.searching){this.searching=true;e(this)}clearTimeout(this.searchDebounce);this.searchDebounce=setTimeout((()=>{this.vc.setQuery(s);this.searching=false;e(this)}),j)}}get optionList(){return b(this.options,"md-select","options")}async show(){if(this.disabled)return;this.open=true}async close(){this.open=false}async focusTrigger(){this.fieldEl?.focus?.()}async reset(){if(!this.value)return;this.value="";this.mdChange.emit("")}async loadOptions(t){if(this.virtualize==="never"||!l()){this.vc.reset();this.optionsData=h(d(t));return}this.optionsData=[];this.vc.setFixedRowHeight(this.rowHeight);this.vc.setFilterMode(this.filterMode);const s=await this.vc.load(t);if(!s){this.vc.reset();this.optionsData=h(d(t))}else{this.updateSelectedLabel()}e(this)}async setQuery(t){this.vc.setQuery(t);if(!this.vc.active)this.query=t;this.queryText=t;this.syncSearchField();e(this)}syncSearchField(){if(this.queryText===null)return;const t=this.el.shadowRoot?.querySelector(".md-select__search");if(!t)return;t.value=this.queryText;this.queryText=null}async getLabels(t){return Object.fromEntries(this.vc.getLabels(t))}componentWillLoad(){this.refreshOptions();if(!this.value){const t=this.optionsData.find((t=>t.selected&&!t.disabled));if(t)this.value=t.value}this.defaultValue=this.value;this.syncFormValue()}syncFormValue(){p(this.internals,this.value||null);this.updateSelectedLabel();this.syncValidity()}syncValidity(){u(this.internals,{missing:this.required&&!this.value,missingMessage:this.valueMissingLabel,customMessage:this.customValidityMessage});this.emitValidityChange()}async getValidity(){return f(this.internals)}emitValidityChange(){const t=f(this.internals);const s=`${t.valid}|${t.validationMessage}`;if(this.lastValidityKey===s)return;const i=this.lastValidityKey!==null;this.lastValidityKey=s;if(i)this.mdValidityChange.emit(t)}async checkValidity(){return g(this.internals)}async reportValidity(){return y(this.internals)}async setCustomValidity(t){this.customValidityMessage=t;this.syncValidity()}formResetCallback(){this.value=this.defaultValue}refreshOptions(){const t=c(this.el,this.optionList);const s=this.virtualize==="always"||this.virtualize==="auto"&&t.length>O;if(s&&l()&&t.length>0){this.optionsData=[];this.vc.setFixedRowHeight(this.rowHeight);this.vc.setFilterMode(this.filterMode);void this.vc.load(t).then((s=>{if(!s){this.optionsData=t;e(this)}else{this.updateSelectedLabel()}}))}else{this.vc.reset();this.optionsData=t}}updateSelectedLabel(){if(!this.value){this.selectedLabel=""}else if(this.vc.active){this.selectedLabel=this.vc.getLabels([this.value]).get(this.value)??this.selectedLabel}e(this)}onOptionChange(t){t.stopPropagation();this.refreshOptions()}syncMenu(t){if(this._syncGuard||!this.menuEl)return;if(t){this.menuEl.show?.({autoFocus:!(this.filterable&&this.vc.active)})}else{this.menuEl.close?.()}}handleKeyDown(t){if(this.disabled)return;if(!this.open&&(t.key==="ArrowDown"||t.key==="Enter"||t.key===" ")){t.preventDefault();this.open=true}else if(this.open&&t.key==="Escape"){t.preventDefault();this.open=false;this.fieldEl?.focus?.()}}wireViewport(){void(async()=>{const t=await(this.menuEl?.getScrollViewport?.())??null;if(!t||this.vpWired)return;this.vpWired=true;await this.vc.attachViewport((async()=>t))})()}componentDidRender(){this.syncSearchField();if(!this.menuEl)return;if(this.vc.active&&!this.providerSet){void this.menuEl.setVirtualProvider?.(this.vc.provider);this.providerSet=true}else if(!this.vc.active&&this.providerSet){void this.menuEl.setVirtualProvider?.(null);this.providerSet=false}if(this.open&&this.vc.active&&!this.vpWired)this.wireViewport()}disconnectedCallback(){clearTimeout(this.searchDebounce);this.vc.detachViewport()}get accessibleName(){if(this.label)return this.label;const t=this.el.getAttribute("aria-label");if(t&&t.trim())return t.trim();const s=this.el.getAttribute("aria-labelledby");if(s){const t=this.el.getRootNode();const i=s.trim().split(/\s+/).map((s=>t.getElementById?.(s)?.textContent?.trim()??"")).filter(Boolean).join(" ");if(i)return i}return""}renderTrigger(){const t=this.vc.active?this.selectedLabel:m(this.optionsData,this.value);const s=!!this.value&&!!t;const i=this.clearable&&s&&!this.disabled;const e=this.label?undefined:this.accessibleName||undefined;return a("md-text-field",{ref:t=>this.fieldEl=t,id:this.triggerId,class:"md-select__field",part:"field",exportparts:"container:field-container",variant:this.variant,label:this.label,"aria-label":e,placeholder:s?"":this.placeholder,value:t,readOnly:true,disabled:this.disabled,required:this.required,error:this.error,errorText:this.errorText,reserveSupportingSpace:this.reserveSupportingSpace,supportingText:this.supportingText,density:this.density,appearFocused:this.open,onClick:this.toggleOpen},a("span",{slot:"trailing-icon",class:"md-select__trailing",part:"trailing","aria-hidden":"true"},this.loading?a("span",{class:"md-select__loader",part:"loading-spinner"},a("slot",{name:"loader"},a("md-loading-indicator",{label:this.loadingText}))):[i&&a("md-icon-button",{class:"md-select__clear",part:"clear",size:"xs",icon:this.clearIcon,"aria-label":this.clearLabel,shapeMorph:false,groupTabindex:-1,onClick:this.clearValue}),a("span",{class:"md-select__caret material-symbols-outlined",part:"caret"},a("slot",{name:"dropdown-icon"},this.dropdownIcon))]))}renderVirtualOptions(){return a("div",{class:"md-select__listbox",role:"listbox",id:`${this.triggerId}-listbox`,"aria-label":this.accessibleName||"Options"},a("div",{class:"md-select__vspacer",style:{height:`${this.vc.topPad}px`},"aria-hidden":"true"}),this.vc.windowRows.map(((t,s)=>{const i=this.vc.windowStart+s;const e=t.value===this.value;return a("md-menu-item",{key:t.index,id:`${this.triggerId}-opt-${i}`,"data-vindex":i,presentation:"option",type:"radio","check-position":"start","keep-open":true,part:e?"option option-selected":"option",disabled:t.disabled,selected:e,headline:t.label,"supporting-text":t.supportingText||"","aria-setsize":this.vc.filteredLength,"aria-posinset":i+1,onMdClick:()=>this.selectValue(t.value)},t.icon?a("span",{slot:"leading-icon",part:"option-icon",class:"material-symbols-outlined md-select__option-icon","aria-hidden":"true"},t.icon):null,t.label)})),a("div",{class:"md-select__vspacer",style:{height:`${this.vc.bottomPad}px`},"aria-hidden":"true"}))}renderMenu(){const t=this.vc.active;const s=this.filterable&&!t?this.query.trim().toLowerCase():"";const i=s?this.optionsData.filter((t=>t.label.toLowerCase().includes(s)||(t.supportingText||"").toLowerCase().includes(s))):this.optionsData;const e=this.loading?"":t?this.vc.filteredLength===0?this.noResultsText:"":this.optionsData.length===0?this.noOptionsText:s&&i.length===0?this.noResultsText:"";const n=t?this.maxHeight??320:this.maxHeight;return a("md-menu",{ref:t=>this.menuEl=t,anchor:this.triggerId,placement:this.placement,"match-anchor-width":this.matchTriggerWidth||this.fullWidth,"max-height":n,"empty-text":e,listbox:true,"list-label":this.accessibleName||"Options",part:"menu",onMdOpen:this.handleMenuOpen,onMdClose:this.handleMenuClose},this.filterable&&!this.loading&&a("div",{slot:"header",class:"md-select__search-wrap",part:"search-wrap"},a("input",{class:"md-select__search",part:"search",type:"text",role:"combobox","aria-haspopup":"listbox","aria-expanded":String(this.open),"aria-controls":`${this.triggerId}-listbox`,"aria-autocomplete":"list",autocomplete:"off",placeholder:this.searchPlaceholder,"aria-label":this.filterLabel||(this.label?`Filter ${this.label}`:"Filter options"),onInput:this.onSearchInput,onClick:t=>t.stopPropagation()}),this.searching&&a("md-loading-indicator",{class:"md-select__search-spinner",part:"search-spinner",label:this.searchingLabel,"aria-hidden":"true"})),this.loading?a("div",{class:"md-select__loading",part:"loading-bar",role:"status","aria-label":this.loadingText},a("md-progress-indicator",{variant:"linear",indeterminate:true,wave:true,part:"loading-progress",label:this.loadingText})):t?this.renderVirtualOptions():a("div",{class:"md-select__listbox",role:"listbox",id:`${this.triggerId}-listbox`,"aria-label":this.accessibleName||"Options"},i.map((t=>a("md-menu-item",{key:t.value,id:`${this.triggerId}-opt-${t.value}`,presentation:"option",type:"radio","check-position":"start","keep-open":true,part:t.value===this.value?"option option-selected":"option",disabled:t.disabled,selected:t.value===this.value,headline:t.label,"supporting-text":t.supportingText||"",onMdClick:()=>this.selectValue(t.value)},t.icon?a("span",{slot:"leading-icon",part:"option-icon",class:"material-symbols-outlined md-select__option-icon",style:t.iconColor?{color:t.iconColor}:undefined,"aria-hidden":"true"},t.icon):null)))))}render(){return a(n,{key:"9673c714adf54a5c44d38754a7539d75a530e750",class:{"md-select":true,[`md-select--${this.variant}`]:true,"md-select--open":this.open,"md-select--disabled":this.disabled,"md-select--loading":this.loading},"aria-haspopup":"listbox","aria-busy":this.loading?"true":undefined},this.renderTrigger(),this.renderMenu(),a("div",{key:"4d83d5a2e165c72dfeddb87ad9679ecaaf964d44",class:"md-select__options",hidden:true},a("slot",{key:"0dbc2ee39737fc9fa38af8c0c2da4ca154807777",onSlotchange:()=>this.refreshOptions()})))}static get formAssociated(){return true}get el(){return this}static get watchers(){return{value:[{syncFormValue:0}],required:[{syncValidity:0}],valueMissingLabel:[{syncValidity:0}],options:[{refreshOptions:0}],open:[{syncMenu:0}]}}static get style(){return V()}},[321,"md-select",{valueMissingLabel:[1,"value-missing-label"],reserveSupportingSpace:[4,"reserve-supporting-space"],variant:[513],label:[1],placeholder:[1],value:[1537],disabled:[516],required:[516],error:[516],errorText:[1,"error-text"],supportingText:[1,"supporting-text"],density:[514],clearable:[516],matchTriggerWidth:[516,"match-trigger-width"],placement:[1],maxHeight:[8,"max-height"],options:[1],virtualize:[1],filterable:[4],filterMode:[1,"filter-mode"],rowHeight:[2,"row-height"],name:[513],searchPlaceholder:[1,"search-placeholder"],filterLabel:[1,"filter-label"],noResultsText:[1,"no-results-text"],noOptionsText:[1,"no-options-text"],clearLabel:[1,"clear-label"],searchingLabel:[1,"searching-label"],loadingText:[1,"loading-text"],clearIcon:[1,"clear-icon"],dropdownIcon:[1,"dropdown-icon"],loading:[516],fullWidth:[516,"full-width"],open:[1540],optionsData:[32],triggerId:[32],query:[32],show:[64],close:[64],focusTrigger:[64],reset:[64],loadOptions:[64],setQuery:[64],getLabels:[64],getValidity:[64],checkValidity:[64],reportValidity:[64],setCustomValidity:[64]},[[0,"mdSelectOptionChange","onOptionChange"],[0,"keydown","handleKeyDown"]],{value:[{syncFormValue:0}],required:[{syncValidity:0}],valueMissingLabel:[{syncValidity:0}],options:[{refreshOptions:0}],open:[{syncMenu:0}]}]);function T(){if(typeof customElements==="undefined"){return}const t=["md-select","md-icon-button","md-loading-indicator","md-menu","md-menu-item","md-progress-indicator","md-ripple","md-text-field"];t.forEach((t=>{switch(t){case"md-select":if(!customElements.get(r(t))){customElements.define(r(t),E)}break;case"md-icon-button":if(!customElements.get(r(t))){_()}break;case"md-loading-indicator":if(!customElements.get(r(t))){x()}break;case"md-menu":if(!customElements.get(r(t))){v()}break;case"md-menu-item":if(!customElements.get(r(t))){w()}break;case"md-progress-indicator":if(!customElements.get(r(t))){k()}break;case"md-ripple":if(!customElements.get(r(t))){z()}break;case"md-text-field":if(!customElements.get(r(t))){C()}break}}))}T();export{E as M,T as d};
|
|
2
|
+
//# sourceMappingURL=p-UdGDg2oJ.js.map
|