@blueprint-chart/lib 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/embed-DxKuPk6P.js +315 -0
- package/dist/embed.d.ts +3 -0
- package/dist/embed.js +8 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +622 -6812
- package/dist/lib/lib.iife.js +77 -3
- package/dist/render-bpc-CnZB0sa5.js +6278 -0
- package/dist/runtime/chart-css.d.ts +1 -1
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/messages.d.ts +10 -0
- package/dist/runtime/runtime.d.ts +8 -0
- package/dist/runtime.d.ts +2 -0
- package/dist/runtime.js +52 -0
- package/package.json +13 -2
package/dist/lib/lib.iife.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var BlueprintChart=(function(
|
|
1
|
+
var BlueprintChart=(function(cn){"use strict";var R5=Object.defineProperty;var F5=(cn,Wn,wr)=>Wn in cn?R5(cn,Wn,{enumerable:!0,configurable:!0,writable:!0,value:wr}):cn[Wn]=wr;var oe=(cn,Wn,wr)=>F5(cn,typeof Wn!="symbol"?Wn+"":Wn,wr);const Wn=`
|
|
2
2
|
/* Blueprint Chart — Runtime Embed Styles
|
|
3
3
|
CSS custom properties with baked-in defaults for standalone iframe usage. */
|
|
4
4
|
|
|
@@ -192,5 +192,79 @@ body {
|
|
|
192
192
|
margin: 0;
|
|
193
193
|
overflow: hidden;
|
|
194
194
|
}
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
|
|
196
|
+
/* Dark theme: activated by data-bs-theme="dark" on the document (matching the
|
|
197
|
+
editor's convention). The chart owns these colors; the dark frame background
|
|
198
|
+
also drives the renderer's resolveBackgroundColor, so data-mark colors and
|
|
199
|
+
contrast labels adapt at render time. Scoped to .bc-frame so these override
|
|
200
|
+
the frame's own light --bc-frame-bg / --bc-text-color declarations (which are
|
|
201
|
+
set on .bc-frame and would otherwise shadow a document-level override). */
|
|
202
|
+
[data-bs-theme="dark"] body {
|
|
203
|
+
/* color themes above-bar value labels (fill: currentColor). */
|
|
204
|
+
background: #1c1c1c;
|
|
205
|
+
color: rgba(255, 255, 255, 0.9);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
[data-bs-theme="dark"] .bc-frame {
|
|
209
|
+
--bc-frame-bg: #1c1c1c;
|
|
210
|
+
--bc-text-color: rgba(255, 255, 255, 0.9);
|
|
211
|
+
--bc-axis-color: rgba(255, 255, 255, 0.6);
|
|
212
|
+
--bc-grid-color: #333;
|
|
213
|
+
|
|
214
|
+
color: rgba(255, 255, 255, 0.9);
|
|
215
|
+
}
|
|
216
|
+
`,wr="blueprint-chart-resize",fs="blueprint-chart-error";function S0(t){return typeof t=="object"&&t!==null&&t.type===wr&&typeof t.height=="number"?t.height:null}function M0(t){return typeof t=="object"&&t!==null&&t.type===fs}const $0=L0();function L0(){var t;try{if(typeof globalThis<"u"){const n=globalThis.BLUEPRINT_CHART_RUNTIME_URL;if(typeof n=="string"&&n)return n}return typeof document>"u"?"":((t=document.currentScript)==null?void 0:t.src)??""}catch{return""}}const ic=new Map;let us=null;function C0(){us||(us=t=>{for(const[n,e]of ic)if(t.source===n.contentWindow){e(t);return}},window.addEventListener("message",us))}function hs(){C0(),document.querySelectorAll('script[type="application/blueprint-chart"]').forEach(T0)}function T0(t){var a,i;const n=(a=t.textContent)==null?void 0:a.trim();if(!n)return;const e=document.createElement("iframe");e.className="blueprint-chart-iframe",e.style.cssText="border: none; width: 100%; display: block;",e.setAttribute("sandbox","allow-scripts"),e.setAttribute("title","Blueprint Chart"),(i=t.parentNode)==null||i.insertBefore(e,t),e.srcdoc=O0(n,$0);const r=o=>{const s=S0(o.data);if(s!==null){e.style.height=`${s}px`;return}M0(o.data)&&console.warn("Blueprint Chart: could not render embed.",o.data.message)};ic.set(e,r)}function O0(t,n,e){const r=n?`<script src="${E0(n)}"><\/script>`:"",a="<html>",i=n?["try {",' window.BlueprintChart.renderBpc(document.getElementById("chart"), __BPC_SRC__);',"}","catch (e) {",` parent.postMessage({ type: "${fs}", message: String(e) }, "*");`,"}"]:[`parent.postMessage({ type: "${fs}", message: "Blueprint Chart runtime URL unavailable" }, "*");`];return["<!DOCTYPE html>",`${a}<head>`,`<style>${Wn}</style>`,"</head><body>",'<div id="chart" class="blueprint-chart-container"></div>',r,"<script>",`var __BPC_SRC__ = ${N0(t)};`,"function notifySize() {"," var h = document.documentElement.scrollHeight;",` parent.postMessage({ type: "${wr}", height: h }, "*");`,"}",...i,"notifySize();","new ResizeObserver(notifySize).observe(document.body);","<\/script>","</body></html>"].filter(Boolean).join(`
|
|
217
|
+
`)}function N0(t){return JSON.stringify(t).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function E0(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function oc(t){let n=0;for(const e of t)e.type==="data"&&n++;return n}function D0(t){const n={properties:[],data:null,colorizes:[],highlights:[],areaFills:[],annotations:[],series:[],scenes:[],transforms:[]};for(const e of t)switch(e.type){case"property":n.properties.push(e);break;case"data":n.data=e;break;case"colorize":n.colorizes.push(e);break;case"highlight":n.highlights.push(e);break;case"area-fill":n.areaFills.push(e);break;case"annotation":n.annotations.push(e);break;case"series":n.series.push(e);break;case"scene":n.scenes.push(e);break;case"transform":n.transforms.push(e);break}return n}function P0(t){const n={properties:[],data:null,colorizes:[],highlights:[],areaFills:[],annotations:[],series:[],transforms:[]};for(const e of t)switch(e.type){case"property":n.properties.push(e);break;case"data":n.data=e;break;case"colorize":n.colorizes.push(e);break;case"highlight":n.highlights.push(e);break;case"area-fill":n.areaFills.push(e);break;case"annotation":n.annotations.push(e);break;case"series":n.series.push(e);break;case"transform":n.transforms.push(e);break}return n}function z0(t,n){function e(){this.constructor=t}e.prototype=n.prototype,t.prototype=new e}function Ar(t,n,e,r){var a=Error.call(this,t);return Object.setPrototypeOf&&Object.setPrototypeOf(a,Ar.prototype),a.expected=n,a.found=e,a.location=r,a.name="SyntaxError",a}z0(Ar,Error);function ds(t,n,e){return e=e||" ",t.length>n?t:(n-=t.length,e+=e.repeat(n),t+e.slice(0,n))}Ar.prototype.format=function(t){var n="Error: "+this.message;if(this.location){var e=null,r;for(r=0;r<t.length;r++)if(t[r].source===this.location.source){e=t[r].text.split(/\r\n|\n|\r/g);break}var a=this.location.start,i=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(a):a,o=this.location.source+":"+i.line+":"+i.column;if(e){var s=this.location.end,l=ds("",i.line.toString().length," "),c=e[a.line-1],f=a.line===s.line?s.column:c.length+1,h=f-a.column||1;n+=`
|
|
218
|
+
--> `+o+`
|
|
219
|
+
`+l+` |
|
|
220
|
+
`+i.line+" | "+c+`
|
|
221
|
+
`+l+" | "+ds("",a.column-1," ")+ds("",h,"^")}else n+=`
|
|
222
|
+
at `+o}return n},Ar.buildMessage=function(t,n){var e={literal:function(c){return'"'+a(c.text)+'"'},class:function(c){var f=c.parts.map(function(h){return Array.isArray(h)?i(h[0])+"-"+i(h[1]):i(h)});return"["+(c.inverted?"^":"")+f.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(c){return c.description}};function r(c){return c.charCodeAt(0).toString(16).toUpperCase()}function a(c){return c.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(f){return"\\x0"+r(f)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(f){return"\\x"+r(f)})}function i(c){return c.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(f){return"\\x0"+r(f)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(f){return"\\x"+r(f)})}function o(c){return e[c.type](c)}function s(c){var f=c.map(o),h,d;if(f.sort(),f.length>0){for(h=1,d=1;h<f.length;h++)f[h-1]!==f[h]&&(f[d]=f[h],d++);f.length=d}switch(f.length){case 1:return f[0];case 2:return f[0]+" or "+f[1];default:return f.slice(0,-1).join(", ")+", or "+f[f.length-1]}}function l(c){return c?'"'+a(c)+'"':"end of input"}return"Expected "+s(t)+" but "+l(n)+" found."};function R0(t,n){n=n!==void 0?n:{};var e={},r=n.grammarSource,a={Chart:l0},i=l0,o="chart",s="{",l="}",c="data",f="=",h=",",d=" ",g="colorize",v="highlight",m="area-fill",b="annotation",x="range",A="note",w="series",S="scene",z="transform",Y="%",G="-",_=".",B='"',P="\\",$="n",N="r",L="t",M="u",D="//",q="/*",V="*/",C=/^[ \t]/,I=/^[^\t\n\r{}=]/,W=/^[a-zA-Z_#]/,it=/^[a-zA-Z0-9_#\-]/,rt=/^[0-9]/,ct=/^[eE]/,pt=/^[+\-]/,xt=/^[^"\\]/,yt=/^[0-9a-fA-F]/,bt=/^[^\n]/,kt=/^[ \t\n\r]/,j=te("chart",!1),J=te("{",!1),X=te("}",!1),O=Pn([" "," "],!1,!1),ht=te("data",!1),mt=te("=",!1),vt=te(",",!1),Tt=te(" ",!1),Ht=Pn([" ",`
|
|
223
|
+
`,"\r","{","}","="],!0,!1),Ft=te("colorize",!1),Yt=te("highlight",!1),Ut=te("area-fill",!1),Gt=te("annotation",!1),dt=te("range",!1),$t=te("note",!1),U=te("series",!1),T=te("scene",!1),F=te("transform",!1),E=te("%",!1),at=gi("identifier"),wt=Pn([["a","z"],["A","Z"],"_","#"],!1,!1),Ct=Pn([["a","z"],["A","Z"],["0","9"],"_","#","-"],!1,!1),st=te("-",!1),Et=te(".",!1),Nt=Pn([["0","9"]],!1,!1),tt=Pn(["e","E"],!1,!1),St=Pn(["+","-"],!1,!1),Dt=gi("string"),Pt=te('"',!1),Zt=te("\\",!1),ae=Pn(['"',"\\"],!0,!1),$e=te("n",!1),Ze=te("r",!1),Le=te("t",!1),yn=te("u",!1),fe=Pn([["0","9"],["a","f"],["A","F"]],!1,!1),ie=M5(),sn=te("//",!1),ft=Pn([`
|
|
224
|
+
`],!0,!1),et=te("/*",!1),gt=te("*/",!1),Lt=gi("blank space"),At=Pn([" "," ",`
|
|
225
|
+
`,"\r"],!1,!1),Kt=gi("whitespace"),He=gi("optional whitespace"),ln=function(u,y){oc(y)>1&&or("duplicate data block — a chart or scene may define at most one data { } block");const k=D0(y);return{type:"chart",chartType:u,properties:k.properties,data:k.data,colorizes:k.colorizes,highlights:k.highlights,areaFills:k.areaFills,annotations:k.annotations,series:k.series,scenes:k.scenes,transforms:k.transforms}},Ce=function(u,y){return u.length&&(y.leadingComments=u),y},Te=function(u){return{type:"data",entries:u}},ar=function(u,y){return u.length&&(y.leadingComments=u),y},ir=function(u,y,k){return k},fi=function(u,y,k){const R=[y,...k];return{type:"property",key:u.name,...u.quoted&&u.name==="series"?{quotedKey:!0}:{},value:R[0].value,isPercentage:!1,values:R.map(H=>H.value)}},ui=function(u,y){return{type:"property",key:u.name,...u.quoted&&u.name==="series"?{quotedKey:!0}:{},value:y.value,isPercentage:y.isPercentage}},nt=function(u){return{name:u,quoted:!0}},Xt=function(u){return{name:u,quoted:!1}},ee=function(u,y){return{type:"property",key:u,...u==="series"?{quotedKey:!0}:{},value:y.value,isPercentage:y.isPercentage}},Qt=function(u){return u.trim()},be=function(u,y){return{type:"colorize",target:u,properties:y}},je=function(){or('colorize needs a quoted target, e.g. colorize "2021" { ... }')},Xr=function(u,y){return{type:"colorize",target:u,properties:y,fromHighlight:!0}},is=function(u){return{type:"highlight",target:u,properties:[]}},os=function(){or('highlight needs a quoted target, e.g. highlight "2021" { ... } or highlight "2021"')},hi=function(u,y,k){return{type:"area-fill",from:u,to:y,properties:k}},j_=function(){or('area-fill needs two quoted targets, e.g. area-fill "Revenue" "Cost" { ... }')},K_=function(){or('area-fill needs two quoted targets, e.g. area-fill "Revenue" "Cost" { ... }')},J_=function(u,y){return{type:"annotation",kind:"point",target:u,properties:y}},Q_=function(){or('annotation needs a quoted target, e.g. annotation "2021" { ... }')},t5=function(u){return{type:"annotation",kind:"range",properties:u}},e5=function(u){return{type:"annotation",kind:"free",properties:u}},n5=function(u,y){return{type:"series",name:u,properties:y}},r5=function(){or('series needs a quoted name, e.g. series "Revenue" { ... }')},a5=function(u,y){oc(y)>1&&or("duplicate data block — a chart or scene may define at most one data { } block");const k=P0(y);return{type:"scene",name:u??null,properties:k.properties,data:k.data,colorizes:k.colorizes,highlights:k.highlights,areaFills:k.areaFills,annotations:k.annotations,series:k.series,transforms:k.transforms}},i5=function(u,y){return{type:"transform",transformType:u,properties:y}},o5=function(u,y){return u.length&&(y.leadingComments=u),y},s5=function(u){return u},l5=function(u,y){return{type:"property",key:u,value:y.value,isPercentage:y.isPercentage}},c5=function(u){return{value:u,isPercentage:!0}},f5=function(u){return{value:u,isPercentage:!1}},u5=function(u){return{value:u,isPercentage:!1}},h5=function(u){return{value:u,isPercentage:!1}},d5=function(u){return parseFloat(u)},g5=function(u){return u.join("")},p5=function(u){return u},m5=function(){return'"'},b5=function(){return"\\"},y5=function(){return`
|
|
226
|
+
`},v5=function(){return"\r"},x5=function(){return" "},w5=function(u){return String.fromCharCode(parseInt(u,16))},A5=function(u){or("Unknown escape sequence \\"+u)},o0=function(u){return u},_5=function(u){return u},k5=function(u){return u.trim()},S5=function(u){return u.trim()},p=n.peg$currPos|0,zt=p,Ca=[{line:1,column:1}],Dn=p,ss=n.peg$maxFailExpected||[],Z=n.peg$silentFails|0,di;if(n.startRule){if(!(n.startRule in a))throw new Error(`Can't start parsing from rule "`+n.startRule+'".');i=a[n.startRule]}function or(u,y){throw y=y!==void 0?y:nc(zt,p),L5(u,y)}function te(u,y){return{type:"literal",text:u,ignoreCase:y}}function Pn(u,y,k){return{type:"class",parts:u,inverted:y,ignoreCase:k}}function M5(){return{type:"any"}}function $5(){return{type:"end"}}function gi(u){return{type:"other",description:u}}function s0(u){var y=Ca[u],k;if(y)return y;if(u>=Ca.length)k=Ca.length-1;else for(k=u;!Ca[--k];);for(y=Ca[k],y={line:y.line,column:y.column};k<u;)t.charCodeAt(k)===10?(y.line++,y.column=1):y.column++,k++;return Ca[u]=y,y}function nc(u,y,k){var R=s0(u),H=s0(y),K={source:r,start:{offset:u,line:R.line,column:R.column},end:{offset:y,line:H.line,column:H.column}};return K}function Q(u){p<Dn||(p>Dn&&(Dn=p,ss=[]),ss.push(u))}function L5(u,y){return new Ar(u,null,null,y)}function C5(u,y,k){return new Ar(Ar.buildMessage(u,y),u,y,k)}function l0(){var u,y,k,R,H,K,lt,Mt;if(u=p,Rt(),t.substr(p,5)===o?(y=o,p+=5):(y=e,Z===0&&Q(j)),y!==e)if(k=zn(),k!==e)if(R=pi(),R!==e)if(Rt(),t.charCodeAt(p)===123?(H=s,p++):(H=e,Z===0&&Q(J)),H!==e){for(K=[],lt=c0();lt!==e;)K.push(lt),lt=c0();lt=Rt(),t.charCodeAt(p)===125?(Mt=l,p++):(Mt=e,Z===0&&Q(X)),Mt!==e?(Rt(),zt=u,u=ln(R,K)):(p=u,u=e)}else p=u,u=e;else p=u,u=e;else p=u,u=e;else p=u,u=e;return u}function c0(){var u,y,k,R,H;if(u=p,y=ac(),k=f0(),k===e&&(k=d0(),k===e&&(k=g0(),k===e&&(k=p0(),k===e&&(k=b0(),k===e&&(k=y0(),k===e&&(k=m0(),k===e&&(k=v0(),k===e&&(k=E5(),k===e&&(k=x0(),k===e&&(k=rc())))))))))),k!==e){for(R=[],H=t.charAt(p),C.test(H)?p++:(H=e,Z===0&&Q(O));H!==e;)R.push(H),H=t.charAt(p),C.test(H)?p++:(H=e,Z===0&&Q(O));H=cs(),H===e&&(H=null),Oa(),zt=u,u=Ce(y,k)}else p=u,u=e;return u}function f0(){var u,y,k,R,H,K;if(u=p,t.substr(p,4)===c?(y=c,p+=4):(y=e,Z===0&&Q(ht)),y!==e)if(Rt(),t.charCodeAt(p)===123?(k=s,p++):(k=e,Z===0&&Q(J)),k!==e){for(R=[],H=u0();H!==e;)R.push(H),H=u0();H=Rt(),t.charCodeAt(p)===125?(K=l,p++):(K=e,Z===0&&Q(X)),K!==e?(zt=u,u=Te(R)):(p=u,u=e)}else p=u,u=e;else p=u,u=e;return u}function u0(){var u,y,k,R,H;if(u=p,y=ac(),k=O5(),k===e&&(k=T5()),k!==e){for(R=[],H=t.charAt(p),C.test(H)?p++:(H=e,Z===0&&Q(O));H!==e;)R.push(H),H=t.charAt(p),C.test(H)?p++:(H=e,Z===0&&Q(O));H=cs(),H===e&&(H=null),Oa(),zt=u,u=ar(y,k)}else p=u,u=e;return u}function T5(){var u,y,k,R,H,K,lt,Mt;if(u=p,y=h0(),y!==e)if(Rt(),t.charCodeAt(p)===61?(k=f,p++):(k=e,Z===0&&Q(mt)),k!==e)if(Rt(),R=Ta(),R!==e){if(H=[],K=p,t.charCodeAt(p)===44?(lt=h,p++):(lt=e,Z===0&&Q(vt)),lt!==e?(Rt(),Mt=Ta(),Mt!==e?(zt=K,K=ir(y,R,Mt)):(p=K,K=e)):(p=K,K=e),K!==e)for(;K!==e;)H.push(K),K=p,t.charCodeAt(p)===44?(lt=h,p++):(lt=e,Z===0&&Q(vt)),lt!==e?(Rt(),Mt=Ta(),Mt!==e?(zt=K,K=ir(y,R,Mt)):(p=K,K=e)):(p=K,K=e);else H=e;H!==e?(zt=u,u=fi(y,R,H)):(p=u,u=e)}else p=u,u=e;else p=u,u=e;else p=u,u=e;return u===e&&(u=p,y=h0(),y!==e?(Rt(),t.charCodeAt(p)===61?(k=f,p++):(k=e,Z===0&&Q(mt)),k!==e?(Rt(),R=Ta(),R!==e?(zt=u,u=ui(y,R)):(p=u,u=e)):(p=u,u=e)):(p=u,u=e)),u}function h0(){var u,y;return u=p,y=vn(),y!==e&&(zt=u,y=nt(y)),u=y,u===e&&(u=p,y=pi(),y!==e&&(zt=u,y=Xt(y)),u=y),u}function O5(){var u,y,k,R;return u=p,y=N5(),y!==e?(t.charCodeAt(p)===9?(k=d,p++):(k=e,Z===0&&Q(Tt)),k!==e?(Rt(),R=Ta(),R!==e?(zt=u,u=ee(y,R)):(p=u,u=e)):(p=u,u=e)):(p=u,u=e),u}function N5(){var u,y,k,R;if(u=p,y=p,k=[],R=t.charAt(p),I.test(R)?p++:(R=e,Z===0&&Q(Ht)),R!==e)for(;R!==e;)k.push(R),R=t.charAt(p),I.test(R)?p++:(R=e,Z===0&&Q(Ht));else k=e;return k!==e?y=t.substring(y,p):y=k,y!==e&&(zt=u,y=Qt(y)),u=y,u}function d0(){var u,y,k,R,H,K,lt,Mt;if(u=p,t.substr(p,8)===g?(y=g,p+=8):(y=e,Z===0&&Q(Ft)),y!==e)if(k=zn(),k!==e)if(R=vn(),R!==e)if(Rt(),t.charCodeAt(p)===123?(H=s,p++):(H=e,Z===0&&Q(J)),H!==e){for(Rt(),K=[],lt=Oe();lt!==e;)K.push(lt),lt=Oe();lt=Rt(),t.charCodeAt(p)===125?(Mt=l,p++):(Mt=e,Z===0&&Q(X)),Mt!==e?(zt=u,u=be(R,K)):(p=u,u=e)}else p=u,u=e;else p=u,u=e;else p=u,u=e;else p=u,u=e;return u===e&&(u=p,t.substr(p,8)===g?(y=g,p+=8):(y=e,Z===0&&Q(Ft)),y!==e?(k=Rt(),t.charCodeAt(p)===123?(R=s,p++):(R=e,Z===0&&Q(J)),R!==e?(zt=u,u=je()):(p=u,u=e)):(p=u,u=e)),u}function g0(){var u,y,k,R,H,K,lt,Mt,ue,ne;if(u=p,t.substr(p,9)===v?(y=v,p+=9):(y=e,Z===0&&Q(Yt)),y!==e)if(k=zn(),k!==e)if(R=vn(),R!==e)if(H=Rt(),t.charCodeAt(p)===123?(K=s,p++):(K=e,Z===0&&Q(J)),K!==e){for(lt=Rt(),Mt=[],ue=Oe();ue!==e;)Mt.push(ue),ue=Oe();ue=Rt(),t.charCodeAt(p)===125?(ne=l,p++):(ne=e,Z===0&&Q(X)),ne!==e?(zt=u,u=Xr(R,Mt)):(p=u,u=e)}else p=u,u=e;else p=u,u=e;else p=u,u=e;else p=u,u=e;return u===e&&(u=p,t.substr(p,9)===v?(y=v,p+=9):(y=e,Z===0&&Q(Yt)),y!==e?(k=zn(),k!==e?(R=vn(),R!==e?(H=p,Z++,K=p,lt=Rt(),t.charCodeAt(p)===123?(Mt=s,p++):(Mt=e,Z===0&&Q(J)),Mt!==e?(lt=[lt,Mt],K=lt):(p=K,K=e),Z--,K===e?H=void 0:(p=H,H=e),H!==e?(zt=u,u=is(R)):(p=u,u=e)):(p=u,u=e)):(p=u,u=e)):(p=u,u=e),u===e&&(u=p,t.substr(p,9)===v?(y=v,p+=9):(y=e,Z===0&&Q(Yt)),y!==e?(k=Rt(),t.charCodeAt(p)===123?(R=s,p++):(R=e,Z===0&&Q(J)),R!==e?(zt=u,u=os()):(p=u,u=e)):(p=u,u=e))),u}function p0(){var u,y,k,R,H,K,lt,Mt,ue,ne;if(u=p,t.substr(p,9)===m?(y=m,p+=9):(y=e,Z===0&&Q(Ut)),y!==e)if(k=zn(),k!==e)if(R=vn(),R!==e)if(H=zn(),H!==e)if(K=vn(),K!==e)if(Rt(),t.charCodeAt(p)===123?(lt=s,p++):(lt=e,Z===0&&Q(J)),lt!==e){for(Rt(),Mt=[],ue=Oe();ue!==e;)Mt.push(ue),ue=Oe();ue=Rt(),t.charCodeAt(p)===125?(ne=l,p++):(ne=e,Z===0&&Q(X)),ne!==e?(zt=u,u=hi(R,K,Mt)):(p=u,u=e)}else p=u,u=e;else p=u,u=e;else p=u,u=e;else p=u,u=e;else p=u,u=e;else p=u,u=e;return u===e&&(u=p,t.substr(p,9)===m?(y=m,p+=9):(y=e,Z===0&&Q(Ut)),y!==e?(k=zn(),k!==e?(R=vn(),R!==e?(H=Rt(),t.charCodeAt(p)===123?(K=s,p++):(K=e,Z===0&&Q(J)),K!==e?(zt=u,u=j_()):(p=u,u=e)):(p=u,u=e)):(p=u,u=e)):(p=u,u=e),u===e&&(u=p,t.substr(p,9)===m?(y=m,p+=9):(y=e,Z===0&&Q(Ut)),y!==e?(k=Rt(),t.charCodeAt(p)===123?(R=s,p++):(R=e,Z===0&&Q(J)),R!==e?(zt=u,u=K_()):(p=u,u=e)):(p=u,u=e))),u}function m0(){var u,y,k,R,H,K,lt,Mt;if(u=p,t.substr(p,10)===b?(y=b,p+=10):(y=e,Z===0&&Q(Gt)),y!==e)if(k=zn(),k!==e)if(R=vn(),R!==e)if(Rt(),t.charCodeAt(p)===123?(H=s,p++):(H=e,Z===0&&Q(J)),H!==e){for(Rt(),K=[],lt=Oe();lt!==e;)K.push(lt),lt=Oe();lt=Rt(),t.charCodeAt(p)===125?(Mt=l,p++):(Mt=e,Z===0&&Q(X)),Mt!==e?(zt=u,u=J_(R,K)):(p=u,u=e)}else p=u,u=e;else p=u,u=e;else p=u,u=e;else p=u,u=e;return u===e&&(u=p,t.substr(p,10)===b?(y=b,p+=10):(y=e,Z===0&&Q(Gt)),y!==e?(k=Rt(),t.charCodeAt(p)===123?(R=s,p++):(R=e,Z===0&&Q(J)),R!==e?(zt=u,u=Q_()):(p=u,u=e)):(p=u,u=e)),u}function b0(){var u,y,k,R,H,K;if(u=p,t.substr(p,5)===x?(y=x,p+=5):(y=e,Z===0&&Q(dt)),y!==e)if(Rt(),t.charCodeAt(p)===123?(k=s,p++):(k=e,Z===0&&Q(J)),k!==e){for(Rt(),R=[],H=Oe();H!==e;)R.push(H),H=Oe();H=Rt(),t.charCodeAt(p)===125?(K=l,p++):(K=e,Z===0&&Q(X)),K!==e?(zt=u,u=t5(R)):(p=u,u=e)}else p=u,u=e;else p=u,u=e;return u}function y0(){var u,y,k,R,H,K;if(u=p,t.substr(p,4)===A?(y=A,p+=4):(y=e,Z===0&&Q($t)),y!==e)if(Rt(),t.charCodeAt(p)===123?(k=s,p++):(k=e,Z===0&&Q(J)),k!==e){for(Rt(),R=[],H=Oe();H!==e;)R.push(H),H=Oe();H=Rt(),t.charCodeAt(p)===125?(K=l,p++):(K=e,Z===0&&Q(X)),K!==e?(zt=u,u=e5(R)):(p=u,u=e)}else p=u,u=e;else p=u,u=e;return u}function v0(){var u,y,k,R,H,K,lt,Mt;if(u=p,t.substr(p,6)===w?(y=w,p+=6):(y=e,Z===0&&Q(U)),y!==e)if(k=zn(),k!==e)if(R=vn(),R!==e)if(Rt(),t.charCodeAt(p)===123?(H=s,p++):(H=e,Z===0&&Q(J)),H!==e){for(Rt(),K=[],lt=Oe();lt!==e;)K.push(lt),lt=Oe();lt=Rt(),t.charCodeAt(p)===125?(Mt=l,p++):(Mt=e,Z===0&&Q(X)),Mt!==e?(zt=u,u=n5(R,K)):(p=u,u=e)}else p=u,u=e;else p=u,u=e;else p=u,u=e;else p=u,u=e;return u===e&&(u=p,t.substr(p,6)===w?(y=w,p+=6):(y=e,Z===0&&Q(U)),y!==e?(k=Rt(),t.charCodeAt(p)===123?(R=s,p++):(R=e,Z===0&&Q(J)),R!==e?(zt=u,u=r5()):(p=u,u=e)):(p=u,u=e)),u}function E5(){var u,y,k,R,H,K,lt,Mt;if(u=p,t.substr(p,5)===S?(y=S,p+=5):(y=e,Z===0&&Q(T)),y!==e)if(k=zn(),k!==e)if(R=vn(),R===e&&(R=null),Rt(),t.charCodeAt(p)===123?(H=s,p++):(H=e,Z===0&&Q(J)),H!==e){for(K=[],lt=w0();lt!==e;)K.push(lt),lt=w0();lt=Rt(),t.charCodeAt(p)===125?(Mt=l,p++):(Mt=e,Z===0&&Q(X)),Mt!==e?(zt=u,u=a5(R,K)):(p=u,u=e)}else p=u,u=e;else p=u,u=e;else p=u,u=e;return u}function x0(){var u,y,k,R,H,K,lt,Mt;if(u=p,t.substr(p,9)===z?(y=z,p+=9):(y=e,Z===0&&Q(F)),y!==e)if(k=zn(),k!==e)if(R=pi(),R!==e)if(Rt(),t.charCodeAt(p)===123?(H=s,p++):(H=e,Z===0&&Q(J)),H!==e){for(Rt(),K=[],lt=Oe();lt!==e;)K.push(lt),lt=Oe();lt=Rt(),t.charCodeAt(p)===125?(Mt=l,p++):(Mt=e,Z===0&&Q(X)),Mt!==e?(zt=u,u=i5(R,K)):(p=u,u=e)}else p=u,u=e;else p=u,u=e;else p=u,u=e;else p=u,u=e;return u}function w0(){var u,y,k,R,H;if(u=p,y=ac(),k=f0(),k===e&&(k=d0(),k===e&&(k=g0(),k===e&&(k=p0(),k===e&&(k=b0(),k===e&&(k=y0(),k===e&&(k=m0(),k===e&&(k=v0(),k===e&&(k=x0(),k===e&&(k=rc()))))))))),k!==e){for(R=[],H=t.charAt(p),C.test(H)?p++:(H=e,Z===0&&Q(O));H!==e;)R.push(H),H=t.charAt(p),C.test(H)?p++:(H=e,Z===0&&Q(O));H=cs(),H===e&&(H=null),Oa(),zt=u,u=o5(y,k)}else p=u,u=e;return u}function Oe(){var u,y;return u=p,Rt(),y=rc(),y!==e?(Rt(),zt=u,u=s5(y)):(p=u,u=e),u}function rc(){var u,y,k,R;return u=p,y=D5(),y!==e?(Rt(),t.charCodeAt(p)===61?(k=f,p++):(k=e,Z===0&&Q(mt)),k!==e?(Rt(),R=Ta(),R!==e?(zt=u,u=l5(y,R)):(p=u,u=e)):(p=u,u=e)):(p=u,u=e),u}function D5(){var u;return u=vn(),u===e&&(u=pi()),u}function Ta(){var u,y,k;return u=p,y=A0(),y!==e?(t.charCodeAt(p)===37?(k=Y,p++):(k=e,Z===0&&Q(E)),k!==e?(zt=u,u=c5(y)):(p=u,u=e)):(p=u,u=e),u===e&&(u=p,y=A0(),y!==e&&(zt=u,y=f5(y)),u=y,u===e&&(u=p,y=vn(),y!==e&&(zt=u,y=u5(y)),u=y,u===e&&(u=p,y=pi(),y!==e&&(zt=u,y=h5(y)),u=y))),u}function pi(){var u,y,k,R,H;if(Z++,u=p,y=p,k=t.charAt(p),W.test(k)?p++:(k=e,Z===0&&Q(wt)),k!==e){for(R=[],H=t.charAt(p),it.test(H)?p++:(H=e,Z===0&&Q(Ct));H!==e;)R.push(H),H=t.charAt(p),it.test(H)?p++:(H=e,Z===0&&Q(Ct));k=[k,R],y=k}else p=y,y=e;return y!==e?u=t.substring(u,p):u=y,Z--,u===e&&(y=e,Z===0&&Q(at)),u}function A0(){var u,y,k,R,H,K,lt,Mt,ue,ne;if(u=p,y=p,k=p,t.charCodeAt(p)===45?(R=G,p++):(R=e,Z===0&&Q(st)),R===e&&(R=null),H=p,t.charCodeAt(p)===46?(K=_,p++):(K=e,Z===0&&Q(Et)),K!==e){if(lt=[],Mt=t.charAt(p),rt.test(Mt)?p++:(Mt=e,Z===0&&Q(Nt)),Mt!==e)for(;Mt!==e;)lt.push(Mt),Mt=t.charAt(p),rt.test(Mt)?p++:(Mt=e,Z===0&&Q(Nt));else lt=e;lt!==e?(K=[K,lt],H=K):(p=H,H=e)}else p=H,H=e;if(H===e){if(H=p,K=[],lt=t.charAt(p),rt.test(lt)?p++:(lt=e,Z===0&&Q(Nt)),lt!==e)for(;lt!==e;)K.push(lt),lt=t.charAt(p),rt.test(lt)?p++:(lt=e,Z===0&&Q(Nt));else K=e;if(K!==e){if(lt=p,t.charCodeAt(p)===46?(Mt=_,p++):(Mt=e,Z===0&&Q(Et)),Mt!==e){for(ue=[],ne=t.charAt(p),rt.test(ne)?p++:(ne=e,Z===0&&Q(Nt));ne!==e;)ue.push(ne),ne=t.charAt(p),rt.test(ne)?p++:(ne=e,Z===0&&Q(Nt));Mt=[Mt,ue],lt=Mt}else p=lt,lt=e;lt===e&&(lt=null),K=[K,lt],H=K}else p=H,H=e}if(H!==e){if(K=p,lt=t.charAt(p),ct.test(lt)?p++:(lt=e,Z===0&&Q(tt)),lt!==e){if(Mt=t.charAt(p),pt.test(Mt)?p++:(Mt=e,Z===0&&Q(St)),Mt===e&&(Mt=null),ue=[],ne=t.charAt(p),rt.test(ne)?p++:(ne=e,Z===0&&Q(Nt)),ne!==e)for(;ne!==e;)ue.push(ne),ne=t.charAt(p),rt.test(ne)?p++:(ne=e,Z===0&&Q(Nt));else ue=e;ue!==e?(lt=[lt,Mt,ue],K=lt):(p=K,K=e)}else p=K,K=e;K===e&&(K=null),R=[R,H,K],k=R}else p=k,k=e;return k!==e?y=t.substring(y,p):y=k,y!==e&&(zt=u,y=d5(y)),u=y,u}function vn(){var u,y,k,R;if(Z++,u=p,t.charCodeAt(p)===34?(y=B,p++):(y=e,Z===0&&Q(Pt)),y!==e){for(k=[],R=_0();R!==e;)k.push(R),R=_0();t.charCodeAt(p)===34?(R=B,p++):(R=e,Z===0&&Q(Pt)),R!==e?(zt=u,u=g5(k)):(p=u,u=e)}else p=u,u=e;return Z--,u===e&&(y=e,Z===0&&Q(Dt)),u}function _0(){var u,y,k;return u=p,t.charCodeAt(p)===92?(y=P,p++):(y=e,Z===0&&Q(Zt)),y!==e?(k=P5(),k!==e?(zt=u,u=p5(k)):(p=u,u=e)):(p=u,u=e),u===e&&(u=t.charAt(p),xt.test(u)?p++:(u=e,Z===0&&Q(ae))),u}function P5(){var u,y,k,R,H,K,lt,Mt;return u=p,t.charCodeAt(p)===34?(y=B,p++):(y=e,Z===0&&Q(Pt)),y!==e&&(zt=u,y=m5()),u=y,u===e&&(u=p,t.charCodeAt(p)===92?(y=P,p++):(y=e,Z===0&&Q(Zt)),y!==e&&(zt=u,y=b5()),u=y,u===e&&(u=p,t.charCodeAt(p)===110?(y=$,p++):(y=e,Z===0&&Q($e)),y!==e&&(zt=u,y=y5()),u=y,u===e&&(u=p,t.charCodeAt(p)===114?(y=N,p++):(y=e,Z===0&&Q(Ze)),y!==e&&(zt=u,y=v5()),u=y,u===e&&(u=p,t.charCodeAt(p)===116?(y=L,p++):(y=e,Z===0&&Q(Le)),y!==e&&(zt=u,y=x5()),u=y,u===e&&(u=p,t.charCodeAt(p)===117?(y=M,p++):(y=e,Z===0&&Q(yn)),y!==e?(k=p,R=p,H=t.charAt(p),yt.test(H)?p++:(H=e,Z===0&&Q(fe)),H!==e?(K=t.charAt(p),yt.test(K)?p++:(K=e,Z===0&&Q(fe)),K!==e?(lt=t.charAt(p),yt.test(lt)?p++:(lt=e,Z===0&&Q(fe)),lt!==e?(Mt=t.charAt(p),yt.test(Mt)?p++:(Mt=e,Z===0&&Q(fe)),Mt!==e?(H=[H,K,lt,Mt],R=H):(p=R,R=e)):(p=R,R=e)):(p=R,R=e)):(p=R,R=e),R!==e?k=t.substring(k,p):k=R,k!==e?(zt=u,u=w5(k)):(p=u,u=e)):(p=u,u=e),u===e&&(u=p,t.length>p?(y=t.charAt(p),p++):(y=e,Z===0&&Q(ie)),y!==e&&(zt=u,y=A5(y)),u=y)))))),u}function ls(){var u;return u=cs(),u===e&&(u=z5()),u}function cs(){var u,y,k,R;if(u=p,t.substr(p,2)===D?(y=D,p+=2):(y=e,Z===0&&Q(sn)),y!==e){for(k=[],R=t.charAt(p),bt.test(R)?p++:(R=e,Z===0&&Q(ft));R!==e;)k.push(R),R=t.charAt(p),bt.test(R)?p++:(R=e,Z===0&&Q(ft));y=[y,k],u=y}else p=u,u=e;return u}function z5(){var u,y,k,R,H,K;if(u=p,t.substr(p,2)===q?(y=q,p+=2):(y=e,Z===0&&Q(et)),y!==e){for(k=[],R=p,H=p,Z++,t.substr(p,2)===V?(K=V,p+=2):(K=e,Z===0&&Q(gt)),Z--,K===e?H=void 0:(p=H,H=e),H!==e?(t.length>p?(K=t.charAt(p),p++):(K=e,Z===0&&Q(ie)),K!==e?(H=[H,K],R=H):(p=R,R=e)):(p=R,R=e);R!==e;)k.push(R),R=p,H=p,Z++,t.substr(p,2)===V?(K=V,p+=2):(K=e,Z===0&&Q(gt)),Z--,K===e?H=void 0:(p=H,H=e),H!==e?(t.length>p?(K=t.charAt(p),p++):(K=e,Z===0&&Q(ie)),K!==e?(H=[H,K],R=H):(p=R,R=e)):(p=R,R=e);t.substr(p,2)===V?(R=V,p+=2):(R=e,Z===0&&Q(gt)),R!==e?(y=[y,k,R],u=y):(p=u,u=e)}else p=u,u=e;return u}function Oa(){var u,y;for(Z++,u=[],y=t.charAt(p),kt.test(y)?p++:(y=e,Z===0&&Q(At));y!==e;)u.push(y),y=t.charAt(p),kt.test(y)?p++:(y=e,Z===0&&Q(At));return Z--,y=e,Z===0&&Q(Lt),u}function ac(){var u,y,k,R;for(u=p,y=[],k=p,Oa(),R=k0(),R!==e?(zt=k,k=o0(R)):(p=k,k=e);k!==e;)y.push(k),k=p,Oa(),R=k0(),R!==e?(zt=k,k=o0(R)):(p=k,k=e);return k=Oa(),zt=u,u=_5(y),u}function k0(){var u,y,k,R,H,K,lt;if(u=p,t.substr(p,2)===D?(y=D,p+=2):(y=e,Z===0&&Q(sn)),y!==e){for(k=p,R=[],H=t.charAt(p),bt.test(H)?p++:(H=e,Z===0&&Q(ft));H!==e;)R.push(H),H=t.charAt(p),bt.test(H)?p++:(H=e,Z===0&&Q(ft));k=t.substring(k,p),zt=u,u=k5(k)}else p=u,u=e;if(u===e)if(u=p,t.substr(p,2)===q?(y=q,p+=2):(y=e,Z===0&&Q(et)),y!==e){for(k=p,R=[],H=p,K=p,Z++,t.substr(p,2)===V?(lt=V,p+=2):(lt=e,Z===0&&Q(gt)),Z--,lt===e?K=void 0:(p=K,K=e),K!==e?(t.length>p?(lt=t.charAt(p),p++):(lt=e,Z===0&&Q(ie)),lt!==e?(K=[K,lt],H=K):(p=H,H=e)):(p=H,H=e);H!==e;)R.push(H),H=p,K=p,Z++,t.substr(p,2)===V?(lt=V,p+=2):(lt=e,Z===0&&Q(gt)),Z--,lt===e?K=void 0:(p=K,K=e),K!==e?(t.length>p?(lt=t.charAt(p),p++):(lt=e,Z===0&&Q(ie)),lt!==e?(K=[K,lt],H=K):(p=H,H=e)):(p=H,H=e);k=t.substring(k,p),t.substr(p,2)===V?(R=V,p+=2):(R=e,Z===0&&Q(gt)),R!==e?(zt=u,u=S5(k)):(p=u,u=e)}else p=u,u=e;return u}function zn(){var u,y;if(Z++,u=[],y=t.charAt(p),kt.test(y)?p++:(y=e,Z===0&&Q(At)),y===e&&(y=ls()),y!==e)for(;y!==e;)u.push(y),y=t.charAt(p),kt.test(y)?p++:(y=e,Z===0&&Q(At)),y===e&&(y=ls());else u=e;return Z--,u===e&&(y=e,Z===0&&Q(Kt)),u}function Rt(){var u,y;for(Z++,u=[],y=t.charAt(p),kt.test(y)?p++:(y=e,Z===0&&Q(At)),y===e&&(y=ls());y!==e;)u.push(y),y=t.charAt(p),kt.test(y)?p++:(y=e,Z===0&&Q(At)),y===e&&(y=ls());return Z--,y=e,Z===0&&Q(He),u}if(di=i(),n.peg$library)return{peg$result:di,peg$currPos:p,peg$FAILED:e,peg$maxFailExpected:ss,peg$maxFailPos:Dn};if(di!==e&&p===t.length)return di;throw di!==e&&p<t.length&&Q($5()),C5(ss,Dn<t.length?t.charAt(Dn):null,Dn<t.length?nc(Dn,Dn+1):nc(Dn,Dn))}function F0(t){try{return R0(t)}catch(n){if(n instanceof Error&&"location"in n){const e=n.location,r=new SyntaxError(`${n.message} at ${e.start.line}:${e.start.column}`);throw r.location=e,r}throw n}}const sc=[{name:"Blueprint",label:"Blueprint",colors:["#2563A0","#D4A63A","#C94044","#2D8659","#4B90CF","#163A65"]},{name:"JosefAlbers",label:"Albers",colors:["#c00559","#de1f6c","#f3a20d","#f07a13","#de6716"]},{name:"Durorthod",label:"Amber",colors:["#2c0c00","#803c15","#c6782c","#ffa91d","#fff3ad"]},{name:"X41",label:"Berry",colors:["#411f6b","#623976","#be3979","#db928a","#e2c6a6"]},{name:"Bright",label:"Bright",colors:["#462255","#ff8811","#9dd9d2","#046e8f","#d44d5c"]},{name:"Cancri",label:"Cancri",colors:["#343854","#8c384d","#cf2438","#d95e31","#f0c742","#f8f0e5"]},{name:"Ceres",label:"Ceres",colors:["#181d20","#4a5f71","#6f8ba0","#f8f9fa"]},{name:"MarcChagall",label:"Chagall",colors:["#3f6f76","#69b7ce","#c65840","#f4ce4b","#62496f"]},{name:"Pelewensis",label:"Coral",colors:["#e2b000","#f7f656","#2449a2","#809098","#0d1115"]},{name:"Deathmasks",label:"Deathmasks",colors:["#926159","#87876e","#c7d2d8","#62b7c8","#43535c","#23313c"]},{name:"Leucosternon",label:"Deep Sea",colors:["#071140","#0e34b2","#207cf5","#9ec8ff","#fbfb53"]},{name:"Deelite",label:"Deelite",colors:["#48448e","#8ccc58","#fc4d97","#b82578"]},{name:"X10",label:"Dusk",colors:["#2a2432","#4f3855","#846d86","#efefcf","#d5b77d","#a89e5e"]},{name:"Vitrixerand",label:"Earth",colors:["#281b27","#723f27","#9b6044","#b5804c","#facd9a"]},{name:"Egypt",label:"Egypt",colors:["#dd5129","#0f7ba2","#43b284","#fab255"]},{name:"ElectronicNight",label:"Electric Night",colors:["#cb54d6","#3e45c4","#21191a","#362f78","#57b4ae"]},{name:"LutjanusSebae",label:"Emperor",colors:["#e5e9ea","#a2bac5","#ce3d21","#992216","#490d07"]},{name:"Enara",label:"Enara",colors:["#262626","#3d5983","#5a8a54","#cfb023"]},{name:"Camo871",label:"Fiesta",colors:["#ffff14","#fea31d","#ce2d41","#3a3fa3"]},{name:"Folklore",label:"Folklore",colors:["#272727","#5c5c5c","#bababa","#f8f8f8"]},{name:"Fritsch",label:"Fritsch",colors:["#0f8d7b","#8942bd","#1e1a1a","#eadd17"]},{name:"AgSunset",label:"Glow",colors:["#4b2991","#872ca2","#c0369d","#ea4f88","#fa7876","#f6a97a","#edd9a3"]},{name:"Harvey",label:"Harvey",colors:["#c6d4d6","#274c4f","#a4432d","#b17c51"]},{name:"Heep",label:"Heep",colors:["#466e9a","#e84d45","#21201c","#a1baac"]},{name:"Imperator",label:"Imperator",colors:["#04093a","#0527b4","#555dfe","#faf830","#b8980f"]},{name:"Klimt",label:"Klimt",colors:["#df9ed4","#c93f55","#eacc62","#469d76","#3c4b99","#924099"]},{name:"KnickCity",label:"Knick City",colors:["#0c2340","#ff6720","#707372","#c8c9c7"]},{name:"London",label:"London",colors:["#bd241e","#e56b1e","#ffcd22","#15274d"]},{name:"Lover",label:"Lover",colors:["#b8396b","#ffd1d7","#fff5cc","#76bae0","#b28f81","#54483e"]},{name:"Maya",label:"Maya",colors:["#3d5a80","#98c1d9","#e0fbfc","#ee6c4d","#293241"]},{name:"X24",label:"Mocha",colors:["#2b1917","#7e5945","#bc927b","#f1e6e1"]},{name:"Camo873",label:"Neon",colors:["#132f8a","#5a56c8","#fc7ead","#ffca3e"]},{name:"NetsCity",label:"Nets City",colors:["#010101","#ffb81c","#da291c","#004c97","#418fde"]},{name:"Nodoubt",label:"No Doubt",colors:["#385581","#6dbac6","#dac190","#c9052c"]},{name:"ClaesOldenburg",label:"Oldenburg",colors:["#95b1c9","#263656","#698946","#f8d440","#c82720"]},{name:"Peacesells",label:"Peace Sells",colors:["#9a5155","#483943","#ecc463","#a497b2"]},{name:"PabloPicasso",label:"Picasso",colors:["#4e7989","#a9011b","#e4a826","#80944e","#dcd6b2"]},{name:"Bifasciatum",label:"Reef",colors:["#080214","#16407b","#2b7ff9","#b1fcfc","#6cbe50"]},{name:"SiameseDream",label:"Siamese Dream",colors:["#f0e9e0","#2f1f16","#a34d2c","#cd8e40"]},{name:"X115",label:"Sienna",colors:["#001a29","#633633","#834a39","#e3b571","#eee6a6"]},{name:"Sixers",label:"Sixers",colors:["#888b8d","#e4d5d3","#003da5","#d50032"]},{name:"SolLeWitt",label:"Sol LeWitt",colors:["#0a71b6","#f9c40a","#190506","#eb5432","#eaf2f0"]},{name:"Sunset",label:"Sunset",colors:["#41476b","#675478","#9e6374","#c67b6f","#de9b71","#efbc82","#fbdfa2"]},{name:"Sunset2",label:"Sunset II",colors:["#1d457f","#61599d","#c36377","#eb7f54","#f2af4a"]},{name:"Sunset3",label:"Sunset III",colors:["#390e40","#701c34","#a63228","#c7662a","#eba42b"]},{name:"Pal9",label:"Tropical",colors:["#273b5b","#c1c243","#e73e26","#2e6657","#e8f5b3","#24a99c"]},{name:"Salvelinus",label:"Trout",colors:["#e6452e","#e49a36","#f9dd4c","#5b4a4c","#01040e"]},{name:"TheovanDoesburg",label:"Van Doesburg",colors:["#bd748f","#3d578e","#bfab68","#dad7d0","#272928"]},{name:"Wizards",label:"Wizards",colors:["#c8102e","#0c2340","#8d9093","#c8c9c7"]},{name:"FrancescoXanto",label:"Xanto",colors:["#2c6aa5","#d9ae2c","#ddc655","#d88c27","#64894d"]},{name:"Zeppelin",label:"Zeppelin",colors:["#efdb15","#739c9c","#0d484c","#c71a08"]}],Y0=Object.fromEntries(sc.map(t=>[t.name,t.colors]));function I0(t){if(!t)return;const n=Y0[t];return n?[...n]:void 0}function H0(){return sc}const{min:B0,max:V0}=Math,_r=(t,n=0,e=1)=>B0(V0(n,t),e),gs=t=>{t._clipped=!1,t._unclipped=t.slice(0);for(let n=0;n<=3;n++)n<3?((t[n]<0||t[n]>255)&&(t._clipped=!0),t[n]=_r(t[n],0,255)):n===3&&(t[n]=_r(t[n],0,1));return t},lc={};for(let t of["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"])lc[`[object ${t}]`]=t.toLowerCase();function qt(t){return lc[Object.prototype.toString.call(t)]||"object"}const Vt=(t,n=null)=>t.length>=3?Array.prototype.slice.call(t):qt(t[0])=="object"&&n?n.split("").filter(e=>t[0][e]!==void 0).map(e=>t[0][e]):t[0].slice(0),Ur=t=>{if(t.length<2)return null;const n=t.length-1;return qt(t[n])=="string"?t[n].toLowerCase():null},{PI:mi,min:cc,max:fc}=Math,fn=t=>Math.round(t*100)/100,ps=t=>Math.round(t*100)/100,Gn=mi*2,ms=mi/3,W0=mi/180,G0=180/mi;function uc(t){return[...t.slice(0,3).reverse(),...t.slice(3)]}const Bt={format:{},autodetect:[]};let ut=class{constructor(...n){const e=this;if(qt(n[0])==="object"&&n[0].constructor&&n[0].constructor===this.constructor)return n[0];let r=Ur(n),a=!1;if(!r){a=!0,Bt.sorted||(Bt.autodetect=Bt.autodetect.sort((i,o)=>o.p-i.p),Bt.sorted=!0);for(let i of Bt.autodetect)if(r=i.test(...n),r)break}if(Bt.format[r]){const i=Bt.format[r].apply(null,a?n:n.slice(0,-1));e._rgb=gs(i)}else throw new Error("unknown format: "+n);e._rgb.length===3&&e._rgb.push(1)}toString(){return qt(this.hex)=="function"?this.hex():`[${this._rgb.join(",")}]`}};const q0="3.2.0",Ot=(...t)=>new ut(...t);Ot.version=q0;const Zr={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},X0=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,U0=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,hc=t=>{if(t.match(X0)){(t.length===4||t.length===7)&&(t=t.substr(1)),t.length===3&&(t=t.split(""),t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);const n=parseInt(t,16),e=n>>16,r=n>>8&255,a=n&255;return[e,r,a,1]}if(t.match(U0)){(t.length===5||t.length===9)&&(t=t.substr(1)),t.length===4&&(t=t.split(""),t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]);const n=parseInt(t,16),e=n>>24&255,r=n>>16&255,a=n>>8&255,i=Math.round((n&255)/255*100)/100;return[e,r,a,i]}throw new Error(`unknown hex color: ${t}`)},{round:bi}=Math,dc=(...t)=>{let[n,e,r,a]=Vt(t,"rgba"),i=Ur(t)||"auto";a===void 0&&(a=1),i==="auto"&&(i=a<1?"rgba":"rgb"),n=bi(n),e=bi(e),r=bi(r);let s="000000"+(n<<16|e<<8|r).toString(16);s=s.substr(s.length-6);let l="0"+bi(a*255).toString(16);switch(l=l.substr(l.length-2),i.toLowerCase()){case"rgba":return`#${s}${l}`;case"argb":return`#${l}${s}`;default:return`#${s}`}};ut.prototype.name=function(){const t=dc(this._rgb,"rgb");for(let n of Object.keys(Zr))if(Zr[n]===t)return n.toLowerCase();return t},Bt.format.named=t=>{if(t=t.toLowerCase(),Zr[t])return hc(Zr[t]);throw new Error("unknown color name: "+t)},Bt.autodetect.push({p:5,test:(t,...n)=>{if(!n.length&&qt(t)==="string"&&Zr[t.toLowerCase()])return"named"}}),ut.prototype.alpha=function(t,n=!1){return t!==void 0&&qt(t)==="number"?n?(this._rgb[3]=t,this):new ut([this._rgb[0],this._rgb[1],this._rgb[2],t],"rgb"):this._rgb[3]},ut.prototype.clipped=function(){return this._rgb._clipped||!1};const Rn={Kn:18,labWhitePoint:"d65",Xn:.95047,Yn:1,Zn:1.08883,kE:216/24389,kKE:8,kK:24389/27,RefWhiteRGB:{X:.95047,Y:1,Z:1.08883},MtxRGB2XYZ:{m00:.4124564390896922,m01:.21267285140562253,m02:.0193338955823293,m10:.357576077643909,m11:.715152155287818,m12:.11919202588130297,m20:.18043748326639894,m21:.07217499330655958,m22:.9503040785363679},MtxXYZ2RGB:{m00:3.2404541621141045,m01:-.9692660305051868,m02:.055643430959114726,m10:-1.5371385127977166,m11:1.8760108454466942,m12:-.2040259135167538,m20:-.498531409556016,m21:.041556017530349834,m22:1.0572251882231791},As:.9414285350000001,Bs:1.040417467,Cs:1.089532651,MtxAdaptMa:{m00:.8951,m01:-.7502,m02:.0389,m10:.2664,m11:1.7135,m12:-.0685,m20:-.1614,m21:.0367,m22:1.0296},MtxAdaptMaI:{m00:.9869929054667123,m01:.43230526972339456,m02:-.008528664575177328,m10:-.14705425642099013,m11:.5183602715367776,m12:.04004282165408487,m20:.15996265166373125,m21:.0492912282128556,m22:.9684866957875502}},Z0=new Map([["a",[1.0985,.35585]],["b",[1.0985,.35585]],["c",[.98074,1.18232]],["d50",[.96422,.82521]],["d55",[.95682,.92149]],["d65",[.95047,1.08883]],["e",[1,1,1]],["f2",[.99186,.67393]],["f7",[.95041,1.08747]],["f11",[1.00962,.6435]],["icc",[.96422,.82521]]]);function qn(t){const n=Z0.get(String(t).toLowerCase());if(!n)throw new Error("unknown Lab illuminant "+t);Rn.labWhitePoint=t,Rn.Xn=n[0],Rn.Zn=n[1]}function Na(){return Rn.labWhitePoint}const bs=(...t)=>{t=Vt(t,"lab");const[n,e,r]=t,[a,i,o]=j0(n,e,r),[s,l,c]=gc(a,i,o);return[s,l,c,t.length>3?t[3]:1]},j0=(t,n,e)=>{const{kE:r,kK:a,kKE:i,Xn:o,Yn:s,Zn:l}=Rn,c=(t+16)/116,f=.002*n+c,h=c-.005*e,d=f*f*f,g=h*h*h,v=d>r?d:(116*f-16)/a,m=t>i?Math.pow((t+16)/116,3):t/a,b=g>r?g:(116*h-16)/a,x=v*o,A=m*s,w=b*l;return[x,A,w]},ys=t=>{const n=Math.sign(t);return t=Math.abs(t),(t<=.0031308?t*12.92:1.055*Math.pow(t,1/2.4)-.055)*n},gc=(t,n,e)=>{const{MtxAdaptMa:r,MtxAdaptMaI:a,MtxXYZ2RGB:i,RefWhiteRGB:o,Xn:s,Yn:l,Zn:c}=Rn,f=s*r.m00+l*r.m10+c*r.m20,h=s*r.m01+l*r.m11+c*r.m21,d=s*r.m02+l*r.m12+c*r.m22,g=o.X*r.m00+o.Y*r.m10+o.Z*r.m20,v=o.X*r.m01+o.Y*r.m11+o.Z*r.m21,m=o.X*r.m02+o.Y*r.m12+o.Z*r.m22,b=(t*r.m00+n*r.m10+e*r.m20)*(g/f),x=(t*r.m01+n*r.m11+e*r.m21)*(v/h),A=(t*r.m02+n*r.m12+e*r.m22)*(m/d),w=b*a.m00+x*a.m10+A*a.m20,S=b*a.m01+x*a.m11+A*a.m21,z=b*a.m02+x*a.m12+A*a.m22,Y=ys(w*i.m00+S*i.m10+z*i.m20),G=ys(w*i.m01+S*i.m11+z*i.m21),_=ys(w*i.m02+S*i.m12+z*i.m22);return[Y*255,G*255,_*255]},vs=(...t)=>{const[n,e,r,...a]=Vt(t,"rgb"),[i,o,s]=pc(n,e,r),[l,c,f]=K0(i,o,s);return[l,c,f,...a.length>0&&a[0]<1?[a[0]]:[]]};function K0(t,n,e){const{Xn:r,Yn:a,Zn:i,kE:o,kK:s}=Rn,l=t/r,c=n/a,f=e/i,h=l>o?Math.pow(l,1/3):(s*l+16)/116,d=c>o?Math.pow(c,1/3):(s*c+16)/116,g=f>o?Math.pow(f,1/3):(s*f+16)/116;return[116*d-16,500*(h-d),200*(d-g)]}function xs(t){const n=Math.sign(t);return t=Math.abs(t),(t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4))*n}const pc=(t,n,e)=>{t=xs(t/255),n=xs(n/255),e=xs(e/255);const{MtxRGB2XYZ:r,MtxAdaptMa:a,MtxAdaptMaI:i,Xn:o,Yn:s,Zn:l,As:c,Bs:f,Cs:h}=Rn;let d=t*r.m00+n*r.m10+e*r.m20,g=t*r.m01+n*r.m11+e*r.m21,v=t*r.m02+n*r.m12+e*r.m22;const m=o*a.m00+s*a.m10+l*a.m20,b=o*a.m01+s*a.m11+l*a.m21,x=o*a.m02+s*a.m12+l*a.m22;let A=d*a.m00+g*a.m10+v*a.m20,w=d*a.m01+g*a.m11+v*a.m21,S=d*a.m02+g*a.m12+v*a.m22;return A*=m/c,w*=b/f,S*=x/h,d=A*i.m00+w*i.m10+S*i.m20,g=A*i.m01+w*i.m11+S*i.m21,v=A*i.m02+w*i.m12+S*i.m22,[d,g,v]};ut.prototype.lab=function(){return vs(this._rgb)},Object.assign(Ot,{lab:(...t)=>new ut(...t,"lab"),getLabWhitePoint:Na,setLabWhitePoint:qn}),Bt.format.lab=bs,Bt.autodetect.push({p:2,test:(...t)=>{if(t=Vt(t,"lab"),qt(t)==="array"&&t.length===3)return"lab"}}),ut.prototype.darken=function(t=1){const n=this,e=n.lab();return e[0]-=Rn.Kn*t,new ut(e,"lab").alpha(n.alpha(),!0)},ut.prototype.brighten=function(t=1){return this.darken(-t)},ut.prototype.darker=ut.prototype.darken,ut.prototype.brighter=ut.prototype.brighten,ut.prototype.get=function(t){const[n,e]=t.split("."),r=this[n]();if(e){const a=n.indexOf(e)-(n.substr(0,2)==="ok"?2:0);if(a>-1)return r[a];throw new Error(`unknown channel ${e} in mode ${n}`)}else return r};const{pow:J0}=Math,Q0=1e-7,tg=20;ut.prototype.luminance=function(t,n="rgb"){if(t!==void 0&&qt(t)==="number"){if(t===0)return new ut([0,0,0,this._rgb[3]],"rgb");if(t===1)return new ut([255,255,255,this._rgb[3]],"rgb");let e=this.luminance(),r=tg;const a=(o,s)=>{const l=o.interpolate(s,.5,n),c=l.luminance();return Math.abs(t-c)<Q0||!r--?l:c>t?a(o,l):a(l,s)},i=(e>t?a(new ut([0,0,0]),this):a(this,new ut([255,255,255]))).rgb();return new ut([...i,this._rgb[3]])}return eg(...this._rgb.slice(0,3))};const eg=(t,n,e)=>(t=ws(t),n=ws(n),e=ws(e),.2126*t+.7152*n+.0722*e),ws=t=>(t/=255,t<=.03928?t/12.92:J0((t+.055)/1.055,2.4)),ye={},jr=(t,n,e=.5,...r)=>{let a=r[0]||"lrgb";if(!ye[a]&&!r.length&&(a=Object.keys(ye)[0]),!ye[a])throw new Error(`interpolation mode ${a} is not defined`);return qt(t)!=="object"&&(t=new ut(t)),qt(n)!=="object"&&(n=new ut(n)),ye[a](t,n,e).alpha(t.alpha()+e*(n.alpha()-t.alpha()))};ut.prototype.mix=ut.prototype.interpolate=function(t,n=.5,...e){return jr(this,t,n,...e)},ut.prototype.premultiply=function(t=!1){const n=this._rgb,e=n[3];return t?(this._rgb=[n[0]*e,n[1]*e,n[2]*e,e],this):new ut([n[0]*e,n[1]*e,n[2]*e,e],"rgb")};const{sin:ng,cos:rg}=Math,mc=(...t)=>{let[n,e,r]=Vt(t,"lch");return isNaN(r)&&(r=0),r=r*W0,[n,rg(r)*e,ng(r)*e]},As=(...t)=>{t=Vt(t,"lch");const[n,e,r]=t,[a,i,o]=mc(n,e,r),[s,l,c]=bs(a,i,o);return[s,l,c,t.length>3?t[3]:1]},ag=(...t)=>{const n=uc(Vt(t,"hcl"));return As(...n)},{sqrt:ig,atan2:og,round:sg}=Math,bc=(...t)=>{const[n,e,r]=Vt(t,"lab"),a=ig(e*e+r*r);let i=(og(r,e)*G0+360)%360;return sg(a*1e4)===0&&(i=Number.NaN),[n,a,i]},_s=(...t)=>{const[n,e,r,...a]=Vt(t,"rgb"),[i,o,s]=vs(n,e,r),[l,c,f]=bc(i,o,s);return[l,c,f,...a.length>0&&a[0]<1?[a[0]]:[]]};ut.prototype.lch=function(){return _s(this._rgb)},ut.prototype.hcl=function(){return uc(_s(this._rgb))},Object.assign(Ot,{lch:(...t)=>new ut(...t,"lch"),hcl:(...t)=>new ut(...t,"hcl")}),Bt.format.lch=As,Bt.format.hcl=ag,["lch","hcl"].forEach(t=>Bt.autodetect.push({p:2,test:(...n)=>{if(n=Vt(n,t),qt(n)==="array"&&n.length===3)return t}})),ut.prototype.saturate=function(t=1){const n=this,e=n.lch();return e[1]+=Rn.Kn*t,e[1]<0&&(e[1]=0),new ut(e,"lch").alpha(n.alpha(),!0)},ut.prototype.desaturate=function(t=1){return this.saturate(-t)},ut.prototype.set=function(t,n,e=!1){const[r,a]=t.split("."),i=this[r]();if(a){const o=r.indexOf(a)-(r.substr(0,2)==="ok"?2:0);if(o>-1){if(qt(n)=="string")switch(n.charAt(0)){case"+":i[o]+=+n;break;case"-":i[o]+=+n;break;case"*":i[o]*=+n.substr(1);break;case"/":i[o]/=+n.substr(1);break;default:i[o]=+n}else if(qt(n)==="number")i[o]=n;else throw new Error("unsupported value for Color.set");const s=new ut(i,r);return e?(this._rgb=s._rgb,this):s}throw new Error(`unknown channel ${a} in mode ${r}`)}else return i},ut.prototype.tint=function(t=.5,...n){return jr(this,"white",t,...n)},ut.prototype.shade=function(t=.5,...n){return jr(this,"black",t,...n)};const lg=(t,n,e)=>{const r=t._rgb,a=n._rgb;return new ut(r[0]+e*(a[0]-r[0]),r[1]+e*(a[1]-r[1]),r[2]+e*(a[2]-r[2]),"rgb")};ye.rgb=lg;const{sqrt:ks,pow:Kr}=Math,cg=(t,n,e)=>{const[r,a,i]=t._rgb,[o,s,l]=n._rgb;return new ut(ks(Kr(r,2)*(1-e)+Kr(o,2)*e),ks(Kr(a,2)*(1-e)+Kr(s,2)*e),ks(Kr(i,2)*(1-e)+Kr(l,2)*e),"rgb")};ye.lrgb=cg;const fg=(t,n,e)=>{const r=t.lab(),a=n.lab();return new ut(r[0]+e*(a[0]-r[0]),r[1]+e*(a[1]-r[1]),r[2]+e*(a[2]-r[2]),"lab")};ye.lab=fg;const Jr=(t,n,e,r)=>{let a,i;r==="hsl"?(a=t.hsl(),i=n.hsl()):r==="hsv"?(a=t.hsv(),i=n.hsv()):r==="hcg"?(a=t.hcg(),i=n.hcg()):r==="hsi"?(a=t.hsi(),i=n.hsi()):r==="lch"||r==="hcl"?(r="hcl",a=t.hcl(),i=n.hcl()):r==="oklch"&&(a=t.oklch().reverse(),i=n.oklch().reverse());let o,s,l,c,f,h;(r.substr(0,1)==="h"||r==="oklch")&&([o,l,f]=a,[s,c,h]=i);let d,g,v,m;return!isNaN(o)&&!isNaN(s)?(s>o&&s-o>180?m=s-(o+360):s<o&&o-s>180?m=s+360-o:m=s-o,g=o+e*m):isNaN(o)?isNaN(s)?g=Number.NaN:(g=s,(f==1||f==0)&&r!="hsv"&&(d=c)):(g=o,(h==1||h==0)&&r!="hsv"&&(d=l)),d===void 0&&(d=l+e*(c-l)),v=f+e*(h-f),r==="oklch"?new ut([v,d,g],r):new ut([g,d,v],r)},yc=(t,n,e)=>Jr(t,n,e,"lch");ye.lch=yc,ye.hcl=yc;const ug=t=>{if(qt(t)=="number"&&t>=0&&t<=16777215){const n=t>>16,e=t>>8&255,r=t&255;return[n,e,r,1]}throw new Error("unknown num color: "+t)},hg=(...t)=>{const[n,e,r]=Vt(t,"rgb");return(n<<16)+(e<<8)+r};ut.prototype.num=function(){return hg(this._rgb)},Object.assign(Ot,{num:(...t)=>new ut(...t,"num")}),Bt.format.num=ug,Bt.autodetect.push({p:5,test:(...t)=>{if(t.length===1&&qt(t[0])==="number"&&t[0]>=0&&t[0]<=16777215)return"num"}});const dg=(t,n,e)=>{const r=t.num(),a=n.num();return new ut(r+e*(a-r),"num")};ye.num=dg;const{floor:gg}=Math,pg=(...t)=>{t=Vt(t,"hcg");let[n,e,r]=t,a,i,o;r=r*255;const s=e*255;if(e===0)a=i=o=r;else{n===360&&(n=0),n>360&&(n-=360),n<0&&(n+=360),n/=60;const l=gg(n),c=n-l,f=r*(1-e),h=f+s*(1-c),d=f+s*c,g=f+s;switch(l){case 0:[a,i,o]=[g,d,f];break;case 1:[a,i,o]=[h,g,f];break;case 2:[a,i,o]=[f,g,d];break;case 3:[a,i,o]=[f,h,g];break;case 4:[a,i,o]=[d,f,g];break;case 5:[a,i,o]=[g,f,h];break}}return[a,i,o,t.length>3?t[3]:1]},mg=(...t)=>{const[n,e,r]=Vt(t,"rgb"),a=cc(n,e,r),i=fc(n,e,r),o=i-a,s=o*100/255,l=a/(255-o)*100;let c;return o===0?c=Number.NaN:(n===i&&(c=(e-r)/o),e===i&&(c=2+(r-n)/o),r===i&&(c=4+(n-e)/o),c*=60,c<0&&(c+=360)),[c,s,l]};ut.prototype.hcg=function(){return mg(this._rgb)};const bg=(...t)=>new ut(...t,"hcg");Ot.hcg=bg,Bt.format.hcg=pg,Bt.autodetect.push({p:1,test:(...t)=>{if(t=Vt(t,"hcg"),qt(t)==="array"&&t.length===3)return"hcg"}});const yg=(t,n,e)=>Jr(t,n,e,"hcg");ye.hcg=yg;const{cos:Qr}=Math,vg=(...t)=>{t=Vt(t,"hsi");let[n,e,r]=t,a,i,o;return isNaN(n)&&(n=0),isNaN(e)&&(e=0),n>360&&(n-=360),n<0&&(n+=360),n/=360,n<1/3?(o=(1-e)/3,a=(1+e*Qr(Gn*n)/Qr(ms-Gn*n))/3,i=1-(o+a)):n<2/3?(n-=1/3,a=(1-e)/3,i=(1+e*Qr(Gn*n)/Qr(ms-Gn*n))/3,o=1-(a+i)):(n-=2/3,i=(1-e)/3,o=(1+e*Qr(Gn*n)/Qr(ms-Gn*n))/3,a=1-(i+o)),a=_r(r*a*3),i=_r(r*i*3),o=_r(r*o*3),[a*255,i*255,o*255,t.length>3?t[3]:1]},{min:xg,sqrt:wg,acos:Ag}=Math,_g=(...t)=>{let[n,e,r]=Vt(t,"rgb");n/=255,e/=255,r/=255;let a;const i=xg(n,e,r),o=(n+e+r)/3,s=o>0?1-i/o:0;return s===0?a=NaN:(a=(n-e+(n-r))/2,a/=wg((n-e)*(n-e)+(n-r)*(e-r)),a=Ag(a),r>e&&(a=Gn-a),a/=Gn),[a*360,s,o]};ut.prototype.hsi=function(){return _g(this._rgb)};const kg=(...t)=>new ut(...t,"hsi");Ot.hsi=kg,Bt.format.hsi=vg,Bt.autodetect.push({p:2,test:(...t)=>{if(t=Vt(t,"hsi"),qt(t)==="array"&&t.length===3)return"hsi"}});const Sg=(t,n,e)=>Jr(t,n,e,"hsi");ye.hsi=Sg;const Ss=(...t)=>{t=Vt(t,"hsl");const[n,e,r]=t;let a,i,o;if(e===0)a=i=o=r*255;else{const s=[0,0,0],l=[0,0,0],c=r<.5?r*(1+e):r+e-r*e,f=2*r-c,h=n/360;s[0]=h+1/3,s[1]=h,s[2]=h-1/3;for(let d=0;d<3;d++)s[d]<0&&(s[d]+=1),s[d]>1&&(s[d]-=1),6*s[d]<1?l[d]=f+(c-f)*6*s[d]:2*s[d]<1?l[d]=c:3*s[d]<2?l[d]=f+(c-f)*(2/3-s[d])*6:l[d]=f;[a,i,o]=[l[0]*255,l[1]*255,l[2]*255]}return t.length>3?[a,i,o,t[3]]:[a,i,o,1]},vc=(...t)=>{t=Vt(t,"rgba");let[n,e,r]=t;n/=255,e/=255,r/=255;const a=cc(n,e,r),i=fc(n,e,r),o=(i+a)/2;let s,l;return i===a?(s=0,l=Number.NaN):s=o<.5?(i-a)/(i+a):(i-a)/(2-i-a),n==i?l=(e-r)/(i-a):e==i?l=2+(r-n)/(i-a):r==i&&(l=4+(n-e)/(i-a)),l*=60,l<0&&(l+=360),t.length>3&&t[3]!==void 0?[l,s,o,t[3]]:[l,s,o]};ut.prototype.hsl=function(){return vc(this._rgb)};const Mg=(...t)=>new ut(...t,"hsl");Ot.hsl=Mg,Bt.format.hsl=Ss,Bt.autodetect.push({p:2,test:(...t)=>{if(t=Vt(t,"hsl"),qt(t)==="array"&&t.length===3)return"hsl"}});const $g=(t,n,e)=>Jr(t,n,e,"hsl");ye.hsl=$g;const{floor:Lg}=Math,Cg=(...t)=>{t=Vt(t,"hsv");let[n,e,r]=t,a,i,o;if(r*=255,e===0)a=i=o=r;else{n===360&&(n=0),n>360&&(n-=360),n<0&&(n+=360),n/=60;const s=Lg(n),l=n-s,c=r*(1-e),f=r*(1-e*l),h=r*(1-e*(1-l));switch(s){case 0:[a,i,o]=[r,h,c];break;case 1:[a,i,o]=[f,r,c];break;case 2:[a,i,o]=[c,r,h];break;case 3:[a,i,o]=[c,f,r];break;case 4:[a,i,o]=[h,c,r];break;case 5:[a,i,o]=[r,c,f];break}}return[a,i,o,t.length>3?t[3]:1]},{min:Tg,max:Og}=Math,Ng=(...t)=>{t=Vt(t,"rgb");let[n,e,r]=t;const a=Tg(n,e,r),i=Og(n,e,r),o=i-a;let s,l,c;return c=i/255,i===0?(s=Number.NaN,l=0):(l=o/i,n===i&&(s=(e-r)/o),e===i&&(s=2+(r-n)/o),r===i&&(s=4+(n-e)/o),s*=60,s<0&&(s+=360)),[s,l,c]};ut.prototype.hsv=function(){return Ng(this._rgb)};const Eg=(...t)=>new ut(...t,"hsv");Ot.hsv=Eg,Bt.format.hsv=Cg,Bt.autodetect.push({p:2,test:(...t)=>{if(t=Vt(t,"hsv"),qt(t)==="array"&&t.length===3)return"hsv"}});const Dg=(t,n,e)=>Jr(t,n,e,"hsv");ye.hsv=Dg;function yi(t,n){let e=t.length;Array.isArray(t[0])||(t=[t]),Array.isArray(n[0])||(n=n.map(o=>[o]));let r=n[0].length,a=n[0].map((o,s)=>n.map(l=>l[s])),i=t.map(o=>a.map(s=>Array.isArray(o)?o.reduce((l,c,f)=>l+c*(s[f]||0),0):s.reduce((l,c)=>l+c*o,0)));return e===1&&(i=i[0]),r===1?i.map(o=>o[0]):i}const Ms=(...t)=>{t=Vt(t,"lab");const[n,e,r,...a]=t,[i,o,s]=Pg([n,e,r]),[l,c,f]=gc(i,o,s);return[l,c,f,...a.length>0&&a[0]<1?[a[0]]:[]]};function Pg(t){var n=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],e=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],r=yi(e,t);return yi(n,r.map(a=>a**3))}const $s=(...t)=>{const[n,e,r,...a]=Vt(t,"rgb"),i=pc(n,e,r);return[...zg(i),...a.length>0&&a[0]<1?[a[0]]:[]]};function zg(t){const n=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],e=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],r=yi(n,t);return yi(e,r.map(a=>Math.cbrt(a)))}ut.prototype.oklab=function(){return $s(this._rgb)},Object.assign(Ot,{oklab:(...t)=>new ut(...t,"oklab")}),Bt.format.oklab=Ms,Bt.autodetect.push({p:2,test:(...t)=>{if(t=Vt(t,"oklab"),qt(t)==="array"&&t.length===3)return"oklab"}});const Rg=(t,n,e)=>{const r=t.oklab(),a=n.oklab();return new ut(r[0]+e*(a[0]-r[0]),r[1]+e*(a[1]-r[1]),r[2]+e*(a[2]-r[2]),"oklab")};ye.oklab=Rg;const Fg=(t,n,e)=>Jr(t,n,e,"oklch");ye.oklch=Fg;const{pow:Ls,sqrt:Cs,PI:Ts,cos:xc,sin:wc,atan2:Yg}=Math,Ig=(t,n="lrgb",e=null)=>{const r=t.length;e||(e=Array.from(new Array(r)).map(()=>1));const a=r/e.reduce(function(h,d){return h+d});if(e.forEach((h,d)=>{e[d]*=a}),t=t.map(h=>new ut(h)),n==="lrgb")return Hg(t,e);const i=t.shift(),o=i.get(n),s=[];let l=0,c=0;for(let h=0;h<o.length;h++)if(o[h]=(o[h]||0)*e[0],s.push(isNaN(o[h])?0:e[0]),n.charAt(h)==="h"&&!isNaN(o[h])){const d=o[h]/180*Ts;l+=xc(d)*e[0],c+=wc(d)*e[0]}let f=i.alpha()*e[0];t.forEach((h,d)=>{const g=h.get(n);f+=h.alpha()*e[d+1];for(let v=0;v<o.length;v++)if(!isNaN(g[v]))if(s[v]+=e[d+1],n.charAt(v)==="h"){const m=g[v]/180*Ts;l+=xc(m)*e[d+1],c+=wc(m)*e[d+1]}else o[v]+=g[v]*e[d+1]});for(let h=0;h<o.length;h++)if(n.charAt(h)==="h"){let d=Yg(c/s[h],l/s[h])/Ts*180;for(;d<0;)d+=360;for(;d>=360;)d-=360;o[h]=d}else o[h]=o[h]/s[h];return f/=r,new ut(o,n).alpha(f>.99999?1:f,!0)},Hg=(t,n)=>{const e=t.length,r=[0,0,0,0];for(let a=0;a<t.length;a++){const i=t[a],o=n[a]/e,s=i._rgb;r[0]+=Ls(s[0],2)*o,r[1]+=Ls(s[1],2)*o,r[2]+=Ls(s[2],2)*o,r[3]+=s[3]*o}return r[0]=Cs(r[0]),r[1]=Cs(r[1]),r[2]=Cs(r[2]),r[3]>.9999999&&(r[3]=1),new ut(gs(r))},{pow:Bg}=Math;function vi(t){let n="rgb",e=Ot("#ccc"),r=0,a=[0,1],i=[0,1],o=[],s=[0,0],l=!1,c=[],f=!1,h=0,d=1,g=!1,v={},m=!0,b=1;const x=function(_){if(_=_||["#fff","#000"],_&&qt(_)==="string"&&Ot.brewer&&Ot.brewer[_.toLowerCase()]&&(_=Ot.brewer[_.toLowerCase()]),qt(_)==="array"){_.length===1&&(_=[_[0],_[0]]),_=_.slice(0);for(let B=0;B<_.length;B++)_[B]=Ot(_[B]);o.length=0;for(let B=0;B<_.length;B++)o.push(B/(_.length-1))}return Y(),c=_},A=function(_){if(l!=null){const B=l.length-1;let P=0;for(;P<B&&_>=l[P];)P++;return P-1}return 0};let w=_=>_,S=_=>_;const z=function(_,B){let P,$;if(B==null&&(B=!1),isNaN(_)||_===null)return e;B?$=_:l&&l.length>2?$=A(_)/(l.length-2):d!==h?$=(_-h)/(d-h):$=1,$=S($),B||($=w($)),b!==1&&($=Bg($,b)),$=s[0]+$*(1-s[0]-s[1]),$=_r($,0,1);const N=Math.floor($*1e4);if(m&&v[N])P=v[N];else{if(qt(c)==="array")for(let L=0;L<o.length;L++){const M=o[L];if($<=M){P=c[L];break}if($>=M&&L===o.length-1){P=c[L];break}if($>M&&$<o[L+1]){$=($-M)/(o[L+1]-M),P=Ot.interpolate(c[L],c[L+1],$,n);break}}else qt(c)==="function"&&(P=c($));m&&(v[N]=P)}return P};var Y=()=>v={};x(t);const G=function(_){const B=Ot(z(_));return f&&B[f]?B[f]():B};return G.classes=function(_){if(_!=null){if(qt(_)==="array")l=_,a=[_[0],_[_.length-1]];else{const B=Ot.analyze(a);_===0?l=[B.min,B.max]:l=Ot.limits(B,"e",_)}return G}return l},G.domain=function(_){if(!arguments.length)return i;i=_.slice(0),h=_[0],d=_[_.length-1],o=[];const B=c.length;if(_.length===B&&h!==d)for(let P of Array.from(_))o.push((P-h)/(d-h));else{for(let P=0;P<B;P++)o.push(P/(B-1));if(_.length>2){const P=_.map((N,L)=>L/(_.length-1)),$=_.map(N=>(N-h)/(d-h));$.every((N,L)=>P[L]===N)||(S=N=>{if(N<=0||N>=1)return N;let L=0;for(;N>=$[L+1];)L++;const M=(N-$[L])/($[L+1]-$[L]);return P[L]+M*(P[L+1]-P[L])})}}return a=[h,d],G},G.mode=function(_){return arguments.length?(n=_,Y(),G):n},G.range=function(_,B){return x(_),G},G.out=function(_){return f=_,G},G.spread=function(_){return arguments.length?(r=_,G):r},G.correctLightness=function(_){return _==null&&(_=!0),g=_,Y(),g?w=function(B){const P=z(0,!0).lab()[0],$=z(1,!0).lab()[0],N=P>$;let L=z(B,!0).lab()[0];const M=P+($-P)*B;let D=L-M,q=0,V=1,C=20;for(;Math.abs(D)>.01&&C-- >0;)(function(){return N&&(D*=-1),D<0?(q=B,B+=(V-B)*.5):(V=B,B+=(q-B)*.5),L=z(B,!0).lab()[0],D=L-M})();return B}:w=B=>B,G},G.padding=function(_){return _!=null?(qt(_)==="number"&&(_=[_,_]),s=_,G):s},G.colors=function(_,B){arguments.length<2&&(B="hex");let P=[];if(arguments.length===0)P=c.slice(0);else if(_===1)P=[G(.5)];else if(_>1){const $=a[0],N=a[1]-$;P=Vg(0,_).map(L=>G($+L/(_-1)*N))}else{t=[];let $=[];if(l&&l.length>2)for(let N=1,L=l.length,M=1<=L;M?N<L:N>L;M?N++:N--)$.push((l[N-1]+l[N])*.5);else $=a;P=$.map(N=>G(N))}return Ot[B]&&(P=P.map($=>$[B]())),P},G.cache=function(_){return _!=null?(m=_,G):m},G.gamma=function(_){return _!=null?(b=_,G):b},G.nodata=function(_){return _!=null?(e=Ot(_),G):e},G}function Vg(t,n,e){let r=[],a=t<n,i=n;for(let o=t;a?o<i:o>i;a?o++:o--)r.push(o);return r}const Wg=function(t){let n=[1,1];for(let e=1;e<t;e++){let r=[1];for(let a=1;a<=n.length;a++)r[a]=(n[a]||0)+n[a-1];n=r}return n},Gg=function(t){let n,e,r,a;if(t=t.map(i=>new ut(i)),t.length===2)[e,r]=t.map(i=>i.lab()),n=function(i){const o=[0,1,2].map(s=>e[s]+i*(r[s]-e[s]));return new ut(o,"lab")};else if(t.length===3)[e,r,a]=t.map(i=>i.lab()),n=function(i){const o=[0,1,2].map(s=>(1-i)*(1-i)*e[s]+2*(1-i)*i*r[s]+i*i*a[s]);return new ut(o,"lab")};else if(t.length===4){let i;[e,r,a,i]=t.map(o=>o.lab()),n=function(o){const s=[0,1,2].map(l=>(1-o)*(1-o)*(1-o)*e[l]+3*(1-o)*(1-o)*o*r[l]+3*(1-o)*o*o*a[l]+o*o*o*i[l]);return new ut(s,"lab")}}else if(t.length>=5){let i,o,s;i=t.map(l=>l.lab()),s=t.length-1,o=Wg(s),n=function(l){const c=1-l,f=[0,1,2].map(h=>i.reduce((d,g,v)=>d+o[v]*c**(s-v)*l**v*g[h],0));return new ut(f,"lab")}}else throw new RangeError("No point in running bezier with only one color.");return n},qg=t=>{const n=Gg(t);return n.scale=()=>vi(n),n},{round:Ac}=Math;ut.prototype.rgb=function(t=!0){return t===!1?this._rgb.slice(0,3):this._rgb.slice(0,3).map(Ac)},ut.prototype.rgba=function(t=!0){return this._rgb.slice(0,4).map((n,e)=>e<3?t===!1?n:Ac(n):n)},Object.assign(Ot,{rgb:(...t)=>new ut(...t,"rgb")}),Bt.format.rgb=(...t)=>{const n=Vt(t,"rgba");return n[3]===void 0&&(n[3]=1),n},Bt.autodetect.push({p:3,test:(...t)=>{if(t=Vt(t,"rgba"),qt(t)==="array"&&(t.length===3||t.length===4&&qt(t[3])=="number"&&t[3]>=0&&t[3]<=1))return"rgb"}});const xn=(t,n,e)=>{if(!xn[e])throw new Error("unknown blend mode "+e);return xn[e](t,n)},sr=t=>(n,e)=>{const r=Ot(e).rgb(),a=Ot(n).rgb();return Ot.rgb(t(r,a))},lr=t=>(n,e)=>{const r=[];return r[0]=t(n[0],e[0]),r[1]=t(n[1],e[1]),r[2]=t(n[2],e[2]),r},Xg=t=>t,Ug=(t,n)=>t*n/255,Zg=(t,n)=>t>n?n:t,jg=(t,n)=>t>n?t:n,Kg=(t,n)=>255*(1-(1-t/255)*(1-n/255)),Jg=(t,n)=>n<128?2*t*n/255:255*(1-2*(1-t/255)*(1-n/255)),Qg=(t,n)=>255*(1-(1-n/255)/(t/255)),tp=(t,n)=>t===255?255:(t=255*(n/255)/(1-t/255),t>255?255:t);xn.normal=sr(lr(Xg)),xn.multiply=sr(lr(Ug)),xn.screen=sr(lr(Kg)),xn.overlay=sr(lr(Jg)),xn.darken=sr(lr(Zg)),xn.lighten=sr(lr(jg)),xn.dodge=sr(lr(tp)),xn.burn=sr(lr(Qg));const{pow:ep,sin:np,cos:rp}=Math;function ap(t=300,n=-1.5,e=1,r=1,a=[0,1]){let i=0,o;qt(a)==="array"?o=a[1]-a[0]:(o=0,a=[a,a]);const s=function(l){const c=Gn*((t+120)/360+n*l),f=ep(a[0]+o*l,r),d=(i!==0?e[0]+l*i:e)*f*(1-f)/2,g=rp(c),v=np(c),m=f+d*(-.14861*g+1.78277*v),b=f+d*(-.29227*g-.90649*v),x=f+d*(1.97294*g);return Ot(gs([m*255,b*255,x*255,1]))};return s.start=function(l){return l==null?t:(t=l,s)},s.rotations=function(l){return l==null?n:(n=l,s)},s.gamma=function(l){return l==null?r:(r=l,s)},s.hue=function(l){return l==null?e:(e=l,qt(e)==="array"?(i=e[1]-e[0],i===0&&(e=e[1])):i=0,s)},s.lightness=function(l){return l==null?a:(qt(l)==="array"?(a=l,o=l[1]-l[0]):(a=[l,l],o=0),s)},s.scale=()=>Ot.scale(s),s.hue(e),s}const ip="0123456789abcdef",{floor:op,random:sp}=Math,lp=(t=sp)=>{let n="#";for(let e=0;e<6;e++)n+=ip.charAt(op(t()*16));return new ut(n,"hex")},{log:_c,pow:cp,floor:fp,abs:up}=Math;function kc(t,n=null){const e={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0};return qt(t)==="object"&&(t=Object.values(t)),t.forEach(r=>{n&&qt(r)==="object"&&(r=r[n]),r!=null&&!isNaN(r)&&(e.values.push(r),e.sum+=r,r<e.min&&(e.min=r),r>e.max&&(e.max=r),e.count+=1)}),e.domain=[e.min,e.max],e.limits=(r,a)=>Sc(e,r,a),e}function Sc(t,n="equal",e=7){qt(t)=="array"&&(t=kc(t));const{min:r,max:a}=t,i=t.values.sort((s,l)=>s-l);if(e===1)return[r,a];const o=[];if(n.substr(0,1)==="c"&&(o.push(r),o.push(a)),n.substr(0,1)==="e"){o.push(r);for(let s=1;s<e;s++)o.push(r+s/e*(a-r));o.push(a)}else if(n.substr(0,1)==="l"){if(r<=0)throw new Error("Logarithmic scales are only possible for values > 0");const s=Math.LOG10E*_c(r),l=Math.LOG10E*_c(a);o.push(r);for(let c=1;c<e;c++)o.push(cp(10,s+c/e*(l-s)));o.push(a)}else if(n.substr(0,1)==="q"){o.push(r);for(let s=1;s<e;s++){const l=(i.length-1)*s/e,c=fp(l);if(c===l)o.push(i[c]);else{const f=l-c;o.push(i[c]*(1-f)+i[c+1]*f)}}o.push(a)}else if(n.substr(0,1)==="k"){let s;const l=i.length,c=new Array(l),f=new Array(e);let h=!0,d=0,g=null;g=[],g.push(r);for(let b=1;b<e;b++)g.push(r+b/e*(a-r));for(g.push(a);h;){for(let x=0;x<e;x++)f[x]=0;for(let x=0;x<l;x++){const A=i[x];let w=Number.MAX_VALUE,S;for(let z=0;z<e;z++){const Y=up(g[z]-A);Y<w&&(w=Y,S=z),f[S]++,c[x]=S}}const b=new Array(e);for(let x=0;x<e;x++)b[x]=null;for(let x=0;x<l;x++)s=c[x],b[s]===null?b[s]=i[x]:b[s]+=i[x];for(let x=0;x<e;x++)b[x]*=1/f[x];h=!1;for(let x=0;x<e;x++)if(b[x]!==g[x]){h=!0;break}g=b,d++,d>200&&(h=!1)}const v={};for(let b=0;b<e;b++)v[b]=[];for(let b=0;b<l;b++)s=c[b],v[s].push(i[b]);let m=[];for(let b=0;b<e;b++)m.push(v[b][0]),m.push(v[b][v[b].length-1]);m=m.sort((b,x)=>b-x),o.push(m[0]);for(let b=1;b<m.length;b+=2){const x=m[b];!isNaN(x)&&o.indexOf(x)===-1&&o.push(x)}}return o}const hp=(t,n)=>{t=new ut(t),n=new ut(n);const e=t.luminance(),r=n.luminance();return e>r?(e+.05)/(r+.05):(r+.05)/(e+.05)};/**
|
|
227
|
+
* @license
|
|
228
|
+
*
|
|
229
|
+
* The APCA contrast prediction algorithm is based of the formulas published
|
|
230
|
+
* in the APCA-1.0.98G specification by Myndex. The specification is available at:
|
|
231
|
+
* https://raw.githubusercontent.com/Myndex/apca-w3/master/images/APCAw3_0.1.17_APCA0.0.98G.svg
|
|
232
|
+
*
|
|
233
|
+
* Note that the APCA implementation is still beta, so please update to
|
|
234
|
+
* future versions of chroma.js when they become available.
|
|
235
|
+
*
|
|
236
|
+
* You can read more about the APCA Readability Criterion at
|
|
237
|
+
* https://readtech.org/ARC/
|
|
238
|
+
*/const Mc=.027,dp=5e-4,gp=.1,$c=1.14,xi=.022,Lc=1.414,pp=(t,n)=>{t=new ut(t),n=new ut(n),t.alpha()<1&&(t=jr(n,t,t.alpha(),"rgb"));const e=Cc(...t.rgb()),r=Cc(...n.rgb()),a=e>=xi?e:e+Math.pow(xi-e,Lc),i=r>=xi?r:r+Math.pow(xi-r,Lc),o=Math.pow(i,.56)-Math.pow(a,.57),s=Math.pow(i,.65)-Math.pow(a,.62),l=Math.abs(i-a)<dp?0:a<i?o*$c:s*$c;return(Math.abs(l)<gp?0:l>0?l-Mc:l+Mc)*100};function Cc(t,n,e){return .2126729*Math.pow(t/255,2.4)+.7151522*Math.pow(n/255,2.4)+.072175*Math.pow(e/255,2.4)}const{sqrt:Xn,pow:se,min:mp,max:bp,atan2:Tc,abs:Oc,cos:wi,sin:Nc,exp:yp,PI:Ec}=Math;function vp(t,n,e=1,r=1,a=1){var i=function(ct){return 360*ct/(2*Ec)},o=function(ct){return 2*Ec*ct/360};t=new ut(t),n=new ut(n);const[s,l,c]=Array.from(t.lab()),[f,h,d]=Array.from(n.lab()),g=(s+f)/2,v=Xn(se(l,2)+se(c,2)),m=Xn(se(h,2)+se(d,2)),b=(v+m)/2,x=.5*(1-Xn(se(b,7)/(se(b,7)+se(25,7)))),A=l*(1+x),w=h*(1+x),S=Xn(se(A,2)+se(c,2)),z=Xn(se(w,2)+se(d,2)),Y=(S+z)/2,G=i(Tc(c,A)),_=i(Tc(d,w)),B=G>=0?G:G+360,P=_>=0?_:_+360,$=Oc(B-P)>180?(B+P+360)/2:(B+P)/2,N=1-.17*wi(o($-30))+.24*wi(o(2*$))+.32*wi(o(3*$+6))-.2*wi(o(4*$-63));let L=P-B;L=Oc(L)<=180?L:P<=B?L+360:L-360,L=2*Xn(S*z)*Nc(o(L)/2);const M=f-s,D=z-S,q=1+.015*se(g-50,2)/Xn(20+se(g-50,2)),V=1+.045*Y,C=1+.015*Y*N,I=30*yp(-se(($-275)/25,2)),it=-(2*Xn(se(Y,7)/(se(Y,7)+se(25,7))))*Nc(2*o(I)),rt=Xn(se(M/(e*q),2)+se(D/(r*V),2)+se(L/(a*C),2)+it*(D/(r*V))*(L/(a*C)));return bp(0,mp(100,rt))}function xp(t,n,e="lab"){t=new ut(t),n=new ut(n);const r=t.get(e),a=n.get(e);let i=0;for(let o in r){const s=(r[o]||0)-(a[o]||0);i+=s*s}return Math.sqrt(i)}const wp=(...t)=>{try{return new ut(...t),!0}catch{return!1}},Ap={cool(){return vi([Ot.hsl(180,1,.9),Ot.hsl(250,.7,.4)])},hot(){return vi(["#000","#f00","#ff0","#fff"]).mode("rgb")}},Os={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},Dc=Object.keys(Os),Pc=new Map(Dc.map(t=>[t.toLowerCase(),t])),_p=typeof Proxy=="function"?new Proxy(Os,{get(t,n){const e=n.toLowerCase();if(Pc.has(e))return t[Pc.get(e)]},getOwnPropertyNames(){return Object.getOwnPropertyNames(Dc)}}):Os,kp=(...t)=>{t=Vt(t,"cmyk");const[n,e,r,a]=t,i=t.length>4?t[4]:1;return a===1?[0,0,0,i]:[n>=1?0:255*(1-n)*(1-a),e>=1?0:255*(1-e)*(1-a),r>=1?0:255*(1-r)*(1-a),i]},{max:zc}=Math,Sp=(...t)=>{let[n,e,r]=Vt(t,"rgb");n=n/255,e=e/255,r=r/255;const a=1-zc(n,zc(e,r)),i=a<1?1/(1-a):0,o=(1-n-a)*i,s=(1-e-a)*i,l=(1-r-a)*i;return[o,s,l,a]};ut.prototype.cmyk=function(){return Sp(this._rgb)},Object.assign(Ot,{cmyk:(...t)=>new ut(...t,"cmyk")}),Bt.format.cmyk=kp,Bt.autodetect.push({p:2,test:(...t)=>{if(t=Vt(t,"cmyk"),qt(t)==="array"&&t.length===4)return"cmyk"}});const Mp=(...t)=>{const n=Vt(t,"hsla");let e=Ur(t)||"lsa";return n[0]=fn(n[0]||0)+"deg",n[1]=fn(n[1]*100)+"%",n[2]=fn(n[2]*100)+"%",e==="hsla"||n.length>3&&n[3]<1?(n[3]="/ "+(n.length>3?n[3]:1),e="hsla"):n.length=3,`${e.substr(0,3)}(${n.join(" ")})`},$p=(...t)=>{const n=Vt(t,"lab");let e=Ur(t)||"lab";return n[0]=fn(n[0])+"%",n[1]=fn(n[1]),n[2]=fn(n[2]),e==="laba"||n.length>3&&n[3]<1?n[3]="/ "+(n.length>3?n[3]:1):n.length=3,`lab(${n.join(" ")})`},Lp=(...t)=>{const n=Vt(t,"lch");let e=Ur(t)||"lab";return n[0]=fn(n[0])+"%",n[1]=fn(n[1]),n[2]=isNaN(n[2])?"none":fn(n[2])+"deg",e==="lcha"||n.length>3&&n[3]<1?n[3]="/ "+(n.length>3?n[3]:1):n.length=3,`lch(${n.join(" ")})`},Cp=(...t)=>{const n=Vt(t,"lab");return n[0]=fn(n[0]*100)+"%",n[1]=ps(n[1]),n[2]=ps(n[2]),n.length>3&&n[3]<1?n[3]="/ "+(n.length>3?n[3]:1):n.length=3,`oklab(${n.join(" ")})`},Rc=(...t)=>{const[n,e,r,...a]=Vt(t,"rgb"),[i,o,s]=$s(n,e,r),[l,c,f]=bc(i,o,s);return[l,c,f,...a.length>0&&a[0]<1?[a[0]]:[]]},Tp=(...t)=>{const n=Vt(t,"lch");return n[0]=fn(n[0]*100)+"%",n[1]=ps(n[1]),n[2]=isNaN(n[2])?"none":fn(n[2])+"deg",n.length>3&&n[3]<1?n[3]="/ "+(n.length>3?n[3]:1):n.length=3,`oklch(${n.join(" ")})`},{round:Ns}=Math,Op=(...t)=>{const n=Vt(t,"rgba");let e=Ur(t)||"rgb";if(e.substr(0,3)==="hsl")return Mp(vc(n),e);if(e.substr(0,3)==="lab"){const r=Na();qn("d50");const a=$p(vs(n),e);return qn(r),a}if(e.substr(0,3)==="lch"){const r=Na();qn("d50");const a=Lp(_s(n),e);return qn(r),a}return e.substr(0,5)==="oklab"?Cp($s(n)):e.substr(0,5)==="oklch"?Tp(Rc(n)):(n[0]=Ns(n[0]),n[1]=Ns(n[1]),n[2]=Ns(n[2]),(e==="rgba"||n.length>3&&n[3]<1)&&(n[3]="/ "+(n.length>3?n[3]:1),e="rgba"),`${e.substr(0,3)}(${n.slice(0,e==="rgb"?3:4).join(" ")})`)},Fc=(...t)=>{t=Vt(t,"lch");const[n,e,r,...a]=t,[i,o,s]=mc(n,e,r),[l,c,f]=Ms(i,o,s);return[l,c,f,...a.length>0&&a[0]<1?[a[0]]:[]]},Un=/((?:-?\d+)|(?:-?\d+(?:\.\d+)?)%|none)/.source,wn=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)%?)|none)/.source,Ai=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)%)|none)/.source,un=/\s*/.source,ta=/\s+/.source,Es=/\s*,\s*/.source,_i=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)(?:deg)?)|none)/.source,ea=/\s*(?:\/\s*((?:[01]|[01]?\.\d+)|\d+(?:\.\d+)?%))?/.source,Yc=new RegExp("^rgba?\\("+un+[Un,Un,Un].join(ta)+ea+"\\)$"),Ic=new RegExp("^rgb\\("+un+[Un,Un,Un].join(Es)+un+"\\)$"),Hc=new RegExp("^rgba\\("+un+[Un,Un,Un,wn].join(Es)+un+"\\)$"),Bc=new RegExp("^hsla?\\("+un+[_i,Ai,Ai].join(ta)+ea+"\\)$"),Vc=new RegExp("^hsl?\\("+un+[_i,Ai,Ai].join(Es)+un+"\\)$"),Wc=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,Gc=new RegExp("^lab\\("+un+[wn,wn,wn].join(ta)+ea+"\\)$"),qc=new RegExp("^lch\\("+un+[wn,wn,_i].join(ta)+ea+"\\)$"),Xc=new RegExp("^oklab\\("+un+[wn,wn,wn].join(ta)+ea+"\\)$"),Uc=new RegExp("^oklch\\("+un+[wn,wn,_i].join(ta)+ea+"\\)$"),{round:Zc}=Math,na=t=>t.map((n,e)=>e<=2?_r(Zc(n),0,255):n),le=(t,n=0,e=100,r=!1)=>(typeof t=="string"&&t.endsWith("%")&&(t=parseFloat(t.substring(0,t.length-1))/100,r?t=n+(t+1)*.5*(e-n):t=n+t*(e-n)),+t),Ne=(t,n)=>t==="none"?n:t,Ds=t=>{if(t=t.toLowerCase().trim(),t==="transparent")return[0,0,0,0];let n;if(Bt.format.named)try{return Bt.format.named(t)}catch{}if((n=t.match(Yc))||(n=t.match(Ic))){let e=n.slice(1,4);for(let a=0;a<3;a++)e[a]=+le(Ne(e[a],0),0,255);e=na(e);const r=n[4]!==void 0?+le(n[4],0,1):1;return e[3]=r,e}if(n=t.match(Hc)){const e=n.slice(1,5);for(let r=0;r<4;r++)e[r]=+le(e[r],0,255);return e}if((n=t.match(Bc))||(n=t.match(Vc))){const e=n.slice(1,4);e[0]=+Ne(e[0].replace("deg",""),0),e[1]=+le(Ne(e[1],0),0,100)*.01,e[2]=+le(Ne(e[2],0),0,100)*.01;const r=na(Ss(e)),a=n[4]!==void 0?+le(n[4],0,1):1;return r[3]=a,r}if(n=t.match(Wc)){const e=n.slice(1,4);e[1]*=.01,e[2]*=.01;const r=Ss(e);for(let a=0;a<3;a++)r[a]=Zc(r[a]);return r[3]=+n[4],r}if(n=t.match(Gc)){const e=n.slice(1,4);e[0]=le(Ne(e[0],0),0,100),e[1]=le(Ne(e[1],0),-125,125,!0),e[2]=le(Ne(e[2],0),-125,125,!0);const r=Na();qn("d50");const a=na(bs(e));qn(r);const i=n[4]!==void 0?+le(n[4],0,1):1;return a[3]=i,a}if(n=t.match(qc)){const e=n.slice(1,4);e[0]=le(e[0],0,100),e[1]=le(Ne(e[1],0),0,150,!1),e[2]=+Ne(e[2].replace("deg",""),0);const r=Na();qn("d50");const a=na(As(e));qn(r);const i=n[4]!==void 0?+le(n[4],0,1):1;return a[3]=i,a}if(n=t.match(Xc)){const e=n.slice(1,4);e[0]=le(Ne(e[0],0),0,1),e[1]=le(Ne(e[1],0),-.4,.4,!0),e[2]=le(Ne(e[2],0),-.4,.4,!0);const r=na(Ms(e)),a=n[4]!==void 0?+le(n[4],0,1):1;return r[3]=a,r}if(n=t.match(Uc)){const e=n.slice(1,4);e[0]=le(Ne(e[0],0),0,1),e[1]=le(Ne(e[1],0),0,.4,!1),e[2]=+Ne(e[2].replace("deg",""),0);const r=na(Fc(e)),a=n[4]!==void 0?+le(n[4],0,1):1;return r[3]=a,r}};Ds.test=t=>Yc.test(t)||Bc.test(t)||Gc.test(t)||qc.test(t)||Xc.test(t)||Uc.test(t)||Ic.test(t)||Hc.test(t)||Vc.test(t)||Wc.test(t)||t==="transparent",ut.prototype.css=function(t){return Op(this._rgb,t)};const Np=(...t)=>new ut(...t,"css");Ot.css=Np,Bt.format.css=Ds,Bt.autodetect.push({p:5,test:(t,...n)=>{if(!n.length&&qt(t)==="string"&&Ds.test(t))return"css"}}),Bt.format.gl=(...t)=>{const n=Vt(t,"rgba");return n[0]*=255,n[1]*=255,n[2]*=255,n};const Ep=(...t)=>new ut(...t,"gl");Ot.gl=Ep,ut.prototype.gl=function(){const t=this._rgb;return[t[0]/255,t[1]/255,t[2]/255,t[3]]},ut.prototype.hex=function(t){return dc(this._rgb,t)};const Dp=(...t)=>new ut(...t,"hex");Ot.hex=Dp,Bt.format.hex=hc,Bt.autodetect.push({p:4,test:(t,...n)=>{if(!n.length&&qt(t)==="string"&&[3,4,5,6,7,8,9].indexOf(t.length)>=0)return"hex"}});const{log:ki}=Math,jc=t=>{const n=t/100;let e,r,a;return n<66?(e=255,r=n<6?0:-155.25485562709179-.44596950469579133*(r=n-2)+104.49216199393888*ki(r),a=n<20?0:-254.76935184120902+.8274096064007395*(a=n-10)+115.67994401066147*ki(a)):(e=351.97690566805693+.114206453784165*(e=n-55)-40.25366309332127*ki(e),r=325.4494125711974+.07943456536662342*(r=n-50)-28.0852963507957*ki(r),a=255),[e,r,a,1]},{round:Pp}=Math,zp=(...t)=>{const n=Vt(t,"rgb"),e=n[0],r=n[2];let a=1e3,i=4e4;const o=.4;let s;for(;i-a>o;){s=(i+a)*.5;const l=jc(s);l[2]/l[0]>=r/e?i=s:a=s}return Pp(s)};ut.prototype.temp=ut.prototype.kelvin=ut.prototype.temperature=function(){return zp(this._rgb)};const Ps=(...t)=>new ut(...t,"temp");Object.assign(Ot,{temp:Ps,kelvin:Ps,temperature:Ps}),Bt.format.temp=Bt.format.kelvin=Bt.format.temperature=jc,ut.prototype.oklch=function(){return Rc(this._rgb)},Object.assign(Ot,{oklch:(...t)=>new ut(...t,"oklch")}),Bt.format.oklch=Fc,Bt.autodetect.push({p:2,test:(...t)=>{if(t=Vt(t,"oklch"),qt(t)==="array"&&t.length===3)return"oklch"}}),Object.assign(Ot,{analyze:kc,average:Ig,bezier:qg,blend:xn,brewer:_p,Color:ut,colors:Zr,contrast:hp,contrastAPCA:pp,cubehelix:ap,deltaE:vp,distance:xp,input:Bt,interpolate:jr,limits:Sc,mix:jr,random:lp,scale:vi,scales:Ap,valid:wp});function Kc(t,n){if(!Ot.valid(t))return n;try{return Ot(t)}catch{return n}}function hn(t){return Ot.valid(t)&&Ot.contrast(t,"#fff")>=Ot.contrast(t,"#333")?"#fff":"#333"}const Ea=4.5;function Be(t){let n=t;for(;n&&n instanceof Element;){const e=getComputedStyle(n).backgroundColor;if(e&&e!=="rgba(0, 0, 0, 0)"&&e!=="transparent")return e;n=n.parentElement}return"#fff"}function Jc(t,n="#fff"){if(!Ot.valid(t))return Ot.valid(n)?hn(n):"#333";let e=Ot(t);const r=Kc(n,Ot("#fff"));if(Ot.contrast(e,r)>=Ea)return e.hex();const a=r.luminance()>.5;for(let i=0;i<20&&(e=a?e.darken(.3):e.brighten(.3),!(Ot.contrast(e,r)>=Ea));i++);return e.hex()}const zs=12,Si=.25,Qc=20;function Rp(t,n){if(t.length===0)return[];const e=Kc(n,Ot("#fff")),r=Ot.valid(n)?n:"#fff",a=e.luminance()>.5,i=t.map(o=>Ot.valid(o)?Fp(Ot(o),r,a):Ot("#000"));for(let o=1;o<i.length;o++)Ot.deltaE(i[o],i[o-1])>=zs||(i[o]=Yp(i[o],i[o-1],r,a));return i.map(o=>o.hex())}function Fp(t,n,e){for(let r=0;r<Qc;r++){if(Ot.contrast(t,n)>=Ea)return t;t=e?t.darken(Si):t.brighten(Si)}return t}function Yp(t,n,e,r){const a=tf(t,n,e,r);if(Ot.deltaE(a,n)>=zs)return a;const i=tf(t,n,e,!r);return Ot.deltaE(i,n)>Ot.deltaE(a,n)&&Ot.contrast(i,e)>=Ea?i:a}function tf(t,n,e,r){let a=t,i=Ot.deltaE(t,n),o=t;for(let s=0;s<Qc;s++){o=r?o.darken(Si):o.brighten(Si);const l=Ot.deltaE(o,n);if(l>i&&Ot.contrast(o,e)>=Ea&&(a=o,i=l),i>=zs)break}return a}function ef(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Mi={exports:{}},Ip=Mi.exports,nf;function Hp(){return nf||(nf=1,(function(t,n){(function(e,r){t.exports=r()})(Ip,(function(){var e=1e3,r=6e4,a=36e5,i="millisecond",o="second",s="minute",l="hour",c="day",f="week",h="month",d="quarter",g="year",v="date",m="Invalid Date",b=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,x=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,A={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(M){var D=["th","st","nd","rd"],q=M%100;return"["+M+(D[(q-20)%10]||D[q]||D[0])+"]"}},w=function(M,D,q){var V=String(M);return!V||V.length>=D?M:""+Array(D+1-V.length).join(q)+M},S={s:w,z:function(M){var D=-M.utcOffset(),q=Math.abs(D),V=Math.floor(q/60),C=q%60;return(D<=0?"+":"-")+w(V,2,"0")+":"+w(C,2,"0")},m:function M(D,q){if(D.date()<q.date())return-M(q,D);var V=12*(q.year()-D.year())+(q.month()-D.month()),C=D.clone().add(V,h),I=q-C<0,W=D.clone().add(V+(I?-1:1),h);return+(-(V+(q-C)/(I?C-W:W-C))||0)},a:function(M){return M<0?Math.ceil(M)||0:Math.floor(M)},p:function(M){return{M:h,y:g,w:f,d:c,D:v,h:l,m:s,s:o,ms:i,Q:d}[M]||String(M||"").toLowerCase().replace(/s$/,"")},u:function(M){return M===void 0}},z="en",Y={};Y[z]=A;var G="$isDayjsObject",_=function(M){return M instanceof N||!(!M||!M[G])},B=function M(D,q,V){var C;if(!D)return z;if(typeof D=="string"){var I=D.toLowerCase();Y[I]&&(C=I),q&&(Y[I]=q,C=I);var W=D.split("-");if(!C&&W.length>1)return M(W[0])}else{var it=D.name;Y[it]=D,C=it}return!V&&C&&(z=C),C||!V&&z},P=function(M,D){if(_(M))return M.clone();var q=typeof D=="object"?D:{};return q.date=M,q.args=arguments,new N(q)},$=S;$.l=B,$.i=_,$.w=function(M,D){return P(M,{locale:D.$L,utc:D.$u,x:D.$x,$offset:D.$offset})};var N=(function(){function M(q){this.$L=B(q.locale,null,!0),this.parse(q),this.$x=this.$x||q.x||{},this[G]=!0}var D=M.prototype;return D.parse=function(q){this.$d=(function(V){var C=V.date,I=V.utc;if(C===null)return new Date(NaN);if($.u(C))return new Date;if(C instanceof Date)return new Date(C);if(typeof C=="string"&&!/Z$/i.test(C)){var W=C.match(b);if(W){var it=W[2]-1||0,rt=(W[7]||"0").substring(0,3);return I?new Date(Date.UTC(W[1],it,W[3]||1,W[4]||0,W[5]||0,W[6]||0,rt)):new Date(W[1],it,W[3]||1,W[4]||0,W[5]||0,W[6]||0,rt)}}return new Date(C)})(q),this.init()},D.init=function(){var q=this.$d;this.$y=q.getFullYear(),this.$M=q.getMonth(),this.$D=q.getDate(),this.$W=q.getDay(),this.$H=q.getHours(),this.$m=q.getMinutes(),this.$s=q.getSeconds(),this.$ms=q.getMilliseconds()},D.$utils=function(){return $},D.isValid=function(){return this.$d.toString()!==m},D.isSame=function(q,V){var C=P(q);return this.startOf(V)<=C&&C<=this.endOf(V)},D.isAfter=function(q,V){return P(q)<this.startOf(V)},D.isBefore=function(q,V){return this.endOf(V)<P(q)},D.$g=function(q,V,C){return $.u(q)?this[V]:this.set(C,q)},D.unix=function(){return Math.floor(this.valueOf()/1e3)},D.valueOf=function(){return this.$d.getTime()},D.startOf=function(q,V){var C=this,I=!!$.u(V)||V,W=$.p(q),it=function(j,J){var X=$.w(C.$u?Date.UTC(C.$y,J,j):new Date(C.$y,J,j),C);return I?X:X.endOf(c)},rt=function(j,J){return $.w(C.toDate()[j].apply(C.toDate("s"),(I?[0,0,0,0]:[23,59,59,999]).slice(J)),C)},ct=this.$W,pt=this.$M,xt=this.$D,yt="set"+(this.$u?"UTC":"");switch(W){case g:return I?it(1,0):it(31,11);case h:return I?it(1,pt):it(0,pt+1);case f:var bt=this.$locale().weekStart||0,kt=(ct<bt?ct+7:ct)-bt;return it(I?xt-kt:xt+(6-kt),pt);case c:case v:return rt(yt+"Hours",0);case l:return rt(yt+"Minutes",1);case s:return rt(yt+"Seconds",2);case o:return rt(yt+"Milliseconds",3);default:return this.clone()}},D.endOf=function(q){return this.startOf(q,!1)},D.$set=function(q,V){var C,I=$.p(q),W="set"+(this.$u?"UTC":""),it=(C={},C[c]=W+"Date",C[v]=W+"Date",C[h]=W+"Month",C[g]=W+"FullYear",C[l]=W+"Hours",C[s]=W+"Minutes",C[o]=W+"Seconds",C[i]=W+"Milliseconds",C)[I],rt=I===c?this.$D+(V-this.$W):V;if(I===h||I===g){var ct=this.clone().set(v,1);ct.$d[it](rt),ct.init(),this.$d=ct.set(v,Math.min(this.$D,ct.daysInMonth())).$d}else it&&this.$d[it](rt);return this.init(),this},D.set=function(q,V){return this.clone().$set(q,V)},D.get=function(q){return this[$.p(q)]()},D.add=function(q,V){var C,I=this;q=Number(q);var W=$.p(V),it=function(pt){var xt=P(I);return $.w(xt.date(xt.date()+Math.round(pt*q)),I)};if(W===h)return this.set(h,this.$M+q);if(W===g)return this.set(g,this.$y+q);if(W===c)return it(1);if(W===f)return it(7);var rt=(C={},C[s]=r,C[l]=a,C[o]=e,C)[W]||1,ct=this.$d.getTime()+q*rt;return $.w(ct,this)},D.subtract=function(q,V){return this.add(-1*q,V)},D.format=function(q){var V=this,C=this.$locale();if(!this.isValid())return C.invalidDate||m;var I=q||"YYYY-MM-DDTHH:mm:ssZ",W=$.z(this),it=this.$H,rt=this.$m,ct=this.$M,pt=C.weekdays,xt=C.months,yt=C.meridiem,bt=function(J,X,O,ht){return J&&(J[X]||J(V,I))||O[X].slice(0,ht)},kt=function(J){return $.s(it%12||12,J,"0")},j=yt||function(J,X,O){var ht=J<12?"AM":"PM";return O?ht.toLowerCase():ht};return I.replace(x,(function(J,X){return X||(function(O){switch(O){case"YY":return String(V.$y).slice(-2);case"YYYY":return $.s(V.$y,4,"0");case"M":return ct+1;case"MM":return $.s(ct+1,2,"0");case"MMM":return bt(C.monthsShort,ct,xt,3);case"MMMM":return bt(xt,ct);case"D":return V.$D;case"DD":return $.s(V.$D,2,"0");case"d":return String(V.$W);case"dd":return bt(C.weekdaysMin,V.$W,pt,2);case"ddd":return bt(C.weekdaysShort,V.$W,pt,3);case"dddd":return pt[V.$W];case"H":return String(it);case"HH":return $.s(it,2,"0");case"h":return kt(1);case"hh":return kt(2);case"a":return j(it,rt,!0);case"A":return j(it,rt,!1);case"m":return String(rt);case"mm":return $.s(rt,2,"0");case"s":return String(V.$s);case"ss":return $.s(V.$s,2,"0");case"SSS":return $.s(V.$ms,3,"0");case"Z":return W}return null})(J)||W.replace(":","")}))},D.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},D.diff=function(q,V,C){var I,W=this,it=$.p(V),rt=P(q),ct=(rt.utcOffset()-this.utcOffset())*r,pt=this-rt,xt=function(){return $.m(W,rt)};switch(it){case g:I=xt()/12;break;case h:I=xt();break;case d:I=xt()/3;break;case f:I=(pt-ct)/6048e5;break;case c:I=(pt-ct)/864e5;break;case l:I=pt/a;break;case s:I=pt/r;break;case o:I=pt/e;break;default:I=pt}return C?I:$.a(I)},D.daysInMonth=function(){return this.endOf(h).$D},D.$locale=function(){return Y[this.$L]},D.locale=function(q,V){if(!q)return this.$L;var C=this.clone(),I=B(q,V,!0);return I&&(C.$L=I),C},D.clone=function(){return $.w(this.$d,this)},D.toDate=function(){return new Date(this.valueOf())},D.toJSON=function(){return this.isValid()?this.toISOString():null},D.toISOString=function(){return this.$d.toISOString()},D.toString=function(){return this.$d.toUTCString()},M})(),L=N.prototype;return P.prototype=L,[["$ms",i],["$s",o],["$m",s],["$H",l],["$W",c],["$M",h],["$y",g],["$D",v]].forEach((function(M){L[M[1]]=function(D){return this.$g(D,M[0],M[1])}})),P.extend=function(M,D){return M.$i||(M(D,N,P),M.$i=!0),P},P.locale=B,P.isDayjs=_,P.unix=function(M){return P(1e3*M)},P.en=Y[z],P.Ls=Y,P.p={},P}))})(Mi)),Mi.exports}var Bp=Hp();const ra=ef(Bp);var $i={exports:{}},Vp=$i.exports,rf;function Wp(){return rf||(rf=1,(function(t,n){(function(e,r){t.exports=r()})(Vp,(function(){var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,a=/\d/,i=/\d\d/,o=/\d\d?/,s=/\d*[^-_:/,()\s\d]+/,l={},c=function(b){return(b=+b)+(b>68?1900:2e3)},f=function(b){return function(x){this[b]=+x}},h=[/[+-]\d\d:?(\d\d)?|Z/,function(b){(this.zone||(this.zone={})).offset=(function(x){if(!x||x==="Z")return 0;var A=x.match(/([+-]|\d\d)/g),w=60*A[1]+(+A[2]||0);return w===0?0:A[0]==="+"?-w:w})(b)}],d=function(b){var x=l[b];return x&&(x.indexOf?x:x.s.concat(x.f))},g=function(b,x){var A,w=l.meridiem;if(w){for(var S=1;S<=24;S+=1)if(b.indexOf(w(S,0,x))>-1){A=S>12;break}}else A=b===(x?"pm":"PM");return A},v={A:[s,function(b){this.afternoon=g(b,!1)}],a:[s,function(b){this.afternoon=g(b,!0)}],Q:[a,function(b){this.month=3*(b-1)+1}],S:[a,function(b){this.milliseconds=100*+b}],SS:[i,function(b){this.milliseconds=10*+b}],SSS:[/\d{3}/,function(b){this.milliseconds=+b}],s:[o,f("seconds")],ss:[o,f("seconds")],m:[o,f("minutes")],mm:[o,f("minutes")],H:[o,f("hours")],h:[o,f("hours")],HH:[o,f("hours")],hh:[o,f("hours")],D:[o,f("day")],DD:[i,f("day")],Do:[s,function(b){var x=l.ordinal,A=b.match(/\d+/);if(this.day=A[0],x)for(var w=1;w<=31;w+=1)x(w).replace(/\[|\]/g,"")===b&&(this.day=w)}],w:[o,f("week")],ww:[i,f("week")],M:[o,f("month")],MM:[i,f("month")],MMM:[s,function(b){var x=d("months"),A=(d("monthsShort")||x.map((function(w){return w.slice(0,3)}))).indexOf(b)+1;if(A<1)throw new Error;this.month=A%12||A}],MMMM:[s,function(b){var x=d("months").indexOf(b)+1;if(x<1)throw new Error;this.month=x%12||x}],Y:[/[+-]?\d+/,f("year")],YY:[i,function(b){this.year=c(b)}],YYYY:[/\d{4}/,f("year")],Z:h,ZZ:h};function m(b){var x,A;x=b,A=l&&l.formats;for(var w=(b=x.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(P,$,N){var L=N&&N.toUpperCase();return $||A[N]||e[N]||A[L].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(M,D,q){return D||q.slice(1)}))}))).match(r),S=w.length,z=0;z<S;z+=1){var Y=w[z],G=v[Y],_=G&&G[0],B=G&&G[1];w[z]=B?{regex:_,parser:B}:Y.replace(/^\[|\]$/g,"")}return function(P){for(var $={},N=0,L=0;N<S;N+=1){var M=w[N];if(typeof M=="string")L+=M.length;else{var D=M.regex,q=M.parser,V=P.slice(L),C=D.exec(V)[0];q.call($,C),P=P.replace(C,"")}}return(function(I){var W=I.afternoon;if(W!==void 0){var it=I.hours;W?it<12&&(I.hours+=12):it===12&&(I.hours=0),delete I.afternoon}})($),$}}return function(b,x,A){A.p.customParseFormat=!0,b&&b.parseTwoDigitYear&&(c=b.parseTwoDigitYear);var w=x.prototype,S=w.parse;w.parse=function(z){var Y=z.date,G=z.utc,_=z.args;this.$u=G;var B=_[1];if(typeof B=="string"){var P=_[2]===!0,$=_[3]===!0,N=P||$,L=_[2];$&&(L=_[2]),l=this.$locale(),!P&&L&&(l=A.Ls[L]),this.$d=(function(V,C,I,W){try{if(["x","X"].indexOf(C)>-1)return new Date((C==="X"?1e3:1)*V);var it=m(C)(V),rt=it.year,ct=it.month,pt=it.day,xt=it.hours,yt=it.minutes,bt=it.seconds,kt=it.milliseconds,j=it.zone,J=it.week,X=new Date,O=pt||(rt||ct?1:X.getDate()),ht=rt||X.getFullYear(),mt=0;rt&&!ct||(mt=ct>0?ct-1:X.getMonth());var vt,Tt=xt||0,Ht=yt||0,Ft=bt||0,Yt=kt||0;return j?new Date(Date.UTC(ht,mt,O,Tt,Ht,Ft,Yt+60*j.offset*1e3)):I?new Date(Date.UTC(ht,mt,O,Tt,Ht,Ft,Yt)):(vt=new Date(ht,mt,O,Tt,Ht,Ft,Yt),J&&(vt=W(vt).week(J).toDate()),vt)}catch{return new Date("")}})(Y,B,G,A),this.init(),L&&L!==!0&&(this.$L=this.locale(L).$L),N&&Y!=this.format(B)&&(this.$d=new Date("")),l={}}else if(B instanceof Array)for(var M=B.length,D=1;D<=M;D+=1){_[1]=B[D-1];var q=A.apply(this,_);if(q.isValid()){this.$d=q.$d,this.$L=q.$L,this.init();break}D===M&&(this.$d=new Date(""))}else S.call(this,z)}}}))})($i)),$i.exports}var Gp=Wp();const qp=ef(Gp);ra.extend(qp);const af=["YYYY-MM-DDTHH:mm:ss","YYYY-MM-DD HH:mm","YYYY-MM-DD","YYYY/MM/DD","MM/DD/YYYY","M/D/YYYY","M/D/YY","DD/MM/YYYY","DD.MM.YYYY","MMM D, YYYY","MMMM D, YYYY","MMM YYYY","MMMM YYYY","YYYY-MM","YYYY/MM","YYYY"];function Xp(t){return t.includes("HH")||t.includes("mm")||t.includes("ss")?"datetime":t.includes("DD")||new RegExp("(?<![MA-Z])D(?!D)").test(t)?"day":t==="YYYY"?"year":t.includes("MM")||t.includes("MMM")||t.includes("MMMM")||t.includes("M/")?"month":"day"}function Li(t){return new Date(Date.UTC(t.year(),t.month(),t.date(),t.hour(),t.minute(),t.second(),t.millisecond()))}function Up(t){const n=t.trim();if(!n)return null;if(/^\d{4}$/.test(n)){const e=ra(n,"YYYY",!0);return e.isValid()?Li(e):null}for(const e of af){if(e==="YYYY")continue;const r=ra(n,e,!0);if(r.isValid())return Li(r)}return null}function Da(t){const n=t.trim();if(!n)return;const e=Up(n);if(e)return e.getTime();const r=parseFloat(n);if(!isNaN(r))return r}function Ci(t){if(t.length===0)return null;const n=[];let e=null;const r=t[0].trim();if(!r)return null;if(/^\d{4}$/.test(r)){for(const i of t){const o=i.trim();if(!/^\d{4}$/.test(o))return null;const s=ra(o,"YYYY",!0);if(!s.isValid())return null;n.push(Li(s))}return{dates:n,granularity:"year"}}const a=[];for(const i of af)i!=="YYYY"&&ra(r,i,!0).isValid()&&a.push(i);if(a.length===0)return null;for(const i of a){const o=[];let s=!0;for(const l of t){const c=ra(l.trim(),i,!0);if(!c.isValid()){s=!1;break}o.push(Li(c))}if(s){e=i,n.push(...o);break}}return e?{dates:n,granularity:Xp(e)}:null}var ve=(t=>(t.BarVertical="bar-vertical",t.BarHorizontal="bar-horizontal",t.BarMulti="bar-multi",t.ColumnStacked="column-stacked",t.BarStacked="bar-stacked",t.BarSplit="bar-split",t.BarGrouped="bar-grouped",t.Line="line",t.LineMulti="line-multi",t.Area="area",t.AreaStacked="area-stacked",t.Donut="donut",t.Pie="pie",t.VerticalBar="vertical-bar",t.HorizontalBar="horizontal-bar",t))(ve||{}),An=(t=>(t.Left="left",t.Right="right",t))(An||{}),aa=(t=>(t.Linear="linear",t.Log="log",t))(aa||{}),he=(t=>(t.Solid="solid",t.Dashed="dashed",t.Dotted="dotted",t.None="none",t))(he||{}),Jt=(t=>(t.Auto="auto",t.Inside="inside",t.Outside="outside",t.Off="off",t))(Jt||{}),Pa=(t=>(t.Auto="auto",t.Horizontal="horizontal",t.Vertical="vertical",t))(Pa||{}),ce=(t=>(t.NW="NW",t.N="N",t.NE="NE",t.E="E",t.SE="SE",t.S="S",t.SW="SW",t.W="W",t.Center="center",t))(ce||{}),xe=(t=>(t.Direct="direct",t.CurveLeft="curve-left",t.CurveRight="curve-right",t.Elbow="elbow",t))(xe||{}),Ti=(t=>(t.Solid="solid",t.Dotted="dotted",t.Dashed="dashed",t))(Ti||{}),we=(t=>(t.Point="point",t.Range="range",t.Free="free",t))(we||{}),of=(t=>(t.Start="start",t.Center="center",t.End="end",t))(of||{}),Ve=(t=>(t.Vertical="vertical",t.Horizontal="horizontal",t))(Ve||{}),Ke=(t=>(t.Circle="circle",t.Square="square",t.Diamond="diamond",t.Triangle="triangle",t.TriangleDown="triangleDown",t.Cross="cross",t.Star="star",t))(Ke||{}),Je=(t=>(t.All="all",t.First="first",t.Last="last",t.FirstLast="firstLast",t))(Je||{}),Ee=(t=>(t.Filled="filled",t.Hollow="hollow",t))(Ee||{}),pe=(t=>(t.Ascending="ascending",t.Descending="descending",t.None="none",t))(pe||{}),_n=(t=>(t.Total="total",t.WithinGroups="within-groups",t.None="none",t))(_n||{}),ia=(t=>(t.Top="top",t.Bottom="bottom",t.Left="left",t.Right="right",t))(ia||{}),Zn=(t=>(t.Start="start",t.Middle="middle",t.End="end",t))(Zn||{}),It=(t=>(t.Inside="inside",t.Outside="outside",t.Auto="auto",t))(It||{}),Ae=(t=>(t.Both="both",t.Vertical="vertical",t.Horizontal="horizontal",t))(Ae||{}),kn=(t=>(t.Solid="solid",t.Dashed="dashed",t.Dotted="dotted",t))(kn||{}),kr=(t=>(t.Normal="normal",t.Percent="percent",t))(kr||{}),_t=(t=>(t.Colors="colors",t.Boolean="boolean",t.Select="select",t.Text="text",t.NumberFormat="numberFormat",t.DateFormat="dateFormat",t))(_t||{}),_e=(t=>(t.Off="",t.Auto="auto",t.Outside="outside",t.Inside="inside",t))(_e||{}),Sn=(t=>(t.Linear="linear",t.MonotoneX="monotoneX",t.Step="step",t.StepBefore="stepBefore",t.StepAfter="stepAfter",t.Basis="basis",t.Cardinal="cardinal",t.CatmullRom="catmullRom",t))(Sn||{});function sf(t){const n=t==null?void 0:t.trim();if(!n)return;const e=Number.parseFloat(n);return Number.isFinite(e)?e:void 0}function lf(t){var i;const n=t.split(`
|
|
239
|
+
`).map(o=>o.trim()).filter(Boolean),e=[],r=[],a=(i=n[0])==null?void 0:i.match(/^series\s*=\s*(.+)$/);if(a){const o=a[1].trim(),s=o.includes('","')?o.split(",").map(f=>f.trim().replace(/^"|"$/g,"")):o.replace(/^"|"$/g,"").split(",").map(f=>f.trim()),l=s.map(()=>[]);for(let f=1;f<n.length;f++){const h=n[f].match(/^"([^"]+)"\s*=\s*([^"]+)$/),g=n[f].match(/^"([^"]+)"\s*=\s*"([^"]*)"$/)??h;if(g){e.push(g[1]);const v=g[2].split(",");for(let m=0;m<s.length;m++)l[m].push(sf(v[m]))}}const c=s.map((f,h)=>({name:f,values:l[h]}));return{labels:e,values:l[0]??[],series:c}}for(const o of n){const s=o.match(/^"([^"]+)"\s*=\s*(.+)$/);s&&(e.push(s[1]),r.push(sf(s[2])))}return{labels:e,values:r}}function Zp(t,n){const e={},r=I0(t.colorPalette);return r?e.colors=r:t.colors&&t.colors.length>0&&(e.colors=t.colors),t.autoContrast&&n&&e.colors&&(e.colors=Rp(e.colors,n)),t.allowDarkMode!==void 0&&(e.allowDarkMode=t.allowDarkMode),e}function jp(t){const n={};return t.legend!==void 0&&(n.legend=t.legend),t.legendPosition!==void 0&&(n.legendPosition=t.legendPosition),t.legendAnchor!==void 0&&(n.legendAnchor=t.legendAnchor),t.directLabelling!==void 0&&(n.directLabelling=t.directLabelling),t.directLabelAnchor!==void 0&&(n.directLabelAnchor=t.directLabelAnchor),n}function Kp(t){if(!(t.showVerticalTicks!==void 0||t.verticalGridStyle!==void 0||t.verticalNumberFormat!==void 0||t.showVerticalAxis!==void 0||t.verticalAxisDirection!==void 0||t.verticalScaleType!==void 0||t.verticalLabelPosition!==void 0||t.verticalRangeMin||t.verticalRangeMax))return{};const e={};t.showVerticalTicks!==void 0&&(e.showTicks=t.showVerticalTicks),t.verticalAxisDirection!==void 0&&(e.direction=t.verticalAxisDirection),t.verticalGridStyle!==void 0&&(e.gridStyle=t.verticalGridStyle),t.verticalNumberFormat!==void 0&&(e.numberFormat=t.verticalNumberFormat),t.showVerticalAxis!==void 0&&(e.showAxis=t.showVerticalAxis),t.verticalScaleType!==void 0&&(e.scaleType=t.verticalScaleType),t.verticalLabelPosition!==void 0&&(e.labelPosition=t.verticalLabelPosition);const r=Da(t.verticalRangeMin??""),a=Da(t.verticalRangeMax??"");return(r!==void 0||a!==void 0)&&(e.range={},r!==void 0&&(e.range.min=r),a!==void 0&&(e.range.max=a)),{verticalAxis:e}}function Jp(t){if(!(t.showHorizontalTicks!==void 0||t.horizontalGridStyle!==void 0||t.horizontalNumberFormat!==void 0||t.showHorizontalAxis!==void 0||t.horizontalScaleType!==void 0||t.horizontalLabelPosition!==void 0||t.horizontalLabelRotation!==void 0||t.horizontalRangeMin||t.horizontalRangeMax))return{};const e={};t.showHorizontalTicks!==void 0&&(e.showTicks=t.showHorizontalTicks),t.horizontalGridStyle!==void 0&&(e.gridStyle=t.horizontalGridStyle),t.horizontalNumberFormat!==void 0&&(e.numberFormat=t.horizontalNumberFormat),t.showHorizontalAxis!==void 0&&(e.showAxis=t.showHorizontalAxis),t.horizontalScaleType!==void 0&&(e.scaleType=t.horizontalScaleType),t.horizontalLabelPosition!==void 0&&(e.labelPosition=t.horizontalLabelPosition),t.horizontalLabelRotation!==void 0&&(e.labelRotation=t.horizontalLabelRotation);const r=Da(t.horizontalRangeMin??""),a=Da(t.horizontalRangeMax??"");return(r!==void 0||a!==void 0)&&(e.range={},r!==void 0&&(e.range.min=r),a!==void 0&&(e.range.max=a)),{horizontalAxis:e}}function Qp(t){return t.lineSymbols?{lineSymbols:{symbol:t.lineSymbolShape??Ke.Circle,showOn:t.lineSymbolShowOn??Je.FirstLast,style:t.lineSymbolStyle??Ee.Filled,size:parseFloat(t.lineSymbolSize??"3.5")||3.5,opacity:parseFloat(t.lineSymbolOpacity??"1")||1}}:{}}function tm(t,n){const e={...Zp(t,n),...jp(t),...Kp(t),...Jp(t),...Qp(t)};t.interpolation!==void 0&&(e.interpolation=t.interpolation),t.valueLabels!==void 0&&(e.valueLabels=t.valueLabels),t.valueLabelPosition!==void 0&&(e.valueLabelPosition=t.valueLabelPosition),t.tooltips!==void 0&&(e.tooltips=t.tooltips),t.crosshair!==void 0&&(e.crosshair=t.crosshair),t.crosshairDirection&&(e.crosshairDirection=t.crosshairDirection),t.crosshairStyle&&(e.crosshairStyle=t.crosshairStyle),t.crosshairColor&&(e.crosshairColor=t.crosshairColor),t.displayAsPercentage!==void 0&&(e.displayAsPercentage=t.displayAsPercentage),t.showTotal!==void 0&&(e.showTotal=t.showTotal),t.showLabels!==void 0&&(e.showLabels=t.showLabels),t.showValues!==void 0&&(e.showValues=t.showValues),t.swapLabelValue!==void 0&&(e.swapLabelValue=t.swapLabelValue);const r=parseInt(t.sliceMax??"",10);!isNaN(r)&&r>0&&(e.sliceMax=r),t.sliceGroupLabel!==void 0&&(e.sliceGroupLabel=t.sliceGroupLabel),t.barBackground!==void 0&&(e.barBackground=t.barBackground),t.barSeparators!==void 0&&(e.barSeparators=t.barSeparators);const a=parseFloat(t.barGap??"");isNaN(a)||(e.barGap=Math.max(0,Math.min(100,a))),t.connectedColumns!==void 0&&(e.connectedColumns=t.connectedColumns);const i=parseFloat(t.connectionsOpacity??"");isNaN(i)||(e.connectionsOpacity=Math.max(0,Math.min(1,i))),t.stackMode!==void 0&&(e.stackMode=t.stackMode),t.stacked!==void 0&&(e.stacked=t.stacked),t.stackPercent!==void 0&&(e.stackPercent=t.stackPercent),t.areaSortMode!==void 0&&(e.areaSortMode=t.areaSortMode),t.areaLines!==void 0&&(e.areaLines=t.areaLines);const o=parseFloat(t.areaFillOpacity??"");return isNaN(o)||(e.areaFillOpacity=o),t.edgePadding!==void 0&&(e.edgePadding=t.edgePadding),t.waterfall!==void 0&&(e.waterfall=t.waterfall),t.waterfallTotal!==void 0&&(e.waterfallTotal=t.waterfallTotal),t.categoryLabelLine!==void 0&&(e.categoryLabelLine=t.categoryLabelLine),e}function Oi(t,n){if(!n||n.min===void 0&&n.max===void 0)return t.map((r,a)=>a);const e=[];for(let r=0;r<t.length;r++){const a=Da(t[r]);if(a===void 0){e.push(r);continue}n.min!==void 0&&a<n.min||n.max!==void 0&&a>n.max||e.push(r)}return e}const Rs=60;function Sr(t){const n=Number.isFinite(t)?Math.max(0,Math.min(100,t)):Rs;return n/(n+100)}function oa(t,n,e){let r=0,a=0,i=1/0,o=!0,s=!1;for(const f of t)Number.isFinite(f)&&(s=!0,f<r&&(r=f),f>a&&(a=f),f<=0?o=!1:f<i&&(i=f));e===aa.Log&&s&&o&&(r=i);let l=(n==null?void 0:n.min)??r,c=(n==null?void 0:n.max)??a;if(l>c&&([l,c]=[c,l]),l===c)if(l===0)c=1;else{const f=Math.abs(l)*.1;l=l-f,c=c+f}return[l,c]}function Ni(t,n){return t==null||n==null?NaN:t<n?-1:t>n?1:t>=n?0:NaN}function em(t,n){return t==null||n==null?NaN:n<t?-1:n>t?1:n>=t?0:NaN}function cf(t){let n,e,r;t.length!==2?(n=Ni,e=(s,l)=>Ni(t(s),l),r=(s,l)=>t(s)-l):(n=t===Ni||t===em?t:nm,e=t,r=t);function a(s,l,c=0,f=s.length){if(c<f){if(n(l,l)!==0)return f;do{const h=c+f>>>1;e(s[h],l)<0?c=h+1:f=h}while(c<f)}return c}function i(s,l,c=0,f=s.length){if(c<f){if(n(l,l)!==0)return f;do{const h=c+f>>>1;e(s[h],l)<=0?c=h+1:f=h}while(c<f)}return c}function o(s,l,c=0,f=s.length){const h=a(s,l,c,f-1);return h>c&&r(s[h-1],l)>-r(s[h],l)?h-1:h}return{left:a,center:o,right:i}}function nm(){return 0}function rm(t){return t===null?NaN:+t}const am=cf(Ni).right,im=cf(rm).center;class Fs extends Map{constructor(n,e=lm){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),n!=null)for(const[r,a]of n)this.set(r,a)}get(n){return super.get(ff(this,n))}has(n){return super.has(ff(this,n))}set(n,e){return super.set(om(this,n),e)}delete(n){return super.delete(sm(this,n))}}function ff({_intern:t,_key:n},e){const r=n(e);return t.has(r)?t.get(r):e}function om({_intern:t,_key:n},e){const r=n(e);return t.has(r)?t.get(r):(t.set(r,e),e)}function sm({_intern:t,_key:n},e){const r=n(e);return t.has(r)&&(e=t.get(r),t.delete(r)),e}function lm(t){return t!==null&&typeof t=="object"?t.valueOf():t}function cm(t){return t}function uf(t,n,...e){return fm(t,cm,n,e)}function fm(t,n,e,r){return(function a(i,o){if(o>=r.length)return e(i);const s=new Fs,l=r[o++];let c=-1;for(const f of i){const h=l(f,++c,i),d=s.get(h);d?d.push(f):s.set(h,[f])}for(const[f,h]of s)s.set(f,a(h,o));return n(s)})(t,0)}const um=Math.sqrt(50),hm=Math.sqrt(10),dm=Math.sqrt(2);function Ei(t,n,e){const r=(n-t)/Math.max(0,e),a=Math.floor(Math.log10(r)),i=r/Math.pow(10,a),o=i>=um?10:i>=hm?5:i>=dm?2:1;let s,l,c;return a<0?(c=Math.pow(10,-a)/o,s=Math.round(t*c),l=Math.round(n*c),s/c<t&&++s,l/c>n&&--l,c=-c):(c=Math.pow(10,a)*o,s=Math.round(t/c),l=Math.round(n/c),s*c<t&&++s,l*c>n&&--l),l<s&&.5<=e&&e<2?Ei(t,n,e*2):[s,l,c]}function gm(t,n,e){if(n=+n,t=+t,e=+e,!(e>0))return[];if(t===n)return[t];const r=n<t,[a,i,o]=r?Ei(n,t,e):Ei(t,n,e);if(!(i>=a))return[];const s=i-a+1,l=new Array(s);if(r)if(o<0)for(let c=0;c<s;++c)l[c]=(i-c)/-o;else for(let c=0;c<s;++c)l[c]=(i-c)*o;else if(o<0)for(let c=0;c<s;++c)l[c]=(a+c)/-o;else for(let c=0;c<s;++c)l[c]=(a+c)*o;return l}function Ys(t,n,e){return n=+n,t=+t,e=+e,Ei(t,n,e)[2]}function pm(t,n,e){n=+n,t=+t,e=+e;const r=n<t,a=r?Ys(n,t,e):Ys(t,n,e);return(r?-1:1)*(a<0?1/-a:a)}function Mr(t,n){let e;if(n===void 0)for(const r of t)r!=null&&(e<r||e===void 0&&r>=r)&&(e=r);else{let r=-1;for(let a of t)(a=n(a,++r,t))!=null&&(e<a||e===void 0&&a>=a)&&(e=a)}return e}function mm(t,n,e){t=+t,n=+n,e=(a=arguments.length)<2?(n=t,t=0,1):a<3?1:+e;for(var r=-1,a=Math.max(0,Math.ceil((n-t)/e))|0,i=new Array(a);++r<a;)i[r]=t+r*e;return i}function hf(t,n){let e=0;if(n===void 0)for(let r of t)(r=+r)&&(e+=r);else{let r=-1;for(let a of t)(a=+n(a,++r,t))&&(e+=a)}return e}function bm(t){return t}var Di=1,Pi=2,Is=3,za=4,df=1e-6;function ym(t){return"translate("+t+",0)"}function vm(t){return"translate(0,"+t+")"}function xm(t){return n=>+t(n)}function wm(t,n){return n=Math.max(0,t.bandwidth()-n*2)/2,t.round()&&(n=Math.round(n)),e=>+t(e)+n}function Am(){return!this.__axis}function zi(t,n){var e=[],r=null,a=null,i=6,o=6,s=3,l=typeof window<"u"&&window.devicePixelRatio>1?0:.5,c=t===Di||t===za?-1:1,f=t===za||t===Pi?"x":"y",h=t===Di||t===Is?ym:vm;function d(g){var v=r??(n.ticks?n.ticks.apply(n,e):n.domain()),m=a??(n.tickFormat?n.tickFormat.apply(n,e):bm),b=Math.max(i,0)+s,x=n.range(),A=+x[0]+l,w=+x[x.length-1]+l,S=(n.bandwidth?wm:xm)(n.copy(),l),z=g.selection?g.selection():g,Y=z.selectAll(".domain").data([null]),G=z.selectAll(".tick").data(v,n).order(),_=G.exit(),B=G.enter().append("g").attr("class","tick"),P=G.select("line"),$=G.select("text");Y=Y.merge(Y.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),G=G.merge(B),P=P.merge(B.append("line").attr("stroke","currentColor").attr(f+"2",c*i)),$=$.merge(B.append("text").attr("fill","currentColor").attr(f,c*b).attr("dy",t===Di?"0em":t===Is?"0.71em":"0.32em")),g!==z&&(Y=Y.transition(g),G=G.transition(g),P=P.transition(g),$=$.transition(g),_=_.transition(g).attr("opacity",df).attr("transform",function(N){return isFinite(N=S(N))?h(N+l):this.getAttribute("transform")}),B.attr("opacity",df).attr("transform",function(N){var L=this.parentNode.__axis;return h((L&&isFinite(L=L(N))?L:S(N))+l)})),_.remove(),Y.attr("d",t===za||t===Pi?o?"M"+c*o+","+A+"H"+l+"V"+w+"H"+c*o:"M"+l+","+A+"V"+w:o?"M"+A+","+c*o+"V"+l+"H"+w+"V"+c*o:"M"+A+","+l+"H"+w),G.attr("opacity",1).attr("transform",function(N){return h(S(N)+l)}),P.attr(f+"2",c*i),$.attr(f,c*b).text(m),z.filter(Am).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===Pi?"start":t===za?"end":"middle"),z.each(function(){this.__axis=S})}return d.scale=function(g){return arguments.length?(n=g,d):n},d.ticks=function(){return e=Array.from(arguments),d},d.tickArguments=function(g){return arguments.length?(e=g==null?[]:Array.from(g),d):e.slice()},d.tickValues=function(g){return arguments.length?(r=g==null?null:Array.from(g),d):r&&r.slice()},d.tickFormat=function(g){return arguments.length?(a=g,d):a},d.tickSize=function(g){return arguments.length?(i=o=+g,d):i},d.tickSizeInner=function(g){return arguments.length?(i=+g,d):i},d.tickSizeOuter=function(g){return arguments.length?(o=+g,d):o},d.tickPadding=function(g){return arguments.length?(s=+g,d):s},d.offset=function(g){return arguments.length?(l=+g,d):l},d}function _m(t){return zi(Di,t)}function gf(t){return zi(Pi,t)}function km(t){return zi(Is,t)}function pf(t){return zi(za,t)}var Sm={value:()=>{}};function Hs(){for(var t=0,n=arguments.length,e={},r;t<n;++t){if(!(r=arguments[t]+"")||r in e||/[\s.]/.test(r))throw new Error("illegal type: "+r);e[r]=[]}return new Ri(e)}function Ri(t){this._=t}function Mm(t,n){return t.trim().split(/^|\s+/).map(function(e){var r="",a=e.indexOf(".");if(a>=0&&(r=e.slice(a+1),e=e.slice(0,a)),e&&!n.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:r}})}Ri.prototype=Hs.prototype={constructor:Ri,on:function(t,n){var e=this._,r=Mm(t+"",e),a,i=-1,o=r.length;if(arguments.length<2){for(;++i<o;)if((a=(t=r[i]).type)&&(a=$m(e[a],t.name)))return a;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++i<o;)if(a=(t=r[i]).type)e[a]=mf(e[a],t.name,n);else if(n==null)for(a in e)e[a]=mf(e[a],t.name,null);return this},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new Ri(t)},call:function(t,n){if((a=arguments.length-2)>0)for(var e=new Array(a),r=0,a,i;r<a;++r)e[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=this._[t],r=0,a=i.length;r<a;++r)i[r].value.apply(n,e)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],a=0,i=r.length;a<i;++a)r[a].value.apply(n,e)}};function $m(t,n){for(var e=0,r=t.length,a;e<r;++e)if((a=t[e]).name===n)return a.value}function mf(t,n,e){for(var r=0,a=t.length;r<a;++r)if(t[r].name===n){t[r]=Sm,t=t.slice(0,r).concat(t.slice(r+1));break}return e!=null&&t.push({name:n,value:e}),t}var Bs="http://www.w3.org/1999/xhtml";const bf={svg:"http://www.w3.org/2000/svg",xhtml:Bs,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Fi(t){var n=t+="",e=n.indexOf(":");return e>=0&&(n=t.slice(0,e))!=="xmlns"&&(t=t.slice(e+1)),bf.hasOwnProperty(n)?{space:bf[n],local:t}:t}function Lm(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===Bs&&n.documentElement.namespaceURI===Bs?n.createElement(t):n.createElementNS(e,t)}}function Cm(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function yf(t){var n=Fi(t);return(n.local?Cm:Lm)(n)}function Tm(){}function Vs(t){return t==null?Tm:function(){return this.querySelector(t)}}function Om(t){typeof t!="function"&&(t=Vs(t));for(var n=this._groups,e=n.length,r=new Array(e),a=0;a<e;++a)for(var i=n[a],o=i.length,s=r[a]=new Array(o),l,c,f=0;f<o;++f)(l=i[f])&&(c=t.call(l,l.__data__,f,i))&&("__data__"in l&&(c.__data__=l.__data__),s[f]=c);return new Qe(r,this._parents)}function Nm(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Em(){return[]}function vf(t){return t==null?Em:function(){return this.querySelectorAll(t)}}function Dm(t){return function(){return Nm(t.apply(this,arguments))}}function Pm(t){typeof t=="function"?t=Dm(t):t=vf(t);for(var n=this._groups,e=n.length,r=[],a=[],i=0;i<e;++i)for(var o=n[i],s=o.length,l,c=0;c<s;++c)(l=o[c])&&(r.push(t.call(l,l.__data__,c,o)),a.push(l));return new Qe(r,a)}function xf(t){return function(){return this.matches(t)}}function wf(t){return function(n){return n.matches(t)}}var zm=Array.prototype.find;function Rm(t){return function(){return zm.call(this.children,t)}}function Fm(){return this.firstElementChild}function Ym(t){return this.select(t==null?Fm:Rm(typeof t=="function"?t:wf(t)))}var Im=Array.prototype.filter;function Hm(){return Array.from(this.children)}function Bm(t){return function(){return Im.call(this.children,t)}}function Vm(t){return this.selectAll(t==null?Hm:Bm(typeof t=="function"?t:wf(t)))}function Wm(t){typeof t!="function"&&(t=xf(t));for(var n=this._groups,e=n.length,r=new Array(e),a=0;a<e;++a)for(var i=n[a],o=i.length,s=r[a]=[],l,c=0;c<o;++c)(l=i[c])&&t.call(l,l.__data__,c,i)&&s.push(l);return new Qe(r,this._parents)}function Af(t){return new Array(t.length)}function Gm(){return new Qe(this._enter||this._groups.map(Af),this._parents)}function Yi(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}Yi.prototype={constructor:Yi,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function qm(t){return function(){return t}}function Xm(t,n,e,r,a,i){for(var o=0,s,l=n.length,c=i.length;o<c;++o)(s=n[o])?(s.__data__=i[o],r[o]=s):e[o]=new Yi(t,i[o]);for(;o<l;++o)(s=n[o])&&(a[o]=s)}function Um(t,n,e,r,a,i,o){var s,l,c=new Map,f=n.length,h=i.length,d=new Array(f),g;for(s=0;s<f;++s)(l=n[s])&&(d[s]=g=o.call(l,l.__data__,s,n)+"",c.has(g)?a[s]=l:c.set(g,l));for(s=0;s<h;++s)g=o.call(t,i[s],s,i)+"",(l=c.get(g))?(r[s]=l,l.__data__=i[s],c.delete(g)):e[s]=new Yi(t,i[s]);for(s=0;s<f;++s)(l=n[s])&&c.get(d[s])===l&&(a[s]=l)}function Zm(t){return t.__data__}function jm(t,n){if(!arguments.length)return Array.from(this,Zm);var e=n?Um:Xm,r=this._parents,a=this._groups;typeof t!="function"&&(t=qm(t));for(var i=a.length,o=new Array(i),s=new Array(i),l=new Array(i),c=0;c<i;++c){var f=r[c],h=a[c],d=h.length,g=Km(t.call(f,f&&f.__data__,c,r)),v=g.length,m=s[c]=new Array(v),b=o[c]=new Array(v),x=l[c]=new Array(d);e(f,h,m,b,x,g,n);for(var A=0,w=0,S,z;A<v;++A)if(S=m[A]){for(A>=w&&(w=A+1);!(z=b[w])&&++w<v;);S._next=z||null}}return o=new Qe(o,r),o._enter=s,o._exit=l,o}function Km(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Jm(){return new Qe(this._exit||this._groups.map(Af),this._parents)}function Qm(t,n,e){var r=this.enter(),a=this,i=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),n!=null&&(a=n(a),a&&(a=a.selection())),e==null?i.remove():e(i),r&&a?r.merge(a).order():a}function tb(t){for(var n=t.selection?t.selection():t,e=this._groups,r=n._groups,a=e.length,i=r.length,o=Math.min(a,i),s=new Array(a),l=0;l<o;++l)for(var c=e[l],f=r[l],h=c.length,d=s[l]=new Array(h),g,v=0;v<h;++v)(g=c[v]||f[v])&&(d[v]=g);for(;l<a;++l)s[l]=e[l];return new Qe(s,this._parents)}function eb(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r=t[n],a=r.length-1,i=r[a],o;--a>=0;)(o=r[a])&&(i&&o.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(o,i),i=o);return this}function nb(t){t||(t=rb);function n(h,d){return h&&d?t(h.__data__,d.__data__):!h-!d}for(var e=this._groups,r=e.length,a=new Array(r),i=0;i<r;++i){for(var o=e[i],s=o.length,l=a[i]=new Array(s),c,f=0;f<s;++f)(c=o[f])&&(l[f]=c);l.sort(n)}return new Qe(a,this._parents).order()}function rb(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function ab(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function ib(){return Array.from(this)}function ob(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],a=0,i=r.length;a<i;++a){var o=r[a];if(o)return o}return null}function sb(){let t=0;for(const n of this)++t;return t}function lb(){return!this.node()}function cb(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var a=n[e],i=0,o=a.length,s;i<o;++i)(s=a[i])&&t.call(s,s.__data__,i,a);return this}function fb(t){return function(){this.removeAttribute(t)}}function ub(t){return function(){this.removeAttributeNS(t.space,t.local)}}function hb(t,n){return function(){this.setAttribute(t,n)}}function db(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function gb(t,n){return function(){var e=n.apply(this,arguments);e==null?this.removeAttribute(t):this.setAttribute(t,e)}}function pb(t,n){return function(){var e=n.apply(this,arguments);e==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function mb(t,n){var e=Fi(t);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((n==null?e.local?ub:fb:typeof n=="function"?e.local?pb:gb:e.local?db:hb)(e,n))}function _f(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function bb(t){return function(){this.style.removeProperty(t)}}function yb(t,n,e){return function(){this.style.setProperty(t,n,e)}}function vb(t,n,e){return function(){var r=n.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function xb(t,n,e){return arguments.length>1?this.each((n==null?bb:typeof n=="function"?vb:yb)(t,n,e??"")):sa(this.node(),t)}function sa(t,n){return t.style.getPropertyValue(n)||_f(t).getComputedStyle(t,null).getPropertyValue(n)}function wb(t){return function(){delete this[t]}}function Ab(t,n){return function(){this[t]=n}}function _b(t,n){return function(){var e=n.apply(this,arguments);e==null?delete this[t]:this[t]=e}}function kb(t,n){return arguments.length>1?this.each((n==null?wb:typeof n=="function"?_b:Ab)(t,n)):this.node()[t]}function kf(t){return t.trim().split(/^|\s+/)}function Ws(t){return t.classList||new Sf(t)}function Sf(t){this._node=t,this._names=kf(t.getAttribute("class")||"")}Sf.prototype={add:function(t){var n=this._names.indexOf(t);n<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function Mf(t,n){for(var e=Ws(t),r=-1,a=n.length;++r<a;)e.add(n[r])}function $f(t,n){for(var e=Ws(t),r=-1,a=n.length;++r<a;)e.remove(n[r])}function Sb(t){return function(){Mf(this,t)}}function Mb(t){return function(){$f(this,t)}}function $b(t,n){return function(){(n.apply(this,arguments)?Mf:$f)(this,t)}}function Lb(t,n){var e=kf(t+"");if(arguments.length<2){for(var r=Ws(this.node()),a=-1,i=e.length;++a<i;)if(!r.contains(e[a]))return!1;return!0}return this.each((typeof n=="function"?$b:n?Sb:Mb)(e,n))}function Cb(){this.textContent=""}function Tb(t){return function(){this.textContent=t}}function Ob(t){return function(){var n=t.apply(this,arguments);this.textContent=n??""}}function Nb(t){return arguments.length?this.each(t==null?Cb:(typeof t=="function"?Ob:Tb)(t)):this.node().textContent}function Eb(){this.innerHTML=""}function Db(t){return function(){this.innerHTML=t}}function Pb(t){return function(){var n=t.apply(this,arguments);this.innerHTML=n??""}}function zb(t){return arguments.length?this.each(t==null?Eb:(typeof t=="function"?Pb:Db)(t)):this.node().innerHTML}function Rb(){this.nextSibling&&this.parentNode.appendChild(this)}function Fb(){return this.each(Rb)}function Yb(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ib(){return this.each(Yb)}function Hb(t){var n=typeof t=="function"?t:yf(t);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function Bb(){return null}function Vb(t,n){var e=typeof t=="function"?t:yf(t),r=n==null?Bb:typeof n=="function"?n:Vs(n);return this.select(function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)})}function Wb(){var t=this.parentNode;t&&t.removeChild(this)}function Gb(){return this.each(Wb)}function qb(){var t=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function Xb(){var t=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function Ub(t){return this.select(t?Xb:qb)}function Zb(t){return arguments.length?this.property("__data__",t):this.node().__data__}function jb(t){return function(n){t.call(this,n,this.__data__)}}function Kb(t){return t.trim().split(/^|\s+/).map(function(n){var e="",r=n.indexOf(".");return r>=0&&(e=n.slice(r+1),n=n.slice(0,r)),{type:n,name:e}})}function Jb(t){return function(){var n=this.__on;if(n){for(var e=0,r=-1,a=n.length,i;e<a;++e)i=n[e],(!t.type||i.type===t.type)&&i.name===t.name?this.removeEventListener(i.type,i.listener,i.options):n[++r]=i;++r?n.length=r:delete this.__on}}}function Qb(t,n,e){return function(){var r=this.__on,a,i=jb(n);if(r){for(var o=0,s=r.length;o<s;++o)if((a=r[o]).type===t.type&&a.name===t.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=i,a.options=e),a.value=n;return}}this.addEventListener(t.type,i,e),a={type:t.type,name:t.name,value:n,listener:i,options:e},r?r.push(a):this.__on=[a]}}function ty(t,n,e){var r=Kb(t+""),a,i=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var l=0,c=s.length,f;l<c;++l)for(a=0,f=s[l];a<i;++a)if((o=r[a]).type===f.type&&o.name===f.name)return f.value}return}for(s=n?Qb:Jb,a=0;a<i;++a)this.each(s(r[a],n,e));return this}function Lf(t,n,e){var r=_f(t),a=r.CustomEvent;typeof a=="function"?a=new a(n,e):(a=r.document.createEvent("Event"),e?(a.initEvent(n,e.bubbles,e.cancelable),a.detail=e.detail):a.initEvent(n,!1,!1)),t.dispatchEvent(a)}function ey(t,n){return function(){return Lf(this,t,n)}}function ny(t,n){return function(){return Lf(this,t,n.apply(this,arguments))}}function ry(t,n){return this.each((typeof n=="function"?ny:ey)(t,n))}function*ay(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],a=0,i=r.length,o;a<i;++a)(o=r[a])&&(yield o)}var Cf=[null];function Qe(t,n){this._groups=t,this._parents=n}function la(){return new Qe([[document.documentElement]],Cf)}function iy(){return this}Qe.prototype=la.prototype={constructor:Qe,select:Om,selectAll:Pm,selectChild:Ym,selectChildren:Vm,filter:Wm,data:jm,enter:Gm,exit:Jm,join:Qm,merge:tb,selection:iy,order:eb,sort:nb,call:ab,nodes:ib,node:ob,size:sb,empty:lb,each:cb,attr:mb,style:xb,property:kb,classed:Lb,text:Nb,html:zb,raise:Fb,lower:Ib,append:Hb,insert:Vb,remove:Gb,clone:Ub,datum:Zb,on:ty,dispatch:ry,[Symbol.iterator]:ay};function ot(t){return typeof t=="string"?new Qe([[document.querySelector(t)]],[document.documentElement]):new Qe([[t]],Cf)}function oy(t){let n;for(;n=t.sourceEvent;)t=n;return t}function sy(t,n){if(t=oy(t),n===void 0&&(n=t.currentTarget),n){var e=n.ownerSVGElement||n;if(e.createSVGPoint){var r=e.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(n.getScreenCTM().inverse()),[r.x,r.y]}if(n.getBoundingClientRect){var a=n.getBoundingClientRect();return[t.clientX-a.left-n.clientLeft,t.clientY-a.top-n.clientTop]}}return[t.pageX,t.pageY]}function Gs(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function Tf(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function Ra(){}var Fa=.7,Ii=1/Fa,ca="\\s*([+-]?\\d+)\\s*",Ya="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Fn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ly=/^#([0-9a-f]{3,8})$/,cy=new RegExp(`^rgb\\(${ca},${ca},${ca}\\)$`),fy=new RegExp(`^rgb\\(${Fn},${Fn},${Fn}\\)$`),uy=new RegExp(`^rgba\\(${ca},${ca},${ca},${Ya}\\)$`),hy=new RegExp(`^rgba\\(${Fn},${Fn},${Fn},${Ya}\\)$`),dy=new RegExp(`^hsl\\(${Ya},${Fn},${Fn}\\)$`),gy=new RegExp(`^hsla\\(${Ya},${Fn},${Fn},${Ya}\\)$`),Of={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Gs(Ra,$r,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Nf,formatHex:Nf,formatHex8:py,formatHsl:my,formatRgb:Ef,toString:Ef});function Nf(){return this.rgb().formatHex()}function py(){return this.rgb().formatHex8()}function my(){return Ff(this).formatHsl()}function Ef(){return this.rgb().formatRgb()}function $r(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=ly.exec(t))?(e=n[1].length,n=parseInt(n[1],16),e===6?Df(n):e===3?new We(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):e===8?Hi(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):e===4?Hi(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=cy.exec(t))?new We(n[1],n[2],n[3],1):(n=fy.exec(t))?new We(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=uy.exec(t))?Hi(n[1],n[2],n[3],n[4]):(n=hy.exec(t))?Hi(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=dy.exec(t))?Rf(n[1],n[2]/100,n[3]/100,1):(n=gy.exec(t))?Rf(n[1],n[2]/100,n[3]/100,n[4]):Of.hasOwnProperty(t)?Df(Of[t]):t==="transparent"?new We(NaN,NaN,NaN,0):null}function Df(t){return new We(t>>16&255,t>>8&255,t&255,1)}function Hi(t,n,e,r){return r<=0&&(t=n=e=NaN),new We(t,n,e,r)}function by(t){return t instanceof Ra||(t=$r(t)),t?(t=t.rgb(),new We(t.r,t.g,t.b,t.opacity)):new We}function qs(t,n,e,r){return arguments.length===1?by(t):new We(t,n,e,r??1)}function We(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}Gs(We,qs,Tf(Ra,{brighter(t){return t=t==null?Ii:Math.pow(Ii,t),new We(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Fa:Math.pow(Fa,t),new We(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new We(Lr(this.r),Lr(this.g),Lr(this.b),Bi(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Pf,formatHex:Pf,formatHex8:yy,formatRgb:zf,toString:zf}));function Pf(){return`#${Cr(this.r)}${Cr(this.g)}${Cr(this.b)}`}function yy(){return`#${Cr(this.r)}${Cr(this.g)}${Cr(this.b)}${Cr((isNaN(this.opacity)?1:this.opacity)*255)}`}function zf(){const t=Bi(this.opacity);return`${t===1?"rgb(":"rgba("}${Lr(this.r)}, ${Lr(this.g)}, ${Lr(this.b)}${t===1?")":`, ${t})`}`}function Bi(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Lr(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Cr(t){return t=Lr(t),(t<16?"0":"")+t.toString(16)}function Rf(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new Mn(t,n,e,r)}function Ff(t){if(t instanceof Mn)return new Mn(t.h,t.s,t.l,t.opacity);if(t instanceof Ra||(t=$r(t)),!t)return new Mn;if(t instanceof Mn)return t;t=t.rgb();var n=t.r/255,e=t.g/255,r=t.b/255,a=Math.min(n,e,r),i=Math.max(n,e,r),o=NaN,s=i-a,l=(i+a)/2;return s?(n===i?o=(e-r)/s+(e<r)*6:e===i?o=(r-n)/s+2:o=(n-e)/s+4,s/=l<.5?i+a:2-i-a,o*=60):s=l>0&&l<1?0:o,new Mn(o,s,l,t.opacity)}function vy(t,n,e,r){return arguments.length===1?Ff(t):new Mn(t,n,e,r??1)}function Mn(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}Gs(Mn,vy,Tf(Ra,{brighter(t){return t=t==null?Ii:Math.pow(Ii,t),new Mn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Fa:Math.pow(Fa,t),new Mn(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,a=2*e-r;return new We(Xs(t>=240?t-240:t+120,a,r),Xs(t,a,r),Xs(t<120?t+240:t-120,a,r),this.opacity)},clamp(){return new Mn(Yf(this.h),Vi(this.s),Vi(this.l),Bi(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Bi(this.opacity);return`${t===1?"hsl(":"hsla("}${Yf(this.h)}, ${Vi(this.s)*100}%, ${Vi(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Yf(t){return t=(t||0)%360,t<0?t+360:t}function Vi(t){return Math.max(0,Math.min(1,t||0))}function Xs(t,n,e){return(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)*255}const Us=t=>()=>t;function xy(t,n){return function(e){return t+e*n}}function wy(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}function Ay(t){return(t=+t)==1?If:function(n,e){return e-n?wy(n,e,t):Us(isNaN(n)?e:n)}}function If(t,n){var e=n-t;return e?xy(t,e):Us(isNaN(t)?n:t)}const Wi=(function t(n){var e=Ay(n);function r(a,i){var o=e((a=qs(a)).r,(i=qs(i)).r),s=e(a.g,i.g),l=e(a.b,i.b),c=If(a.opacity,i.opacity);return function(f){return a.r=o(f),a.g=s(f),a.b=l(f),a.opacity=c(f),a+""}}return r.gamma=t,r})(1);function _y(t,n){n||(n=[]);var e=t?Math.min(n.length,t.length):0,r=n.slice(),a;return function(i){for(a=0;a<e;++a)r[a]=t[a]*(1-i)+n[a]*i;return r}}function ky(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Sy(t,n){var e=n?n.length:0,r=t?Math.min(e,t.length):0,a=new Array(r),i=new Array(e),o;for(o=0;o<r;++o)a[o]=Ks(t[o],n[o]);for(;o<e;++o)i[o]=n[o];return function(s){for(o=0;o<r;++o)i[o]=a[o](s);return i}}function My(t,n){var e=new Date;return t=+t,n=+n,function(r){return e.setTime(t*(1-r)+n*r),e}}function De(t,n){return t=+t,n=+n,function(e){return t*(1-e)+n*e}}function Ia(t,n){var e={},r={},a;(t===null||typeof t!="object")&&(t={}),(n===null||typeof n!="object")&&(n={});for(a in n)a in t?e[a]=Ks(t[a],n[a]):r[a]=n[a];return function(i){for(a in e)r[a]=e[a](i);return r}}var Zs=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,js=new RegExp(Zs.source,"g");function $y(t){return function(){return t}}function Ly(t){return function(n){return t(n)+""}}function Hf(t,n){var e=Zs.lastIndex=js.lastIndex=0,r,a,i,o=-1,s=[],l=[];for(t=t+"",n=n+"";(r=Zs.exec(t))&&(a=js.exec(n));)(i=a.index)>e&&(i=n.slice(e,i),s[o]?s[o]+=i:s[++o]=i),(r=r[0])===(a=a[0])?s[o]?s[o]+=a:s[++o]=a:(s[++o]=null,l.push({i:o,x:De(r,a)})),e=js.lastIndex;return e<n.length&&(i=n.slice(e),s[o]?s[o]+=i:s[++o]=i),s.length<2?l[0]?Ly(l[0].x):$y(n):(n=l.length,function(c){for(var f=0,h;f<n;++f)s[(h=l[f]).i]=h.x(c);return s.join("")})}function Ks(t,n){var e=typeof n,r;return n==null||e==="boolean"?Us(n):(e==="number"?De:e==="string"?(r=$r(n))?(n=r,Wi):Hf:n instanceof $r?Wi:n instanceof Date?My:ky(n)?_y:Array.isArray(n)?Sy:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?Ia:De)(t,n)}function Cy(t,n){return t=+t,n=+n,function(e){return Math.round(t*(1-e)+n*e)}}var Bf=180/Math.PI,Js={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Vf(t,n,e,r,a,i){var o,s,l;return(o=Math.sqrt(t*t+n*n))&&(t/=o,n/=o),(l=t*e+n*r)&&(e-=t*l,r-=n*l),(s=Math.sqrt(e*e+r*r))&&(e/=s,r/=s,l/=s),t*r<n*e&&(t=-t,n=-n,l=-l,o=-o),{translateX:a,translateY:i,rotate:Math.atan2(n,t)*Bf,skewX:Math.atan(l)*Bf,scaleX:o,scaleY:s}}var Gi;function Ty(t){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return n.isIdentity?Js:Vf(n.a,n.b,n.c,n.d,n.e,n.f)}function Oy(t){return t==null||(Gi||(Gi=document.createElementNS("http://www.w3.org/2000/svg","g")),Gi.setAttribute("transform",t),!(t=Gi.transform.baseVal.consolidate()))?Js:(t=t.matrix,Vf(t.a,t.b,t.c,t.d,t.e,t.f))}function Wf(t,n,e,r){function a(c){return c.length?c.pop()+" ":""}function i(c,f,h,d,g,v){if(c!==h||f!==d){var m=g.push("translate(",null,n,null,e);v.push({i:m-4,x:De(c,h)},{i:m-2,x:De(f,d)})}else(h||d)&&g.push("translate("+h+n+d+e)}function o(c,f,h,d){c!==f?(c-f>180?f+=360:f-c>180&&(c+=360),d.push({i:h.push(a(h)+"rotate(",null,r)-2,x:De(c,f)})):f&&h.push(a(h)+"rotate("+f+r)}function s(c,f,h,d){c!==f?d.push({i:h.push(a(h)+"skewX(",null,r)-2,x:De(c,f)}):f&&h.push(a(h)+"skewX("+f+r)}function l(c,f,h,d,g,v){if(c!==h||f!==d){var m=g.push(a(g)+"scale(",null,",",null,")");v.push({i:m-4,x:De(c,h)},{i:m-2,x:De(f,d)})}else(h!==1||d!==1)&&g.push(a(g)+"scale("+h+","+d+")")}return function(c,f){var h=[],d=[];return c=t(c),f=t(f),i(c.translateX,c.translateY,f.translateX,f.translateY,h,d),o(c.rotate,f.rotate,h,d),s(c.skewX,f.skewX,h,d),l(c.scaleX,c.scaleY,f.scaleX,f.scaleY,h,d),c=f=null,function(g){for(var v=-1,m=d.length,b;++v<m;)h[(b=d[v]).i]=b.x(g);return h.join("")}}}var Ny=Wf(Ty,"px, ","px)","deg)"),Ey=Wf(Oy,", ",")",")"),fa=0,Ha=0,Ba=0,Gf=1e3,qi,Va,Xi=0,Tr=0,Ui=0,Wa=typeof performance=="object"&&performance.now?performance:Date,qf=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Qs(){return Tr||(qf(Dy),Tr=Wa.now()+Ui)}function Dy(){Tr=0}function Zi(){this._call=this._time=this._next=null}Zi.prototype=Xf.prototype={constructor:Zi,restart:function(t,n,e){if(typeof t!="function")throw new TypeError("callback is not a function");e=(e==null?Qs():+e)+(n==null?0:+n),!this._next&&Va!==this&&(Va?Va._next=this:qi=this,Va=this),this._call=t,this._time=e,tl()},stop:function(){this._call&&(this._call=null,this._time=1/0,tl())}};function Xf(t,n,e){var r=new Zi;return r.restart(t,n,e),r}function Py(){Qs(),++fa;for(var t=qi,n;t;)(n=Tr-t._time)>=0&&t._call.call(void 0,n),t=t._next;--fa}function Uf(){Tr=(Xi=Wa.now())+Ui,fa=Ha=0;try{Py()}finally{fa=0,Ry(),Tr=0}}function zy(){var t=Wa.now(),n=t-Xi;n>Gf&&(Ui-=n,Xi=t)}function Ry(){for(var t,n=qi,e,r=1/0;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:qi=e);Va=t,tl(r)}function tl(t){if(!fa){Ha&&(Ha=clearTimeout(Ha));var n=t-Tr;n>24?(t<1/0&&(Ha=setTimeout(Uf,t-Wa.now()-Ui)),Ba&&(Ba=clearInterval(Ba))):(Ba||(Xi=Wa.now(),Ba=setInterval(zy,Gf)),fa=1,qf(Uf))}}function Zf(t,n,e){var r=new Zi;return n=n==null?0:+n,r.restart(a=>{r.stop(),t(a+n)},n,e),r}var Fy=Hs("start","end","cancel","interrupt"),Yy=[],jf=0,Kf=1,el=2,ji=3,Jf=4,nl=5,Ki=6;function Ji(t,n,e,r,a,i){var o=t.__transition;if(!o)t.__transition={};else if(e in o)return;Iy(t,e,{name:n,index:r,group:a,on:Fy,tween:Yy,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:jf})}function rl(t,n){var e=$n(t,n);if(e.state>jf)throw new Error("too late; already scheduled");return e}function Yn(t,n){var e=$n(t,n);if(e.state>ji)throw new Error("too late; already running");return e}function $n(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}function Iy(t,n,e){var r=t.__transition,a;r[n]=e,e.timer=Xf(i,0,e.time);function i(c){e.state=Kf,e.timer.restart(o,e.delay,e.time),e.delay<=c&&o(c-e.delay)}function o(c){var f,h,d,g;if(e.state!==Kf)return l();for(f in r)if(g=r[f],g.name===e.name){if(g.state===ji)return Zf(o);g.state===Jf?(g.state=Ki,g.timer.stop(),g.on.call("interrupt",t,t.__data__,g.index,g.group),delete r[f]):+f<n&&(g.state=Ki,g.timer.stop(),g.on.call("cancel",t,t.__data__,g.index,g.group),delete r[f])}if(Zf(function(){e.state===ji&&(e.state=Jf,e.timer.restart(s,e.delay,e.time),s(c))}),e.state=el,e.on.call("start",t,t.__data__,e.index,e.group),e.state===el){for(e.state=ji,a=new Array(d=e.tween.length),f=0,h=-1;f<d;++f)(g=e.tween[f].value.call(t,t.__data__,e.index,e.group))&&(a[++h]=g);a.length=h+1}}function s(c){for(var f=c<e.duration?e.ease.call(null,c/e.duration):(e.timer.restart(l),e.state=nl,1),h=-1,d=a.length;++h<d;)a[h].call(t,f);e.state===nl&&(e.on.call("end",t,t.__data__,e.index,e.group),l())}function l(){e.state=Ki,e.timer.stop(),delete r[n];for(var c in r)return;delete t.__transition}}function Hy(t,n){var e=t.__transition,r,a,i=!0,o;if(e){n=n==null?null:n+"";for(o in e){if((r=e[o]).name!==n){i=!1;continue}a=r.state>el&&r.state<nl,r.state=Ki,r.timer.stop(),r.on.call(a?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete e[o]}i&&delete t.__transition}}function By(t){return this.each(function(){Hy(this,t)})}function Vy(t,n){var e,r;return function(){var a=Yn(this,t),i=a.tween;if(i!==e){r=e=i;for(var o=0,s=r.length;o<s;++o)if(r[o].name===n){r=r.slice(),r.splice(o,1);break}}a.tween=r}}function Wy(t,n,e){var r,a;if(typeof e!="function")throw new Error;return function(){var i=Yn(this,t),o=i.tween;if(o!==r){a=(r=o).slice();for(var s={name:n,value:e},l=0,c=a.length;l<c;++l)if(a[l].name===n){a[l]=s;break}l===c&&a.push(s)}i.tween=a}}function Gy(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r=$n(this.node(),e).tween,a=0,i=r.length,o;a<i;++a)if((o=r[a]).name===t)return o.value;return null}return this.each((n==null?Vy:Wy)(e,t,n))}function al(t,n,e){var r=t._id;return t.each(function(){var a=Yn(this,r);(a.value||(a.value={}))[n]=e.apply(this,arguments)}),function(a){return $n(a,r).value[n]}}function Qf(t,n){var e;return(typeof n=="number"?De:n instanceof $r?Wi:(e=$r(n))?(n=e,Wi):Hf)(t,n)}function qy(t){return function(){this.removeAttribute(t)}}function Xy(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Uy(t,n,e){var r,a=e+"",i;return function(){var o=this.getAttribute(t);return o===a?null:o===r?i:i=n(r=o,e)}}function Zy(t,n,e){var r,a=e+"",i;return function(){var o=this.getAttributeNS(t.space,t.local);return o===a?null:o===r?i:i=n(r=o,e)}}function jy(t,n,e){var r,a,i;return function(){var o,s=e(this),l;return s==null?void this.removeAttribute(t):(o=this.getAttribute(t),l=s+"",o===l?null:o===r&&l===a?i:(a=l,i=n(r=o,s)))}}function Ky(t,n,e){var r,a,i;return function(){var o,s=e(this),l;return s==null?void this.removeAttributeNS(t.space,t.local):(o=this.getAttributeNS(t.space,t.local),l=s+"",o===l?null:o===r&&l===a?i:(a=l,i=n(r=o,s)))}}function Jy(t,n){var e=Fi(t),r=e==="transform"?Ey:Qf;return this.attrTween(t,typeof n=="function"?(e.local?Ky:jy)(e,r,al(this,"attr."+t,n)):n==null?(e.local?Xy:qy)(e):(e.local?Zy:Uy)(e,r,n))}function Qy(t,n){return function(e){this.setAttribute(t,n.call(this,e))}}function t1(t,n){return function(e){this.setAttributeNS(t.space,t.local,n.call(this,e))}}function e1(t,n){var e,r;function a(){var i=n.apply(this,arguments);return i!==r&&(e=(r=i)&&t1(t,i)),e}return a._value=n,a}function n1(t,n){var e,r;function a(){var i=n.apply(this,arguments);return i!==r&&(e=(r=i)&&Qy(t,i)),e}return a._value=n,a}function r1(t,n){var e="attr."+t;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(n==null)return this.tween(e,null);if(typeof n!="function")throw new Error;var r=Fi(t);return this.tween(e,(r.local?e1:n1)(r,n))}function a1(t,n){return function(){rl(this,t).delay=+n.apply(this,arguments)}}function i1(t,n){return n=+n,function(){rl(this,t).delay=n}}function o1(t){var n=this._id;return arguments.length?this.each((typeof t=="function"?a1:i1)(n,t)):$n(this.node(),n).delay}function s1(t,n){return function(){Yn(this,t).duration=+n.apply(this,arguments)}}function l1(t,n){return n=+n,function(){Yn(this,t).duration=n}}function c1(t){var n=this._id;return arguments.length?this.each((typeof t=="function"?s1:l1)(n,t)):$n(this.node(),n).duration}function f1(t,n){if(typeof n!="function")throw new Error;return function(){Yn(this,t).ease=n}}function u1(t){var n=this._id;return arguments.length?this.each(f1(n,t)):$n(this.node(),n).ease}function h1(t,n){return function(){var e=n.apply(this,arguments);if(typeof e!="function")throw new Error;Yn(this,t).ease=e}}function d1(t){if(typeof t!="function")throw new Error;return this.each(h1(this._id,t))}function g1(t){typeof t!="function"&&(t=xf(t));for(var n=this._groups,e=n.length,r=new Array(e),a=0;a<e;++a)for(var i=n[a],o=i.length,s=r[a]=[],l,c=0;c<o;++c)(l=i[c])&&t.call(l,l.__data__,c,i)&&s.push(l);return new jn(r,this._parents,this._name,this._id)}function p1(t){if(t._id!==this._id)throw new Error;for(var n=this._groups,e=t._groups,r=n.length,a=e.length,i=Math.min(r,a),o=new Array(r),s=0;s<i;++s)for(var l=n[s],c=e[s],f=l.length,h=o[s]=new Array(f),d,g=0;g<f;++g)(d=l[g]||c[g])&&(h[g]=d);for(;s<r;++s)o[s]=n[s];return new jn(o,this._parents,this._name,this._id)}function m1(t){return(t+"").trim().split(/^|\s+/).every(function(n){var e=n.indexOf(".");return e>=0&&(n=n.slice(0,e)),!n||n==="start"})}function b1(t,n,e){var r,a,i=m1(n)?rl:Yn;return function(){var o=i(this,t),s=o.on;s!==r&&(a=(r=s).copy()).on(n,e),o.on=a}}function y1(t,n){var e=this._id;return arguments.length<2?$n(this.node(),e).on.on(t):this.each(b1(e,t,n))}function v1(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}function x1(){return this.on("end.remove",v1(this._id))}function w1(t){var n=this._name,e=this._id;typeof t!="function"&&(t=Vs(t));for(var r=this._groups,a=r.length,i=new Array(a),o=0;o<a;++o)for(var s=r[o],l=s.length,c=i[o]=new Array(l),f,h,d=0;d<l;++d)(f=s[d])&&(h=t.call(f,f.__data__,d,s))&&("__data__"in f&&(h.__data__=f.__data__),c[d]=h,Ji(c[d],n,e,d,c,$n(f,e)));return new jn(i,this._parents,n,e)}function A1(t){var n=this._name,e=this._id;typeof t!="function"&&(t=vf(t));for(var r=this._groups,a=r.length,i=[],o=[],s=0;s<a;++s)for(var l=r[s],c=l.length,f,h=0;h<c;++h)if(f=l[h]){for(var d=t.call(f,f.__data__,h,l),g,v=$n(f,e),m=0,b=d.length;m<b;++m)(g=d[m])&&Ji(g,n,e,m,d,v);i.push(d),o.push(f)}return new jn(i,o,n,e)}var _1=la.prototype.constructor;function k1(){return new _1(this._groups,this._parents)}function S1(t,n){var e,r,a;return function(){var i=sa(this,t),o=(this.style.removeProperty(t),sa(this,t));return i===o?null:i===e&&o===r?a:a=n(e=i,r=o)}}function tu(t){return function(){this.style.removeProperty(t)}}function M1(t,n,e){var r,a=e+"",i;return function(){var o=sa(this,t);return o===a?null:o===r?i:i=n(r=o,e)}}function $1(t,n,e){var r,a,i;return function(){var o=sa(this,t),s=e(this),l=s+"";return s==null&&(l=s=(this.style.removeProperty(t),sa(this,t))),o===l?null:o===r&&l===a?i:(a=l,i=n(r=o,s))}}function L1(t,n){var e,r,a,i="style."+n,o="end."+i,s;return function(){var l=Yn(this,t),c=l.on,f=l.value[i]==null?s||(s=tu(n)):void 0;(c!==e||a!==f)&&(r=(e=c).copy()).on(o,a=f),l.on=r}}function C1(t,n,e){var r=(t+="")=="transform"?Ny:Qf;return n==null?this.styleTween(t,S1(t,r)).on("end.style."+t,tu(t)):typeof n=="function"?this.styleTween(t,$1(t,r,al(this,"style."+t,n))).each(L1(this._id,t)):this.styleTween(t,M1(t,r,n),e).on("end.style."+t,null)}function T1(t,n,e){return function(r){this.style.setProperty(t,n.call(this,r),e)}}function O1(t,n,e){var r,a;function i(){var o=n.apply(this,arguments);return o!==a&&(r=(a=o)&&T1(t,o,e)),r}return i._value=n,i}function N1(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(n==null)return this.tween(r,null);if(typeof n!="function")throw new Error;return this.tween(r,O1(t,n,e??""))}function E1(t){return function(){this.textContent=t}}function D1(t){return function(){var n=t(this);this.textContent=n??""}}function P1(t){return this.tween("text",typeof t=="function"?D1(al(this,"text",t)):E1(t==null?"":t+""))}function z1(t){return function(n){this.textContent=t.call(this,n)}}function R1(t){var n,e;function r(){var a=t.apply(this,arguments);return a!==e&&(n=(e=a)&&z1(a)),n}return r._value=t,r}function F1(t){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;return this.tween(n,R1(t))}function Y1(){for(var t=this._name,n=this._id,e=nu(),r=this._groups,a=r.length,i=0;i<a;++i)for(var o=r[i],s=o.length,l,c=0;c<s;++c)if(l=o[c]){var f=$n(l,n);Ji(l,t,e,c,o,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new jn(r,this._parents,t,e)}function I1(){var t,n,e=this,r=e._id,a=e.size();return new Promise(function(i,o){var s={value:o},l={value:function(){--a===0&&i()}};e.each(function(){var c=Yn(this,r),f=c.on;f!==t&&(n=(t=f).copy(),n._.cancel.push(s),n._.interrupt.push(s),n._.end.push(l)),c.on=n}),a===0&&i()})}var H1=0;function jn(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function eu(t){return la().transition(t)}function nu(){return++H1}var Kn=la.prototype;jn.prototype=eu.prototype={constructor:jn,select:w1,selectAll:A1,selectChild:Kn.selectChild,selectChildren:Kn.selectChildren,filter:g1,merge:p1,selection:k1,transition:Y1,call:Kn.call,nodes:Kn.nodes,node:Kn.node,size:Kn.size,empty:Kn.empty,each:Kn.each,on:y1,attr:Jy,attrTween:r1,style:C1,styleTween:N1,text:P1,textTween:F1,remove:x1,tween:Gy,delay:o1,duration:c1,ease:u1,easeVarying:d1,end:I1,[Symbol.iterator]:Kn[Symbol.iterator]};function Qi(t){return--t*t*t+1}function to(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var B1={time:null,delay:0,duration:250,ease:to};function V1(t,n){for(var e;!(e=t.__transition)||!(e=e[n]);)if(!(t=t.parentNode))throw new Error(`transition ${n} not found`);return e}function W1(t){var n,e;t instanceof jn?(n=t._id,t=t._name):(n=nu(),(e=B1).time=Qs(),t=t==null?null:t+"");for(var r=this._groups,a=r.length,i=0;i<a;++i)for(var o=r[i],s=o.length,l,c=0;c<s;++c)(l=o[c])&&Ji(l,t,n,c,o,e||V1(l,n));return new jn(r,this._parents,t,n)}la.prototype.interrupt=By,la.prototype.transition=W1;const il=Math.PI,ol=2*il,Or=1e-6,G1=ol-Or;function ru(t){this._+=t[0];for(let n=1,e=t.length;n<e;++n)this._+=arguments[n]+t[n]}function q1(t){let n=Math.floor(t);if(!(n>=0))throw new Error(`invalid digits: ${t}`);if(n>15)return ru;const e=10**n;return function(r){this._+=r[0];for(let a=1,i=r.length;a<i;++a)this._+=Math.round(arguments[a]*e)/e+r[a]}}class X1{constructor(n){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=n==null?ru:q1(n)}moveTo(n,e){this._append`M${this._x0=this._x1=+n},${this._y0=this._y1=+e}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(n,e){this._append`L${this._x1=+n},${this._y1=+e}`}quadraticCurveTo(n,e,r,a){this._append`Q${+n},${+e},${this._x1=+r},${this._y1=+a}`}bezierCurveTo(n,e,r,a,i,o){this._append`C${+n},${+e},${+r},${+a},${this._x1=+i},${this._y1=+o}`}arcTo(n,e,r,a,i){if(n=+n,e=+e,r=+r,a=+a,i=+i,i<0)throw new Error(`negative radius: ${i}`);let o=this._x1,s=this._y1,l=r-n,c=a-e,f=o-n,h=s-e,d=f*f+h*h;if(this._x1===null)this._append`M${this._x1=n},${this._y1=e}`;else if(d>Or)if(!(Math.abs(h*l-c*f)>Or)||!i)this._append`L${this._x1=n},${this._y1=e}`;else{let g=r-o,v=a-s,m=l*l+c*c,b=g*g+v*v,x=Math.sqrt(m),A=Math.sqrt(d),w=i*Math.tan((il-Math.acos((m+d-b)/(2*x*A)))/2),S=w/A,z=w/x;Math.abs(S-1)>Or&&this._append`L${n+S*f},${e+S*h}`,this._append`A${i},${i},0,0,${+(h*g>f*v)},${this._x1=n+z*l},${this._y1=e+z*c}`}}arc(n,e,r,a,i,o){if(n=+n,e=+e,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let s=r*Math.cos(a),l=r*Math.sin(a),c=n+s,f=e+l,h=1^o,d=o?a-i:i-a;this._x1===null?this._append`M${c},${f}`:(Math.abs(this._x1-c)>Or||Math.abs(this._y1-f)>Or)&&this._append`L${c},${f}`,r&&(d<0&&(d=d%ol+ol),d>G1?this._append`A${r},${r},0,1,${h},${n-s},${e-l}A${r},${r},0,1,${h},${this._x1=c},${this._y1=f}`:d>Or&&this._append`A${r},${r},0,${+(d>=il)},${h},${this._x1=n+r*Math.cos(i)},${this._y1=e+r*Math.sin(i)}`)}rect(n,e,r,a){this._append`M${this._x0=this._x1=+n},${this._y0=this._y1=+e}h${r=+r}v${+a}h${-r}Z`}toString(){return this._}}function U1(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function eo(t,n){if(!isFinite(t)||t===0)return null;var e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"),r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}function ua(t){return t=eo(Math.abs(t)),t?t[1]:NaN}function Z1(t,n){return function(e,r){for(var a=e.length,i=[],o=0,s=t[0],l=0;a>0&&s>0&&(l+s+1>r&&(s=Math.max(1,r-l)),i.push(e.substring(a-=s,a+s)),!((l+=s+1)>r));)s=t[o=(o+1)%t.length];return i.reverse().join(n)}}function j1(t){return function(n){return n.replace(/[0-9]/g,function(e){return t[+e]})}}var K1=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function no(t){if(!(n=K1.exec(t)))throw new Error("invalid format: "+t);var n;return new sl({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}no.prototype=sl.prototype;function sl(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}sl.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function J1(t){t:for(var n=t.length,e=1,r=-1,a;e<n;++e)switch(t[e]){case".":r=a=e;break;case"0":r===0&&(r=e),a=e;break;default:if(!+t[e])break t;r>0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(a+1):t}var ro;function Q1(t,n){var e=eo(t,n);if(!e)return ro=void 0,t.toPrecision(n);var r=e[0],a=e[1],i=a-(ro=Math.max(-8,Math.min(8,Math.floor(a/3)))*3)+1,o=r.length;return i===o?r:i>o?r+new Array(i-o+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+eo(t,Math.max(0,n+i-1))[0]}function au(t,n){var e=eo(t,n);if(!e)return t+"";var r=e[0],a=e[1];return a<0?"0."+new Array(-a).join("0")+r:r.length>a+1?r.slice(0,a+1)+"."+r.slice(a+1):r+new Array(a-r.length+2).join("0")}const iu={"%":(t,n)=>(t*100).toFixed(n),b:t=>Math.round(t).toString(2),c:t=>t+"",d:U1,e:(t,n)=>t.toExponential(n),f:(t,n)=>t.toFixed(n),g:(t,n)=>t.toPrecision(n),o:t=>Math.round(t).toString(8),p:(t,n)=>au(t*100,n),r:au,s:Q1,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function ou(t){return t}var su=Array.prototype.map,lu=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function tv(t){var n=t.grouping===void 0||t.thousands===void 0?ou:Z1(su.call(t.grouping,Number),t.thousands+""),e=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",a=t.decimal===void 0?".":t.decimal+"",i=t.numerals===void 0?ou:j1(su.call(t.numerals,String)),o=t.percent===void 0?"%":t.percent+"",s=t.minus===void 0?"−":t.minus+"",l=t.nan===void 0?"NaN":t.nan+"";function c(h,d){h=no(h);var g=h.fill,v=h.align,m=h.sign,b=h.symbol,x=h.zero,A=h.width,w=h.comma,S=h.precision,z=h.trim,Y=h.type;Y==="n"?(w=!0,Y="g"):iu[Y]||(S===void 0&&(S=12),z=!0,Y="g"),(x||g==="0"&&v==="=")&&(x=!0,g="0",v="=");var G=(d&&d.prefix!==void 0?d.prefix:"")+(b==="$"?e:b==="#"&&/[boxX]/.test(Y)?"0"+Y.toLowerCase():""),_=(b==="$"?r:/[%p]/.test(Y)?o:"")+(d&&d.suffix!==void 0?d.suffix:""),B=iu[Y],P=/[defgprs%]/.test(Y);S=S===void 0?6:/[gprs]/.test(Y)?Math.max(1,Math.min(21,S)):Math.max(0,Math.min(20,S));function $(N){var L=G,M=_,D,q,V;if(Y==="c")M=B(N)+M,N="";else{N=+N;var C=N<0||1/N<0;if(N=isNaN(N)?l:B(Math.abs(N),S),z&&(N=J1(N)),C&&+N==0&&m!=="+"&&(C=!1),L=(C?m==="("?m:s:m==="-"||m==="("?"":m)+L,M=(Y==="s"&&!isNaN(N)&&ro!==void 0?lu[8+ro/3]:"")+M+(C&&m==="("?")":""),P){for(D=-1,q=N.length;++D<q;)if(V=N.charCodeAt(D),48>V||V>57){M=(V===46?a+N.slice(D+1):N.slice(D))+M,N=N.slice(0,D);break}}}w&&!x&&(N=n(N,1/0));var I=L.length+N.length+M.length,W=I<A?new Array(A-I+1).join(g):"";switch(w&&x&&(N=n(W+N,W.length?A-M.length:1/0),W=""),v){case"<":N=L+N+M+W;break;case"=":N=L+W+N+M;break;case"^":N=W.slice(0,I=W.length>>1)+L+N+M+W.slice(I);break;default:N=W+L+N+M;break}return i(N)}return $.toString=function(){return h+""},$}function f(h,d){var g=Math.max(-8,Math.min(8,Math.floor(ua(d)/3)))*3,v=Math.pow(10,-g),m=c((h=no(h),h.type="f",h),{suffix:lu[8+g/3]});return function(b){return m(v*b)}}return{format:c,formatPrefix:f}}var ao,io,cu;ev({thousands:",",grouping:[3],currency:["$",""]});function ev(t){return ao=tv(t),io=ao.format,cu=ao.formatPrefix,ao}function nv(t){return Math.max(0,-ua(Math.abs(t)))}function rv(t,n){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ua(n)/3)))*3-ua(Math.abs(t)))}function av(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,ua(n)-ua(t))+1}function oo(t,n){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(n).domain(t);break}return this}const fu=Symbol("implicit");function ll(){var t=new Fs,n=[],e=[],r=fu;function a(i){let o=t.get(i);if(o===void 0){if(r!==fu)return r;t.set(i,o=n.push(i)-1)}return e[o%e.length]}return a.domain=function(i){if(!arguments.length)return n.slice();n=[],t=new Fs;for(const o of i)t.has(o)||t.set(o,n.push(o)-1);return a},a.range=function(i){return arguments.length?(e=Array.from(i),a):e.slice()},a.unknown=function(i){return arguments.length?(r=i,a):r},a.copy=function(){return ll(n,e).unknown(r)},oo.apply(a,arguments),a}function tn(){var t=ll().unknown(void 0),n=t.domain,e=t.range,r=0,a=1,i,o,s=!1,l=0,c=0,f=.5;delete t.unknown;function h(){var d=n().length,g=a<r,v=g?a:r,m=g?r:a;i=(m-v)/Math.max(1,d-l+c*2),s&&(i=Math.floor(i)),v+=(m-v-i*(d-l))*f,o=i*(1-l),s&&(v=Math.round(v),o=Math.round(o));var b=mm(d).map(function(x){return v+i*x});return e(g?b.reverse():b)}return t.domain=function(d){return arguments.length?(n(d),h()):n()},t.range=function(d){return arguments.length?([r,a]=d,r=+r,a=+a,h()):[r,a]},t.rangeRound=function(d){return[r,a]=d,r=+r,a=+a,s=!0,h()},t.bandwidth=function(){return o},t.step=function(){return i},t.round=function(d){return arguments.length?(s=!!d,h()):s},t.padding=function(d){return arguments.length?(l=Math.min(1,c=+d),h()):l},t.paddingInner=function(d){return arguments.length?(l=Math.min(1,d),h()):l},t.paddingOuter=function(d){return arguments.length?(c=+d,h()):c},t.align=function(d){return arguments.length?(f=Math.max(0,Math.min(1,d)),h()):f},t.copy=function(){return tn(n(),[r,a]).round(s).paddingInner(l).paddingOuter(c).align(f)},oo.apply(h(),arguments)}function uu(t){var n=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return uu(n())},t}function so(){return uu(tn.apply(null,arguments).paddingInner(1))}function iv(t){return function(){return t}}function ov(t){return+t}var hu=[0,1];function ha(t){return t}function cl(t,n){return(n-=t=+t)?function(e){return(e-t)/n}:iv(isNaN(n)?NaN:.5)}function sv(t,n){var e;return t>n&&(e=t,t=n,n=e),function(r){return Math.max(t,Math.min(n,r))}}function lv(t,n,e){var r=t[0],a=t[1],i=n[0],o=n[1];return a<r?(r=cl(a,r),i=e(o,i)):(r=cl(r,a),i=e(i,o)),function(s){return i(r(s))}}function cv(t,n,e){var r=Math.min(t.length,n.length)-1,a=new Array(r),i=new Array(r),o=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),n=n.slice().reverse());++o<r;)a[o]=cl(t[o],t[o+1]),i[o]=e(n[o],n[o+1]);return function(s){var l=am(t,s,1,r)-1;return i[l](a[l](s))}}function du(t,n){return n.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function gu(){var t=hu,n=hu,e=Ks,r,a,i,o=ha,s,l,c;function f(){var d=Math.min(t.length,n.length);return o!==ha&&(o=sv(t[0],t[d-1])),s=d>2?cv:lv,l=c=null,h}function h(d){return d==null||isNaN(d=+d)?i:(l||(l=s(t.map(r),n,e)))(r(o(d)))}return h.invert=function(d){return o(a((c||(c=s(n,t.map(r),De)))(d)))},h.domain=function(d){return arguments.length?(t=Array.from(d,ov),f()):t.slice()},h.range=function(d){return arguments.length?(n=Array.from(d),f()):n.slice()},h.rangeRound=function(d){return n=Array.from(d),e=Cy,f()},h.clamp=function(d){return arguments.length?(o=d?!0:ha,f()):o!==ha},h.interpolate=function(d){return arguments.length?(e=d,f()):e},h.unknown=function(d){return arguments.length?(i=d,h):i},function(d,g){return r=d,a=g,f()}}function fv(){return gu()(ha,ha)}function uv(t,n,e,r){var a=pm(t,n,e),i;switch(r=no(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(t),Math.abs(n));return r.precision==null&&!isNaN(i=rv(a,o))&&(r.precision=i),cu(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(i=av(a,Math.max(Math.abs(t),Math.abs(n))))&&(r.precision=i-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(i=nv(a))&&(r.precision=i-(r.type==="%")*2);break}}return io(r)}function pu(t){var n=t.domain;return t.ticks=function(e){var r=n();return gm(r[0],r[r.length-1],e??10)},t.tickFormat=function(e,r){var a=n();return uv(a[0],a[a.length-1],e??10,r)},t.nice=function(e){e==null&&(e=10);var r=n(),a=0,i=r.length-1,o=r[a],s=r[i],l,c,f=10;for(s<o&&(c=o,o=s,s=c,c=a,a=i,i=c);f-- >0;){if(c=Ys(o,s,e),c===l)return r[a]=o,r[i]=s,n(r);if(c>0)o=Math.floor(o/c)*c,s=Math.ceil(s/c)*c;else if(c<0)o=Math.ceil(o*c)/c,s=Math.floor(s*c)/c;else break;l=c}return t},t}function Pe(){var t=fv();return t.copy=function(){return du(t,Pe())},oo.apply(t,arguments),pu(t)}function mu(t){return function(n){return Math.sign(n)*Math.log1p(Math.abs(n/t))}}function bu(t){return function(n){return Math.sign(n)*Math.expm1(Math.abs(n))*t}}function hv(t){var n=1,e=t(mu(n),bu(n));return e.constant=function(r){return arguments.length?t(mu(n=+r),bu(n)):n},pu(e)}function cr(){var t=hv(gu());return t.copy=function(){return du(t,cr()).constant(t.constant())},oo.apply(t,arguments)}const fl=new Date,ul=new Date;function In(t,n,e,r){function a(i){return t(i=arguments.length===0?new Date:new Date(+i)),i}return a.floor=i=>(t(i=new Date(+i)),i),a.ceil=i=>(t(i=new Date(i-1)),n(i,1),t(i),i),a.round=i=>{const o=a(i),s=a.ceil(i);return i-o<s-i?o:s},a.offset=(i,o)=>(n(i=new Date(+i),o==null?1:Math.floor(o)),i),a.range=(i,o,s)=>{const l=[];if(i=a.ceil(i),s=s==null?1:Math.floor(s),!(i<o)||!(s>0))return l;let c;do l.push(c=new Date(+i)),n(i,s),t(i);while(c<i&&i<o);return l},a.filter=i=>In(o=>{if(o>=o)for(;t(o),!i(o);)o.setTime(o-1)},(o,s)=>{if(o>=o)if(s<0)for(;++s<=0;)for(;n(o,-1),!i(o););else for(;--s>=0;)for(;n(o,1),!i(o););}),e&&(a.count=(i,o)=>(fl.setTime(+i),ul.setTime(+o),t(fl),t(ul),Math.floor(e(fl,ul))),a.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?a.filter(r?o=>r(o)%i===0:o=>a.count(0,o)%i===0):a)),a}const hl=1e3*60,Ga=hl*60*24,yu=Ga*7,dl=In(t=>t.setHours(0,0,0,0),(t,n)=>t.setDate(t.getDate()+n),(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*hl)/Ga,t=>t.getDate()-1);dl.range;const gl=In(t=>{t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n)},(t,n)=>(n-t)/Ga,t=>t.getUTCDate()-1);gl.range,In(t=>{t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n)},(t,n)=>(n-t)/Ga,t=>Math.floor(t/Ga)).range;function Nr(t){return In(n=>{n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)},(n,e)=>{n.setDate(n.getDate()+e*7)},(n,e)=>(e-n-(e.getTimezoneOffset()-n.getTimezoneOffset())*hl)/yu)}const vu=Nr(0),lo=Nr(1),dv=Nr(2),gv=Nr(3),da=Nr(4),pv=Nr(5),mv=Nr(6);vu.range,lo.range,dv.range,gv.range,da.range,pv.range,mv.range;function Er(t){return In(n=>{n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)},(n,e)=>{n.setUTCDate(n.getUTCDate()+e*7)},(n,e)=>(e-n)/yu)}const xu=Er(0),co=Er(1),bv=Er(2),yv=Er(3),ga=Er(4),vv=Er(5),xv=Er(6);xu.range,co.range,bv.range,yv.range,ga.range,vv.range,xv.range;const Dr=In(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n)},(t,n)=>n.getFullYear()-t.getFullYear(),t=>t.getFullYear());Dr.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:In(n=>{n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)},(n,e)=>{n.setFullYear(n.getFullYear()+e*t)}),Dr.range;const Pr=In(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n)},(t,n)=>n.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());Pr.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:In(n=>{n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)},(n,e)=>{n.setUTCFullYear(n.getUTCFullYear()+e*t)}),Pr.range;function pl(t){if(0<=t.y&&t.y<100){var n=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return n.setFullYear(t.y),n}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function ml(t){if(0<=t.y&&t.y<100){var n=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return n.setUTCFullYear(t.y),n}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function qa(t,n,e){return{y:t,m:n,d:e,H:0,M:0,S:0,L:0}}function wv(t){var n=t.dateTime,e=t.date,r=t.time,a=t.periods,i=t.days,o=t.shortDays,s=t.months,l=t.shortMonths,c=Xa(a),f=Ua(a),h=Xa(i),d=Ua(i),g=Xa(o),v=Ua(o),m=Xa(s),b=Ua(s),x=Xa(l),A=Ua(l),w={a:V,A:C,b:I,B:W,c:null,d:Mu,e:Mu,f:Wv,g:tx,G:nx,H:Hv,I:Bv,j:Vv,L:$u,m:Gv,M:qv,p:it,q:rt,Q:Eu,s:Du,S:Xv,u:Uv,U:Zv,V:jv,w:Kv,W:Jv,x:null,X:null,y:Qv,Y:ex,Z:rx,"%":Nu},S={a:ct,A:pt,b:xt,B:yt,c:null,d:Cu,e:Cu,f:sx,g:bx,G:vx,H:ax,I:ix,j:ox,L:Tu,m:lx,M:cx,p:bt,q:kt,Q:Eu,s:Du,S:fx,u:ux,U:hx,V:dx,w:gx,W:px,x:null,X:null,y:mx,Y:yx,Z:xx,"%":Nu},z={a:P,A:$,b:N,B:L,c:M,d:ku,e:ku,f:Rv,g:_u,G:Au,H:Su,I:Su,j:Ev,L:zv,m:Nv,M:Dv,p:B,q:Ov,Q:Yv,s:Iv,S:Pv,u:Mv,U:$v,V:Lv,w:Sv,W:Cv,x:D,X:q,y:_u,Y:Au,Z:Tv,"%":Fv};w.x=Y(e,w),w.X=Y(r,w),w.c=Y(n,w),S.x=Y(e,S),S.X=Y(r,S),S.c=Y(n,S);function Y(j,J){return function(X){var O=[],ht=-1,mt=0,vt=j.length,Tt,Ht,Ft;for(X instanceof Date||(X=new Date(+X));++ht<vt;)j.charCodeAt(ht)===37&&(O.push(j.slice(mt,ht)),(Ht=wu[Tt=j.charAt(++ht)])!=null?Tt=j.charAt(++ht):Ht=Tt==="e"?" ":"0",(Ft=J[Tt])&&(Tt=Ft(X,Ht)),O.push(Tt),mt=ht+1);return O.push(j.slice(mt,ht)),O.join("")}}function G(j,J){return function(X){var O=qa(1900,void 0,1),ht=_(O,j,X+="",0),mt,vt;if(ht!=X.length)return null;if("Q"in O)return new Date(O.Q);if("s"in O)return new Date(O.s*1e3+("L"in O?O.L:0));if(J&&!("Z"in O)&&(O.Z=0),"p"in O&&(O.H=O.H%12+O.p*12),O.m===void 0&&(O.m="q"in O?O.q:0),"V"in O){if(O.V<1||O.V>53)return null;"w"in O||(O.w=1),"Z"in O?(mt=ml(qa(O.y,0,1)),vt=mt.getUTCDay(),mt=vt>4||vt===0?co.ceil(mt):co(mt),mt=gl.offset(mt,(O.V-1)*7),O.y=mt.getUTCFullYear(),O.m=mt.getUTCMonth(),O.d=mt.getUTCDate()+(O.w+6)%7):(mt=pl(qa(O.y,0,1)),vt=mt.getDay(),mt=vt>4||vt===0?lo.ceil(mt):lo(mt),mt=dl.offset(mt,(O.V-1)*7),O.y=mt.getFullYear(),O.m=mt.getMonth(),O.d=mt.getDate()+(O.w+6)%7)}else("W"in O||"U"in O)&&("w"in O||(O.w="u"in O?O.u%7:"W"in O?1:0),vt="Z"in O?ml(qa(O.y,0,1)).getUTCDay():pl(qa(O.y,0,1)).getDay(),O.m=0,O.d="W"in O?(O.w+6)%7+O.W*7-(vt+5)%7:O.w+O.U*7-(vt+6)%7);return"Z"in O?(O.H+=O.Z/100|0,O.M+=O.Z%100,ml(O)):pl(O)}}function _(j,J,X,O){for(var ht=0,mt=J.length,vt=X.length,Tt,Ht;ht<mt;){if(O>=vt)return-1;if(Tt=J.charCodeAt(ht++),Tt===37){if(Tt=J.charAt(ht++),Ht=z[Tt in wu?J.charAt(ht++):Tt],!Ht||(O=Ht(j,X,O))<0)return-1}else if(Tt!=X.charCodeAt(O++))return-1}return O}function B(j,J,X){var O=c.exec(J.slice(X));return O?(j.p=f.get(O[0].toLowerCase()),X+O[0].length):-1}function P(j,J,X){var O=g.exec(J.slice(X));return O?(j.w=v.get(O[0].toLowerCase()),X+O[0].length):-1}function $(j,J,X){var O=h.exec(J.slice(X));return O?(j.w=d.get(O[0].toLowerCase()),X+O[0].length):-1}function N(j,J,X){var O=x.exec(J.slice(X));return O?(j.m=A.get(O[0].toLowerCase()),X+O[0].length):-1}function L(j,J,X){var O=m.exec(J.slice(X));return O?(j.m=b.get(O[0].toLowerCase()),X+O[0].length):-1}function M(j,J,X){return _(j,n,J,X)}function D(j,J,X){return _(j,e,J,X)}function q(j,J,X){return _(j,r,J,X)}function V(j){return o[j.getDay()]}function C(j){return i[j.getDay()]}function I(j){return l[j.getMonth()]}function W(j){return s[j.getMonth()]}function it(j){return a[+(j.getHours()>=12)]}function rt(j){return 1+~~(j.getMonth()/3)}function ct(j){return o[j.getUTCDay()]}function pt(j){return i[j.getUTCDay()]}function xt(j){return l[j.getUTCMonth()]}function yt(j){return s[j.getUTCMonth()]}function bt(j){return a[+(j.getUTCHours()>=12)]}function kt(j){return 1+~~(j.getUTCMonth()/3)}return{format:function(j){var J=Y(j+="",w);return J.toString=function(){return j},J},parse:function(j){var J=G(j+="",!1);return J.toString=function(){return j},J},utcFormat:function(j){var J=Y(j+="",S);return J.toString=function(){return j},J},utcParse:function(j){var J=G(j+="",!0);return J.toString=function(){return j},J}}}var wu={"-":"",_:" ",0:"0"},de=/^\s*\d+/,Av=/^%/,_v=/[\\^$*+?|[\]().{}]/g;function jt(t,n,e){var r=t<0?"-":"",a=(r?-t:t)+"",i=a.length;return r+(i<e?new Array(e-i+1).join(n)+a:a)}function kv(t){return t.replace(_v,"\\$&")}function Xa(t){return new RegExp("^(?:"+t.map(kv).join("|")+")","i")}function Ua(t){return new Map(t.map((n,e)=>[n.toLowerCase(),e]))}function Sv(t,n,e){var r=de.exec(n.slice(e,e+1));return r?(t.w=+r[0],e+r[0].length):-1}function Mv(t,n,e){var r=de.exec(n.slice(e,e+1));return r?(t.u=+r[0],e+r[0].length):-1}function $v(t,n,e){var r=de.exec(n.slice(e,e+2));return r?(t.U=+r[0],e+r[0].length):-1}function Lv(t,n,e){var r=de.exec(n.slice(e,e+2));return r?(t.V=+r[0],e+r[0].length):-1}function Cv(t,n,e){var r=de.exec(n.slice(e,e+2));return r?(t.W=+r[0],e+r[0].length):-1}function Au(t,n,e){var r=de.exec(n.slice(e,e+4));return r?(t.y=+r[0],e+r[0].length):-1}function _u(t,n,e){var r=de.exec(n.slice(e,e+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),e+r[0].length):-1}function Tv(t,n,e){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(e,e+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function Ov(t,n,e){var r=de.exec(n.slice(e,e+1));return r?(t.q=r[0]*3-3,e+r[0].length):-1}function Nv(t,n,e){var r=de.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function ku(t,n,e){var r=de.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function Ev(t,n,e){var r=de.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function Su(t,n,e){var r=de.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function Dv(t,n,e){var r=de.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function Pv(t,n,e){var r=de.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function zv(t,n,e){var r=de.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function Rv(t,n,e){var r=de.exec(n.slice(e,e+6));return r?(t.L=Math.floor(r[0]/1e3),e+r[0].length):-1}function Fv(t,n,e){var r=Av.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function Yv(t,n,e){var r=de.exec(n.slice(e));return r?(t.Q=+r[0],e+r[0].length):-1}function Iv(t,n,e){var r=de.exec(n.slice(e));return r?(t.s=+r[0],e+r[0].length):-1}function Mu(t,n){return jt(t.getDate(),n,2)}function Hv(t,n){return jt(t.getHours(),n,2)}function Bv(t,n){return jt(t.getHours()%12||12,n,2)}function Vv(t,n){return jt(1+dl.count(Dr(t),t),n,3)}function $u(t,n){return jt(t.getMilliseconds(),n,3)}function Wv(t,n){return $u(t,n)+"000"}function Gv(t,n){return jt(t.getMonth()+1,n,2)}function qv(t,n){return jt(t.getMinutes(),n,2)}function Xv(t,n){return jt(t.getSeconds(),n,2)}function Uv(t){var n=t.getDay();return n===0?7:n}function Zv(t,n){return jt(vu.count(Dr(t)-1,t),n,2)}function Lu(t){var n=t.getDay();return n>=4||n===0?da(t):da.ceil(t)}function jv(t,n){return t=Lu(t),jt(da.count(Dr(t),t)+(Dr(t).getDay()===4),n,2)}function Kv(t){return t.getDay()}function Jv(t,n){return jt(lo.count(Dr(t)-1,t),n,2)}function Qv(t,n){return jt(t.getFullYear()%100,n,2)}function tx(t,n){return t=Lu(t),jt(t.getFullYear()%100,n,2)}function ex(t,n){return jt(t.getFullYear()%1e4,n,4)}function nx(t,n){var e=t.getDay();return t=e>=4||e===0?da(t):da.ceil(t),jt(t.getFullYear()%1e4,n,4)}function rx(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+jt(n/60|0,"0",2)+jt(n%60,"0",2)}function Cu(t,n){return jt(t.getUTCDate(),n,2)}function ax(t,n){return jt(t.getUTCHours(),n,2)}function ix(t,n){return jt(t.getUTCHours()%12||12,n,2)}function ox(t,n){return jt(1+gl.count(Pr(t),t),n,3)}function Tu(t,n){return jt(t.getUTCMilliseconds(),n,3)}function sx(t,n){return Tu(t,n)+"000"}function lx(t,n){return jt(t.getUTCMonth()+1,n,2)}function cx(t,n){return jt(t.getUTCMinutes(),n,2)}function fx(t,n){return jt(t.getUTCSeconds(),n,2)}function ux(t){var n=t.getUTCDay();return n===0?7:n}function hx(t,n){return jt(xu.count(Pr(t)-1,t),n,2)}function Ou(t){var n=t.getUTCDay();return n>=4||n===0?ga(t):ga.ceil(t)}function dx(t,n){return t=Ou(t),jt(ga.count(Pr(t),t)+(Pr(t).getUTCDay()===4),n,2)}function gx(t){return t.getUTCDay()}function px(t,n){return jt(co.count(Pr(t)-1,t),n,2)}function mx(t,n){return jt(t.getUTCFullYear()%100,n,2)}function bx(t,n){return t=Ou(t),jt(t.getUTCFullYear()%100,n,2)}function yx(t,n){return jt(t.getUTCFullYear()%1e4,n,4)}function vx(t,n){var e=t.getUTCDay();return t=e>=4||e===0?ga(t):ga.ceil(t),jt(t.getUTCFullYear()%1e4,n,4)}function xx(){return"+0000"}function Nu(){return"%"}function Eu(t){return+t}function Du(t){return Math.floor(+t/1e3)}var pa,bl;wx({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function wx(t){return pa=wv(t),bl=pa.format,pa.parse,pa.utcFormat,pa.utcParse,pa}function Wt(t){return function(){return t}}const Pu=Math.abs,ke=Math.atan2,Jn=Math.cos,Ax=Math.max,yl=Math.min,Ge=Math.sin,Se=Math.sqrt,Me=1e-12,fr=Math.PI,fo=fr/2,ur=2*fr;function _x(t){return t>1?0:t<-1?fr:Math.acos(t)}function zu(t){return t>=1?fo:t<=-1?-fo:Math.asin(t)}function uo(t){let n=3;return t.digits=function(e){if(!arguments.length)return n;if(e==null)n=null;else{const r=Math.floor(e);if(!(r>=0))throw new RangeError(`invalid digits: ${e}`);n=r}return t},()=>new X1(n)}function kx(t){return t.innerRadius}function Sx(t){return t.outerRadius}function Mx(t){return t.startAngle}function $x(t){return t.endAngle}function Lx(t){return t&&t.padAngle}function Cx(t,n,e,r,a,i,o,s){var l=e-t,c=r-n,f=o-a,h=s-i,d=h*l-f*c;if(!(d*d<Me))return d=(f*(n-i)-h*(t-a))/d,[t+d*l,n+d*c]}function ho(t,n,e,r,a,i,o){var s=t-e,l=n-r,c=(o?i:-i)/Se(s*s+l*l),f=c*l,h=-c*s,d=t+f,g=n+h,v=e+f,m=r+h,b=(d+v)/2,x=(g+m)/2,A=v-d,w=m-g,S=A*A+w*w,z=a-i,Y=d*m-v*g,G=(w<0?-1:1)*Se(Ax(0,z*z*S-Y*Y)),_=(Y*w-A*G)/S,B=(-Y*A-w*G)/S,P=(Y*w+A*G)/S,$=(-Y*A+w*G)/S,N=_-b,L=B-x,M=P-b,D=$-x;return N*N+L*L>M*M+D*D&&(_=P,B=$),{cx:_,cy:B,x01:-f,y01:-h,x11:_*(a/z-1),y11:B*(a/z-1)}}function Tx(){var t=kx,n=Sx,e=Wt(0),r=null,a=Mx,i=$x,o=Lx,s=null,l=uo(c);function c(){var f,h,d=+t.apply(this,arguments),g=+n.apply(this,arguments),v=a.apply(this,arguments)-fo,m=i.apply(this,arguments)-fo,b=Pu(m-v),x=m>v;if(s||(s=f=l()),g<d&&(h=g,g=d,d=h),!(g>Me))s.moveTo(0,0);else if(b>ur-Me)s.moveTo(g*Jn(v),g*Ge(v)),s.arc(0,0,g,v,m,!x),d>Me&&(s.moveTo(d*Jn(m),d*Ge(m)),s.arc(0,0,d,m,v,x));else{var A=v,w=m,S=v,z=m,Y=b,G=b,_=o.apply(this,arguments)/2,B=_>Me&&(r?+r.apply(this,arguments):Se(d*d+g*g)),P=yl(Pu(g-d)/2,+e.apply(this,arguments)),$=P,N=P,L,M;if(B>Me){var D=zu(B/d*Ge(_)),q=zu(B/g*Ge(_));(Y-=D*2)>Me?(D*=x?1:-1,S+=D,z-=D):(Y=0,S=z=(v+m)/2),(G-=q*2)>Me?(q*=x?1:-1,A+=q,w-=q):(G=0,A=w=(v+m)/2)}var V=g*Jn(A),C=g*Ge(A),I=d*Jn(z),W=d*Ge(z);if(P>Me){var it=g*Jn(w),rt=g*Ge(w),ct=d*Jn(S),pt=d*Ge(S),xt;if(b<fr)if(xt=Cx(V,C,ct,pt,it,rt,I,W)){var yt=V-xt[0],bt=C-xt[1],kt=it-xt[0],j=rt-xt[1],J=1/Ge(_x((yt*kt+bt*j)/(Se(yt*yt+bt*bt)*Se(kt*kt+j*j)))/2),X=Se(xt[0]*xt[0]+xt[1]*xt[1]);$=yl(P,(d-X)/(J-1)),N=yl(P,(g-X)/(J+1))}else $=N=0}G>Me?N>Me?(L=ho(ct,pt,V,C,g,N,x),M=ho(it,rt,I,W,g,N,x),s.moveTo(L.cx+L.x01,L.cy+L.y01),N<P?s.arc(L.cx,L.cy,N,ke(L.y01,L.x01),ke(M.y01,M.x01),!x):(s.arc(L.cx,L.cy,N,ke(L.y01,L.x01),ke(L.y11,L.x11),!x),s.arc(0,0,g,ke(L.cy+L.y11,L.cx+L.x11),ke(M.cy+M.y11,M.cx+M.x11),!x),s.arc(M.cx,M.cy,N,ke(M.y11,M.x11),ke(M.y01,M.x01),!x))):(s.moveTo(V,C),s.arc(0,0,g,A,w,!x)):s.moveTo(V,C),!(d>Me)||!(Y>Me)?s.lineTo(I,W):$>Me?(L=ho(I,W,it,rt,d,-$,x),M=ho(V,C,ct,pt,d,-$,x),s.lineTo(L.cx+L.x01,L.cy+L.y01),$<P?s.arc(L.cx,L.cy,$,ke(L.y01,L.x01),ke(M.y01,M.x01),!x):(s.arc(L.cx,L.cy,$,ke(L.y01,L.x01),ke(L.y11,L.x11),!x),s.arc(0,0,d,ke(L.cy+L.y11,L.cx+L.x11),ke(M.cy+M.y11,M.cx+M.x11),x),s.arc(M.cx,M.cy,$,ke(M.y11,M.x11),ke(M.y01,M.x01),!x))):s.arc(0,0,d,z,S,x)}if(s.closePath(),f)return s=null,f+""||null}return c.centroid=function(){var f=(+t.apply(this,arguments)+ +n.apply(this,arguments))/2,h=(+a.apply(this,arguments)+ +i.apply(this,arguments))/2-fr/2;return[Jn(h)*f,Ge(h)*f]},c.innerRadius=function(f){return arguments.length?(t=typeof f=="function"?f:Wt(+f),c):t},c.outerRadius=function(f){return arguments.length?(n=typeof f=="function"?f:Wt(+f),c):n},c.cornerRadius=function(f){return arguments.length?(e=typeof f=="function"?f:Wt(+f),c):e},c.padRadius=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Wt(+f),c):r},c.startAngle=function(f){return arguments.length?(a=typeof f=="function"?f:Wt(+f),c):a},c.endAngle=function(f){return arguments.length?(i=typeof f=="function"?f:Wt(+f),c):i},c.padAngle=function(f){return arguments.length?(o=typeof f=="function"?f:Wt(+f),c):o},c.context=function(f){return arguments.length?(s=f??null,c):s},c}function go(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Ru(t){this._context=t}Ru.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:this._context.lineTo(t,n);break}}};function po(t){return new Ru(t)}function Fu(t){return t[0]}function Yu(t){return t[1]}function Za(t,n){var e=Wt(!0),r=null,a=po,i=null,o=uo(s);t=typeof t=="function"?t:t===void 0?Fu:Wt(t),n=typeof n=="function"?n:n===void 0?Yu:Wt(n);function s(l){var c,f=(l=go(l)).length,h,d=!1,g;for(r==null&&(i=a(g=o())),c=0;c<=f;++c)!(c<f&&e(h=l[c],c,l))===d&&((d=!d)?i.lineStart():i.lineEnd()),d&&i.point(+t(h,c,l),+n(h,c,l));if(g)return i=null,g+""||null}return s.x=function(l){return arguments.length?(t=typeof l=="function"?l:Wt(+l),s):t},s.y=function(l){return arguments.length?(n=typeof l=="function"?l:Wt(+l),s):n},s.defined=function(l){return arguments.length?(e=typeof l=="function"?l:Wt(!!l),s):e},s.curve=function(l){return arguments.length?(a=l,r!=null&&(i=a(r)),s):a},s.context=function(l){return arguments.length?(l==null?r=i=null:i=a(r=l),s):r},s}function ja(t,n,e){var r=null,a=Wt(!0),i=null,o=po,s=null,l=uo(c);t=typeof t=="function"?t:t===void 0?Fu:Wt(+t),n=typeof n=="function"?n:Wt(n===void 0?0:+n),e=typeof e=="function"?e:e===void 0?Yu:Wt(+e);function c(h){var d,g,v,m=(h=go(h)).length,b,x=!1,A,w=new Array(m),S=new Array(m);for(i==null&&(s=o(A=l())),d=0;d<=m;++d){if(!(d<m&&a(b=h[d],d,h))===x)if(x=!x)g=d,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),v=d-1;v>=g;--v)s.point(w[v],S[v]);s.lineEnd(),s.areaEnd()}x&&(w[d]=+t(b,d,h),S[d]=+n(b,d,h),s.point(r?+r(b,d,h):w[d],e?+e(b,d,h):S[d]))}if(A)return s=null,A+""||null}function f(){return Za().defined(a).curve(o).context(i)}return c.x=function(h){return arguments.length?(t=typeof h=="function"?h:Wt(+h),r=null,c):t},c.x0=function(h){return arguments.length?(t=typeof h=="function"?h:Wt(+h),c):t},c.x1=function(h){return arguments.length?(r=h==null?null:typeof h=="function"?h:Wt(+h),c):r},c.y=function(h){return arguments.length?(n=typeof h=="function"?h:Wt(+h),e=null,c):n},c.y0=function(h){return arguments.length?(n=typeof h=="function"?h:Wt(+h),c):n},c.y1=function(h){return arguments.length?(e=h==null?null:typeof h=="function"?h:Wt(+h),c):e},c.lineX0=c.lineY0=function(){return f().x(t).y(n)},c.lineY1=function(){return f().x(t).y(e)},c.lineX1=function(){return f().x(r).y(n)},c.defined=function(h){return arguments.length?(a=typeof h=="function"?h:Wt(!!h),c):a},c.curve=function(h){return arguments.length?(o=h,i!=null&&(s=o(i)),c):o},c.context=function(h){return arguments.length?(h==null?i=s=null:s=o(i=h),c):i},c}function Ox(t,n){return n<t?-1:n>t?1:n>=t?0:NaN}function Nx(t){return t}function Ex(){var t=Nx,n=Ox,e=null,r=Wt(0),a=Wt(ur),i=Wt(0);function o(s){var l,c=(s=go(s)).length,f,h,d=0,g=new Array(c),v=new Array(c),m=+r.apply(this,arguments),b=Math.min(ur,Math.max(-ur,a.apply(this,arguments)-m)),x,A=Math.min(Math.abs(b)/c,i.apply(this,arguments)),w=A*(b<0?-1:1),S;for(l=0;l<c;++l)(S=v[g[l]=l]=+t(s[l],l,s))>0&&(d+=S);for(n!=null?g.sort(function(z,Y){return n(v[z],v[Y])}):e!=null&&g.sort(function(z,Y){return e(s[z],s[Y])}),l=0,h=d?(b-c*w)/d:0;l<c;++l,m=x)f=g[l],S=v[f],x=m+(S>0?S*h:0)+w,v[f]={data:s[f],index:l,value:S,startAngle:m,endAngle:x,padAngle:A};return v}return o.value=function(s){return arguments.length?(t=typeof s=="function"?s:Wt(+s),o):t},o.sortValues=function(s){return arguments.length?(n=s,e=null,o):n},o.sort=function(s){return arguments.length?(e=s,n=null,o):e},o.startAngle=function(s){return arguments.length?(r=typeof s=="function"?s:Wt(+s),o):r},o.endAngle=function(s){return arguments.length?(a=typeof s=="function"?s:Wt(+s),o):a},o.padAngle=function(s){return arguments.length?(i=typeof s=="function"?s:Wt(+s),o):i},o}const vl={draw(t,n){const e=Se(n/fr);t.moveTo(e,0),t.arc(0,0,e,0,ur)}},Dx={draw(t,n){const e=Se(n/5)/2;t.moveTo(-3*e,-e),t.lineTo(-e,-e),t.lineTo(-e,-3*e),t.lineTo(e,-3*e),t.lineTo(e,-e),t.lineTo(3*e,-e),t.lineTo(3*e,e),t.lineTo(e,e),t.lineTo(e,3*e),t.lineTo(-e,3*e),t.lineTo(-e,e),t.lineTo(-3*e,e),t.closePath()}},Iu=Se(1/3),Px=Iu*2,zx={draw(t,n){const e=Se(n/Px),r=e*Iu;t.moveTo(0,-e),t.lineTo(r,0),t.lineTo(0,e),t.lineTo(-r,0),t.closePath()}},Rx={draw(t,n){const e=Se(n),r=-e/2;t.rect(r,r,e,e)}},Fx=.8908130915292852,Hu=Ge(fr/10)/Ge(7*fr/10),Yx=Ge(ur/10)*Hu,Ix=-Jn(ur/10)*Hu,Hx={draw(t,n){const e=Se(n*Fx),r=Yx*e,a=Ix*e;t.moveTo(0,-e),t.lineTo(r,a);for(let i=1;i<5;++i){const o=ur*i/5,s=Jn(o),l=Ge(o);t.lineTo(l*e,-s*e),t.lineTo(s*r-l*a,l*r+s*a)}t.closePath()}},xl=Se(3),Bu={draw(t,n){const e=-Se(n/(xl*3));t.moveTo(0,e*2),t.lineTo(-xl*e,-e),t.lineTo(xl*e,-e),t.closePath()}},Bx=Se(3),Vx={draw(t,n){const e=Se(n)*.6824,r=e/2,a=e*Bx/2;t.moveTo(0,-e),t.lineTo(a,r),t.lineTo(-a,r),t.closePath()}};function Wx(t,n){let e=null,r=uo(a);t=typeof t=="function"?t:Wt(t||vl),n=typeof n=="function"?n:Wt(n===void 0?64:+n);function a(){let i;if(e||(e=i=r()),t.apply(this,arguments).draw(e,+n.apply(this,arguments)),i)return e=null,i+""||null}return a.type=function(i){return arguments.length?(t=typeof i=="function"?i:Wt(i),a):t},a.size=function(i){return arguments.length?(n=typeof i=="function"?i:Wt(+i),a):n},a.context=function(i){return arguments.length?(e=i??null,a):e},a}function Vu(t,n,e){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+n)/6,(t._y0+4*t._y1+e)/6)}function Wu(t){this._context=t}Wu.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Vu(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Vu(this,t,n);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}};function Gx(t){return new Wu(t)}function Gu(t,n,e){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-n),t._y2+t._k*(t._y1-e),t._x2,t._y2)}function wl(t,n){this._context=t,this._k=(1-n)/6}wl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Gu(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2,this._x1=t,this._y1=n;break;case 2:this._point=3;default:Gu(this,t,n);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};const qx=(function t(n){function e(r){return new wl(r,n)}return e.tension=function(r){return t(+r)},e})(0);function Xx(t,n,e){var r=t._x1,a=t._y1,i=t._x2,o=t._y2;if(t._l01_a>Me){var s=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,l=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*s-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,a=(a*s-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>Me){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,f=3*t._l23_a*(t._l23_a+t._l12_a);i=(i*c+t._x1*t._l23_2a-n*t._l12_2a)/f,o=(o*c+t._y1*t._l23_2a-e*t._l12_2a)/f}t._context.bezierCurveTo(r,a,i,o,t._x2,t._y2)}function qu(t,n){this._context=t,this._alpha=n}qu.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3;default:Xx(this,t,n);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};const Ux=(function t(n){function e(r){return n?new qu(r,n):new wl(r,0)}return e.alpha=function(r){return t(+r)},e})(.5);function Xu(t){return t<0?-1:1}function Uu(t,n,e){var r=t._x1-t._x0,a=n-t._x1,i=(t._y1-t._y0)/(r||a<0&&-0),o=(e-t._y1)/(a||r<0&&-0),s=(i*a+o*r)/(r+a);return(Xu(i)+Xu(o))*Math.min(Math.abs(i),Math.abs(o),.5*Math.abs(s))||0}function Zu(t,n){var e=t._x1-t._x0;return e?(3*(t._y1-t._y0)/e-n)/2:n}function Al(t,n,e){var r=t._x0,a=t._y0,i=t._x1,o=t._y1,s=(i-r)/3;t._context.bezierCurveTo(r+s,a+s*n,i-s,o-s*e,i,o)}function mo(t){this._context=t}mo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Al(this,this._t0,Zu(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){var e=NaN;if(t=+t,n=+n,!(t===this._x1&&n===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,Al(this,Zu(this,e=Uu(this,t,n)),e);break;default:Al(this,this._t0,e=Uu(this,t,n));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n,this._t0=e}}},Object.create(mo.prototype).point=function(t,n){mo.prototype.point.call(this,n,t)};function Zx(t){return new mo(t)}function bo(t,n){this._context=t,this._t=n}bo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,n),this._context.lineTo(t,n);else{var e=this._x*(1-this._t)+t*this._t;this._context.lineTo(e,this._y),this._context.lineTo(e,n)}break}}this._x=t,this._y=n}};function jx(t){return new bo(t,.5)}function Kx(t){return new bo(t,0)}function Jx(t){return new bo(t,1)}function yo(t,n){if((o=t.length)>1)for(var e=1,r,a,i=t[n[0]],o,s=i.length;e<o;++e)for(a=i,i=t[n[e]],r=0;r<s;++r)i[r][1]+=i[r][0]=isNaN(a[r][1])?a[r][0]:a[r][1]}function vo(t){for(var n=t.length,e=new Array(n);--n>=0;)e[n]=n;return e}function Qx(t,n){return t[n]}function t2(t){const n=[];return n.key=t,n}function ju(){var t=Wt([]),n=vo,e=yo,r=Qx;function a(i){var o=Array.from(t.apply(this,arguments),t2),s,l=o.length,c=-1,f;for(const h of i)for(s=0,++c;s<l;++s)(o[s][c]=[0,+r(h,o[s].key,c,i)]).data=h;for(s=0,f=go(n(o));s<l;++s)o[f[s]].index=s;return e(o,f),o}return a.keys=function(i){return arguments.length?(t=typeof i=="function"?i:Wt(Array.from(i)),a):t},a.value=function(i){return arguments.length?(r=typeof i=="function"?i:Wt(+i),a):r},a.order=function(i){return arguments.length?(n=i==null?vo:typeof i=="function"?i:Wt(Array.from(i)),a):n},a.offset=function(i){return arguments.length?(e=i??yo,a):e},a}function e2(t,n){if((r=t.length)>0){for(var e,r,a=0,i=t[0].length,o;a<i;++a){for(o=e=0;e<r;++e)o+=t[e][a][1]||0;if(o)for(e=0;e<r;++e)t[e][a][1]/=o}yo(t,n)}}function n2(t,n){if((l=t.length)>0)for(var e,r=0,a,i,o,s,l,c=t[n[0]].length;r<c;++r)for(o=s=0,e=0;e<l;++e)(i=(a=t[n[e]][r])[1]-a[0])>0?(a[0]=o,a[1]=o+=i):i<0?(a[1]=s,a[0]=s+=i):(a[0]=0,a[1]=i)}function Ka(t,n,e){this.k=t,this.x=n,this.y=e}Ka.prototype={constructor:Ka,scale:function(t){return t===1?this:new Ka(this.k*t,this.x,this.y)},translate:function(t,n){return t===0&n===0?this:new Ka(this.k,this.x+this.k*t,this.y+this.k*n)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},Ka.prototype;function _l(t,n){if(!t)throw new Error(`[d3-blueprint] ${n}`)}class r2{constructor(){oe(this,"properties",new Map)}define(n,e){_l(!this.properties.has(n),`config "${n}" is already defined`);const{defaultValue:r,getter:a,setter:i}=e,o=i?i(r):r;return this.properties.set(n,{value:o,getter:a,setter:i}),this}get(n){const e=this.getProperty(n),{value:r,getter:a}=e;return a?a(r):r}set(n,e){const r=this.getProperty(n);return r.value=r.setter?r.setter(e):e,this}setBatch(n){for(const[e,r]of Object.entries(n))this.set(e,r);return this}getAll(){const n={};for(const[e]of this.properties)n[e]=this.get(e);return n}has(n){return this.properties.has(n)}getProperty(n){const e=this.properties.get(n);return _l(e,`config "${n}" is not defined`),e}}const kl=["update","enter","merge","exit"],Ku=new Set([...kl,...kl.map(t=>`${t}:transition`)]);function a2(t){return Ku.has(t)}function Ju(t){_l(a2(t),`"${t}" is not a valid lifecycle event. Expected one of: ${[...Ku].join(", ")}`)}function i2(t,n,e){const r=t.exit(),a={update:t,enter:n,merge:n.merge(t),exit:r};return kl.map(i=>{const o=a[i],s=e.get(i)??[],l=e.get(`${i}:transition`)??[];return{name:i,selection:o,handlers:s,transitionHandlers:l}})}function o2(t,n){for(const e of n)e(t)}function s2(t,n){return n.map(e=>{const r=t.transition();return e(r),l2(r)})}function l2(t){return t.end().then(()=>{},()=>{})}class c2{constructor(n,e){oe(this,"base");oe(this,"dataBindFn");oe(this,"insertFn");oe(this,"handlers",new Map);if(this.base=n,this.dataBindFn=e.dataBind,this.insertFn=e.insert,e.events)for(const[r,a]of Object.entries(e.events))a&&this.on(r,a)}on(n,e){Ju(n);const r=this.handlers.get(n)??[];return r.push(e),this.handlers.set(n,r),this}off(n,e){if(Ju(n),!e)return this.handlers.delete(n),this;const r=this.handlers.get(n);if(r){const a=r.indexOf(e);a!==-1&&r.splice(a,1)}return this}draw(n){const e=this.dataBindFn(this.base,n),r=e.enter(),a=this.insertFn(r),i=i2(e,a,this.handlers),o=[];for(const s of i){o2(s.selection,s.handlers);const l=s2(s.selection,s.transitionHandlers);o.push(...l)}return Promise.all(o).then(()=>{})}}function f2(t,n,e,r){if(e&&r){const i=new c2(e,r);return t.set(n,i),i}const a=t.get(n);if(!a)throw new Error(`[d3-blueprint] layer "${n}" is not defined`);return a}function u2(t,n,e,r){return typeof e=="string"&&r===void 0?t.get(e):typeof e=="string"?(t.set(e,r),n):(t.setBatch(e),n)}function h2(t,n){const e=[];for(const r of t.values())e.push(r.draw(n));return e}function d2(t,n){const e=[];for(const r of t.values()){const a=r.draw(n);a&&e.push(a)}return e}const g2=["preDraw","postDraw","postTransition"];class zr{constructor(n){oe(this,"base");oe(this,"layers",new Map);oe(this,"attachments",new Map);oe(this,"configs",new r2);oe(this,"dispatcher");oe(this,"attached",new Proxy({},{get:(n,e)=>{const r=this.attachments.get(e);if(!r)throw new Error(`[d3-blueprint] attachment "${e}" is not defined`);return r},has:(n,e)=>this.attachments.has(e)}));this.base=n,this.dispatcher=Hs(...g2),this.initialize()}initialize(){}transform(n){return n}preDraw(n){}postDraw(n){}postTransition(n){}layer(n,e,r){return f2(this.layers,n,e,r)}attach(n,e,r){if(r!==void 0){const a=e;this.attachments.set(n,new a(r))}else this.attachments.set(n,e);return this}config(n,e){return u2(this.configs,this,n,e)}configDefine(n,e){return this.configs.define(n,e),this}on(n,e){return this.dispatcher.on(n,e),this}off(n){return this.dispatcher.on(n,null),this}use(n,e){const r=e||n.name||"plugin";if(n.install(this),n.preDraw&&this.on(`preDraw.${r}`,a=>n.preDraw(this,a)),n.postDraw&&this.on(`postDraw.${r}`,a=>n.postDraw(this,a)),n.postTransition&&this.on(`postTransition.${r}`,a=>n.postTransition(this,a)),n.destroy){const a=this.destroy.bind(this);this.destroy=()=>{n.destroy(this),a()}}return this}async draw(n){const e=this.transform(n);this.preDraw(e),this.dispatcher.call("preDraw",this,e);const r=h2(this.layers,e),a=d2(this.attachments,e);this.postDraw(e),this.dispatcher.call("postDraw",this,e),await Promise.all([...r,...a]),this.postTransition(e),this.dispatcher.call("postTransition",this,e)}destroy(){this.layers.clear(),this.attachments.clear()}}class p2 extends zr{initialize(){const n=this.base.append("div").attr("class","bc-frame"),e=n.append("div").attr("class","bc-frame-header");n.append("div").attr("class","bc-frame-body"),n.append("p").attr("class","bc-frame-note");const r=n.append("div").attr("class","bc-frame-footer").style("display","flex").style("justify-content","space-between").style("align-items","center").style("flex-wrap","wrap").style("gap","0.25rem 1rem"),a=r.append("div").attr("class","bc-frame-footer-left").style("display","flex").style("flex-wrap","wrap").style("gap","0.25rem 0.75rem"),i=r.append("div").attr("class","bc-frame-footer-right").style("display","flex").style("align-items","center");this.layer("headerItems",e,{dataBind:(o,s)=>o.selectAll(".bc-frame-header-item").data(s.headerItems,l=>l.className),insert:o=>o.append(s=>document.createElement(s.tag)),events:{enter:o=>{o.attr("class",s=>s.className).text(s=>s.text)},merge:o=>{o.attr("class",s=>s.className).text(s=>s.text)},exit:o=>{o.remove()}}}),this.layer("footerLeftItems",a,{dataBind:(o,s)=>o.selectAll(".bc-frame-footer-item").data(s.footerLeftItems,l=>l.className),insert:o=>o.append(s=>document.createElement(s.tag)),events:{enter:o=>{o.attr("class",s=>s.className).each(function(s){if(this.textContent="",s.prefix){const l=document.createElement("span");l.className="bc-frame-source-prefix",l.textContent=s.prefix,this.appendChild(l)}if(s.href){const l=document.createElement("a");l.className="bc-frame-source-link",l.href=s.href,l.textContent=s.text,this.appendChild(l)}else this.appendChild(document.createTextNode(s.text))})},merge:o=>{o.attr("class",s=>s.className).each(function(s){if(this.textContent="",s.prefix){const l=document.createElement("span");l.className="bc-frame-source-prefix",l.textContent=s.prefix,this.appendChild(l)}if(s.href){const l=document.createElement("a");l.className="bc-frame-source-link",l.href=s.href,l.textContent=s.text,this.appendChild(l)}else this.appendChild(document.createTextNode(s.text))})},exit:o=>{o.remove()}}}),this.layer("footerRightItems",i,{dataBind:(o,s)=>o.selectAll(".bc-frame-footer-item").data(s.footerRightItems,l=>l.className),insert:o=>o.append(s=>document.createElement(s.tag)),events:{enter:o=>{o.attr("class",s=>s.className).each(function(s){if(s.html){const c=document.createRange().createContextualFragment(s.html);this.appendChild(c)}else this.textContent=s.text}),o.filter(s=>!!s.href).attr("href",s=>s.href),o.filter(s=>!!s.target).attr("target",s=>s.target),o.filter(s=>!!s.rel).attr("rel",s=>s.rel)},merge:o=>{o.attr("class",s=>s.className).each(function(s){if(this.textContent="",s.html){const c=document.createRange().createContextualFragment(s.html);this.appendChild(c)}else this.textContent=s.text}),o.filter(s=>!!s.href).attr("href",s=>s.href),o.filter(s=>!!s.target).attr("target",s=>s.target),o.filter(s=>!!s.rel).attr("rel",s=>s.rel)},exit:o=>{o.remove()}}})}}function m2(t){const n=[];return t.title&&n.push({tag:"h3",className:"bc-frame-title",text:t.title}),t.description&&n.push({tag:"p",className:"bc-frame-description",text:t.description}),n}function b2(t){const n=[];return t.byline&&n.push({tag:"span",className:"bc-frame-byline",text:t.byline}),t.source&&n.push({tag:"span",className:"bc-frame-source",text:t.source,prefix:"Source: ",href:t.sourceUrl||void 0}),n}const y2='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48.042969 90.607422" width="10" height="18" style="vertical-align:-3px;margin-right:3px"><path fill="currentColor" opacity="0.55" d="M 20.042969 34.607422 A 28 28 0 0 1 23.072266 34.779297 A 28 28 0 0 0 20.042969 34.607422 z M 23.34375 34.810547 A 28 28 0 0 1 26.171875 35.292969 A 28 28 0 0 0 23.34375 34.810547 z M 16.570312 34.84375 A 28 28 0 0 0 15.474609 35.033203 A 28 28 0 0 1 16.570312 34.84375 z M 26.390625 35.341797 A 28 28 0 0 1 29.316406 36.189453 A 28 28 0 0 0 26.390625 35.341797 z M 13.128906 35.511719 A 28 28 0 0 0 11.904297 35.873047 A 28 28 0 0 1 13.128906 35.511719 z M 29.373047 36.210938 A 28 28 0 0 1 32.103516 37.347656 A 28 28 0 0 0 29.373047 36.210938 z M 9.7832031 36.609375 A 28 28 0 0 0 8.5820312 37.117188 A 28 28 0 0 1 9.7832031 36.609375 z M 32.392578 37.486328 A 28 28 0 0 1 34.939453 38.90625 A 28 28 0 0 0 32.392578 37.486328 z M 6.5742188 38.128906 A 28 28 0 0 0 5.4511719 38.765625 A 28 28 0 0 1 6.5742188 38.128906 z M 35.041016 38.966797 A 28 28 0 0 1 37.523438 40.738281 A 28 28 0 0 0 35.041016 38.966797 z M 3.5273438 40.080078 A 28 28 0 0 0 2.5761719 40.771484 A 28 28 0 0 1 3.5273438 40.080078 z M 37.658203 40.851562 A 28 28 0 0 1 39.804688 42.783203 A 28 28 0 0 0 37.658203 40.851562 z M 40.011719 42.990234 A 28 28 0 0 1 42.013672 45.251953 A 28 28 0 0 0 40.011719 42.990234 z M 42.013672 45.251953 A 28 28 0 0 1 20.042969 56 A 28 28 0 0 1 14.232422 55.3125 A 16 16 0 0 1 16 62.607422 A 16 16 0 0 1 0 78.607422 L 0 82.121094 A 28 28 0 0 0 20.042969 90.607422 A 28 28 0 0 0 48.042969 62.607422 A 28 28 0 0 0 42.013672 45.251953 z M 1.3007812 46.667969 A 16 16 0 0 1 1.6191406 46.697266 A 16 16 0 0 0 1.3007812 46.667969 z M 4.2558594 47.189453 A 16 16 0 0 1 4.4355469 47.242188 A 16 16 0 0 0 4.2558594 47.189453 z "/><path fill="currentColor" opacity="0.85" d="M 6.0637516 38.376047 A 28 28 0 0 1 20.042969 34.615234 A 28 28 0 0 1 42.013672 45.259765 A 28 28 0 0 0 48.042969 28.007812 A 28 28 0 0 0 20.042969 0.0078125 A 28 28 0 0 0 0 8.4941407 L 0 16.007812 A 12 12 0 0 1 12 28.007812 A 12 12 0 0 1 6.0613693 38.364443 "/><path fill="currentColor" d="M 20.042969 34.607422 A 28 28 0 0 0 5.0878906 38.970703 A 28 28 0 0 1 6.0644531 38.376953 L 6.0605469 38.365234 A 12 12 0 0 1 0 40.007812 L 0 43.09375 L 0 43.101562 L 0 46.607422 A 16 16 0 0 1 2.8847656 46.873047 A 16 16 0 0 1 2.9199219 46.878906 A 16 16 0 0 1 5.7011719 47.662109 A 16 16 0 0 1 5.7324219 47.673828 A 16 16 0 0 1 8.3300781 48.955078 A 16 16 0 0 1 8.3398438 48.958984 A 16 16 0 0 1 8.3457031 48.962891 A 16 16 0 0 1 10.662109 50.6875 A 16 16 0 0 1 10.697266 50.71875 A 16 16 0 0 1 12.660156 52.837891 A 16 16 0 0 1 12.667969 52.845703 A 16 16 0 0 1 12.673828 52.855469 A 16 16 0 0 1 14.228516 55.306641 A 16 16 0 0 1 14.232422 55.3125 A 28 28 0 0 0 20.042969 56 A 28 28 0 0 0 42.013672 45.251953 A 28 28 0 0 0 20.042969 34.607422 z M 4.7695312 39.177734 A 28 28 0 0 0 2.5390625 40.798828 A 28 28 0 0 1 4.7695312 39.177734 z M 2.1816406 41.091797 A 28 28 0 0 0 0.11914062 42.984375 A 28 28 0 0 1 2.1816406 41.091797 z "/></svg>';function v2(){return[{tag:"a",className:"bc-frame-credit",text:"Blueprint Chart",html:y2+"Blueprint Chart",href:"/",target:"_blank",rel:"noopener noreferrer"}]}function dn(t,n){if(n===null)return{wrapper:t,header:t,body:t,footer:t};const e=n??{};new p2(ot(t)).draw({headerItems:m2(e),footerLeftItems:b2(e),footerRightItems:v2()});const a=t.querySelector(".bc-frame"),i=a.querySelector(".bc-frame-header"),o=a.querySelector(".bc-frame-body"),s=a.querySelector(".bc-frame-note"),l=a.querySelector(".bc-frame-footer");if(e.padding&&a.style.setProperty("--bc-frame-padding",e.padding),e.transparentBackground&&a.style.setProperty("--bc-frame-bg","transparent"),e.note?s.textContent=e.note:s.style.display="none",t.isConnected){const c=getComputedStyle(t),f=c.aspectRatio&&c.aspectRatio!=="auto"&&c.aspectRatio!=="",h=c.display==="flex"&&c.flexDirection==="column";if(f||h){const d=i.offsetHeight,g=l.offsetHeight,v=s.style.display!=="none"?s.offsetHeight:0;a.classList.add("bc-frame--constrained"),o.dataset.headerH=String(d);const m=t;o.dataset.footerH=String(m.__bcFooterH??g+v),requestAnimationFrame(()=>{m.__bcFooterH=l.offsetHeight+(s.style.display!=="none"?s.offsetHeight:0)})}}return{wrapper:a,header:i,body:o,footer:l}}function Qu(t){return t&&(t.startsWith("(")&&t.endsWith(")")?t.slice(0,-1):t)}function x2(t){if(!t)return{prefix:"",d3Spec:"",suffix:""};if(t.includes("|")){const n=t.split("|");return{prefix:n[0]??"",d3Spec:Qu(n[1]??""),suffix:n[2]??""}}return{prefix:"",d3Spec:Qu(t),suffix:""}}function hr(t){if(!t)return null;const{prefix:n,d3Spec:e,suffix:r}=x2(t);if(!e)return null;const a=io(e);return!n&&!r?a:i=>`${n}${a(i)}${r}`}function xo(t,n){return!Number.isFinite(n)||n<=0?"0%":`${Math.round(t/n*100)}%`}function Ln(t,n){if(!t)return;const e=t.stableTop??t.top,r=n.stableTop??n.top;return{dx:t.left-n.left,dy:e-r}}const w2={top:12,right:20,bottom:24,left:50},th=600,eh=400;class A2 extends zr{initialize(){this.configDefine("totalWidth",{defaultValue:th}),this.configDefine("totalHeight",{defaultValue:eh}),this.layer("svg",this.base,{dataBind:(n,e)=>n.selectAll("svg").data(e),insert:n=>n.append("svg"),events:{enter:n=>{const e=this.config("totalWidth"),r=this.config("totalHeight");n.attr("width",e).attr("height",r).append("g").attr("transform",a=>`translate(${a.left},${a.top})`)}}})}}const _2=400,nh=2,wo=2,Ao=9;function Rr(t,n,e,r){const a=Math.min(0,...t),i=Math.max(0,...t),o=(n==null?void 0:n.min)??a,s=(n==null?void 0:n.max)??i,l=r==="log"?cr().domain([o,s]).nice():Pe().domain([o,s]).nice(),c=l.ticks(),f=e?hr(e)??l.tickFormat():l.tickFormat(),h=c.map(g=>f(g));if(h.length===0)return 0;try{const v=document.createElement("canvas").getContext("2d");if(v){v.font="10px sans-serif";let m=0;for(const b of h){const x=v.measureText(b).width;x>m&&(m=x)}return Math.ceil(m)+wo+Ao}}catch{}return Math.max(...h.map(g=>g.length))*6+wo+Ao}function _o(t){if(t.length===0)return 0;try{const r=document.createElement("canvas").getContext("2d");if(r){r.font="10px sans-serif";let a=0;for(const i of t){const o=r.measureText(i).width;o>a&&(a=o)}return Math.ceil(a)+wo+Ao}}catch{}return Math.max(...t.map(e=>e.length))*6+wo+Ao}function Cn(t,n,e,r,a,i){const o={},s=a??50,l=r??"left",c=n??"auto",f=c==="auto"?t>0&&t<_2?"inside":"outside":c,h=f==="inside",d=f==="off";return l==="right"?(o.left=0,h?o.right=nh:d?o.right=0:o.right=s):(o.right=i!==!1?15:0,h?o.left=nh:d?o.left=0:o.left=s),h&&(o.top=35),(i===!1||e==="inside"||e==="off")&&(o.bottom=5),o}function qe(t){const n=t.getBoundingClientRect(),e=getComputedStyle(t);return{width:n.width-(parseFloat(e.paddingLeft)||0)-(parseFloat(e.paddingRight)||0),height:n.height-(parseFloat(e.paddingTop)||0)-(parseFloat(e.paddingBottom)||0)}}function k2(t,n){var a;const e=n.closest(".bc-frame");if(!e||e.style.getPropertyValue("--bc-frame-bg").trim()==="transparent")return;(a=t.querySelector(".bc-canvas-bg"))==null||a.remove();const r=t.ownerDocument.createElementNS("http://www.w3.org/2000/svg","rect");r.setAttribute("class","bc-canvas-bg"),r.setAttribute("width","100%"),r.setAttribute("height","100%"),r.setAttribute("fill",Be(e)),t.insertBefore(r,t.firstChild)}function gn(t,n){const e={...w2,...n},r=t.closest(".bc-frame--constrained")!=null;if(r){const d=parseFloat(t.dataset.headerH||"0"),g=parseFloat(t.dataset.footerH||"0"),v=e.top;e.top=d+v,e.bottom+=g,e.stableTop=v}const a=qe(t),i=a.width>0?a.width:th,o=a.height>0?a.height:eh,s=i-e.left-e.right,l=o-e.top-e.bottom,c=new A2(ot(t));c.config({totalWidth:i,totalHeight:o}),c.draw([e]);const f=t.querySelector("svg"),h=f.querySelector("g");return k2(f,t),r&&(f.setAttribute("viewBox",`0 0 ${i} ${o}`),f.setAttribute("preserveAspectRatio","none"),f.removeAttribute("width"),f.removeAttribute("height"),f.style.width="100%",f.style.height="100%",f.style.display="block"),{svg:f,chartArea:h,width:s,height:l,margin:e}}function Fr(t){return typeof window>"u"||typeof window.matchMedia!="function"?t:window.matchMedia("(prefers-reduced-motion: reduce)").matches?0:t}const ma=500;let rh=0;function pn(t){rh=t?ma:0}function Ja(){return Fr(rh)}function en(t,n){const e=Fr(ma);e<=0||typeof t.animate!="function"||t.animate([{opacity:0},{opacity:1}],{duration:e,easing:"ease-in-out"})}function nn(t,n){const e=Fr(ma);if(t.querySelectorAll("[data-bc-fade-overlay]").forEach(a=>{typeof a.getAnimations=="function"&&a.getAnimations().forEach(i=>i.cancel()),a.remove()}),e<=0||t.children.length===0)return null;const r=document.createElement("div");return r.style.position="absolute",r.style.inset="0",r.style.pointerEvents="none",r.style.display="flex",r.style.flexDirection="column",r.dataset.bcFadeOverlay="true",Array.from(t.childNodes).forEach(a=>{r.appendChild(a.cloneNode(!0))}),r.querySelectorAll(".bc-axis-vertical, .bc-axis-horizontal").forEach(a=>{a.remove()}),r.querySelectorAll(".bc-frame-footer, .bc-frame-note").forEach(a=>{a.remove()}),r.querySelectorAll("[data-bc-fade-overlay], .bc-frame--fade-snapshot").forEach(a=>{a.remove()}),r.querySelectorAll(".bc-frame").forEach(a=>{a.classList.remove("bc-frame"),a.classList.add("bc-frame--fade-snapshot")}),r}function rn(t,n,e){const r=Fr(ma);if(getComputedStyle(t).position==="static"&&(t.style.position="relative"),t.appendChild(n),r>0&&typeof n.animate=="function"){const i=n.animate([{opacity:1},{opacity:0}],{duration:r,easing:"ease-in-out"});i.onfinish=()=>n.remove()}else n.remove()}const S2=60,Qa=10,Sl=1.3,M2=12,$2=3,L2=14,C2=10;function T2(t,n,e=$2){if(t==="")return[""];if(t.length*Qa<=n)return[t];const r=t.split(/\s+/).filter(Boolean);if(r.length===0)return null;const a=[];let i="";for(const o of r){if(o.length*Qa>n)return null;const s=i?`${i} ${o}`:o;if(s.length*Qa<=n)i=s;else if(a.push(i),i=o,a.length>=e)return null}return i&&a.push(i),a.length>e?null:a}const O2={year:"%Y",month:"%b %Y",day:"%b %-d, %Y",datetime:"%b %-d, %Y %H:%M"};function N2(t){return typeof t.step=="function"}function ah(t,n){const e=Ci(n);if(t&&t.includes("%")){if(e){const r=bl(t),a=new Map;return n.forEach((i,o)=>a.set(i,e.dates[o])),i=>{if(i instanceof Date)return r(i);const o=a.get(String(i));return o?r(o):String(i)}}return null}if(t)return hr(t)??io(t);if(e){const r=bl(O2[e.granularity]??"%Y-%m-%d"),a=new Map;return n.forEach((i,o)=>a.set(i,e.dates[o])),i=>{if(i instanceof Date)return r(i);const o=a.get(String(i));return o?r(o):String(i)}}return null}function ti(t,n){let e=0;for(const r of t){const i=(n?n(r):r).length*Qa;i>e&&(e=i)}return e}function E2(t,n,e){if(t.length<=1)return t;const r=e?ti(t,e):t.reduce((c,f)=>Math.max(c,f.length),0)*Qa,a=Math.max(16,Math.ceil(r)+8),i=Math.max(2,Math.floor(n/a));if(t.length<=i)return t;const o=Math.ceil(t.length/i),s=t.filter((c,f)=>f%o===0),l=t[t.length-1];return s[s.length-1]!==l&&s.push(l),s}function D2(t,n,e,r){if(t.length<=1||n<=0||e==="horizontal")return!1;if(e==="vertical")return!0;if(Ci(t))return!1;const a=ti(t,r??null),i=n/t.length;return a>i*Sl}function P2(t,n){if(t.length===0)return 0;const e=ti(t,n??null);return Math.ceil(e)+M2}function z2(t){let n=1;for(const e of t)e.length>n&&(n=e.length);return n<=1?0:n*L2+C2}function Ml(t,n,e={},r=24){if(t.length===0||n<=0||e.labelPosition==="off"||e.labelPosition==="inside")return;const a=e.tickFormat?e.tickFormat:ah(e.numberFormat??null,t),i=e.labelRotation??"auto";if(!(i!=="vertical"&&Ci(t)!==null)&&t.length>1){const f=n/t.length*Sl,d=ti(t,a)>f;if(i!=="vertical"&&d){const g=ih(t,f,a);if(g){const v=z2(Array.from(g.values()));return v>r?v:void 0}}}if(!D2(t,n,i,a))return;const l=P2(t,a);return l>r?l:void 0}function ih(t,n,e){const r=new Map;let a=!1;for(const i of t){const o=e?e(i):i,s=T2(o,n);if(s===null)return null;r.set(i,s),s.length>1&&(a=!0)}return a?r:null}function R2(t,n){t.selectAll(".tick").each(function(){const e=ot(this),r=e.datum(),a=r instanceof Date?r.toISOString():String(r),i=n.get(a);if(!i||i.length<=1)return;const o=e.select("text");o.empty()||(o.attr("dy",null).text(null),i.forEach((s,l)=>{o.append("tspan").attr("x",0).attr("dy",l===0?"0.71em":"1em").text(s)}))})}class F2 extends zr{initialize(){this.configDefine("scale",{defaultValue:tn()}),this.configDefine("height",{defaultValue:0}),this.configDefine("tickPosition",{defaultValue:"below"}),this.configDefine("showAxis",{defaultValue:!0}),this.configDefine("showTicks",{defaultValue:!1}),this.configDefine("gridStyle",{defaultValue:"dashed"}),this.configDefine("ticks",{defaultValue:null}),this.configDefine("numberFormat",{defaultValue:null}),this.configDefine("width",{defaultValue:0}),this.configDefine("labels",{defaultValue:[]}),this.configDefine("labelPosition",{defaultValue:"auto"}),this.configDefine("labelRotation",{defaultValue:"auto"}),this.configDefine("zeroY",{defaultValue:null}),this.configDefine("tickFormat",{defaultValue:null});const n=this.base.append("g");this.layer("axis",n,{dataBind:(e,r)=>e.selectAll(".bc-axis-horizontal").data(r),insert:e=>e.append("g").attr("class","bc-axis bc-axis-horizontal"),events:{"merge:transition":e=>{this.applyAxis(e,"merge")},exit:e=>{e.remove()},enter:e=>{this.applyAxis(e,"enter")}}})}applyAxis(n,e){const r=this.config("scale"),a=this.config("scale"),i=this.config("tickPosition"),o=this.config("height"),s=this.config("labelPosition"),l=this.config("labelRotation"),c=this.config("width"),f=this.config("numberFormat"),h=this.config("labels"),d=this.config("tickFormat"),g=i==="above"?_m(r):km(r);this.config("showTicks")||g.tickSizeOuter(0);const v=d||ah(f,h);v&&g.tickFormat(v);const m=N2(a),b=m?a.domain():[],x=m&&l!=="vertical"&&Ci(b)!==null;let A=null,w=!1;if(m&&!x&&b.length>1&&c>0){const $=c/b.length*Sl,L=ti(b,v)>$;l==="vertical"?w=!0:L&&(A=ih(b,$,v),!A&&l==="auto"&&(w=!0))}let S=this.config("ticks");if(!S&&c>0)if(m){if(x){const P=E2(b,c,v);P.length<b.length&&(S=P)}}else{const P=Math.max(2,Math.floor(c/S2));g.ticks(P)}S&&g.tickValues(S);const z=i==="above"?0:o,Y=n.node(),G=e==="merge"?Ja():0;if(e==="merge"){if(!Y)return;G>0?(n.attr("transform",`translate(0,${z})`),n.duration(G).call(g)):ot(Y).attr("transform",`translate(0,${z})`).call(g)}else n.attr("transform",`translate(0,${z})`),n.call(g);const _=G>0?n:Y?ot(Y):n;if(!this.config("showAxis"))_.select(".domain").remove();else if(e==="enter"){const P=this.config("zeroY");if(P!=null){const $=P-(i==="above"?0:o);_.select(".domain").attr("transform",`translate(0,${$})`)}}this.config("showTicks")||_.selectAll(".tick line").remove();const B=s==="auto"?"outside":s;B==="off"?_.selectAll(".tick text").remove():B==="inside"&&_.selectAll(".tick text").attr("y",0).attr("dy","-0.6em"),w&&B!=="off"?_.selectAll(".tick text").attr("transform","rotate(-90)").attr("text-anchor","end").attr("x",i==="above"?9:-9).attr("y",0).attr("dy","0.32em"):_.selectAll(".tick text").attr("transform",null),A&&B!=="off"&&R2(_,A)}postDraw(){const n=this.config("gridStyle"),e=this.config("height"),r=this.base.select(".bc-axis-horizontal").node();r&&n!=="none"&&e>0&&Y2(r,n,e)}}function Y2(t,n,e){var s;const r=((s=t.ownerSVGElement)==null?void 0:s.parentElement)??document.documentElement,i=getComputedStyle(r).getPropertyValue("--bc-grid-color").trim()||"#ccc";ot(t).selectAll(".tick").each(function(){const c=ot(this).append("line").attr("class","bc-grid-line").attr("x1",0).attr("x2",0).attr("y1",0).attr("y2",-e).attr("stroke",i).attr("stroke-width",1);n==="dashed"?c.attr("stroke-dasharray","4,4"):n==="dotted"&&c.attr("stroke-dasharray","1,3")})}const oh=30;class I2 extends zr{initialize(){this.configDefine("scale",{defaultValue:Pe()}),this.configDefine("direction",{defaultValue:An.Left}),this.configDefine("showAxis",{defaultValue:!0}),this.configDefine("showTicks",{defaultValue:!1}),this.configDefine("gridStyle",{defaultValue:he.Dashed}),this.configDefine("gridWidth",{defaultValue:0}),this.configDefine("height",{defaultValue:0}),this.configDefine("ticks",{defaultValue:null}),this.configDefine("numberFormat",{defaultValue:null}),this.configDefine("labelPosition",{defaultValue:Jt.Auto}),this.configDefine("topPadding",{defaultValue:0}),this.configDefine("tickFormat",{defaultValue:null});const n=this.base.append("g");this.layer("axis",n,{dataBind:(e,r)=>e.selectAll(".bc-axis-vertical").data(r),insert:e=>e.append("g").attr("class","bc-axis bc-axis-vertical"),events:{"merge:transition":e=>{const r=this.config("scale"),a=this.config("direction"),i=this.config("showAxis"),o=this.config("showTicks"),s=this.config("labelPosition"),l=this.config("gridWidth"),c=this.config("height"),f=a===An.Right?gf(r):pf(r);o||f.tickSizeOuter(0);const h=this.config("ticks");if(h)f.tickValues(h);else if(c>0){const m=Math.max(2,Math.floor(c/oh));f.ticks(m)}const d=this.config("tickFormat");if(d)f.tickFormat(d);else{const m=this.config("numberFormat"),b=m?hr(m):null;b&&f.tickFormat(b)}const g=Ja(),v=e.node();if(v){g>0?e.duration(g).call(f):ot(v).call(f),i||ot(v).select(".domain").remove(),o||ot(v).selectAll(".tick line").attr("opacity",0);const b=s===Jt.Auto?l>0&&l<400?Jt.Inside:Jt.Outside:s;if(b===Jt.Inside){const x=i?4:0,A=g>0?e.selectAll(".tick text"):ot(v).selectAll(".tick text");a===An.Right?A.attr("x",-x).attr("dy","-0.4em").attr("text-anchor","end"):A.attr("x",x).attr("dy","-0.4em").attr("text-anchor","start")}else b===Jt.Off&&ot(v).selectAll(".tick text").attr("opacity",0)}},exit:e=>{e.remove()},enter:e=>{const r=this.config("scale"),a=this.config("direction"),i=this.config("labelPosition"),o=this.config("gridWidth"),s=this.config("height"),l=this.config("topPadding"),c=a===An.Right?gf(r):pf(r);this.config("showTicks")||c.tickSizeOuter(0);const f=this.config("ticks");if(f)c.tickValues(f);else if(s>0){const b=Math.max(2,Math.floor(s/oh));c.ticks(b)}const h=this.config("tickFormat");if(h)c.tickFormat(h);else{const b=this.config("numberFormat"),x=b?hr(b):null;x&&c.tickFormat(x)}e.call(c);const d=this.config("showAxis"),g=this.config("showTicks");d||e.select(".domain").remove();const m=i===Jt.Auto?o>0&&o<400?Jt.Inside:Jt.Outside:i;if(m===Jt.Inside){const b=d?4:0;if(a===An.Right?e.selectAll(".tick text").attr("x",-b).attr("dy","-0.4em").attr("text-anchor","end"):e.selectAll(".tick text").attr("x",b).attr("dy","-0.4em").attr("text-anchor","start"),g?e.selectAll(".tick line").attr("x2",a===An.Right?-6:6):e.selectAll(".tick line").remove(),l>0&&d){const x=e.select(".domain");if(!x.empty()){const A=x.attr("d"),w=A.replace(/V[\d.]+/,`V${-l}`);w!==A&&x.attr("d",w)}}}else g||e.selectAll(".tick line").remove(),m===Jt.Off&&e.selectAll(".tick text").remove()}}})}postDraw(){const n=this.config("gridStyle"),e=this.config("gridWidth"),r=this.config("direction"),a=this.base.select(".bc-axis-vertical").node();if(a&&n!==he.None&&e>0){const i=r===An.Right?-e:e;H2(a,n,i)}}}function H2(t,n,e){var s;const r=((s=t.ownerSVGElement)==null?void 0:s.parentElement)??document.documentElement,i=getComputedStyle(r).getPropertyValue("--bc-grid-color").trim()||"#ccc";ot(t).selectAll(".tick").each(function(){const c=ot(this).append("line").attr("class","bc-grid-line").attr("x1",0).attr("x2",e).attr("y1",0).attr("y2",0).attr("stroke",i).attr("stroke-width",1);n===he.Dashed?c.attr("stroke-dasharray","4,4"):n===he.Dotted&&c.attr("stroke-dasharray","1,3")})}function B2(t){return typeof t.step=="function"}const ko=new WeakMap;class an{constructor(n){oe(this,"vGroup",null);oe(this,"hGroup",null);oe(this,"vChart",null);oe(this,"hChart",null);oe(this,"container");oe(this,"initialized",!1);this.container=n}static for(n){let e=ko.get(n);return e||(e=new an(n),ko.set(n,e)),e}static clear(n){ko.delete(n)}detach(){var n,e;(n=this.vGroup)!=null&&n.parentNode&&(ot(this.vGroup).interrupt().selectAll("*").interrupt(),this.vGroup.querySelectorAll(".bc-grid-line").forEach(r=>r.remove()),this.vGroup.remove()),(e=this.hGroup)!=null&&e.parentNode&&(ot(this.hGroup).interrupt().selectAll("*").interrupt(),this.hGroup.querySelectorAll(".bc-grid-line").forEach(r=>r.remove()),this.hGroup.remove())}attach(n,e){if(!this.initialized)this.vGroup=document.createElementNS("http://www.w3.org/2000/svg","g"),this.vGroup.setAttribute("class","bc-axis-service-v"),this.hGroup=document.createElementNS("http://www.w3.org/2000/svg","g"),this.hGroup.setAttribute("class","bc-axis-service-h"),n.appendChild(this.vGroup),n.appendChild(this.hGroup),this.vChart=new I2(ot(this.vGroup)),this.hChart=new F2(ot(this.hGroup)),this.initialized=!0;else{for(const a of[this.vGroup,this.hGroup])ot(a).selectAll(".tick").interrupt();n.appendChild(this.vGroup),n.appendChild(this.hGroup);const r=1;if(e&&(Math.abs(e.dx)>=r||Math.abs(e.dy)>=r)){const{dx:a,dy:i}=e;for(const o of[this.vGroup,this.hGroup]){o.setAttribute("transform",`translate(${a},${i})`);const s=Ja();s>0?ot(o).transition().duration(s).attrTween("transform",()=>{const l=De(a,0),c=De(i,0);return f=>`translate(${l(f)},${c(f)})`}):o.removeAttribute("transform")}}}}update(n){const e=n.order??"vertical-first";e==="horizontal-first"?(this.updateHorizontal(n.horizontal),this.updateVertical(n.vertical)):(this.updateVertical(n.vertical),this.updateHorizontal(n.horizontal)),e==="horizontal-first"?this.hGroup&&this.vGroup&&this.hGroup.parentNode&&this.hGroup.parentNode.insertBefore(this.hGroup,this.vGroup):this.vGroup&&this.hGroup&&this.vGroup.parentNode&&this.vGroup.parentNode.insertBefore(this.vGroup,this.hGroup)}updateVertical(n){if(!this.vChart||!this.vGroup)return;if(!n){this.vGroup.style.display="none";return}this.vGroup.style.display="";const e=n.options;this.vChart.config({scale:n.scale,direction:e.direction??"left",showAxis:e.showAxis??!0,showTicks:e.showTicks??!1,gridStyle:e.gridStyle??"dashed",gridWidth:e.gridWidth??0,height:n.height,ticks:e.ticks??null,numberFormat:e.numberFormat??null,labelPosition:e.labelPosition??"auto",topPadding:e.topPadding??0,tickFormat:e.tickFormat??null}),this.vChart.draw([{placeholder:!0}]);const r=this.vGroup.querySelector(".bc-axis-vertical");r&&(e.direction??"left")==="right"?r.setAttribute("transform",`translate(${e.gridWidth??0},0)`):r&&r.removeAttribute("transform")}updateHorizontal(n){if(!this.hChart||!this.hGroup)return;if(!n){this.hGroup.style.display="none";return}this.hGroup.style.display="";const e=n.options,r=n.scale,a=B2(r)?r.domain():[];this.hChart.config({scale:r,height:n.height,tickPosition:e.tickPosition??"below",showAxis:e.showAxis??!0,showTicks:e.showTicks??!1,gridStyle:e.gridStyle??"dashed",ticks:e.ticks??null,numberFormat:e.numberFormat??null,width:e.width??0,labels:a,labelPosition:e.labelPosition??"auto",labelRotation:e.labelRotation??"auto",zeroY:e.zeroY??null,tickFormat:e.tickFormat??null}),this.hChart.draw([{placeholder:!0}])}destroy(){this.detach(),this.vChart=null,this.hChart=null,this.vGroup=null,this.hGroup=null,this.initialized=!1,ko.delete(this.container)}}const $l=Math.min,ba=Math.max,So=Math.round,Hn=t=>({x:t,y:t}),V2={left:"right",right:"left",bottom:"top",top:"bottom"},W2={start:"end",end:"start"};function sh(t,n,e){return ba(t,$l(n,e))}function Mo(t,n){return typeof t=="function"?t(n):t}function Yr(t){return t.split("-")[0]}function $o(t){return t.split("-")[1]}function lh(t){return t==="x"?"y":"x"}function ch(t){return t==="y"?"height":"width"}const G2=new Set(["top","bottom"]);function dr(t){return G2.has(Yr(t))?"y":"x"}function fh(t){return lh(dr(t))}function q2(t,n,e){e===void 0&&(e=!1);const r=$o(t),a=fh(t),i=ch(a);let o=a==="x"?r===(e?"end":"start")?"right":"left":r==="start"?"bottom":"top";return n.reference[i]>n.floating[i]&&(o=Lo(o)),[o,Lo(o)]}function X2(t){const n=Lo(t);return[Ll(t),n,Ll(n)]}function Ll(t){return t.replace(/start|end/g,n=>W2[n])}const uh=["left","right"],hh=["right","left"],U2=["top","bottom"],Z2=["bottom","top"];function j2(t,n,e){switch(t){case"top":case"bottom":return e?n?hh:uh:n?uh:hh;case"left":case"right":return n?U2:Z2;default:return[]}}function K2(t,n,e,r){const a=$o(t);let i=j2(Yr(t),e==="start",r);return a&&(i=i.map(o=>o+"-"+a),n&&(i=i.concat(i.map(Ll)))),i}function Lo(t){return t.replace(/left|right|bottom|top/g,n=>V2[n])}function J2(t){return{top:0,right:0,bottom:0,left:0,...t}}function Q2(t){return typeof t!="number"?J2(t):{top:t,right:t,bottom:t,left:t}}function Co(t){const{x:n,y:e,width:r,height:a}=t;return{width:r,height:a,top:e,left:n,right:n+r,bottom:e+a,x:n,y:e}}function dh(t,n,e){let{reference:r,floating:a}=t;const i=dr(n),o=fh(n),s=ch(o),l=Yr(n),c=i==="y",f=r.x+r.width/2-a.width/2,h=r.y+r.height/2-a.height/2,d=r[s]/2-a[s]/2;let g;switch(l){case"top":g={x:f,y:r.y-a.height};break;case"bottom":g={x:f,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:h};break;case"left":g={x:r.x-a.width,y:h};break;default:g={x:r.x,y:r.y}}switch($o(n)){case"start":g[o]-=d*(e&&c?-1:1);break;case"end":g[o]+=d*(e&&c?-1:1);break}return g}async function tw(t,n){var e;n===void 0&&(n={});const{x:r,y:a,platform:i,rects:o,elements:s,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:f="viewport",elementContext:h="floating",altBoundary:d=!1,padding:g=0}=Mo(n,t),v=Q2(g),b=s[d?h==="floating"?"reference":"floating":h],x=Co(await i.getClippingRect({element:(e=await(i.isElement==null?void 0:i.isElement(b)))==null||e?b:b.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(s.floating)),boundary:c,rootBoundary:f,strategy:l})),A=h==="floating"?{x:r,y:a,width:o.floating.width,height:o.floating.height}:o.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(s.floating)),S=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},z=Co(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:A,offsetParent:w,strategy:l}):A);return{top:(x.top-z.top+v.top)/S.y,bottom:(z.bottom-x.bottom+v.bottom)/S.y,left:(x.left-z.left+v.left)/S.x,right:(z.right-x.right+v.right)/S.x}}const ew=async(t,n,e)=>{const{placement:r="bottom",strategy:a="absolute",middleware:i=[],platform:o}=e,s=i.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(n));let c=await o.getElementRects({reference:t,floating:n,strategy:a}),{x:f,y:h}=dh(c,r,l),d=r,g={},v=0;for(let b=0;b<s.length;b++){var m;const{name:x,fn:A}=s[b],{x:w,y:S,data:z,reset:Y}=await A({x:f,y:h,initialPlacement:r,placement:d,strategy:a,middlewareData:g,rects:c,platform:{...o,detectOverflow:(m=o.detectOverflow)!=null?m:tw},elements:{reference:t,floating:n}});f=w??f,h=S??h,g={...g,[x]:{...g[x],...z}},Y&&v<=50&&(v++,typeof Y=="object"&&(Y.placement&&(d=Y.placement),Y.rects&&(c=Y.rects===!0?await o.getElementRects({reference:t,floating:n,strategy:a}):Y.rects),{x:f,y:h}=dh(c,d,l)),b=-1)}return{x:f,y:h,placement:d,strategy:a,middlewareData:g}},nw=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(n){var e,r;const{placement:a,middlewareData:i,rects:o,initialPlacement:s,platform:l,elements:c}=n,{mainAxis:f=!0,crossAxis:h=!0,fallbackPlacements:d,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:m=!0,...b}=Mo(t,n);if((e=i.arrow)!=null&&e.alignmentOffset)return{};const x=Yr(a),A=dr(s),w=Yr(s)===s,S=await(l.isRTL==null?void 0:l.isRTL(c.floating)),z=d||(w||!m?[Lo(s)]:X2(s)),Y=v!=="none";!d&&Y&&z.push(...K2(s,m,v,S));const G=[s,...z],_=await l.detectOverflow(n,b),B=[];let P=((r=i.flip)==null?void 0:r.overflows)||[];if(f&&B.push(_[x]),h){const M=q2(a,o,S);B.push(_[M[0]],_[M[1]])}if(P=[...P,{placement:a,overflows:B}],!B.every(M=>M<=0)){var $,N;const M=((($=i.flip)==null?void 0:$.index)||0)+1,D=G[M];if(D&&(!(h==="alignment"?A!==dr(D):!1)||P.every(C=>dr(C.placement)===A?C.overflows[0]>0:!0)))return{data:{index:M,overflows:P},reset:{placement:D}};let q=(N=P.filter(V=>V.overflows[0]<=0).sort((V,C)=>V.overflows[1]-C.overflows[1])[0])==null?void 0:N.placement;if(!q)switch(g){case"bestFit":{var L;const V=(L=P.filter(C=>{if(Y){const I=dr(C.placement);return I===A||I==="y"}return!0}).map(C=>[C.placement,C.overflows.filter(I=>I>0).reduce((I,W)=>I+W,0)]).sort((C,I)=>C[1]-I[1])[0])==null?void 0:L[0];V&&(q=V);break}case"initialPlacement":q=s;break}if(a!==q)return{reset:{placement:q}}}return{}}}},rw=new Set(["left","top"]);async function aw(t,n){const{placement:e,platform:r,elements:a}=t,i=await(r.isRTL==null?void 0:r.isRTL(a.floating)),o=Yr(e),s=$o(e),l=dr(e)==="y",c=rw.has(o)?-1:1,f=i&&l?-1:1,h=Mo(n,t);let{mainAxis:d,crossAxis:g,alignmentAxis:v}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return s&&typeof v=="number"&&(g=s==="end"?v*-1:v),l?{x:g*f,y:d*c}:{x:d*c,y:g*f}}const iw=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(n){var e,r;const{x:a,y:i,placement:o,middlewareData:s}=n,l=await aw(n,t);return o===((e=s.offset)==null?void 0:e.placement)&&(r=s.arrow)!=null&&r.alignmentOffset?{}:{x:a+l.x,y:i+l.y,data:{...l,placement:o}}}}},ow=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(n){const{x:e,y:r,placement:a,platform:i}=n,{mainAxis:o=!0,crossAxis:s=!1,limiter:l={fn:x=>{let{x:A,y:w}=x;return{x:A,y:w}}},...c}=Mo(t,n),f={x:e,y:r},h=await i.detectOverflow(n,c),d=dr(Yr(a)),g=lh(d);let v=f[g],m=f[d];if(o){const x=g==="y"?"top":"left",A=g==="y"?"bottom":"right",w=v+h[x],S=v-h[A];v=sh(w,v,S)}if(s){const x=d==="y"?"top":"left",A=d==="y"?"bottom":"right",w=m+h[x],S=m-h[A];m=sh(w,m,S)}const b=l.fn({...n,[g]:v,[d]:m});return{...b,data:{x:b.x-e,y:b.y-r,enabled:{[g]:o,[d]:s}}}}}};function To(){return typeof window<"u"}function ya(t){return gh(t)?(t.nodeName||"").toLowerCase():"#document"}function on(t){var n;return(t==null||(n=t.ownerDocument)==null?void 0:n.defaultView)||window}function Qn(t){var n;return(n=(gh(t)?t.ownerDocument:t.document)||window.document)==null?void 0:n.documentElement}function gh(t){return To()?t instanceof Node||t instanceof on(t).Node:!1}function Tn(t){return To()?t instanceof Element||t instanceof on(t).Element:!1}function Bn(t){return To()?t instanceof HTMLElement||t instanceof on(t).HTMLElement:!1}function ph(t){return!To()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof on(t).ShadowRoot}const sw=new Set(["inline","contents"]);function ei(t){const{overflow:n,overflowX:e,overflowY:r,display:a}=On(t);return/auto|scroll|overlay|hidden|clip/.test(n+r+e)&&!sw.has(a)}const lw=new Set(["table","td","th"]);function cw(t){return lw.has(ya(t))}const fw=[":popover-open",":modal"];function Oo(t){return fw.some(n=>{try{return t.matches(n)}catch{return!1}})}const uw=["transform","translate","scale","rotate","perspective"],hw=["transform","translate","scale","rotate","perspective","filter"],dw=["paint","layout","strict","content"];function Cl(t){const n=Tl(),e=Tn(t)?On(t):t;return uw.some(r=>e[r]?e[r]!=="none":!1)||(e.containerType?e.containerType!=="normal":!1)||!n&&(e.backdropFilter?e.backdropFilter!=="none":!1)||!n&&(e.filter?e.filter!=="none":!1)||hw.some(r=>(e.willChange||"").includes(r))||dw.some(r=>(e.contain||"").includes(r))}function gw(t){let n=gr(t);for(;Bn(n)&&!va(n);){if(Cl(n))return n;if(Oo(n))return null;n=gr(n)}return null}function Tl(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const pw=new Set(["html","body","#document"]);function va(t){return pw.has(ya(t))}function On(t){return on(t).getComputedStyle(t)}function No(t){return Tn(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function gr(t){if(ya(t)==="html")return t;const n=t.assignedSlot||t.parentNode||ph(t)&&t.host||Qn(t);return ph(n)?n.host:n}function mh(t){const n=gr(t);return va(n)?t.ownerDocument?t.ownerDocument.body:t.body:Bn(n)&&ei(n)?n:mh(n)}function bh(t,n,e){var r;n===void 0&&(n=[]);const a=mh(t),i=a===((r=t.ownerDocument)==null?void 0:r.body),o=on(a);return i?(Ol(o),n.concat(o,o.visualViewport||[],ei(a)?a:[],[])):n.concat(a,bh(a,[]))}function Ol(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function yh(t){const n=On(t);let e=parseFloat(n.width)||0,r=parseFloat(n.height)||0;const a=Bn(t),i=a?t.offsetWidth:e,o=a?t.offsetHeight:r,s=So(e)!==i||So(r)!==o;return s&&(e=i,r=o),{width:e,height:r,$:s}}function vh(t){return Tn(t)?t:t.contextElement}function xa(t){const n=vh(t);if(!Bn(n))return Hn(1);const e=n.getBoundingClientRect(),{width:r,height:a,$:i}=yh(n);let o=(i?So(e.width):e.width)/r,s=(i?So(e.height):e.height)/a;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}const mw=Hn(0);function xh(t){const n=on(t);return!Tl()||!n.visualViewport?mw:{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function bw(t,n,e){return n===void 0&&(n=!1),!e||n&&e!==on(t)?!1:n}function ni(t,n,e,r){n===void 0&&(n=!1),e===void 0&&(e=!1);const a=t.getBoundingClientRect(),i=vh(t);let o=Hn(1);n&&(r?Tn(r)&&(o=xa(r)):o=xa(t));const s=bw(i,e,r)?xh(i):Hn(0);let l=(a.left+s.x)/o.x,c=(a.top+s.y)/o.y,f=a.width/o.x,h=a.height/o.y;if(i){const d=on(i),g=r&&Tn(r)?on(r):r;let v=d,m=Ol(v);for(;m&&r&&g!==v;){const b=xa(m),x=m.getBoundingClientRect(),A=On(m),w=x.left+(m.clientLeft+parseFloat(A.paddingLeft))*b.x,S=x.top+(m.clientTop+parseFloat(A.paddingTop))*b.y;l*=b.x,c*=b.y,f*=b.x,h*=b.y,l+=w,c+=S,v=on(m),m=Ol(v)}}return Co({width:f,height:h,x:l,y:c})}function Eo(t,n){const e=No(t).scrollLeft;return n?n.left+e:ni(Qn(t)).left+e}function wh(t,n){const e=t.getBoundingClientRect(),r=e.left+n.scrollLeft-Eo(t,e),a=e.top+n.scrollTop;return{x:r,y:a}}function yw(t){let{elements:n,rect:e,offsetParent:r,strategy:a}=t;const i=a==="fixed",o=Qn(r),s=n?Oo(n.floating):!1;if(r===o||s&&i)return e;let l={scrollLeft:0,scrollTop:0},c=Hn(1);const f=Hn(0),h=Bn(r);if((h||!h&&!i)&&((ya(r)!=="body"||ei(o))&&(l=No(r)),Bn(r))){const g=ni(r);c=xa(r),f.x=g.x+r.clientLeft,f.y=g.y+r.clientTop}const d=o&&!h&&!i?wh(o,l):Hn(0);return{width:e.width*c.x,height:e.height*c.y,x:e.x*c.x-l.scrollLeft*c.x+f.x+d.x,y:e.y*c.y-l.scrollTop*c.y+f.y+d.y}}function vw(t){return Array.from(t.getClientRects())}function xw(t){const n=Qn(t),e=No(t),r=t.ownerDocument.body,a=ba(n.scrollWidth,n.clientWidth,r.scrollWidth,r.clientWidth),i=ba(n.scrollHeight,n.clientHeight,r.scrollHeight,r.clientHeight);let o=-e.scrollLeft+Eo(t);const s=-e.scrollTop;return On(r).direction==="rtl"&&(o+=ba(n.clientWidth,r.clientWidth)-a),{width:a,height:i,x:o,y:s}}const Ah=25;function ww(t,n){const e=on(t),r=Qn(t),a=e.visualViewport;let i=r.clientWidth,o=r.clientHeight,s=0,l=0;if(a){i=a.width,o=a.height;const f=Tl();(!f||f&&n==="fixed")&&(s=a.offsetLeft,l=a.offsetTop)}const c=Eo(r);if(c<=0){const f=r.ownerDocument,h=f.body,d=getComputedStyle(h),g=f.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,v=Math.abs(r.clientWidth-h.clientWidth-g);v<=Ah&&(i-=v)}else c<=Ah&&(i+=c);return{width:i,height:o,x:s,y:l}}const Aw=new Set(["absolute","fixed"]);function _w(t,n){const e=ni(t,!0,n==="fixed"),r=e.top+t.clientTop,a=e.left+t.clientLeft,i=Bn(t)?xa(t):Hn(1),o=t.clientWidth*i.x,s=t.clientHeight*i.y,l=a*i.x,c=r*i.y;return{width:o,height:s,x:l,y:c}}function _h(t,n,e){let r;if(n==="viewport")r=ww(t,e);else if(n==="document")r=xw(Qn(t));else if(Tn(n))r=_w(n,e);else{const a=xh(t);r={x:n.x-a.x,y:n.y-a.y,width:n.width,height:n.height}}return Co(r)}function kh(t,n){const e=gr(t);return e===n||!Tn(e)||va(e)?!1:On(e).position==="fixed"||kh(e,n)}function kw(t,n){const e=n.get(t);if(e)return e;let r=bh(t,[]).filter(s=>Tn(s)&&ya(s)!=="body"),a=null;const i=On(t).position==="fixed";let o=i?gr(t):t;for(;Tn(o)&&!va(o);){const s=On(o),l=Cl(o);!l&&s.position==="fixed"&&(a=null),(i?!l&&!a:!l&&s.position==="static"&&!!a&&Aw.has(a.position)||ei(o)&&!l&&kh(t,o))?r=r.filter(f=>f!==o):a=s,o=gr(o)}return n.set(t,r),r}function Sw(t){let{element:n,boundary:e,rootBoundary:r,strategy:a}=t;const o=[...e==="clippingAncestors"?Oo(n)?[]:kw(n,this._c):[].concat(e),r],s=o[0],l=o.reduce((c,f)=>{const h=_h(n,f,a);return c.top=ba(h.top,c.top),c.right=$l(h.right,c.right),c.bottom=$l(h.bottom,c.bottom),c.left=ba(h.left,c.left),c},_h(n,s,a));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Mw(t){const{width:n,height:e}=yh(t);return{width:n,height:e}}function $w(t,n,e){const r=Bn(n),a=Qn(n),i=e==="fixed",o=ni(t,!0,i,n);let s={scrollLeft:0,scrollTop:0};const l=Hn(0);function c(){l.x=Eo(a)}if(r||!r&&!i)if((ya(n)!=="body"||ei(a))&&(s=No(n)),r){const g=ni(n,!0,i,n);l.x=g.x+n.clientLeft,l.y=g.y+n.clientTop}else a&&c();i&&!r&&a&&c();const f=a&&!r&&!i?wh(a,s):Hn(0),h=o.left+s.scrollLeft-l.x-f.x,d=o.top+s.scrollTop-l.y-f.y;return{x:h,y:d,width:o.width,height:o.height}}function Nl(t){return On(t).position==="static"}function Sh(t,n){if(!Bn(t)||On(t).position==="fixed")return null;if(n)return n(t);let e=t.offsetParent;return Qn(t)===e&&(e=e.ownerDocument.body),e}function Mh(t,n){const e=on(t);if(Oo(t))return e;if(!Bn(t)){let a=gr(t);for(;a&&!va(a);){if(Tn(a)&&!Nl(a))return a;a=gr(a)}return e}let r=Sh(t,n);for(;r&&cw(r)&&Nl(r);)r=Sh(r,n);return r&&va(r)&&Nl(r)&&!Cl(r)?e:r||gw(t)||e}const Lw=async function(t){const n=this.getOffsetParent||Mh,e=this.getDimensions,r=await e(t.floating);return{reference:$w(t.reference,await n(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Cw(t){return On(t).direction==="rtl"}const Tw={convertOffsetParentRelativeRectToViewportRelativeRect:yw,getDocumentElement:Qn,getClippingRect:Sw,getOffsetParent:Mh,getElementRects:Lw,getClientRects:vw,getDimensions:Mw,getScale:xa,isElement:Tn,isRTL:Cw},$h=iw,Lh=ow,Ch=nw,Th=(t,n,e)=>{const r=new Map,a={platform:Tw,...e},i={...a.platform,_c:r};return ew(t,n,{...a,platform:i})},Oh="bc-tooltip";function Ow(){if(document.getElementById("bc-tooltip-styles"))return;const t=document.createElement("style");t.id="bc-tooltip-styles",t.textContent=`
|
|
240
|
+
.${Oh} {
|
|
241
|
+
position: absolute;
|
|
242
|
+
pointer-events: none;
|
|
243
|
+
background: var(--bs-body-bg, #fff);
|
|
244
|
+
color: var(--bs-body-color, #212529);
|
|
245
|
+
border: 1px solid var(--bs-border-color, #dee2e6);
|
|
246
|
+
border-radius: 4px;
|
|
247
|
+
padding: 6px 10px;
|
|
248
|
+
font-size: 13px;
|
|
249
|
+
box-shadow: 0 2px 8px rgba(0,0,0,0.12);
|
|
250
|
+
z-index: 9999;
|
|
251
|
+
display: none;
|
|
252
|
+
}
|
|
253
|
+
`,document.head.appendChild(t)}function Nw(t){const n=t?hr(t):null,e=r=>typeof r=="number"&&n?n(r):String(r);return r=>{if(r&&typeof r=="object"){if("data"in r&&typeof r.data=="number")return e(r.data);const a=r;if("label"in a&&"value"in a)return`${a.label}: ${e(a.value)}`;if("series"in a&&"value"in a)return`${a.series}: ${e(a.value)}`;if("value"in a)return e(a.value)}return String(r)}}function pr(t){const n=(t==null?void 0:t.format)??Nw(t==null?void 0:t.numberFormat);let e=null;const r=[];return{name:"tooltip",install(){Ow(),e=document.createElement("div"),e.className=Oh,document.body.appendChild(e)},postDraw(a){a.base.selectAll(".bc-bar, .bc-dot, .bc-arc").each(function(){const s=this,l=()=>{if(!e)return;const f=ot(s).datum();e.textContent=n(f),e.style.display="block",Th(s,e,{placement:"top",middleware:[$h(8),Ch(),Lh()]}).then(({x:h,y:d})=>{e&&(e.style.left=`${h}px`,e.style.top=`${d}px`)})},c=()=>{e&&(e.style.display="none")};s.addEventListener("mouseenter",l),s.addEventListener("mouseleave",c),r.push(()=>{s.removeEventListener("mouseenter",l),s.removeEventListener("mouseleave",c)})})},destroy(){for(const a of r)a();r.length=0,e&&(e.remove(),e=null)}}}function Ew(t){switch(t){case kn.Solid:return"none";case kn.Dotted:return"2,2";case kn.Dashed:default:return"4,3"}}function Ir(t){const n=(t==null?void 0:t.color)??"#999",e=(t==null?void 0:t.dashArray)??Ew(t==null?void 0:t.style),r=(t==null?void 0:t.direction)??Ae.Both,a=(t==null?void 0:t.orientation)??Ve.Vertical,i=[];return{name:"crosshair",install(){},postDraw(o){const s=o.base,l=(t==null?void 0:t.width)??0,c=(t==null?void 0:t.height)??0,f=r===Ae.Both||r===Ae.Vertical,h=r===Ae.Both||r===Ae.Horizontal,d=f?s.append("line").attr("class","bc-crosshair bc-crosshair-v").attr("y1",0).attr("y2",c).attr("stroke",n).attr("stroke-width",1).style("stroke-dasharray",e).attr("pointer-events","none").style("display","none"):null,g=h?s.append("line").attr("class","bc-crosshair bc-crosshair-h").attr("x1",0).attr("x2",l).attr("stroke",n).attr("stroke-width",1).style("stroke-dasharray",e).attr("pointer-events","none").style("display","none"):null;s.selectAll(".bc-dot, .bc-bar").each(function(){const m=this,b=()=>{const A=ot(m);let w,S;if(m.tagName==="circle")w=parseFloat(A.attr("cx")),S=parseFloat(A.attr("cy"));else{const z=parseFloat(A.attr("x")),Y=parseFloat(A.attr("width")),G=parseFloat(A.attr("y")),_=parseFloat(A.attr("height"));a===Ve.Horizontal?(w=z+Y,S=G+_/2):(w=z+Y/2,S=G)}d&&d.attr("x1",w).attr("x2",w).style("display",null),g&&g.attr("y1",S).attr("y2",S).style("display",null)},x=()=>{d&&d.style("display","none"),g&&g.style("display","none")};m.addEventListener("mouseenter",b),m.addEventListener("mouseleave",x),i.push(()=>{m.removeEventListener("mouseenter",b),m.removeEventListener("mouseleave",x)})})},destroy(){for(const o of i)o();i.length=0}}}function El(t){const n=t.querySelector(".bc-annotation-line");if(!(!n||!n.hasAttribute("data-line-style")))return{style:n.getAttribute("data-line-style"),fromX:parseFloat(n.getAttribute("data-line-from-x")||"0"),fromY:parseFloat(n.getAttribute("data-line-from-y")||"0"),toX:parseFloat(n.getAttribute("data-line-to-x")||"0"),toY:parseFloat(n.getAttribute("data-line-to-y")||"0"),departVertical:n.getAttribute("data-line-depart-vertical")==="true"}}function Xe(t){const n=new Map,e=t.querySelectorAll("g[data-annotation-id]");for(const r of e){const a=r.getAttribute("data-annotation-id"),i=El(r);try{const o=r.getBBox();n.set(a,{id:a,element:r,rect:{x:o.x,y:o.y,width:o.width,height:o.height},line:i})}catch{n.set(a,{id:a,element:r,rect:{x:0,y:0,width:0,height:0},line:i})}}return n}const mr={N:{dx:0,dy:-1},NE:{dx:.707,dy:-.707},E:{dx:1,dy:0},SE:{dx:.707,dy:.707},S:{dx:0,dy:1},SW:{dx:-.707,dy:.707},W:{dx:-1,dy:0},NW:{dx:-.707,dy:-.707},center:{dx:0,dy:0}},Nh={N:{nx:0,ny:-1},NE:{nx:1,ny:-1},E:{nx:1,ny:0},SE:{nx:1,ny:1},S:{nx:0,ny:1},SW:{nx:-1,ny:1},W:{nx:-1,ny:0},NW:{nx:-1,ny:-1},center:{nx:0,ny:0}};ce.N+"",ce.W,ce.NE+"",ce.NW,ce.E+"",ce.N,ce.SE+"",ce.NE,ce.S+"",ce.E,ce.SW+"",ce.SE,ce.W+"",ce.S,ce.NW+"",ce.SW,ce.Center+"",ce.Center;function Dw(t,n){const e=mr[t]??mr.NW;return{dx:e.dx*n,dy:e.dy*n}}function Dl(t){return"step"in t&&!("bandwidth"in t)}function Eh(t){if("bandwidth"in t||Dl(t))return!1;const n=t.domain();return n.length>0&&n[0]instanceof Date}function Dh(t,n){if("bandwidth"in t){const e=t;return(e(n)??0)+e.bandwidth()/2}return Dl(t)?t(n)??0:Eh(t)?t(new Date(n)):t(Number(n))}function Ph(t,n){const e=(n.left+n.right)/2,r=(n.top+n.bottom)/2,a=Nh[t]??Nh.N;return{x:e+a.nx*(n.right-n.left)/2,y:r+a.ny*(n.bottom-n.top)/2}}function Pw(t,n,e,r,a){if("bandwidth"in n){const c=n,f=c(t.label)??0,h=c.bandwidth(),d=e(t.value),g=e(0);return a==="horizontal"?Ph(r,{left:g,right:d,top:f,bottom:f+h}):Ph(r,{left:f,right:f+h,top:d,bottom:g})}const i=Dh(n,t.label),o=e(t.value),s=2,l=mr[r]??mr.N;return{x:i+l.dx*s,y:o+l.dy*s}}function zw(t,n,e,r=4){const a=t.x+t.width/2,i=t.y+t.height/2;if(n===a&&e===i)return{x:a,y:i};const o=n>=t.x&&n<=t.x+t.width,s=e>=t.y&&e<=t.y+t.height,l=[];if(o&&(e<i?l.push({x:a,y:t.y-r,dist:Math.abs(i-e)}):l.push({x:a,y:t.y+t.height+r,dist:Math.abs(e-i)})),s&&(n>a?l.push({x:t.x+t.width+r,y:i,dist:Math.abs(n-a)}):l.push({x:t.x-r,y:i,dist:Math.abs(a-n)})),l.length>0){l.sort((v,m)=>v.dist-m.dist);const{x:d,y:g}=l[0];return{x:d,y:g}}const c=[{x:a,y:t.y-r},{x:a,y:t.y+t.height+r},{x:t.x+t.width+r,y:i},{x:t.x-r,y:i}];let f=c[0],h=(f.x-n)**2+(f.y-e)**2;for(let d=1;d<c.length;d++){const g=(c[d].x-n)**2+(c[d].y-e)**2;g<h&&(f=c[d],h=g)}return f}function Pl(t,n){if(!t)return"bc-arrow";const e=n??"#666",r=`bc-arrow-${e.replace(/[^a-zA-Z0-9]/g,"")}`;return t.querySelector(`#${r}`)||(ot(t).select("defs").empty()?ot(t).append("defs"):ot(t).select("defs")).append("marker").attr("id",r).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",8).attr("markerHeight",8).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M 1 1 L 9 5 L 1 9").attr("fill","none").attr("stroke",e).attr("stroke-width",1.5).attr("stroke-linecap","round").attr("stroke-linejoin","round"),r}function Rw(t){switch(t){case Ti.Dotted:return"2,3";case Ti.Dashed:return"5,4";default:return""}}function Fw(t,n,e,r={}){const a=t.append("circle").attr("class","bc-annotation-circle").attr("cx",n).attr("cy",e).attr("r",r.size??4).attr("fill","none").attr("stroke",r.color??"#666").attr("stroke-width",1.5),i=Rw(r.style??Ti.Solid);i&&a.attr("stroke-dasharray",i)}const zh=1/Math.tan(40*Math.PI/180);function Yw(t,n,e){if(e){const i=n.y>=t.y?1:-1,o=Math.max(Math.abs(n.y-t.y)-Math.abs(n.x-t.x)*zh,12);return{x:t.x,y:t.y+i*o}}const r=n.x>=t.x?1:-1,a=Math.max(Math.abs(n.x-t.x)-Math.abs(n.y-t.y)*zh,12);return{x:t.x+r*a,y:t.y}}function Iw(t,n,e){const r=Yw(t,n,e);return`M ${t.x} ${t.y} L ${r.x} ${r.y} L ${n.x} ${n.y}`}function Hw(t,n,e,r=xe.Direct,a={}){var l;let i;switch(r){case xe.CurveLeft:case xe.CurveRight:{const c=e.x-n.x,f=e.y-n.y,d=Math.sqrt(c*c+f*f)*.8,g=r===xe.CurveRight?1:0;i=`M ${n.x} ${n.y} A ${d} ${d} 0 0 ${g} ${e.x} ${e.y}`;break}case xe.Elbow:{i=Iw(n,e,a.departVertical??!1);break}default:i=`M ${n.x} ${n.y} L ${e.x} ${e.y}`}const o=a.color??"#666",s=t.append("path").attr("class","bc-annotation-line").attr("d",i).attr("fill","none").attr("stroke",o).attr("stroke-width",a.lineWeight??1).attr("pathLength","1").attr("data-line-style",r).attr("data-line-from-x",String(n.x)).attr("data-line-from-y",String(n.y)).attr("data-line-to-x",String(e.x)).attr("data-line-to-y",String(e.y)).attr("data-line-depart-vertical",String(a.departVertical??!1));if(a.showArrow===!0){const c=((l=t.node())==null?void 0:l.ownerSVGElement)??null,f=Pl(c,o);s.attr("marker-end",`url(#${f})`)}}function zl(t,n,e,r,a={}){const i=a.textAnchor??"middle",o=a.textOutline!==!1,s=t.append("text").attr("class","bc-annotation-text").attr("x",e).attr("y",r).attr("text-anchor",i).attr("font-size","12px").attr("fill",a.textColor??"currentColor");o&&s.attr("stroke",a.backgroundColor??"#fff").attr("stroke-width",3).attr("paint-order","stroke");const l=n.split(`
|
|
254
|
+
`);if(l.length>1||a.maxWidth&&a.maxWidth>0)if(a.maxWidth&&a.maxWidth>0)Bw(s,n,a.maxWidth);else for(let c=0;c<l.length;c++)s.append("tspan").attr("x",s.attr("x")).attr("dy",c===0?"0":"1.2em").text(l[c]);else s.text(n)}function Bw(t,n,e){const r=n.split(/\s+/);let a="",i=0;for(const o of r){const s=a?`${a} ${o}`:o;a&&s.length*7>e?(t.append("tspan").attr("x",t.attr("x")).attr("dy",i===0?"0":"1.2em").text(a),a=o,i++):a=s}a&&t.append("tspan").attr("x",t.attr("x")).attr("dy",i===0?"0":"1.2em").text(a)}function Do(t,n,e=of.Center){if("bandwidth"in n){const r=n,a=r(String(t))??0,i=r.bandwidth(),o=r.step()-i;return e==="start"?a-o/2:e==="end"?a+i+o/2:a+i/2}if(Dl(n)){const r=n(String(t))??0,a=n.step()/2;return e==="start"?r-a:e==="end"?r+a:r}return Eh(n)?n(new Date(String(t))):n(Number(t))}function Po(t,n){return n(Number(t))}function Rh(t,n){if(typeof t=="number")return n/2+t/100*n;const e=String(t);return e.endsWith("%")?n/2+parseFloat(e)/100*n:parseFloat(e)||0}function Rl(t,n){if(t==null)return;if(typeof t=="number")return t||void 0;const e=String(t);return e.endsWith("%")?parseFloat(e)/100*n:parseFloat(e)||void 0}function Vw(t){return t<-4?"end":t>4?"start":"middle"}function Fh(t,n,e){if("bandwidth"in n){const r=n;return{x:(r(t.label)??0)+r.bandwidth()/2,y:e(t.value)}}return{x:Dh(n,t.label),y:e(t.value)}}function Yh(t,n,e,r){const a="target"in n?n.target:void 0;if(!a)return;const i=e.data.find(S=>S.label===a);if(!i)return;const o=t.append("g").attr("data-annotation-index",String(r)),s=n.key;s&&o.attr("data-annotation-id",s);const l=n,c=l.anchorDirection??ce.N,f=Pw(i,e.scaleX,e.scaleY,c,e.orientation);let h,d;const g=n;if(g.dx!=null||g.dy!=null){const{x:S,y:z}=Fh(i,e.scaleX,e.scaleY);h=S+(Number(g.dx)||40),d=z+(Number(g.dy)||-40)}else if(g.direction!=null&&g.textOffsetX==null){const{x:S,y:z}=Fh(i,e.scaleX,e.scaleY),Y=g.direction,G=g.anchorDistance??60,_=Dw(Y,G);h=S+_.dx,d=z+_.dy}else h=f.x+(l.textOffsetX??-42),d=f.y+(l.textOffsetY??-42);const v=n.circleColor??"#666",m=n;m.showCircle&&Fw(o,f.x,f.y,{size:m.circleSize,style:m.circleStyle,color:v});const b=Math.max(4,Math.min(h,e.width-4)),x=Math.max(4,Math.min(d,e.height-4));if(n.text){const S=Vw(h-f.x);zl(o,n.text,b,x-4,{textColor:n.textColor,maxWidth:Rl(n.maxWidth,e.width),textAnchor:S,backgroundColor:e.backgroundColor,textOutline:n.textOutline})}if(g.dx!=null||g.dy!=null?l.showLine!==!1:l.showLine===!0||l.showArrow===!0){let S={x:b,y:x},z=!1;const Y=o.select(".bc-annotation-text").node();if(Y)try{const P=Y.getBBox();if(P.width>0&&P.height>0){S=zw(P,f.x,f.y);const $=P.x+P.width/2;z=Math.abs(S.x-$)<1}}catch{}const G=l.showCircle?(l.circleSize??4)+(l.lineTargetDistance??5):l.lineTargetDistance??0;let _=f.x,B=f.y;if(G>0){const P=f.x-S.x,$=f.y-S.y,N=Math.sqrt(P*P+$*$);if(N>0){const L=f.x-P/N*G,M=f.y-$/N*G,D=mr[c]??mr.N;_=Math.abs(D.dx)>.01?L:f.x,B=Math.abs(D.dy)>.01?M:f.y}}Hw(o,S,{x:_,y:B},l.lineStyle??xe.Direct,{showArrow:l.showArrow,lineWeight:l.lineWeight,color:v,departVertical:z})}}function Ih(t,n,e,r,a){if(n.kind!==we.Range)return;const i=t.append("g").attr("data-annotation-index",String(r)),o=n.key;o&&i.attr("data-annotation-id",o);const s=n.orientation??Ve.Vertical;let l,c,f,h;if(e.orientation===Ve.Horizontal)if(s===Ve.Vertical){const d=Do(n.start,e.scaleX,n.startAnchor),g=Do(n.end,e.scaleX,n.endAnchor);c=Math.min(d,g),h=Math.abs(g-d),l=0,f=e.width}else{const d=Po(n.start,e.scaleY),g=Po(n.end,e.scaleY);l=Math.min(d,g),f=Math.abs(g-d),c=0,h=e.height}else if(s===Ve.Vertical){const d=Do(n.start,e.scaleX,n.startAnchor),g=Do(n.end,e.scaleX,n.endAnchor);l=Math.min(d,g),f=Math.abs(g-d),c=0,h=e.height}else{const d=Po(n.start,e.scaleY),g=Po(n.end,e.scaleY);c=Math.min(d,g),h=Math.abs(g-d),l=0,f=e.width}if(i.append("rect").attr("class","bc-annotation-range").attr("x",l).attr("y",c).attr("width",f).attr("height",h).attr("fill",n.bgColor??"#ccc").attr("opacity",(n.bgOpacity??20)/100),n.text){const d=s===Ve.Vertical?f:h,g=Rl(n.maxWidth,e.width)??Math.max(d,50),v=n.direction??"center",m=4,b=mr[v]??mr.center,x=.5+b.dx*.5,A=.5+b.dy*.5,w=Math.max(m,Math.min(l+f*x,e.width-m));let S="middle";x<.25?S="start":x>.75&&(S="end");const Y=c+m+12,G=a?a.append("g").attr("data-annotation-index",String(r)):i;if(zl(G,n.text,w,Y,{textColor:n.textColor,maxWidth:g,textAnchor:S,backgroundColor:e.backgroundColor,textOutline:n.textOutline}),A>.25){const _=G.select(".bc-annotation-text").node();if(_)try{const B=_.getBBox();let P=0;A>.75?P=c+h-m-(B.y+B.height):P=c+h/2-(B.y+B.height/2),Math.abs(P)>.5&&_.setAttribute("transform",`translate(0, ${P})`)}catch{}}}}function Hh(t,n,e,r){if(n.kind!=="free")return;const a=t.append("g").attr("data-annotation-index",String(r)),i=n.key;i&&a.attr("data-annotation-id",i);const o=Rh(n.x,e.width),s=Rh(n.y,e.height);if(n.text){zl(a,n.text,o,s,{textColor:n.textColor,maxWidth:Rl(n.maxWidth,e.width),textAnchor:"middle",backgroundColor:e.backgroundColor,textOutline:n.textOutline});const l=a.select(".bc-annotation-text").node();if(l)try{const c=l.getBBox(),f=s-(c.y+c.height/2);Math.abs(f)>.5&&l.setAttribute("transform",`translate(0, ${f})`)}catch{}}}function Fl(t,n,e,r){const a=e+.45*(t-e);return`M ${t} ${n} L ${a} ${n} L ${e} ${r}`}function Ww(t,n){const e=t.hasAttribute("marker-end"),r=El(t.parentElement);if(e&&r){const a=ot(t),i=t.getAttribute("d"),o=`M ${r.fromX} ${r.fromY} L ${r.fromX} ${r.fromY}`;if(a.attr("d",o),r.style===xe.Elbow){const s={tipX:r.toX,tipY:r.toY,calloutX:r.fromX,calloutY:r.fromY},l={tipX:r.fromX,tipY:r.fromY,calloutX:r.fromX,calloutY:r.fromY};a.transition().duration(n).ease(Qi).attrTween("d",()=>{const c=Ia(l,s);return f=>{const h=c(f);return Fl(h.calloutX,h.calloutY,h.tipX,h.tipY)}})}else if(r.style===xe.CurveLeft||r.style===xe.CurveRight){const s={x:r.fromX,y:r.fromY},l={x:r.toX,y:r.toY},c=l.x-s.x,f=l.y-s.y,h=Math.sqrt(c*c+f*f),d=h*.8,g=r.style===xe.CurveRight?1:0,v=h/2,m=v<d?Math.sqrt(d*d-v*v):0,b=(s.x+l.x)/2,x=(s.y+l.y)/2,A=h>0?-f/h:0,w=h>0?c/h:0,S=g===1?1:-1,z=b+S*m*A,Y=x+S*m*w,G=Math.atan2(s.y-Y,s.x-z);let B=Math.atan2(l.y-Y,l.x-z)-G;g===1&&B<=0&&(B+=2*Math.PI),g===0&&B>=0&&(B-=2*Math.PI),a.transition().duration(n).ease(Qi).attrTween("d",()=>P=>{if(P>=.98)return i;const $=G+P*B,N=z+d*Math.cos($),L=Y+d*Math.sin($);return`M ${s.x} ${s.y} A ${d} ${d} 0 0 ${g} ${N} ${L}`})}else a.transition().duration(n).ease(Qi).attrTween("d",()=>{const s=De(r.fromX,r.toX),l=De(r.fromY,r.toY);return c=>`M ${r.fromX} ${r.fromY} L ${s(c)} ${l(c)}`})}else t.setAttribute("stroke-dasharray","1"),t.setAttribute("stroke-dashoffset","1"),ot(t).transition().duration(n).ease(Qi).attr("stroke-dashoffset","0").on("end",()=>{t.removeAttribute("stroke-dasharray"),t.removeAttribute("stroke-dashoffset")})}const zo=1;function Gw(t,n){return t.style!==n.style||t.departVertical!==n.departVertical?!1:Math.abs(t.fromX-n.fromX)<=zo&&Math.abs(t.fromY-n.fromY)<=zo&&Math.abs(t.toX-n.toX)<=zo&&Math.abs(t.toY-n.toY)<=zo}function qw(t,n,e){const r=El(t.parentElement);if(!r||Gw(n,r))return;const a=ot(t);if(n.style===xe.Elbow&&r.style===xe.Elbow){const i={tipX:n.toX,tipY:n.toY,calloutX:n.fromX,calloutY:n.fromY},o={tipX:r.toX,tipY:r.toY,calloutX:r.fromX,calloutY:r.fromY};a.attr("d",Fl(i.calloutX,i.calloutY,i.tipX,i.tipY)),a.transition().duration(e).ease(to).attrTween("d",()=>{const s=Ia(i,o);return l=>{const c=s(l);return Fl(c.calloutX,c.calloutY,c.tipX,c.tipY)}})}else{const i={x:n.fromX,y:n.fromY},o={x:n.toX,y:n.toY},s={x:r.fromX,y:r.fromY},l={x:r.toX,y:r.toY},c=t.getAttribute("d"),f=`M ${i.x} ${i.y} L ${o.x} ${o.y}`;a.attr("d",f),a.transition().duration(e).ease(to).attrTween("d",()=>{const h=Ia(i,s),d=Ia(o,l);return g=>{if(g>=.98)return c;const v=h(g),m=d(g);if(r.style===xe.Direct||n.style===xe.Direct)return`M ${v.x} ${v.y} L ${m.x} ${m.y}`;const b=m.x-v.x,x=m.y-v.y,w=Math.sqrt(b*b+x*x)*.8,S=r.style===xe.CurveRight?1:0;return`M ${v.x} ${v.y} A ${w} ${w} 0 0 ${S} ${m.x} ${m.y}`}})}}function Bh(t,n,e,r){if(r<=0)return;const a=[...t.querySelectorAll("g[data-annotation-id]"),...n.querySelectorAll("g[data-annotation-id]")],i=new Set;for(const o of a){const s=o.getAttribute("data-annotation-id");i.add(s);const l=e.get(s);if(l){const c=o.querySelector(".bc-annotation-line");c&&l.line&&qw(c,l.line,r);try{const f=o.getBBox(),h=l.rect.x-f.x,d=l.rect.y-f.y;if(Math.abs(h)>.5||Math.abs(d)>.5){const g=o.querySelectorAll(".bc-annotation-text, .bc-annotation-circle");for(const v of g){const m=v;m.style.transition="none",m.setAttribute("transform",`translate(${h}, ${d})`),m.getBoundingClientRect(),m.style.transition=`transform ${r}ms ease`,m.setAttribute("transform","translate(0, 0)")}}}catch{}}else{const c=o.querySelector(".bc-annotation-line");c&&Ww(c,r);const f=o.querySelectorAll(".bc-annotation-text, .bc-annotation-circle");for(const h of f){const d=h;d.style.opacity="0",d.getBoundingClientRect(),d.style.transition=`opacity ${r}ms ease`,d.style.opacity="1"}}}for(const[o,s]of e)if(!i.has(o)){const l=s.element.cloneNode(!0);t.appendChild(l),l.style.opacity="1",l.getBoundingClientRect(),l.style.transition=`opacity ${r}ms ease`,l.style.opacity="0",setTimeout(()=>l.remove(),r)}}function Vh(t){if(!t)return;const n=parseFloat(t.getAttribute("width")||"0"),e=parseFloat(t.getAttribute("height")||"0");if(!n||!e)return;const r=t.getBBox();if(r.width===0&&r.height===0)return;const a=8,i=r.x,o=r.y,s=r.x+r.width,l=r.y+r.height,c=i<0?i-a:0,f=o<0?o-a:0,h=s>n?s+a:n,d=l>e?l+a:e;(c<0||f<0||h>n||d>e)&&ot(t).attr("viewBox",`${c} ${f} ${h-c} ${d-f}`).attr("preserveAspectRatio","xMidYMid meet")}function Ro(t,n,e){const r=t.ownerSVGElement??t;ot(r).style("overflow","visible"),Pl(r);const a=ot(t);let i;if(e.transition)if(e.priorAnnotations&&e.priorAnnotations.size>0)i=e.priorAnnotations;else{const l=t.querySelector(".bc-annotations"),c=t.querySelector(".bc-annotations-range");if(l||c){if(i=new Map,l)for(const[f,h]of Xe(l))i.set(f,h);if(c)for(const[f,h]of Xe(c))i.set(f,h)}}t.querySelectorAll(".bc-annotations, .bc-annotations-range").forEach(l=>l.remove());const o=a.insert("g",":first-child").attr("class","bc-annotations-range"),s=a.append("g").attr("class","bc-annotations").attr("data-ctx-width",String(e.width)).attr("data-ctx-height",String(e.height));for(let l=0;l<n.length;l++){const c=n[l];switch(c.kind??we.Point){case we.Point:Yh(s,c,e,l);break;case we.Range:Ih(o,c,e,l,s);break;case we.Free:Hh(s,c,e,l);break}}if(e.transition){const l=Fr(ma);Bh(s.node(),o.node(),i??new Map,l)}Vh(r)}function wa(t,n){return{name:"annotations",install(){},postDraw(e){var d;const r=e.base,a=((d=r.node())==null?void 0:d.ownerSVGElement)??r.node();a&&ot(a).style("overflow","visible"),Pl(a);const i=r.node(),o=i==null?void 0:i.parentNode,s=o&&o!==a?ot(o):r,l=s.node();let c;if(n.transition){if(n.priorAnnotations&&n.priorAnnotations.size>0)c=n.priorAnnotations;else if(l){const g=l.querySelector(".bc-annotations"),v=l.querySelector(".bc-annotations-range");if(g||v){if(c=new Map,g)for(const[m,b]of Xe(g))c.set(m,b);if(v)for(const[m,b]of Xe(v))c.set(m,b)}}}l&&l.querySelectorAll(".bc-annotations, .bc-annotations-range").forEach(g=>g.remove());const f=s.insert("g",":first-child").attr("class","bc-annotations-range"),h=s.append("g").attr("class","bc-annotations").attr("data-ctx-width",String(n.width)).attr("data-ctx-height",String(n.height));for(let g=0;g<t.length;g++){const v=t[g];switch(v.kind??we.Point){case we.Point:Yh(h,v,n,g);break;case we.Range:Ih(f,v,n,g,h);break;case we.Free:Hh(h,v,n,g);break}}if(n.transition){const g=Fr(ma);Bh(h.node(),f.node(),c??new Map,g)}Vh(a)}}}function Vn(t){return new Map((t??[]).map(n=>[n.target,n.color]))}const Wh=new WeakMap;function mn(t){return Wh.get(t)}function bn(t,n){Wh.set(t,n)}let Xw=0;const Gh=new WeakMap;function Nn(t,n,e,r){let a=Gh.get(n);a||(a=new Map,Gh.set(n,a));let i=a.get(e);i||(i=`bc-clip-${++Xw}`,a.set(e,i));const o=ot(t).select("defs").empty()?ot(t).append("defs"):ot(t).select("defs"),s=o.select(`#${i}`);return s.empty()?o.append("clipPath").attr("id",i).append("rect").attr("x",r.x).attr("y",r.y).attr("width",r.width).attr("height",r.height):s.select("rect").attr("x",r.x).attr("y",r.y).attr("width",r.width).attr("height",r.height),i}class Uw extends zr{initialize(){}}function Hr(t){return new Uw(t)}const Fo="bc-scene",Zw=500,qh=new Set,Yl=new WeakMap;function me(t){let n=Yl.get(t);return n||(n=new Kw(t),Yl.set(t,n)),n}function jw(t){Yl.delete(t)}class Kw{constructor(n){oe(this,"container");oe(this,"_state","idle");oe(this,"_transition",null);oe(this,"_buffer",[]);this.container=n}register(n){this._buffer.push(n)}get state(){return this._state}get activeTransition(){return this._transition}beginCommit(){(this._state==="committing"||this._state==="animating")&&this.interrupt(),this._state="committing"}commit(n={}){if(this._state!=="committing"){console.warn(`[blueprint-chart] commit() called from state '${this._state}' — call beginCommit() first; ignored.`);return}const e=n.mode??"transform";if(e!=="transform"){qh.has(e)||(qh.add(e),console.warn(`[blueprint-chart] transition mode '${e}' is not yet implemented; falling back to snap.`));const s=this._buffer;this._buffer=[],this._state="animating";for(const l of s)try{l()}catch(c){console.warn("[blueprint-chart] feature flush failed:",c)}this._state="idle";return}const r=n.duration??Zw,a=this.effectiveDuration(r),i=this._buffer;if(this._buffer=[],a<=0){this._state="animating";for(const s of i)try{s()}catch(l){console.warn("[blueprint-chart] feature flush failed:",l)}this._state="idle";return}this._state="animating";const o=eu(Fo).duration(a).ease(to);this._transition=o;for(const s of i)try{s()}catch(l){console.warn("[blueprint-chart] feature flush failed:",l)}o.on("end",()=>{this._transition===o&&(this._transition=null,this._state="idle")}),o.on("interrupt",()=>{this._transition===o&&(this._transition=null,this._state="idle")})}effectiveDuration(n){return n<=0?0:typeof window>"u"||typeof window.matchMedia!="function"?n:window.matchMedia("(prefers-reduced-motion: reduce)").matches?0:n}interrupt(){this._buffer=[],this._transition=null,ot(this.container).interrupt(Fo),ot(this.container).selectAll("*").interrupt(Fo),this._state="idle"}run(n,e={}){this.beginCommit();try{n()}catch(r){console.warn("[blueprint-chart] scene-transition commit failed:",r),this._state="idle";return}this.commit(e)}destroy(){this.interrupt(),jw(this.container)}}function Jw(t,n){const e=new Map;return t.querySelectorAll(`[data-bc-role="${n}"]`).forEach(a=>{const i=a.getAttribute("data-bc-key");i!=null&&e.set(i,a)}),e}function Qw(t,n){return t.tagName===n.tagName}function Xh(t,n){ot(t).interrupt(Fo);const e={};for(const r of n){const a=t.getAttribute(r);a!==null&&(e[r]=a)}return e}function Uh(t,n){const e=Zh(t),r=Zh(n);if(e.skeleton!==r.skeleton||e.nums.length!==r.nums.length)return s=>s<.5?t:n;const{skeleton:a,nums:i}=e,{nums:o}=r;return s=>{if(s<=0)return t;if(s>=1)return n;let l=0;return a.replace(/#/g,()=>{const c=i[l]+(o[l]-i[l])*s;return l++,tA(c)})}}function Zh(t){const n=[];return{skeleton:t.replace(/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,r=>(n.push(parseFloat(r)),"#")),nums:n}}function tA(t){const n=Math.round(t*1e3)/1e3;return Object.is(n,-0)?"0":String(n)}const eA={opacity:0},nA=new Set(["d","transform"]),rA=new Set(["stroke-dasharray"]);function ge(t,n){if(t.state==="idle"||t.state==="animating"){aA(n);return}t.register(()=>iA(t,n))}function aA(t){const e=ot(t.parent).selectAll(t.selector).data(t.data,i=>t.key(i));e.exit().remove();const r=t.insert(e.enter());jh(r,t),r.merge(e).each(function(i){ri(this,t.attrs(i))})}function iA(t,n){const e=t.activeTransition,a=ot(n.parent).selectAll(n.selector).data(n.data,c=>n.key(c)),i=oA(n),o=a.exit();e?o.each(function(){const c=this,f=ot(c).datum(),h=n.exitTo?n.exitTo(f):eA;Yo(c,h,e).on("end.featureJoin-exit",()=>{var d;return(d=c.parentNode)==null?void 0:d.removeChild(c)})}):o.remove();const s=Jw(t.container,n.role),l=n.insert(a.enter());jh(l,n),l.each(function(c){const f=this,h=n.attrs(c);if(e){const d=s.get(Kh(n.key(c)));if(d&&Qw(d,f)){const v=Xh(d,i);ri(f,v),Yo(f,h,e);return}const g=n.enterFrom?n.enterFrom(c):h;ri(f,g),Yo(f,h,e)}else ri(f,h)}),a.each(function(c){const f=this,h=n.attrs(c);e?(Xh(f,i),Yo(f,h,e)):ri(f,h)})}function jh(t,n){t.attr("data-bc-role",n.role),t.attr("data-bc-key",e=>Kh(n.key(e)))}function Kh(t){return t.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,"␟")}function oA(t){return t.data.length===0?[]:Object.keys(t.attrs(t.data[0]))}function ri(t,n){for(const[e,r]of Object.entries(n))t.setAttribute(e,String(r))}function Yo(t,n,e){const r=ot(t).transition(e);for(const[a,i]of Object.entries(n))if(nA.has(a)){const o=String(i);r.attrTween(a,function(){const s=this.getAttribute(a)??o;return Uh(s,o)})}else rA.has(a)?t.setAttribute(a,String(i)):r.attr(a,String(i));return r}function En(t,n){if(!n.active||!n.from)return;const e=n.svg.querySelector(`#${n.clipId} rect`);sA(t,{group:n.group,clipRect:e,from:n.from,to:n.to})}function sA(t,n){const{group:e,clipRect:r,from:a,to:i}=n,o=`translate(${i.left},${i.top})`,s=`translate(${a.left},${a.top})`;t.register(()=>{const l=t.activeTransition;if(!l){e.setAttribute("transform",o),r&&(r.setAttribute("width",String(i.width)),r.setAttribute("height",String(i.height)));return}e.setAttribute("transform",s),ot(e).transition(l).attrTween("transform",function(){const c=this.getAttribute("transform")??s;return Uh(c,o)}),r&&(r.setAttribute("width",String(a.width)),r.setAttribute("height",String(a.height)),ot(r).transition(l).attr("width",i.width).attr("height",i.height))})}const lA=.35;function Aa(t){return new Set((t??[]).map(n=>n.target))}function Ue(t,n,e=1){return t.size===0||t.has(n)?e:lA}const cA=11,fA=6.2,Jh=cA,uA=8,hA=4,dA=14;function gA(t){return t.length*fA}function Br(t){const n=gA(t.text);return t.placement==="inside"?t.orientation==="horizontal"?n<=t.barWidth-uA&&Jh<=t.barHeight:Jh<=t.barHeight-hA&&n<=t.barWidth:(t.orientation==="vertical"?t.barWidth:t.barHeight)>=dA}const _a=["#4e79a7"],Qh=13;function td(t,n,e={},r=!1){var X,O,ht,mt,vt,Tt,Ht,Ft,Yt,Ut,Gt,dt,$t,U;pn(r);let a=null,i,o,s,l=[];const c=an.for(t);if(r){const T=mn(t);o=T==null?void 0:T.margin,s=T==null?void 0:T.plotRect,c.detach(),(T==null?void 0:T.chartType)==="bar-vertical"?l=Array.from(t.querySelectorAll(".bc-frame .bc-bar")):T&&(a=nn(t)),i=new Map;for(const F of t.querySelectorAll(".bc-frame .bc-annotations, .bc-frame .bc-annotations-range"))for(const[E,at]of Xe(F))i.set(E,at);t.replaceChildren()}const{body:f}=dn(t,e.frame),h=qe(f).width,d=e.categoryLabelLine===!0,g=Rr(n.values,(X=e.verticalAxis)==null?void 0:X.range,(O=e.verticalAxis)==null?void 0:O.numberFormat,(ht=e.verticalAxis)==null?void 0:ht.scaleType),v=d?Jt.Off:(mt=e.horizontalAxis)==null?void 0:mt.labelPosition,m=Cn(h,(vt=e.verticalAxis)==null?void 0:vt.labelPosition,v,(Tt=e.verticalAxis)==null?void 0:Tt.direction,g);if(!d){const T=Math.max(0,h-(m.left??50)-(m.right??20)),F=Ml(n.labels,T,e.horizontalAxis);F!==void 0&&(m.bottom=F)}const{chartArea:b,width:x,height:A,margin:w}=gn(f,m),z=A-(d?Qh:0),Y=Ln(o,w),G={left:w.left,top:w.top,width:x,height:z},_=bA(n,e),B=_.map(T=>({label:T,value:n.values[n.labels.indexOf(T)]})),P=e.swapLabelValue===!0,$=e.waterfall===!0,N=[];if($){let T=0;for(const F of B){const E=T;T+=F.value,N.push({label:F.label,value:F.value,y0:E,y1:T,isTotal:!1})}e.waterfallTotal&&N.push({label:"Total",value:T,y0:0,y1:T,isTotal:!0})}const L=$?N.map(T=>T.label):_,M=tn().domain(L).range([0,x]).padding(Sr(e.barGap)),D=((Ht=e.verticalAxis)==null?void 0:Ht.scaleType)==="log",q=$?N.flatMap(T=>[T.y0,T.y1]):B.map(T=>T.value);let[V,C]=oa(q,(Ft=e.verticalAxis)==null?void 0:Ft.range,(Yt=e.verticalAxis)==null?void 0:Yt.scaleType);if(e.valueLabels&&V<0&&((Gt=(Ut=e.verticalAxis)==null?void 0:Ut.range)==null?void 0:Gt.min)==null){const T=C-V;V-=T*.1}const I=D?cr().domain([V,C]).nice().range([z,0]):Pe().domain([V,C]).nice().range([z,0]);c.attach(b,Y);const W=P&&e.valueLabels&&!$?(()=>{const T=new Map(B.map(F=>[F.label,F.value]));return{...e.horizontalAxis,width:x,tickFormat:F=>String(T.get(F)??F)}})():{...e.horizontalAxis,width:x},it=d?{...W,labelPosition:Jt.Off}:W;c.update({vertical:{scale:I,height:A,options:{...e.verticalAxis,gridWidth:x,topPadding:w.top}},horizontal:{scale:M,height:A,options:it}}),!D&&V<0&&C>0&&ot(b).append("line").attr("class","bc-zero-baseline").attr("x1",0).attr("x2",x).attr("y1",I(0)).attr("y2",I(0)).attr("stroke","#666").attr("stroke-width",1);const rt=Vn(e.colorizes),ct=new Set((e.highlights??[]).map(T=>T.target)),pt=b.ownerSVGElement,xt=Nn(pt,t,"bars",{x:0,y:0,width:x,height:z}),yt=ot(pt).select("defs"),bt=xt.replace(/^bc-clip-/,""),kt=ot(b).append("g").attr("clip-path",`url(#${xt})`);if(e.barBackground){const T=(e.colors??_a)[0],F=$?L:B.map(E=>E.label);kt.selectAll(".bc-bar-bg").data(F,E=>E).enter().append("rect").attr("class","bc-bar-bg").attr("x",E=>M(E)??0).attr("y",0).attr("width",M.bandwidth()).attr("height",z).attr("fill",T).attr("opacity",.18)}const j=$?L:B.map(T=>T.label);if(e.barSeparators&&j.length>1){const T=M.step();for(let F=1;F<j.length;F++){const E=(M(j[F-1])??0)+M.bandwidth()+(T-M.bandwidth())/2;kt.append("line").attr("class","bc-bar-separator").attr("x1",E).attr("x2",E).attr("y1",0).attr("y2",z).attr("stroke","currentColor").attr("opacity",.15)}}if(!$&&e.connectedColumns&&B.length>1){const T=e.colors??_a,F=e.connectionsOpacity??.15;for(let E=0;E<B.length-1;E++){const at=B[E],wt=B[E+1];if(at.value==null||wt.value==null||Number.isNaN(at.value)||Number.isNaN(wt.value)||at.value===0||wt.value===0)continue;const Ct=(M(at.label)??0)+M.bandwidth(),st=M(wt.label)??0,Et=Math.min(I(0),I(at.value)),Nt=Math.min(I(0),I(wt.value)),tt=I(0),St=rt.get(at.label)??T[0],Dt=rt.get(wt.label)??T[0];let Pt;if(St===Dt)Pt=St;else{const Zt=`bc-conn-grad-${bt}-${E}`,ae=yt.append("linearGradient").attr("id",Zt).attr("x1","0%").attr("x2","100%").attr("y1","0%").attr("y2","0%");ae.append("stop").attr("offset","0%").attr("stop-color",St),ae.append("stop").attr("offset","100%").attr("stop-color",Dt),Pt=`url(#${Zt})`}kt.append("polygon").attr("class","bc-bar-connection").attr("points",`${Ct},${Et} ${st},${Nt} ${st},${tt} ${Ct},${tt}`).attr("fill",Pt).attr("opacity",F).attr("pointer-events","none")}}const J=ot(b).append("g");if($){const T=e.colors??_a,F="#333";if(e.connectedColumns&&N.length>1){const E=e.colors??_a,at=e.connectionsOpacity??.15;for(let wt=0;wt<N.length-1;wt++){const Ct=N[wt],st=N[wt+1];if(st.isTotal||Ct.value==null||st.value==null||Number.isNaN(Ct.value)||Number.isNaN(st.value)||Ct.value===0||st.value===0)continue;const Et=(M(Ct.label)??0)+M.bandwidth(),Nt=M(st.label)??0,tt=I(Ct.y1),St=I(st.y1),Dt=I(Ct.y0),Pt=I(st.y0),Zt=rt.get(Ct.label)??E[0],ae=rt.get(st.label)??E[0];let $e;if(Zt===ae)$e=Zt;else{const Ze=`bc-conn-grad-${bt}-${wt}`,Le=yt.append("linearGradient").attr("id",Ze).attr("x1","0%").attr("x2","100%").attr("y1","0%").attr("y2","0%");Le.append("stop").attr("offset","0%").attr("stop-color",Zt),Le.append("stop").attr("offset","100%").attr("stop-color",ae),$e=`url(#${Ze})`}kt.append("polygon").attr("class","bc-bar-connection").attr("points",`${Et},${tt} ${Nt},${St} ${Nt},${Pt} ${Et},${Dt}`).attr("fill",$e).attr("opacity",at).attr("pointer-events","none")}}for(let E=0;E<N.length-1;E++){const at=N[E],wt=N[E+1];if(wt.isTotal)break;kt.append("line").attr("class","bc-waterfall-connector").attr("x1",(M(at.label)??0)+M.bandwidth()).attr("x2",M(wt.label)??0).attr("y1",I(at.y1)).attr("y2",I(at.y1)).attr("stroke","currentColor").attr("stroke-dasharray","2,2").attr("opacity",.3)}if(kt.selectAll(".bc-bar").data(N,E=>E.label).enter().append("rect").attr("class","bc-bar").attr("x",E=>M(E.label)??0).attr("y",E=>Math.min(I(E.y0),I(E.y1))).attr("width",M.bandwidth()).attr("height",E=>Math.abs(I(E.y0)-I(E.y1))).attr("fill",E=>E.isTotal?F:rt.get(E.label)??T[0]).attr("opacity",E=>ct.size>0?Ue(ct,E.label):null),e.valueLabels){const E=e.valueLabelPosition??It.Auto,at=hr(((dt=e.verticalAxis)==null?void 0:dt.numberFormat)??""),wt=Ct=>at?at(Ct):String(Ct);J.selectAll(".bc-value-label").data(N,Ct=>Ct.label).enter().append("text").attr("class","bc-value-label").attr("font-size","11px").attr("x",Ct=>(M(Ct.label)??0)+M.bandwidth()/2).attr("y",Ct=>{const st=Math.min(I(Ct.y0),I(Ct.y1)),Et=Math.abs(I(Ct.y0)-I(Ct.y1));return E===It.Inside?st+Et/2:st-4}).attr("text-anchor","middle").attr("dominant-baseline",E===It.Inside?"central":"auto").attr("fill",Ct=>E===It.Inside?hn(Ct.isTotal?F:rt.get(Ct.label)??T[0]):"currentColor").text(Ct=>P?Ct.label:wt(Ct.isTotal?Ct.y1:Ct.value))}}else{const T=me(t),F=kt.append("g").node();if(r)for(const wt of l)F.appendChild(wt);ge(T,{role:"mark-per-category",parent:F,selector:".bc-bar",data:B,key:wt=>wt.label,insert:wt=>wt.append("rect").attr("class","bc-bar"),attrs:wt=>({x:M(wt.label)??0,y:Math.min(I(0),I(wt.value)),width:M.bandwidth(),height:Math.abs(I(wt.value)-I(0)),fill:rt.get(wt.label)??(e.colors??_a)[0],opacity:Ue(ct,wt.label)})}),En(T,{svg:pt,clipId:xt,group:b,from:s,to:G,active:r&&l.length>0});const E=Hr(kt);e.tooltips&&E.use(pr({numberFormat:($t=e.verticalAxis)==null?void 0:$t.numberFormat})),e.crosshair&&E.use(Ir({width:x,height:z,direction:e.crosshairDirection,style:e.crosshairStyle,color:e.crosshairColor})),(U=e.annotations)!=null&&U.length&&E.use(wa(e.annotations,{scaleX:M,scaleY:I,data:B,width:x,height:z,backgroundColor:Be(t),transition:r,priorAnnotations:i}));const at=()=>E.draw(B);T.state==="committing"?T.register(at):at(),e.valueLabels&&mA(J,B,M,I,{position:e.valueLabelPosition,colorOverrides:rt,colors:e.colors??_a,swapLabelValue:P,percent:e.valueLabels==="percent",total:hf(B,wt=>wt.value)})}if(d){const T=ot(b).append("g").attr("class","bc-category-labels");for(const F of L)T.append("text").attr("class","bc-category-label").attr("x",(M(F)??0)+M.bandwidth()/2).attr("y",z+Qh/2).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size","10px").attr("font-weight","600").attr("fill","currentColor").text(F)}bn(t,{chartType:"bar-vertical",margin:w,plotRect:G}),a&&(en(kt.node()),rn(t,a))}function pA(t,n,e,r){const a=Math.abs(e(t.value)-e(0)),i=r===It.Inside,o=(n(t.label)??0)+n.bandwidth()/2,s="middle";let l,c;return t.value<0?i?(l=e(t.value)-a/2,c="central"):(l=e(t.value)+4,c="hanging"):i?(l=e(t.value)+a/2,c="central"):(l=e(t.value)-4,c="auto"),{tx:o,ty:l,anchor:s,baseline:c,isInside:i}}function mA(t,n,e,r,a){const i=a.position??It.Auto,o=d=>a.swapLabelValue?d.label:a.percent&&a.total!==void 0?xo(d.value,a.total):String(d.value);let s=t.select(".bc-value-label-group");s.empty()&&(s=t.append("g").attr("class","bc-value-label-group"));const l=t.node().ownerSVGElement,c=l==null?void 0:l.parentElement,f=me(c),h=n.filter(d=>Br({text:o(d),placement:i===It.Inside?"inside":"outside",orientation:"vertical",barWidth:e.bandwidth(),barHeight:Math.abs(r(d.value)-r(0))}));ge(f,{role:"value-label",parent:s.node(),selector:".bc-value-label",data:h,key:d=>d.label,insert:d=>d.append("text").attr("class","bc-value-label").attr("font-size","11px"),attrs:d=>{const g=pA(d,e,r,i);return{x:g.tx,y:g.ty,"text-anchor":g.anchor,"dominant-baseline":g.baseline,fill:g.isInside?hn(a.colorOverrides.get(d.label)??a.colors[0]):"currentColor"}}}),s.selectAll(".bc-value-label").data(h,d=>d.label).text(o)}function bA(t,n){const e=t.labels.map((r,a)=>({label:r,value:t.values[a]}));return n.sort===pe.Ascending?e.sort((r,a)=>r.value-a.value):n.sort===pe.Descending&&e.sort((r,a)=>a.value-r.value),e.map(r=>r.label)}const ka=["#4e79a7"],ed=13,yA="11px sans-serif",Il=4;function Hl(t){try{const e=document.createElement("canvas").getContext("2d");if(e)return e.font=yA,Math.ceil(e.measureText(t).width)}catch{}return t.length*6.5}function nd(t,n,e={},r=!1){var X,O,ht,mt,vt,Tt,Ht,Ft,Yt,Ut,Gt;pn(r);let a=null,i,o,s=[],l;const c=an.for(t);if(r){const dt=mn(t);o=dt==null?void 0:dt.margin,l=dt==null?void 0:dt.plotRect,c.detach(),(dt==null?void 0:dt.chartType)==="bar-horizontal"?s=Array.from(t.querySelectorAll(".bc-frame .bc-bar")):dt&&(a=nn(t)),i=new Map;for(const $t of t.querySelectorAll(".bc-frame .bc-annotations, .bc-frame .bc-annotations-range"))for(const[U,T]of Xe($t))i.set(U,T);t.replaceChildren()}const{body:f}=dn(t,e.frame),h=qe(f).width,d=h>0&&h<400&&((X=e.verticalAxis)==null?void 0:X.labelPosition)!=="outside",g=e.categoryLabelLine===!0||d,v=_o(n.labels),m=g?Jt.Off:(O=e.verticalAxis)==null?void 0:O.labelPosition,b=Cn(h,m,(ht=e.horizontalAxis)==null?void 0:ht.labelPosition,(mt=e.verticalAxis)==null?void 0:mt.direction,v,(vt=e.horizontalAxis)==null?void 0:vt.showAxis),x=e.valueLabelPosition??It.Auto,A=e.swapLabelValue===!0;if(e.valueLabels&&x!==It.Inside)if(A){const dt=n.labels.reduce((U,T)=>U.length>T.length?U:T,""),$t=Hl(dt)+Il;b.right=Math.max(b.right??15,$t)}else{const dt=Math.max(...n.values),$t=Math.min(...n.values),U=dt>0?Hl(String(dt))+Il:0,T=$t<0?Hl(String($t))+Il:0;b.right=Math.max(b.right??15,U),T>0&&(b.left=(b.left??50)+T)}const{chartArea:w,width:S,height:z,margin:Y}=gn(f,b),G={left:Y.left,top:Y.top,width:S,height:z},_=g?ed:0,B=Ln(o,Y),P=wA(n,e),$=P.map(dt=>({label:dt,value:n.values[n.labels.indexOf(dt)]})),N=e.waterfall===!0,L=[];if(N){let dt=0;for(const $t of $){const U=dt;dt+=$t.value,L.push({label:$t.label,value:$t.value,x0:U,x1:dt,isTotal:!1})}e.waterfallTotal&&L.push({label:"Total",value:dt,x0:0,x1:dt,isTotal:!0})}const M=((Tt=e.horizontalAxis)==null?void 0:Tt.scaleType)==="log",D=N?L.flatMap(dt=>[dt.x0,dt.x1]):$.map(dt=>dt.value),[q,V]=oa(D,(Ht=e.horizontalAxis)==null?void 0:Ht.range,(Ft=e.horizontalAxis)==null?void 0:Ft.scaleType),C=M?cr().domain([q,V]).nice().range([0,S]):Pe().domain([q,V]).nice().range([0,S]),I=N?L.map(dt=>dt.label):P,W=tn().domain(I).range([0,z]).padding(Sr(e.barGap)),it=A&&e.valueLabels&&!N?(()=>{const dt=new Map($.map($t=>[$t.label,$t.value]));return{...e.verticalAxis,topPadding:Y.top,tickFormat:$t=>String(dt.get($t)??$t)}})():{...e.verticalAxis,topPadding:Y.top},rt=g?{...it,labelPosition:Jt.Off,...d?{showAxis:!1}:{}}:it;c.attach(w,B),c.update({horizontal:{scale:C,height:z,options:{...e.horizontalAxis,width:S}},vertical:{scale:W,height:z,options:rt},order:"horizontal-first"}),!M&&q<0&&V>0&&ot(w).append("line").attr("class","bc-zero-baseline").attr("x1",C(0)).attr("x2",C(0)).attr("y1",0).attr("y2",z).attr("stroke","#666").attr("stroke-width",1);const ct=Vn(e.colorizes),pt=new Set((e.highlights??[]).map(dt=>dt.target)),xt=w.ownerSVGElement,yt=Nn(xt,t,"bars",{x:0,y:0,width:S,height:z}),bt=ot(xt).select("defs"),kt=yt.replace(/^bc-clip-/,""),j=ot(w).append("g").attr("clip-path",`url(#${yt})`);if(e.barBackground){const dt=(e.colors??ka)[0],$t=N?I:$.map(U=>U.label);j.selectAll(".bc-bar-bg").data($t,U=>U).enter().append("rect").attr("class","bc-bar-bg").attr("x",0).attr("y",U=>(W(U)??0)+_).attr("width",S).attr("height",W.bandwidth()-_).attr("fill",dt).attr("opacity",.18)}const J=N?I:$.map(dt=>dt.label);if(e.barSeparators&&J.length>1){const dt=W.step();for(let $t=1;$t<J.length;$t++){const U=(W(J[$t-1])??0)+W.bandwidth()+(dt-W.bandwidth())/2;j.append("line").attr("class","bc-bar-separator").attr("x1",0).attr("x2",S).attr("y1",U).attr("y2",U).attr("stroke","currentColor").attr("opacity",.15)}}if(!N&&e.connectedColumns&&$.length>1){const dt=e.colors??ka,$t=e.connectionsOpacity??.15;for(let U=0;U<$.length-1;U++){const T=$[U],F=$[U+1];if(T.value==null||F.value==null||Number.isNaN(T.value)||Number.isNaN(F.value)||T.value===0||F.value===0)continue;const E=(W(T.label)??0)+W.bandwidth(),at=(W(F.label)??0)+_,wt=Math.max(C(0),C(T.value)),Ct=Math.max(C(0),C(F.value)),st=C(0),Et=ct.get(T.label)??dt[0],Nt=ct.get(F.label)??dt[0];let tt;if(Et===Nt)tt=Et;else{const St=`bc-conn-grad-${kt}-${U}`,Dt=bt.append("linearGradient").attr("id",St).attr("x1","0%").attr("x2","0%").attr("y1","0%").attr("y2","100%");Dt.append("stop").attr("offset","0%").attr("stop-color",Et),Dt.append("stop").attr("offset","100%").attr("stop-color",Nt),tt=`url(#${St})`}j.append("polygon").attr("class","bc-bar-connection").attr("points",`${wt},${E} ${Ct},${at} ${st},${at} ${st},${E}`).attr("fill",tt).attr("opacity",$t).attr("pointer-events","none")}}if(N){const dt=e.colors??ka,$t="#333";if(e.connectedColumns&&L.length>1){const U=e.colors??ka,T=e.connectionsOpacity??.15;for(let F=0;F<L.length-1;F++){const E=L[F],at=L[F+1];if(at.isTotal||E.value==null||at.value==null||Number.isNaN(E.value)||Number.isNaN(at.value)||E.value===0||at.value===0)continue;const wt=(W(E.label)??0)+W.bandwidth(),Ct=(W(at.label)??0)+_,st=C(E.x1),Et=C(at.x1),Nt=C(E.x0),tt=C(at.x0),St=ct.get(E.label)??U[0],Dt=ct.get(at.label)??U[0];let Pt;if(St===Dt)Pt=St;else{const Zt=`bc-conn-grad-${kt}-${F}`,ae=bt.append("linearGradient").attr("id",Zt).attr("x1","0%").attr("x2","0%").attr("y1","0%").attr("y2","100%");ae.append("stop").attr("offset","0%").attr("stop-color",St),ae.append("stop").attr("offset","100%").attr("stop-color",Dt),Pt=`url(#${Zt})`}j.append("polygon").attr("class","bc-bar-connection").attr("points",`${st},${wt} ${Et},${Ct} ${tt},${Ct} ${Nt},${wt}`).attr("fill",Pt).attr("opacity",T).attr("pointer-events","none")}}for(let U=0;U<L.length-1;U++){const T=L[U],F=L[U+1];if(F.isTotal)break;j.append("line").attr("class","bc-waterfall-connector").attr("x1",C(T.x1)).attr("x2",C(T.x1)).attr("y1",(W(T.label)??0)+W.bandwidth()).attr("y2",(W(F.label)??0)+_).attr("stroke","currentColor").attr("stroke-dasharray","2,2").attr("opacity",.3)}if(j.selectAll(".bc-bar").data(L,U=>U.label).enter().append("rect").attr("class","bc-bar").attr("x",U=>Math.min(C(U.x0),C(U.x1))).attr("y",U=>(W(U.label)??0)+_).attr("width",U=>Math.abs(C(U.x1)-C(U.x0))).attr("height",W.bandwidth()-_).attr("fill",U=>U.isTotal?$t:ct.get(U.label)??dt[0]).attr("opacity",U=>pt.size>0?Ue(pt,U.label):null),e.valueLabels){const U=x,T=hr(((Yt=e.horizontalAxis)==null?void 0:Yt.numberFormat)??""),F=at=>T?T(at):String(at);ot(w).append("g").selectAll(".bc-value-label").data(L,at=>at.label).enter().append("text").attr("class","bc-value-label").attr("font-size","11px").attr("dominant-baseline","central").attr("y",at=>(W(at.label)??0)+_+(W.bandwidth()-_)/2).attr("x",at=>{const wt=Math.max(C(at.x0),C(at.x1));return U===It.Inside?wt-4:wt+4}).attr("text-anchor",U===It.Inside?"end":"start").attr("fill",at=>U===It.Inside?hn(at.isTotal?$t:ct.get(at.label)??dt[0]):"currentColor").text(at=>A?at.label:F(at.isTotal?at.x1:at.value))}}else{const dt=me(t),$t=j.append("g").node();if(r)for(const F of s)$t.appendChild(F);ge(dt,{role:"mark-per-category",parent:$t,selector:".bc-bar",data:$,key:F=>F.label,insert:F=>F.append("rect").attr("class","bc-bar"),attrs:F=>({x:Math.min(C(0),C(F.value)),y:(W(F.label)??0)+_,width:Math.abs(C(F.value)-C(0)),height:W.bandwidth()-_,fill:ct.get(F.label)??(e.colors??ka)[0],opacity:Ue(pt,F.label)})}),En(dt,{svg:xt,clipId:yt,group:w,from:l,to:G,active:r&&s.length>0});const U=Hr(j);e.tooltips&&U.use(pr({numberFormat:(Ut=e.horizontalAxis)==null?void 0:Ut.numberFormat})),e.crosshair&&U.use(Ir({width:S,height:z,direction:e.crosshairDirection,style:e.crosshairStyle,color:e.crosshairColor,orientation:Ve.Horizontal})),(Gt=e.annotations)!=null&&Gt.length&&U.use(wa(e.annotations,{scaleX:W,scaleY:C,data:$,width:S,height:z,backgroundColor:Be(t),orientation:Ve.Horizontal,transition:r,priorAnnotations:i}));const T=()=>U.draw($);if(dt.state==="committing"?dt.register(T):T(),e.valueLabels){const F=ot(w).append("g");xA(F,$,C,W,{position:x,colorOverrides:ct,colors:e.colors??ka,swapLabelValue:A,categoryLabelOffset:_,percent:e.valueLabels==="percent",total:hf($,E=>E.value)})}}if(g){const dt=ot(w).append("g").attr("class","bc-category-labels");for(const $t of I){const U=W($t)??0;dt.append("text").attr("class","bc-category-label").attr("x",2).attr("y",U+ed/2).attr("text-anchor","start").attr("dominant-baseline","central").attr("font-size","10px").attr("font-weight","600").attr("fill","currentColor").text($t)}}bn(t,{chartType:"bar-horizontal",margin:Y,plotRect:G}),a&&(en(j.node()),rn(t,a))}function vA(t,n,e,r,a=0){const i=r===It.Inside,o=(e(t.label)??0)+a+(e.bandwidth()-a)/2;let s,l;if(t.value<0){const c=Math.min(n(0),n(t.value));i?(s=c+4,l="start"):(s=c-4,l="end")}else{const c=n(t.value);i?(s=c-4,l="end"):(s=c+4,l="start")}return{tx:s,ty:o,anchor:l,isInside:i}}function xA(t,n,e,r,a){const i=a.position??It.Auto,o=a.categoryLabelOffset??0,s=g=>a.swapLabelValue?g.label:a.percent&&a.total!==void 0?xo(g.value,a.total):String(g.value);let l=t.select(".bc-value-label-group");l.empty()&&(l=t.append("g").attr("class","bc-value-label-group"));const c=t.node().ownerSVGElement,f=c==null?void 0:c.parentElement,h=me(f),d=n.filter(g=>Br({text:s(g),placement:i===It.Inside?"inside":"outside",orientation:"horizontal",barWidth:Math.abs(e(g.value)-e(0)),barHeight:r.bandwidth()}));ge(h,{role:"value-label",parent:l.node(),selector:".bc-value-label",data:d,key:g=>g.label,insert:g=>g.append("text").attr("class","bc-value-label").attr("font-size","11px").attr("dominant-baseline","central"),attrs:g=>{const v=vA(g,e,r,i,o);return{x:v.tx,y:v.ty,"text-anchor":v.anchor,fill:v.isInside?hn(a.colorOverrides.get(g.label)??a.colors[0]):"currentColor"}}}),l.selectAll(".bc-value-label").data(d,g=>g.label).text(s)}function wA(t,n){const e=t.labels.map((r,a)=>({label:r,value:t.values[a]}));return n.sort===pe.Ascending?e.sort((r,a)=>r.value-a.value):n.sort===pe.Descending&&e.sort((r,a)=>a.value-r.value),e.map(r=>r.label)}const rd=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7"],AA=200,ad=.2;class _A extends zr{initialize(){this.configDefine("colors",{defaultValue:rd}),this.configDefine("yOffset",{defaultValue:-10}),this.configDefine("layout",{defaultValue:"horizontal"}),this.configDefine("valueSuffixes",{defaultValue:[]}),this.configDefine("maxWidth",{defaultValue:0});const n=this.base.append("g").attr("class","bc-legend"),e=r=>{var d,g;const a=this.config("colors"),i=this.config("layout"),o=this.config("valueSuffixes"),s=((g=(d=this.base.node())==null?void 0:d.ownerSVGElement)==null?void 0:g.parentElement)??document.documentElement,l=getComputedStyle(s).getPropertyValue("--bc-text-color").trim()||"#555",c=this.config("maxWidth");let f=0,h=0;r.each(function(v,m){const b=ot(this),x=o[m],w=16+(x?v.length+1+x.length:v.length)*7+12;i==="horizontal"&&c>0&&f>0&&f+w>c&&(f=0,h+=20),b.attr("transform",`translate(${f},${h})`).attr("data-series",v).style("cursor","default");let S=b.select("rect");S.empty()&&(S=b.append("rect").attr("width",12).attr("height",12)),S.attr("fill",a[m%a.length]);let z=b.select("text");z.empty()&&(z=b.append("text").attr("x",16).attr("y",10).attr("font-size","12px")),z.attr("fill",l),z.selectAll("tspan").remove(),x?(z.text(null),z.append("tspan").attr("font-weight","bold").text(v),z.append("tspan").text(` ${x}`)):z.text(v),i==="vertical"?h+=20:f+=w})};this.layer("items",n,{dataBind:(r,a)=>r.selectAll(".bc-legend-item").data(a,i=>i),insert:r=>r.append("g").attr("class","bc-legend-item"),events:{enter:e,update:e}})}preDraw(){const n=this.config("yOffset");this.base.select(".bc-legend").attr("transform",`translate(0,${n})`)}}function kA(t){const n=ot(t).selectAll(".bc-legend-item");if(n.empty())return;let e=null,r=null;function a(o){r=o,n.each(function(){const l=ot(this),c=l.attr("data-series")===o;l.transition().duration(150).style("opacity",c?1:ad)}),ot(t).selectAll("[data-series]").filter(function(){return!this.closest(".bc-legend")}).each(function(){const l=ot(this),c=l.attr("data-series")===o,f=this.classList.contains("bc-direct-label")||this.classList.contains("bc-value-label");l.transition().duration(150).style("opacity",c?1:f?0:ad)})}function i(){r=null,n.transition().duration(150).style("opacity",1),ot(t).selectAll("[data-series]").filter(function(){return!this.closest(".bc-legend")}).transition().duration(150).style("opacity",null)}n.on("mouseenter.bcHighlight",null).on("mouseleave.bcHighlight",null).on("mouseenter.bcHighlight",function(){const o=ot(this).attr("data-series")??"";e&&clearTimeout(e),e=setTimeout(()=>a(o),Fr(AA))}).on("mouseleave.bcHighlight",()=>{e&&(clearTimeout(e),e=null),r!==null&&i()})}function br(t,n,e=rd,r=-10,a="top",i="start",o=0,s=0,l=0,c=[],f={}){const h=a==="left"||a==="right"?"vertical":"horizontal",d=new _A(ot(t));d.config({colors:e,yOffset:r,layout:h,valueSuffixes:c,maxWidth:o}),d.draw(n);const g=t.querySelector(".bc-legend");if(g){let v=0,m=0;const b=n.map((z,Y)=>{const G=c[Y];return G?z.length+1+G.length:z.length});if(h==="horizontal"){const z=b.map(B=>16+B*7+12);let Y=1,G=0,_=0;for(const B of z)o>0&&G>0&&G+B>o?(_=Math.max(_,G),Y++,G=B):G+=B;_=Math.max(_,G),v=_,m=Y*20}else v=Math.max(...b)*7+16+8,m=n.length*20;const x=f.left??0,A=f.right??0;let w=l,S=r;h==="horizontal"?i==="middle"?w+=-x+(o+x+A-v)/2:i==="end"?w+=o+A-v:w+=-x:i==="middle"?S+=(s-m)/2:i==="end"&&(S+=s-m),g.setAttribute("transform",`translate(${w},${S})`)}return kA(t),g}function yr(t,n,e){if(t.length===0)return{width:0,height:0};if(n==="left"||n==="right"){const f=Math.max(...t.map(d=>d.length))*7+16+8,h=t.length*20;return{width:f,height:h}}const a=20,i=t.map(c=>16+c.length*7+12);if(!e||e<=0)return{width:i.reduce((f,h)=>f+h,0),height:a};let o=1,s=0,l=0;for(const c of i)s>0&&s+c>e?(l=Math.max(l,s),o++,s=c):s+=c;return l=Math.max(l,s),{width:l,height:o*a}}function id(t){return t.length===0?0:Math.max(...t.map(e=>e.length))*7+10}function tr(t,n){return n==null?void 0:n.find(e=>e.name===t)}function re(t,n,e,r){const a=tr(t,r);return(a==null?void 0:a.color)??e[n%e.length]}function SA(t,n){const e=tr(t,n);return(e==null?void 0:e.dash)??"solid"}function MA(t,n){const e=tr(t,n);return(e==null?void 0:e.lineWidth)??2}function od(t,n,e){const r=tr(t,e);return!(r!=null&&r.interpolation)||r.interpolation==="global"?n:r.interpolation}function Vr(t,n){const e=tr(t,n);return(e==null?void 0:e.hidden)??!1}function vr(t,n,e){const r=tr(t,e);return!(r!=null&&r.labelMode)||r.labelMode==="global"?n:r.labelMode}function Sa(t,n,e){const r=tr(t,e);return(r==null?void 0:r.valueLabels)!==void 0?r.valueLabels:n}function ai(t,n){const e=tr(t,n);return(e==null?void 0:e.opacity)??1}function $A(t,n,e){const r=tr(t,e);if((r==null?void 0:r.lineSymbols)!==!1&&((r==null?void 0:r.lineSymbols)===!0||n))return{name:t,symbolShape:(r==null?void 0:r.symbolShape)??(n==null?void 0:n.symbolShape),symbolShowOn:(r==null?void 0:r.symbolShowOn)??(n==null?void 0:n.symbolShowOn),symbolStyle:(r==null?void 0:r.symbolStyle)??(n==null?void 0:n.symbolStyle),symbolSize:(r==null?void 0:r.symbolSize)??(n==null?void 0:n.symbolSize),symbolOpacity:(r==null?void 0:r.symbolOpacity)??(n==null?void 0:n.symbolOpacity),lineSymbols:!0}}const LA=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7"];function CA(t,n,e={},r=!1){var tt,St,Dt,Pt,Zt,ae,$e,Ze,Le,yn,fe,ie,sn;pn(r);let a=null,i,o,s=[],l;const c=an.for(t);if(r){const ft=mn(t);o=ft==null?void 0:ft.margin,l=ft==null?void 0:ft.plotRect,c.detach(),(ft==null?void 0:ft.chartType)==="bar-multi"?s=Array.from(t.querySelectorAll(".bc-frame .bc-bar-multi")):ft&&(a=nn(t)),i=new Map;for(const et of t.querySelectorAll(".bc-frame .bc-annotations, .bc-frame .bc-annotations-range"))for(const[gt,Lt]of Xe(et))i.set(gt,Lt);t.replaceChildren()}const{body:f}=dn(t,e.frame),h=n.series??[],d=h.filter(ft=>!Vr(ft.name,e.seriesOverrides)),g=d.map(ft=>ft.name),v=e.colors??LA,m=e.seriesOverrides,b=e.directLabelling===!0||e.directLabelling==="auto"&&e.legend!==!0||!!e.directLabelling&&e.directLabelling!=="auto",x=b?"direct":e.legend!==!1?"legend":"none",A=e.legend!==!1&&!b,w=qe(f).width,S=350,z=e.legendPosition??"top",Y=w>0&&w<S&&(z==="left"||z==="right")?"top":z,G=e.legendAnchor??"start",_=d.flatMap(ft=>ft.values),B=Rr(_,(tt=e.verticalAxis)==null?void 0:tt.range,(St=e.verticalAxis)==null?void 0:St.numberFormat,(Dt=e.verticalAxis)==null?void 0:Dt.scaleType),P=Cn(w,(Pt=e.verticalAxis)==null?void 0:Pt.labelPosition,(Zt=e.horizontalAxis)==null?void 0:Zt.labelPosition,(ae=e.verticalAxis)==null?void 0:ae.direction,B),$=Math.max(0,w-(P.left??50)-(P.right??20)),N=Ml(n.labels,$,e.horizontalAxis);N!==void 0&&(P.bottom=N);const L=P.top!=null,M=Math.max(0,w-(P.left??50)-(P.right??20)),D=A?yr(g,Y,M):{width:0,height:0},q=A?D.height+15:0,V={...P};if(A&&Y==="top"){const ft=L?15:0;V.top=q+ft}A&&Y==="bottom"&&(V.bottom=(V.bottom??24)+q),A&&Y==="left"&&(V.left=(V.left??50)+D.width+10),A&&Y==="right"&&(V.right=(V.right??20)+D.width+10);const{chartArea:C,width:I,height:W,margin:it}=gn(f,V),rt=Ln(o,it);let[ct,pt]=oa(_,($e=e.verticalAxis)==null?void 0:$e.range,(Ze=e.verticalAxis)==null?void 0:Ze.scaleType);if(e.valueLabels&&ct<0&&((yn=(Le=e.verticalAxis)==null?void 0:Le.range)==null?void 0:yn.min)==null){const ft=pt-ct;ct-=ft*.1}let xt=n.labels;if(e.sortMode==="total"){const ft=n.labels.map((et,gt)=>({label:et,index:gt,total:d.reduce((Lt,At)=>Lt+(At.values[gt]??0),0)}));ft.sort((et,gt)=>gt.total-et.total),xt=ft.map(et=>et.label)}const yt=tn().domain(xt).range([0,I]).padding(Sr(e.barGap)),bt=tn().domain(g).range([0,yt.bandwidth()]).padding(.05),kt=((fe=e.verticalAxis)==null?void 0:fe.scaleType)==="log",j=kt?cr().domain([ct,pt]).nice().range([W,0]):Pe().domain([ct,pt]).nice().range([W,0]);c.attach(C,rt),c.update({vertical:{scale:j,height:W,options:{...e.verticalAxis,gridWidth:I,topPadding:it.top}},horizontal:{scale:yt,height:W,options:{...e.horizontalAxis,width:I}}}),!kt&&ct<0&&pt>0&&ot(C).append("line").attr("class","bc-zero-baseline").attr("x1",0).attr("x2",I).attr("y1",j(0)).attr("y2",j(0)).attr("stroke","#666").attr("stroke-width",1);const J=new Map;e.sortMode==="within-groups"&&n.labels.forEach((ft,et)=>{const gt=d.map(Lt=>({name:Lt.name,value:Lt.values[et]}));gt.sort((Lt,At)=>At.value-Lt.value),gt.forEach((Lt,At)=>{J.set(`${ft}\0${Lt.name}`,g[At])})});const X=[];n.labels.forEach((ft,et)=>{d.forEach(gt=>{const Lt=h.findIndex(Kt=>Kt.name===gt.name),At=e.sortMode==="within-groups"?J.get(`${ft}\0${gt.name}`)??gt.name:gt.name;X.push({label:ft,series:At,seriesName:gt.name,value:gt.values[et],seriesIndex:Lt})})});const O=e.valueLabels??!1,ht=C.ownerSVGElement,mt=Nn(ht,t,"bars",{x:0,y:0,width:I,height:W}),vt=ot(C).append("g").attr("clip-path",`url(#${mt})`),Tt=me(t),Ht=Aa(e.highlights),Ft=Vn(e.colorizes),Yt=vt.append("g").node();if(r)for(const ft of s)ft.removeAttribute("opacity"),ft.removeAttribute("fill-opacity"),Yt.appendChild(ft);ge(Tt,{role:"mark-per-cell",parent:Yt,selector:".bc-bar-multi",data:X,key:ft=>`${ft.label}\0${ft.seriesName}`,insert:ft=>ft.append("rect").attr("class","bc-bar bc-bar-multi"),attrs:ft=>{const et=re(ft.seriesName,ft.seriesIndex,v,m),gt=ai(ft.seriesName,m),Lt={"data-series":ft.seriesName,x:(yt(ft.label)??0)+(bt(ft.series)??0),y:Math.min(j(0),j(ft.value)),width:bt.bandwidth(),height:Math.abs(j(ft.value)-j(0)),fill:Ft.get(ft.seriesName)??et};return gt<1&&(Lt["fill-opacity"]=gt),Ht.size>0?{...Lt,opacity:Ue(Ht,ft.seriesName)}:Lt}});const Ut={left:it.left,top:it.top,width:I,height:W};En(Tt,{svg:ht,clipId:mt,group:C,from:l,to:Ut,active:r&&s.length>0});const Gt=Hr(vt);if(e.tooltips&&Gt.use(pr({numberFormat:(ie=e.verticalAxis)==null?void 0:ie.numberFormat})),e.crosshair&&Gt.use(Ir({width:I,height:W,direction:e.crosshairDirection,style:e.crosshairStyle,color:e.crosshairColor})),(sn=e.annotations)!=null&&sn.length){const ft=n.labels.map((et,gt)=>({label:et,value:Math.max(...d.map(Lt=>Lt.values[gt]??0))}));Gt.use(wa(e.annotations,{scaleX:yt,scaleY:j,data:ft,width:I,height:W,backgroundColor:Be(t),transition:r,priorAnnotations:i}))}const dt=()=>Gt.draw(X);Tt.state==="committing"?Tt.register(dt):dt(),bn(t,{chartType:"bar-multi",margin:it,plotRect:Ut}),a&&(en(vt.node()),rn(t,a));const $t=new Set;d.forEach(ft=>{vr(ft.name,x,m)==="direct"&&$t.add(ft.name)});const U=$t.size>0,T=Be(t),F=typeof e.directLabelling=="string"?e.directLabelling:e.directLabelling?_e.Auto:_e.Off,E=e.directLabelAnchor??"middle",at=e.valueLabelPosition??It.Auto;function wt(){return at===It.Inside?It.Inside:(at===It.Outside,It.Outside)}function Ct(ft){return F===_e.Inside?It.Inside:F===_e.Outside?It.Outside:O?wt():It.Outside}function st(ft,et,gt){return gt==="start"?ft+12:gt==="end"?ft+et-4:ft+et/2}const Et=ot(C).append("g").attr("class","bc-value-labels");X.forEach(ft=>{if(!Sa(ft.seriesName,O,m))return;const et=(yt(ft.label)??0)+(bt(ft.series)??0)+bt.bandwidth()/2,gt=Math.min(j(0),j(ft.value)),Lt=Math.abs(j(ft.value)-j(0)),At=wt(),Kt=U&&$t.has(ft.seriesName),He=ft.value<0,ln=gt+Lt;let Ce,Te,ar;if(At===It.Inside){const ir=re(ft.seriesName,ft.seriesIndex,v,m);Te=hn(ir),ar="central",Kt&&Ct()===It.Inside?Ce=st(gt,Lt,E)+14:Ce=gt+Lt/2}else Te="currentColor",He?(Ce=Kt&&Ct()===It.Outside?ln+16:ln+4,ar="hanging"):(Ce=Kt&&Ct()===It.Outside?gt-16:gt-4,ar="auto");Br({text:String(ft.value),placement:At===It.Inside?"inside":"outside",orientation:"vertical",barWidth:bt.bandwidth(),barHeight:Lt})&&Et.append("text").attr("class","bc-value-label").attr("data-series",ft.seriesName).attr("x",et).attr("y",Ce).attr("text-anchor","middle").attr("dominant-baseline",ar).attr("font-size","11px").attr("fill",Te).text(String(ft.value))}),X.forEach(ft=>{var Ce;if(!$t.has(ft.seriesName))return;const et=(yt(ft.label)??0)+(bt(ft.series)??0)+bt.bandwidth()/2,gt=Math.min(j(0),j(ft.value)),Lt=Math.abs(j(ft.value)-j(0)),At=((Ce=m==null?void 0:m.find(Te=>Te.name===ft.seriesName))==null?void 0:Ce.labelText)||ft.seriesName,Kt=Ct(),He=re(ft.seriesName,ft.seriesIndex,v,m),ln=ot(C).append("text").attr("class","bc-direct-label").attr("data-series",ft.seriesName).attr("x",et).attr("text-anchor","middle").attr("font-size","10px").text(At);if(Kt===It.Inside){const Te=st(gt,Lt,E);ln.attr("y",Te).attr("fill",hn(He)),E==="middle"&&ln.attr("dominant-baseline","central")}else ln.attr("y",gt-4).attr("fill",Jc(He,T))});const Nt=g.filter(ft=>vr(ft,x,m)==="legend");if(A&&Nt.length>0){const ft=Nt.map(Lt=>{const At=h.findIndex(Kt=>Kt.name===Lt);return re(Lt,At,v,m)});let et=0,gt=0;if(Y==="top"){const Lt=L?15:0;gt=-(D.height+10+Lt)}else Y==="bottom"?gt=W+25:Y==="left"?et=-(D.width+10):Y==="right"&&(et=I+10);br(C,Nt,ft,gt,Y,G,I,W,et,[],{left:it.left,right:it.right})}}const TA={linear:po,monotoneX:Zx,step:jx,stepBefore:Kx,stepAfter:Jx,basis:Gx,cardinal:qx,catmullRom:Ux};function Wr(t){return t&&TA[t]||po}const sd="bc-tooltip",Ma=new WeakMap;function Io(t){const n=Ma.get(t);n&&(Ma.delete(t),n())}function OA(){if(document.getElementById("bc-tooltip-styles"))return;const t=document.createElement("style");t.id="bc-tooltip-styles",t.textContent=`
|
|
255
|
+
.${sd} {
|
|
256
|
+
position: absolute;
|
|
257
|
+
pointer-events: none;
|
|
258
|
+
background: var(--bs-body-bg, #fff);
|
|
259
|
+
color: var(--bs-body-color, #212529);
|
|
260
|
+
border: 1px solid var(--bs-border-color, #dee2e6);
|
|
261
|
+
border-radius: 4px;
|
|
262
|
+
padding: 6px 10px;
|
|
263
|
+
font-size: 13px;
|
|
264
|
+
box-shadow: 0 2px 8px rgba(0,0,0,0.12);
|
|
265
|
+
z-index: 9999;
|
|
266
|
+
display: none;
|
|
267
|
+
}
|
|
268
|
+
`,document.head.appendChild(t)}function NA(t){const n=t?hr(t):null,e=r=>n?n(r):String(r);return r=>r.series?`${r.series} – ${r.label}: ${e(r.value)}`:`${r.label}: ${e(r.value)}`}function Ho(t,n){const{width:e,height:r,points:a,tooltip:i=!0,crosshair:o=!1,crosshairDirection:s=Ae.Both,crosshairStyle:l=kn.Dashed,crosshairColor:c="#999",format:f=NA(n.numberFormat),container:h}=n;if(a.length===0){const M=()=>{};return h&&Ma.set(h,M),M}const d=l===kn.Solid?"none":l===kn.Dotted?"2,2":"4,3",g=[...new Set(a.map(M=>M.cx))].sort((M,D)=>M-D),v=ot(t);let m=null;i&&(OA(),m=document.createElement("div"),m.className=sd,document.body.appendChild(m));const b=".bc-annotations",x=!v.select(b).empty(),A=M=>x?v.insert(M,b):v.append(M),w=o&&(s===Ae.Both||s===Ae.Vertical),S=o&&(s===Ae.Both||s===Ae.Horizontal);let z=null,Y=null;w&&(z=A("line").attr("class","bc-crosshair bc-crosshair-v").attr("y1",0).attr("y2",r).attr("stroke",c).attr("stroke-width",1).style("stroke-dasharray",d).attr("pointer-events","none").style("display","none")),S&&(Y=A("line").attr("class","bc-crosshair bc-crosshair-h").attr("x1",0).attr("x2",e).attr("stroke",c).attr("stroke-width",1).style("stroke-dasharray",d).attr("pointer-events","none").style("display","none"));const G=A("circle").attr("class","bc-proximity-dot").attr("r",6).attr("fill","none").attr("stroke","#333").attr("stroke-width",1).attr("opacity",.45).attr("pointer-events","none").style("display","none"),_=A("rect").attr("class","bc-proximity-overlay").attr("width",e).attr("height",r).attr("fill","none").attr("pointer-events","all");function B(M,D){if(g.length===0)return null;const q=im(g,M),V=g[q],C=a.filter(it=>it.cx===V);if(C.length===0)return null;let I=C[0],W=Math.abs(C[0].cy-D);for(let it=1;it<C.length;it++){const rt=Math.abs(C[it].cy-D);rt<W&&(I=C[it],W=rt)}return I}const P=M=>{const[D,q]=sy(M,t),V=B(D,q);V&&(G.attr("cx",V.cx).attr("cy",V.cy).attr("stroke",V.color).style("display",null),m&&(m.textContent=f(V),m.style.display="block",Th(G.node(),m,{placement:"top",middleware:[$h(8),Ch(),Lh()]}).then(({x:C,y:I})=>{m&&(m.style.left=`${C}px`,m.style.top=`${I}px`)})),z&&z.attr("x1",V.cx).attr("x2",V.cx).style("display",null),Y&&Y.attr("y1",V.cy).attr("y2",V.cy).style("display",null))},$=()=>{G.style("display","none"),m&&(m.style.display="none"),z&&z.style("display","none"),Y&&Y.style("display","none")},N=_.node();N.addEventListener("mousemove",P),N.addEventListener("mouseleave",$);const L=()=>{N.removeEventListener("mousemove",P),N.removeEventListener("mouseleave",$),_.remove(),G.remove(),m&&(m.remove(),m=null),z&&z.remove(),Y&&Y.remove(),h&&Ma.get(h)===L&&Ma.delete(h)};return h&&Ma.set(h,L),L}const EA={circle:vl,square:Rx,diamond:zx,triangle:Bu,triangleDown:Vx??Bu,cross:Dx,star:Hx};function DA(t,n,e){switch(e){case Je.First:return t===0;case Je.Last:return t===n-1;case Je.FirstLast:return t===0||t===n-1;case Je.All:default:return!0}}function Bl(t,n,e,r,a=!1){const i=r.symbol??Ke.Circle,o=r.showOn??Je.FirstLast,s=r.style??Ee.Filled,l=r.size??3.5,c=r.opacity??1,f="var(--bs-body-bg, #fff)",h=n.filter(g=>DA(g.index,e,o)),d=a?Ja():0;if(i===Ke.Circle){t.selectAll("path.bc-symbol").remove();const g=t.selectAll("circle.bc-symbol").data(h).join(m=>m.append("circle").attr("class","bc-symbol").attr("cx",b=>b.cx).attr("cy",b=>b.cy).attr("r",l).attr("fill",b=>s===Ee.Filled?b.color:f).attr("stroke",b=>b.color).attr("stroke-width",s===Ee.Hollow?1.5:0).attr("opacity",c),m=>m,m=>m.remove());(a?g.transition().duration(d):g).attr("cx",m=>m.cx).attr("cy",m=>m.cy).attr("r",l).attr("fill",m=>s===Ee.Filled?m.color:f).attr("stroke",m=>m.color).attr("stroke-width",s===Ee.Hollow?1.5:0).attr("opacity",c)}else{const g=EA[i]??vl,v=Math.PI*l*l,m=Wx().type(g).size(v);t.selectAll("circle.bc-symbol").remove();const b=t.selectAll("path.bc-symbol").data(h).join(A=>A.append("path").attr("class","bc-symbol").attr("transform",w=>`translate(${w.cx},${w.cy})`).attr("d",m).attr("fill",w=>s===Ee.Filled?w.color:f).attr("stroke",w=>w.color).attr("stroke-width",s===Ee.Hollow?1.5:0).attr("opacity",c),A=>A,A=>A.remove());(a?b.transition().duration(d):b).attr("transform",A=>`translate(${A.cx},${A.cy})`).attr("d",m).attr("fill",A=>s===Ee.Filled?A.color:f).attr("stroke",A=>A.color).attr("stroke-width",s===Ee.Hollow?1.5:0).attr("opacity",c)}}const PA="#4e79a7";function zA(t,n,e={},r=!1){var mt,vt,Tt,Ht,Ft,Yt,Ut,Gt,dt,$t,U,T,F;pn(r),Io(t);let a=[],i=[],o=null,s=null,l,c,f;const h=an.for(t);if(r){const E=mn(t);c=E==null?void 0:E.margin,f=E==null?void 0:E.plotRect,h.detach(),(E==null?void 0:E.chartType)==="line"?(a=Array.from(t.querySelectorAll(".bc-frame .bc-area")),i=Array.from(t.querySelectorAll(".bc-frame .bc-line")),o=t.querySelector(".bc-frame .bc-symbols")):E&&(s=nn(t)),l=new Map;for(const at of t.querySelectorAll(".bc-frame .bc-annotations, .bc-frame .bc-annotations-range"))for(const[wt,Ct]of Xe(at))l.set(wt,Ct);t.replaceChildren()}const{body:d}=dn(t,e.frame),g=qe(d).width,v=Rr(n.values,(mt=e.verticalAxis)==null?void 0:mt.range,(vt=e.verticalAxis)==null?void 0:vt.numberFormat,(Tt=e.verticalAxis)==null?void 0:Tt.scaleType),m=Cn(g,(Ht=e.verticalAxis)==null?void 0:Ht.labelPosition,(Ft=e.horizontalAxis)==null?void 0:Ft.labelPosition,(Yt=e.verticalAxis)==null?void 0:Yt.direction,v),{chartArea:b,width:x,height:A,margin:w}=gn(d,m),S=Ln(c,w),z=Oi(n.labels,(Ut=e.horizontalAxis)==null?void 0:Ut.range),Y=z.map(E=>n.labels[E]),G=z.map(E=>n.values[E]),_=Y.map((E,at)=>({label:E,value:G[at]})),B=so().domain(Y).range([0,x]).padding(e.edgePadding?.6:0),P=B,$=E=>B(E.label)??0,N=((Gt=e.verticalAxis)==null?void 0:Gt.scaleType)==="log",[L,M]=oa(G,(dt=e.verticalAxis)==null?void 0:dt.range,($t=e.verticalAxis)==null?void 0:$t.scaleType),D=N?cr().domain([L,M]).nice().range([A,0]):Pe().domain([L,M]).nice().range([A,0]),q=D.domain(),V=q[0]<0&&q[1]>0?D(0):void 0;h.attach(b,S),h.update({vertical:{scale:D,height:A,options:{...e.verticalAxis,gridWidth:x,topPadding:w.top}},horizontal:{scale:P,height:A,options:{...e.horizontalAxis,width:x,zeroY:V}}});const C=b.ownerSVGElement,I=Nn(C,t,"plot",{x:-1,y:-1,width:x+2,height:A+2}),W=ot(b).append("g").attr("clip-path",`url(#${I})`),it=W.node(),rt=((U=e.colors)==null?void 0:U[0])??PA,ct=Wr(e.interpolation),pt=e.areaFill??!1,xt=e.areaFillOpacity??.2,yt=ja().curve(ct).x(E=>$(E)).y0(A).y1(E=>D(E.value)),bt=Za().curve(ct).x(E=>$(E)).y(E=>D(E.value)),kt=ot(it).append("g").node(),j=ot(it).append("g").node();if(r){for(const E of a)kt.appendChild(E);for(const E of i)j.appendChild(E)}const J=me(t),X=[{name:"line",points:_}];ge(J,{role:"series-area",parent:kt,selector:".bc-area",data:pt?X:[],key:E=>E.name,insert:E=>E.append("path").attr("class","bc-area"),attrs:E=>({d:yt(E.points)??"",fill:rt,opacity:xt})}),ge(J,{role:"series-line",parent:j,selector:".bc-line",data:X,key:E=>E.name,insert:E=>E.append("path").attr("class","bc-line"),attrs:E=>({d:bt(E.points)??"",fill:"none",stroke:rt})}),ot(it).append("g").selectAll(".bc-dot").data(_,E=>E.label).enter().append("circle").attr("class","bc-dot").attr("cx",E=>$(E)).attr("cy",E=>D(E.value)).attr("r",3).attr("fill",rt).attr("fill-opacity",0).attr("stroke-opacity",0).attr("pointer-events","none");const ht={left:w.left,top:w.top,width:x+2,height:A+2};if(En(J,{svg:C,clipId:I,group:b,from:f,to:ht,active:r&&(a.length>0||i.length>0)}),(T=e.annotations)!=null&&T.length&&Ro(b,e.annotations,{scaleX:P,scaleY:D,data:_,width:x,height:A,backgroundColor:Be(t),transition:r,priorAnnotations:l}),e.tooltips||e.crosshair){const E=_.map(at=>({cx:$(at),cy:D(at.value),label:at.label,value:at.value,color:rt}));Ho(b,{width:x,height:A,points:E,tooltip:e.tooltips,crosshair:e.crosshair,crosshairDirection:e.crosshairDirection,crosshairStyle:e.crosshairStyle,crosshairColor:e.crosshairColor,numberFormat:(F=e.verticalAxis)==null?void 0:F.numberFormat,container:t})}if(e.valueLabels&&ot(it).append("g").selectAll(".bc-value-label").data(_,at=>at.label).enter().append("text").attr("class","bc-value-label").attr("x",at=>$(at)).attr("y",at=>D(at.value)-8).attr("text-anchor","middle").attr("font-size","11px").attr("fill","currentColor").text(at=>String(at.value)),e.lineSymbols){const E=_.map((wt,Ct)=>({cx:$(wt),cy:D(wt.value),color:rt,index:Ct}));let at;o?(b.appendChild(o),at=ot(o)):at=ot(b).append("g").attr("class","bc-symbols"),Bl(at,E,_.length,e.lineSymbols,r)}bn(t,{chartType:"line",margin:w,plotRect:ht}),s&&(en(W.node()),rn(t,s))}const Vl=28,ld=18,cd=20;function Wl(t,n,e,r=Vl){if(t.length===0)return[];if(t.length===1)return[Math.max(n,Math.min(e,t[0]))];const a=t.length,i=e-n,s=(a-1)*r>i?Math.max(0,i/(a-1)):r,l=[...t];for(let c=0;c<10;c++){for(let f=1;f<l.length;f++)l[f]-l[f-1]<s&&(l[f]=l[f-1]+s);l[l.length-1]>e&&(l[l.length-1]=e);for(let f=l.length-2;f>=0;f--)l[f+1]-l[f]<s&&(l[f]=l[f+1]-s);l[0]<n&&(l[0]=n)}return l}function fd(t,n,e){const{outerRadius:r,fontSize:a=12,bgColor:i="#fff"}=e,o=r+2,s=o+ld,l=Vl/s,c=[],f=[];for(const d of n){const g=(d.startAngle+d.endAngle)/2;g<Math.PI?f.push({...d,midAngle:g}):c.push({...d,midAngle:g})}function h(d,g){if(d.length===0)return;d.sort((S,z)=>S.midAngle-z.midAngle);const v=g?.05:Math.PI+.05,m=g?Math.PI-.05:2*Math.PI-.05,b=d.map(S=>S.midAngle),x=Wl(b,v,m,l),A=g?1:-1,w=t.append("g").attr("class","bc-arc-labels");d.forEach((S,z)=>{const Y=S.showLabel!==!1,G=S.showValue!==!1;if(!Y&&!G)return;const B=x[z]-Math.PI/2,P=Math.cos(B)*o,$=Math.sin(B)*o,N=Math.cos(B)*s,L=Math.sin(B)*s,M=N+A*cd;w.append("polyline").attr("class","bc-arc-label-line").attr("points",`${P},${$} ${N},${L} ${M},${L}`).attr("fill","none").attr("stroke","var(--bc-text-color, #999)").attr("stroke-width",1).attr("opacity",.5);const D=M+A*4,q=w.append("text").attr("class","bc-arc-direct-label").attr("x",D).attr("y",L).attr("text-anchor",g?"start":"end").attr("font-size",`${a}px`);if(Y&&q.append("tspan").attr("x",D).attr("dy",G?"-0.1em":"0.35em").attr("font-weight","bold").attr("fill",Jc(S.color,i)).text(S.label),G){const V=S.displayAsPercentage&&S.percentage!=null?`${Math.round(S.percentage)}%`:String(S.value);q.append("tspan").attr("x",D).attr("dy",Y?"1.2em":"0.35em").attr("fill","var(--bc-text-color, #666)").text(V)}})}h(f,!0),h(c,!1)}const ud=.3;function hd(t,n,e){const{outerRadius:r,innerRadius:a=0,fontSize:i=12}=e,o=(a+r)/2,s=t.append("g").attr("class","bc-arc-labels-inside");for(const l of n){if(l.endAngle-l.startAngle<ud)continue;const f=l.showLabel!==!1,h=l.showValue!==!1;if(!f&&!h)continue;const d=(l.startAngle+l.endAngle)/2-Math.PI/2,g=Math.cos(d)*o,v=Math.sin(d)*o,m=s.append("text").attr("class","bc-arc-inside-label").attr("x",g).attr("y",v).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",`${i}px`),b=hn(l.color);if(f&&m.append("tspan").attr("x",g).attr("dy",h?"-0.5em":"0em").attr("font-weight","bold").attr("fill",b).text(l.label),h){const x=l.displayAsPercentage&&l.percentage!=null?`${Math.round(l.percentage)}%`:String(l.value);m.append("tspan").attr("x",g).attr("dy",f?"1.2em":"0em").attr("fill",b).attr("opacity",.85).text(x)}}}function RA(t,n,e){const{outerRadius:r,innerRadius:a=0,fontSize:i=12,bgColor:o}=e,s=(a+r)/2,l=[],c=[];for(const f of n){const h=f.endAngle-f.startAngle,d=h*s,g=f.label.length*7;d>g*1.2&&h>=ud?l.push(f):c.push(f)}l.length>0&&hd(t,l,{outerRadius:r,innerRadius:a,fontSize:i}),c.length>0&&fd(t,c,{outerRadius:r,fontSize:i,bgColor:o})}function FA(t,n){if(t.length===0)return{left:0,right:0,top:0,bottom:0};const e=Math.max(...t.map(s=>s.length)),r=ld+cd+6+4+e*7+6,i=t.length*Vl/2,o=Math.max(10,i-n+20);return{left:r,right:r,top:o,bottom:o}}const YA=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7"];function IA(t,n,e={},r=!1){var sn,ft,et,gt,Lt,At,Kt,He,ln,Ce,Te,ar,ir,fi,ui;pn(r),Io(t);let a=n,i=[],o=[],s=[],l=null,c,f,h;const d=an.for(t);if(r){const nt=mn(t);f=nt==null?void 0:nt.margin,h=nt==null?void 0:nt.plotRect,d.detach(),(nt==null?void 0:nt.chartType)==="line-multi"?(i=Array.from(t.querySelectorAll(".bc-frame .bc-area")),o=Array.from(t.querySelectorAll(".bc-frame .bc-line")),s=Array.from(t.querySelectorAll(".bc-frame .bc-symbols"))):nt&&(l=nn(t)),c=new Map;for(const Xt of t.querySelectorAll(".bc-frame .bc-annotations, .bc-frame .bc-annotations-range"))for(const[ee,Qt]of Xe(Xt))c.set(ee,Qt);t.replaceChildren()}const{body:g}=dn(t,e.frame),v=a.series??[];let m=v.filter(nt=>!Vr(nt.name,e.seriesOverrides));(e.sortMode==="total"||e.sortMode==="within-groups")&&(m=[...m].sort((nt,Xt)=>{const ee=nt.values.reduce((be,je)=>be+je,0);return Xt.values.reduce((be,je)=>be+je,0)-ee}));const b=e.colors??YA,x=m.map(nt=>nt.name),A=Vn(e.colorizes),w=e.seriesOverrides,S=e.directLabelling===!0||e.directLabelling==="auto"&&e.legend!==!0||!!e.directLabelling&&e.directLabelling!=="auto",z=S?"direct":e.legend!==!1?"legend":"none",Y=x.filter(nt=>vr(nt,z,w)==="direct"),G=e.legend!==!1&&!S,_=qe(g).width,B=350,P=e.legendPosition??"top",$=_>0&&_<B&&(P==="left"||P==="right")?"top":P,N=e.legendAnchor??"start",L=Oi(a.labels,(sn=e.horizontalAxis)==null?void 0:sn.range),M=L.map(nt=>a.labels[nt]);m=m.map(nt=>({...nt,values:L.map(Xt=>nt.values[Xt])})),a={...a,labels:M,series:m};const D=m.flatMap(nt=>nt.values),q=Rr(D,(ft=e.verticalAxis)==null?void 0:ft.range,(et=e.verticalAxis)==null?void 0:et.numberFormat,(gt=e.verticalAxis)==null?void 0:gt.scaleType),V=Cn(_,(Lt=e.verticalAxis)==null?void 0:Lt.labelPosition,(At=e.horizontalAxis)==null?void 0:At.labelPosition,(Kt=e.verticalAxis)==null?void 0:Kt.direction,q),C=Y.length>0?id(Y):0,I=V.top!=null,W=Math.max(0,_-(V.left??50)-(V.right??20)-C),it=G?yr(x,$,W):{width:0,height:0},rt=G?it.height+15:0,ct={...V};if(G&&$==="top"){const nt=I?15:0;ct.top=rt+nt}G&&$==="bottom"&&(ct.bottom=(ct.bottom??24)+rt),G&&$==="left"&&(ct.left=(ct.left??50)+it.width+10),G&&$==="right"&&(ct.right=(ct.right??20)+it.width+10),C>0&&(ct.right=(ct.right??20)+C);const{chartArea:pt,width:xt,height:yt,margin:bt}=gn(g,ct),kt=Ln(f,bt),[j,J]=oa(D,(He=e.verticalAxis)==null?void 0:He.range,(ln=e.verticalAxis)==null?void 0:ln.scaleType),X=so().domain(a.labels).range([0,xt]).padding(e.edgePadding?.6:0),O=X,ht=nt=>X(a.labels[nt])??0,vt=((Ce=e.verticalAxis)==null?void 0:Ce.scaleType)==="log"?cr().domain([j,J]).nice().range([yt,0]):Pe().domain([j,J]).nice().range([yt,0]),Tt=vt.domain(),Ht=Tt[0]<0&&Tt[1]>0?vt(0):void 0;d.attach(pt,kt),d.update({vertical:{scale:vt,height:yt,options:{...e.verticalAxis,gridWidth:xt,topPadding:bt.top}},horizontal:{scale:O,height:yt,options:{...e.horizontalAxis,width:xt,zeroY:Ht}}});const Ft=pt.ownerSVGElement,Yt=Nn(Ft,t,"plot",{x:0,y:0,width:xt,height:yt}),Ut=ot(pt).append("g").attr("clip-path",`url(#${Yt})`),Gt=Ut.node(),dt=m.map(nt=>({name:nt.name,values:nt.values,colorIndex:v.findIndex(Xt=>Xt.name===nt.name)})),$t=Wr(e.interpolation);(Te=e.areaFills)!=null&&Te.length&&HA(Gt,e.areaFills,m,ht,a.labels.length,vt,$t);const U=[];m.forEach((nt,Xt)=>{a.labels.forEach((ee,Qt)=>{U.push({label:ee,value:nt.values[Qt],series:nt.name,colorIndex:Xt})})});const T=e.lineSymbols,F={solid:"",dotted:"2,4",dashed:"8,4","dash-dot":"8,4,2,4"},E=e.valueLabels??!1,at=new Set((e.highlights??[]).map(nt=>nt.target)),wt=e.areaFill??!1,Ct=e.areaFillOpacity??.2,st=nt=>A.get(nt.name)??re(nt.name,nt.colorIndex,b,w),Et=ja().curve($t).x((nt,Xt)=>ht(Xt)).y0(yt).y1(nt=>vt(nt)),Nt=me(t),tt=ot(Gt).append("g").node(),St=ot(Gt).append("g").node(),Dt=new Set(dt.map(nt=>nt.name));if(r){for(const nt of i)Dt.has(((ar=nt.__data__)==null?void 0:ar.name)??"")&&tt.appendChild(nt);for(const nt of o)Dt.has(((ir=nt.__data__)==null?void 0:ir.name)??"")&&St.appendChild(nt)}ge(Nt,{role:"series-area",parent:tt,selector:".bc-area",data:wt?dt:[],key:nt=>nt.name,insert:nt=>nt.append("path").attr("class","bc-area"),attrs:nt=>({"data-series":nt.colorIndex,d:Et(nt.values)??"",fill:st(nt),opacity:Ue(at,nt.name,Ct)})}),ge(Nt,{role:"series-line",parent:St,selector:".bc-line",data:dt,key:nt=>nt.name,insert:nt=>nt.append("path").attr("class","bc-line"),attrs:nt=>{const Xt=od(nt.name,e.interpolation??"linear",w),ee=Za().curve(Wr(Xt)).x((Qt,be)=>ht(be)).y(Qt=>vt(Qt));return{"data-series":nt.colorIndex,d:ee(nt.values)??"",fill:"none",stroke:st(nt),"stroke-width":MA(nt.name,w),"stroke-dasharray":F[SA(nt.name,w)]??"",opacity:Ue(at,nt.name,1)}}}),ot(Gt).append("g").selectAll(".bc-dot").data(U,nt=>nt.label+"\0"+nt.series).enter().append("circle").attr("class","bc-dot").attr("data-series",nt=>nt.colorIndex).attr("cx",nt=>ht(a.labels.indexOf(nt.label))).attr("cy",nt=>vt(nt.value)).attr("r",3).attr("fill",nt=>st({name:nt.series,colorIndex:nt.colorIndex})).attr("fill-opacity",0).attr("stroke-opacity",0).attr("pointer-events","none");const Zt={left:bt.left,top:bt.top,width:xt,height:yt};if(En(Nt,{svg:Ft,clipId:Yt,group:pt,from:h,to:Zt,active:r&&(o.length>0||i.length>0)}),(fi=e.annotations)!=null&&fi.length){const nt=a.labels.map((Xt,ee)=>{var Qt;return{label:Xt,value:((Qt=m[0])==null?void 0:Qt.values[ee])??0}});Ro(pt,e.annotations,{scaleX:O,scaleY:vt,data:nt,width:xt,height:yt,backgroundColor:Be(t),transition:r,priorAnnotations:c})}const ae=ot(Gt).append("g").attr("class","bc-value-labels");if(U.forEach(nt=>{if(!Sa(nt.series,E,w))return;const Xt=ht(a.labels.indexOf(nt.label)),ee=vt(nt.value);ae.append("text").attr("class","bc-value-label").attr("data-series",nt.colorIndex).attr("x",Xt).attr("y",ee-8).attr("text-anchor","middle").attr("font-size","11px").attr("fill","currentColor").text(String(nt.value))}),e.tooltips||e.crosshair){const nt=U.map(Xt=>({cx:ht(a.labels.indexOf(Xt.label)),cy:vt(Xt.value),label:Xt.label,value:Xt.value,series:Xt.series,color:re(Xt.series,Xt.colorIndex,b,w)}));Ho(pt,{width:xt,height:yt,points:nt,tooltip:e.tooltips,crosshair:e.crosshair,crosshairDirection:e.crosshairDirection,crosshairStyle:e.crosshairStyle,crosshairColor:e.crosshairColor,numberFormat:(ui=e.verticalAxis)==null?void 0:ui.numberFormat,container:t})}const $e=T?{symbolShape:T.symbol,symbolShowOn:T.showOn,symbolStyle:T.style,symbolSize:T.size,symbolOpacity:T.opacity}:void 0,Ze=a.labels.length;m.forEach((nt,Xt)=>{const ee=$A(nt.name,$e,w);if(!ee)return;const Qt={symbol:ee.symbolShape??(T==null?void 0:T.symbol)??Ke.Circle,showOn:ee.symbolShowOn??(T==null?void 0:T.showOn)??Je.FirstLast,style:ee.symbolStyle??(T==null?void 0:T.style)??Ee.Filled,size:ee.symbolSize??(T==null?void 0:T.size)??3.5,opacity:ee.symbolOpacity??(T==null?void 0:T.opacity)??1},be=a.labels.map((os,hi)=>({cx:ht(hi),cy:vt(nt.values[hi]),color:re(nt.name,Xt,b,w),index:hi})),je=s.find(os=>os.getAttribute("data-series-name")===nt.name);let Xr,is=!1;je?(pt.appendChild(je),Xr=ot(je),is=!0):Xr=ot(pt).append("g").attr("class","bc-symbols").attr("data-series",Xt).attr("data-series-name",nt.name),Bl(Xr,be,Ze,Qt,r&&is)});const Le=a.labels.length-1,yn=ht(Le)+6,fe=[];if(m.forEach((nt,Xt)=>{var je;if(vr(nt.name,z,w)!=="direct")return;const Qt=nt.values[Le],be=((je=w==null?void 0:w.find(Xr=>Xr.name===nt.name))==null?void 0:je.labelText)||nt.name;fe.push({name:nt.name,index:Xt,naturalY:vt(Qt),text:be})}),fe.length>0){fe.sort((Qt,be)=>Qt.naturalY-be.naturalY);const nt=fe.map(Qt=>Qt.naturalY),ee=Wl(nt,0,yt,14);fe.forEach((Qt,be)=>{ot(pt).append("text").attr("class","bc-direct-label").attr("data-series",Qt.index).attr("x",yn).attr("y",ee[be]).attr("dy","0.35em").attr("font-size","11px").attr("fill",re(Qt.name,Qt.index,b,w)).text(Qt.text)})}const ie=x.filter(nt=>vr(nt,z,w)==="legend");if(G&&ie.length>0){const nt=ie.map(Qt=>{const be=v.findIndex(je=>je.name===Qt);return re(Qt,be,b,w)});let Xt=0,ee=0;if($==="top"){const Qt=I?15:0;ee=-(it.height+10+Qt)}else $==="bottom"?ee=yt+25:$==="left"?Xt=-(it.width+10):$==="right"&&(Xt=xt+10);br(pt,ie,nt,ee,$,N,xt,yt,Xt,[],{left:bt.left,right:bt.right})}bn(t,{chartType:"line-multi",margin:bt,plotRect:Zt}),l&&(en(Ut.node()),rn(t,l))}function HA(t,n,e,r,a,i,o){const s=ot(t).append("g").attr("class","bc-area-fills");for(const l of n){const c=e.find(m=>m.name===l.from),f=e.find(m=>m.name===l.to);if(!c||!f)continue;const h=l.interpolation?Wr(l.interpolation):o,d=(l.opacity??30)/100,g=l.color??"#ccc",v=l.negativeColor;if(v)VA(s,c.values,f.values,r,i,h,g,v,d);else{const m=ja().curve(h).x((b,x)=>r(x)).y0((b,x)=>i(f.values[x])).y1(b=>i(b));s.append("path").attr("class","bc-area-fill").attr("d",m(c.values)??"").attr("fill",g).attr("opacity",d)}}}function BA(t,n,e,r){const a=t-e,i=n-r;if(a===0&&i===0||a>0&&i>0||a<0&&i<0)return null;const o=i-a;if(o===0)return null;const s=-a/o;return s<0||s>1?null:s}function VA(t,n,e,r,a,i,o,s,l){const c=n.length;if(c===0)return;const f=[];for(let v=0;v<c;v++){const m=r(v),b=a(n[v]),x=a(e[v]);if(f.push({x:m,fromY:b,toY:x}),v<c-1){const A=a(n[v+1]),w=a(e[v+1]),S=BA(b,A,x,w);if(S!==null&&S>0&&S<1){const z=m+S*(r(v+1)-m),Y=b+S*(A-b),G=x+S*(w-x);f.push({x:z,fromY:Y,toY:G})}}}const h=[];let d=[],g=null;for(const v of f){const m=v.fromY-v.toY,b=m<0;g===null?(g=m===0?null:b,d.push(v)):m===0?(d.push(v),d.length>=2&&h.push({points:d,positive:g}),d=[v],g=null):g===b?d.push(v):(d.push(v),d.length>=2&&h.push({points:d,positive:g}),d=[v],g=b)}d.length>=2&&g!==null&&h.push({points:d,positive:g});for(const v of h){const m=v.points;let b=`M${m[0].x},${m[0].fromY}`;for(let x=1;x<m.length;x++)b+=`L${m[x].x},${m[x].fromY}`;for(let x=m.length-1;x>=0;x--)b+=`L${m[x].x},${m[x].toY}`;b+="Z",t.append("path").attr("class",`bc-area-fill ${v.positive?"bc-area-fill-pos":"bc-area-fill-neg"}`).attr("d",b).attr("fill",v.positive?o:s).attr("opacity",l)}}const WA=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7"];class GA extends zr{initialize(){}}function qA(t,n,e={},r=!1){dd(t,n,e,.6,r)}function dd(t,n,e,r,a=!1){var J;pn(a);let i=null,o;if(a){const X=mn(t),O=r>0?"donut":"pie";X&&X.chartType!==O&&(i=nn(t)),o=new Map;for(const ht of t.querySelectorAll(".bc-frame .bc-annotations, .bc-frame .bc-annotations-range"))for(const[mt,vt]of Xe(ht))o.set(mt,vt);t.replaceChildren()}const{body:s}=dn(t,e.frame);let l=[...n.labels],c=[...n.values];if(e.sort===pe.Ascending||e.sort===pe.Descending){const X=l.map((O,ht)=>({label:O,value:c[ht]}));X.sort((O,ht)=>e.sort===pe.Ascending?O.value-ht.value:ht.value-O.value),l=X.map(O=>O.label),c=X.map(O=>O.value)}if(e.sliceMax&&e.sliceMax>0&&l.length>e.sliceMax){const X=e.sliceMax-1,O=l.slice(0,X),ht=c.slice(0,X),mt=c.slice(X).reduce((vt,Tt)=>vt+Tt,0);O.push(e.sliceGroupLabel??"Others"),ht.push(mt),l=O,c=ht}const f=c.reduce((X,O)=>X+O,0),h=c.map(X=>f>0?X/f*100:0),d=e.colors??WA,g=d.length<l.length&&d.length>=2?Ot.scale(d).mode("lch").colors(l.length):d,v=typeof e.directLabelling=="string"?e.directLabelling:e.directLabelling?_e.Auto:_e.Off,m=!!v&&!(v===_e.Auto&&e.legend===!0),x=(e.showValues??!0)&&!m?c.map((X,O)=>`(${e.displayAsPercentage?`${Math.round(h[O])}%`:String(X)})`):[],A=e.legend!==!1&&!m,w=qe(s).width,S=350,z=e.legendPosition??"top",Y=w>0&&w<S&&(z==="left"||z==="right")?"top":z,G=e.legendAnchor??"start",_=x.length>0?l.map((X,O)=>`${X} ${x[O]}`):l,B=Math.max(0,w-50-20),P=A?yr(_,Y,B):{width:0,height:0},$=A?P.height+15:0,N={};if(A&&Y==="top"&&(N.top=$),A&&Y==="bottom"&&(N.bottom=24+$),A&&Y==="left"&&(N.left=50+P.width+10),A&&Y==="right"&&(N.right=20+P.width+10),m){const X=qe(s),O=20,ht=X.width-2*O,mt=(X.height>0?X.height:400)-2*O,vt=Math.min(ht,mt)/2,Tt=FA(l,vt);N.left=(N.left??O)+Tt.left,N.right=(N.right??O)+Tt.right,N.top=(N.top??O)+Tt.top,N.bottom=(N.bottom??O)+Tt.bottom}const{chartArea:L,width:M,height:D,margin:q}=gn(s,N),V=Math.min(M,D)/2,C=V*r,I=ll().domain(l).range(g),W=Ex().sort(null),it=Tx().innerRadius(C).outerRadius(V),rt=ot(L).append("g").attr("transform",`translate(${M/2},${D/2})`),ct=Vn(e.colorizes),pt=W(c),xt=pt.map((X,O)=>({label:l[O],arc:X,color:ct.get(l[O])??I(l[O])})),yt=me(t),bt=Aa(e.highlights),kt=rt.append("g").node();ge(yt,{role:"mark-per-category",parent:kt,selector:".bc-arc",data:xt,key:X=>X.label,insert:X=>X.append("path").attr("class","bc-arc"),attrs:X=>{const O={d:it(X.arc)??"",fill:X.color};return bt.size>0?{...O,opacity:Ue(bt,X.label)}:O}});const j=new GA(rt);if(e.tooltips&&j.use(pr()),j.draw(xt),(J=e.annotations)!=null&&J.length){const X=e.annotations.filter(O=>O.kind==="free");X.length&&wa(X,{scaleX:tn().domain([]).range([0,M]),scaleY:Pe().domain([0,1]).range([D,0]),data:[],width:M,height:D,backgroundColor:Be(t),transition:a,priorAnnotations:o}).postDraw({base:ot(L)},void 0)}if(m){const X=pt.map((vt,Tt)=>({label:l[Tt],value:vt.data,startAngle:vt.startAngle,endAngle:vt.endAngle,color:I(l[Tt]),percentage:h[Tt],displayAsPercentage:e.displayAsPercentage,showLabel:e.showLabels??!0,showValue:e.showValues??!0})),O=rt,ht=Be(t),mt={outerRadius:V,innerRadius:C,bgColor:ht};v===_e.Inside?hd(O,X,mt):v===_e.Auto?RA(O,X,mt):fd(O,X,mt)}if(e.showTotal&&r>0&&!e.displayAsPercentage){const X=String(f);rt.append("text").attr("class","bc-arc-total-label").attr("text-anchor","middle").attr("dy","-0.3em").attr("font-size","11px").attr("fill","var(--bc-text-color, #555)").attr("opacity",.7).text("Total"),rt.append("text").attr("class","bc-arc-total-value").attr("text-anchor","middle").attr("dy","1em").attr("font-size","18px").attr("font-weight","bold").attr("fill","var(--bc-text-color, #555)").text(X)}if(A){let X=0,O=0;Y==="top"?O=-(P.height+10):Y==="bottom"?O=D+25:Y==="left"?X=-(P.width+10):Y==="right"&&(X=M+10),br(L,l,g,O,Y,G,M,D,X,x,{left:q.left,right:q.right})}bn(t,{chartType:r>0?"donut":"pie"}),i&&(en(rt.node()),rn(t,i))}function XA(t,n,e={},r=!1){dd(t,n,e,0,r)}const UA="#4e79a7";function ZA(t,n,e={},r=!1){var ht,mt,vt,Tt,Ht,Ft,Yt,Ut,Gt,dt,$t,U,T;pn(r),Io(t);let a=[],i=[],o=null,s=null,l,c,f;const h=an.for(t);if(r){const F=mn(t);c=F==null?void 0:F.margin,f=F==null?void 0:F.plotRect,h.detach(),(F==null?void 0:F.chartType)==="area"?(a=Array.from(t.querySelectorAll(".bc-frame .bc-area")),i=Array.from(t.querySelectorAll(".bc-frame .bc-line")),o=t.querySelector(".bc-frame .bc-symbols")):F&&(s=nn(t)),l=new Map;for(const E of t.querySelectorAll(".bc-frame .bc-annotations, .bc-frame .bc-annotations-range"))for(const[at,wt]of Xe(E))l.set(at,wt);t.replaceChildren()}const{body:d}=dn(t,e.frame),g=qe(d).width,v=Rr(n.values,(ht=e.verticalAxis)==null?void 0:ht.range,(mt=e.verticalAxis)==null?void 0:mt.numberFormat,(vt=e.verticalAxis)==null?void 0:vt.scaleType),m=Cn(g,(Tt=e.verticalAxis)==null?void 0:Tt.labelPosition,(Ht=e.horizontalAxis)==null?void 0:Ht.labelPosition,(Ft=e.verticalAxis)==null?void 0:Ft.direction,v),{chartArea:b,width:x,height:A,margin:w}=gn(d,m),S=Ln(c,w),z=Oi(n.labels,(Yt=e.horizontalAxis)==null?void 0:Yt.range),Y=z.map(F=>n.labels[F]),G=z.map(F=>n.values[F]),_=Y.map((F,E)=>({label:F,value:G[E]})),B=so().domain(Y).range([0,x]).padding(e.edgePadding?.6:0),P=B,$=F=>B(F.label)??0,N=((Ut=e.verticalAxis)==null?void 0:Ut.scaleType)==="log",[L,M]=oa(G,(Gt=e.verticalAxis)==null?void 0:Gt.range,(dt=e.verticalAxis)==null?void 0:dt.scaleType),D=N?cr().domain([L,M]).nice().range([A,0]):Pe().domain([L,M]).nice().range([A,0]),q=D.domain(),V=q[0]<0&&q[1]>0?D(0):void 0;h.attach(b,S),h.update({vertical:{scale:D,height:A,options:{...e.verticalAxis,gridWidth:x,topPadding:w.top}},horizontal:{scale:P,height:A,options:{...e.horizontalAxis,width:x,zeroY:V}}});const C=b.ownerSVGElement,I=Nn(C,t,"plot",{x:0,y:0,width:x,height:A}),W=ot(b).append("g").attr("clip-path",`url(#${I})`),it=W.node(),rt=(($t=e.colors)==null?void 0:$t[0])??UA,ct=Wr(e.interpolation??"monotoneX"),pt=e.areaFillOpacity??.25,xt=ja().curve(ct).x(F=>$(F)).y0(A).y1(F=>D(F.value)),yt=Za().curve(ct).x(F=>$(F)).y(F=>D(F.value)),bt=ot(it).append("g").node(),kt=ot(it).append("g").node();if(r){for(const F of a)bt.appendChild(F);for(const F of i)kt.appendChild(F)}const j=me(t),J=[{name:"area",points:_}];ge(j,{role:"series-area",parent:bt,selector:".bc-area",data:J,key:F=>F.name,insert:F=>F.append("path").attr("class","bc-area"),attrs:F=>({d:xt(F.points)??"",fill:rt,opacity:pt})}),ge(j,{role:"series-line",parent:kt,selector:".bc-line",data:J,key:F=>F.name,insert:F=>F.append("path").attr("class","bc-line"),attrs:F=>({d:yt(F.points)??"",fill:"none",stroke:rt,"stroke-width":2})}),ot(it).append("g").selectAll(".bc-dot").data(_,F=>F.label).enter().append("circle").attr("class","bc-dot").attr("cx",F=>$(F)).attr("cy",F=>D(F.value)).attr("r",3).attr("fill",rt).attr("fill-opacity",0).attr("stroke-opacity",0).attr("pointer-events","none");const O={left:w.left,top:w.top,width:x,height:A};if(En(j,{svg:C,clipId:I,group:b,from:f,to:O,active:r&&(a.length>0||i.length>0)}),(U=e.annotations)!=null&&U.length&&Ro(b,e.annotations,{scaleX:P,scaleY:D,data:_,width:x,height:A,backgroundColor:Be(t),transition:r,priorAnnotations:l}),e.tooltips||e.crosshair){const F=_.map(E=>({cx:$(E),cy:D(E.value),label:E.label,value:E.value,color:rt}));Ho(b,{width:x,height:A,points:F,tooltip:e.tooltips,crosshair:e.crosshair,crosshairDirection:e.crosshairDirection,crosshairStyle:e.crosshairStyle,crosshairColor:e.crosshairColor,numberFormat:(T=e.verticalAxis)==null?void 0:T.numberFormat,container:t})}if(e.valueLabels&&ot(it).append("g").selectAll(".bc-value-label").data(_,E=>E.label).enter().append("text").attr("class","bc-value-label").attr("x",E=>$(E)).attr("y",E=>D(E.value)-8).attr("text-anchor","middle").attr("font-size","11px").attr("fill","currentColor").text(E=>String(E.value)),e.lineSymbols){const F=_.map((at,wt)=>({cx:$(at),cy:D(at.value),color:rt,index:wt}));let E;o?(b.appendChild(o),E=ot(o)):E=ot(b).append("g").attr("class","bc-symbols"),Bl(E,F,_.length,e.lineSymbols,r)}bn(t,{chartType:"area",margin:w,plotRect:O}),s&&(en(W.node()),rn(t,s))}function Gl(t){const n=t.series??[];if(n.length===0)return[];const e=n.map(o=>o.name);let r=!1;const a=t.labels.map((o,s)=>{const l={_index:s};return n.forEach(c=>{const f=c.values[s]??0;f<0&&(r=!0),l[c.name]=f}),l});return ju().keys(e).order(vo).offset(r?n2:yo)(a)}function ql(t){const n=t.series??[];if(n.length===0)return[];const e=n.map(o=>o.name),r=t.labels.map((o,s)=>{const l={_index:s};return n.forEach(c=>{l[c.name]=c.values[s]??0}),l}),i=ju().keys(e).order(vo).offset(e2)(r);for(const o of i)for(const s of o)s[0]*=100,s[1]*=100;return i}const jA=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7"];function KA(t,n,e={},r=!1){var ae,$e,Ze,Le,yn,fe,ie,sn,ft;pn(r),Io(t);let a=n,i=[],o=[],s=null,l,c,f;const h=an.for(t);if(r){const et=mn(t);c=et==null?void 0:et.margin,f=et==null?void 0:et.plotRect,h.detach(),(et==null?void 0:et.chartType)==="area-stacked"?(i=Array.from(t.querySelectorAll(".bc-frame .bc-area")),o=Array.from(t.querySelectorAll(".bc-frame .bc-line"))):et&&(s=nn(t)),l=new Map;for(const gt of t.querySelectorAll(".bc-frame .bc-annotations, .bc-frame .bc-annotations-range"))for(const[Lt,At]of Xe(gt))l.set(Lt,At);t.replaceChildren()}const{body:d}=dn(t,e.frame),g=Oi(a.labels,(ae=e.horizontalAxis)==null?void 0:ae.range);if(g.length<a.labels.length){const et=g.map(Lt=>a.labels[Lt]),gt=(a.series??[]).map(Lt=>({...Lt,values:g.map(At=>Lt.values[At])}));a={labels:et,values:g.map(Lt=>a.values[Lt]),series:gt}}const v=a.series??[],m=v.filter(et=>!Vr(et.name,e.seriesOverrides)),b=e.colors??jA,x=m.map(et=>et.name),A=e.seriesOverrides,w=Vn(e.colorizes),S=e.directLabelling===!0||e.directLabelling==="auto"&&e.legend!==!0||!!e.directLabelling&&e.directLabelling!=="auto",z=S?"direct":e.legend!==!1?"legend":"none",Y=x.filter(et=>vr(et,z,A)==="direct"),G=e.legend!==!1&&!S,_=qe(d).width,B=350,P=e.legendPosition??"top",$=_>0&&_<B&&(P==="left"||P==="right")?"top":P,N=e.legendAnchor??"start",L=e.stacked!==!1,M=e.stackPercent===!0||e.stackMode===kr.Percent,D=e.areaSortMode??pe.None,q=e.areaLines!==!1,V=[...m];if(D!==pe.None){const et=new Map(V.map(gt=>[gt.name,gt.values.reduce((Lt,At)=>Lt+At,0)]));V.sort((gt,Lt)=>{const At=(et.get(gt.name)??0)-(et.get(Lt.name)??0);return D===pe.Ascending?At:-At})}const C={labels:a.labels,values:a.values,series:V},I=M?ql(C):Gl(C);let W=0;if(L)for(const et of I)for(const gt of et)gt[1]>W&&(W=gt[1]);else for(const et of V)for(const gt of et.values)gt>W&&(W=gt);M&&(W=100);const it=[0,W],rt=(($e=e.verticalAxis)==null?void 0:$e.numberFormat)??(M?"|d|%":void 0),ct=Rr(it,(Ze=e.verticalAxis)==null?void 0:Ze.range,rt,(Le=e.verticalAxis)==null?void 0:Le.scaleType),pt=Cn(_,(yn=e.verticalAxis)==null?void 0:yn.labelPosition,(fe=e.horizontalAxis)==null?void 0:fe.labelPosition,(ie=e.verticalAxis)==null?void 0:ie.direction,ct),xt=Y.length>0?id(Y):0,yt=pt.top!=null,bt=Math.max(0,_-(pt.left??50)-(pt.right??20)-xt),kt=G?yr(x,$,bt):{width:0,height:0},j=G?kt.height+15:0,J={...pt};if(G&&$==="top"){const et=yt?15:0;J.top=j+et}G&&$==="bottom"&&(J.bottom=(J.bottom??24)+j),G&&$==="left"&&(J.left=(J.left??50)+kt.width+10),G&&$==="right"&&(J.right=(J.right??20)+kt.width+10),xt>0&&(J.right=(J.right??20)+xt);const{chartArea:X,width:O,height:ht,margin:mt}=gn(d,J),vt=Ln(c,mt),Tt=so().domain(a.labels).range([0,O]).padding(e.edgePadding?.6:0),Ht=Tt,Ft=et=>Tt(a.labels[et])??0,Yt=Pe().domain([0,W]).nice().range([ht,0]);h.attach(X,vt),h.update({vertical:{scale:Yt,height:ht,options:{...e.verticalAxis,numberFormat:rt,gridWidth:O,topPadding:mt.top}},horizontal:{scale:Ht,height:ht,options:{...e.horizontalAxis,width:O}}});const Ut=X.ownerSVGElement,Gt=Nn(Ut,t,"plot",{x:0,y:0,width:O,height:ht}),dt=ot(X).append("g").attr("clip-path",`url(#${Gt})`),$t=dt.node(),U=Wr(e.interpolation??"monotoneX"),T=I.map(et=>{const gt=v.findIndex(At=>At.name===et.key);let Lt;if(L)Lt=Array.from(et).map(At=>[Yt(At[0]),Yt(At[1])]);else{const At=V.find(Kt=>Kt.name===et.key);Lt=((At==null?void 0:At.values)??[]).map(Kt=>[Yt(0),Yt(Kt)])}return{name:et.key,points:Lt,colorIndex:gt>=0?gt:0}}),F=new Set((e.highlights??[]).map(et=>et.target)),E=F.size>0,at=e.areaFillOpacity!=null?e.areaFillOpacity:.85,wt=et=>w.get(et.name)??re(et.name,et.colorIndex,b,A),Ct=ja().curve(U).x((et,gt)=>Ft(gt)).y0(et=>et[0]).y1(et=>et[1]),st=ot($t).append("g").node(),Et=ot($t).append("g").node();if(r){for(const et of i)st.appendChild(et);for(const et of o)Et.appendChild(et)}const Nt=me(t);ge(Nt,{role:"series-area",parent:st,selector:".bc-area",data:T,key:et=>et.name,insert:et=>et.append("path").attr("class","bc-area"),attrs:et=>({"data-series":et.colorIndex,d:Ct(et.points)??"",fill:wt(et),opacity:E?Ue(F,et.name,at):at})}),ge(Nt,{role:"series-line",parent:Et,selector:".bc-line",data:q?T:[],key:et=>et.name,insert:et=>et.append("path").attr("class","bc-line"),attrs:et=>{const gt=od(et.name,e.interpolation??"monotoneX",A),Lt=Za().curve(Wr(gt)).x((At,Kt)=>Ft(Kt)).y(At=>At[1]);return{"data-series":et.colorIndex,d:Lt(et.points)??"",fill:"none",stroke:wt(et),"stroke-width":1,opacity:E?Ue(F,et.name,1):1}}});const tt={left:mt.left,top:mt.top,width:O,height:ht};if(En(Nt,{svg:Ut,clipId:Gt,group:X,from:f,to:tt,active:r&&(i.length>0||o.length>0)}),(sn=e.annotations)!=null&&sn.length){const et=a.labels.map((gt,Lt)=>{var At;return{label:gt,value:((At=m[0])==null?void 0:At.values[Lt])??0}});Ro(X,e.annotations,{scaleX:Ht,scaleY:Yt,data:et,width:O,height:ht,backgroundColor:Be(t),transition:r,priorAnnotations:l})}if(e.tooltips||e.crosshair){const et=[];I.forEach(gt=>{const Lt=v.findIndex(At=>At.name===gt.key);Array.from(gt).forEach((At,Kt)=>{const He=At[1]-At[0];et.push({cx:Ft(Kt),cy:Yt(At[1]),label:a.labels[Kt],value:Math.round(He*100)/100,series:gt.key,color:re(gt.key,Lt,b,A)})})}),Ho(X,{width:O,height:ht,points:et,tooltip:e.tooltips,crosshair:e.crosshair,crosshairDirection:e.crosshairDirection,crosshairStyle:e.crosshairStyle,crosshairColor:e.crosshairColor,numberFormat:(ft=e.verticalAxis)==null?void 0:ft.numberFormat,container:t})}const St=a.labels.length-1,Dt=Ft(St)+6,Pt=[];if(m.forEach((et,gt)=>{var Ce;if(vr(et.name,z,A)!=="direct")return;const At=I.find(Te=>Te.key===et.name);if(!At)return;const Kt=At[St],He=Yt((Kt[0]+Kt[1])/2),ln=((Ce=A==null?void 0:A.find(Te=>Te.name===et.name))==null?void 0:Ce.labelText)||et.name;Pt.push({name:et.name,index:gt,naturalY:He,text:ln})}),Pt.length>0){Pt.sort((At,Kt)=>At.naturalY-Kt.naturalY);const et=Pt.map(At=>At.naturalY),Lt=Wl(et,0,ht,14);Pt.forEach((At,Kt)=>{ot(X).append("text").attr("class","bc-direct-label").attr("data-series",At.index).attr("x",Dt).attr("y",Lt[Kt]).attr("dy","0.35em").attr("font-size","11px").attr("fill",re(At.name,At.index,b,A)).text(At.text)})}const Zt=x.filter(et=>vr(et,z,A)==="legend");if(G&&Zt.length>0){const et=Zt.map(At=>{const Kt=v.findIndex(He=>He.name===At);return re(At,Kt,b,A)});let gt=0,Lt=0;if($==="top"){const At=yt?15:0;Lt=-(kt.height+10+At)}else $==="bottom"?Lt=ht+25:$==="left"?gt=-(kt.width+10):$==="right"&&(gt=O+10);br(X,Zt,et,Lt,$,N,O,ht,gt,[],{left:mt.left,right:mt.right})}bn(t,{chartType:"area-stacked",margin:mt,plotRect:tt}),s&&(en(dt.node()),rn(t,s))}const JA=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7"];function QA(t,n,e){const r=[];for(const a of t){const i=a.key,o=e.findIndex(s=>s.name===i);for(let s=0;s<a.length;s++){const l=a[s];r.push({label:n[s],seriesName:i,seriesIndex:o,y0:l[0],y1:l[1],value:l[1]-l[0]})}}return r}function t_(t,n,e={},r=!1){var $t,U,T,F,E,at,wt,Ct;pn(r);let a=[],i=null,o,s,l;const c=an.for(t);if(r){const st=mn(t);s=st==null?void 0:st.margin,l=st==null?void 0:st.plotRect,c.detach(),(st==null?void 0:st.chartType)==="column-stacked"?a=Array.from(t.querySelectorAll(".bc-frame .bc-bar-stacked")):st&&(i=nn(t)),o=new Map;for(const Et of t.querySelectorAll(".bc-frame .bc-annotations, .bc-frame .bc-annotations-range"))for(const[Nt,tt]of Xe(Et))o.set(Nt,tt);t.replaceChildren()}const{body:f}=dn(t,e.frame),h=n.series??[],d=h.filter(st=>!Vr(st.name,e.seriesOverrides)),g=d.map(st=>st.name),v=e.colors??JA,m=e.seriesOverrides,b=e.legend!==!1,x=qe(f).width,A=350,w=e.legendPosition??"top",S=x>0&&x<A&&(w==="left"||w==="right")?"top":w,z=e.legendAnchor??"start",Y={labels:n.labels,values:n.values,series:d},G=e.stackMode===kr.Percent,_=G?ql(Y):Gl(Y),B=QA(_,n.labels,h),P=G?100:Mr(B,st=>st.y1)??0,N=Rr([0,P],($t=e.verticalAxis)==null?void 0:$t.range,(U=e.verticalAxis)==null?void 0:U.numberFormat,(T=e.verticalAxis)==null?void 0:T.scaleType),L=Cn(x,(F=e.verticalAxis)==null?void 0:F.labelPosition,(E=e.horizontalAxis)==null?void 0:E.labelPosition,(at=e.verticalAxis)==null?void 0:at.direction,N),M=Math.max(0,x-(L.left??50)-(L.right??20)),D=Ml(n.labels,M,e.horizontalAxis);D!==void 0&&(L.bottom=D);const q=L.top!=null,V=Math.max(0,x-(L.left??50)-(L.right??20)),C=b?yr(g,S,V):{width:0,height:0},I=b?C.height+15:0,W={...L};if(b&&S==="top"){const st=q?15:0;W.top=I+st}b&&S==="bottom"&&(W.bottom=(W.bottom??24)+I),b&&S==="left"&&(W.left=(W.left??50)+C.width+10),b&&S==="right"&&(W.right=(W.right??20)+C.width+10);const{chartArea:it,width:rt,height:ct,margin:pt}=gn(f,W),xt=Ln(s,pt);let yt=n.labels;if(e.sortMode==="total"){const st=n.labels.map((Et,Nt)=>({label:Et,index:Nt,total:d.reduce((tt,St)=>tt+(St.values[Nt]??0),0)}));st.sort((Et,Nt)=>Nt.total-Et.total),yt=st.map(Et=>Et.label)}const bt=tn().domain(yt).range([0,rt]).padding(Sr(e.barGap)),kt=Pe().domain([0,P]).nice().range([ct,0]);c.attach(it,xt),c.update({vertical:{scale:kt,height:ct,options:{...e.verticalAxis,gridWidth:rt,topPadding:pt.top}},horizontal:{scale:bt,height:ct,options:{...e.horizontalAxis,width:rt}}});const j=it.ownerSVGElement,J=Nn(j,t,"bars",{x:0,y:0,width:rt,height:ct}),X=ot(it).append("g").attr("clip-path",`url(#${J})`),O=yt===n.labels?B:yt.flatMap(st=>B.filter(Et=>Et.label===st)),ht=Vn(e.colorizes),mt=Aa(e.highlights),vt=me(t),Tt=X.append("g").node();if(r)for(const st of a)st.removeAttribute("opacity"),st.removeAttribute("fill-opacity"),Tt.appendChild(st);ge(vt,{role:"mark-per-cell",parent:Tt,selector:".bc-bar-stacked",data:O,key:st=>st.label+"\0"+st.seriesName,insert:st=>st.append("rect").attr("class","bc-bar bc-bar-stacked"),attrs:st=>{const Et=ht.get(st.seriesName)??re(st.seriesName,st.seriesIndex,v,m),Nt=ai(st.seriesName,m),tt={"data-series":st.seriesName,x:bt(st.label)??0,y:kt(st.y1),width:bt.bandwidth(),height:kt(st.y0)-kt(st.y1),fill:Et};return Nt<1&&(tt["fill-opacity"]=Nt),mt.size>0&&(tt.opacity=Ue(mt,st.seriesName)),tt}});const Ht={left:pt.left,top:pt.top,width:rt,height:ct};En(vt,{svg:j,clipId:J,group:it,from:l,to:Ht,active:r&&a.length>0});const Ft=Hr(X);if(e.tooltips&&Ft.use(pr({numberFormat:(wt=e.verticalAxis)==null?void 0:wt.numberFormat})),e.crosshair&&Ft.use(Ir({width:rt,height:ct,direction:e.crosshairDirection,style:e.crosshairStyle,color:e.crosshairColor})),(Ct=e.annotations)!=null&&Ct.length){const st=n.labels.map((Et,Nt)=>({label:Et,value:d.reduce((tt,St)=>tt+(St.values[Nt]??0),0)}));Ft.use(wa(e.annotations,{scaleX:bt,scaleY:kt,data:st,width:rt,height:ct,backgroundColor:Be(t),transition:r,priorAnnotations:o}))}const Yt=()=>Ft.draw(O);vt.state==="committing"?vt.register(Yt):Yt(),bn(t,{chartType:"column-stacked",margin:pt,plotRect:Ht}),i&&(en(X.node()),rn(t,i));const Ut=e.valueLabels??!1,Gt=uf(O,st=>Mr(st,Et=>Et.y1)??0,st=>st.label),dt=ot(it).append("g").attr("class","bc-value-labels");if(O.forEach(st=>{if(!Sa(st.seriesName,Ut,m))return;const Et=(bt(st.label)??0)+bt.bandwidth()/2,Nt=Math.abs(kt(st.y0)-kt(st.y1)),tt=kt(st.y0)-Nt/2,St=G?`${Math.round(st.value)}%`:e.valueLabels==="percent"?xo(st.value,Gt.get(st.label)??0):String(Math.round(st.value*100)/100);Br({text:St,placement:"inside",orientation:"vertical",barWidth:bt.bandwidth(),barHeight:Nt})&&dt.append("text").attr("class","bc-value-label").attr("data-series",st.seriesName).attr("x",Et).attr("y",tt).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size","11px").attr("fill","currentColor").text(St)}),b&&g.length>0){const st=g.map(tt=>{const St=h.findIndex(Dt=>Dt.name===tt);return re(tt,St,v,m)});let Et=0,Nt=0;if(S==="top"){const tt=q?15:0;Nt=-(C.height+10+tt)}else S==="bottom"?Nt=ct+25:S==="left"?Et=-(C.width+10):S==="right"&&(Et=rt+10);br(it,g,st,Nt,S,z,rt,ct,Et,[],{left:pt.left,right:pt.right})}}const e_=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7"],gd=13;function n_(t,n,e){const r=[];for(const a of t){const i=a.key,o=e.findIndex(s=>s.name===i);for(let s=0;s<a.length;s++){const l=a[s];r.push({label:n[s],seriesName:i,seriesIndex:o,y0:l[0],y1:l[1],value:l[1]-l[0]})}}return r}function r_(t,n,e={},r=!1){var E,at,wt,Ct,st,Et,Nt;pn(r);let a=[],i=null,o,s,l;const c=an.for(t);if(r){const tt=mn(t);s=tt==null?void 0:tt.margin,l=tt==null?void 0:tt.plotRect,c.detach(),(tt==null?void 0:tt.chartType)==="bar-stacked"?a=Array.from(t.querySelectorAll(".bc-frame .bc-bar-stacked")):tt&&(i=nn(t)),o=new Map;for(const St of t.querySelectorAll(".bc-frame .bc-annotations, .bc-frame .bc-annotations-range"))for(const[Dt,Pt]of Xe(St))o.set(Dt,Pt);t.replaceChildren()}const{body:f}=dn(t,e.frame),h=n.series??[],d=h.filter(tt=>!Vr(tt.name,e.seriesOverrides)),g=d.map(tt=>tt.name),v=e.colors??e_,m=e.seriesOverrides,b=e.legend!==!1,x=qe(f).width,A=350,w=e.legendPosition??"top",S=x>0&&x<A&&(w==="left"||w==="right")?"top":w,z=e.legendAnchor??"start",Y={labels:n.labels,values:n.values,series:d},G=e.stackMode===kr.Percent,_=G?ql(Y):Gl(Y),B=n_(_,n.labels,h),P=G?100:Mr(B,tt=>tt.y1)??0,$=e.categoryLabelLine===!0,N=_o(n.labels),L=$?Jt.Off:(E=e.verticalAxis)==null?void 0:E.labelPosition,M=Cn(x,L,(at=e.horizontalAxis)==null?void 0:at.labelPosition,(wt=e.verticalAxis)==null?void 0:wt.direction,N,(Ct=e.horizontalAxis)==null?void 0:Ct.showAxis),D=M.top!=null,q=Math.max(0,x-(M.left??50)-(M.right??20)),V=b?yr(g,S,q):{width:0,height:0},C=b?V.height+15:0,I={...M};if(b&&S==="top"){const tt=D?15:0;I.top=C+tt}b&&S==="bottom"&&(I.bottom=(I.bottom??24)+C),b&&S==="left"&&(I.left=(I.left??50)+V.width+10),b&&S==="right"&&(I.right=(I.right??20)+V.width+10);const{chartArea:W,width:it,height:rt,margin:ct}=gn(f,I),pt=Ln(s,ct);let xt=n.labels;if(e.sortMode==="total"){const tt=n.labels.map((St,Dt)=>({label:St,index:Dt,total:d.reduce((Pt,Zt)=>Pt+(Zt.values[Dt]??0),0)}));tt.sort((St,Dt)=>Dt.total-St.total),xt=tt.map(St=>St.label)}const yt=Pe().domain([0,P]).nice().range([0,it]),bt=tn().domain(xt).range([0,rt]).padding(Sr(e.barGap));c.attach(W,pt),c.update({horizontal:{scale:yt,height:rt,options:{...e.horizontalAxis,width:it}},vertical:{scale:bt,height:rt,options:{...e.verticalAxis,labelPosition:$?Jt.Off:(st=e.verticalAxis)==null?void 0:st.labelPosition,topPadding:ct.top}},order:"horizontal-first"});const kt=W.ownerSVGElement,j=Nn(kt,t,"bars",{x:0,y:0,width:it,height:rt}),J=ot(W).append("g").attr("clip-path",`url(#${j})`),X=xt===n.labels?B:xt.flatMap(tt=>B.filter(St=>St.label===tt)),O=$?gd:0,ht=Vn(e.colorizes),mt=Aa(e.highlights),vt=me(t),Tt=J.append("g").node();if(r)for(const tt of a)tt.removeAttribute("opacity"),tt.removeAttribute("fill-opacity"),Tt.appendChild(tt);ge(vt,{role:"mark-per-cell",parent:Tt,selector:".bc-bar-stacked",data:X,key:tt=>tt.label+"\0"+tt.seriesName,insert:tt=>tt.append("rect").attr("class","bc-bar bc-bar-stacked"),attrs:tt=>{const St=ht.get(tt.seriesName)??re(tt.seriesName,tt.seriesIndex,v,m),Dt=ai(tt.seriesName,m),Pt={"data-series":tt.seriesName,x:yt(tt.y0),y:(bt(tt.label)??0)+O,width:yt(tt.y1)-yt(tt.y0),height:Math.max(0,bt.bandwidth()-O),fill:St};return Dt<1&&(Pt["fill-opacity"]=Dt),mt.size>0&&(Pt.opacity=Ue(mt,tt.seriesName)),Pt}});const Ht={left:ct.left,top:ct.top,width:it,height:rt};En(vt,{svg:kt,clipId:j,group:W,from:l,to:Ht,active:r&&a.length>0});const Ft=Hr(J);if(e.tooltips&&Ft.use(pr({numberFormat:(Et=e.verticalAxis)==null?void 0:Et.numberFormat})),e.crosshair&&Ft.use(Ir({width:it,height:rt,direction:e.crosshairDirection,style:e.crosshairStyle,color:e.crosshairColor,orientation:Ve.Horizontal})),(Nt=e.annotations)!=null&&Nt.length){const tt=n.labels.map((St,Dt)=>({label:St,value:d.reduce((Pt,Zt)=>Pt+(Zt.values[Dt]??0),0)}));Ft.use(wa(e.annotations,{scaleX:bt,scaleY:yt,data:tt,width:it,height:rt,backgroundColor:Be(t),orientation:Ve.Horizontal,transition:r,priorAnnotations:o}))}const Yt=()=>Ft.draw(X);if(vt.state==="committing"?vt.register(Yt):Yt(),bn(t,{chartType:"bar-stacked",margin:ct,plotRect:Ht}),i&&(en(J.node()),rn(t,i)),$){const tt=ot(W).append("g").attr("class","bc-category-labels");for(const St of xt){const Dt=bt(St)??0;tt.append("text").attr("class","bc-category-label").attr("x",2).attr("y",Dt+gd/2).attr("text-anchor","start").attr("dominant-baseline","central").attr("font-size","10px").attr("font-weight","600").attr("fill","currentColor").text(St)}}const Ut=e.valueLabels??!1,Gt=e.valueLabelPosition??It.Auto,dt=new Set,$t=new Map;for(const tt of xt){const St=X.filter(Dt=>Dt.label===tt).sort((Dt,Pt)=>Dt.y1-Pt.y1);if(St.length>0){const Dt=St[St.length-1];dt.add(Dt.label+"\0"+Dt.seriesName);for(let Pt=0;Pt<St.length-1;Pt++){const Zt=St[Pt].label+"\0"+St[Pt].seriesName;$t.set(Zt,yt(St[Pt+1].y1)-yt(St[Pt].y1))}}}const U=new Map,T=uf(X,tt=>Mr(tt,St=>St.y1)??0,tt=>tt.label),F=ot(W).append("g").attr("class","bc-value-labels");if(X.forEach(tt=>{if(!Sa(tt.seriesName,Ut,m))return;const St=G?`${Math.round(tt.value)}%`:e.valueLabels==="percent"?xo(tt.value,T.get(tt.label)??0):String(Math.round(tt.value*100)/100),Dt=yt(tt.y1)-yt(tt.y0),Pt=St.length*6.5+8,Zt=Dt>=Pt,ae=(bt(tt.label)??0)+O+(bt.bandwidth()-O)/2,$e=re(tt.seriesName,tt.seriesIndex,v,m),Ze=dt.has(tt.label+"\0"+tt.seriesName),Le=Gt===It.Outside||Gt===It.Auto&&!Zt&&Ze,yn=Br({text:St,placement:Le?"outside":"inside",orientation:"horizontal",barWidth:Dt,barHeight:bt.bandwidth()}),fe=()=>{const ie=yt(tt.y0)+Dt/2;F.append("text").attr("class","bc-value-label").attr("data-series",tt.seriesName).attr("opacity",0).attr("x",ie).attr("y",ae).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size","11px").attr("fill",hn($e)).text(St)};if(Le)if(Gt===It.Inside)fe();else{const ie=yt(tt.y1)+4,sn=U.get(tt.label)??0,ft=$t.get(tt.label+"\0"+tt.seriesName),et=ie<sn,gt=ft!==void 0&&Pt+4>ft,Lt=it+ct.right-2,At=ie+Pt>Lt;et||gt||At||!yn?fe():(U.set(tt.label,ie+Pt),F.append("text").attr("class","bc-value-label").attr("data-series",tt.seriesName).attr("x",ie).attr("y",ae).attr("text-anchor","start").attr("dominant-baseline","central").attr("font-size","11px").attr("fill","currentColor").text(St))}else if(!Zt||!yn)fe();else{const ie=yt(tt.y0)+Dt/2;F.append("text").attr("class","bc-value-label").attr("data-series",tt.seriesName).attr("x",ie).attr("y",ae).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size","11px").attr("fill",hn($e)).text(St)}}),b&&g.length>0){const tt=g.map(Pt=>{const Zt=h.findIndex(ae=>ae.name===Pt);return re(Pt,Zt,v,m)});let St=0,Dt=0;if(S==="top"){const Pt=D?15:0;Dt=-(V.height+10+Pt)}else S==="bottom"?Dt=rt+25:S==="left"?St=-(V.width+10):S==="right"&&(St=it+10);br(W,g,tt,Dt,S,z,it,rt,St,[],{left:ct.left,right:ct.right})}}const a_=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7"],pd=16,Bo=20,md=13;function i_(t,n,e,r){const a=t.length;if(a===0)return[];const i=Math.max(0,(e-(a-1)*pd)/a),o=r?Mr(t.flatMap(s=>s.values))??0:0;return t.map((s,l)=>{const c=r?o:Mr(s.values)??0,f=Pe().domain([0,c]).nice().range([0,i]);return{seriesName:s.name,seriesIndex:n.findIndex(h=>h.name===s.name),xOffset:l*(i+pd),panelWidth:i,xScale:f}})}function o_(t,n,e,r){const a=[];for(const i of t){const o=r.find(s=>s.name===i.seriesName);if(o)for(const s of n){const l=e.indexOf(s),c=l>=0?o.values[l]??0:0,f=Math.max(0,i.xScale(c)-i.xScale(0));a.push({label:s,seriesName:i.seriesName,seriesIndex:i.seriesIndex,value:c,xPos:i.xOffset,barWidth:f})}}return a}function s_(t,n,e={},r=!1){var Ft,Yt,Ut,Gt,dt,$t;pn(r);let a=[],i=null,o,s;const l=an.for(t);if(r){const U=mn(t);o=U==null?void 0:U.margin,s=U==null?void 0:U.plotRect,l.detach(),(U==null?void 0:U.chartType)==="bar-split"?a=Array.from(t.querySelectorAll(".bc-frame .bc-bar-split")):U&&(i=nn(t)),t.replaceChildren()}const{body:c}=dn(t,e.frame),f=n.series??[],h=f.filter(U=>!Vr(U.name,e.seriesOverrides)),d=h.map(U=>U.name),g=e.colors??a_,v=e.seriesOverrides,m=e.legend!==!1,b=qe(c).width,x=350,A=e.legendPosition??"top",w=b>0&&b<x&&(A==="left"||A==="right")?"top":A,S=e.legendAnchor??"start",z=e.categoryLabelLine===!0,Y=_o(n.labels),G=z?Jt.Off:(Ft=e.verticalAxis)==null?void 0:Ft.labelPosition,_=Cn(b,G,(Yt=e.horizontalAxis)==null?void 0:Yt.labelPosition,(Ut=e.verticalAxis)==null?void 0:Ut.direction,Y,(Gt=e.horizontalAxis)==null?void 0:Gt.showAxis);_.top=(_.top??12)+Bo;const B=Math.max(0,b-(_.left??50)-(_.right??20)),P=m?yr(d,w,B):{width:0,height:0},$=m?P.height+15:0,N={..._};m&&w==="top"&&(N.top=$+Bo),m&&w==="bottom"&&(N.bottom=(N.bottom??24)+$),m&&w==="left"&&(N.left=(N.left??50)+P.width+10),m&&w==="right"&&(N.right=(N.right??20)+P.width+10);const{chartArea:L,width:M,height:D,margin:q}=gn(c,N),V=Ln(o,q);let C=n.labels;if(e.sortMode==="total"){const U=n.labels.map((T,F)=>({label:T,total:h.reduce((E,at)=>E+(at.values[F]??0),0)}));U.sort((T,F)=>F.total-T.total),C=U.map(T=>T.label)}const I=tn().domain(C).range([0,D]).padding(Sr(e.barGap)),W=z?md:0;l.attach(L,V),l.update({vertical:{scale:I,height:D,options:{...e.verticalAxis,labelPosition:z?Jt.Off:(dt=e.verticalAxis)==null?void 0:dt.labelPosition,topPadding:q.top}},order:"horizontal-first"});const it=e.sharedScale===!0,rt=i_(h,f,M,it),ct=L.ownerSVGElement,pt=Nn(ct,t,"bars",{x:0,y:0,width:M,height:D}),xt=ot(L).append("g").attr("clip-path",`url(#${pt})`),yt=ot(L).append("g").attr("class","bc-split-headers");for(const U of rt)yt.append("text").attr("class","bc-split-header").attr("x",U.xOffset+U.panelWidth/2).attr("y",-Bo/2).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size","11px").attr("font-weight","600").attr("fill","currentColor").text(U.seriesName);const bt=o_(rt,C,n.labels,f),kt=Aa(e.highlights),j=Vn(e.colorizes),J=me(t),X=xt.append("g").node();if(r)for(const U of a)U.removeAttribute("opacity"),U.removeAttribute("fill-opacity"),X.appendChild(U);ge(J,{role:"mark-per-cell",parent:X,selector:".bc-bar-split",data:bt,key:U=>U.label+"\0"+U.seriesName,insert:U=>U.append("rect").attr("class","bc-bar bc-bar-split"),attrs:U=>{const T=j.get(U.seriesName)??re(U.seriesName,U.seriesIndex,g,v),F=ai(U.seriesName,v),E={"data-series":U.seriesName,x:U.xPos,y:(I(U.label)??0)+W,width:U.barWidth,height:Math.max(0,I.bandwidth()-W),fill:T};return F<1&&(E["fill-opacity"]=F),kt.size>0&&(E.opacity=Ue(kt,U.seriesName)),E}});const O={left:q.left,top:q.top,width:M,height:D};En(J,{svg:ct,clipId:pt,group:L,from:s,to:O,active:r&&a.length>0});const ht=Hr(xt);e.tooltips&&ht.use(pr({numberFormat:($t=e.verticalAxis)==null?void 0:$t.numberFormat})),e.crosshair&&ht.use(Ir({width:M,height:D,direction:e.crosshairDirection,style:e.crosshairStyle,color:e.crosshairColor,orientation:Ve.Horizontal}));const mt=()=>ht.draw(bt);if(J.state==="committing"?J.register(mt):mt(),bn(t,{chartType:"bar-split",margin:q,plotRect:O}),i&&(en(xt.node()),rn(t,i)),z){const U=ot(L).append("g").attr("class","bc-category-labels");for(const T of C){const F=I(T)??0;U.append("text").attr("class","bc-category-label").attr("x",2).attr("y",F+md/2).attr("text-anchor","start").attr("dominant-baseline","central").attr("font-size","10px").attr("font-weight","600").attr("fill","currentColor").text(T)}}const vt=e.valueLabels??!0,Tt=e.valueLabelPosition??It.Auto,Ht=ot(L).append("g").attr("class","bc-value-labels");if(bt.forEach(U=>{if(!Sa(U.seriesName,vt,v))return;const T=rt.find(tt=>tt.seriesName===U.seriesName);if(!T)return;const F=re(U.seriesName,U.seriesIndex,g,v),E=U.xPos+U.barWidth,at=Math.max(0,I.bandwidth()-W),wt=(I(U.label)??0)+W+at/2,Ct=Tt===It.Inside||Tt===It.Auto&&U.barWidth>30;if(!Br({text:String(U.value),placement:Ct?"inside":"outside",orientation:"horizontal",barWidth:U.barWidth,barHeight:at}))return;let st,Et,Nt;if(Ct)st=E-4,Et="end",Nt=hn(F);else{const tt=E+4,St=T.xOffset+T.panelWidth;tt+20>St?(st=U.xPos-4,Et="end"):(st=tt,Et="start"),Nt="currentColor"}Ht.append("text").attr("class","bc-value-label").attr("data-series",U.seriesName).attr("x",st).attr("y",wt).attr("text-anchor",Et).attr("dominant-baseline","central").attr("font-size","11px").attr("fill",Nt).text(String(U.value))}),m&&d.length>0){const U=d.map(E=>{const at=f.findIndex(wt=>wt.name===E);return re(E,at,g,v)});let T=0,F=0;w==="top"?F=-(P.height+10+Bo):w==="bottom"?F=D+25:w==="left"?T=-(P.width+10):w==="right"&&(T=M+10),br(L,d,U,F,w,S,M,D,T,[],{left:q.left,right:q.right})}}const bd=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7"],yd=13;function l_(t,n,e={},r=!1){var Yt,Ut,Gt,dt,$t,U;pn(r);let a=[],i=null,o,s;const l=an.for(t);if(r){const T=mn(t);o=T==null?void 0:T.margin,s=T==null?void 0:T.plotRect,l.detach(),(T==null?void 0:T.chartType)==="bar-grouped"?a=Array.from(t.querySelectorAll(".bc-frame .bc-bar-grouped")):T&&(i=nn(t)),t.replaceChildren()}const{body:c}=dn(t,e.frame),f=n.series??[],h=f.filter(T=>!Vr(T.name,e.seriesOverrides)),d=h.map(T=>T.name),g=e.colors??bd,v=e.seriesOverrides,m=e.legend!==!1,b=qe(c).width,x=350,A=e.legendPosition??"top",w=b>0&&b<x&&(A==="left"||A==="right")?"top":A,S=e.legendAnchor??"start",z=e.categoryLabelLine===!0,Y=_o(n.labels),G=z?Jt.Off:(Yt=e.verticalAxis)==null?void 0:Yt.labelPosition,_=Cn(b,G,(Ut=e.horizontalAxis)==null?void 0:Ut.labelPosition,(Gt=e.verticalAxis)==null?void 0:Gt.direction,Y,(dt=e.horizontalAxis)==null?void 0:dt.showAxis),B=Math.max(0,b-(_.left??50)-(_.right??20)),P=m?yr(d,w,B):{width:0,height:0},$=m?P.height+15:0,N={..._};m&&w==="top"&&(N.top=$),m&&w==="bottom"&&(N.bottom=(N.bottom??24)+$),m&&w==="left"&&(N.left=(N.left??50)+P.width+10),m&&w==="right"&&(N.right=(N.right??20)+P.width+10);const{chartArea:L,width:M,height:D,margin:q}=gn(c,N),V=Ln(o,q);let C=n.labels;if(e.sortMode==="total"){const T=n.labels.map((F,E)=>({label:F,total:h.reduce((at,wt)=>at+(wt.values[E]??0),0)}));T.sort((F,E)=>E.total-F.total),C=T.map(F=>F.label)}const I=tn().domain(C).range([0,D]).paddingInner(Sr(e.barGap)).paddingOuter(.05),W=z?yd:0,it=Math.max(0,I.bandwidth()-W),rt=tn().domain(d).range([0,it]).padding(.05),ct=Mr(h.flatMap(T=>T.values))??0,pt=Pe().domain([0,ct]).nice().range([0,M]);l.attach(L,V),l.update({vertical:{scale:I,height:D,options:{...e.verticalAxis,labelPosition:z?Jt.Off:($t=e.verticalAxis)==null?void 0:$t.labelPosition,topPadding:q.top}},horizontal:{scale:pt,height:D,options:{...e.horizontalAxis,width:M}},order:"horizontal-first"});const xt=L.ownerSVGElement,yt=Nn(xt,t,"bars",{x:0,y:0,width:M,height:D}),bt=ot(L).append("g").attr("clip-path",`url(#${yt})`);if(e.barBackground){const T=(e.colors??bd)[0];bt.selectAll(".bc-bar-bg").data(C,F=>F).enter().append("rect").attr("class","bc-bar-bg").attr("x",0).attr("y",F=>(I(F)??0)+W).attr("width",M).attr("height",I.bandwidth()-W).attr("fill",T).attr("opacity",.18)}if(e.barSeparators&&C.length>1){const T=I.step();for(let F=1;F<C.length;F++){const E=(I(C[F-1])??0)+I.bandwidth()+(T-I.bandwidth())/2;bt.append("line").attr("class","bc-bar-separator").attr("x1",0).attr("x2",M).attr("y1",E).attr("y2",E).attr("stroke","currentColor").attr("opacity",.15)}}const kt=[];for(const T of C){const F=n.labels.indexOf(T);for(const E of h){const at=f.findIndex(wt=>wt.name===E.name);kt.push({label:T,seriesName:E.name,seriesIndex:at,value:F>=0?E.values[F]??0:0})}}const j=Aa(e.highlights),J=Vn(e.colorizes),X=me(t),O=bt.append("g").node();if(r)for(const T of a)T.removeAttribute("opacity"),T.removeAttribute("fill-opacity"),O.appendChild(T);ge(X,{role:"mark-per-cell",parent:O,selector:".bc-bar-grouped",data:kt,key:T=>T.label+"\0"+T.seriesName,insert:T=>T.append("rect").attr("class","bc-bar bc-bar-grouped"),attrs:T=>{const F=J.get(T.seriesName)??re(T.seriesName,T.seriesIndex,g,v),E=ai(T.seriesName,v),at={"data-series":T.seriesName,x:pt(0),y:(I(T.label)??0)+W+(rt(T.seriesName)??0),width:Math.max(0,pt(T.value)-pt(0)),height:rt.bandwidth(),fill:F};return E<1&&(at["fill-opacity"]=E),j.size>0&&(at.opacity=Ue(j,T.seriesName)),at}});const ht={left:q.left,top:q.top,width:M,height:D};En(X,{svg:xt,clipId:yt,group:L,from:s,to:ht,active:r&&a.length>0});const mt=Hr(bt);e.tooltips&&mt.use(pr({numberFormat:(U=e.verticalAxis)==null?void 0:U.numberFormat})),e.crosshair&&mt.use(Ir({width:M,height:D,direction:e.crosshairDirection,style:e.crosshairStyle,color:e.crosshairColor,orientation:Ve.Horizontal}));const vt=()=>mt.draw(kt);if(X.state==="committing"?X.register(vt):vt(),bn(t,{chartType:"bar-grouped",margin:q,plotRect:ht}),i&&(en(bt.node()),rn(t,i)),z){const T=ot(L).append("g").attr("class","bc-category-labels");for(const F of C){const E=I(F)??0;T.append("text").attr("class","bc-category-label").attr("x",2).attr("y",E+yd/2).attr("text-anchor","start").attr("dominant-baseline","central").attr("font-size","10px").attr("font-weight","600").attr("fill","currentColor").text(F)}}const Tt=e.valueLabels??!0,Ht=e.valueLabelPosition??It.Auto,Ft=ot(L).append("g").attr("class","bc-value-labels");if(kt.forEach(T=>{if(!Sa(T.seriesName,Tt,v))return;const F=re(T.seriesName,T.seriesIndex,g,v),E=Math.max(0,pt(T.value)-pt(0)),at=pt(0)+E,wt=(I(T.label)??0)+W+(rt(T.seriesName)??0)+rt.bandwidth()/2,Ct=Ht===It.Inside||Ht===It.Auto&&E>30;if(!Br({text:String(T.value),placement:Ct?"inside":"outside",orientation:"horizontal",barWidth:E,barHeight:rt.bandwidth()}))return;let st,Et,Nt;Ct?(st=at-4,Et="end",Nt=hn(F)):(st=at+4,Et="start",Nt="currentColor"),Ft.append("text").attr("class","bc-value-label").attr("data-series",T.seriesName).attr("x",st).attr("y",wt).attr("text-anchor",Et).attr("dominant-baseline","central").attr("font-size","11px").attr("fill",Nt).text(String(T.value))}),m&&d.length>0){const T=d.map(at=>{const wt=f.findIndex(Ct=>Ct.name===at);return re(at,wt,g,v)});let F=0,E=0;w==="top"?E=-(P.height+10):w==="bottom"?E=D+25:w==="left"?F=-(P.width+10):w==="right"&&(F=M+10),br(L,d,T,E,w,S,M,D,F,[],{left:q.left,right:q.right})}}const Xl=new Map;function ze(t,n,e){Xl.set(t,{renderer:n,options:e})}function c_(t){var n;return(n=Xl.get(t))==null?void 0:n.renderer}function vd(t){var n;return((n=Xl.get(t))==null?void 0:n.options)??[]}const xd=[{value:he.Solid,text:"Solid"},{value:he.Dashed,text:"Dashed"},{value:he.Dotted,text:"Dotted"},{value:he.None,text:"None"}],Re={key:"colors",type:_t.Colors,label:"Colors"},Fe={key:"colorPalette",type:_t.Select,label:"Color palette",default:"Blueprint",choices:[{value:"",text:"Custom"},...H0().map(t=>({value:t.name,text:t.label}))]},Ye={key:"autoContrast",type:_t.Boolean,label:"Auto-adjust contrast",default:!1},Ie={key:"allowDarkMode",type:_t.Boolean,label:"Allow dark mode",default:!0},$a={key:"legend",type:_t.Boolean,label:"Show legend",default:!0},er={key:"legendPosition",type:_t.Select,label:"Legend position",default:ia.Top,choices:[{value:ia.Top,text:"Top"},{value:ia.Bottom,text:"Bottom"},{value:ia.Left,text:"Left"},{value:ia.Right,text:"Right"}]},nr={key:"legendAnchor",type:_t.Select,label:"Legend anchor",default:Zn.Start,choices:[{value:Zn.Start,text:"Start"},{value:Zn.Middle,text:"Middle"},{value:Zn.End,text:"End"}]},Vo={key:"directLabelling",type:_t.Select,label:"Direct labelling",default:_e.Off,choices:[{value:_e.Off,text:"Off"},{value:_e.Auto,text:"Auto"},{value:_e.Outside,text:"Outside"},{value:_e.Inside,text:"Inside"}]},Ul={key:"directLabelAnchor",type:_t.Select,label:"Label anchor",default:Zn.Middle,choices:[{value:Zn.Start,text:"Start"},{value:Zn.Middle,text:"Middle"},{value:Zn.End,text:"End"}]},Wo={key:"valueLabels",type:_t.Boolean,label:"Value labels",default:!1},Go={key:"valueLabelPosition",type:_t.Select,label:"Label position",default:It.Auto,choices:[{value:It.Auto,text:"Auto"},{value:It.Outside,text:"Outside"},{value:It.Inside,text:"Inside"}]},rr={key:"tooltips",type:_t.Boolean,label:"Tooltips",default:!1},wd={key:"crosshair",type:_t.Boolean,label:"Crosshair",default:!1},Ad={key:"crosshairDirection",type:_t.Select,label:"Crosshair direction",default:Ae.Both,choices:[{value:Ae.Both,text:"Both"},{value:Ae.Vertical,text:"Vertical"},{value:Ae.Horizontal,text:"Horizontal"}]},_d={key:"crosshairStyle",type:_t.Select,label:"Crosshair style",default:kn.Dashed,choices:[{value:kn.Solid,text:"Solid"},{value:kn.Dashed,text:"Dashed"},{value:kn.Dotted,text:"Dotted"}]},kd={key:"crosshairColor",type:_t.Text,label:"Crosshair color",default:"#999",placeholder:"#999"},Sd={key:"lineSymbols",type:_t.Boolean,label:"Show line symbols",default:!1},Md={key:"lineSymbolShape",type:_t.Select,label:"Symbol",default:Ke.Circle,choices:[{value:Ke.Circle,text:"Circle"},{value:Ke.Square,text:"Square"},{value:Ke.Diamond,text:"Diamond"},{value:Ke.Triangle,text:"Triangle Up"},{value:Ke.TriangleDown,text:"Triangle Down"},{value:Ke.Cross,text:"Cross"},{value:Ke.Star,text:"Star"}]},$d={key:"lineSymbolShowOn",type:_t.Select,label:"Show on",default:Je.FirstLast,choices:[{value:Je.FirstLast,text:"First & Last"},{value:Je.First,text:"First"},{value:Je.Last,text:"Last"},{value:Je.All,text:"All"}]},Ld={key:"lineSymbolStyle",type:_t.Select,label:"Style",default:Ee.Filled,choices:[{value:Ee.Filled,text:"Filled"},{value:Ee.Hollow,text:"Hollow"}]},Cd={key:"lineSymbolSize",type:_t.Text,label:"Size",default:"3.5",placeholder:"3.5"},Td={key:"lineSymbolOpacity",type:_t.Text,label:"Opacity",default:"1",placeholder:"1"},ii={key:"sortMode",type:_t.Select,label:"Sort mode",default:_n.None,choices:[{value:_n.None,text:"None"},{value:_n.Total,text:"By total"},{value:_n.WithinGroups,text:"Within groups"}]},qo={key:"edgePadding",type:_t.Boolean,label:"Edge padding",default:!1},Xo={key:"waterfall",type:_t.Boolean,label:"Waterfall",default:!1},Uo={key:"waterfallTotal",type:_t.Boolean,label:"Waterfall total",default:!1},oi={key:"barBackground",type:_t.Boolean,label:"Bar background",default:!1},Zo={key:"barGap",type:_t.Text,label:"Bar gap",default:String(Rs),placeholder:String(Rs)},si={key:"barSeparators",type:_t.Boolean,label:"Bar separators",default:!1},jo={key:"connectedColumns",type:_t.Boolean,label:"Connected columns",default:!1},Ko={key:"connectionsOpacity",type:_t.Text,label:"Opacity",default:"0.15",placeholder:"0.15"},Jo={key:"swapLabelValue",type:_t.Boolean,label:"Swap labels and values",default:!1},Od={key:"stackMode",type:_t.Select,label:"Stack mode",default:kr.Normal,choices:[{value:kr.Normal,text:"Normal"},{value:kr.Percent,text:"Percentage (100%)"}]},f_={key:"sharedScale",type:_t.Boolean,label:"Shared scale",default:!1},Gr={key:"categoryLabelLine",type:_t.Boolean,label:"Labels on separate line",default:!1},Nd={key:"displayAsPercentage",type:_t.Boolean,label:"Display as percentage",default:!1},Ed={key:"showTotal",type:_t.Boolean,label:"Show total",default:!1},Dd={key:"showLabels",type:_t.Boolean,label:"Show labels",default:!0},Pd={key:"showValues",type:_t.Boolean,label:"Show values",default:!0},zd={key:"sliceMax",type:_t.Text,label:"Max slices",default:"6"},Rd={key:"sliceGroupLabel",type:_t.Text,label:"Group label",default:"Others",placeholder:"Others"},u_={key:"areaFillOpacity",type:_t.Text,label:"Opacity",default:"0.85",placeholder:"0.85"},h_={key:"stacked",type:_t.Boolean,label:"Stack areas",default:!0},d_={key:"stackPercent",type:_t.Boolean,label:"Stack to 100%",default:!1},g_={key:"areaLines",type:_t.Boolean,label:"Separate areas with lines",default:!0},p_={key:"areaSortMode",type:_t.Select,label:"Sort areas",default:pe.None,choices:[{value:pe.None,text:"Keep order"},{value:pe.Ascending,text:"Smallest first"},{value:pe.Descending,text:"Largest first"}]},m_={key:"interpolation",type:_t.Select,label:"Line interpolation",default:Sn.Linear,choices:[{value:Sn.Linear,text:"Linear"},{value:Sn.MonotoneX,text:"Monotone"},{value:Sn.Step,text:"Step"},{value:Sn.StepBefore,text:"Step (before)"},{value:Sn.StepAfter,text:"Step (after)"},{value:Sn.Basis,text:"Basis"},{value:Sn.Cardinal,text:"Cardinal"},{value:Sn.CatmullRom,text:"Catmull-Rom"}]},Fd=[{value:aa.Linear,text:"Linear"},{value:aa.Log,text:"Logarithmic"}],Yd=[{value:Jt.Auto,text:"Auto"},{value:Jt.Inside,text:"Inside"},{value:Jt.Outside,text:"Outside"},{value:Jt.Off,text:"Off"}],b_=[{value:Pa.Auto,text:"Auto"},{value:Pa.Horizontal,text:"Horizontal"},{value:Pa.Vertical,text:"Vertical"}];function li(t){return[{key:"showVerticalAxis",type:_t.Boolean,label:"Show vertical axis",default:t.showVerticalAxis??!0},{key:"verticalAxisDirection",type:_t.Select,label:"Vertical axis side",default:An.Left,choices:[{value:An.Left,text:"Left"},{value:An.Right,text:"Right"}]},{key:"showVerticalTicks",type:_t.Boolean,label:"Show vertical ticks",default:t.showVerticalTicks},{key:"verticalLabelPosition",type:_t.Select,label:"Vertical labels",default:t.valueAxisLabelsOff&&t.valueAxis==="vertical"?Jt.Off:Jt.Auto,choices:Yd},{key:"verticalGridStyle",type:_t.Select,label:"Vertical grid style",default:t.verticalGrid,choices:xd},{key:"verticalNumberFormat",type:_t.NumberFormat,label:"Vertical number format"},...t.valueAxis==="vertical"?[{key:"verticalScaleType",type:_t.Select,label:"Vertical scale",default:aa.Linear,choices:Fd},t.valueAxisZeroBaseline?{key:"verticalRangeMin",type:_t.Text,label:"Vertical min",default:"0",placeholder:"auto"}:{key:"verticalRangeMin",type:_t.Text,label:"Vertical min",placeholder:"auto"},{key:"verticalRangeMax",type:_t.Text,label:"Vertical max",placeholder:"auto"}]:[],{key:"showHorizontalAxis",type:_t.Boolean,label:"Show horizontal axis",default:t.showHorizontalAxis??!0},{key:"showHorizontalTicks",type:_t.Boolean,label:"Show horizontal ticks",default:t.showHorizontalTicks},{key:"horizontalLabelPosition",type:_t.Select,label:"Horizontal labels",default:t.valueAxisLabelsOff&&t.valueAxis==="horizontal"?Jt.Off:Jt.Auto,choices:Yd},{key:"horizontalLabelRotation",type:_t.Select,label:"Horizontal label rotation",default:Pa.Horizontal,choices:b_},{key:"horizontalGridStyle",type:_t.Select,label:"Horizontal grid style",default:t.horizontalGrid,choices:xd},{key:"horizontalNumberFormat",type:_t.NumberFormat,label:"Horizontal number format"},...t.valueAxis==="horizontal"?[{key:"horizontalScaleType",type:_t.Select,label:"Horizontal scale",default:aa.Linear,choices:Fd},t.valueAxisZeroBaseline?{key:"horizontalRangeMin",type:_t.Text,label:"Horizontal min",default:"0",placeholder:"auto"}:{key:"horizontalRangeMin",type:_t.Text,label:"Horizontal min",placeholder:"auto"},{key:"horizontalRangeMax",type:_t.Text,label:"Horizontal max",placeholder:"auto"}]:[],...t.horizontalRange?[{key:"horizontalRangeMin",type:_t.Text,label:"Horizontal min",placeholder:"auto"},{key:"horizontalRangeMax",type:_t.Text,label:"Horizontal max",placeholder:"auto"}]:[]]}const Qo=li({verticalGrid:he.None,horizontalGrid:he.None,showVerticalTicks:!1,showHorizontalTicks:!1,showVerticalAxis:!1,valueAxis:"vertical",valueAxisZeroBaseline:!0,valueAxisLabelsOff:!0}),ci=li({verticalGrid:he.None,horizontalGrid:he.None,showVerticalTicks:!1,showHorizontalTicks:!1,showHorizontalAxis:!1,valueAxis:"horizontal",valueAxisZeroBaseline:!0,valueAxisLabelsOff:!0}),Id=li({verticalGrid:he.Dashed,horizontalGrid:he.None,showVerticalTicks:!1,showHorizontalTicks:!1,showVerticalAxis:!1,valueAxis:"vertical",horizontalRange:!0}),y_=li({verticalGrid:he.Dashed,horizontalGrid:he.None,showVerticalTicks:!1,showHorizontalTicks:!1,showVerticalAxis:!1,valueAxis:"vertical",horizontalRange:!0,valueAxisZeroBaseline:!0}),ts={...m_,default:Sn.MonotoneX},v_={...Ad,default:Ae.Vertical},x_={...wd,default:!0},w_={...Sd,default:!0},Hd={...ii,default:_n.Total},Zl={...Wo,default:!0},A_={...Wo,default:!0},__={...Nd,default:!0},k_={...zd,default:"5"},S_={...Ed,default:!0},es={...Vo,default:_e.Auto},ns={...$a,default:!1},rs=[wd,Ad,_d,kd],jl=[x_,v_,_d,kd],as=[A_,Go,rr,...rs],Kl=[Zl,Go,rr,...rs],M_=[Sd,Md,$d,Ld,Cd,Td],$_=[w_,Md,$d,Ld,Cd,Td],Bd=[Wo,rr,...jl,...M_],L_=[Wo,rr,...jl,...$_],C_=[__,Ed,Dd,Pd,k_,Rd],T_=[Nd,S_,Dd,Pd,zd,Rd];ze(ve.BarVertical,td,[Re,Fe,Ye,Ie,Jo,oi,si,Zo,jo,Ko,Xo,Uo,Gr,...Qo,...as]),ze(ve.BarHorizontal,nd,[Re,Fe,Ye,Ie,Jo,oi,si,Zo,jo,Ko,Xo,Uo,Gr,...ci,...Kl]),ze(ve.BarMulti,CA,[Re,Fe,Ye,Ie,Hd,ns,nr,er,es,Ul,...Qo,...as]),ze(ve.Line,zA,[Re,Fe,Ye,Ie,ts,qo,...Id,...Bd]),ze(ve.LineMulti,IA,[Re,Fe,Ye,Ie,ts,qo,ii,ns,nr,er,es,...Id,...L_]),ze(ve.Donut,qA,[Re,Fe,Ye,Ie,ns,nr,er,es,rr,...T_]),ze(ve.Pie,XA,[Re,Fe,Ye,Ie,ns,nr,er,es,rr,...C_]),ze(ve.Area,ZA,[Re,Fe,Ye,Ie,ts,qo,...y_,...Bd]);const O_=li({verticalGrid:he.Dashed,horizontalGrid:he.None,showVerticalTicks:!1,showHorizontalTicks:!1,showVerticalAxis:!1,valueAxis:"vertical",horizontalRange:!0,valueAxisZeroBaseline:!0});ze(ve.AreaStacked,KA,[Re,Fe,Ye,Ie,u_,ts,qo,p_,h_,d_,g_,$a,nr,er,Vo,...O_,rr,...jl]),ze(ve.ColumnStacked,t_,[Re,Fe,Ye,Ie,Od,ii,$a,nr,er,Vo,Ul,...Qo,...as]),ze(ve.BarStacked,r_,[Re,Fe,Ye,Ie,Od,ii,$a,nr,er,Vo,Ul,Gr,...ci,...Kl]),ze(ve.BarSplit,s_,[Re,Fe,Ye,Ie,f_,ii,$a,nr,er,Gr,...ci,Zl,Go,rr,...rs]),ze(ve.BarGrouped,l_,[Re,Fe,Ye,Ie,Hd,$a,nr,er,oi,si,Gr,...ci,Zl,Go,rr,...rs]),ze(ve.VerticalBar,td,[Re,Fe,Ye,Ie,Jo,oi,si,Zo,jo,Ko,Xo,Uo,Gr,...Qo,...as]),ze(ve.HorizontalBar,nd,[Re,Fe,Ye,Ie,Jo,oi,si,Zo,jo,Ko,Xo,Uo,Gr,...ci,...Kl]);function qr(t){return new Map(t.map(n=>[n.key,n.value]))}function Vd(t,n){const e=qr(n),r=vd(t),a=new Set(r.map(o=>o.key)),i={};for(const o of r){const s=e.get(o.key);s!==void 0&&a.has(o.key)&&(o.type===_t.Colors?i[o.key]=String(s).split(",").map(l=>l.trim()).filter(Boolean):o.type===_t.Boolean?o.key==="valueLabels"&&String(s).toLowerCase()==="percent"?i[o.key]="percent":i[o.key]=s==="true"||s===!0:i[o.key]=String(s))}return i}function N_(t){return!(/^-?\d+(\.\d+)?$/.test(t)||/^-?\d+(\.\d+)?%$/.test(t)||/^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(t))}function Wd(t){return t.entries.map(n=>{if(n.values&&n.values.length>1){if(n.key==="series"&&!n.quotedKey)return`series = ${n.values.map(a=>`"${a}"`).join(",")}`;const r=n.values.join(",");return`"${n.key}" = ${r}`}const e=n.isPercentage?`${n.value}%`:String(n.value);return n.key==="series"&&!n.quotedKey?`series = "${e}"`:typeof n.value=="string"&&N_(e)?`"${n.key}" = "${e}"`:`"${n.key}" = ${e}`}).join(`
|
|
269
|
+
`)}function Gd(t,n){const e=t.find(r=>r.key===n);return e?String(e.value):void 0}function qd(t,n){const e=t.find(r=>r.key===n);if(e)return e.isPercentage,e.value}function Xd(t){const n=t.find(e=>e.key==="maxWidth");if(n)return n.isPercentage?`${n.value}%`:n.value}const xr=t=>t==="true"||t===!0;function Ud(t){return t.map(n=>({target:n.target,color:Gd(n.properties,"color")??"#e15759",label:Gd(n.properties,"label")}))}function Zd(t){return t.map(n=>({target:n.target}))}function jd(t){return t.map(n=>{const e=qr(n.properties);return{from:n.from,to:n.to,color:e.has("color")?String(e.get("color")):void 0,negativeColor:e.has("negativeColor")?String(e.get("negativeColor")):void 0,opacity:e.has("opacity")?Number(e.get("opacity")):void 0,interpolation:e.has("interpolation")?String(e.get("interpolation")):void 0}})}function Jl(t){const n=t.get("repeat");if(n===!0||n==="true")return"always";if(n===void 0||n===!1||n==="false")return;const e=Number(n);return Number.isInteger(e)&&e>=1?e:void 0}function Kd(t){return t.map(n=>{const e=qr(n.properties),r=n.kind??we.Point;if(r===we.Range){const s={kind:we.Range,start:e.has("start")?isNaN(Number(e.get("start")))?String(e.get("start")):Number(e.get("start")):0,end:e.has("end")?isNaN(Number(e.get("end")))?String(e.get("end")):Number(e.get("end")):0};return s.repeat=Jl(e),e.has("orientation")&&(s.orientation=String(e.get("orientation"))),e.has("startAnchor")&&(s.startAnchor=String(e.get("startAnchor"))),e.has("endAnchor")&&(s.endAnchor=String(e.get("endAnchor"))),e.has("bgColor")&&(s.bgColor=String(e.get("bgColor"))),e.has("bgOpacity")&&(s.bgOpacity=Number(e.get("bgOpacity"))),e.has("direction")&&(s.direction=String(e.get("direction"))),e.has("text")&&(s.text=String(e.get("text"))),e.has("textColor")&&(s.textColor=String(e.get("textColor"))),s}if(r===we.Free){const s={kind:we.Free,text:String(e.get("text")??""),x:qd(n.properties,"x")??0,y:qd(n.properties,"y")??0};s.repeat=Jl(e),e.has("textColor")&&(s.textColor=String(e.get("textColor")));const l=Xd(n.properties);return l!==void 0&&(s.maxWidth=l),e.has("textOutline")&&(s.textOutline=xr(e.get("textOutline"))),s}const a="target"in n?n.target:"",i={kind:we.Point,target:a,text:String(e.get("text")??"")};i.repeat=Jl(e),e.has("textColor")&&(i.textColor=String(e.get("textColor")));const o=Xd(n.properties);return o!==void 0&&(i.maxWidth=o),e.has("textOutline")&&(i.textOutline=xr(e.get("textOutline"))),e.has("showLine")&&(i.showLine=xr(e.get("showLine"))),e.has("anchorDirection")&&(i.anchorDirection=String(e.get("anchorDirection"))),e.has("textOffsetX")&&(i.textOffsetX=Number(e.get("textOffsetX"))),e.has("textOffsetY")&&(i.textOffsetY=Number(e.get("textOffsetY"))),e.has("lineStyle")&&(i.lineStyle=String(e.get("lineStyle"))),e.has("lineWeight")&&(i.lineWeight=Number(e.get("lineWeight"))),e.has("showArrow")&&(i.showArrow=xr(e.get("showArrow"))),e.has("lineTargetDistance")&&(i.lineTargetDistance=Number(e.get("lineTargetDistance"))),e.has("showCircle")&&(i.showCircle=xr(e.get("showCircle"))),e.has("circleSize")&&(i.circleSize=Number(e.get("circleSize"))),e.has("circleStyle")&&(i.circleStyle=String(e.get("circleStyle"))),e.has("circleColor")&&(i.circleColor=String(e.get("circleColor"))),i})}function Jd(t){return t.map(n=>{const e=qr(n.properties),r={name:n.name};if(e.has("color")&&(r.color=String(e.get("color"))),e.has("lineWidth")&&(r.lineWidth=Number(e.get("lineWidth"))),e.has("dash")&&(r.dash=String(e.get("dash"))),e.has("interpolation")&&(r.interpolation=String(e.get("interpolation"))),e.has("labelMode")&&(r.labelMode=String(e.get("labelMode"))),e.has("labelText")&&(r.labelText=String(e.get("labelText"))),e.has("valueLabels")){const a=e.get("valueLabels");r.valueLabels=String(a).toLowerCase()==="percent"?"percent":xr(a)}return e.has("lineSymbols")&&(r.lineSymbols=xr(e.get("lineSymbols"))),e.has("hidden")&&(r.hidden=xr(e.get("hidden"))),e.has("symbolShape")&&(r.symbolShape=String(e.get("symbolShape"))),e.has("symbolShowOn")&&(r.symbolShowOn=String(e.get("symbolShowOn"))),e.has("symbolStyle")&&(r.symbolStyle=String(e.get("symbolStyle"))),e.has("symbolSize")&&(r.symbolSize=Number(e.get("symbolSize"))),e.has("symbolOpacity")&&(r.symbolOpacity=Number(e.get("symbolOpacity"))),r})}const Qd=new Set;function E_(t,n,e){let r=n;for(const a of t)a.transformType==="sort"?r=_n.Total:Qd.has(a.transformType)||(Qd.add(a.transformType),console.warn(`[blueprint-chart] Unknown transform "${a.transformType}" in ${e}; ignored.`));return r}function D_(t){const n=i=>{const o=t.get(i);return o==null?void 0:String(o)||void 0},e=t.get("transparentBackground"),r={title:n("title"),description:n("description"),source:n("source"),sourceUrl:n("sourceUrl"),byline:n("byline"),note:n("note"),padding:n("padding"),transparentBackground:e===!0||e==="true"||void 0};return Object.values(r).some(i=>i!==void 0)?r:void 0}function P_(t){const n=qr(t.properties),e=t.data?Wd(t.data):"",r=lf(e),a=n.get("sort"),i=a==null?void 0:String(a),o=i===pe.Ascending||i===pe.Descending?i:void 0,s=n.get("theme"),l=n.get("sortMode");let c;return(l===_n.Total||l===_n.WithinGroups||l===_n.None)&&(c=l),c=E_(t.transforms,c,"chart"),{chartType:t.chartType,data:r,properties:t.properties,frame:D_(n),colorizes:Ud(t.colorizes),highlights:Zd(t.highlights),areaFills:jd(t.areaFills),annotations:Kd(t.annotations),seriesOverrides:Jd(t.series),scenes:t.scenes,sort:o,sortMode:c,theme:s==null?void 0:String(s)||void 0}}const Ql=Object.create(null);function z_(t){if(!Ql[t]){const n={};for(const e of vd(t))e.default!==void 0&&(n[e.key]=e.default);Ql[t]=n}return Ql[t]}function t0(t,n){var a;const e=z_(t);return((a=n.colors)==null?void 0:a.length)?{...e,colorPalette:void 0,...n}:{...e,...n}}const e0=new Set;function R_(t,n,e){let r=n;for(const a of t)a.transformType==="sort"?r=_n.Total:e0.has(a.transformType)||(e0.add(a.transformType),console.warn(`[blueprint-chart] Unknown transform "${a.transformType}" in ${e}; ignored.`));return r}function F_(){return{properties:new Map,chartTypeOptions:{},colorizes:[],highlights:[],areaFills:[],seriesOverrides:[],transforms:[]}}function Y_(t,n,e){const r=F_();for(let a=0;a<=n;a++){const i=t[a],o=qr(i.properties),s=o.get("type");s&&(r.chartType=s);const l=r.chartType??e;i.data&&(r.data=i.data);const c=Vd(l,i.properties);r.chartTypeOptions={...r.chartTypeOptions,...c},i.colorizes.length>0?r.colorizes=i.colorizes:i.data&&(r.colorizes=[]),a===n&&(r.highlights=i.highlights),i.areaFills.length>0&&(r.areaFills=i.areaFills),i.series.length>0&&(r.seriesOverrides=i.series),i.transforms.length>0&&(r.transforms=[...r.transforms,...i.transforms]);for(const[f,h]of o)r.properties.set(f,h)}return r}function I_(t,n,e){return e<t?!1:n==="always"?!0:e<=t+(typeof n=="number"?n:0)}function H_(t,n){const e=t.options??(t.properties?t0(t.chartType,Vd(t.chartType,t.properties)):{}),r={chartType:t.chartType,data:t.data,options:e,frame:t.frame,colorizes:t.colorizes??[],highlights:t.highlights??[],areaFills:t.areaFills??[],annotations:(t.annotations??[]).map((A,w)=>({...A,key:A.key??`base:${w}:${A.kind}`})),seriesOverrides:t.seriesOverrides??[],sort:t.sort,sortMode:t.sortMode,theme:t.theme};if(n==null||!t.scenes||n<0||n>=t.scenes.length)return r;const a=Y_(t.scenes,n,t.chartType),i=a.chartType??t.chartType,o=a.data?lf(Wd(a.data)):r.data,s=Object.keys(a.chartTypeOptions).length>0?t0(i,{...e,...a.chartTypeOptions}):e,l=a.colorizes.length>0?Ud(a.colorizes):a.data?[]:r.colorizes,c=n!=null?Zd(a.highlights):r.highlights,f=a.areaFills.length>0?jd(a.areaFills):r.areaFills,h=(t.annotations??[]).map((A,w)=>({anchor:-1,key:A.key??`base:${w}:${A.kind}`,config:A}));for(let A=0;A<=n;A++)Kd(t.scenes[A].annotations).forEach((w,S)=>{h.push({anchor:A,key:w.key??`s${A}:${S}:${w.kind}`,config:w})});const d=h.filter(({anchor:A,config:w})=>I_(A,w.repeat,n)).map(({key:A,config:w})=>({...w,key:A})),g=a.seriesOverrides.length>0?Jd(a.seriesOverrides):r.seriesOverrides,v=R_(a.transforms,r.sortMode,`scene ${n}`),m=["title","description","source","sourceUrl","byline","note"],b={};for(const A of m){const w=a.properties.get(A);typeof w=="string"&&(b[A]=w)}const x=Object.keys(b).length>0?{...r.frame,...b}:r.frame;return{...r,chartType:i,data:o,options:s,frame:x,colorizes:l,highlights:c,areaFills:f,annotations:d,seriesOverrides:g,sortMode:v}}const tc=new WeakMap;function B_(t){const n=tc.get(t);if(!(!n||n.size===0)){for(const e of n)t.style[e]="";n.clear()}}function La(t,n){let e=tc.get(t);e||(e=new Set,tc.set(t,e)),e.add(n)}function V_(t,n,e){if(B_(t),e.ignoreLayout||!n)return{constrained:!1};const r=qr(n),a=r.get("heightMode"),i=r.get("aspectRatio"),o=r.get("fixedHeight");let s=!1;if(a==="aspect-ratio"&&i){const l=String(i).split(":").map(Number);l.length===2&&l[0]>0&&l[1]>0&&(t.style.aspectRatio=`${l[0]} / ${l[1]}`,t.style.height="auto",La(t,"aspectRatio"),La(t,"height"),s=!0)}else a==="fixed"&&o&&(t.style.height=`${o}px`,La(t,"height"),s=!0);return s&&(t.style.display="flex",t.style.flexDirection="column",t.style.overflow="hidden",La(t,"display"),La(t,"flexDirection"),La(t,"overflow")),{constrained:s}}const ec=new WeakMap;function n0(t){t.querySelectorAll("[data-bc-fade-overlay]").forEach(n=>{typeof n.getAnimations=="function"&&n.getAnimations().forEach(e=>e.cancel()),n.remove()})}function W_(t,n,e){if(!e)return null;const r=ec.get(t);return!r||r===n?null:(n0(t),nn(t))}function G_(t,n,e){if(ec.set(t,n),e){const r=t.querySelector(".bc-frame .bc-frame-body");r&&en(r),rn(t,e)}}function r0(t){ec.delete(t),n0(t)}function q_(t,n,e){const r=t.querySelector(".bc-frame");if(!r)return;const a=[];r.classList.forEach(i=>{i.startsWith("bc-theme-")&&a.push(i)});for(const i of a)r.classList.remove(i);n.theme&&r.classList.add(`bc-theme-${n.theme}`),e.constrained&&r.classList.add("bc-frame--constrained")}function X_(t,n,e={}){var g;if(e.transition||(me(t).interrupt(),t.replaceChildren(),r0(t)),n.data.labels.length===0){e.transition&&(me(t).interrupt(),t.replaceChildren(),r0(t));return}let r=n;if(e.stripColors){const v={...n};if(n.properties&&(v.properties=n.properties.filter(m=>m.key!=="colors"&&m.key!=="colorPalette")),n.options){const{colors:m,colorPalette:b,...x}=n.options;v.options=x}r=v}const a=V_(t,r.properties,e),i=H_(r,e.sceneIndex),o=c_(i.chartType);if(!o)return;const s=W_(t,i.chartType,!!e.transition);s&&t.replaceChildren();const l=Be(t),c=tm(i.options,l);let f;if(e.thumbnail)f=null;else{const v=((g=i.frame)==null?void 0:g.padding)??e.padding??"16px";f={...i.frame??{},padding:v}}const h=me(t);e.transition&&h.beginCommit(),o(t,i.data,{frame:f,sort:i.sort,sortMode:i.sortMode,...c,colorizes:i.colorizes.length>0?i.colorizes:void 0,highlights:i.highlights.length>0?i.highlights:void 0,areaFills:i.areaFills.length>0?i.areaFills:void 0,annotations:i.annotations.length>0?i.annotations:void 0,seriesOverrides:i.seriesOverrides.length>0?i.seriesOverrides:void 0},!!e.transition),e.transition&&h.commit({duration:Ja(),mode:e.transitionMode});const d=e.theme??i.theme;q_(t,{theme:d},a),G_(t,i.chartType,s)}function a0(t,n,e){const r=document.createElement("div");r.style.cssText="color: #888; font-family: monospace; padding: 0.75rem; white-space: pre-wrap;",r.textContent=`Blueprint Chart: ${n}
|
|
270
|
+
${e}`,t.replaceChildren(r)}function U_(t,n,e){if(!n){e!=null&&e.transition||t.replaceChildren();return}let r;try{r=F0(n)}catch(a){const i=a instanceof Error?a.message:String(a);a0(t,"could not parse chart",i);return}try{const a=P_(r);X_(t,a,e)}catch(a){const i=a instanceof Error?a.message:String(a);a0(t,"could not render chart",i)}}function i0(t,n,e){let r=0,a=!1;const i=document.createElement("nav");i.className="blueprint-chart-scenes";const o=document.createElement("button");o.className="blueprint-chart-scenes-prev",o.textContent="Previous";const s=document.createElement("button");s.className="blueprint-chart-scenes-next",s.textContent="Next";const l=document.createElement("span");l.className="blueprint-chart-scenes-counter",i.appendChild(o),i.appendChild(l),i.appendChild(s),n.length>0&&t.appendChild(i);function c(){if(n.length===0){l.textContent="";return}l.textContent=`${r+1} / ${n.length}`}function f(h){if(a||n.length===0||!Number.isFinite(h))return;const g=(Math.floor(h)%n.length+n.length)%n.length;r=g,c(),e(n[g],g)}return o.addEventListener("click",()=>f(r-1)),s.addEventListener("click",()=>f(r+1)),c(),{get currentScene(){return r},get totalScenes(){return n.length},next(){f(r+1)},previous(){f(r-1)},goTo:f,destroy(){a||(a=!0,i.remove())}}}const Z_=i0;return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",hs):hs(),cn.createSceneController=i0,cn.createStepController=Z_,cn.initBlueprint=hs,cn.renderBpc=U_,Object.defineProperty(cn,Symbol.toStringTag,{value:"Module"}),cn})({});
|