From c35d59de48b0251855688e91195b1ef802db649e Mon Sep 17 00:00:00 2001 From: dabreegster Date: Wed, 8 Nov 2023 16:18:09 +0000 Subject: [PATCH] deploy: a13aadd3f9efb86a9dd904a41b985bb5b905e934 --- assets/Loading-65ee842b.js | 39 ----------------------- assets/Loading-a8d2f85e.js | 39 +++++++++++++++++++++++ assets/{x2-91d17a8b.js => x2-340aa4e6.js} | 2 +- assets/{x3-b502fe4b.js => x3-6481bdb1.js} | 2 +- edge_cost.html | 4 +-- interactive.html | 4 +-- 6 files changed, 45 insertions(+), 45 deletions(-) delete mode 100644 assets/Loading-65ee842b.js create mode 100644 assets/Loading-a8d2f85e.js rename assets/{x2-91d17a8b.js => x2-340aa4e6.js} (99%) rename assets/{x3-b502fe4b.js => x3-6481bdb1.js} (99%) diff --git a/assets/Loading-65ee842b.js b/assets/Loading-65ee842b.js deleted file mode 100644 index c52d28a..0000000 --- a/assets/Loading-65ee842b.js +++ /dev/null @@ -1,39 +0,0 @@ -var pd=Object.defineProperty;var md=(i,t,e)=>t in i?pd(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var C=(i,t,e)=>(md(i,typeof t!="symbol"?t+"":t,e),e);import{af as bd,ag as _d,S as An,i as Dn,s as Pi,D as Gs,l as st,t as fe,r as _r,b as De,u as xr,v as ot,ah as xd,T as co,a7 as yd,U as ho,ai as ra,E as It,G as vd,J as wd,K as kd,N as Md,Y as Sd,e as z,g as Pe,j as ft,k as ih,n as N,p as Ps,q as Gt,C as nh,f as ge,z as mi,I as aa,w as On,V as Ge,x as uo,y as fo,ab as xi,c as Pd,h as St,a as Cd,A as go,d as Ad,ac as yr,aa as sh,a6 as oh}from"./Legend-36db5a45.js";function Dd(i,t,e,n,s){let o=!1;i.getSource(t)&&(o=!0,i.removeSource(t));const r=()=>{n(t)&&(i.addSource(t,e),s())};if(o){const a=()=>{t&&(i.getSource(t)?setTimeout(a,1):r())};a()}else r()}function Od(i,t,e){bd().then(()=>{let n=_d(i);if(!n)return;n.getSource(t)===e&&n.removeSource(t)})}function la(i){let t=i[0],e,n,s=ca(i);return{c(){s.c(),e=Gs()},m(o,r){s.m(o,r),st(o,e,r),n=!0},p(o,r){r&1&&Pi(t,t=o[0])?(_r(),De(s,1,1,It),xr(),s=ca(o),s.c(),fe(s,1),s.m(e.parentNode,e)):s.p(o,r)},i(o){n||(fe(s),n=!0)},o(o){De(s),n=!1},d(o){o&&ot(e),s.d(o)}}}function ca(i){let t;const e=i[15].default,n=vd(e,i,i[14],null);return{c(){n&&n.c()},m(s,o){n&&n.m(s,o),t=!0},p(s,o){n&&n.p&&(!t||o&16384)&&wd(n,e,s,s[14],t?Md(e,s[14],o,null):kd(s[14]),null)},i(s){t||(fe(n,s),t=!0)},o(s){De(n,s),t=!1},d(s){n&&n.d(s)}}}function Td(i){let t,e,n=i[0]&&la(i);return{c(){n&&n.c(),t=Gs()},m(s,o){n&&n.m(s,o),st(s,t,o),e=!0},p(s,[o]){s[0]?n?(n.p(s,o),o&1&&fe(n,1)):(n=la(s),n.c(),fe(n,1),n.m(t.parentNode,t)):n&&(_r(),De(n,1,1,()=>{n=null}),xr())},i(s){e||(fe(n),e=!0)},o(s){De(n),e=!1},d(s){s&&ot(t),n&&n.d(s)}}}function Ld(i,t,e){let n,s,o,{$$slots:r={},$$scope:a}=t,{id:l=Sd("geojson")}=t,{data:c}=t,{generateId:h=!1}=t,{promoteId:u=void 0}=t,{filter:d=void 0}=t,{lineMetrics:f=void 0}=t,{cluster:g=void 0}=t;const{map:p,cluster:m,self:_}=xd();co(i,p,b=>e(13,s=b)),co(i,m,b=>e(16,o=b)),co(i,_,b=>e(0,n=b));let x,v=!0;return yd(()=>{n&&x&&s&&(Od(p,n,x),ho(_,n=null,n),e(11,x=void 0))}),i.$$set=b=>{"id"in b&&e(4,l=b.id),"data"in b&&e(5,c=b.data),"generateId"in b&&e(6,h=b.generateId),"promoteId"in b&&e(7,u=b.promoteId),"filter"in b&&e(8,d=b.filter),"lineMetrics"in b&&e(9,f=b.lineMetrics),"cluster"in b&&e(10,g=b.cluster),"$$scope"in b&&e(14,a=b.$$scope)},i.$$.update=()=>{i.$$.dirty&1024&&ho(m,o=g,o),i.$$.dirty&12273&&s&&n!==l&&(ho(_,n=l,n),Dd(s,n,ra({type:"geojson",data:c,filter:d,lineMetrics:f,generateId:h,promoteId:u,cluster:!!g,clusterMinPoints:g==null?void 0:g.minPoints,clusterMaxZoom:g==null?void 0:g.maxZoom,clusterRadius:g==null?void 0:g.radius,clusterProperties:g==null?void 0:g.properties}),b=>s&&b===n,()=>{n&&(e(11,x=s==null?void 0:s.getSource(n)),e(12,v=!0))})),i.$$.dirty&8208&&(s==null||s.on("style.load",()=>{e(11,x=s==null?void 0:s.getSource(l))})),i.$$.dirty&6176&&x&&(v?e(12,v=!1):x.setData(c)),i.$$.dirty&3072&&(x==null||x.setClusterOptions(ra({cluster:!!g,clusterMaxZoom:g==null?void 0:g.maxZoom,clusterRadius:g==null?void 0:g.radius})))},[n,p,m,_,l,c,h,u,d,f,g,x,v,s,a,r]}class Bv extends An{constructor(t){super(),Dn(this,t,Ld,Td,Pi,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}}let I;const rh=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&rh.decode();let Ki=null;function ln(){return(Ki===null||Ki.byteLength===0)&&(Ki=new Uint8Array(I.memory.buffer)),Ki}function Ke(i,t){return i=i>>>0,rh.decode(ln().subarray(i,i+t))}const ce=new Array(128).fill(void 0);ce.push(void 0,null,!0,!1);let cn=ce.length;function Y(i){cn===ce.length&&ce.push(ce.length+1);const t=cn;return cn=ce[t],ce[t]=i,t}function T(i){return ce[i]}function Rd(i){i<132||(ce[i]=cn,cn=i)}function ye(i){const t=T(i);return Rd(i),t}let Je=0;const ys=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},Ed=typeof ys.encodeInto=="function"?function(i,t){return ys.encodeInto(i,t)}:function(i,t){const e=ys.encode(i);return t.set(e),{read:i.length,written:e.length}};function po(i,t,e){if(e===void 0){const a=ys.encode(i),l=t(a.length,1)>>>0;return ln().subarray(l,l+a.length).set(a),Je=a.length,l}let n=i.length,s=t(n,1)>>>0;const o=ln();let r=0;for(;r127)break;o[s+r]=a}if(r!==n){r!==0&&(i=i.slice(r)),s=e(s,n,n=r+i.length*3,1)>>>0;const a=ln().subarray(s+r,s+n),l=Ed(i,a);r+=l.written}return Je=r,s}function Ci(i){return i==null}let Gi=null;function it(){return(Gi===null||Gi.byteLength===0)&&(Gi=new Int32Array(I.memory.buffer)),Gi}let Zi=null;function ah(){return(Zi===null||Zi.byteLength===0)&&(Zi=new Float64Array(I.memory.buffer)),Zi}let Ji=null;function Id(){return(Ji===null||Ji.byteLength===0)&&(Ji=new BigInt64Array(I.memory.buffer)),Ji}function jo(i){const t=typeof i;if(t=="number"||t=="boolean"||i==null)return`${i}`;if(t=="string")return`"${i}"`;if(t=="symbol"){const s=i.description;return s==null?"Symbol":`Symbol(${s})`}if(t=="function"){const s=i.name;return typeof s=="string"&&s.length>0?`Function(${s})`:"Function"}if(Array.isArray(i)){const s=i.length;let o="[";s>0&&(o+=jo(i[0]));for(let r=1;r1)n=e[1];else return toString.call(i);if(n=="Object")try{return"Object("+JSON.stringify(i)+")"}catch{return"Object"}return i instanceof Error?`${i.name}: ${i.message} -${i.stack}`:n}function Fd(i,t){const e=t(i.length*1,1)>>>0;return ln().set(i,e/1),Je=i.length,e}function $d(i,t){return i=i>>>0,ah().subarray(i/8,i/8+t)}function $e(i,t){try{return i.apply(this,t)}catch(e){I.__wbindgen_exn_store(Y(e))}}class Ho{static __wrap(t){t=t>>>0;const e=Object.create(Ho.prototype);return e.__wbg_ptr=t,e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,t}free(){const t=this.__destroy_into_raw();I.__wbg_jsnetwork_free(t)}constructor(t){try{const o=I.__wbindgen_add_to_stack_pointer(-16),r=Fd(t,I.__wbindgen_malloc),a=Je;I.jsnetwork_new(o,r,a);var e=it()[o/4+0],n=it()[o/4+1],s=it()[o/4+2];if(s)throw ye(n);return Ho.__wrap(e)}finally{I.__wbindgen_add_to_stack_pointer(16)}}recalculate(t){let e,n;try{const h=I.__wbindgen_add_to_stack_pointer(-16);I.jsnetwork_recalculate(h,this.__wbg_ptr,Y(t));var s=it()[h/4+0],o=it()[h/4+1],r=it()[h/4+2],a=it()[h/4+3],l=s,c=o;if(a)throw l=0,c=0,ye(r);return e=l,n=c,Ke(l,c)}finally{I.__wbindgen_add_to_stack_pointer(16),I.__wbindgen_free(e,n,1)}}updateCostFunction(t){try{const s=I.__wbindgen_add_to_stack_pointer(-16);I.jsnetwork_updateCostFunction(s,this.__wbg_ptr,Y(t));var e=it()[s/4+0],n=it()[s/4+1];if(n)throw ye(e)}finally{I.__wbindgen_add_to_stack_pointer(16)}}getBounds(){try{const s=I.__wbindgen_add_to_stack_pointer(-16);I.jsnetwork_getBounds(s,this.__wbg_ptr);var t=it()[s/4+0],e=it()[s/4+1],n=$d(t,e).slice();return I.__wbindgen_free(t,e*8),n}finally{I.__wbindgen_add_to_stack_pointer(16)}}debugNetwork(){let t,e;try{const c=I.__wbindgen_add_to_stack_pointer(-16);I.jsnetwork_debugNetwork(c,this.__wbg_ptr);var n=it()[c/4+0],s=it()[c/4+1],o=it()[c/4+2],r=it()[c/4+3],a=n,l=s;if(r)throw a=0,l=0,ye(o);return t=a,e=l,Ke(a,l)}finally{I.__wbindgen_add_to_stack_pointer(16),I.__wbindgen_free(t,e,1)}}}async function zd(i,t){if(typeof Response=="function"&&i instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(i,t)}catch(n){if(i.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}const e=await i.arrayBuffer();return await WebAssembly.instantiate(e,t)}else{const e=await WebAssembly.instantiate(i,t);return e instanceof WebAssembly.Instance?{instance:e,module:i}:e}}function Bd(){const i={};return i.wbg={},i.wbg.__wbindgen_string_new=function(t,e){const n=Ke(t,e);return Y(n)},i.wbg.__wbindgen_is_bigint=function(t){return typeof T(t)=="bigint"},i.wbg.__wbindgen_bigint_from_u64=function(t){const e=BigInt.asUintN(64,t);return Y(e)},i.wbg.__wbindgen_jsval_eq=function(t,e){return T(t)===T(e)},i.wbg.__wbindgen_object_drop_ref=function(t){ye(t)},i.wbg.__wbindgen_string_get=function(t,e){const n=T(e),s=typeof n=="string"?n:void 0;var o=Ci(s)?0:po(s,I.__wbindgen_malloc,I.__wbindgen_realloc),r=Je;it()[t/4+1]=r,it()[t/4+0]=o},i.wbg.__wbindgen_number_get=function(t,e){const n=T(e),s=typeof n=="number"?n:void 0;ah()[t/8+1]=Ci(s)?0:s,it()[t/4+0]=!Ci(s)},i.wbg.__wbindgen_is_string=function(t){return typeof T(t)=="string"},i.wbg.__wbindgen_is_object=function(t){const e=T(t);return typeof e=="object"&&e!==null},i.wbg.__wbindgen_is_undefined=function(t){return T(t)===void 0},i.wbg.__wbindgen_in=function(t,e){return T(t)in T(e)},i.wbg.__wbindgen_error_new=function(t,e){const n=new Error(Ke(t,e));return Y(n)},i.wbg.__wbindgen_object_clone_ref=function(t){const e=T(t);return Y(e)},i.wbg.__wbindgen_jsval_loose_eq=function(t,e){return T(t)==T(e)},i.wbg.__wbindgen_boolean_get=function(t){const e=T(t);return typeof e=="boolean"?e?1:0:2},i.wbg.__wbindgen_number_new=function(t){return Y(t)},i.wbg.__wbg_getwithrefkey_3b3c46ba20582127=function(t,e){const n=T(t)[T(e)];return Y(n)},i.wbg.__wbg_new_abda76e883ba8a5f=function(){const t=new Error;return Y(t)},i.wbg.__wbg_stack_658279fe44541cf6=function(t,e){const n=T(e).stack,s=po(n,I.__wbindgen_malloc,I.__wbindgen_realloc),o=Je;it()[t/4+1]=o,it()[t/4+0]=s},i.wbg.__wbg_error_f851667af71bcfc6=function(t,e){let n,s;try{n=t,s=e,console.error(Ke(t,e))}finally{I.__wbindgen_free(n,s,1)}},i.wbg.__wbg_getwithrefkey_5e6d9547403deab8=function(t,e){const n=T(t)[T(e)];return Y(n)},i.wbg.__wbg_set_841ac57cff3d672b=function(t,e,n){T(t)[ye(e)]=ye(n)},i.wbg.__wbg_now_0cfdc90c97d0c24b=function(t){return T(t).now()},i.wbg.__wbg_debug_9a6b3243fbbebb61=function(t){console.debug(T(t))},i.wbg.__wbg_error_788ae33f81d3b84b=function(t){console.error(T(t))},i.wbg.__wbg_info_2e30e8204b29d91d=function(t){console.info(T(t))},i.wbg.__wbg_log_1d3ae0273d8f4f8a=function(t){console.log(T(t))},i.wbg.__wbg_warn_d60e832f9882c1b2=function(t){console.warn(T(t))},i.wbg.__wbg_get_44be0491f933a435=function(t,e){const n=T(t)[e>>>0];return Y(n)},i.wbg.__wbg_length_fff51ee6522a1a18=function(t){return T(t).length},i.wbg.__wbg_new_898a68150f225f2e=function(){const t=new Array;return Y(t)},i.wbg.__wbindgen_is_function=function(t){return typeof T(t)=="function"},i.wbg.__wbg_newnoargs_581967eacc0e2604=function(t,e){const n=new Function(Ke(t,e));return Y(n)},i.wbg.__wbg_next_526fc47e980da008=function(t){const e=T(t).next;return Y(e)},i.wbg.__wbg_next_ddb3312ca1c4e32a=function(){return $e(function(t){const e=T(t).next();return Y(e)},arguments)},i.wbg.__wbg_done_5c1f01fb660d73b5=function(t){return T(t).done},i.wbg.__wbg_value_1695675138684bd5=function(t){const e=T(t).value;return Y(e)},i.wbg.__wbg_iterator_97f0c81209c6c35a=function(){return Y(Symbol.iterator)},i.wbg.__wbg_get_97b561fb56f034b5=function(){return $e(function(t,e){const n=Reflect.get(T(t),T(e));return Y(n)},arguments)},i.wbg.__wbg_call_cb65541d95d71282=function(){return $e(function(t,e){const n=T(t).call(T(e));return Y(n)},arguments)},i.wbg.__wbg_new_b51585de1b234aff=function(){const t=new Object;return Y(t)},i.wbg.__wbg_self_1ff1d729e9aae938=function(){return $e(function(){const t=self.self;return Y(t)},arguments)},i.wbg.__wbg_window_5f4faef6c12b79ec=function(){return $e(function(){const t=window.window;return Y(t)},arguments)},i.wbg.__wbg_globalThis_1d39714405582d3c=function(){return $e(function(){const t=globalThis.globalThis;return Y(t)},arguments)},i.wbg.__wbg_global_651f05c6a0944d1c=function(){return $e(function(){const t=global.global;return Y(t)},arguments)},i.wbg.__wbg_set_502d29070ea18557=function(t,e,n){T(t)[e>>>0]=ye(n)},i.wbg.__wbg_instanceof_ArrayBuffer_39ac22089b74fddb=function(t){let e;try{e=T(t)instanceof ArrayBuffer}catch{e=!1}return e},i.wbg.__wbg_isSafeInteger_bb8e18dd21c97288=function(t){return Number.isSafeInteger(T(t))},i.wbg.__wbg_entries_e51f29c7bba0c054=function(t){const e=Object.entries(T(t));return Y(e)},i.wbg.__wbg_buffer_085ec1f694018c4f=function(t){const e=T(t).buffer;return Y(e)},i.wbg.__wbg_new_8125e318e6245eed=function(t){const e=new Uint8Array(T(t));return Y(e)},i.wbg.__wbg_set_5cf90238115182c3=function(t,e,n){T(t).set(T(e),n>>>0)},i.wbg.__wbg_length_72e2208bbc0efc61=function(t){return T(t).length},i.wbg.__wbg_instanceof_Uint8Array_d8d9cb2b8e8ac1d4=function(t){let e;try{e=T(t)instanceof Uint8Array}catch{e=!1}return e},i.wbg.__wbindgen_bigint_get_as_i64=function(t,e){const n=T(e),s=typeof n=="bigint"?n:void 0;Id()[t/8+1]=Ci(s)?BigInt(0):s,it()[t/4+0]=!Ci(s)},i.wbg.__wbindgen_debug_string=function(t,e){const n=jo(T(e)),s=po(n,I.__wbindgen_malloc,I.__wbindgen_realloc),o=Je;it()[t/4+1]=o,it()[t/4+0]=s},i.wbg.__wbindgen_throw=function(t,e){throw new Error(Ke(t,e))},i.wbg.__wbindgen_memory=function(){const t=I.memory;return Y(t)},i}function Nd(i,t){return I=i.exports,Vd.__wbindgen_wasm_module=t,Ji=null,Zi=null,Gi=null,Ki=null,I}async function Vd(i){if(I!==void 0)return I;typeof i>"u"&&(i="/od2net/assets/wasm_od2net_bg.wasm");const t=Bd();(typeof i=="string"||typeof Request=="function"&&i instanceof Request||typeof URL=="function"&&i instanceof URL)&&(i=fetch(i));const{instance:e,module:n}=await zd(await i,t);return Nd(e,n)}function Wd(i){let t,e,n,s,o,r,a,l,c,h,u,d;return{c(){t=z("div"),e=z("label"),n=Pe(`Or load an example: - `),s=z("select"),o=z("option"),o.textContent="Custom file loaded",r=z("option"),r.textContent="Antwerp",a=z("option"),a.textContent="Berlin",l=z("option"),l.textContent="South London",c=z("option"),c.textContent="Paris",h=z("option"),h.textContent="Seattle",o.__value="",ft(o,o.__value),r.__value="antwerp",ft(r,r.__value),a.__value="berlin",ft(a,a.__value),l.__value="london",ft(l,l.__value),c.__value="paris",ft(c,c.__value),h.__value="seattle",ft(h,h.__value),i[0]===void 0&&ih(()=>i[1].call(s))},m(f,g){st(f,t,g),N(t,e),N(e,n),N(e,s),N(s,o),N(s,r),N(s,a),N(s,l),N(s,c),N(s,h),Ps(s,i[0],!0),u||(d=Gt(s,"change",i[1]),u=!0)},p(f,[g]){g&1&&Ps(s,f[0])},i:It,o:It,d(f){f&&ot(t),u=!1,d()}}}function jd(i,t,e){let{example:n}=t;function s(){n=nh(this),e(0,n)}return i.$$set=o=>{"example"in o&&e(0,n=o.example)},[n,s]}class Nv extends An{constructor(t){super(),Dn(this,t,jd,Wd,Pi,{example:0})}}/*! - * @kurkle/color v0.3.2 - * https://github.com/kurkle/color#readme - * (c) 2023 Jukka Kurkela - * Released under the MIT License - */function Tn(i){return i+.5|0}const ve=(i,t,e)=>Math.max(Math.min(i,e),t);function Qi(i){return ve(Tn(i*2.55),0,255)}function Ce(i){return ve(Tn(i*255),0,255)}function re(i){return ve(Tn(i/2.55)/100,0,1)}function ha(i){return ve(Tn(i*100),0,100)}const Ot={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Yo=[..."0123456789ABCDEF"],Hd=i=>Yo[i&15],Yd=i=>Yo[(i&240)>>4]+Yo[i&15],Bn=i=>(i&240)>>4===(i&15),Xd=i=>Bn(i.r)&&Bn(i.g)&&Bn(i.b)&&Bn(i.a);function Ud(i){var t=i.length,e;return i[0]==="#"&&(t===4||t===5?e={r:255&Ot[i[1]]*17,g:255&Ot[i[2]]*17,b:255&Ot[i[3]]*17,a:t===5?Ot[i[4]]*17:255}:(t===7||t===9)&&(e={r:Ot[i[1]]<<4|Ot[i[2]],g:Ot[i[3]]<<4|Ot[i[4]],b:Ot[i[5]]<<4|Ot[i[6]],a:t===9?Ot[i[7]]<<4|Ot[i[8]]:255})),e}const qd=(i,t)=>i<255?t(i):"";function Kd(i){var t=Xd(i)?Hd:Yd;return i?"#"+t(i.r)+t(i.g)+t(i.b)+qd(i.a,t):void 0}const Gd=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function lh(i,t,e){const n=t*Math.min(e,1-e),s=(o,r=(o+i/30)%12)=>e-n*Math.max(Math.min(r-3,9-r,1),-1);return[s(0),s(8),s(4)]}function Zd(i,t,e){const n=(s,o=(s+i/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[n(5),n(3),n(1)]}function Jd(i,t,e){const n=lh(i,1,.5);let s;for(t+e>1&&(s=1/(t+e),t*=s,e*=s),s=0;s<3;s++)n[s]*=1-t-e,n[s]+=t;return n}function Qd(i,t,e,n,s){return i===s?(t-e)/n+(t.5?h/(2-o-r):h/(o+r),l=Qd(e,n,s,h,o),l=l*60+.5),[l|0,c||0,a]}function wr(i,t,e,n){return(Array.isArray(t)?i(t[0],t[1],t[2]):i(t,e,n)).map(Ce)}function kr(i,t,e){return wr(lh,i,t,e)}function tf(i,t,e){return wr(Jd,i,t,e)}function ef(i,t,e){return wr(Zd,i,t,e)}function ch(i){return(i%360+360)%360}function nf(i){const t=Gd.exec(i);let e=255,n;if(!t)return;t[5]!==n&&(e=t[6]?Qi(+t[5]):Ce(+t[5]));const s=ch(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?n=tf(s,o,r):t[1]==="hsv"?n=ef(s,o,r):n=kr(s,o,r),{r:n[0],g:n[1],b:n[2],a:e}}function sf(i,t){var e=vr(i);e[0]=ch(e[0]+t),e=kr(e),i.r=e[0],i.g=e[1],i.b=e[2]}function of(i){if(!i)return;const t=vr(i),e=t[0],n=ha(t[1]),s=ha(t[2]);return i.a<255?`hsla(${e}, ${n}%, ${s}%, ${re(i.a)})`:`hsl(${e}, ${n}%, ${s}%)`}const ua={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},da={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function rf(){const i={},t=Object.keys(da),e=Object.keys(ua);let n,s,o,r,a;for(n=0;n>16&255,o>>8&255,o&255]}return i}let Nn;function af(i){Nn||(Nn=rf(),Nn.transparent=[0,0,0,0]);const t=Nn[i.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const lf=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function cf(i){const t=lf.exec(i);let e=255,n,s,o;if(t){if(t[7]!==n){const r=+t[7];e=t[8]?Qi(r):ve(r*255,0,255)}return n=+t[1],s=+t[3],o=+t[5],n=255&(t[2]?Qi(n):ve(n,0,255)),s=255&(t[4]?Qi(s):ve(s,0,255)),o=255&(t[6]?Qi(o):ve(o,0,255)),{r:n,g:s,b:o,a:e}}}function hf(i){return i&&(i.a<255?`rgba(${i.r}, ${i.g}, ${i.b}, ${re(i.a)})`:`rgb(${i.r}, ${i.g}, ${i.b})`)}const mo=i=>i<=.0031308?i*12.92:Math.pow(i,1/2.4)*1.055-.055,ri=i=>i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4);function uf(i,t,e){const n=ri(re(i.r)),s=ri(re(i.g)),o=ri(re(i.b));return{r:Ce(mo(n+e*(ri(re(t.r))-n))),g:Ce(mo(s+e*(ri(re(t.g))-s))),b:Ce(mo(o+e*(ri(re(t.b))-o))),a:i.a+e*(t.a-i.a)}}function Vn(i,t,e){if(i){let n=vr(i);n[t]=Math.max(0,Math.min(n[t]+n[t]*e,t===0?360:1)),n=kr(n),i.r=n[0],i.g=n[1],i.b=n[2]}}function hh(i,t){return i&&Object.assign(t||{},i)}function fa(i){var t={r:0,g:0,b:0,a:255};return Array.isArray(i)?i.length>=3&&(t={r:i[0],g:i[1],b:i[2],a:255},i.length>3&&(t.a=Ce(i[3]))):(t=hh(i,{r:0,g:0,b:0,a:1}),t.a=Ce(t.a)),t}function df(i){return i.charAt(0)==="r"?cf(i):nf(i)}let uh=class Xo{constructor(t){if(t instanceof Xo)return t;const e=typeof t;let n;e==="object"?n=fa(t):e==="string"&&(n=Ud(t)||af(t)||df(t)),this._rgb=n,this._valid=!!n}get valid(){return this._valid}get rgb(){var t=hh(this._rgb);return t&&(t.a=re(t.a)),t}set rgb(t){this._rgb=fa(t)}rgbString(){return this._valid?hf(this._rgb):void 0}hexString(){return this._valid?Kd(this._rgb):void 0}hslString(){return this._valid?of(this._rgb):void 0}mix(t,e){if(t){const n=this.rgb,s=t.rgb;let o;const r=e===o?.5:e,a=2*r-1,l=n.a-s.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-c,n.r=255&c*n.r+o*s.r+.5,n.g=255&c*n.g+o*s.g+.5,n.b=255&c*n.b+o*s.b+.5,n.a=r*n.a+(1-r)*s.a,this.rgb=n}return this}interpolate(t,e){return t&&(this._rgb=uf(this._rgb,t._rgb,e)),this}clone(){return new Xo(this.rgb)}alpha(t){return this._rgb.a=Ce(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=Tn(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){const e=this._rgb;return e.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Vn(this._rgb,2,t),this}darken(t){return Vn(this._rgb,2,-t),this}saturate(t){return Vn(this._rgb,1,t),this}desaturate(t){return Vn(this._rgb,1,-t),this}rotate(t){return sf(this._rgb,t),this}};/*! - * Chart.js v4.4.0 - * https://www.chartjs.org - * (c) 2023 Chart.js Contributors - * Released under the MIT License - */function ee(){}const ff=(()=>{let i=0;return()=>i++})();function W(i){return i===null||typeof i>"u"}function Z(i){if(Array.isArray&&Array.isArray(i))return!0;const t=Object.prototype.toString.call(i);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function $(i){return i!==null&&Object.prototype.toString.call(i)==="[object Object]"}function rt(i){return(typeof i=="number"||i instanceof Number)&&isFinite(+i)}function Ct(i,t){return rt(i)?i:t}function E(i,t){return typeof i>"u"?t:i}const gf=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100:+i/t,dh=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100*t:+i;function G(i,t,e){if(i&&typeof i.call=="function")return i.apply(e,t)}function X(i,t,e,n){let s,o,r;if(Z(i))if(o=i.length,n)for(s=o-1;s>=0;s--)t.call(e,i[s],s);else for(s=0;si,x:i=>i.x,y:i=>i.y};function bf(i){const t=i.split("."),e=[];let n="";for(const s of t)n+=s,n.endsWith("\\")?n=n.slice(0,-1)+".":(e.push(n),n="");return e}function _f(i){const t=bf(i);return e=>{for(const n of t){if(n==="")break;e=e&&e[n]}return e}}function Oe(i,t){return(ga[t]||(ga[t]=_f(t)))(i)}function Mr(i){return i.charAt(0).toUpperCase()+i.slice(1)}const xn=i=>typeof i<"u",Te=i=>typeof i=="function",pa=(i,t)=>{if(i.size!==t.size)return!1;for(const e of i)if(!t.has(e))return!1;return!0};function xf(i){return i.type==="mouseup"||i.type==="click"||i.type==="contextmenu"}const Q=Math.PI,J=2*Q,yf=J+Q,Ds=Number.POSITIVE_INFINITY,vf=Q/180,ut=Q/2,ze=Q/4,ma=Q*2/3,we=Math.log10,qt=Math.sign;function un(i,t,e){return Math.abs(i-t)s-o).pop(),t}function yi(i){return!isNaN(parseFloat(i))&&isFinite(i)}function kf(i,t){const e=Math.round(i);return e-t<=i&&e+t>=i}function gh(i,t,e){let n,s,o;for(n=0,s=i.length;nl&&c=Math.min(t,e)-n&&i<=Math.max(t,e)+n}function Pr(i,t,e){e=e||(r=>i[r]1;)o=s+n>>1,e(o)?s=o:n=o;return{lo:s,hi:n}}const ue=(i,t,e,n)=>Pr(i,e,n?s=>{const o=i[s][t];return oi[s][t]Pr(i,e,n=>i[n][t]>=e);function Cf(i,t,e){let n=0,s=i.length;for(;nn&&i[s-1]>e;)s--;return n>0||s{const n="_onData"+Mr(e),s=i[e];Object.defineProperty(i,e,{configurable:!0,enumerable:!1,value(...o){const r=s.apply(this,o);return i._chartjs.listeners.forEach(a=>{typeof a[n]=="function"&&a[n](...o)}),r}})})}function xa(i,t){const e=i._chartjs;if(!e)return;const n=e.listeners,s=n.indexOf(t);s!==-1&&n.splice(s,1),!(n.length>0)&&(mh.forEach(o=>{delete i[o]}),delete i._chartjs)}function bh(i){const t=new Set(i);return t.size===i.length?i:Array.from(t)}const _h=function(){return typeof window>"u"?function(i){return i()}:window.requestAnimationFrame}();function xh(i,t){let e=[],n=!1;return function(...s){e=s,n||(n=!0,_h.call(window,()=>{n=!1,i.apply(t,e)}))}}function Df(i,t){let e;return function(...n){return t?(clearTimeout(e),e=setTimeout(i,t,n)):i.apply(this,n),t}}const Cr=i=>i==="start"?"left":i==="end"?"right":"center",bt=(i,t,e)=>i==="start"?t:i==="end"?e:(t+e)/2,Of=(i,t,e,n)=>i===(n?"left":"right")?e:i==="center"?(t+e)/2:t;function yh(i,t,e){const n=t.length;let s=0,o=n;if(i._sorted){const{iScale:r,_parsed:a}=i,l=r.axis,{min:c,max:h,minDefined:u,maxDefined:d}=r.getUserBounds();u&&(s=gt(Math.min(ue(a,l,c).lo,e?n:ue(t,l,r.getPixelForValue(c)).lo),0,n-1)),d?o=gt(Math.max(ue(a,r.axis,h,!0).hi+1,e?0:ue(t,l,r.getPixelForValue(h),!0).hi+1),s,n)-s:o=n-s}return{start:s,count:o}}function vh(i){const{xScale:t,yScale:e,_scaleRanges:n}=i,s={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!n)return i._scaleRanges=s,!0;const o=n.xmin!==t.min||n.xmax!==t.max||n.ymin!==e.min||n.ymax!==e.max;return Object.assign(n,s),o}const Wn=i=>i===0||i===1,ya=(i,t,e)=>-(Math.pow(2,10*(i-=1))*Math.sin((i-t)*J/e)),va=(i,t,e)=>Math.pow(2,-10*i)*Math.sin((i-t)*J/e)+1,dn={linear:i=>i,easeInQuad:i=>i*i,easeOutQuad:i=>-i*(i-2),easeInOutQuad:i=>(i/=.5)<1?.5*i*i:-.5*(--i*(i-2)-1),easeInCubic:i=>i*i*i,easeOutCubic:i=>(i-=1)*i*i+1,easeInOutCubic:i=>(i/=.5)<1?.5*i*i*i:.5*((i-=2)*i*i+2),easeInQuart:i=>i*i*i*i,easeOutQuart:i=>-((i-=1)*i*i*i-1),easeInOutQuart:i=>(i/=.5)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2),easeInQuint:i=>i*i*i*i*i,easeOutQuint:i=>(i-=1)*i*i*i*i+1,easeInOutQuint:i=>(i/=.5)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2),easeInSine:i=>-Math.cos(i*ut)+1,easeOutSine:i=>Math.sin(i*ut),easeInOutSine:i=>-.5*(Math.cos(Q*i)-1),easeInExpo:i=>i===0?0:Math.pow(2,10*(i-1)),easeOutExpo:i=>i===1?1:-Math.pow(2,-10*i)+1,easeInOutExpo:i=>Wn(i)?i:i<.5?.5*Math.pow(2,10*(i*2-1)):.5*(-Math.pow(2,-10*(i*2-1))+2),easeInCirc:i=>i>=1?i:-(Math.sqrt(1-i*i)-1),easeOutCirc:i=>Math.sqrt(1-(i-=1)*i),easeInOutCirc:i=>(i/=.5)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1),easeInElastic:i=>Wn(i)?i:ya(i,.075,.3),easeOutElastic:i=>Wn(i)?i:va(i,.075,.3),easeInOutElastic(i){return Wn(i)?i:i<.5?.5*ya(i*2,.1125,.45):.5+.5*va(i*2-1,.1125,.45)},easeInBack(i){return i*i*((1.70158+1)*i-1.70158)},easeOutBack(i){return(i-=1)*i*((1.70158+1)*i+1.70158)+1},easeInOutBack(i){let t=1.70158;return(i/=.5)<1?.5*(i*i*(((t*=1.525)+1)*i-t)):.5*((i-=2)*i*(((t*=1.525)+1)*i+t)+2)},easeInBounce:i=>1-dn.easeOutBounce(1-i),easeOutBounce(i){return i<1/2.75?7.5625*i*i:i<2/2.75?7.5625*(i-=1.5/2.75)*i+.75:i<2.5/2.75?7.5625*(i-=2.25/2.75)*i+.9375:7.5625*(i-=2.625/2.75)*i+.984375},easeInOutBounce:i=>i<.5?dn.easeInBounce(i*2)*.5:dn.easeOutBounce(i*2-1)*.5+.5};function Ar(i){if(i&&typeof i=="object"){const t=i.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function wa(i){return Ar(i)?i:new uh(i)}function bo(i){return Ar(i)?i:new uh(i).saturate(.5).darken(.1).hexString()}const Tf=["x","y","borderWidth","radius","tension"],Lf=["color","borderColor","backgroundColor"];function Rf(i){i.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),i.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),i.set("animations",{colors:{type:"color",properties:Lf},numbers:{type:"number",properties:Tf}}),i.describe("animations",{_fallback:"animation"}),i.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function Ef(i){i.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const ka=new Map;function If(i,t){t=t||{};const e=i+JSON.stringify(t);let n=ka.get(e);return n||(n=new Intl.NumberFormat(i,t),ka.set(e,n)),n}function Ln(i,t,e){return If(t,e).format(i)}const wh={values(i){return Z(i)?i:""+i},numeric(i,t,e){if(i===0)return"0";const n=this.chart.options.locale;let s,o=i;if(e.length>1){const c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),o=Ff(i,e)}const r=we(Math.abs(o)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),Ln(i,n,l)},logarithmic(i,t,e){if(i===0)return"0";const n=e[t].significand||i/Math.pow(10,Math.floor(we(i)));return[1,2,3,5,10,15].includes(n)||t>.8*e.length?wh.numeric.call(this,i,t,e):""}};function Ff(i,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&i!==Math.floor(i)&&(e=i-Math.floor(i)),e}var Zs={formatters:wh};function $f(i){i.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Zs.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),i.route("scale.ticks","color","","color"),i.route("scale.grid","color","","borderColor"),i.route("scale.border","color","","borderColor"),i.route("scale.title","color","","color"),i.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),i.describe("scales",{_fallback:"scale"}),i.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const ii=Object.create(null),qo=Object.create(null);function fn(i,t){if(!t)return i;const e=t.split(".");for(let n=0,s=e.length;nn.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(n,s)=>bo(s.backgroundColor),this.hoverBorderColor=(n,s)=>bo(s.borderColor),this.hoverColor=(n,s)=>bo(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return _o(this,t,e)}get(t){return fn(this,t)}describe(t,e){return _o(qo,t,e)}override(t,e){return _o(ii,t,e)}route(t,e,n,s){const o=fn(this,t),r=fn(this,n),a="_"+e;Object.defineProperties(o,{[a]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const l=this[a],c=r[s];return $(l)?Object.assign({},c,l):E(l,c)},set(l){this[a]=l}}})}apply(t){t.forEach(e=>e(this))}};var at=new zf({_scriptable:i=>!i.startsWith("on"),_indexable:i=>i!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Rf,Ef,$f]);function Bf(i){return!i||W(i.size)||W(i.family)?null:(i.style?i.style+" ":"")+(i.weight?i.weight+" ":"")+i.size+"px "+i.family}function Os(i,t,e,n,s){let o=t[s];return o||(o=t[s]=i.measureText(s).width,e.push(s)),o>n&&(n=o),n}function Nf(i,t,e,n){n=n||{};let s=n.data=n.data||{},o=n.garbageCollect=n.garbageCollect||[];n.font!==t&&(s=n.data={},o=n.garbageCollect=[],n.font=t),i.save(),i.font=t;let r=0;const a=e.length;let l,c,h,u,d;for(l=0;le.length){for(l=0;l0&&i.stroke()}}function de(i,t,e){return e=e||.5,!t||i&&i.x>t.left-e&&i.xt.top-e&&i.y0&&o.strokeColor!=="";let l,c;for(i.save(),i.font=s.string,jf(i,o),l=0;l+i||0;function Dr(i,t){const e={},n=$(t),s=n?Object.keys(t):t,o=$(i)?n?r=>E(i[r],i[t[r]]):r=>i[r]:()=>i;for(const r of s)e[r]=Kf(o(r));return e}function Mh(i){return Dr(i,{top:"y",right:"x",bottom:"y",left:"x"})}function Qe(i){return Dr(i,["topLeft","topRight","bottomLeft","bottomRight"])}function yt(i){const t=Mh(i);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function dt(i,t){i=i||{},t=t||at.font;let e=E(i.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let n=E(i.style,t.style);n&&!(""+n).match(Uf)&&(console.warn('Invalid font style specified: "'+n+'"'),n=void 0);const s={family:E(i.family,t.family),lineHeight:qf(E(i.lineHeight,t.lineHeight),e),size:e,style:n,weight:E(i.weight,t.weight),string:""};return s.string=Bf(s),s}function tn(i,t,e,n){let s=!0,o,r,a;for(o=0,r=i.length;oe&&a===0?0:a+l;return{min:r(n,-Math.abs(o)),max:r(s,o)}}function Ee(i,t){return Object.assign(Object.create(i),t)}function Or(i,t=[""],e,n,s=()=>i[0]){const o=e||i;typeof n>"u"&&(n=Ah("_fallback",i));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:i,_rootScopes:o,_fallback:n,_getTarget:s,override:a=>Or([a,...i],t,o,n)};return new Proxy(r,{deleteProperty(a,l){return delete a[l],delete a._keys,delete i[0][l],!0},get(a,l){return Ph(a,l,()=>sg(l,t,i,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(i[0])},has(a,l){return Pa(a).includes(l)},ownKeys(a){return Pa(a)},set(a,l,c){const h=a._storage||(a._storage=s());return a[l]=h[l]=c,delete a._keys,!0}})}function vi(i,t,e,n){const s={_cacheable:!1,_proxy:i,_context:t,_subProxy:e,_stack:new Set,_descriptors:Sh(i,n),setContext:o=>vi(i,o,e,n),override:o=>vi(i.override(o),t,e,n)};return new Proxy(s,{deleteProperty(o,r){return delete o[r],delete i[r],!0},get(o,r,a){return Ph(o,r,()=>Jf(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(i,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(i,r)},getPrototypeOf(){return Reflect.getPrototypeOf(i)},has(o,r){return Reflect.has(i,r)},ownKeys(){return Reflect.ownKeys(i)},set(o,r,a){return i[r]=a,delete o[r],!0}})}function Sh(i,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:n=t.indexable,_allKeys:s=t.allKeys}=i;return{allKeys:s,scriptable:e,indexable:n,isScriptable:Te(e)?e:()=>e,isIndexable:Te(n)?n:()=>n}}const Zf=(i,t)=>i?i+Mr(t):t,Tr=(i,t)=>$(t)&&i!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function Ph(i,t,e){if(Object.prototype.hasOwnProperty.call(i,t))return i[t];const n=e();return i[t]=n,n}function Jf(i,t,e){const{_proxy:n,_context:s,_subProxy:o,_descriptors:r}=i;let a=n[t];return Te(a)&&r.isScriptable(t)&&(a=Qf(t,a,i,e)),Z(a)&&a.length&&(a=tg(t,a,i,r.isIndexable)),Tr(t,a)&&(a=vi(a,s,o&&o[t],r)),a}function Qf(i,t,e,n){const{_proxy:s,_context:o,_subProxy:r,_stack:a}=e;if(a.has(i))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+i);a.add(i);let l=t(o,r||n);return a.delete(i),Tr(i,l)&&(l=Lr(s._scopes,s,i,l)),l}function tg(i,t,e,n){const{_proxy:s,_context:o,_subProxy:r,_descriptors:a}=e;if(typeof o.index<"u"&&n(i))return t[o.index%t.length];if($(t[0])){const l=t,c=s._scopes.filter(h=>h!==l);t=[];for(const h of l){const u=Lr(c,s,i,h);t.push(vi(u,o,r&&r[i],a))}}return t}function Ch(i,t,e){return Te(i)?i(t,e):i}const eg=(i,t)=>i===!0?t:typeof i=="string"?Oe(t,i):void 0;function ig(i,t,e,n,s){for(const o of t){const r=eg(e,o);if(r){i.add(r);const a=Ch(r._fallback,e,s);if(typeof a<"u"&&a!==e&&a!==n)return a}else if(r===!1&&typeof n<"u"&&e!==n)return null}return!1}function Lr(i,t,e,n){const s=t._rootScopes,o=Ch(t._fallback,e,n),r=[...i,...s],a=new Set;a.add(n);let l=Sa(a,r,e,o||e,n);return l===null||typeof o<"u"&&o!==e&&(l=Sa(a,r,o,l,n),l===null)?!1:Or(Array.from(a),[""],s,o,()=>ng(t,e,n))}function Sa(i,t,e,n,s){for(;e;)e=ig(i,t,e,n,s);return e}function ng(i,t,e){const n=i._getTarget();t in n||(n[t]={});const s=n[t];return Z(s)&&$(e)?e:s||{}}function sg(i,t,e,n){let s;for(const o of t)if(s=Ah(Zf(o,i),e),typeof s<"u")return Tr(i,s)?Lr(e,n,i,s):s}function Ah(i,t){for(const e of t){if(!e)continue;const n=e[i];if(typeof n<"u")return n}}function Pa(i){let t=i._keys;return t||(t=i._keys=og(i._scopes)),t}function og(i){const t=new Set;for(const e of i)for(const n of Object.keys(e).filter(s=>!s.startsWith("_")))t.add(n);return Array.from(t)}function Dh(i,t,e,n){const{iScale:s}=i,{key:o="r"}=this._parsing,r=new Array(n);let a,l,c,h;for(a=0,l=n;ati==="x"?"y":"x";function ag(i,t,e,n){const s=i.skip?t:i,o=t,r=e.skip?t:e,a=Uo(o,s),l=Uo(r,o);let c=a/(a+l),h=l/(a+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const u=n*c,d=n*h;return{previous:{x:o.x-u*(r.x-s.x),y:o.y-u*(r.y-s.y)},next:{x:o.x+d*(r.x-s.x),y:o.y+d*(r.y-s.y)}}}function lg(i,t,e){const n=i.length;let s,o,r,a,l,c=wi(i,0);for(let h=0;h!c.skip)),t.cubicInterpolationMode==="monotone")hg(i,s);else{let c=n?i[i.length-1]:i[0];for(o=0,r=i.length;oi.ownerDocument.defaultView.getComputedStyle(i,null);function fg(i,t){return to(i).getPropertyValue(t)}const gg=["top","right","bottom","left"];function ti(i,t,e){const n={};e=e?"-"+e:"";for(let s=0;s<4;s++){const o=gg[s];n[o]=parseFloat(i[t+"-"+o+e])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}const pg=(i,t,e)=>(i>0||t>0)&&(!e||!e.shadowRoot);function mg(i,t){const e=i.touches,n=e&&e.length?e[0]:i,{offsetX:s,offsetY:o}=n;let r=!1,a,l;if(pg(s,o,i.target))a=s,l=o;else{const c=t.getBoundingClientRect();a=n.clientX-c.left,l=n.clientY-c.top,r=!0}return{x:a,y:l,box:r}}function He(i,t){if("native"in i)return i;const{canvas:e,currentDevicePixelRatio:n}=t,s=to(e),o=s.boxSizing==="border-box",r=ti(s,"padding"),a=ti(s,"border","width"),{x:l,y:c,box:h}=mg(i,e),u=r.left+(h&&a.left),d=r.top+(h&&a.top);let{width:f,height:g}=t;return o&&(f-=r.width+a.width,g-=r.height+a.height),{x:Math.round((l-u)/f*e.width/n),y:Math.round((c-d)/g*e.height/n)}}function bg(i,t,e){let n,s;if(t===void 0||e===void 0){const o=Rr(i);if(!o)t=i.clientWidth,e=i.clientHeight;else{const r=o.getBoundingClientRect(),a=to(o),l=ti(a,"border","width"),c=ti(a,"padding");t=r.width-c.width-l.width,e=r.height-c.height-l.height,n=Ts(a.maxWidth,o,"clientWidth"),s=Ts(a.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:n||Ds,maxHeight:s||Ds}}const Hn=i=>Math.round(i*10)/10;function _g(i,t,e,n){const s=to(i),o=ti(s,"margin"),r=Ts(s.maxWidth,i,"clientWidth")||Ds,a=Ts(s.maxHeight,i,"clientHeight")||Ds,l=bg(i,t,e);let{width:c,height:h}=l;if(s.boxSizing==="content-box"){const d=ti(s,"border","width"),f=ti(s,"padding");c-=f.width+d.width,h-=f.height+d.height}return c=Math.max(0,c-o.width),h=Math.max(0,n?c/n:h-o.height),c=Hn(Math.min(c,r,l.maxWidth)),h=Hn(Math.min(h,a,l.maxHeight)),c&&!h&&(h=Hn(c/2)),(t!==void 0||e!==void 0)&&n&&l.height&&h>l.height&&(h=l.height,c=Hn(Math.floor(h*n))),{width:c,height:h}}function Ca(i,t,e){const n=t||1,s=Math.floor(i.height*n),o=Math.floor(i.width*n);i.height=Math.floor(i.height),i.width=Math.floor(i.width);const r=i.canvas;return r.style&&(e||!r.style.height&&!r.style.width)&&(r.style.height=`${i.height}px`,r.style.width=`${i.width}px`),i.currentDevicePixelRatio!==n||r.height!==s||r.width!==o?(i.currentDevicePixelRatio=n,r.height=s,r.width=o,i.ctx.setTransform(n,0,0,n,0,0),!0):!1}const xg=function(){let i=!1;try{const t={get passive(){return i=!0,!1}};window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch{}return i}();function Aa(i,t){const e=fg(i,t),n=e&&e.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function Ye(i,t,e,n){return{x:i.x+e*(t.x-i.x),y:i.y+e*(t.y-i.y)}}function yg(i,t,e,n){return{x:i.x+e*(t.x-i.x),y:n==="middle"?e<.5?i.y:t.y:n==="after"?e<1?i.y:t.y:e>0?t.y:i.y}}function vg(i,t,e,n){const s={x:i.cp2x,y:i.cp2y},o={x:t.cp1x,y:t.cp1y},r=Ye(i,s,e),a=Ye(s,o,e),l=Ye(o,t,e),c=Ye(r,a,e),h=Ye(a,l,e);return Ye(c,h,e)}const wg=function(i,t){return{x(e){return i+i+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,n){return e-n},leftForLtr(e,n){return e-n}}},kg=function(){return{x(i){return i},setWidth(i){},textAlign(i){return i},xPlus(i,t){return i+t},leftForLtr(i,t){return i}}};function bi(i,t,e){return i?wg(t,e):kg()}function Lh(i,t){let e,n;(t==="ltr"||t==="rtl")&&(e=i.canvas.style,n=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),i.prevTextDirection=n)}function Rh(i,t){t!==void 0&&(delete i.prevTextDirection,i.canvas.style.setProperty("direction",t[0],t[1]))}function Eh(i){return i==="angle"?{between:yn,compare:Mf,normalize:At}:{between:he,compare:(t,e)=>t-e,normalize:t=>t}}function Da({start:i,end:t,count:e,loop:n,style:s}){return{start:i%e,end:t%e,loop:n&&(t-i+1)%e===0,style:s}}function Mg(i,t,e){const{property:n,start:s,end:o}=e,{between:r,normalize:a}=Eh(n),l=t.length;let{start:c,end:h,loop:u}=i,d,f;if(u){for(c+=l,h+=l,d=0,f=l;dl(s,v,_)&&a(s,v)!==0,y=()=>a(o,_)===0||l(o,v,_),k=()=>p||b(),w=()=>!p||y();for(let M=h,S=h;M<=u;++M)x=t[M%r],!x.skip&&(_=c(x[n]),_!==v&&(p=l(_,s,o),m===null&&k()&&(m=a(_,s)===0?M:S),m!==null&&w()&&(g.push(Da({start:m,end:M,loop:d,count:r,style:f})),m=null),S=M,v=_));return m!==null&&g.push(Da({start:m,end:u,loop:d,count:r,style:f})),g}function Fh(i,t){const e=[],n=i.segments;for(let s=0;ss&&i[o%t].skip;)o--;return o%=t,{start:s,end:o}}function Pg(i,t,e,n){const s=i.length,o=[];let r=t,a=i[t],l;for(l=t+1;l<=e;++l){const c=i[l%s];c.skip||c.stop?a.skip||(n=!1,o.push({start:t%s,end:(l-1)%s,loop:n}),t=r=c.stop?l:null):(r=l,a.skip&&(t=l)),a=c}return r!==null&&o.push({start:t%s,end:r%s,loop:n}),o}function Cg(i,t){const e=i.points,n=i.options.spanGaps,s=e.length;if(!s)return[];const o=!!i._loop,{start:r,end:a}=Sg(e,s,o,n);if(n===!0)return Oa(i,[{start:r,end:a,loop:o}],e,t);const l=aa({chart:t,initial:e.initial,numSteps:r,currentStep:Math.min(n-e.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=_h.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((n,s)=>{if(!n.running||!n.items.length)return;const o=n.items;let r=o.length-1,a=!1,l;for(;r>=0;--r)l=o[r],l._active?(l._total>n.duration&&(n.duration=l._total),l.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(s.draw(),this._notify(s,n,t,"progress")),o.length||(n.running=!1,this._notify(s,n,t,"complete"),n.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let n=e.get(t);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,n)),n}listen(t,e,n){this._getAnims(t).listeners[e].push(n)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((n,s)=>Math.max(n,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const n=e.items;let s=n.length-1;for(;s>=0;--s)n[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}};var ie=new Og;const La="transparent",Tg={boolean(i,t,e){return e>.5?t:i},color(i,t,e){const n=wa(i||La),s=n.valid&&wa(t||La);return s&&s.valid?s.mix(n,e).hexString():t},number(i,t,e){return i+(t-i)*e}};let Lg=class{constructor(t,e,n,s){const o=e[n];s=tn([t.to,s,o,t.from]);const r=tn([t.from,o,s]);this._active=!0,this._fn=t.fn||Tg[t.type||typeof r],this._easing=dn[t.easing]||dn.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=n,this._from=r,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,n){if(this._active){this._notify(!1);const s=this._target[this._prop],o=n-this._start,r=this._duration-o;this._start=n,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=tn([t.to,e,s,t.from]),this._from=tn([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,n=this._duration,s=this._prop,o=this._from,r=this._loop,a=this._to;let l;if(this._active=o!==a&&(r||e1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,n)=>{t.push({res:e,rej:n})})}_notify(t){const e=t?"res":"rej",n=this._promises||[];for(let s=0;s{const o=t[s];if(!$(o))return;const r={};for(const a of e)r[a]=o[a];(Z(o.properties)&&o.properties||[s]).forEach(a=>{(a===s||!n.has(a))&&n.set(a,r)})})}_animateOptions(t,e){const n=e.options,s=Eg(t,n);if(!s)return[];const o=this._createAnimations(s,n);return n.$shared&&Rg(t.options.$animations,n).then(()=>{t.options=n},()=>{}),o}_createAnimations(t,e){const n=this._properties,s=[],o=t.$animations||(t.$animations={}),r=Object.keys(e),a=Date.now();let l;for(l=r.length-1;l>=0;--l){const c=r[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,e));continue}const h=e[c];let u=o[c];const d=n.get(c);if(u)if(d&&u.active()){u.update(d,h,a);continue}else u.cancel();if(!d||!d.duration){t[c]=h;continue}o[c]=u=new Lg(d,t,c,h),s.push(u)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const n=this._createAnimations(t,e);if(n.length)return ie.add(this._chart,n),!0}};function Rg(i,t){const e=[],n=Object.keys(t);for(let s=0;s0||!e&&o<0)return s.index}return null}function $a(i,t){const{chart:e,_cachedMeta:n}=i,s=e._stacks||(e._stacks={}),{iScale:o,vScale:r,index:a}=n,l=o.axis,c=r.axis,h=zg(o,r,n),u=t.length;let d;for(let f=0;fe[n].axis===t).shift()}function Vg(i,t){return Ee(i,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Wg(i,t,e){return Ee(i,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function Ai(i,t){const e=i.controller.index,n=i.vScale&&i.vScale.axis;if(n){t=t||i._parsed;for(const s of t){const o=s._stacks;if(!o||o[n]===void 0||o[n][e]===void 0)return;delete o[n][e],o[n]._visualValues!==void 0&&o[n]._visualValues[e]!==void 0&&delete o[n]._visualValues[e]}}}const yo=i=>i==="reset"||i==="none",za=(i,t)=>t?i:Object.assign({},i),jg=(i,t,e)=>i&&!t.hidden&&t._stacked&&{keys:zh(e,!0),values:null};var Ni;let Ie=(Ni=class{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Ia(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&Ai(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,n=this.getDataset(),s=(u,d,f,g)=>u==="x"?d:u==="r"?g:f,o=e.xAxisID=E(n.xAxisID,xo(t,"x")),r=e.yAxisID=E(n.yAxisID,xo(t,"y")),a=e.rAxisID=E(n.rAxisID,xo(t,"r")),l=e.indexAxis,c=e.iAxisID=s(l,o,r,a),h=e.vAxisID=s(l,r,o,a);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(r),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&xa(this._data,this),t._stacked&&Ai(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),n=this._data;if($(e))this._data=$g(e);else if(n!==e){if(n){xa(n,this);const s=this._cachedMeta;Ai(s),s._parsed=[]}e&&Object.isExtensible(e)&&Af(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,n=this.getDataset();let s=!1;this._dataCheck();const o=e._stacked;e._stacked=Ia(e.vScale,e),e.stack!==n.stack&&(s=!0,Ai(e),e.stack=n.stack),this._resyncElements(t),(s||o!==e._stacked)&&$a(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),n=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:n,_data:s}=this,{iScale:o,_stacked:r}=n,a=o.axis;let l=t===0&&e===s.length?!0:n._sorted,c=t>0&&n._parsed[t-1],h,u,d;if(this._parsing===!1)n._parsed=s,n._sorted=!0,d=s;else{Z(s[t])?d=this.parseArrayData(n,s,t,e):$(s[t])?d=this.parseObjectData(n,s,t,e):d=this.parsePrimitiveData(n,s,t,e);const f=()=>u[a]===null||c&&u[a]p||u=0;--d)if(!g()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,n=[];let s,o,r;for(s=0,o=e.length;s=0&&tthis.getContext(n,s,e),p=c.resolveNamedOptions(d,f,g,u);return p.$shared&&(p.$shared=l,o[r]=Object.freeze(za(p,l))),p}_resolveAnimations(t,e,n){const s=this.chart,o=this._cachedDataOpts,r=`animation-${e}`,a=o[r];if(a)return a;let l;if(s.options.animation!==!1){const h=this.chart.config,u=h.datasetAnimationScopeKeys(this._type,e),d=h.getOptionScopes(this.getDataset(),u);l=h.createResolver(d,this.getContext(t,n,e))}const c=new $h(s,l&&l.animations);return l&&l._cacheable&&(o[r]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||yo(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const n=this.resolveDataElementOptions(t,e),s=this._sharedOptions,o=this.getSharedOptions(n),r=this.includeOptions(e,o)||o!==s;return this.updateSharedOptions(o,e,n),{sharedOptions:o,includeOptions:r}}updateElement(t,e,n,s){yo(s)?Object.assign(t,n):this._resolveAnimations(e,s).update(t,n)}updateSharedOptions(t,e,n){t&&!yo(e)&&this._resolveAnimations(void 0,e).update(t,n)}_setStyle(t,e,n,s){t.active=s;const o=this.getStyle(e,s);this._resolveAnimations(e,n,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,n){this._setStyle(t,n,"active",!1)}setHoverStyle(t,e,n){this._setStyle(t,n,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,n=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const s=n.length,o=e.length,r=Math.min(o,s);r&&this.parse(0,r),o>s?this._insertElements(s,o-s,t):o{for(c.length+=e,a=c.length-1;a>=r;a--)c[a]=c[a-e]};for(l(o),a=t;as-o))}return i._cache.$bar}function Yg(i){const t=i.iScale,e=Hg(t,i.type);let n=t._length,s,o,r,a;const l=()=>{r===32767||r===-32768||(xn(a)&&(n=Math.min(n,Math.abs(r-a)||n)),a=r)};for(s=0,o=e.length;s0?s[i-1]:null,a=iMath.abs(a)&&(l=a,c=r),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:s,end:o,min:r,max:a}}function Bh(i,t,e,n){return Z(i)?qg(i,t,e,n):t[e.axis]=e.parse(i,n),t}function Ba(i,t,e,n){const s=i.iScale,o=i.vScale,r=s.getLabels(),a=s===o,l=[];let c,h,u,d;for(c=e,h=e+n;c=e?1:-1)}function Gg(i){let t,e,n,s,o;return i.horizontal?(t=i.base>i.x,e="left",n="right"):(t=i.basel.controller.options.grouped),o=n.options.stacked,r=[],a=l=>{const c=l.controller.getParsed(e),h=c&&c[l.vScale.axis];if(W(h)||isNaN(h))return!0};for(const l of s)if(!(e!==void 0&&a(l))&&((o===!1||r.indexOf(l.stack)===-1||o===void 0&&l.stack===void 0)&&r.push(l.stack),l.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,n){const s=this._getStacks(t,n),o=e!==void 0?s.indexOf(e):-1;return o===-1?s.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,n=e.iScale,s=[];let o,r;for(o=0,r=e.data.length;o=0;--n)e=Math.max(e,t[n].size(this.resolveDataElementOptions(n))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,n=this.chart.data.labels||[],{xScale:s,yScale:o}=e,r=this.getParsed(t),a=s.getLabelForValue(r.x),l=o.getLabelForValue(r.y),c=r._custom;return{label:n[t]||"",value:"("+a+", "+l+(c?", "+c:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,n,s){const o=s==="reset",{iScale:r,vScale:a}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(e,s),h=r.axis,u=a.axis;for(let d=e;dyn(v,a,l,!0)?1:Math.max(b,b*e,y,y*e),g=(v,b,y)=>yn(v,a,l,!0)?-1:Math.min(b,b*e,y,y*e),p=f(0,c,u),m=f(ut,h,d),_=g(Q,c,u),x=g(Q+ut,h,d);n=(p-_)/2,s=(m-x)/2,o=-(p+_)/2,r=-(m+x)/2}return{ratioX:n,ratioY:s,offsetX:o,offsetY:r}}var di;let Er=(di=class extends Ie{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const n=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=n;else{let o=l=>+n[l];if($(n[t])){const{key:l="value"}=this._parsing;o=c=>+Oe(n[c],l)}let r,a;for(r=t,a=t+e;r0&&!isNaN(t)?J*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,n=this.chart,s=n.data.labels||[],o=Ln(e._parsed[t],n.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let e=0;const n=this.chart;let s,o,r,a,l;if(!t){for(s=0,o=n.data.datasets.length;st!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),C(di,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:n,color:s}}=t.legend.options;return e.labels.map((o,r)=>{const l=t.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:n,hidden:!t.getDataVisibility(r),index:r}})}return[]}},onClick(t,e,n){n.chart.toggleDataVisibility(e.index),n.chart.update()}}}}),di);var ji;let np=(ji=class extends Ie{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:n,data:s=[],_dataset:o}=e,r=this.chart._animationsDisabled;let{start:a,count:l}=yh(e,s,r);this._drawStart=a,this._drawCount=l,vh(e)&&(a=0,l=s.length),n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!o._decimated,n.points=s;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(n,void 0,{animated:!r,options:c},t),this.updateElements(s,a,l,t)}updateElements(t,e,n,s){const o=s==="reset",{iScale:r,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:h,includeOptions:u}=this._getSharedOptions(e,s),d=r.axis,f=a.axis,{spanGaps:g,segment:p}=this.options,m=yi(g)?g:Number.POSITIVE_INFINITY,_=this.chart._animationsDisabled||o||s==="none",x=e+n,v=t.length;let b=e>0&&this.getParsed(e-1);for(let y=0;y=x){w.skip=!0;continue}const M=this.getParsed(y),S=W(M[f]),P=w[d]=r.getPixelForValue(M[d],y),D=w[f]=o||S?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,M,l):M[f],y);w.skip=isNaN(P)||isNaN(D)||S,w.stop=y>0&&Math.abs(M[d]-b[d])>m,p&&(w.parsed=M,w.raw=c.data[y]),u&&(w.options=h||this.resolveDataElementOptions(y,k.active?"active":s)),_||this.updateElement(k,y,w,s),b=M}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,n=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return n;const o=s[0].size(this.resolveDataElementOptions(0)),r=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(n,o,r)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},C(ji,"id","line"),C(ji,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),C(ji,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}}),ji);var Hi;let Nh=(Hi=class extends Ie{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,n=this.chart,s=n.data.labels||[],o=Ln(e._parsed[t].r,n.options.locale);return{label:s[t]||"",value:o}}parseObjectData(t,e,n,s){return Dh.bind(this)(t,e,n,s)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((n,s)=>{const o=this.getParsed(s).r;!isNaN(o)&&this.chart.getDataVisibility(s)&&(oe.max&&(e.max=o))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,n=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(s/2,0),r=Math.max(n.cutoutPercentage?o/100*n.cutoutPercentage:1,0),a=(o-r)/t.getVisibleDatasetCount();this.outerRadius=o-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(t,e,n,s){const o=s==="reset",r=this.chart,l=r.options.animation,c=this._cachedMeta.rScale,h=c.xCenter,u=c.yCenter,d=c.getIndexAngle(0)-.5*Q;let f=d,g;const p=360/this.countVisibleElements();for(g=0;g{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,n){return this.chart.getDataVisibility(t)?Nt(this.resolveDataElementOptions(t,e).angle||n):0}},C(Hi,"id","polarArea"),C(Hi,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),C(Hi,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:n,color:s}}=t.legend.options;return e.labels.map((o,r)=>{const l=t.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:n,hidden:!t.getDataVisibility(r),index:r}})}return[]}},onClick(t,e,n){n.chart.toggleDataVisibility(e.index),n.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}}),Hi);var fs;let sp=(fs=class extends Er{},C(fs,"id","pie"),C(fs,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"}),fs);var Yi;let op=(Yi=class extends Ie{getLabelAndValue(t){const e=this._cachedMeta.vScale,n=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(n[e.axis])}}parseObjectData(t,e,n,s){return Dh.bind(this)(t,e,n,s)}update(t){const e=this._cachedMeta,n=e.dataset,s=e.data||[],o=e.iScale.getLabels();if(n.points=s,t!=="resize"){const r=this.resolveDatasetElementOptions(t);this.options.showLine||(r.borderWidth=0);const a={_loop:!0,_fullLoop:o.length===s.length,options:r};this.updateElement(n,void 0,a,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,n,s){const o=this._cachedMeta.rScale,r=s==="reset";for(let a=e;a0&&this.getParsed(e-1);for(let b=e;b0&&Math.abs(k[f]-v[f])>_,m&&(w.parsed=k,w.raw=c.data[b]),d&&(w.options=u||this.resolveDataElementOptions(b,y.active?"active":s)),x||this.updateElement(y,b,w,s),v=k}this.updateSharedOptions(u,s,h)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let a=0;for(let l=e.length-1;l>=0;--l)a=Math.max(a,e[l].size(this.resolveDataElementOptions(l))/2);return a>0&&a}const n=t.dataset,s=n.options&&n.options.borderWidth||0;if(!e.length)return s;const o=e[0].size(this.resolveDataElementOptions(0)),r=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,o,r)/2}},C(Xi,"id","scatter"),C(Xi,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),C(Xi,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}}),Xi);var ap=Object.freeze({__proto__:null,BarController:tp,BubbleController:ep,DoughnutController:Er,LineController:np,PieController:sp,PolarAreaController:Nh,RadarController:op,ScatterController:rp});function Ne(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Ir{constructor(t){C(this,"options");this.options=t||{}}static override(t){Object.assign(Ir.prototype,t)}init(){}formats(){return Ne()}parse(){return Ne()}format(){return Ne()}add(){return Ne()}diff(){return Ne()}startOf(){return Ne()}endOf(){return Ne()}}var lp={_date:Ir};function cp(i,t,e,n){const{controller:s,data:o,_sorted:r}=i,a=s._cachedMeta.iScale;if(a&&t===a.axis&&t!=="r"&&r&&o.length){const l=a._reversePixels?Pf:ue;if(n){if(s._sharedOptions){const c=o[0],h=typeof c.getRange=="function"&&c.getRange(t);if(h){const u=l(o,t,e-h),d=l(o,t,e+h);return{lo:u.lo,hi:d.hi}}}}else return l(o,t,e)}return{lo:0,hi:o.length-1}}function Rn(i,t,e,n,s){const o=i.getSortedVisibleDatasetMetas(),r=e[t];for(let a=0,l=o.length;a{l[r](t[e],s)&&(o.push({element:l,datasetIndex:c,index:h}),a=a||l.inRange(t.x,t.y,s))}),n&&!a?[]:o}var fp={evaluateInteractionItems:Rn,modes:{index(i,t,e,n){const s=He(t,i),o=e.axis||"x",r=e.includeInvisible||!1,a=e.intersect?wo(i,s,o,n,r):ko(i,s,o,!1,n,r),l=[];return a.length?(i.getSortedVisibleDatasetMetas().forEach(c=>{const h=a[0].index,u=c.data[h];u&&!u.skip&&l.push({element:u,datasetIndex:c.index,index:h})}),l):[]},dataset(i,t,e,n){const s=He(t,i),o=e.axis||"xy",r=e.includeInvisible||!1;let a=e.intersect?wo(i,s,o,n,r):ko(i,s,o,!1,n,r);if(a.length>0){const l=a[0].datasetIndex,c=i.getDatasetMeta(l).data;a=[];for(let h=0;he.pos===t)}function ja(i,t){return i.filter(e=>Vh.indexOf(e.pos)===-1&&e.box.axis===t)}function Oi(i,t){return i.sort((e,n)=>{const s=t?n:e,o=t?e:n;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function gp(i){const t=[];let e,n,s,o,r,a;for(e=0,n=(i||[]).length;ec.box.fullSize),!0),n=Oi(Di(t,"left"),!0),s=Oi(Di(t,"right")),o=Oi(Di(t,"top"),!0),r=Oi(Di(t,"bottom")),a=ja(t,"x"),l=ja(t,"y");return{fullSize:e,leftAndTop:n.concat(o),rightAndBottom:s.concat(l).concat(r).concat(a),chartArea:Di(t,"chartArea"),vertical:n.concat(s).concat(l),horizontal:o.concat(r).concat(a)}}function Ha(i,t,e,n){return Math.max(i[e],t[e])+Math.max(i[n],t[n])}function Wh(i,t){i.top=Math.max(i.top,t.top),i.left=Math.max(i.left,t.left),i.bottom=Math.max(i.bottom,t.bottom),i.right=Math.max(i.right,t.right)}function _p(i,t,e,n){const{pos:s,box:o}=e,r=i.maxPadding;if(!$(s)){e.size&&(i[s]-=e.size);const u=n[e.stack]||{size:0,count:1};u.size=Math.max(u.size,e.horizontal?o.height:o.width),e.size=u.size/u.count,i[s]+=e.size}o.getPadding&&Wh(r,o.getPadding());const a=Math.max(0,t.outerWidth-Ha(r,i,"left","right")),l=Math.max(0,t.outerHeight-Ha(r,i,"top","bottom")),c=a!==i.w,h=l!==i.h;return i.w=a,i.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function xp(i){const t=i.maxPadding;function e(n){const s=Math.max(t[n]-i[n],0);return i[n]+=s,s}i.y+=e("top"),i.x+=e("left"),e("right"),e("bottom")}function yp(i,t){const e=t.maxPadding;function n(s){const o={left:0,top:0,right:0,bottom:0};return s.forEach(r=>{o[r]=Math.max(t[r],e[r])}),o}return n(i?["left","right"]:["top","bottom"])}function en(i,t,e,n){const s=[];let o,r,a,l,c,h;for(o=0,r=i.length,c=0;o{typeof p.beforeLayout=="function"&&p.beforeLayout()});const h=l.reduce((p,m)=>m.box.options&&m.box.options.display===!1?p:p+1,0)||1,u=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/h,hBoxMaxHeight:r/2}),d=Object.assign({},s);Wh(d,yt(n));const f=Object.assign({maxPadding:d,w:o,h:r,x:s.left,y:s.top},s),g=mp(l.concat(c),u);en(a.fullSize,f,u,g),en(l,f,u,g),en(c,f,u,g)&&en(l,f,u,g),xp(f),Ya(a.leftAndTop,f,u,g),f.x+=f.w,f.y+=f.h,Ya(a.rightAndBottom,f,u,g),i.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},X(a.chartArea,p=>{const m=p.box;Object.assign(m,i.chartArea),m.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};let jh=class{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,n){}removeEventListener(t,e,n){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,n,s){return e=Math.max(0,e||t.width),n=n||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):n)}}isAttached(t){return!0}updateConfig(t){}},vp=class extends jh{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}};const vs="$chartjs",wp={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Xa=i=>i===null||i==="";function kp(i,t){const e=i.style,n=i.getAttribute("height"),s=i.getAttribute("width");if(i[vs]={initial:{height:n,width:s,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",Xa(s)){const o=Aa(i,"width");o!==void 0&&(i.width=o)}if(Xa(n))if(i.style.height==="")i.height=i.width/(t||2);else{const o=Aa(i,"height");o!==void 0&&(i.height=o)}return i}const Hh=xg?{passive:!0}:!1;function Mp(i,t,e){i.addEventListener(t,e,Hh)}function Sp(i,t,e){i.canvas.removeEventListener(t,e,Hh)}function Pp(i,t){const e=wp[i.type]||i.type,{x:n,y:s}=He(i,t);return{type:e,chart:t,native:i,x:n!==void 0?n:null,y:s!==void 0?s:null}}function Ls(i,t){for(const e of i)if(e===t||e.contains(t))return!0}function Cp(i,t,e){const n=i.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||Ls(a.addedNodes,n),r=r&&!Ls(a.removedNodes,n);r&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function Ap(i,t,e){const n=i.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||Ls(a.removedNodes,n),r=r&&!Ls(a.addedNodes,n);r&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}const wn=new Map;let Ua=0;function Yh(){const i=window.devicePixelRatio;i!==Ua&&(Ua=i,wn.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function Dp(i,t){wn.size||window.addEventListener("resize",Yh),wn.set(i,t)}function Op(i){wn.delete(i),wn.size||window.removeEventListener("resize",Yh)}function Tp(i,t,e){const n=i.canvas,s=n&&Rr(n);if(!s)return;const o=xh((a,l)=>{const c=s.clientWidth;e(a,l),c{const l=a[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||o(c,h)});return r.observe(s),Dp(i,o),r}function Mo(i,t,e){e&&e.disconnect(),t==="resize"&&Op(i)}function Lp(i,t,e){const n=i.canvas,s=xh(o=>{i.ctx!==null&&e(Pp(o,i))},i);return Mp(n,t,s),s}let Rp=class extends jh{acquireContext(t,e){const n=t&&t.getContext&&t.getContext("2d");return n&&n.canvas===t?(kp(t,e),n):null}releaseContext(t){const e=t.canvas;if(!e[vs])return!1;const n=e[vs].initial;["height","width"].forEach(o=>{const r=n[o];W(r)?e.removeAttribute(o):e.setAttribute(o,r)});const s=n.style||{};return Object.keys(s).forEach(o=>{e.style[o]=s[o]}),e.width=e.width,delete e[vs],!0}addEventListener(t,e,n){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),r={attach:Cp,detach:Ap,resize:Tp}[e]||Lp;s[e]=r(t,e,n)}removeEventListener(t,e){const n=t.$proxies||(t.$proxies={}),s=n[e];if(!s)return;({attach:Mo,detach:Mo,resize:Mo}[e]||Sp)(t,e,s),n[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,n,s){return _g(t,e,n,s)}isAttached(t){const e=Rr(t);return!!(e&&e.isConnected)}};function Ep(i){return!Th()||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?vp:Rp}var gs;let pe=(gs=class{constructor(){C(this,"x");C(this,"y");C(this,"active",!1);C(this,"options");C(this,"$animations")}tooltipPosition(t){const{x:e,y:n}=this.getProps(["x","y"],t);return{x:e,y:n}}hasValue(){return yi(this.x)&&yi(this.y)}getProps(t,e){const n=this.$animations;if(!e||!n)return this;const s={};return t.forEach(o=>{s[o]=n[o]&&n[o].active()?n[o]._to:this[o]}),s}},C(gs,"defaults",{}),C(gs,"defaultRoutes"),gs);function Ip(i,t){const e=i.options.ticks,n=Fp(i),s=Math.min(e.maxTicksLimit||n,n),o=e.major.enabled?zp(t):[],r=o.length,a=o[0],l=o[r-1],c=[];if(r>s)return Bp(t,c,o,r/s),c;const h=$p(o,t,s);if(r>0){let u,d;const f=r>1?Math.round((l-a)/(r-1)):null;for(Xn(t,c,h,W(f)?0:a-f,a),u=0,d=r-1;us)return l}return Math.max(s,1)}function zp(i){const t=[];let e,n;for(e=0,n=i.length;ei==="left"?"right":i==="right"?"left":i,qa=(i,t,e)=>t==="top"||t==="left"?i[t]+e:i[t]-e,Ka=(i,t)=>Math.min(t||i,i);function Ga(i,t){const e=[],n=i.length/t,s=i.length;let o=0;for(;or+a)))return l}function jp(i,t){X(i,e=>{const n=e.gc,s=n.length/2;let o;if(s>t){for(o=0;on?n:e,n=s&&e>n?e:n,{min:Ct(e,Ct(n,e)),max:Ct(n,Ct(e,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){G(this.options.beforeUpdate,[this])}update(t,e,n){const{beginAtZero:s,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=n=Object.assign({left:0,right:0,top:0,bottom:0},n),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+n.left+n.right:this.height+n.top+n.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=Gf(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a=o||n<=1||!this.isHorizontal()){this.labelRotation=s;return}const h=this._getLabelSizes(),u=h.widest.width,d=h.highest.height,f=gt(this.chart.width-u,0,this.maxWidth);a=t.offset?this.maxWidth/n:f/(n-1),u+6>a&&(a=f/(n-(t.offset?.5:1)),l=this.maxHeight-Ti(t.grid)-e.padding-Za(t.title,this.chart.options.font),c=Math.sqrt(u*u+d*d),r=Sr(Math.min(Math.asin(gt((h.highest.height+6)/a,-1,1)),Math.asin(gt(l/c,-1,1))-Math.asin(gt(d/c,-1,1)))),r=Math.max(s,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){G(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){G(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:n,title:s,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){const l=Za(s,e.options.font);if(a?(t.width=this.maxWidth,t.height=Ti(o)+l):(t.height=this.maxHeight,t.width=Ti(o)+l),n.display&&this.ticks.length){const{first:c,last:h,widest:u,highest:d}=this._getLabelSizes(),f=n.padding*2,g=Nt(this.labelRotation),p=Math.cos(g),m=Math.sin(g);if(a){const _=n.mirror?0:m*u.width+p*d.height;t.height=Math.min(this.maxHeight,t.height+_+f)}else{const _=n.mirror?0:p*u.width+m*d.height;t.width=Math.min(this.maxWidth,t.width+_+f)}this._calculatePadding(c,h,m,p)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,n,s){const{ticks:{align:o,padding:r},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,u=this.right-this.getPixelForTick(this.ticks.length-1);let d=0,f=0;l?c?(d=s*t.width,f=n*e.height):(d=n*t.height,f=s*e.width):o==="start"?f=e.width:o==="end"?d=t.width:o!=="inner"&&(d=t.width/2,f=e.width/2),this.paddingLeft=Math.max((d-h+r)*this.width/(this.width-h),0),this.paddingRight=Math.max((f-u+r)*this.width/(this.width-u),0)}else{let h=e.height/2,u=t.height/2;o==="start"?(h=0,u=t.height):o==="end"&&(h=e.height,u=0),this.paddingTop=h+r,this.paddingBottom=u+r}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){G(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,n;for(e=0,n=t.length;e({width:r[S]||0,height:a[S]||0});return{first:M(0),last:M(e-1),widest:M(k),highest:M(w),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return Sf(this._alignToPixels?Be(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&ta*s?a/n:l/s:l*s0}_computeGridLineItems(t){const e=this.axis,n=this.chart,s=this.options,{grid:o,position:r,border:a}=s,l=o.offset,c=this.isHorizontal(),u=this.ticks.length+(l?1:0),d=Ti(o),f=[],g=a.setContext(this.getContext()),p=g.display?g.width:0,m=p/2,_=function(L){return Be(n,L,p)};let x,v,b,y,k,w,M,S,P,D,O,H;if(r==="top")x=_(this.bottom),w=this.bottom-d,S=x-m,D=_(t.top)+m,H=t.bottom;else if(r==="bottom")x=_(this.top),D=t.top,H=_(t.bottom)-m,w=x+m,S=this.top+d;else if(r==="left")x=_(this.right),k=this.right-d,M=x-m,P=_(t.left)+m,O=t.right;else if(r==="right")x=_(this.left),P=t.left,O=_(t.right)-m,k=x+m,M=this.left+d;else if(e==="x"){if(r==="center")x=_((t.top+t.bottom)/2+.5);else if($(r)){const L=Object.keys(r)[0],R=r[L];x=_(this.chart.scales[L].getPixelForValue(R))}D=t.top,H=t.bottom,w=x+m,S=w+d}else if(e==="y"){if(r==="center")x=_((t.left+t.right)/2);else if($(r)){const L=Object.keys(r)[0],R=r[L];x=_(this.chart.scales[L].getPixelForValue(R))}k=x-m,M=k-d,P=t.left,O=t.right}const F=E(s.ticks.maxTicksLimit,u),A=Math.max(1,Math.ceil(u/F));for(v=0;vo.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const e=this.options.grid,n=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,r;const a=(l,c,h)=>{!h.width||!h.color||(n.save(),n.lineWidth=h.width,n.strokeStyle=h.color,n.setLineDash(h.borderDash||[]),n.lineDashOffset=h.borderDashOffset,n.beginPath(),n.moveTo(l.x,l.y),n.lineTo(c.x,c.y),n.stroke(),n.restore())};if(e.display)for(o=0,r=s.length;o{this.draw(o)}}]:[{z:n,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+"AxisID",s=[];let o,r;for(o=0,r=e.length;o{const n=e.split("."),s=n.pop(),o=[i].concat(n).join("."),r=t[e].split("."),a=r.pop(),l=r.join(".");at.route(o,s,l,a)})}function Gp(i){return"id"in i&&"defaults"in i}let Zp=class{constructor(){this.controllers=new Un(Ie,"datasets",!0),this.elements=new Un(pe,"elements"),this.plugins=new Un(Object,"plugins"),this.scales=new Un(En,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,n){[...e].forEach(s=>{const o=n||this._getRegistryForType(s);n||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):X(s,r=>{const a=n||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,e,n){const s=Mr(t);G(n["before"+s],[],n),e[t](n),G(n["after"+s],[],n)}_getRegistryForType(t){for(let e=0;eo.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(s(e,n),t,"stop"),this._notify(s(n,e),t,"start")}};function Qp(i){const t={},e=[],n=Object.keys(Yt.plugins.items);for(let o=0;o1&&Ja(i[0].toLowerCase());if(n)return n}throw new Error(`Cannot determine type of '${i}' axis. Please provide 'axis' or 'position' option.`)}function Qa(i,t,e){if(e[t+"AxisID"]===i)return{axis:t}}function rm(i,t){if(t.data&&t.data.datasets){const e=t.data.datasets.filter(n=>n.xAxisID===i||n.yAxisID===i);if(e.length)return Qa(i,"x",e[0])||Qa(i,"y",e[0])}return{}}function am(i,t){const e=ii[i.type]||{scales:{}},n=t.scales||{},s=Go(i.type,t),o=Object.create(null);return Object.keys(n).forEach(r=>{const a=n[r];if(!$(a))return console.error(`Invalid scale configuration for scale: ${r}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);const l=Zo(r,a,rm(r,i),at.scales[a.type]),c=sm(l,s),h=e.scales||{};o[r]=hn(Object.create(null),[{axis:l},a,h[l],h[c]])}),i.data.datasets.forEach(r=>{const a=r.type||i.type,l=r.indexAxis||Go(a,t),h=(ii[a]||{}).scales||{};Object.keys(h).forEach(u=>{const d=nm(u,l),f=r[d+"AxisID"]||d;o[f]=o[f]||Object.create(null),hn(o[f],[{axis:d},n[f],h[u]])})}),Object.keys(o).forEach(r=>{const a=o[r];hn(a,[at.scales[a.type],at.scale])}),o}function Uh(i){const t=i.options||(i.options={});t.plugins=E(t.plugins,{}),t.scales=am(i,t)}function qh(i){return i=i||{},i.datasets=i.datasets||[],i.labels=i.labels||[],i}function lm(i){return i=i||{},i.data=qh(i.data),Uh(i),i}const tl=new Map,Kh=new Set;function qn(i,t){let e=tl.get(i);return e||(e=t(),tl.set(i,e),Kh.add(e)),e}const Li=(i,t,e)=>{const n=Oe(t,e);n!==void 0&&i.add(n)};let cm=class{constructor(t){this._config=lm(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=qh(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),Uh(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return qn(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return qn(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return qn(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,n=this.type;return qn(`${n}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const n=this._scopeCache;let s=n.get(t);return(!s||e)&&(s=new Map,n.set(t,s)),s}getOptionScopes(t,e,n){const{options:s,type:o}=this,r=this._cachedScopes(t,n),a=r.get(e);if(a)return a;const l=new Set;e.forEach(h=>{t&&(l.add(t),h.forEach(u=>Li(l,t,u))),h.forEach(u=>Li(l,s,u)),h.forEach(u=>Li(l,ii[o]||{},u)),h.forEach(u=>Li(l,at,u)),h.forEach(u=>Li(l,qo,u))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Kh.has(e)&&r.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,ii[e]||{},at.datasets[e]||{},{type:e},at,qo]}resolveNamedOptions(t,e,n,s=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=el(this._resolverCache,t,s);let l=r;if(um(r,e)){o.$shared=!1,n=Te(n)?n():n;const c=this.createResolver(t,n,a);l=vi(r,n,c)}for(const c of e)o[c]=l[c];return o}createResolver(t,e,n=[""],s){const{resolver:o}=el(this._resolverCache,t,n);return $(e)?vi(o,e,void 0,s):o}};function el(i,t,e){let n=i.get(t);n||(n=new Map,i.set(t,n));const s=e.join();let o=n.get(s);return o||(o={resolver:Or(t,e),subPrefixes:e.filter(a=>!a.toLowerCase().includes("hover"))},n.set(s,o)),o}const hm=i=>$(i)&&Object.getOwnPropertyNames(i).reduce((t,e)=>t||Te(i[e]),!1);function um(i,t){const{isScriptable:e,isIndexable:n}=Sh(i);for(const s of t){const o=e(s),r=n(s),a=(r||o)&&i[s];if(o&&(Te(a)||hm(a))||r&&Z(a))return!0}return!1}var dm="4.4.0";const fm=["top","bottom","left","right","chartArea"];function il(i,t){return i==="top"||i==="bottom"||fm.indexOf(i)===-1&&t==="x"}function nl(i,t){return function(e,n){return e[i]===n[i]?e[t]-n[t]:e[i]-n[i]}}function sl(i){const t=i.chart,e=t.options.animation;t.notifyPlugins("afterRender"),G(e&&e.onComplete,[i],t)}function gm(i){const t=i.chart,e=t.options.animation;G(e&&e.onProgress,[i],t)}function Gh(i){return Th()&&typeof i=="string"?i=document.getElementById(i):i&&i.length&&(i=i[0]),i&&i.canvas&&(i=i.canvas),i}const ws={},ol=i=>{const t=Gh(i);return Object.values(ws).filter(e=>e.canvas===t).pop()};function pm(i,t,e){const n=Object.keys(i);for(const s of n){const o=+s;if(o>=t){const r=i[s];delete i[s],(e>0||o>t)&&(i[o+e]=r)}}}function mm(i,t,e,n){return!e||i.type==="mouseout"?null:n?t:i}function Kn(i,t,e){return i.options.clip?i[e]:t[e]}function bm(i,t){const{xScale:e,yScale:n}=i;return e&&n?{left:Kn(e,t,"left"),right:Kn(e,t,"right"),top:Kn(n,t,"top"),bottom:Kn(n,t,"bottom")}:t}var _e;let nn=(_e=class{static register(...t){Yt.add(...t),rl()}static unregister(...t){Yt.remove(...t),rl()}constructor(t,e){const n=this.config=new cm(e),s=Gh(t),o=ol(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const r=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||Ep(s)),this.platform.updateConfig(n);const a=this.platform.acquireContext(s,r.aspectRatio),l=a&&a.canvas,c=l&&l.height,h=l&&l.width;if(this.id=ff(),this.ctx=a,this.canvas=l,this.width=h,this.height=c,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Jp,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Df(u=>this.update(u),r.resizeDelay||0),this._dataChanges=[],ws[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}ie.listen(this,"complete",sl),ie.listen(this,"progress",gm),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:n,height:s,_aspectRatio:o}=this;return W(t)?e&&o?o:s?n/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return Yt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Ca(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Ma(this.canvas,this.ctx),this}stop(){return ie.stop(this),this}resize(t,e){ie.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const n=this.options,s=this.canvas,o=n.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(s,t,e,o),a=n.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,Ca(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),G(n.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};X(e,(n,s)=>{n.id=s})}buildOrUpdateScales(){const t=this.options,e=t.scales,n=this.scales,s=Object.keys(n).reduce((r,a)=>(r[a]=!1,r),{});let o=[];e&&(o=o.concat(Object.keys(e).map(r=>{const a=e[r],l=Zo(r,a),c=l==="r",h=l==="x";return{options:a,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),X(o,r=>{const a=r.options,l=a.id,c=Zo(l,a),h=E(a.type,r.dtype);(a.position===void 0||il(a.position,c)!==il(r.dposition))&&(a.position=r.dposition),s[l]=!0;let u=null;if(l in n&&n[l].type===h)u=n[l];else{const d=Yt.getScale(h);u=new d({id:l,type:h,ctx:this.ctx,chart:this}),n[u.id]=u}u.init(a,t)}),X(s,(r,a)=>{r||delete n[a]}),X(n,r=>{_t.configure(this,r,r.options),_t.addBox(this,r)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,n=t.length;if(t.sort((s,o)=>s.index-o.index),n>e){for(let s=e;se.length&&delete this._stacks,t.forEach((n,s)=>{e.filter(o=>o===n._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let n,s;for(this._removeUnreferencedMetasets(),n=0,s=e.length;n{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const n=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let c=0,h=this.data.datasets.length;c{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(nl("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){X(this.scales,t=>{_t.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),n=new Set(t.events);(!pa(e,n)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:n,start:s,count:o}of e){const r=n==="_removeElements"?-o:o;pm(t,s,r)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,n=o=>new Set(t.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),s=n(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;_t.update(this,this.width,this.height,t);const e=this.chartArea,n=e.width<=0||e.height<=0;this._layers=[],X(this.boxes,s=>{n&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,n=this.data.datasets.length;e=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,n=t._clip,s=!n.disabled,o=bm(t,this.chartArea),r={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(s&&Js(e,{left:n.left===!1?0:o.left-n.left,right:n.right===!1?this.width:o.right+n.right,top:n.top===!1?0:o.top-n.top,bottom:n.bottom===!1?this.height:o.bottom+n.bottom}),t.controller.draw(),s&&Qs(e),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return de(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,n,s){const o=fp.modes[e];return typeof o=="function"?o(this,t,n,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],n=this._metasets;let s=n.filter(o=>o&&o._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},n.push(s)),s}getContext(){return this.$context||(this.$context=Ee(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const n=this.getDatasetMeta(t);return typeof n.hidden=="boolean"?!n.hidden:!e.hidden}setDatasetVisibility(t,e){const n=this.getDatasetMeta(t);n.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,n){const s=n?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,s);xn(e)?(o.data[e].hidden=!n,this.update()):(this.setDatasetVisibility(t,n),r.update(o,{visible:n}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),ie.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,o,r),t[o]=r},s=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};X(this.options.events,o=>n(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,n=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let r;const a=()=>{s("attach",a),this.attached=!0,this.resize(),n("resize",o),n("detach",r)};r=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),n("attach",a)},e.isAttached(this.canvas)?a():r()}unbindEvents(){X(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},X(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,n){const s=n?"set":"remove";let o,r,a,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=t.length;a{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[r],index:r}});!Cs(n,e)&&(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,e))}notifyPlugins(t,e,n){return this._plugins.notify(this,t,e,n)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,n){const s=this.options.hover,o=(l,c)=>l.filter(h=>!c.some(u=>h.datasetIndex===u.datasetIndex&&h.index===u.index)),r=o(e,t),a=n?t:o(t,e);r.length&&this.updateHoverStyle(r,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,e){const n={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",n,s)===!1)return;const o=this._handleEvent(t,e,n.inChartArea);return n.cancelable=!1,this.notifyPlugins("afterEvent",n,s),(o||n.changed)&&this.render(),this}_handleEvent(t,e,n){const{_active:s=[],options:o}=this,r=e,a=this._getActiveElements(t,s,n,r),l=xf(t),c=mm(t,this._lastEvent,n,l);n&&(this._lastEvent=null,G(o.onHover,[t,a,this],this),l&&G(o.onClick,[t,a,this],this));const h=!Cs(a,s);return(h||e)&&(this._active=a,this._updateHoverStyles(a,s,e)),this._lastEvent=c,h}_getActiveElements(t,e,n,s){if(t.type==="mouseout")return[];if(!n)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}},C(_e,"defaults",at),C(_e,"instances",ws),C(_e,"overrides",ii),C(_e,"registry",Yt),C(_e,"version",dm),C(_e,"getChart",ol),_e);function rl(){return X(nn.instances,i=>i._plugins.invalidate())}function _m(i,t,e){const{startAngle:n,pixelMargin:s,x:o,y:r,outerRadius:a,innerRadius:l}=t;let c=s/a;i.beginPath(),i.arc(o,r,a,n-c,e+c),l>s?(c=s/l,i.arc(o,r,l,e+c,n-c,!0)):i.arc(o,r,s,e+ut,n-ut),i.closePath(),i.clip()}function xm(i){return Dr(i,["outerStart","outerEnd","innerStart","innerEnd"])}function ym(i,t,e,n){const s=xm(i.options.borderRadius),o=(e-t)/2,r=Math.min(o,n*t/2),a=l=>{const c=(e-Math.min(o,l))*n/2;return gt(l,0,Math.min(o,c))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:gt(s.innerStart,0,r),innerEnd:gt(s.innerEnd,0,r)}}function ai(i,t,e,n){return{x:e+i*Math.cos(t),y:n+i*Math.sin(t)}}function Rs(i,t,e,n,s,o){const{x:r,y:a,startAngle:l,pixelMargin:c,innerRadius:h}=t,u=Math.max(t.outerRadius+n+e-c,0),d=h>0?h+n+e+c:0;let f=0;const g=s-l;if(n){const A=h>0?h-n:0,L=u>0?u-n:0,R=(A+L)/2,ht=R!==0?g*R/(R+n):g;f=(g-ht)/2}const p=Math.max(.001,g*u-e/Q)/u,m=(g-p)/2,_=l+m+f,x=s-m-f,{outerStart:v,outerEnd:b,innerStart:y,innerEnd:k}=ym(t,d,u,x-_),w=u-v,M=u-b,S=_+v/w,P=x-b/M,D=d+y,O=d+k,H=_+y/D,F=x-k/O;if(i.beginPath(),o){const A=(S+P)/2;if(i.arc(r,a,u,S,A),i.arc(r,a,u,A,P),b>0){const tt=ai(M,P,r,a);i.arc(tt.x,tt.y,b,P,x+ut)}const L=ai(O,x,r,a);if(i.lineTo(L.x,L.y),k>0){const tt=ai(O,F,r,a);i.arc(tt.x,tt.y,k,x+ut,F+Math.PI)}const R=(x-k/d+(_+y/d))/2;if(i.arc(r,a,d,x-k/d,R,!0),i.arc(r,a,d,R,_+y/d,!0),y>0){const tt=ai(D,H,r,a);i.arc(tt.x,tt.y,y,H+Math.PI,_-ut)}const ht=ai(w,_,r,a);if(i.lineTo(ht.x,ht.y),v>0){const tt=ai(w,S,r,a);i.arc(tt.x,tt.y,v,_-ut,S)}}else{i.moveTo(r,a);const A=Math.cos(S)*u+r,L=Math.sin(S)*u+a;i.lineTo(A,L);const R=Math.cos(P)*u+r,ht=Math.sin(P)*u+a;i.lineTo(R,ht)}i.closePath()}function vm(i,t,e,n,s){const{fullCircles:o,startAngle:r,circumference:a}=t;let l=t.endAngle;if(o){Rs(i,t,e,n,l,s);for(let c=0;c=J||yn(r,l,c),m=he(a,h+f,u+f);return p&&m}getCenterPoint(e){const{x:n,y:s,startAngle:o,endAngle:r,innerRadius:a,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:c,spacing:h}=this.options,u=(o+r)/2,d=(a+l+h+c)/2;return{x:n+Math.cos(u)*d,y:s+Math.sin(u)*d}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){const{options:n,circumference:s}=this,o=(n.offset||0)/4,r=(n.spacing||0)/2,a=n.circular;if(this.pixelMargin=n.borderAlign==="inner"?.33:0,this.fullCircles=s>J?Math.floor(s/J):0,s===0||this.innerRadius<0||this.outerRadius<0)return;e.save();const l=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(l)*o,Math.sin(l)*o);const c=1-Math.sin(Math.min(Q,s||0)),h=o*c;e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,vm(e,this,h,r,a),wm(e,this,h,r,a),e.restore()}},C(fi,"id","arc"),C(fi,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),C(fi,"defaultRoutes",{backgroundColor:"backgroundColor"}),C(fi,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"}),fi);function Zh(i,t,e=t){i.lineCap=E(e.borderCapStyle,t.borderCapStyle),i.setLineDash(E(e.borderDash,t.borderDash)),i.lineDashOffset=E(e.borderDashOffset,t.borderDashOffset),i.lineJoin=E(e.borderJoinStyle,t.borderJoinStyle),i.lineWidth=E(e.borderWidth,t.borderWidth),i.strokeStyle=E(e.borderColor,t.borderColor)}function Mm(i,t,e){i.lineTo(e.x,e.y)}function Sm(i){return i.stepped?Vf:i.tension||i.cubicInterpolationMode==="monotone"?Wf:Mm}function Jh(i,t,e={}){const n=i.length,{start:s=0,end:o=n-1}=e,{start:r,end:a}=t,l=Math.max(s,r),c=Math.min(o,a),h=sa&&o>a;return{count:n,start:l,loop:t.loop,ilen:c(r+(c?a-b:b))%o,v=()=>{p!==m&&(i.lineTo(h,m),i.lineTo(h,p),i.lineTo(h,_))};for(l&&(f=s[x(0)],i.moveTo(f.x,f.y)),d=0;d<=a;++d){if(f=s[x(d)],f.skip)continue;const b=f.x,y=f.y,k=b|0;k===g?(ym&&(m=y),h=(u*h+b)/++u):(v(),i.lineTo(b,y),g=k,u=0,p=m=y),_=y}v()}function Jo(i){const t=i.options,e=t.borderDash&&t.borderDash.length;return!i._decimated&&!i._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?Cm:Pm}function Am(i){return i.stepped?yg:i.tension||i.cubicInterpolationMode==="monotone"?vg:Ye}function Dm(i,t,e,n){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,n)&&s.closePath()),Zh(i,t.options),i.stroke(s)}function Om(i,t,e,n){const{segments:s,options:o}=t,r=Jo(t);for(const a of s)Zh(i,o,a.style),i.beginPath(),r(i,t,a,{start:e,end:e+n-1})&&i.closePath(),i.stroke()}const Tm=typeof Path2D=="function";function Lm(i,t,e,n){Tm&&!t.options.segment?Dm(i,t,e,n):Om(i,t,e,n)}var gi;let eo=(gi=class extends pe{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const n=this.options;if((n.tension||n.cubicInterpolationMode==="monotone")&&!n.stepped&&!this._pointsUpdated){const s=n.spanGaps?this._loop:this._fullLoop;dg(this._points,n,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Cg(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,n=t.length;return n&&e[t[n-1].end]}interpolate(t,e){const n=this.options,s=t[e],o=this.points,r=Fh(this,{property:e,start:s,end:s});if(!r.length)return;const a=[],l=Am(n);let c,h;for(c=0,h=r.length;ct!=="borderDash"&&t!=="fill"}),gi);function al(i,t,e,n){const s=i.options,{[e]:o}=i.getProps([e],n);return Math.abs(t-o)i.replace("rgb(","rgba(").replace(")",", 0.5)"));function tu(i){return Qo[i%Qo.length]}function eu(i){return ll[i%ll.length]}function Vm(i,t){return i.borderColor=tu(t),i.backgroundColor=eu(t),++t}function Wm(i,t){return i.backgroundColor=i.data.map(()=>tu(t++)),t}function jm(i,t){return i.backgroundColor=i.data.map(()=>eu(t++)),t}function Hm(i){let t=0;return(e,n)=>{const s=i.getDatasetMeta(n).controller;s instanceof Er?t=Wm(e,t):s instanceof Nh?t=jm(e,t):s&&(t=Vm(e,t))}}function cl(i){let t;for(t in i)if(i[t].borderColor||i[t].backgroundColor)return!0;return!1}function Ym(i){return i&&(i.borderColor||i.backgroundColor)}var Xm={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(i,t,e){if(!e.enabled)return;const{data:{datasets:n},options:s}=i.config,{elements:o}=s;if(!e.forceOverride&&(cl(n)||Ym(s)||o&&cl(o)))return;const r=Hm(i);n.forEach(r)}};function Um(i,t,e,n,s){const o=s.samples||n;if(o>=e)return i.slice(t,t+e);const r=[],a=(e-2)/(o-2);let l=0;const c=t+e-1;let h=t,u,d,f,g,p;for(r[l++]=i[h],u=0;uf&&(f=g,d=i[x],p=x);r[l++]=d,h=p}return r[l++]=i[c],r}function qm(i,t,e,n){let s=0,o=0,r,a,l,c,h,u,d,f,g,p;const m=[],_=t+e-1,x=i[t].x,b=i[_].x-x;for(r=t;rp&&(p=c,d=r),s=(o*s+a.x)/++o;else{const k=r-1;if(!W(u)&&!W(d)){const w=Math.min(u,d),M=Math.max(u,d);w!==f&&w!==k&&m.push({...i[w],x:s}),M!==f&&M!==k&&m.push({...i[M],x:s})}r>0&&k!==f&&m.push(i[k]),m.push(a),h=y,o=0,g=p=c,u=d=f=r}}return m}function iu(i){if(i._decimated){const t=i._data;delete i._decimated,delete i._data,Object.defineProperty(i,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function hl(i){i.data.datasets.forEach(t=>{iu(t)})}function Km(i,t){const e=t.length;let n=0,s;const{iScale:o}=i,{min:r,max:a,minDefined:l,maxDefined:c}=o.getUserBounds();return l&&(n=gt(ue(t,o.axis,r).lo,0,e-1)),c?s=gt(ue(t,o.axis,a).hi+1,n,e)-n:s=e-n,{start:n,count:s}}var Gm={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(i,t,e)=>{if(!e.enabled){hl(i);return}const n=i.width;i.data.datasets.forEach((s,o)=>{const{_data:r,indexAxis:a}=s,l=i.getDatasetMeta(o),c=r||s.data;if(tn([a,i.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;const h=i.scales[l.xAxisID];if(h.type!=="linear"&&h.type!=="time"||i.options.parsing)return;let{start:u,count:d}=Km(l,c);const f=e.threshold||4*n;if(d<=f){iu(s);return}W(r)&&(s._data=c,delete s.data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(p){this._data=p}}));let g;switch(e.algorithm){case"lttb":g=Um(c,u,d,n,e);break;case"min-max":g=qm(c,u,d,n);break;default:throw new Error(`Unsupported decimation algorithm '${e.algorithm}'`)}s._decimated=g})},destroy(i){hl(i)}};function Zm(i,t,e){const n=i.segments,s=i.points,o=t.points,r=[];for(const a of n){let{start:l,end:c}=a;c=Fr(l,c,s);const h=tr(e,s[l],s[c],a.loop);if(!t.segments){r.push({source:a,target:h,start:s[l],end:s[c]});continue}const u=Fh(t,h);for(const d of u){const f=tr(e,o[d.start],o[d.end],d.loop),g=Ih(a,s,f);for(const p of g)r.push({source:p,target:d,start:{[e]:ul(h,f,"start",Math.max)},end:{[e]:ul(h,f,"end",Math.min)}})}}return r}function tr(i,t,e,n){if(n)return;let s=t[i],o=e[i];return i==="angle"&&(s=At(s),o=At(o)),{property:i,start:s,end:o}}function Jm(i,t){const{x:e=null,y:n=null}=i||{},s=t.points,o=[];return t.segments.forEach(({start:r,end:a})=>{a=Fr(r,a,s);const l=s[r],c=s[a];n!==null?(o.push({x:l.x,y:n}),o.push({x:c.x,y:n})):e!==null&&(o.push({x:e,y:l.y}),o.push({x:e,y:c.y}))}),o}function Fr(i,t,e){for(;t>i;t--){const n=e[t];if(!isNaN(n.x)&&!isNaN(n.y))break}return t}function ul(i,t,e,n){return i&&t?n(i[e],t[e]):i?i[e]:t?t[e]:0}function nu(i,t){let e=[],n=!1;return Z(i)?(n=!0,e=i):e=Jm(i,t),e.length?new eo({points:e,options:{tension:0},_loop:n,_fullLoop:n}):null}function dl(i){return i&&i.fill!==!1}function Qm(i,t,e){let s=i[t].fill;const o=[t];let r;if(!e)return s;for(;s!==!1&&o.indexOf(s)===-1;){if(!rt(s))return s;if(r=i[s],!r)return!1;if(r.visible)return s;o.push(s),s=r.fill}return!1}function tb(i,t,e){const n=sb(i);if($(n))return isNaN(n.value)?!1:n;let s=parseFloat(n);return rt(s)&&Math.floor(s)===s?eb(n[0],t,s,e):["origin","start","end","stack","shape"].indexOf(n)>=0&&n}function eb(i,t,e,n){return(i==="-"||i==="+")&&(e=t+e),e===t||e<0||e>=n?!1:e}function ib(i,t){let e=null;return i==="start"?e=t.bottom:i==="end"?e=t.top:$(i)?e=t.getPixelForValue(i.value):t.getBasePixel&&(e=t.getBasePixel()),e}function nb(i,t,e){let n;return i==="start"?n=e:i==="end"?n=t.options.reverse?t.min:t.max:$(i)?n=i.value:n=t.getBaseValue(),n}function sb(i){const t=i.options,e=t.fill;let n=E(e&&e.target,e);return n===void 0&&(n=!!t.backgroundColor),n===!1||n===null?!1:n===!0?"origin":n}function ob(i){const{scale:t,index:e,line:n}=i,s=[],o=n.segments,r=n.points,a=rb(t,e);a.push(nu({x:null,y:t.bottom},n));for(let l=0;l=0;--r){const a=s[r].$filler;a&&(a.line.updateControlPoints(o,a.axis),n&&a.fill&&Co(i.ctx,a,o))}},beforeDatasetsDraw(i,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;const n=i.getSortedVisibleDatasetMetas();for(let s=n.length-1;s>=0;--s){const o=n[s].$filler;dl(o)&&Co(i.ctx,o,i.chartArea)}},beforeDatasetDraw(i,t,e){const n=t.meta.$filler;!dl(n)||e.drawTime!=="beforeDatasetDraw"||Co(i.ctx,n,i.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const ml=(i,t)=>{let{boxHeight:e=t,boxWidth:n=t}=i;return i.usePointStyle&&(e=Math.min(e,t),n=i.pointStyleWidth||Math.min(n,t)),{boxWidth:n,boxHeight:e,itemHeight:Math.max(t,e)}},bb=(i,t)=>i!==null&&t!==null&&i.datasetIndex===t.datasetIndex&&i.index===t.index;class bl extends pe{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,n){this.maxWidth=t,this.maxHeight=e,this._margins=n,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=G(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(n=>t.filter(n,this.chart.data))),t.sort&&(e=e.sort((n,s)=>t.sort(n,s,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}const n=t.labels,s=dt(n.font),o=s.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=ml(n,o);let c,h;e.font=s.string,this.isHorizontal()?(c=this.maxWidth,h=this._fitRows(r,o,a,l)+10):(h=this.maxHeight,c=this._fitCols(r,s,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,n,s){const{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],h=s+a;let u=t;o.textAlign="left",o.textBaseline="middle";let d=-1,f=-h;return this.legendItems.forEach((g,p)=>{const m=n+e/2+o.measureText(g.text).width;(p===0||c[c.length-1]+m+2*a>r)&&(u+=h,c[c.length-(p>0?0:1)]=0,f+=h,d++),l[p]={left:0,top:f,row:d,width:m,height:s},c[c.length-1]+=m+a}),u}_fitCols(t,e,n,s){const{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],h=r-t;let u=a,d=0,f=0,g=0,p=0;return this.legendItems.forEach((m,_)=>{const{itemWidth:x,itemHeight:v}=_b(n,e,o,m,s);_>0&&f+v+2*a>h&&(u+=d+a,c.push({width:d,height:f}),g+=d+a,p++,d=f=0),l[_]={left:g,top:f,col:p,width:x,height:v},d=Math.max(d,x),f+=v+a}),u+=d,c.push({width:d,height:f}),u}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:n,labels:{padding:s},rtl:o}}=this,r=bi(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=bt(n,this.left+s,this.right-this.lineWidths[a]);for(const c of e)a!==c.row&&(a=c.row,l=bt(n,this.left+s,this.right-this.lineWidths[a])),c.top+=this.top+t+s,c.left=r.leftForLtr(r.x(l),c.width),l+=c.width+s}else{let a=0,l=bt(n,this.top+t+s,this.bottom-this.columnSizes[a].height);for(const c of e)c.col!==a&&(a=c.col,l=bt(n,this.top+t+s,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+s,c.left=r.leftForLtr(r.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;Js(t,this),this._draw(),Qs(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:n,ctx:s}=this,{align:o,labels:r}=t,a=at.color,l=bi(t.rtl,this.left,this.width),c=dt(r.font),{padding:h}=r,u=c.size,d=u/2;let f;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:g,boxHeight:p,itemHeight:m}=ml(r,u),_=function(k,w,M){if(isNaN(g)||g<=0||isNaN(p)||p<0)return;s.save();const S=E(M.lineWidth,1);if(s.fillStyle=E(M.fillStyle,a),s.lineCap=E(M.lineCap,"butt"),s.lineDashOffset=E(M.lineDashOffset,0),s.lineJoin=E(M.lineJoin,"miter"),s.lineWidth=S,s.strokeStyle=E(M.strokeStyle,a),s.setLineDash(E(M.lineDash,[])),r.usePointStyle){const P={radius:p*Math.SQRT2/2,pointStyle:M.pointStyle,rotation:M.rotation,borderWidth:S},D=l.xPlus(k,g/2),O=w+d;kh(s,P,D,O,r.pointStyleWidth&&g)}else{const P=w+Math.max((u-p)/2,0),D=l.leftForLtr(k,g),O=Qe(M.borderRadius);s.beginPath(),Object.values(O).some(H=>H!==0)?vn(s,{x:D,y:P,w:g,h:p,radius:O}):s.rect(D,P,g,p),s.fill(),S!==0&&s.stroke()}s.restore()},x=function(k,w,M){ni(s,M.text,k,w+m/2,c,{strikethrough:M.hidden,textAlign:l.textAlign(M.textAlign)})},v=this.isHorizontal(),b=this._computeTitleHeight();v?f={x:bt(o,this.left+h,this.right-n[0]),y:this.top+h+b,line:0}:f={x:this.left+h,y:bt(o,this.top+b+h,this.bottom-e[0].height),line:0},Lh(this.ctx,t.textDirection);const y=m+h;this.legendItems.forEach((k,w)=>{s.strokeStyle=k.fontColor,s.fillStyle=k.fontColor;const M=s.measureText(k.text).width,S=l.textAlign(k.textAlign||(k.textAlign=r.textAlign)),P=g+d+M;let D=f.x,O=f.y;l.setWidth(this.width),v?w>0&&D+P+h>this.right&&(O=f.y+=y,f.line++,D=f.x=bt(o,this.left+h,this.right-n[f.line])):w>0&&O+y>this.bottom&&(D=f.x=D+e[f.line].width+h,f.line++,O=f.y=bt(o,this.top+b+h,this.bottom-e[f.line].height));const H=l.x(D);if(_(H,O,k),D=Of(S,D+g+d,v?D+P:this.right,t.rtl),x(l.x(D),O,k),v)f.x+=P+h;else if(typeof k.text!="string"){const F=c.lineHeight;f.y+=ou(k,F)+h}else f.y+=y}),Rh(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,n=dt(e.font),s=yt(e.padding);if(!e.display)return;const o=bi(t.rtl,this.left,this.width),r=this.ctx,a=e.position,l=n.size/2,c=s.top+l;let h,u=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),h=this.top+c,u=bt(t.align,u,this.right-d);else{const g=this.columnSizes.reduce((p,m)=>Math.max(p,m.height),0);h=c+bt(t.align,this.top,this.bottom-g-t.labels.padding-this._computeTitleHeight())}const f=bt(a,u,u+d);r.textAlign=o.textAlign(Cr(a)),r.textBaseline="middle",r.strokeStyle=e.color,r.fillStyle=e.color,r.font=n.string,ni(r,e.text,f,h,n)}_computeTitleHeight(){const t=this.options.title,e=dt(t.font),n=yt(t.padding);return t.display?e.lineHeight+n.height:0}_getLegendItemAt(t,e){let n,s,o;if(he(t,this.left,this.right)&&he(e,this.top,this.bottom)){for(o=this.legendHitBoxes,n=0;no.length>r.length?o:r)),t+e.size/2+n.measureText(s).width}function yb(i,t,e){let n=i;return typeof t.text!="string"&&(n=ou(t,e)),n}function ou(i,t){const e=i.text?i.text.length:0;return t*e}function vb(i,t){return!!((i==="mousemove"||i==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(i==="click"||i==="mouseup"))}var wb={id:"legend",_element:bl,start(i,t,e){const n=i.legend=new bl({ctx:i.ctx,options:e,chart:i});_t.configure(i,n,e),_t.addBox(i,n)},stop(i){_t.removeBox(i,i.legend),delete i.legend},beforeUpdate(i,t,e){const n=i.legend;_t.configure(i,n,e),n.options=e},afterUpdate(i){const t=i.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(i,t){t.replay||i.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(i,t,e){const n=t.datasetIndex,s=e.chart;s.isDatasetVisible(n)?(s.hide(n),t.hidden=!0):(s.show(n),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:i=>i.chart.options.color,boxWidth:40,padding:10,generateLabels(i){const t=i.data.datasets,{labels:{usePointStyle:e,pointStyle:n,textAlign:s,color:o,useBorderRadius:r,borderRadius:a}}=i.legend.options;return i._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(e?0:void 0),h=yt(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:c.borderColor,pointStyle:n||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:r&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:i=>i.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:i=>!i.startsWith("on"),labels:{_scriptable:i=>!["generateLabels","filter","sort"].includes(i)}}};class $r extends pe{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const n=this.options;if(this.left=0,this.top=0,!n.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;const s=Z(n.text)?n.text.length:1;this._padding=yt(n.padding);const o=s*dt(n.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:e,left:n,bottom:s,right:o,options:r}=this,a=r.align;let l=0,c,h,u;return this.isHorizontal()?(h=bt(a,n,o),u=e+t,c=o-n):(r.position==="left"?(h=n+t,u=bt(a,s,e),l=Q*-.5):(h=o-t,u=bt(a,e,s),l=Q*.5),c=s-e),{titleX:h,titleY:u,maxWidth:c,rotation:l}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const n=dt(e.font),o=n.lineHeight/2+this._padding.top,{titleX:r,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(o);ni(t,e.text,0,0,n,{color:e.color,maxWidth:l,rotation:c,textAlign:Cr(e.align),textBaseline:"middle",translation:[r,a]})}}function kb(i,t){const e=new $r({ctx:i.ctx,options:t,chart:i});_t.configure(i,e,t),_t.addBox(i,e),i.titleBlock=e}var Mb={id:"title",_element:$r,start(i,t,e){kb(i,e)},stop(i){const t=i.titleBlock;_t.removeBox(i,t),delete i.titleBlock},beforeUpdate(i,t,e){const n=i.titleBlock;_t.configure(i,n,e),n.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Gn=new WeakMap;var Sb={id:"subtitle",start(i,t,e){const n=new $r({ctx:i.ctx,options:e,chart:i});_t.configure(i,n,e),_t.addBox(i,n),Gn.set(i,n)},stop(i){_t.removeBox(i,Gn.get(i)),Gn.delete(i)},beforeUpdate(i,t,e){const n=Gn.get(i);_t.configure(i,n,e),n.options=e},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const sn={average(i){if(!i.length)return!1;let t,e,n=0,s=0,o=0;for(t=0,e=i.length;t-1?i.split(` -`):i}function Pb(i,t){const{element:e,datasetIndex:n,index:s}=t,o=i.getDatasetMeta(n).controller,{label:r,value:a}=o.getLabelAndValue(s);return{chart:i,label:r,parsed:o.getParsed(s),raw:i.data.datasets[n].data[s],formattedValue:a,dataset:o.getDataset(),dataIndex:s,datasetIndex:n,element:e}}function _l(i,t){const e=i.chart.ctx,{body:n,footer:s,title:o}=i,{boxWidth:r,boxHeight:a}=t,l=dt(t.bodyFont),c=dt(t.titleFont),h=dt(t.footerFont),u=o.length,d=s.length,f=n.length,g=yt(t.padding);let p=g.height,m=0,_=n.reduce((b,y)=>b+y.before.length+y.lines.length+y.after.length,0);if(_+=i.beforeBody.length+i.afterBody.length,u&&(p+=u*c.lineHeight+(u-1)*t.titleSpacing+t.titleMarginBottom),_){const b=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;p+=f*b+(_-f)*l.lineHeight+(_-1)*t.bodySpacing}d&&(p+=t.footerMarginTop+d*h.lineHeight+(d-1)*t.footerSpacing);let x=0;const v=function(b){m=Math.max(m,e.measureText(b).width+x)};return e.save(),e.font=c.string,X(i.title,v),e.font=l.string,X(i.beforeBody.concat(i.afterBody),v),x=t.displayColors?r+2+t.boxPadding:0,X(n,b=>{X(b.before,v),X(b.lines,v),X(b.after,v)}),x=0,e.font=h.string,X(i.footer,v),e.restore(),m+=g.width,{width:m,height:p}}function Cb(i,t){const{y:e,height:n}=t;return ei.height-n/2?"bottom":"center"}function Ab(i,t,e,n){const{x:s,width:o}=n,r=e.caretSize+e.caretPadding;if(i==="left"&&s+o+r>t.width||i==="right"&&s-o-r<0)return!0}function Db(i,t,e,n){const{x:s,width:o}=e,{width:r,chartArea:{left:a,right:l}}=i;let c="center";return n==="center"?c=s<=(a+l)/2?"left":"right":s<=o/2?c="left":s>=r-o/2&&(c="right"),Ab(c,i,t,e)&&(c="center"),c}function xl(i,t,e){const n=e.yAlign||t.yAlign||Cb(i,e);return{xAlign:e.xAlign||t.xAlign||Db(i,t,e,n),yAlign:n}}function Ob(i,t){let{x:e,width:n}=i;return t==="right"?e-=n:t==="center"&&(e-=n/2),e}function Tb(i,t,e){let{y:n,height:s}=i;return t==="top"?n+=e:t==="bottom"?n-=s+e:n-=s/2,n}function yl(i,t,e,n){const{caretSize:s,caretPadding:o,cornerRadius:r}=i,{xAlign:a,yAlign:l}=e,c=s+o,{topLeft:h,topRight:u,bottomLeft:d,bottomRight:f}=Qe(r);let g=Ob(t,a);const p=Tb(t,l,c);return l==="center"?a==="left"?g+=c:a==="right"&&(g-=c):a==="left"?g-=Math.max(h,d)+s:a==="right"&&(g+=Math.max(u,f)+s),{x:gt(g,0,n.width-t.width),y:gt(p,0,n.height-t.height)}}function Zn(i,t,e){const n=yt(e.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-n.right:i.x+n.left}function vl(i){return jt([],ne(i))}function Lb(i,t,e){return Ee(i,{tooltip:t,tooltipItems:e,type:"tooltip"})}function wl(i,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?i.override(e):i}const ru={beforeTitle:ee,title(i){if(i.length>0){const t=i[0],e=t.chart.data.labels,n=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(n>0&&t.dataIndex"u"?ru[t].call(e,n):s}var Wo;let kl=(Wo=class extends pe{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,n=this.options.setContext(this.getContext()),s=n.enabled&&e.options.animation&&n.animations,o=new $h(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=Lb(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:n}=e,s=vt(n,"beforeTitle",this,t),o=vt(n,"title",this,t),r=vt(n,"afterTitle",this,t);let a=[];return a=jt(a,ne(s)),a=jt(a,ne(o)),a=jt(a,ne(r)),a}getBeforeBody(t,e){return vl(vt(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:n}=e,s=[];return X(t,o=>{const r={before:[],lines:[],after:[]},a=wl(n,o);jt(r.before,ne(vt(a,"beforeLabel",this,o))),jt(r.lines,vt(a,"label",this,o)),jt(r.after,ne(vt(a,"afterLabel",this,o))),s.push(r)}),s}getAfterBody(t,e){return vl(vt(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:n}=e,s=vt(n,"beforeFooter",this,t),o=vt(n,"footer",this,t),r=vt(n,"afterFooter",this,t);let a=[];return a=jt(a,ne(s)),a=jt(a,ne(o)),a=jt(a,ne(r)),a}_createItems(t){const e=this._active,n=this.chart.data,s=[],o=[],r=[];let a=[],l,c;for(l=0,c=e.length;lt.filter(h,u,d,n))),t.itemSort&&(a=a.sort((h,u)=>t.itemSort(h,u,n))),X(a,h=>{const u=wl(t.callbacks,h);s.push(vt(u,"labelColor",this,h)),o.push(vt(u,"labelPointStyle",this,h)),r.push(vt(u,"labelTextColor",this,h))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(t,e){const n=this.options.setContext(this.getContext()),s=this._active;let o,r=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const a=sn[n.position].call(this,s,this._eventPosition);r=this._createItems(n),this.title=this.getTitle(r,n),this.beforeBody=this.getBeforeBody(r,n),this.body=this.getBody(r,n),this.afterBody=this.getAfterBody(r,n),this.footer=this.getFooter(r,n);const l=this._size=_l(this,n),c=Object.assign({},a,l),h=xl(this.chart,n,c),u=yl(n,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:u.x,y:u.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,n,s){const o=this.getCaretPosition(t,n,s);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,n){const{xAlign:s,yAlign:o}=this,{caretSize:r,cornerRadius:a}=n,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:u}=Qe(a),{x:d,y:f}=t,{width:g,height:p}=e;let m,_,x,v,b,y;return o==="center"?(b=f+p/2,s==="left"?(m=d,_=m-r,v=b+r,y=b-r):(m=d+g,_=m+r,v=b-r,y=b+r),x=m):(s==="left"?_=d+Math.max(l,h)+r:s==="right"?_=d+g-Math.max(c,u)-r:_=this.caretX,o==="top"?(v=f,b=v-r,m=_-r,x=_+r):(v=f+p,b=v+r,m=_+r,x=_-r),y=v),{x1:m,x2:_,x3:x,y1:v,y2:b,y3:y}}drawTitle(t,e,n){const s=this.title,o=s.length;let r,a,l;if(o){const c=bi(n.rtl,this.x,this.width);for(t.x=Zn(this,n.titleAlign,n),e.textAlign=c.textAlign(n.titleAlign),e.textBaseline="middle",r=dt(n.titleFont),a=n.titleSpacing,e.fillStyle=n.titleColor,e.font=r.string,l=0;lx!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,vn(t,{x:p,y:g,w:c,h:l,radius:_}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),vn(t,{x:m,y:g+1,w:c-2,h:l-2,radius:_}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(p,g,c,l),t.strokeRect(p,g,c,l),t.fillStyle=r.backgroundColor,t.fillRect(m,g+1,c-2,l-2))}t.fillStyle=this.labelTextColors[n]}drawBody(t,e,n){const{body:s}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:h}=n,u=dt(n.bodyFont);let d=u.lineHeight,f=0;const g=bi(n.rtl,this.x,this.width),p=function(M){e.fillText(M,g.x(t.x+f),t.y+d/2),t.y+=d+o},m=g.textAlign(r);let _,x,v,b,y,k,w;for(e.textAlign=r,e.textBaseline="middle",e.font=u.string,t.x=Zn(this,m,n),e.fillStyle=n.bodyColor,X(this.beforeBody,p),f=a&&m!=="right"?r==="center"?c/2+h:c+2+h:0,b=0,k=s.length;b0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,n=this.$animations,s=n&&n.x,o=n&&n.y;if(s||o){const r=sn[t.position].call(this,this._active,this._eventPosition);if(!r)return;const a=this._size=_l(this,t),l=Object.assign({},r,this._size),c=xl(e,t,l),h=yl(t,l,c,e);(s._to!==h.x||o._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let n=this.opacity;if(!n)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;const r=yt(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=n,this.drawBackground(o,t,s,e),Lh(t,e.textDirection),o.y+=r.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),Rh(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const n=this._active,s=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!Cs(n,s),r=this._positionChanged(s,e);(o||r)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,n=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],r=this._getActiveElements(t,o,e,n),a=this._positionChanged(r,t),l=e||!Cs(r,o)||a;return l&&(this._active=r,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,n,s){const o=this.options;if(t.type==="mouseout")return[];if(!s)return e;const r=this.chart.getElementsAtEventForMode(t,o.mode,o,n);return o.reverse&&r.reverse(),r}_positionChanged(t,e){const{caretX:n,caretY:s,options:o}=this,r=sn[o.position].call(this,t,e);return r!==!1&&(n!==r.x||s!==r.y)}},C(Wo,"positioners",sn),Wo);var Rb={id:"tooltip",_element:kl,positioners:sn,afterInit(i,t,e){e&&(i.tooltip=new kl({chart:i,options:e}))},beforeUpdate(i,t,e){i.tooltip&&i.tooltip.initialize(e)},reset(i,t,e){i.tooltip&&i.tooltip.initialize(e)},afterDraw(i){const t=i.tooltip;if(t&&t._willRender()){const e={tooltip:t};if(i.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(i.ctx),i.notifyPlugins("afterTooltipDraw",e)}},afterEvent(i,t){if(i.tooltip){const e=t.replay;i.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(i,t)=>t.bodyFont.size,boxWidth:(i,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:ru},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:i=>i!=="filter"&&i!=="itemSort"&&i!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},Eb=Object.freeze({__proto__:null,Colors:Xm,Decimation:Gm,Filler:mb,Legend:wb,SubTitle:Sb,Title:Mb,Tooltip:Rb});const Ib=(i,t,e,n)=>(typeof t=="string"?(e=i.push(t)-1,n.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function Fb(i,t,e,n){const s=i.indexOf(t);if(s===-1)return Ib(i,t,e,n);const o=i.lastIndexOf(t);return s!==o?e:s}const $b=(i,t)=>i===null?null:gt(Math.round(i),0,t);function Ml(i){const t=this.getLabels();return i>=0&&ie.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}},C(ps,"id","category"),C(ps,"defaults",{ticks:{callback:Ml}}),ps);function Bb(i,t){const e=[],{bounds:s,step:o,min:r,max:a,precision:l,count:c,maxTicks:h,maxDigits:u,includeBounds:d}=i,f=o||1,g=h-1,{min:p,max:m}=t,_=!W(r),x=!W(a),v=!W(c),b=(m-p)/(u+1);let y=ba((m-p)/g/f)*f,k,w,M,S;if(y<1e-14&&!_&&!x)return[{value:p},{value:m}];S=Math.ceil(m/y)-Math.floor(p/y),S>g&&(y=ba(S*y/g/f)*f),W(l)||(k=Math.pow(10,l),y=Math.ceil(y*k)/k),s==="ticks"?(w=Math.floor(p/y)*y,M=Math.ceil(m/y)*y):(w=p,M=m),_&&x&&o&&kf((a-r)/o,y/1e3)?(S=Math.round(Math.min((a-r)/y,h)),y=(a-r)/S,w=r,M=a):v?(w=_?r:w,M=x?a:M,S=c-1,y=(M-w)/S):(S=(M-w)/y,un(S,Math.round(S),y/1e3)?S=Math.round(S):S=Math.ceil(S));const P=Math.max(_a(y),_a(w));k=Math.pow(10,W(l)?P:l),w=Math.round(w*k)/k,M=Math.round(M*k)/k;let D=0;for(_&&(d&&w!==r?(e.push({value:r}),wa)break;e.push({value:O})}return x&&d&&M!==a?e.length&&un(e[e.length-1].value,a,Sl(a,b,i))?e[e.length-1].value=a:e.push({value:a}):(!x||M===a)&&e.push({value:M}),e}function Sl(i,t,{horizontal:e,minRotation:n}){const s=Nt(n),o=(e?Math.sin(s):Math.cos(s))||.001,r=.75*t*(""+i).length;return Math.min(t/o,r)}let Es=class extends En{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return W(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:n}=this.getUserBounds();let{min:s,max:o}=this;const r=l=>s=e?s:l,a=l=>o=n?o:l;if(t){const l=qt(s),c=qt(o);l<0&&c<0?a(0):l>0&&c>0&&r(0)}if(s===o){let l=o===0?1:Math.abs(o*.05);a(o+l),t||r(s-l)}this.min=s,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:n}=t,s;return n?(s=Math.ceil(this.max/n)-Math.floor(this.min/n)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${n} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let n=this.getTickLimit();n=Math.max(2,n);const s={maxTicks:n,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,r=Bb(s,o);return t.bounds==="ticks"&&gh(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const t=this.ticks;let e=this.min,n=this.max;if(super.configure(),this.options.offset&&t.length){const s=(n-e)/Math.max(t.length-1,1)/2;e-=s,n+=s}this._startValue=e,this._endValue=n,this._valueRange=n-e}getLabelForValue(t){return Ln(t,this.chart.options.locale,this.options.ticks.format)}};var ms;let Nb=(ms=class extends Es{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=rt(t)?t:0,this.max=rt(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,n=Nt(this.options.ticks.minRotation),s=(t?Math.sin(n):Math.cos(n))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}},C(ms,"id","linear"),C(ms,"defaults",{ticks:{callback:Zs.formatters.numeric}}),ms);const kn=i=>Math.floor(we(i)),Ve=(i,t)=>Math.pow(10,kn(i)+t);function Pl(i){return i/Math.pow(10,kn(i))===1}function Cl(i,t,e){const n=Math.pow(10,e),s=Math.floor(i/n);return Math.ceil(t/n)-s}function Vb(i,t){const e=t-i;let n=kn(e);for(;Cl(i,t,n)>10;)n++;for(;Cl(i,t,n)<10;)n--;return Math.min(n,kn(i))}function Wb(i,{min:t,max:e}){t=Ct(i.min,t);const n=[],s=kn(t);let o=Vb(t,e),r=o<0?Math.pow(10,Math.abs(o)):1;const a=Math.pow(10,o),l=s>o?Math.pow(10,s):0,c=Math.round((t-l)*r)/r,h=Math.floor((t-l)/a/10)*a*10;let u=Math.floor((c-h)/Math.pow(10,o)),d=Ct(i.min,Math.round((l+h+u*Math.pow(10,o))*r)/r);for(;d=10?u=u<15?15:20:u++,u>=20&&(o++,u=2,r=o>=0?1:r),d=Math.round((l+h+u*Math.pow(10,o))*r)/r;const f=Ct(i.max,d);return n.push({value:f,major:Pl(f),significand:u}),n}var bs;let jb=(bs=class extends En{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const n=Es.prototype.parse.apply(this,[t,e]);if(n===0){this._zero=!0;return}return rt(n)&&n>0?n:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=rt(t)?Math.max(0,t):null,this.max=rt(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!rt(this._userMin)&&(this.min=t===Ve(this.min,0)?Ve(this.min,-1):Ve(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let n=this.min,s=this.max;const o=a=>n=t?n:a,r=a=>s=e?s:a;n===s&&(n<=0?(o(1),r(10)):(o(Ve(n,-1)),r(Ve(s,1)))),n<=0&&o(Ve(s,-1)),s<=0&&r(Ve(n,1)),this.min=n,this.max=s}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},n=Wb(e,this);return t.bounds==="ticks"&&gh(n,this,"value"),t.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}getLabelForValue(t){return t===void 0?"0":Ln(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=we(t),this._valueRange=we(this.max)-we(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(we(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}},C(bs,"id","logarithmic"),C(bs,"defaults",{ticks:{callback:Zs.formatters.logarithmic,major:{enabled:!0}}}),bs);function er(i){const t=i.ticks;if(t.display&&i.display){const e=yt(t.backdropPadding);return E(t.font&&t.font.size,at.font.size)+e.height}return 0}function Hb(i,t,e){return e=Z(e)?e:[e],{w:Nf(i,t.string,e),h:e.length*t.lineHeight}}function Al(i,t,e,n,s){return i===n||i===s?{start:t-e/2,end:t+e/2}:is?{start:t-e,end:t}:{start:t,end:t+e}}function Yb(i){const t={l:i.left+i._padding.left,r:i.right-i._padding.right,t:i.top+i._padding.top,b:i.bottom-i._padding.bottom},e=Object.assign({},t),n=[],s=[],o=i._pointLabels.length,r=i.options.pointLabels,a=r.centerPointLabels?Q/o:0;for(let l=0;lt.r&&(a=(n.end-t.r)/o,i.r=Math.max(i.r,t.r+a)),s.startt.b&&(l=(s.end-t.b)/r,i.b=Math.max(i.b,t.b+l))}function Ub(i,t,e){const n=i.drawingArea,{extra:s,additionalAngle:o,padding:r,size:a}=e,l=i.getPointPosition(t,n+s+r,o),c=Math.round(Sr(At(l.angle+ut))),h=Jb(l.y,a.h,c),u=Gb(c),d=Zb(l.x,a.w,u);return{visible:!0,x:l.x,y:h,textAlign:u,left:d,top:h,right:d+a.w,bottom:h+a.h}}function qb(i,t){if(!t)return!0;const{left:e,top:n,right:s,bottom:o}=i;return!(de({x:e,y:n},t)||de({x:e,y:o},t)||de({x:s,y:n},t)||de({x:s,y:o},t))}function Kb(i,t,e){const n=[],s=i._pointLabels.length,o=i.options,{centerPointLabels:r,display:a}=o.pointLabels,l={extra:er(o)/2,additionalAngle:r?Q/s:0};let c;for(let h=0;h270||e<90)&&(i-=t),i}function Qb(i,t,e){const{left:n,top:s,right:o,bottom:r}=e,{backdropColor:a}=t;if(!W(a)){const l=Qe(t.borderRadius),c=yt(t.backdropPadding);i.fillStyle=a;const h=n-c.left,u=s-c.top,d=o-n+c.width,f=r-s+c.height;Object.values(l).some(g=>g!==0)?(i.beginPath(),vn(i,{x:h,y:u,w:d,h:f,radius:l}),i.fill()):i.fillRect(h,u,d,f)}}function t_(i,t){const{ctx:e,options:{pointLabels:n}}=i;for(let s=t-1;s>=0;s--){const o=i._pointLabelItems[s];if(!o.visible)continue;const r=n.setContext(i.getPointLabelContext(s));Qb(e,r,o);const a=dt(r.font),{x:l,y:c,textAlign:h}=o;ni(e,i._pointLabels[s],l,c+a.lineHeight/2,a,{color:r.color,textAlign:h,textBaseline:"middle"})}}function au(i,t,e,n){const{ctx:s}=i;if(e)s.arc(i.xCenter,i.yCenter,t,0,J);else{let o=i.getPointPosition(0,t);s.moveTo(o.x,o.y);for(let r=1;r{const s=G(this.options.pointLabels.callback,[e,n],this);return s||s===0?s:""}).filter((e,n)=>this.chart.getDataVisibility(n))}fit(){const t=this.options;t.display&&t.pointLabels.display?Yb(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,n,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((n-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,n,s))}getIndexAngle(t){const e=J/(this._pointLabels.length||1),n=this.options.startAngle||0;return At(t*e+Nt(n))}getDistanceFromCenterForValue(t){if(W(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(W(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t{if(u!==0){l=this.getDistanceFromCenterForValue(h.value);const d=this.getContext(u),f=s.setContext(d),g=o.setContext(d);e_(this,f,l,r,g)}}),n.display){for(t.save(),a=r-1;a>=0;a--){const h=n.setContext(this.getPointLabelContext(a)),{color:u,lineWidth:d}=h;!d||!u||(t.lineWidth=d,t.strokeStyle=u,t.setLineDash(h.borderDash),t.lineDashOffset=h.borderDashOffset,l=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),c=this.getPointPosition(a,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,n=e.ticks;if(!n.display)return;const s=this.getIndexAngle(0);let o,r;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&!e.reverse)return;const c=n.setContext(this.getContext(l)),h=dt(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=h.string,r=t.measureText(a.label).width,t.fillStyle=c.backdropColor;const u=yt(c.backdropPadding);t.fillRect(-r/2-u.left,-o-h.size/2-u.top,r+u.width,h.size+u.height)}ni(t,a.label,0,-o,h,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}},C(pi,"id","radialLinear"),C(pi,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Zs.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),C(pi,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),C(pi,"descriptors",{angleLines:{_fallback:"grid"}}),pi);const io={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},kt=Object.keys(io);function Dl(i,t){return i-t}function Ol(i,t){if(W(t))return null;const e=i._adapter,{parser:n,round:s,isoWeekday:o}=i._parseOpts;let r=t;return typeof n=="function"&&(r=n(r)),rt(r)||(r=typeof n=="string"?e.parse(r,n):e.parse(r)),r===null?null:(s&&(r=s==="week"&&(yi(o)||o===!0)?e.startOf(r,"isoWeek",o):e.startOf(r,s)),+r)}function Tl(i,t,e,n){const s=kt.length;for(let o=kt.indexOf(i);o=kt.indexOf(e);o--){const r=kt[o];if(io[r].common&&i._adapter.diff(s,n,r)>=t-1)return r}return kt[e?kt.indexOf(e):0]}function o_(i){for(let t=kt.indexOf(i)+1,e=kt.length;t=t?e[n]:e[s];i[o]=!0}}function r_(i,t,e,n){const s=i._adapter,o=+s.startOf(t[0].value,n),r=t[t.length-1].value;let a,l;for(a=o;a<=r;a=+s.add(a,1,n))l=e[a],l>=0&&(t[l].major=!0);return t}function Rl(i,t,e){const n=[],s={},o=t.length;let r,a;for(r=0;r+t.value))}initOffsets(t=[]){let e=0,n=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?n=o:n=(o-this.getDecimalForValue(t[t.length-2]))/2);const r=t.length<3?.5:.25;e=gt(e,0,r),n=gt(n,0,r),this._offsets={start:e,end:n,factor:1/(e+1+n)}}_generate(){const t=this._adapter,e=this.min,n=this.max,s=this.options,o=s.time,r=o.unit||Tl(o.minUnit,e,n,this._getLabelCapacity(e)),a=E(s.ticks.stepSize,1),l=r==="week"?o.isoWeekday:!1,c=yi(l)||l===!0,h={};let u=e,d,f;if(c&&(u=+t.startOf(u,"isoWeek",l)),u=+t.startOf(u,c?"day":r),t.diff(n,e,r)>1e5*a)throw new Error(e+" and "+n+" are too far apart with stepSize of "+a+" "+r);const g=s.ticks.source==="data"&&this.getDataTimestamps();for(d=u,f=0;d+p)}getLabelForValue(t){const e=this._adapter,n=this.options.time;return n.tooltipFormat?e.format(t,n.tooltipFormat):e.format(t,n.displayFormats.datetime)}format(t,e){const s=this.options.time.displayFormats,o=this._unit,r=e||s[o];return this._adapter.format(t,r)}_tickFormatFunction(t,e,n,s){const o=this.options,r=o.ticks.callback;if(r)return G(r,[t,e,n],this);const a=o.time.displayFormats,l=this._unit,c=this._majorUnit,h=l&&a[l],u=c&&a[c],d=n[e],f=c&&u&&d&&d.major;return this._adapter.format(t,s||(f?u:h))}generateTickLabels(t){let e,n,s;for(e=0,n=t.length;e0?a:1}getDataTimestamps(){let t=this._cache.data||[],e,n;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,n=s.length;e=i[n].pos&&t<=i[s].pos&&({lo:n,hi:s}=ue(i,"pos",t)),{pos:o,time:a}=i[n],{pos:r,time:l}=i[s]):(t>=i[n].time&&t<=i[s].time&&({lo:n,hi:s}=ue(i,"time",t)),{time:o,pos:a}=i[n],{time:r,pos:l}=i[s]);const c=r-o;return c?a+(l-a)*(t-o)/c:a}var xs;let a_=(xs=class extends ir{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=Jn(e,this.min),this._tableRange=Jn(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:n}=this,s=[],o=[];let r,a,l,c,h;for(r=0,a=t.length;r=e&&c<=n&&s.push(c);if(s.length<2)return[{time:e,pos:0},{time:n,pos:1}];for(r=0,a=s.length;rs-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),n=this.getLabelTimestamps();return e.length&&n.length?t=this.normalize(e.concat(n)):t=e.length?e:n,t=this._cache.all=t,t}getDecimalForValue(t){return(Jn(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,n=this.getDecimalForPixel(t)/e.factor-e.end;return Jn(this._table,n*this._tableRange+this._minPos,!0)}},C(xs,"id","timeseries"),C(xs,"defaults",ir.defaults),xs);var l_=Object.freeze({__proto__:null,CategoryScale:zb,LinearScale:Nb,LogarithmicScale:jb,RadialLinearScale:n_,TimeScale:ir,TimeSeriesScale:a_});const c_=[ap,Nm,Eb,l_];/*! - * Chart.js v3.9.1 - * https://www.chartjs.org - * (c) 2022 Chart.js Contributors - * Released under the MIT License - */const h_=function(){let i=0;return function(){return i++}}();function q(i){return i===null||typeof i>"u"}function et(i){if(Array.isArray&&Array.isArray(i))return!0;const t=Object.prototype.toString.call(i);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function j(i){return i!==null&&Object.prototype.toString.call(i)==="[object Object]"}const pt=i=>(typeof i=="number"||i instanceof Number)&&isFinite(+i);function Lt(i,t){return pt(i)?i:t}function V(i,t){return typeof i>"u"?t:i}const u_=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100:i/t,lu=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100*t:+i;function nt(i,t,e){if(i&&typeof i.call=="function")return i.apply(e,t)}function U(i,t,e,n){let s,o,r;if(et(i))if(o=i.length,n)for(s=o-1;s>=0;s--)t.call(e,i[s],s);else for(s=0;si,x:i=>i.x,y:i=>i.y};function Le(i,t){return(El[t]||(El[t]=g_(t)))(i)}function g_(i){const t=p_(i);return e=>{for(const n of t){if(n==="")break;e=e&&e[n]}return e}}function p_(i){const t=i.split("."),e=[];let n="";for(const s of t)n+=s,n.endsWith("\\")?n=n.slice(0,-1)+".":(e.push(n),n="");return e}function zr(i){return i.charAt(0).toUpperCase()+i.slice(1)}const Ft=i=>typeof i<"u",Re=i=>typeof i=="function",Il=(i,t)=>{if(i.size!==t.size)return!1;for(const e of i)if(!t.has(e))return!1;return!0};function m_(i){return i.type==="mouseup"||i.type==="click"||i.type==="contextmenu"}const ct=Math.PI,K=2*ct,b_=K+ct,$s=Number.POSITIVE_INFINITY,__=ct/180,lt=ct/2,Ri=ct/4,Fl=ct*2/3,Et=Math.log10,Kt=Math.sign;function $l(i){const t=Math.round(i);i=pn(i,t,i/1e3)?t:i;const e=Math.pow(10,Math.floor(Et(i))),n=i/e;return(n<=1?1:n<=2?2:n<=5?5:10)*e}function x_(i){const t=[],e=Math.sqrt(i);let n;for(n=1;ns-o).pop(),t}function ki(i){return!isNaN(parseFloat(i))&&isFinite(i)}function pn(i,t,e){return Math.abs(i-t)=i}function hu(i,t,e){let n,s,o;for(n=0,s=i.length;nl&&c=Math.min(t,e)-n&&i<=Math.max(t,e)+n}function Nr(i,t,e){e=e||(r=>i[r]1;)o=s+n>>1,e(o)?s=o:n=o;return{lo:s,hi:n}}const Ze=(i,t,e,n)=>Nr(i,e,n?s=>i[s][t]<=e:s=>i[s][t]Nr(i,e,n=>i[n][t]>=e);function M_(i,t,e){let n=0,s=i.length;for(;nn&&i[s-1]>e;)s--;return n>0||s{const n="_onData"+zr(e),s=i[e];Object.defineProperty(i,e,{configurable:!0,enumerable:!1,value(...o){const r=s.apply(this,o);return i._chartjs.listeners.forEach(a=>{typeof a[n]=="function"&&a[n](...o)}),r}})})}function Bl(i,t){const e=i._chartjs;if(!e)return;const n=e.listeners,s=n.indexOf(t);s!==-1&&n.splice(s,1),!(n.length>0)&&(du.forEach(o=>{delete i[o]}),delete i._chartjs)}function fu(i){const t=new Set;let e,n;for(e=0,n=i.length;e"u"?function(i){return i()}:window.requestAnimationFrame}();function pu(i,t,e){const n=e||(r=>Array.prototype.slice.call(r));let s=!1,o=[];return function(...r){o=n(r),s||(s=!0,gu.call(window,()=>{s=!1,i.apply(t,o)}))}}function P_(i,t){let e;return function(...n){return t?(clearTimeout(e),e=setTimeout(i,t,n)):i.apply(this,n),t}}const C_=i=>i==="start"?"left":i==="end"?"right":"center",Nl=(i,t,e)=>i==="start"?t:i==="end"?e:(t+e)/2;function mu(i,t,e){const n=t.length;let s=0,o=n;if(i._sorted){const{iScale:r,_parsed:a}=i,l=r.axis,{min:c,max:h,minDefined:u,maxDefined:d}=r.getUserBounds();u&&(s=xt(Math.min(Ze(a,r.axis,c).lo,e?n:Ze(t,l,r.getPixelForValue(c)).lo),0,n-1)),d?o=xt(Math.max(Ze(a,r.axis,h,!0).hi+1,e?0:Ze(t,l,r.getPixelForValue(h),!0).hi+1),s,n)-s:o=n-s}return{start:s,count:o}}function bu(i){const{xScale:t,yScale:e,_scaleRanges:n}=i,s={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!n)return i._scaleRanges=s,!0;const o=n.xmin!==t.min||n.xmax!==t.max||n.ymin!==e.min||n.ymax!==e.max;return Object.assign(n,s),o}const Qn=i=>i===0||i===1,Vl=(i,t,e)=>-(Math.pow(2,10*(i-=1))*Math.sin((i-t)*K/e)),Wl=(i,t,e)=>Math.pow(2,-10*i)*Math.sin((i-t)*K/e)+1,mn={linear:i=>i,easeInQuad:i=>i*i,easeOutQuad:i=>-i*(i-2),easeInOutQuad:i=>(i/=.5)<1?.5*i*i:-.5*(--i*(i-2)-1),easeInCubic:i=>i*i*i,easeOutCubic:i=>(i-=1)*i*i+1,easeInOutCubic:i=>(i/=.5)<1?.5*i*i*i:.5*((i-=2)*i*i+2),easeInQuart:i=>i*i*i*i,easeOutQuart:i=>-((i-=1)*i*i*i-1),easeInOutQuart:i=>(i/=.5)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2),easeInQuint:i=>i*i*i*i*i,easeOutQuint:i=>(i-=1)*i*i*i*i+1,easeInOutQuint:i=>(i/=.5)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2),easeInSine:i=>-Math.cos(i*lt)+1,easeOutSine:i=>Math.sin(i*lt),easeInOutSine:i=>-.5*(Math.cos(ct*i)-1),easeInExpo:i=>i===0?0:Math.pow(2,10*(i-1)),easeOutExpo:i=>i===1?1:-Math.pow(2,-10*i)+1,easeInOutExpo:i=>Qn(i)?i:i<.5?.5*Math.pow(2,10*(i*2-1)):.5*(-Math.pow(2,-10*(i*2-1))+2),easeInCirc:i=>i>=1?i:-(Math.sqrt(1-i*i)-1),easeOutCirc:i=>Math.sqrt(1-(i-=1)*i),easeInOutCirc:i=>(i/=.5)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1),easeInElastic:i=>Qn(i)?i:Vl(i,.075,.3),easeOutElastic:i=>Qn(i)?i:Wl(i,.075,.3),easeInOutElastic(i){return Qn(i)?i:i<.5?.5*Vl(i*2,.1125,.45):.5+.5*Wl(i*2-1,.1125,.45)},easeInBack(i){return i*i*((1.70158+1)*i-1.70158)},easeOutBack(i){return(i-=1)*i*((1.70158+1)*i+1.70158)+1},easeInOutBack(i){let t=1.70158;return(i/=.5)<1?.5*(i*i*(((t*=1.525)+1)*i-t)):.5*((i-=2)*i*(((t*=1.525)+1)*i+t)+2)},easeInBounce:i=>1-mn.easeOutBounce(1-i),easeOutBounce(i){return i<1/2.75?7.5625*i*i:i<2/2.75?7.5625*(i-=1.5/2.75)*i+.75:i<2.5/2.75?7.5625*(i-=2.25/2.75)*i+.9375:7.5625*(i-=2.625/2.75)*i+.984375},easeInOutBounce:i=>i<.5?mn.easeInBounce(i*2)*.5:mn.easeOutBounce(i*2-1)*.5+.5};/*! - * @kurkle/color v0.2.1 - * https://github.com/kurkle/color#readme - * (c) 2022 Jukka Kurkela - * Released under the MIT License - */function In(i){return i+.5|0}const Me=(i,t,e)=>Math.max(Math.min(i,e),t);function on(i){return Me(In(i*2.55),0,255)}function Ae(i){return Me(In(i*255),0,255)}function ae(i){return Me(In(i/2.55)/100,0,1)}function jl(i){return Me(In(i*100),0,100)}const Tt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},sr=[..."0123456789ABCDEF"],A_=i=>sr[i&15],D_=i=>sr[(i&240)>>4]+sr[i&15],ts=i=>(i&240)>>4===(i&15),O_=i=>ts(i.r)&&ts(i.g)&&ts(i.b)&&ts(i.a);function T_(i){var t=i.length,e;return i[0]==="#"&&(t===4||t===5?e={r:255&Tt[i[1]]*17,g:255&Tt[i[2]]*17,b:255&Tt[i[3]]*17,a:t===5?Tt[i[4]]*17:255}:(t===7||t===9)&&(e={r:Tt[i[1]]<<4|Tt[i[2]],g:Tt[i[3]]<<4|Tt[i[4]],b:Tt[i[5]]<<4|Tt[i[6]],a:t===9?Tt[i[7]]<<4|Tt[i[8]]:255})),e}const L_=(i,t)=>i<255?t(i):"";function R_(i){var t=O_(i)?A_:D_;return i?"#"+t(i.r)+t(i.g)+t(i.b)+L_(i.a,t):void 0}const E_=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function _u(i,t,e){const n=t*Math.min(e,1-e),s=(o,r=(o+i/30)%12)=>e-n*Math.max(Math.min(r-3,9-r,1),-1);return[s(0),s(8),s(4)]}function I_(i,t,e){const n=(s,o=(s+i/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[n(5),n(3),n(1)]}function F_(i,t,e){const n=_u(i,1,.5);let s;for(t+e>1&&(s=1/(t+e),t*=s,e*=s),s=0;s<3;s++)n[s]*=1-t-e,n[s]+=t;return n}function $_(i,t,e,n,s){return i===s?(t-e)/n+(t.5?h/(2-o-r):h/(o+r),l=$_(e,n,s,h,o),l=l*60+.5),[l|0,c||0,a]}function Wr(i,t,e,n){return(Array.isArray(t)?i(t[0],t[1],t[2]):i(t,e,n)).map(Ae)}function jr(i,t,e){return Wr(_u,i,t,e)}function z_(i,t,e){return Wr(F_,i,t,e)}function B_(i,t,e){return Wr(I_,i,t,e)}function xu(i){return(i%360+360)%360}function N_(i){const t=E_.exec(i);let e=255,n;if(!t)return;t[5]!==n&&(e=t[6]?on(+t[5]):Ae(+t[5]));const s=xu(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?n=z_(s,o,r):t[1]==="hsv"?n=B_(s,o,r):n=jr(s,o,r),{r:n[0],g:n[1],b:n[2],a:e}}function V_(i,t){var e=Vr(i);e[0]=xu(e[0]+t),e=jr(e),i.r=e[0],i.g=e[1],i.b=e[2]}function W_(i){if(!i)return;const t=Vr(i),e=t[0],n=jl(t[1]),s=jl(t[2]);return i.a<255?`hsla(${e}, ${n}%, ${s}%, ${ae(i.a)})`:`hsl(${e}, ${n}%, ${s}%)`}const Hl={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Yl={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function j_(){const i={},t=Object.keys(Yl),e=Object.keys(Hl);let n,s,o,r,a;for(n=0;n>16&255,o>>8&255,o&255]}return i}let es;function H_(i){es||(es=j_(),es.transparent=[0,0,0,0]);const t=es[i.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const Y_=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function X_(i){const t=Y_.exec(i);let e=255,n,s,o;if(t){if(t[7]!==n){const r=+t[7];e=t[8]?on(r):Me(r*255,0,255)}return n=+t[1],s=+t[3],o=+t[5],n=255&(t[2]?on(n):Me(n,0,255)),s=255&(t[4]?on(s):Me(s,0,255)),o=255&(t[6]?on(o):Me(o,0,255)),{r:n,g:s,b:o,a:e}}}function U_(i){return i&&(i.a<255?`rgba(${i.r}, ${i.g}, ${i.b}, ${ae(i.a)})`:`rgb(${i.r}, ${i.g}, ${i.b})`)}const Ao=i=>i<=.0031308?i*12.92:Math.pow(i,1/2.4)*1.055-.055,li=i=>i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4);function q_(i,t,e){const n=li(ae(i.r)),s=li(ae(i.g)),o=li(ae(i.b));return{r:Ae(Ao(n+e*(li(ae(t.r))-n))),g:Ae(Ao(s+e*(li(ae(t.g))-s))),b:Ae(Ao(o+e*(li(ae(t.b))-o))),a:i.a+e*(t.a-i.a)}}function is(i,t,e){if(i){let n=Vr(i);n[t]=Math.max(0,Math.min(n[t]+n[t]*e,t===0?360:1)),n=jr(n),i.r=n[0],i.g=n[1],i.b=n[2]}}function yu(i,t){return i&&Object.assign(t||{},i)}function Xl(i){var t={r:0,g:0,b:0,a:255};return Array.isArray(i)?i.length>=3&&(t={r:i[0],g:i[1],b:i[2],a:255},i.length>3&&(t.a=Ae(i[3]))):(t=yu(i,{r:0,g:0,b:0,a:1}),t.a=Ae(t.a)),t}function K_(i){return i.charAt(0)==="r"?X_(i):N_(i)}class Bs{constructor(t){if(t instanceof Bs)return t;const e=typeof t;let n;e==="object"?n=Xl(t):e==="string"&&(n=T_(t)||H_(t)||K_(t)),this._rgb=n,this._valid=!!n}get valid(){return this._valid}get rgb(){var t=yu(this._rgb);return t&&(t.a=ae(t.a)),t}set rgb(t){this._rgb=Xl(t)}rgbString(){return this._valid?U_(this._rgb):void 0}hexString(){return this._valid?R_(this._rgb):void 0}hslString(){return this._valid?W_(this._rgb):void 0}mix(t,e){if(t){const n=this.rgb,s=t.rgb;let o;const r=e===o?.5:e,a=2*r-1,l=n.a-s.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-c,n.r=255&c*n.r+o*s.r+.5,n.g=255&c*n.g+o*s.g+.5,n.b=255&c*n.b+o*s.b+.5,n.a=r*n.a+(1-r)*s.a,this.rgb=n}return this}interpolate(t,e){return t&&(this._rgb=q_(this._rgb,t._rgb,e)),this}clone(){return new Bs(this.rgb)}alpha(t){return this._rgb.a=Ae(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=In(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){const e=this._rgb;return e.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return is(this._rgb,2,t),this}darken(t){return is(this._rgb,2,-t),this}saturate(t){return is(this._rgb,1,t),this}desaturate(t){return is(this._rgb,1,-t),this}rotate(t){return V_(this._rgb,t),this}}function vu(i){return new Bs(i)}function wu(i){if(i&&typeof i=="object"){const t=i.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function Ul(i){return wu(i)?i:vu(i)}function Do(i){return wu(i)?i:vu(i).saturate(.5).darken(.1).hexString()}const si=Object.create(null),or=Object.create(null);function bn(i,t){if(!t)return i;const e=t.split(".");for(let n=0,s=e.length;ne.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(e,n)=>Do(n.backgroundColor),this.hoverBorderColor=(e,n)=>Do(n.borderColor),this.hoverColor=(e,n)=>Do(n.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t)}set(t,e){return Oo(this,t,e)}get(t){return bn(this,t)}describe(t,e){return Oo(or,t,e)}override(t,e){return Oo(si,t,e)}route(t,e,n,s){const o=bn(this,t),r=bn(this,n),a="_"+e;Object.defineProperties(o,{[a]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const l=this[a],c=r[s];return j(l)?Object.assign({},c,l):V(l,c)},set(l){this[a]=l}}})}}var B=new G_({_scriptable:i=>!i.startsWith("on"),_indexable:i=>i!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}});function Z_(i){return!i||q(i.size)||q(i.family)?null:(i.style?i.style+" ":"")+(i.weight?i.weight+" ":"")+i.size+"px "+i.family}function Ns(i,t,e,n,s){let o=t[s];return o||(o=t[s]=i.measureText(s).width,e.push(s)),o>n&&(n=o),n}function J_(i,t,e,n){n=n||{};let s=n.data=n.data||{},o=n.garbageCollect=n.garbageCollect||[];n.font!==t&&(s=n.data={},o=n.garbageCollect=[],n.font=t),i.save(),i.font=t;let r=0;const a=e.length;let l,c,h,u,d;for(l=0;le.length){for(l=0;l0&&i.stroke()}}function Pn(i,t,e){return e=e||.5,!t||i&&i.x>t.left-e&&i.xt.top-e&&i.y0&&o.strokeColor!=="";let l,c;for(i.save(),i.font=s.string,i0(i,o),l=0;l+i||0;function Hr(i,t){const e={},n=j(t),s=n?Object.keys(t):t,o=j(i)?n?r=>V(i[r],i[t[r]]):r=>i[r]:()=>i;for(const r of s)e[r]=a0(o(r));return e}function Su(i){return Hr(i,{top:"y",right:"x",bottom:"y",left:"x"})}function _i(i){return Hr(i,["topLeft","topRight","bottomLeft","bottomRight"])}function $t(i){const t=Su(i);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function Dt(i,t){i=i||{},t=t||B.font;let e=V(i.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let n=V(i.style,t.style);n&&!(""+n).match(o0)&&(console.warn('Invalid font style specified: "'+n+'"'),n="");const s={family:V(i.family,t.family),lineHeight:r0(V(i.lineHeight,t.lineHeight),e),size:e,style:n,weight:V(i.weight,t.weight),string:""};return s.string=Z_(s),s}function ns(i,t,e,n){let s=!0,o,r,a;for(o=0,r=i.length;oe&&a===0?0:a+l;return{min:r(n,-Math.abs(o)),max:r(s,o)}}function Fe(i,t){return Object.assign(Object.create(i),t)}function Yr(i,t=[""],e=i,n,s=()=>i[0]){Ft(n)||(n=Du("_fallback",i));const o={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:i,_rootScopes:e,_fallback:n,_getTarget:s,override:r=>Yr([r,...i],t,e,n)};return new Proxy(o,{deleteProperty(r,a){return delete r[a],delete r._keys,delete i[0][a],!0},get(r,a){return Cu(r,a,()=>m0(a,t,i,r))},getOwnPropertyDescriptor(r,a){return Reflect.getOwnPropertyDescriptor(r._scopes[0],a)},getPrototypeOf(){return Reflect.getPrototypeOf(i[0])},has(r,a){return Gl(r).includes(a)},ownKeys(r){return Gl(r)},set(r,a,l){const c=r._storage||(r._storage=s());return r[a]=c[a]=l,delete r._keys,!0}})}function Mi(i,t,e,n){const s={_cacheable:!1,_proxy:i,_context:t,_subProxy:e,_stack:new Set,_descriptors:Pu(i,n),setContext:o=>Mi(i,o,e,n),override:o=>Mi(i.override(o),t,e,n)};return new Proxy(s,{deleteProperty(o,r){return delete o[r],delete i[r],!0},get(o,r,a){return Cu(o,r,()=>h0(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(i,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(i,r)},getPrototypeOf(){return Reflect.getPrototypeOf(i)},has(o,r){return Reflect.has(i,r)},ownKeys(){return Reflect.ownKeys(i)},set(o,r,a){return i[r]=a,delete o[r],!0}})}function Pu(i,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:n=t.indexable,_allKeys:s=t.allKeys}=i;return{allKeys:s,scriptable:e,indexable:n,isScriptable:Re(e)?e:()=>e,isIndexable:Re(n)?n:()=>n}}const c0=(i,t)=>i?i+zr(t):t,Xr=(i,t)=>j(t)&&i!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function Cu(i,t,e){if(Object.prototype.hasOwnProperty.call(i,t))return i[t];const n=e();return i[t]=n,n}function h0(i,t,e){const{_proxy:n,_context:s,_subProxy:o,_descriptors:r}=i;let a=n[t];return Re(a)&&r.isScriptable(t)&&(a=u0(t,a,i,e)),et(a)&&a.length&&(a=d0(t,a,i,r.isIndexable)),Xr(t,a)&&(a=Mi(a,s,o&&o[t],r)),a}function u0(i,t,e,n){const{_proxy:s,_context:o,_subProxy:r,_stack:a}=e;if(a.has(i))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+i);return a.add(i),t=t(o,r||n),a.delete(i),Xr(i,t)&&(t=Ur(s._scopes,s,i,t)),t}function d0(i,t,e,n){const{_proxy:s,_context:o,_subProxy:r,_descriptors:a}=e;if(Ft(o.index)&&n(i))t=t[o.index%t.length];else if(j(t[0])){const l=t,c=s._scopes.filter(h=>h!==l);t=[];for(const h of l){const u=Ur(c,s,i,h);t.push(Mi(u,o,r&&r[i],a))}}return t}function Au(i,t,e){return Re(i)?i(t,e):i}const f0=(i,t)=>i===!0?t:typeof i=="string"?Le(t,i):void 0;function g0(i,t,e,n,s){for(const o of t){const r=f0(e,o);if(r){i.add(r);const a=Au(r._fallback,e,s);if(Ft(a)&&a!==e&&a!==n)return a}else if(r===!1&&Ft(n)&&e!==n)return null}return!1}function Ur(i,t,e,n){const s=t._rootScopes,o=Au(t._fallback,e,n),r=[...i,...s],a=new Set;a.add(n);let l=Kl(a,r,e,o||e,n);return l===null||Ft(o)&&o!==e&&(l=Kl(a,r,o,l,n),l===null)?!1:Yr(Array.from(a),[""],s,o,()=>p0(t,e,n))}function Kl(i,t,e,n,s){for(;e;)e=g0(i,t,e,n,s);return e}function p0(i,t,e){const n=i._getTarget();t in n||(n[t]={});const s=n[t];return et(s)&&j(e)?e:s}function m0(i,t,e,n){let s;for(const o of t)if(s=Du(c0(o,i),e),Ft(s))return Xr(i,s)?Ur(e,n,i,s):s}function Du(i,t){for(const e of t){if(!e)continue;const n=e[i];if(Ft(n))return n}}function Gl(i){let t=i._keys;return t||(t=i._keys=b0(i._scopes)),t}function b0(i){const t=new Set;for(const e of i)for(const n of Object.keys(e).filter(s=>!s.startsWith("_")))t.add(n);return Array.from(t)}function Ou(i,t,e,n){const{iScale:s}=i,{key:o="r"}=this._parsing,r=new Array(n);let a,l,c,h;for(a=0,l=n;ati==="x"?"y":"x";function x0(i,t,e,n){const s=i.skip?t:i,o=t,r=e.skip?t:e,a=nr(o,s),l=nr(r,o);let c=a/(a+l),h=l/(a+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const u=n*c,d=n*h;return{previous:{x:o.x-u*(r.x-s.x),y:o.y-u*(r.y-s.y)},next:{x:o.x+d*(r.x-s.x),y:o.y+d*(r.y-s.y)}}}function y0(i,t,e){const n=i.length;let s,o,r,a,l,c=Si(i,0);for(let h=0;h!c.skip)),t.cubicInterpolationMode==="monotone")w0(i,s);else{let c=n?i[i.length-1]:i[0];for(o=0,r=i.length;owindow.getComputedStyle(i,null);function S0(i,t){return no(i).getPropertyValue(t)}const P0=["top","right","bottom","left"];function ei(i,t,e){const n={};e=e?"-"+e:"";for(let s=0;s<4;s++){const o=P0[s];n[o]=parseFloat(i[t+"-"+o+e])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}const C0=(i,t,e)=>(i>0||t>0)&&(!e||!e.shadowRoot);function A0(i,t){const e=i.touches,n=e&&e.length?e[0]:i,{offsetX:s,offsetY:o}=n;let r=!1,a,l;if(C0(s,o,i.target))a=s,l=o;else{const c=t.getBoundingClientRect();a=n.clientX-c.left,l=n.clientY-c.top,r=!0}return{x:a,y:l,box:r}}function Xe(i,t){if("native"in i)return i;const{canvas:e,currentDevicePixelRatio:n}=t,s=no(e),o=s.boxSizing==="border-box",r=ei(s,"padding"),a=ei(s,"border","width"),{x:l,y:c,box:h}=A0(i,e),u=r.left+(h&&a.left),d=r.top+(h&&a.top);let{width:f,height:g}=t;return o&&(f-=r.width+a.width,g-=r.height+a.height),{x:Math.round((l-u)/f*e.width/n),y:Math.round((c-d)/g*e.height/n)}}function D0(i,t,e){let n,s;if(t===void 0||e===void 0){const o=qr(i);if(!o)t=i.clientWidth,e=i.clientHeight;else{const r=o.getBoundingClientRect(),a=no(o),l=ei(a,"border","width"),c=ei(a,"padding");t=r.width-c.width-l.width,e=r.height-c.height-l.height,n=js(a.maxWidth,o,"clientWidth"),s=js(a.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:n||$s,maxHeight:s||$s}}const To=i=>Math.round(i*10)/10;function O0(i,t,e,n){const s=no(i),o=ei(s,"margin"),r=js(s.maxWidth,i,"clientWidth")||$s,a=js(s.maxHeight,i,"clientHeight")||$s,l=D0(i,t,e);let{width:c,height:h}=l;if(s.boxSizing==="content-box"){const u=ei(s,"border","width"),d=ei(s,"padding");c-=d.width+u.width,h-=d.height+u.height}return c=Math.max(0,c-o.width),h=Math.max(0,n?Math.floor(c/n):h-o.height),c=To(Math.min(c,r,l.maxWidth)),h=To(Math.min(h,a,l.maxHeight)),c&&!h&&(h=To(c/2)),{width:c,height:h}}function Zl(i,t,e){const n=t||1,s=Math.floor(i.height*n),o=Math.floor(i.width*n);i.height=s/n,i.width=o/n;const r=i.canvas;return r.style&&(e||!r.style.height&&!r.style.width)&&(r.style.height=`${i.height}px`,r.style.width=`${i.width}px`),i.currentDevicePixelRatio!==n||r.height!==s||r.width!==o?(i.currentDevicePixelRatio=n,r.height=s,r.width=o,i.ctx.setTransform(n,0,0,n,0,0),!0):!1}const T0=function(){let i=!1;try{const t={get passive(){return i=!0,!1}};window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch{}return i}();function Jl(i,t){const e=S0(i,t),n=e&&e.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function Ue(i,t,e,n){return{x:i.x+e*(t.x-i.x),y:i.y+e*(t.y-i.y)}}function L0(i,t,e,n){return{x:i.x+e*(t.x-i.x),y:n==="middle"?e<.5?i.y:t.y:n==="after"?e<1?i.y:t.y:e>0?t.y:i.y}}function R0(i,t,e,n){const s={x:i.cp2x,y:i.cp2y},o={x:t.cp1x,y:t.cp1y},r=Ue(i,s,e),a=Ue(s,o,e),l=Ue(o,t,e),c=Ue(r,a,e),h=Ue(a,l,e);return Ue(c,h,e)}const Ql=new Map;function E0(i,t){t=t||{};const e=i+JSON.stringify(t);let n=Ql.get(e);return n||(n=new Intl.NumberFormat(i,t),Ql.set(e,n)),n}function Fn(i,t,e){return E0(t,e).format(i)}const I0=function(i,t){return{x(e){return i+i+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,n){return e-n},leftForLtr(e,n){return e-n}}},F0=function(){return{x(i){return i},setWidth(i){},textAlign(i){return i},xPlus(i,t){return i+t},leftForLtr(i,t){return i}}};function Lo(i,t,e){return i?I0(t,e):F0()}function $0(i,t){let e,n;(t==="ltr"||t==="rtl")&&(e=i.canvas.style,n=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),i.prevTextDirection=n)}function z0(i,t){t!==void 0&&(delete i.prevTextDirection,i.canvas.style.setProperty("direction",t[0],t[1]))}function Ru(i){return i==="angle"?{between:Sn,compare:v_,normalize:Bt}:{between:zs,compare:(t,e)=>t-e,normalize:t=>t}}function tc({start:i,end:t,count:e,loop:n,style:s}){return{start:i%e,end:t%e,loop:n&&(t-i+1)%e===0,style:s}}function B0(i,t,e){const{property:n,start:s,end:o}=e,{between:r,normalize:a}=Ru(n),l=t.length;let{start:c,end:h,loop:u}=i,d,f;if(u){for(c+=l,h+=l,d=0,f=l;dl(s,v,_)&&a(s,v)!==0,y=()=>a(o,_)===0||l(o,v,_),k=()=>p||b(),w=()=>!p||y();for(let M=h,S=h;M<=u;++M)x=t[M%r],!x.skip&&(_=c(x[n]),_!==v&&(p=l(_,s,o),m===null&&k()&&(m=a(_,s)===0?M:S),m!==null&&w()&&(g.push(tc({start:m,end:M,loop:d,count:r,style:f})),m=null),S=M,v=_));return m!==null&&g.push(tc({start:m,end:u,loop:d,count:r,style:f})),g}function V0(i,t){const e=[],n=i.segments;for(let s=0;ss&&i[o%t].skip;)o--;return o%=t,{start:s,end:o}}function j0(i,t,e,n){const s=i.length,o=[];let r=t,a=i[t],l;for(l=t+1;l<=e;++l){const c=i[l%s];c.skip||c.stop?a.skip||(n=!1,o.push({start:t%s,end:(l-1)%s,loop:n}),t=r=c.stop?l:null):(r=l,a.skip&&(t=l)),a=c}return r!==null&&o.push({start:t%s,end:r%s,loop:n}),o}function H0(i,t){const e=i.points,n=i.options.spanGaps,s=e.length;if(!s)return[];const o=!!i._loop,{start:r,end:a}=W0(e,s,o,n);if(n===!0)return ec(i,[{start:r,end:a,loop:o}],e,t);const l=aa({chart:t,initial:e.initial,numSteps:r,currentStep:Math.min(n-e.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=gu.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((n,s)=>{if(!n.running||!n.items.length)return;const o=n.items;let r=o.length-1,a=!1,l;for(;r>=0;--r)l=o[r],l._active?(l._total>n.duration&&(n.duration=l._total),l.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(s.draw(),this._notify(s,n,t,"progress")),o.length||(n.running=!1,this._notify(s,n,t,"complete"),n.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let n=e.get(t);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,n)),n}listen(t,e,n){this._getAnims(t).listeners[e].push(n)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((n,s)=>Math.max(n,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const n=e.items;let s=n.length-1;for(;s>=0;--s)n[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var se=new U0;const nc="transparent",q0={boolean(i,t,e){return e>.5?t:i},color(i,t,e){const n=Ul(i||nc),s=n.valid&&Ul(t||nc);return s&&s.valid?s.mix(n,e).hexString():t},number(i,t,e){return i+(t-i)*e}};class K0{constructor(t,e,n,s){const o=e[n];s=ns([t.to,s,o,t.from]);const r=ns([t.from,o,s]);this._active=!0,this._fn=t.fn||q0[t.type||typeof r],this._easing=mn[t.easing]||mn.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=n,this._from=r,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,n){if(this._active){this._notify(!1);const s=this._target[this._prop],o=n-this._start,r=this._duration-o;this._start=n,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=ns([t.to,e,s,t.from]),this._from=ns([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,n=this._duration,s=this._prop,o=this._from,r=this._loop,a=this._to;let l;if(this._active=o!==a&&(r||e1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,n)=>{t.push({res:e,rej:n})})}_notify(t){const e=t?"res":"rej",n=this._promises||[];for(let s=0;si!=="onProgress"&&i!=="onComplete"&&i!=="fn"});B.set("animations",{colors:{type:"color",properties:Z0},numbers:{type:"number",properties:G0}});B.describe("animations",{_fallback:"animation"});B.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:i=>i|0}}}});class Eu{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!j(t))return;const e=this._properties;Object.getOwnPropertyNames(t).forEach(n=>{const s=t[n];if(!j(s))return;const o={};for(const r of J0)o[r]=s[r];(et(s.properties)&&s.properties||[n]).forEach(r=>{(r===n||!e.has(r))&&e.set(r,o)})})}_animateOptions(t,e){const n=e.options,s=tx(t,n);if(!s)return[];const o=this._createAnimations(s,n);return n.$shared&&Q0(t.options.$animations,n).then(()=>{t.options=n},()=>{}),o}_createAnimations(t,e){const n=this._properties,s=[],o=t.$animations||(t.$animations={}),r=Object.keys(e),a=Date.now();let l;for(l=r.length-1;l>=0;--l){const c=r[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,e));continue}const h=e[c];let u=o[c];const d=n.get(c);if(u)if(d&&u.active()){u.update(d,h,a);continue}else u.cancel();if(!d||!d.duration){t[c]=h;continue}o[c]=u=new K0(d,t,c,h),s.push(u)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const n=this._createAnimations(t,e);if(n.length)return se.add(this._chart,n),!0}}function Q0(i,t){const e=[],n=Object.keys(t);for(let s=0;s0||!e&&o<0)return s.index}return null}function lc(i,t){const{chart:e,_cachedMeta:n}=i,s=e._stacks||(e._stacks={}),{iScale:o,vScale:r,index:a}=n,l=o.axis,c=r.axis,h=sx(o,r,n),u=t.length;let d;for(let f=0;fe[n].axis===t).shift()}function ax(i,t){return Fe(i,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function lx(i,t,e){return Fe(i,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function Ei(i,t){const e=i.controller.index,n=i.vScale&&i.vScale.axis;if(n){t=t||i._parsed;for(const s of t){const o=s._stacks;if(!o||o[n]===void 0||o[n][e]===void 0)return;delete o[n][e]}}}const Eo=i=>i==="reset"||i==="none",cc=(i,t)=>t?i:Object.assign({},i),cx=(i,t,e)=>i&&!t.hidden&&t._stacked&&{keys:Iu(e,!0),values:null};class Wt{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=rc(t.vScale,t),this.addElements()}updateIndex(t){this.index!==t&&Ei(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,n=this.getDataset(),s=(u,d,f,g)=>u==="x"?d:u==="r"?g:f,o=e.xAxisID=V(n.xAxisID,Ro(t,"x")),r=e.yAxisID=V(n.yAxisID,Ro(t,"y")),a=e.rAxisID=V(n.rAxisID,Ro(t,"r")),l=e.indexAxis,c=e.iAxisID=s(l,o,r,a),h=e.vAxisID=s(l,r,o,a);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(r),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Bl(this._data,this),t._stacked&&Ei(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),n=this._data;if(j(e))this._data=nx(e);else if(n!==e){if(n){Bl(n,this);const s=this._cachedMeta;Ei(s),s._parsed=[]}e&&Object.isExtensible(e)&&S_(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,n=this.getDataset();let s=!1;this._dataCheck();const o=e._stacked;e._stacked=rc(e.vScale,e),e.stack!==n.stack&&(s=!0,Ei(e),e.stack=n.stack),this._resyncElements(t),(s||o!==e._stacked)&&lc(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),n=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:n,_data:s}=this,{iScale:o,_stacked:r}=n,a=o.axis;let l=t===0&&e===s.length?!0:n._sorted,c=t>0&&n._parsed[t-1],h,u,d;if(this._parsing===!1)n._parsed=s,n._sorted=!0,d=s;else{et(s[t])?d=this.parseArrayData(n,s,t,e):j(s[t])?d=this.parseObjectData(n,s,t,e):d=this.parsePrimitiveData(n,s,t,e);const f=()=>u[a]===null||c&&u[a]p||u=0;--d)if(!g()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,n=[];let s,o,r;for(s=0,o=e.length;s=0&&tthis.getContext(n,s),p=c.resolveNamedOptions(d,f,g,u);return p.$shared&&(p.$shared=l,o[r]=Object.freeze(cc(p,l))),p}_resolveAnimations(t,e,n){const s=this.chart,o=this._cachedDataOpts,r=`animation-${e}`,a=o[r];if(a)return a;let l;if(s.options.animation!==!1){const h=this.chart.config,u=h.datasetAnimationScopeKeys(this._type,e),d=h.getOptionScopes(this.getDataset(),u);l=h.createResolver(d,this.getContext(t,n,e))}const c=new Eu(s,l&&l.animations);return l&&l._cacheable&&(o[r]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Eo(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const n=this.resolveDataElementOptions(t,e),s=this._sharedOptions,o=this.getSharedOptions(n),r=this.includeOptions(e,o)||o!==s;return this.updateSharedOptions(o,e,n),{sharedOptions:o,includeOptions:r}}updateElement(t,e,n,s){Eo(s)?Object.assign(t,n):this._resolveAnimations(e,s).update(t,n)}updateSharedOptions(t,e,n){t&&!Eo(e)&&this._resolveAnimations(void 0,e).update(t,n)}_setStyle(t,e,n,s){t.active=s;const o=this.getStyle(e,s);this._resolveAnimations(e,n,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,n){this._setStyle(t,n,"active",!1)}setHoverStyle(t,e,n){this._setStyle(t,n,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,n=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const s=n.length,o=e.length,r=Math.min(o,s);r&&this.parse(0,r),o>s?this._insertElements(s,o-s,t):o{for(c.length+=e,a=c.length-1;a>=r;a--)c[a]=c[a-e]};for(l(o),a=t;as-o))}return i._cache.$bar}function ux(i){const t=i.iScale,e=hx(t,i.type);let n=t._length,s,o,r,a;const l=()=>{r===32767||r===-32768||(Ft(a)&&(n=Math.min(n,Math.abs(r-a)||n)),a=r)};for(s=0,o=e.length;s0?s[i-1]:null,a=iMath.abs(a)&&(l=a,c=r),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:s,end:o,min:r,max:a}}function Fu(i,t,e,n){return et(i)?gx(i,t,e,n):t[e.axis]=e.parse(i,n),t}function hc(i,t,e,n){const s=i.iScale,o=i.vScale,r=s.getLabels(),a=s===o,l=[];let c,h,u,d;for(c=e,h=e+n;c=e?1:-1)}function mx(i){let t,e,n,s,o;return i.horizontal?(t=i.base>i.x,e="left",n="right"):(t=i.basel.controller.options.grouped),o=n.options.stacked,r=[],a=l=>{const c=l.controller.getParsed(e),h=c&&c[l.vScale.axis];if(q(h)||isNaN(h))return!0};for(const l of s)if(!(e!==void 0&&a(l))&&((o===!1||r.indexOf(l.stack)===-1||o===void 0&&l.stack===void 0)&&r.push(l.stack),l.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,n){const s=this._getStacks(t,n),o=e!==void 0?s.indexOf(e):-1;return o===-1?s.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,n=e.iScale,s=[];let o,r;for(o=0,r=e.data.length;o=0;--n)e=Math.max(e,t[n].size(this.resolveDataElementOptions(n))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,{xScale:n,yScale:s}=e,o=this.getParsed(t),r=n.getLabelForValue(o.x),a=s.getLabelForValue(o.y),l=o._custom;return{label:e.label,value:"("+r+", "+a+(l?", "+l:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,n,s){const o=s==="reset",{iScale:r,vScale:a}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(e,s),h=r.axis,u=a.axis;for(let d=e;dSn(v,a,l,!0)?1:Math.max(b,b*e,y,y*e),g=(v,b,y)=>Sn(v,a,l,!0)?-1:Math.min(b,b*e,y,y*e),p=f(0,c,u),m=f(lt,h,d),_=g(ct,c,u),x=g(ct+lt,h,d);n=(p-_)/2,s=(m-x)/2,o=-(p+_)/2,r=-(m+x)/2}return{ratioX:n,ratioY:s,offsetX:o,offsetY:r}}class $n extends Wt{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const n=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=n;else{let o=l=>+n[l];if(j(n[t])){const{key:l="value"}=this._parsing;o=c=>+Le(n[c],l)}let r,a;for(r=t,a=t+e;r0&&!isNaN(t)?K*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,n=this.chart,s=n.data.labels||[],o=Fn(e._parsed[t],n.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let e=0;const n=this.chart;let s,o,r,a,l;if(!t){for(s=0,o=n.data.datasets.length;si!=="spacing",_indexable:i=>i!=="spacing"};$n.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(i){const t=i.data;if(t.labels.length&&t.datasets.length){const{labels:{pointStyle:e}}=i.legend.options;return t.labels.map((n,s)=>{const r=i.getDatasetMeta(0).controller.getStyle(s);return{text:n,fillStyle:r.backgroundColor,strokeStyle:r.borderColor,lineWidth:r.borderWidth,pointStyle:e,hidden:!i.getDataVisibility(s),index:s}})}return[]}},onClick(i,t,e){e.chart.toggleDataVisibility(t.index),e.chart.update()}},tooltip:{callbacks:{title(){return""},label(i){let t=i.label;const e=": "+i.formattedValue;return et(t)?(t=t.slice(),t[0]+=e):t+=e,t}}}}};class Zr extends Wt{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:n,data:s=[],_dataset:o}=e,r=this.chart._animationsDisabled;let{start:a,count:l}=mu(e,s,r);this._drawStart=a,this._drawCount=l,bu(e)&&(a=0,l=s.length),n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!o._decimated,n.points=s;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(n,void 0,{animated:!r,options:c},t),this.updateElements(s,a,l,t)}updateElements(t,e,n,s){const o=s==="reset",{iScale:r,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:h,includeOptions:u}=this._getSharedOptions(e,s),d=r.axis,f=a.axis,{spanGaps:g,segment:p}=this.options,m=ki(g)?g:Number.POSITIVE_INFINITY,_=this.chart._animationsDisabled||o||s==="none";let x=e>0&&this.getParsed(e-1);for(let v=e;v0&&Math.abs(y[d]-x[d])>m,p&&(k.parsed=y,k.raw=c.data[v]),u&&(k.options=h||this.resolveDataElementOptions(v,b.active?"active":s)),_||this.updateElement(b,v,k,s),x=y}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,n=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return n;const o=s[0].size(this.resolveDataElementOptions(0)),r=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(n,o,r)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}Zr.id="line";Zr.defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};Zr.overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};class Jr extends Wt{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,n=this.chart,s=n.data.labels||[],o=Fn(e._parsed[t].r,n.options.locale);return{label:s[t]||"",value:o}}parseObjectData(t,e,n,s){return Ou.bind(this)(t,e,n,s)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((n,s)=>{const o=this.getParsed(s).r;!isNaN(o)&&this.chart.getDataVisibility(s)&&(oe.max&&(e.max=o))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,n=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(s/2,0),r=Math.max(n.cutoutPercentage?o/100*n.cutoutPercentage:1,0),a=(o-r)/t.getVisibleDatasetCount();this.outerRadius=o-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(t,e,n,s){const o=s==="reset",r=this.chart,l=r.options.animation,c=this._cachedMeta.rScale,h=c.xCenter,u=c.yCenter,d=c.getIndexAngle(0)-.5*ct;let f=d,g;const p=360/this.countVisibleElements();for(g=0;g{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,n){return this.chart.getDataVisibility(t)?Vt(this.resolveDataElementOptions(t,e).angle||n):0}}Jr.id="polarArea";Jr.defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};Jr.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(i){const t=i.data;if(t.labels.length&&t.datasets.length){const{labels:{pointStyle:e}}=i.legend.options;return t.labels.map((n,s)=>{const r=i.getDatasetMeta(0).controller.getStyle(s);return{text:n,fillStyle:r.backgroundColor,strokeStyle:r.borderColor,lineWidth:r.borderWidth,pointStyle:e,hidden:!i.getDataVisibility(s),index:s}})}return[]}},onClick(i,t,e){e.chart.toggleDataVisibility(t.index),e.chart.update()}},tooltip:{callbacks:{title(){return""},label(i){return i.chart.data.labels[i.dataIndex]+": "+i.formattedValue}}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};class $u extends $n{}$u.id="pie";$u.defaults={cutout:0,rotation:0,circumference:360,radius:"100%"};class Qr extends Wt{getLabelAndValue(t){const e=this._cachedMeta.vScale,n=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(n[e.axis])}}parseObjectData(t,e,n,s){return Ou.bind(this)(t,e,n,s)}update(t){const e=this._cachedMeta,n=e.dataset,s=e.data||[],o=e.iScale.getLabels();if(n.points=s,t!=="resize"){const r=this.resolveDatasetElementOptions(t);this.options.showLine||(r.borderWidth=0);const a={_loop:!0,_fullLoop:o.length===s.length,options:r};this.updateElement(n,void 0,a,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,n,s){const o=this._cachedMeta.rScale,r=s==="reset";for(let a=e;a{s[o]=n[o]&&n[o].active()?n[o]._to:this[o]}),s}}me.defaults={};me.defaultRoutes=void 0;const zu={values(i){return et(i)?i:""+i},numeric(i,t,e){if(i===0)return"0";const n=this.chart.options.locale;let s,o=i;if(e.length>1){const c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),o=vx(i,e)}const r=Et(Math.abs(o)),a=Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),Fn(i,n,l)},logarithmic(i,t,e){if(i===0)return"0";const n=i/Math.pow(10,Math.floor(Et(i)));return n===1||n===2||n===5?zu.numeric.call(this,i,t,e):""}};function vx(i,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&i!==Math.floor(i)&&(e=i-Math.floor(i)),e}var so={formatters:zu};B.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",grace:0,grid:{display:!0,lineWidth:1,drawBorder:!0,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(i,t)=>t.lineWidth,tickColor:(i,t)=>t.color,offset:!1,borderDash:[],borderDashOffset:0,borderWidth:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:so.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}});B.route("scale.ticks","color","","color");B.route("scale.grid","color","","borderColor");B.route("scale.grid","borderColor","","borderColor");B.route("scale.title","color","","color");B.describe("scale",{_fallback:!1,_scriptable:i=>!i.startsWith("before")&&!i.startsWith("after")&&i!=="callback"&&i!=="parser",_indexable:i=>i!=="borderDash"&&i!=="tickBorderDash"});B.describe("scales",{_fallback:"scale"});B.describe("scale.ticks",{_scriptable:i=>i!=="backdropPadding"&&i!=="callback",_indexable:i=>i!=="backdropPadding"});function wx(i,t){const e=i.options.ticks,n=e.maxTicksLimit||kx(i),s=e.major.enabled?Sx(t):[],o=s.length,r=s[0],a=s[o-1],l=[];if(o>n)return Px(t,l,s,o/n),l;const c=Mx(s,t,n);if(o>0){let h,u;const d=o>1?Math.round((a-r)/(o-1)):null;for(os(t,l,c,q(d)?0:r-d,r),h=0,u=o-1;hs)return l}return Math.max(s,1)}function Sx(i){const t=[];let e,n;for(e=0,n=i.length;ei==="left"?"right":i==="right"?"left":i,fc=(i,t,e)=>t==="top"||t==="left"?i[t]+e:i[t]-e;function gc(i,t){const e=[],n=i.length/t,s=i.length;let o=0;for(;or+a)))return l}function Ox(i,t){U(i,e=>{const n=e.gc,s=n.length/2;let o;if(s>t){for(o=0;on?n:e,n=s&&e>n?e:n,{min:Lt(e,Lt(n,e)),max:Lt(n,Lt(e,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){nt(this.options.beforeUpdate,[this])}update(t,e,n){const{beginAtZero:s,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=n=Object.assign({left:0,right:0,top:0,bottom:0},n),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+n.left+n.right:this.height+n.top+n.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=l0(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a=o||n<=1||!this.isHorizontal()){this.labelRotation=s;return}const h=this._getLabelSizes(),u=h.widest.width,d=h.highest.height,f=xt(this.chart.width-u,0,this.maxWidth);a=t.offset?this.maxWidth/n:f/(n-1),u+6>a&&(a=f/(n-(t.offset?.5:1)),l=this.maxHeight-Ii(t.grid)-e.padding-pc(t.title,this.chart.options.font),c=Math.sqrt(u*u+d*d),r=Br(Math.min(Math.asin(xt((h.highest.height+6)/a,-1,1)),Math.asin(xt(l/c,-1,1))-Math.asin(xt(d/c,-1,1)))),r=Math.max(s,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){nt(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){nt(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:n,title:s,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){const l=pc(s,e.options.font);if(a?(t.width=this.maxWidth,t.height=Ii(o)+l):(t.height=this.maxHeight,t.width=Ii(o)+l),n.display&&this.ticks.length){const{first:c,last:h,widest:u,highest:d}=this._getLabelSizes(),f=n.padding*2,g=Vt(this.labelRotation),p=Math.cos(g),m=Math.sin(g);if(a){const _=n.mirror?0:m*u.width+p*d.height;t.height=Math.min(this.maxHeight,t.height+_+f)}else{const _=n.mirror?0:p*u.width+m*d.height;t.width=Math.min(this.maxWidth,t.width+_+f)}this._calculatePadding(c,h,m,p)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,n,s){const{ticks:{align:o,padding:r},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,u=this.right-this.getPixelForTick(this.ticks.length-1);let d=0,f=0;l?c?(d=s*t.width,f=n*e.height):(d=n*t.height,f=s*e.width):o==="start"?f=e.width:o==="end"?d=t.width:o!=="inner"&&(d=t.width/2,f=e.width/2),this.paddingLeft=Math.max((d-h+r)*this.width/(this.width-h),0),this.paddingRight=Math.max((f-u+r)*this.width/(this.width-u),0)}else{let h=e.height/2,u=t.height/2;o==="start"?(h=0,u=t.height):o==="end"&&(h=e.height,u=0),this.paddingTop=h+r,this.paddingBottom=u+r}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){nt(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,n;for(e=0,n=t.length;e({width:o[w]||0,height:r[w]||0});return{first:k(0),last:k(e-1),widest:k(b),highest:k(y),widths:o,heights:r}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return w_(this._alignToPixels?We(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&ta*s?a/n:l/s:l*s0}_computeGridLineItems(t){const e=this.axis,n=this.chart,s=this.options,{grid:o,position:r}=s,a=o.offset,l=this.isHorizontal(),h=this.ticks.length+(a?1:0),u=Ii(o),d=[],f=o.setContext(this.getContext()),g=f.drawBorder?f.borderWidth:0,p=g/2,m=function(A){return We(n,A,g)};let _,x,v,b,y,k,w,M,S,P,D,O;if(r==="top")_=m(this.bottom),k=this.bottom-u,M=_-p,P=m(t.top)+p,O=t.bottom;else if(r==="bottom")_=m(this.top),P=t.top,O=m(t.bottom)-p,k=_+p,M=this.top+u;else if(r==="left")_=m(this.right),y=this.right-u,w=_-p,S=m(t.left)+p,D=t.right;else if(r==="right")_=m(this.left),S=t.left,D=m(t.right)-p,y=_+p,w=this.left+u;else if(e==="x"){if(r==="center")_=m((t.top+t.bottom)/2+.5);else if(j(r)){const A=Object.keys(r)[0],L=r[A];_=m(this.chart.scales[A].getPixelForValue(L))}P=t.top,O=t.bottom,k=_+p,M=k+u}else if(e==="y"){if(r==="center")_=m((t.left+t.right)/2);else if(j(r)){const A=Object.keys(r)[0],L=r[A];_=m(this.chart.scales[A].getPixelForValue(L))}y=_-p,w=y-u,S=t.left,D=t.right}const H=V(s.ticks.maxTicksLimit,h),F=Math.max(1,Math.ceil(h/H));for(x=0;xo.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const e=this.options.grid,n=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,r;const a=(l,c,h)=>{!h.width||!h.color||(n.save(),n.lineWidth=h.width,n.strokeStyle=h.color,n.setLineDash(h.borderDash||[]),n.lineDashOffset=h.borderDashOffset,n.beginPath(),n.moveTo(l.x,l.y),n.lineTo(c.x,c.y),n.stroke(),n.restore())};if(e.display)for(o=0,r=s.length;o{this.draw(s)}}]:[{z:n,draw:s=>{this.drawBackground(),this.drawGrid(s),this.drawTitle()}},{z:n+1,draw:()=>{this.drawBorder()}},{z:e,draw:s=>{this.drawLabels(s)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+"AxisID",s=[];let o,r;for(o=0,r=e.length;o{const n=e.split("."),s=n.pop(),o=[i].concat(n).join("."),r=t[e].split("."),a=r.pop(),l=r.join(".");B.route(o,s,l,a)})}function $x(i){return"id"in i&&"defaults"in i}class zx{constructor(){this.controllers=new rs(Wt,"datasets",!0),this.elements=new rs(me,"elements"),this.plugins=new rs(Object,"plugins"),this.scales=new rs(oi,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,n){[...e].forEach(s=>{const o=n||this._getRegistryForType(s);n||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):U(s,r=>{const a=n||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,e,n){const s=zr(t);nt(n["before"+s],[],n),e[t](n),nt(n["after"+s],[],n)}_getRegistryForType(t){for(let e=0;e0&&this.getParsed(e-1);for(let b=e;b0&&Math.abs(k[f]-v[f])>_,m&&(w.parsed=k,w.raw=c.data[b]),d&&(w.options=u||this.resolveDataElementOptions(b,y.active?"active":s)),x||this.updateElement(y,b,w,s),v=k}this.updateSharedOptions(u,s,h)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let a=0;for(let l=e.length-1;l>=0;--l)a=Math.max(a,e[l].size(this.resolveDataElementOptions(l))/2);return a>0&&a}const n=t.dataset,s=n.options&&n.options.borderWidth||0;if(!e.length)return s;const o=e[0].size(this.resolveDataElementOptions(0)),r=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,o,r)/2}}ta.id="scatter";ta.defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};ta.overrides={interaction:{mode:"point"},plugins:{tooltip:{callbacks:{title(){return""},label(i){return"("+i.label+", "+i.formattedValue+")"}}}},scales:{x:{type:"linear"},y:{type:"linear"}}};function je(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class ar{constructor(t){this.options=t||{}}init(t){}formats(){return je()}parse(t,e){return je()}format(t,e){return je()}add(t,e,n){return je()}diff(t,e,n){return je()}startOf(t,e,n){return je()}endOf(t,e){return je()}}ar.override=function(i){Object.assign(ar.prototype,i)};var Bx={_date:ar};function Nx(i,t,e,n){const{controller:s,data:o,_sorted:r}=i,a=s._cachedMeta.iScale;if(a&&t===a.axis&&t!=="r"&&r&&o.length){const l=a._reversePixels?k_:Ze;if(n){if(s._sharedOptions){const c=o[0],h=typeof c.getRange=="function"&&c.getRange(t);if(h){const u=l(o,t,e-h),d=l(o,t,e+h);return{lo:u.lo,hi:d.hi}}}}else return l(o,t,e)}return{lo:0,hi:o.length-1}}function zn(i,t,e,n,s){const o=i.getSortedVisibleDatasetMetas(),r=e[t];for(let a=0,l=o.length;a{l[r](t[e],s)&&(o.push({element:l,datasetIndex:c,index:h}),a=a||l.inRange(t.x,t.y,s))}),n&&!a?[]:o}var Hx={evaluateInteractionItems:zn,modes:{index(i,t,e,n){const s=Xe(t,i),o=e.axis||"x",r=e.includeInvisible||!1,a=e.intersect?Fo(i,s,o,n,r):$o(i,s,o,!1,n,r),l=[];return a.length?(i.getSortedVisibleDatasetMetas().forEach(c=>{const h=a[0].index,u=c.data[h];u&&!u.skip&&l.push({element:u,datasetIndex:c.index,index:h})}),l):[]},dataset(i,t,e,n){const s=Xe(t,i),o=e.axis||"xy",r=e.includeInvisible||!1;let a=e.intersect?Fo(i,s,o,n,r):$o(i,s,o,!1,n,r);if(a.length>0){const l=a[0].datasetIndex,c=i.getDatasetMeta(l).data;a=[];for(let h=0;he.pos===t)}function bc(i,t){return i.filter(e=>Bu.indexOf(e.pos)===-1&&e.box.axis===t)}function $i(i,t){return i.sort((e,n)=>{const s=t?n:e,o=t?e:n;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function Yx(i){const t=[];let e,n,s,o,r,a;for(e=0,n=(i||[]).length;ec.box.fullSize),!0),n=$i(Fi(t,"left"),!0),s=$i(Fi(t,"right")),o=$i(Fi(t,"top"),!0),r=$i(Fi(t,"bottom")),a=bc(t,"x"),l=bc(t,"y");return{fullSize:e,leftAndTop:n.concat(o),rightAndBottom:s.concat(l).concat(r).concat(a),chartArea:Fi(t,"chartArea"),vertical:n.concat(s).concat(l),horizontal:o.concat(r).concat(a)}}function _c(i,t,e,n){return Math.max(i[e],t[e])+Math.max(i[n],t[n])}function Nu(i,t){i.top=Math.max(i.top,t.top),i.left=Math.max(i.left,t.left),i.bottom=Math.max(i.bottom,t.bottom),i.right=Math.max(i.right,t.right)}function Kx(i,t,e,n){const{pos:s,box:o}=e,r=i.maxPadding;if(!j(s)){e.size&&(i[s]-=e.size);const u=n[e.stack]||{size:0,count:1};u.size=Math.max(u.size,e.horizontal?o.height:o.width),e.size=u.size/u.count,i[s]+=e.size}o.getPadding&&Nu(r,o.getPadding());const a=Math.max(0,t.outerWidth-_c(r,i,"left","right")),l=Math.max(0,t.outerHeight-_c(r,i,"top","bottom")),c=a!==i.w,h=l!==i.h;return i.w=a,i.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function Gx(i){const t=i.maxPadding;function e(n){const s=Math.max(t[n]-i[n],0);return i[n]+=s,s}i.y+=e("top"),i.x+=e("left"),e("right"),e("bottom")}function Zx(i,t){const e=t.maxPadding;function n(s){const o={left:0,top:0,right:0,bottom:0};return s.forEach(r=>{o[r]=Math.max(t[r],e[r])}),o}return n(i?["left","right"]:["top","bottom"])}function rn(i,t,e,n){const s=[];let o,r,a,l,c,h;for(o=0,r=i.length,c=0;o{typeof p.beforeLayout=="function"&&p.beforeLayout()});const h=l.reduce((p,m)=>m.box.options&&m.box.options.display===!1?p:p+1,0)||1,u=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/h,hBoxMaxHeight:r/2}),d=Object.assign({},s);Nu(d,$t(n));const f=Object.assign({maxPadding:d,w:o,h:r,x:s.left,y:s.top},s),g=Ux(l.concat(c),u);rn(a.fullSize,f,u,g),rn(l,f,u,g),rn(c,f,u,g)&&rn(l,f,u,g),Gx(f),xc(a.leftAndTop,f,u,g),f.x+=f.w,f.y+=f.h,xc(a.rightAndBottom,f,u,g),i.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},U(a.chartArea,p=>{const m=p.box;Object.assign(m,i.chartArea),m.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class Vu{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,n){}removeEventListener(t,e,n){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,n,s){return e=Math.max(0,e||t.width),n=n||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):n)}}isAttached(t){return!0}updateConfig(t){}}class Jx extends Vu{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const ks="$chartjs",Qx={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},yc=i=>i===null||i==="";function ty(i,t){const e=i.style,n=i.getAttribute("height"),s=i.getAttribute("width");if(i[ks]={initial:{height:n,width:s,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",yc(s)){const o=Jl(i,"width");o!==void 0&&(i.width=o)}if(yc(n))if(i.style.height==="")i.height=i.width/(t||2);else{const o=Jl(i,"height");o!==void 0&&(i.height=o)}return i}const Wu=T0?{passive:!0}:!1;function ey(i,t,e){i.addEventListener(t,e,Wu)}function iy(i,t,e){i.canvas.removeEventListener(t,e,Wu)}function ny(i,t){const e=Qx[i.type]||i.type,{x:n,y:s}=Xe(i,t);return{type:e,chart:t,native:i,x:n!==void 0?n:null,y:s!==void 0?s:null}}function Hs(i,t){for(const e of i)if(e===t||e.contains(t))return!0}function sy(i,t,e){const n=i.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||Hs(a.addedNodes,n),r=r&&!Hs(a.removedNodes,n);r&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function oy(i,t,e){const n=i.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||Hs(a.removedNodes,n),r=r&&!Hs(a.addedNodes,n);r&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}const Cn=new Map;let vc=0;function ju(){const i=window.devicePixelRatio;i!==vc&&(vc=i,Cn.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function ry(i,t){Cn.size||window.addEventListener("resize",ju),Cn.set(i,t)}function ay(i){Cn.delete(i),Cn.size||window.removeEventListener("resize",ju)}function ly(i,t,e){const n=i.canvas,s=n&&qr(n);if(!s)return;const o=pu((a,l)=>{const c=s.clientWidth;e(a,l),c{const l=a[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||o(c,h)});return r.observe(s),ry(i,o),r}function zo(i,t,e){e&&e.disconnect(),t==="resize"&&ay(i)}function cy(i,t,e){const n=i.canvas,s=pu(o=>{i.ctx!==null&&e(ny(o,i))},i,o=>{const r=o[0];return[r,r.offsetX,r.offsetY]});return ey(n,t,s),s}class hy extends Vu{acquireContext(t,e){const n=t&&t.getContext&&t.getContext("2d");return n&&n.canvas===t?(ty(t,e),n):null}releaseContext(t){const e=t.canvas;if(!e[ks])return!1;const n=e[ks].initial;["height","width"].forEach(o=>{const r=n[o];q(r)?e.removeAttribute(o):e.setAttribute(o,r)});const s=n.style||{};return Object.keys(s).forEach(o=>{e.style[o]=s[o]}),e.width=e.width,delete e[ks],!0}addEventListener(t,e,n){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),r={attach:sy,detach:oy,resize:ly}[e]||cy;s[e]=r(t,e,n)}removeEventListener(t,e){const n=t.$proxies||(t.$proxies={}),s=n[e];if(!s)return;({attach:zo,detach:zo,resize:zo}[e]||iy)(t,e,s),n[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,n,s){return O0(t,e,n,s)}isAttached(t){const e=qr(t);return!!(e&&e.isConnected)}}function uy(i){return!Lu()||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?Jx:hy}class dy{constructor(){this._init=[]}notify(t,e,n,s){e==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const o=s?this._descriptors(t).filter(s):this._descriptors(t),r=this._notify(o,t,e,n);return e==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall")),r}_notify(t,e,n,s){s=s||{};for(const o of t){const r=o.plugin,a=r[n],l=[e,s,o.options];if(nt(a,l,r)===!1&&s.cancelable)return!1}return!0}invalidate(){q(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const n=t&&t.config,s=V(n.options&&n.options.plugins,{}),o=fy(n);return s===!1&&!e?[]:py(t,o,s,e)}_notifyStateChanges(t){const e=this._oldCache||[],n=this._cache,s=(o,r)=>o.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(s(e,n),t,"stop"),this._notify(s(n,e),t,"start")}}function fy(i){const t={},e=[],n=Object.keys(Ut.plugins.items);for(let o=0;o{const l=n[a];if(!j(l))return console.error(`Invalid scale configuration for scale: ${a}`);if(l._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);const c=cr(a,l),h=_y(c,s),u=e.scales||{};o[c]=o[c]||a,r[a]=gn(Object.create(null),[{axis:c},l,u[c],u[h]])}),i.data.datasets.forEach(a=>{const l=a.type||i.type,c=a.indexAxis||lr(l,t),u=(si[l]||{}).scales||{};Object.keys(u).forEach(d=>{const f=by(d,c),g=a[f+"AxisID"]||o[f]||f;r[g]=r[g]||Object.create(null),gn(r[g],[{axis:f},n[g],u[d]])})}),Object.keys(r).forEach(a=>{const l=r[a];gn(l,[B.scales[l.type],B.scale])}),r}function Hu(i){const t=i.options||(i.options={});t.plugins=V(t.plugins,{}),t.scales=yy(i,t)}function Yu(i){return i=i||{},i.datasets=i.datasets||[],i.labels=i.labels||[],i}function vy(i){return i=i||{},i.data=Yu(i.data),Hu(i),i}const wc=new Map,Xu=new Set;function cs(i,t){let e=wc.get(i);return e||(e=t(),wc.set(i,e),Xu.add(e)),e}const zi=(i,t,e)=>{const n=Le(t,e);n!==void 0&&i.add(n)};class wy{constructor(t){this._config=vy(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Yu(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),Hu(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return cs(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return cs(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return cs(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,n=this.type;return cs(`${n}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const n=this._scopeCache;let s=n.get(t);return(!s||e)&&(s=new Map,n.set(t,s)),s}getOptionScopes(t,e,n){const{options:s,type:o}=this,r=this._cachedScopes(t,n),a=r.get(e);if(a)return a;const l=new Set;e.forEach(h=>{t&&(l.add(t),h.forEach(u=>zi(l,t,u))),h.forEach(u=>zi(l,s,u)),h.forEach(u=>zi(l,si[o]||{},u)),h.forEach(u=>zi(l,B,u)),h.forEach(u=>zi(l,or,u))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Xu.has(e)&&r.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,si[e]||{},B.datasets[e]||{},{type:e},B,or]}resolveNamedOptions(t,e,n,s=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=kc(this._resolverCache,t,s);let l=r;if(My(r,e)){o.$shared=!1,n=Re(n)?n():n;const c=this.createResolver(t,n,a);l=Mi(r,n,c)}for(const c of e)o[c]=l[c];return o}createResolver(t,e,n=[""],s){const{resolver:o}=kc(this._resolverCache,t,n);return j(e)?Mi(o,e,void 0,s):o}}function kc(i,t,e){let n=i.get(t);n||(n=new Map,i.set(t,n));const s=e.join();let o=n.get(s);return o||(o={resolver:Yr(t,e),subPrefixes:e.filter(a=>!a.toLowerCase().includes("hover"))},n.set(s,o)),o}const ky=i=>j(i)&&Object.getOwnPropertyNames(i).reduce((t,e)=>t||Re(i[e]),!1);function My(i,t){const{isScriptable:e,isIndexable:n}=Pu(i);for(const s of t){const o=e(s),r=n(s),a=(r||o)&&i[s];if(o&&(Re(a)||ky(a))||r&&et(a))return!0}return!1}var Sy="3.9.1";const Py=["top","bottom","left","right","chartArea"];function Mc(i,t){return i==="top"||i==="bottom"||Py.indexOf(i)===-1&&t==="x"}function Sc(i,t){return function(e,n){return e[i]===n[i]?e[t]-n[t]:e[i]-n[i]}}function Pc(i){const t=i.chart,e=t.options.animation;t.notifyPlugins("afterRender"),nt(e&&e.onComplete,[i],t)}function Cy(i){const t=i.chart,e=t.options.animation;nt(e&&e.onProgress,[i],t)}function Uu(i){return Lu()&&typeof i=="string"?i=document.getElementById(i):i&&i.length&&(i=i[0]),i&&i.canvas&&(i=i.canvas),i}const Ys={},qu=i=>{const t=Uu(i);return Object.values(Ys).filter(e=>e.canvas===t).pop()};function Ay(i,t,e){const n=Object.keys(i);for(const s of n){const o=+s;if(o>=t){const r=i[s];delete i[s],(e>0||o>t)&&(i[o+e]=r)}}}function Dy(i,t,e,n){return!e||i.type==="mouseout"?null:n?t:i}class ea{constructor(t,e){const n=this.config=new wy(e),s=Uu(t),o=qu(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const r=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||uy(s)),this.platform.updateConfig(n);const a=this.platform.acquireContext(s,r.aspectRatio),l=a&&a.canvas,c=l&&l.height,h=l&&l.width;if(this.id=h_(),this.ctx=a,this.canvas=l,this.width=h,this.height=c,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new dy,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=P_(u=>this.update(u),r.resizeDelay||0),this._dataChanges=[],Ys[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}se.listen(this,"complete",Pc),se.listen(this,"progress",Cy),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:n,height:s,_aspectRatio:o}=this;return q(t)?e&&o?o:s?n/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Zl(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return ql(this.canvas,this.ctx),this}stop(){return se.stop(this),this}resize(t,e){se.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const n=this.options,s=this.canvas,o=n.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(s,t,e,o),a=n.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,Zl(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),nt(n.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};U(e,(n,s)=>{n.id=s})}buildOrUpdateScales(){const t=this.options,e=t.scales,n=this.scales,s=Object.keys(n).reduce((r,a)=>(r[a]=!1,r),{});let o=[];e&&(o=o.concat(Object.keys(e).map(r=>{const a=e[r],l=cr(r,a),c=l==="r",h=l==="x";return{options:a,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),U(o,r=>{const a=r.options,l=a.id,c=cr(l,a),h=V(a.type,r.dtype);(a.position===void 0||Mc(a.position,c)!==Mc(r.dposition))&&(a.position=r.dposition),s[l]=!0;let u=null;if(l in n&&n[l].type===h)u=n[l];else{const d=Ut.getScale(h);u=new d({id:l,type:h,ctx:this.ctx,chart:this}),n[u.id]=u}u.init(a,t)}),U(s,(r,a)=>{r||delete n[a]}),U(n,r=>{ls.configure(this,r,r.options),ls.addBox(this,r)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,n=t.length;if(t.sort((s,o)=>s.index-o.index),n>e){for(let s=e;se.length&&delete this._stacks,t.forEach((n,s)=>{e.filter(o=>o===n._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let n,s;for(this._removeUnreferencedMetasets(),n=0,s=e.length;n{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const n=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let c=0,h=this.data.datasets.length;c{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Sc("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){U(this.scales,t=>{ls.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),n=new Set(t.events);(!Il(e,n)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:n,start:s,count:o}of e){const r=n==="_removeElements"?-o:o;Ay(t,s,r)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,n=o=>new Set(t.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),s=n(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;ls.update(this,this.width,this.height,t);const e=this.chartArea,n=e.width<=0||e.height<=0;this._layers=[],U(this.boxes,s=>{n&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,n=this.data.datasets.length;e=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,n=t._clip,s=!n.disabled,o=this.chartArea,r={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(s&&ku(e,{left:n.left===!1?0:o.left-n.left,right:n.right===!1?this.width:o.right+n.right,top:n.top===!1?0:o.top-n.top,bottom:n.bottom===!1?this.height:o.bottom+n.bottom}),t.controller.draw(),s&&Mu(e),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return Pn(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,n,s){const o=Hx.modes[e];return typeof o=="function"?o(this,t,n,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],n=this._metasets;let s=n.filter(o=>o&&o._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},n.push(s)),s}getContext(){return this.$context||(this.$context=Fe(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const n=this.getDatasetMeta(t);return typeof n.hidden=="boolean"?!n.hidden:!e.hidden}setDatasetVisibility(t,e){const n=this.getDatasetMeta(t);n.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,n){const s=n?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,s);Ft(e)?(o.data[e].hidden=!n,this.update()):(this.setDatasetVisibility(t,n),r.update(o,{visible:n}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),se.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,o,r),t[o]=r},s=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};U(this.options.events,o=>n(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,n=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let r;const a=()=>{s("attach",a),this.attached=!0,this.resize(),n("resize",o),n("detach",r)};r=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),n("attach",a)},e.isAttached(this.canvas)?a():r()}unbindEvents(){U(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},U(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,n){const s=n?"set":"remove";let o,r,a,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=t.length;a{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[r],index:r}});!Is(n,e)&&(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,e))}notifyPlugins(t,e,n){return this._plugins.notify(this,t,e,n)}_updateHoverStyles(t,e,n){const s=this.options.hover,o=(l,c)=>l.filter(h=>!c.some(u=>h.datasetIndex===u.datasetIndex&&h.index===u.index)),r=o(e,t),a=n?t:o(t,e);r.length&&this.updateHoverStyle(r,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,e){const n={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",n,s)===!1)return;const o=this._handleEvent(t,e,n.inChartArea);return n.cancelable=!1,this.notifyPlugins("afterEvent",n,s),(o||n.changed)&&this.render(),this}_handleEvent(t,e,n){const{_active:s=[],options:o}=this,r=e,a=this._getActiveElements(t,s,n,r),l=m_(t),c=Dy(t,this._lastEvent,n,l);n&&(this._lastEvent=null,nt(o.onHover,[t,a,this],this),l&&nt(o.onClick,[t,a,this],this));const h=!Is(a,s);return(h||e)&&(this._active=a,this._updateHoverStyles(a,s,e)),this._lastEvent=c,h}_getActiveElements(t,e,n,s){if(t.type==="mouseout")return[];if(!n)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}}const Cc=()=>U(ea.instances,i=>i._plugins.invalidate()),be=!0;Object.defineProperties(ea,{defaults:{enumerable:be,value:B},instances:{enumerable:be,value:Ys},overrides:{enumerable:be,value:si},registry:{enumerable:be,value:Ut},version:{enumerable:be,value:Sy},getChart:{enumerable:be,value:qu},register:{enumerable:be,value:(...i)=>{Ut.add(...i),Cc()}},unregister:{enumerable:be,value:(...i)=>{Ut.remove(...i),Cc()}}});function Ku(i,t,e){const{startAngle:n,pixelMargin:s,x:o,y:r,outerRadius:a,innerRadius:l}=t;let c=s/a;i.beginPath(),i.arc(o,r,a,n-c,e+c),l>s?(c=s/l,i.arc(o,r,l,e+c,n-c,!0)):i.arc(o,r,s,e+lt,n-lt),i.closePath(),i.clip()}function Oy(i){return Hr(i,["outerStart","outerEnd","innerStart","innerEnd"])}function Ty(i,t,e,n){const s=Oy(i.options.borderRadius),o=(e-t)/2,r=Math.min(o,n*t/2),a=l=>{const c=(e-Math.min(o,l))*n/2;return xt(l,0,Math.min(o,c))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:xt(s.innerStart,0,r),innerEnd:xt(s.innerEnd,0,r)}}function ci(i,t,e,n){return{x:e+i*Math.cos(t),y:n+i*Math.sin(t)}}function hr(i,t,e,n,s,o){const{x:r,y:a,startAngle:l,pixelMargin:c,innerRadius:h}=t,u=Math.max(t.outerRadius+n+e-c,0),d=h>0?h+n+e+c:0;let f=0;const g=s-l;if(n){const A=h>0?h-n:0,L=u>0?u-n:0,R=(A+L)/2,ht=R!==0?g*R/(R+n):g;f=(g-ht)/2}const p=Math.max(.001,g*u-e/ct)/u,m=(g-p)/2,_=l+m+f,x=s-m-f,{outerStart:v,outerEnd:b,innerStart:y,innerEnd:k}=Ty(t,d,u,x-_),w=u-v,M=u-b,S=_+v/w,P=x-b/M,D=d+y,O=d+k,H=_+y/D,F=x-k/O;if(i.beginPath(),o){if(i.arc(r,a,u,S,P),b>0){const R=ci(M,P,r,a);i.arc(R.x,R.y,b,P,x+lt)}const A=ci(O,x,r,a);if(i.lineTo(A.x,A.y),k>0){const R=ci(O,F,r,a);i.arc(R.x,R.y,k,x+lt,F+Math.PI)}if(i.arc(r,a,d,x-k/d,_+y/d,!0),y>0){const R=ci(D,H,r,a);i.arc(R.x,R.y,y,H+Math.PI,_-lt)}const L=ci(w,_,r,a);if(i.lineTo(L.x,L.y),v>0){const R=ci(w,S,r,a);i.arc(R.x,R.y,v,_-lt,S)}}else{i.moveTo(r,a);const A=Math.cos(S)*u+r,L=Math.sin(S)*u+a;i.lineTo(A,L);const R=Math.cos(P)*u+r,ht=Math.sin(P)*u+a;i.lineTo(R,ht)}i.closePath()}function Ly(i,t,e,n,s){const{fullCircles:o,startAngle:r,circumference:a}=t;let l=t.endAngle;if(o){hr(i,t,e,n,r+K,s);for(let c=0;c=K||Sn(o,a,l),p=zs(r,c+d,h+d);return g&&p}getCenterPoint(t){const{x:e,y:n,startAngle:s,endAngle:o,innerRadius:r,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius","circumference"],t),{offset:l,spacing:c}=this.options,h=(s+o)/2,u=(r+a+c+l)/2;return{x:e+Math.cos(h)*u,y:n+Math.sin(h)*u}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:n}=this,s=(e.offset||0)/2,o=(e.spacing||0)/2,r=e.circular;if(this.pixelMargin=e.borderAlign==="inner"?.33:0,this.fullCircles=n>K?Math.floor(n/K):0,n===0||this.innerRadius<0||this.outerRadius<0)return;t.save();let a=0;if(s){a=s/2;const c=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(c)*a,Math.sin(c)*a),this.circumference>=ct&&(a=s)}t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor;const l=Ly(t,this,a,o,r);Ey(t,this,a,o,l,r),t.restore()}}ia.id="arc";ia.defaults={borderAlign:"center",borderColor:"#fff",borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0};ia.defaultRoutes={backgroundColor:"backgroundColor"};function Gu(i,t,e=t){i.lineCap=V(e.borderCapStyle,t.borderCapStyle),i.setLineDash(V(e.borderDash,t.borderDash)),i.lineDashOffset=V(e.borderDashOffset,t.borderDashOffset),i.lineJoin=V(e.borderJoinStyle,t.borderJoinStyle),i.lineWidth=V(e.borderWidth,t.borderWidth),i.strokeStyle=V(e.borderColor,t.borderColor)}function Iy(i,t,e){i.lineTo(e.x,e.y)}function Fy(i){return i.stepped?t0:i.tension||i.cubicInterpolationMode==="monotone"?e0:Iy}function Zu(i,t,e={}){const n=i.length,{start:s=0,end:o=n-1}=e,{start:r,end:a}=t,l=Math.max(s,r),c=Math.min(o,a),h=sa&&o>a;return{count:n,start:l,loop:t.loop,ilen:c(r+(c?a-b:b))%o,v=()=>{p!==m&&(i.lineTo(h,m),i.lineTo(h,p),i.lineTo(h,_))};for(l&&(f=s[x(0)],i.moveTo(f.x,f.y)),d=0;d<=a;++d){if(f=s[x(d)],f.skip)continue;const b=f.x,y=f.y,k=b|0;k===g?(ym&&(m=y),h=(u*h+b)/++u):(v(),i.lineTo(b,y),g=k,u=0,p=m=y),_=y}v()}function ur(i){const t=i.options,e=t.borderDash&&t.borderDash.length;return!i._decimated&&!i._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?zy:$y}function By(i){return i.stepped?L0:i.tension||i.cubicInterpolationMode==="monotone"?R0:Ue}function Ny(i,t,e,n){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,n)&&s.closePath()),Gu(i,t.options),i.stroke(s)}function Vy(i,t,e,n){const{segments:s,options:o}=t,r=ur(t);for(const a of s)Gu(i,o,a.style),i.beginPath(),r(i,t,a,{start:e,end:e+n-1})&&i.closePath(),i.stroke()}const Wy=typeof Path2D=="function";function jy(i,t,e,n){Wy&&!t.options.segment?Ny(i,t,e,n):Vy(i,t,e,n)}class oo extends me{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const n=this.options;if((n.tension||n.cubicInterpolationMode==="monotone")&&!n.stepped&&!this._pointsUpdated){const s=n.spanGaps?this._loop:this._fullLoop;M0(this._points,n,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=H0(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,n=t.length;return n&&e[t[n-1].end]}interpolate(t,e){const n=this.options,s=t[e],o=this.points,r=V0(this,{property:e,start:s,end:s});if(!r.length)return;const a=[],l=By(n);let c,h;for(c=0,h=r.length;ci!=="borderDash"&&i!=="fill"};function Ac(i,t,e,n){const s=i.options,{[e]:o}=i.getProps([e],n);return Math.abs(t-o)-1?i.split(` -`):i}function Ky(i,t){const{element:e,datasetIndex:n,index:s}=t,o=i.getDatasetMeta(n).controller,{label:r,value:a}=o.getLabelAndValue(s);return{chart:i,label:r,parsed:o.getParsed(s),raw:i.data.datasets[n].data[s],formattedValue:a,dataset:o.getDataset(),dataIndex:s,datasetIndex:n,element:e}}function Dc(i,t){const e=i.chart.ctx,{body:n,footer:s,title:o}=i,{boxWidth:r,boxHeight:a}=t,l=Dt(t.bodyFont),c=Dt(t.titleFont),h=Dt(t.footerFont),u=o.length,d=s.length,f=n.length,g=$t(t.padding);let p=g.height,m=0,_=n.reduce((b,y)=>b+y.before.length+y.lines.length+y.after.length,0);if(_+=i.beforeBody.length+i.afterBody.length,u&&(p+=u*c.lineHeight+(u-1)*t.titleSpacing+t.titleMarginBottom),_){const b=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;p+=f*b+(_-f)*l.lineHeight+(_-1)*t.bodySpacing}d&&(p+=t.footerMarginTop+d*h.lineHeight+(d-1)*t.footerSpacing);let x=0;const v=function(b){m=Math.max(m,e.measureText(b).width+x)};return e.save(),e.font=c.string,U(i.title,v),e.font=l.string,U(i.beforeBody.concat(i.afterBody),v),x=t.displayColors?r+2+t.boxPadding:0,U(n,b=>{U(b.before,v),U(b.lines,v),U(b.after,v)}),x=0,e.font=h.string,U(i.footer,v),e.restore(),m+=g.width,{width:m,height:p}}function Gy(i,t){const{y:e,height:n}=t;return ei.height-n/2?"bottom":"center"}function Zy(i,t,e,n){const{x:s,width:o}=n,r=e.caretSize+e.caretPadding;if(i==="left"&&s+o+r>t.width||i==="right"&&s-o-r<0)return!0}function Jy(i,t,e,n){const{x:s,width:o}=e,{width:r,chartArea:{left:a,right:l}}=i;let c="center";return n==="center"?c=s<=(a+l)/2?"left":"right":s<=o/2?c="left":s>=r-o/2&&(c="right"),Zy(c,i,t,e)&&(c="center"),c}function Oc(i,t,e){const n=e.yAlign||t.yAlign||Gy(i,e);return{xAlign:e.xAlign||t.xAlign||Jy(i,t,e,n),yAlign:n}}function Qy(i,t){let{x:e,width:n}=i;return t==="right"?e-=n:t==="center"&&(e-=n/2),e}function t1(i,t,e){let{y:n,height:s}=i;return t==="top"?n+=e:t==="bottom"?n-=s+e:n-=s/2,n}function Tc(i,t,e,n){const{caretSize:s,caretPadding:o,cornerRadius:r}=i,{xAlign:a,yAlign:l}=e,c=s+o,{topLeft:h,topRight:u,bottomLeft:d,bottomRight:f}=_i(r);let g=Qy(t,a);const p=t1(t,l,c);return l==="center"?a==="left"?g+=c:a==="right"&&(g-=c):a==="left"?g-=Math.max(h,d)+s:a==="right"&&(g+=Math.max(u,f)+s),{x:xt(g,0,n.width-t.width),y:xt(p,0,n.height-t.height)}}function hs(i,t,e){const n=$t(e.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-n.right:i.x+n.left}function Lc(i){return Ht([],oe(i))}function e1(i,t,e){return Fe(i,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Rc(i,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?i.override(e):i}class i1 extends me{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart||t._chart,this._chart=this.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,n=this.options.setContext(this.getContext()),s=n.enabled&&e.options.animation&&n.animations,o=new Eu(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=e1(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:n}=e,s=n.beforeTitle.apply(this,[t]),o=n.title.apply(this,[t]),r=n.afterTitle.apply(this,[t]);let a=[];return a=Ht(a,oe(s)),a=Ht(a,oe(o)),a=Ht(a,oe(r)),a}getBeforeBody(t,e){return Lc(e.callbacks.beforeBody.apply(this,[t]))}getBody(t,e){const{callbacks:n}=e,s=[];return U(t,o=>{const r={before:[],lines:[],after:[]},a=Rc(n,o);Ht(r.before,oe(a.beforeLabel.call(this,o))),Ht(r.lines,a.label.call(this,o)),Ht(r.after,oe(a.afterLabel.call(this,o))),s.push(r)}),s}getAfterBody(t,e){return Lc(e.callbacks.afterBody.apply(this,[t]))}getFooter(t,e){const{callbacks:n}=e,s=n.beforeFooter.apply(this,[t]),o=n.footer.apply(this,[t]),r=n.afterFooter.apply(this,[t]);let a=[];return a=Ht(a,oe(s)),a=Ht(a,oe(o)),a=Ht(a,oe(r)),a}_createItems(t){const e=this._active,n=this.chart.data,s=[],o=[],r=[];let a=[],l,c;for(l=0,c=e.length;lt.filter(h,u,d,n))),t.itemSort&&(a=a.sort((h,u)=>t.itemSort(h,u,n))),U(a,h=>{const u=Rc(t.callbacks,h);s.push(u.labelColor.call(this,h)),o.push(u.labelPointStyle.call(this,h)),r.push(u.labelTextColor.call(this,h))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(t,e){const n=this.options.setContext(this.getContext()),s=this._active;let o,r=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const a=Ms[n.position].call(this,s,this._eventPosition);r=this._createItems(n),this.title=this.getTitle(r,n),this.beforeBody=this.getBeforeBody(r,n),this.body=this.getBody(r,n),this.afterBody=this.getAfterBody(r,n),this.footer=this.getFooter(r,n);const l=this._size=Dc(this,n),c=Object.assign({},a,l),h=Oc(this.chart,n,c),u=Tc(n,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:u.x,y:u.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,n,s){const o=this.getCaretPosition(t,n,s);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,n){const{xAlign:s,yAlign:o}=this,{caretSize:r,cornerRadius:a}=n,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:u}=_i(a),{x:d,y:f}=t,{width:g,height:p}=e;let m,_,x,v,b,y;return o==="center"?(b=f+p/2,s==="left"?(m=d,_=m-r,v=b+r,y=b-r):(m=d+g,_=m+r,v=b-r,y=b+r),x=m):(s==="left"?_=d+Math.max(l,h)+r:s==="right"?_=d+g-Math.max(c,u)-r:_=this.caretX,o==="top"?(v=f,b=v-r,m=_-r,x=_+r):(v=f+p,b=v+r,m=_+r,x=_-r),y=v),{x1:m,x2:_,x3:x,y1:v,y2:b,y3:y}}drawTitle(t,e,n){const s=this.title,o=s.length;let r,a,l;if(o){const c=Lo(n.rtl,this.x,this.width);for(t.x=hs(this,n.titleAlign,n),e.textAlign=c.textAlign(n.titleAlign),e.textBaseline="middle",r=Dt(n.titleFont),a=n.titleSpacing,e.fillStyle=n.titleColor,e.font=r.string,l=0;lv!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Ws(t,{x:m,y:p,w:c,h:l,radius:x}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),Ws(t,{x:_,y:p+1,w:c-2,h:l-2,radius:x}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(m,p,c,l),t.strokeRect(m,p,c,l),t.fillStyle=r.backgroundColor,t.fillRect(_,p+1,c-2,l-2))}t.fillStyle=this.labelTextColors[n]}drawBody(t,e,n){const{body:s}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:h}=n,u=Dt(n.bodyFont);let d=u.lineHeight,f=0;const g=Lo(n.rtl,this.x,this.width),p=function(M){e.fillText(M,g.x(t.x+f),t.y+d/2),t.y+=d+o},m=g.textAlign(r);let _,x,v,b,y,k,w;for(e.textAlign=r,e.textBaseline="middle",e.font=u.string,t.x=hs(this,m,n),e.fillStyle=n.bodyColor,U(this.beforeBody,p),f=a&&m!=="right"?r==="center"?c/2+h:c+2+h:0,b=0,k=s.length;b0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,n=this.$animations,s=n&&n.x,o=n&&n.y;if(s||o){const r=Ms[t.position].call(this,this._active,this._eventPosition);if(!r)return;const a=this._size=Dc(this,t),l=Object.assign({},r,this._size),c=Oc(e,t,l),h=Tc(t,l,c,e);(s._to!==h.x||o._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let n=this.opacity;if(!n)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;const r=$t(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=n,this.drawBackground(o,t,s,e),$0(t,e.textDirection),o.y+=r.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),z0(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const n=this._active,s=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!Is(n,s),r=this._positionChanged(s,e);(o||r)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,n=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],r=this._getActiveElements(t,o,e,n),a=this._positionChanged(r,t),l=e||!Is(r,o)||a;return l&&(this._active=r,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,n,s){const o=this.options;if(t.type==="mouseout")return[];if(!s)return e;const r=this.chart.getElementsAtEventForMode(t,o.mode,o,n);return o.reverse&&r.reverse(),r}_positionChanged(t,e){const{caretX:n,caretY:s,options:o}=this,r=Ms[o.position].call(this,t,e);return r!==!1&&(n!==r.x||s!==r.y)}}i1.positioners=Ms;const n1=(i,t,e,n)=>(typeof t=="string"?(e=i.push(t)-1,n.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function s1(i,t,e,n){const s=i.indexOf(t);if(s===-1)return n1(i,t,e,n);const o=i.lastIndexOf(t);return s!==o?e:s}const o1=(i,t)=>i===null?null:xt(Math.round(i),0,t);class dr extends oi{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const n=this.getLabels();for(const{index:s,label:o}of e)n[s]===o&&n.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(q(t))return null;const n=this.getLabels();return e=isFinite(e)&&n[e]===t?e:s1(n,t,V(e,t),this._addedLabels),o1(e,n.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:n,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(n=0),e||(s=this.getLabels().length-1)),this.min=n,this.max=s}buildTicks(){const t=this.min,e=this.max,n=this.options.offset,s=[];let o=this.getLabels();o=t===0&&e===o.length-1?o:o.slice(t,e+1),this._valueRange=Math.max(o.length-(n?0:1),1),this._startValue=this.min-(n?.5:0);for(let r=t;r<=e;r++)s.push({value:r});return s}getLabelForValue(t){const e=this.getLabels();return t>=0&&te.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}dr.id="category";dr.defaults={ticks:{callback:dr.prototype.getLabelForValue}};function r1(i,t){const e=[],{bounds:s,step:o,min:r,max:a,precision:l,count:c,maxTicks:h,maxDigits:u,includeBounds:d}=i,f=o||1,g=h-1,{min:p,max:m}=t,_=!q(r),x=!q(a),v=!q(c),b=(m-p)/(u+1);let y=$l((m-p)/g/f)*f,k,w,M,S;if(y<1e-14&&!_&&!x)return[{value:p},{value:m}];S=Math.ceil(m/y)-Math.floor(p/y),S>g&&(y=$l(S*y/g/f)*f),q(l)||(k=Math.pow(10,l),y=Math.ceil(y*k)/k),s==="ticks"?(w=Math.floor(p/y)*y,M=Math.ceil(m/y)*y):(w=p,M=m),_&&x&&o&&y_((a-r)/o,y/1e3)?(S=Math.round(Math.min((a-r)/y,h)),y=(a-r)/S,w=r,M=a):v?(w=_?r:w,M=x?a:M,S=c-1,y=(M-w)/S):(S=(M-w)/y,pn(S,Math.round(S),y/1e3)?S=Math.round(S):S=Math.ceil(S));const P=Math.max(zl(y),zl(w));k=Math.pow(10,q(l)?P:l),w=Math.round(w*k)/k,M=Math.round(M*k)/k;let D=0;for(_&&(d&&w!==r?(e.push({value:r}),ws=e?s:l,a=l=>o=n?o:l;if(t){const l=Kt(s),c=Kt(o);l<0&&c<0?a(0):l>0&&c>0&&r(0)}if(s===o){let l=1;(o>=Number.MAX_SAFE_INTEGER||s<=Number.MIN_SAFE_INTEGER)&&(l=Math.abs(o*.05)),a(o+l),t||r(s-l)}this.min=s,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:n}=t,s;return n?(s=Math.ceil(this.max/n)-Math.floor(this.min/n)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${n} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let n=this.getTickLimit();n=Math.max(2,n);const s={maxTicks:n,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,r=r1(s,o);return t.bounds==="ticks"&&hu(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const t=this.ticks;let e=this.min,n=this.max;if(super.configure(),this.options.offset&&t.length){const s=(n-e)/Math.max(t.length-1,1)/2;e-=s,n+=s}this._startValue=e,this._endValue=n,this._valueRange=n-e}getLabelForValue(t){return Fn(t,this.chart.options.locale,this.options.ticks.format)}}class Qu extends Xs{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=pt(t)?t:0,this.max=pt(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,n=Vt(this.options.ticks.minRotation),s=(t?Math.sin(n):Math.cos(n))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}Qu.id="linear";Qu.defaults={ticks:{callback:so.formatters.numeric}};function Ic(i){return i/Math.pow(10,Math.floor(Et(i)))===1}function a1(i,t){const e=Math.floor(Et(t.max)),n=Math.ceil(t.max/Math.pow(10,e)),s=[];let o=Lt(i.min,Math.pow(10,Math.floor(Et(t.min)))),r=Math.floor(Et(o)),a=Math.floor(o/Math.pow(10,r)),l=r<0?Math.pow(10,Math.abs(r)):1;do s.push({value:o,major:Ic(o)}),++a,a===10&&(a=1,++r,l=r>=0?1:l),o=Math.round(a*Math.pow(10,r)*l)/l;while(r0?n:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=pt(t)?Math.max(0,t):null,this.max=pt(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let n=this.min,s=this.max;const o=l=>n=t?n:l,r=l=>s=e?s:l,a=(l,c)=>Math.pow(10,Math.floor(Et(l))+c);n===s&&(n<=0?(o(1),r(10)):(o(a(n,-1)),r(a(s,1)))),n<=0&&o(a(s,-1)),s<=0&&r(a(n,1)),this._zero&&this.min!==this._suggestedMin&&n===a(this.min,0)&&o(a(n,-1)),this.min=n,this.max=s}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},n=a1(e,this);return t.bounds==="ticks"&&hu(n,this,"value"),t.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}getLabelForValue(t){return t===void 0?"0":Fn(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=Et(t),this._valueRange=Et(this.max)-Et(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Et(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}td.id="logarithmic";td.defaults={ticks:{callback:so.formatters.logarithmic,major:{enabled:!0}}};function fr(i){const t=i.ticks;if(t.display&&i.display){const e=$t(t.backdropPadding);return V(t.font&&t.font.size,B.font.size)+e.height}return 0}function l1(i,t,e){return e=et(e)?e:[e],{w:J_(i,t.string,e),h:e.length*t.lineHeight}}function Fc(i,t,e,n,s){return i===n||i===s?{start:t-e/2,end:t+e/2}:is?{start:t-e,end:t}:{start:t,end:t+e}}function c1(i){const t={l:i.left+i._padding.left,r:i.right-i._padding.right,t:i.top+i._padding.top,b:i.bottom-i._padding.bottom},e=Object.assign({},t),n=[],s=[],o=i._pointLabels.length,r=i.options.pointLabels,a=r.centerPointLabels?ct/o:0;for(let l=0;lt.r&&(a=(n.end-t.r)/o,i.r=Math.max(i.r,t.r+a)),s.startt.b&&(l=(s.end-t.b)/r,i.b=Math.max(i.b,t.b+l))}function u1(i,t,e){const n=[],s=i._pointLabels.length,o=i.options,r=fr(o)/2,a=i.drawingArea,l=o.pointLabels.centerPointLabels?ct/s:0;for(let c=0;c270||e<90)&&(i-=t),i}function p1(i,t){const{ctx:e,options:{pointLabels:n}}=i;for(let s=t-1;s>=0;s--){const o=n.setContext(i.getPointLabelContext(s)),r=Dt(o.font),{x:a,y:l,textAlign:c,left:h,top:u,right:d,bottom:f}=i._pointLabelItems[s],{backdropColor:g}=o;if(!q(g)){const p=_i(o.borderRadius),m=$t(o.backdropPadding);e.fillStyle=g;const _=h-m.left,x=u-m.top,v=d-h+m.width,b=f-u+m.height;Object.values(p).some(y=>y!==0)?(e.beginPath(),Ws(e,{x:_,y:x,w:v,h:b,radius:p}),e.fill()):e.fillRect(_,x,v,b)}Vs(e,i._pointLabels[s],a,l+r.lineHeight/2,r,{color:o.color,textAlign:c,textBaseline:"middle"})}}function ed(i,t,e,n){const{ctx:s}=i;if(e)s.arc(i.xCenter,i.yCenter,t,0,K);else{let o=i.getPointPosition(0,t);s.moveTo(o.x,o.y);for(let r=1;r{const s=nt(this.options.pointLabels.callback,[e,n],this);return s||s===0?s:""}).filter((e,n)=>this.chart.getDataVisibility(n))}fit(){const t=this.options;t.display&&t.pointLabels.display?c1(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,n,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((n-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,n,s))}getIndexAngle(t){const e=K/(this._pointLabels.length||1),n=this.options.startAngle||0;return Bt(t*e+Vt(n))}getDistanceFromCenterForValue(t){if(q(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(q(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t{if(h!==0){a=this.getDistanceFromCenterForValue(c.value);const u=s.setContext(this.getContext(h-1));m1(this,u,a,o)}}),n.display){for(t.save(),r=o-1;r>=0;r--){const c=n.setContext(this.getPointLabelContext(r)),{color:h,lineWidth:u}=c;!u||!h||(t.lineWidth=u,t.strokeStyle=h,t.setLineDash(c.borderDash),t.lineDashOffset=c.borderDashOffset,a=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),l=this.getPointPosition(r,a),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,n=e.ticks;if(!n.display)return;const s=this.getIndexAngle(0);let o,r;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&!e.reverse)return;const c=n.setContext(this.getContext(l)),h=Dt(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=h.string,r=t.measureText(a.label).width,t.fillStyle=c.backdropColor;const u=$t(c.backdropPadding);t.fillRect(-r/2-u.left,-o-h.size/2-u.top,r+u.width,h.size+u.height)}Vs(t,a.label,0,-o,h,{color:c.color})}),t.restore()}drawTitle(){}}ro.id="radialLinear";ro.defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:so.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(i){return i},padding:5,centerPointLabels:!1}};ro.defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};ro.descriptors={angleLines:{_fallback:"grid"}};const ao={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Mt=Object.keys(ao);function _1(i,t){return i-t}function $c(i,t){if(q(t))return null;const e=i._adapter,{parser:n,round:s,isoWeekday:o}=i._parseOpts;let r=t;return typeof n=="function"&&(r=n(r)),pt(r)||(r=typeof n=="string"?e.parse(r,n):e.parse(r)),r===null?null:(s&&(r=s==="week"&&(ki(o)||o===!0)?e.startOf(r,"isoWeek",o):e.startOf(r,s)),+r)}function zc(i,t,e,n){const s=Mt.length;for(let o=Mt.indexOf(i);o=Mt.indexOf(e);o--){const r=Mt[o];if(ao[r].common&&i._adapter.diff(s,n,r)>=t-1)return r}return Mt[e?Mt.indexOf(e):0]}function y1(i){for(let t=Mt.indexOf(i)+1,e=Mt.length;t=t?e[n]:e[s];i[o]=!0}}function v1(i,t,e,n){const s=i._adapter,o=+s.startOf(t[0].value,n),r=t[t.length-1].value;let a,l;for(a=o;a<=r;a=+s.add(a,1,n))l=e[a],l>=0&&(t[l].major=!0);return t}function Nc(i,t,e){const n=[],s={},o=t.length;let r,a;for(r=0;r+t.value))}initOffsets(t){let e=0,n=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?n=o:n=(o-this.getDecimalForValue(t[t.length-2]))/2);const r=t.length<3?.5:.25;e=xt(e,0,r),n=xt(n,0,r),this._offsets={start:e,end:n,factor:1/(e+1+n)}}_generate(){const t=this._adapter,e=this.min,n=this.max,s=this.options,o=s.time,r=o.unit||zc(o.minUnit,e,n,this._getLabelCapacity(e)),a=V(o.stepSize,1),l=r==="week"?o.isoWeekday:!1,c=ki(l)||l===!0,h={};let u=e,d,f;if(c&&(u=+t.startOf(u,"isoWeek",l)),u=+t.startOf(u,c?"day":r),t.diff(n,e,r)>1e5*a)throw new Error(e+" and "+n+" are too far apart with stepSize of "+a+" "+r);const g=s.ticks.source==="data"&&this.getDataTimestamps();for(d=u,f=0;dp-m).map(p=>+p)}getLabelForValue(t){const e=this._adapter,n=this.options.time;return n.tooltipFormat?e.format(t,n.tooltipFormat):e.format(t,n.displayFormats.datetime)}_tickFormatFunction(t,e,n,s){const o=this.options,r=o.time.displayFormats,a=this._unit,l=this._majorUnit,c=a&&r[a],h=l&&r[l],u=n[e],d=l&&h&&u&&u.major,f=this._adapter.format(t,s||(d?h:c)),g=o.ticks.callback;return g?nt(g,[f,e,n],this):f}generateTickLabels(t){let e,n,s;for(e=0,n=t.length;e0?a:1}getDataTimestamps(){let t=this._cache.data||[],e,n;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,n=s.length;e=i[n].pos&&t<=i[s].pos&&({lo:n,hi:s}=Ze(i,"pos",t)),{pos:o,time:a}=i[n],{pos:r,time:l}=i[s]):(t>=i[n].time&&t<=i[s].time&&({lo:n,hi:s}=Ze(i,"time",t)),{time:o,pos:a}=i[n],{time:r,pos:l}=i[s]);const c=r-o;return c?a+(l-a)*(t-o)/c:a}class id extends lo{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=us(e,this.min),this._tableRange=us(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:n}=this,s=[],o=[];let r,a,l,c,h;for(r=0,a=t.length;r=e&&c<=n&&s.push(c);if(s.length<2)return[{time:e,pos:0},{time:n,pos:1}];for(r=0,a=s.length;r{}};function nd(){for(var i,t=0,e=arguments.length,n={};t=0&&(n=e.slice(s+1),e=e.slice(0,s)),e&&!t.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:n}})}function M1(i,t){for(var e,n=0,s=i.length;n0)for(var e,n,s=new Array(e),o=0;o=0&&(t=i.slice(0,e))!=="xmlns"&&(i=i.slice(e+1)),Wc.hasOwnProperty(t)?{space:Wc[t],local:i}:i}function S1(i){return function(){var t=this.ownerDocument,e=this.namespaceURI;return e===gr&&t.documentElement.namespaceURI===gr?t.createElement(i):t.createElementNS(e,i)}}function P1(i){return function(){return this.ownerDocument.createElementNS(i.space,i.local)}}function jc(i){var t=sd(i);return(t.local?P1:S1)(t)}function C1(){}function Hc(i){return i==null?C1:function(){return this.querySelector(i)}}function A1(i){return i==null?[]:Array.isArray(i)?i:Array.from(i)}function D1(){return[]}function Yc(i){return function(t){return t.matches(i)}}var O1=Array.prototype.find;function T1(){return this.firstElementChild}var L1=Array.prototype.filter;function R1(){return Array.from(this.children)}function Xc(i){return new Array(i.length)}function Us(i,t){this.ownerDocument=i.ownerDocument,this.namespaceURI=i.namespaceURI,this._next=null,this._parent=i,this.__data__=t}function E1(i){return function(){return i}}function I1(i,t,e,n,s,o){for(var r,a=0,l=t.length,c=o.length;at?1:i>=t?0:NaN}function N1(i){return function(){this.removeAttribute(i)}}function V1(i){return function(){this.removeAttributeNS(i.space,i.local)}}function W1(i,t){return function(){this.setAttribute(i,t)}}function j1(i,t){return function(){this.setAttributeNS(i.space,i.local,t)}}function H1(i,t){return function(){var e=t.apply(this,arguments);e==null?this.removeAttribute(i):this.setAttribute(i,e)}}function Y1(i,t){return function(){var e=t.apply(this,arguments);e==null?this.removeAttributeNS(i.space,i.local):this.setAttributeNS(i.space,i.local,e)}}function od(i){return i.ownerDocument&&i.ownerDocument.defaultView||i.document&&i||i.defaultView}function X1(i){return function(){this.style.removeProperty(i)}}function U1(i,t,e){return function(){this.style.setProperty(i,t,e)}}function q1(i,t,e){return function(){var n=t.apply(this,arguments);n==null?this.style.removeProperty(i):this.style.setProperty(i,n,e)}}function K1(i,t){return i.style.getPropertyValue(t)||od(i).getComputedStyle(i,null).getPropertyValue(t)}function G1(i){return function(){delete this[i]}}function Z1(i,t){return function(){this[i]=t}}function J1(i,t){return function(){var e=t.apply(this,arguments);e==null?delete this[i]:this[i]=e}}function rd(i){return i.trim().split(/^|\s+/)}function oa(i){return i.classList||new ad(i)}function ad(i){this._node=i,this._names=rd(i.getAttribute("class")||"")}function ld(i,t){for(var e=oa(i),n=-1,s=t.length;++n=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}})}function pv(i){return function(){var t=this.__on;if(t){for(var e,n=0,s=-1,o=t.length;n=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(i){return this._names.indexOf(i)>=0}};var xv=[null];function Rt(i,t){this._groups=i,this._parents=t}function an(i){return typeof i=="string"?new Rt([[document.querySelector(i)]],[document.documentElement]):new Rt([[i]],xv)}function Uc(i,t){if(i=function(o){let r;for(;r=o.sourceEvent;)o=r;return o}(i),t===void 0&&(t=i.currentTarget),t){var e=t.ownerSVGElement||t;if(e.createSVGPoint){var n=e.createSVGPoint();return n.x=i.clientX,n.y=i.clientY,[(n=n.matrixTransform(t.getScreenCTM().inverse())).x,n.y]}if(t.getBoundingClientRect){var s=t.getBoundingClientRect();return[i.clientX-s.left-t.clientLeft,i.clientY-s.top-t.clientTop]}}return[i.pageX,i.pageY]}Rt.prototype={constructor:Rt,select:function(i){typeof i!="function"&&(i=Hc(i));for(var t=this._groups,e=t.length,n=new Array(e),s=0;s=y&&(y=b+1);!(v=m[y])&&++y=0;)(n=s[o])&&(r&&4^n.compareDocumentPosition(r)&&r.parentNode.insertBefore(n,r),r=n);return this},sort:function(i){function t(u,d){return u&&d?i(u.__data__,d.__data__):!u-!d}i||(i=B1);for(var e=this._groups,n=e.length,s=new Array(n),o=0;o1?this.each((t==null?X1:typeof t=="function"?q1:U1)(i,t,e??"")):K1(this.node(),i)},property:function(i,t){return arguments.length>1?this.each((t==null?G1:typeof t=="function"?J1:Z1)(i,t)):this.node()[i]},classed:function(i,t){var e=rd(i+"");if(arguments.length<2){for(var n=oa(this.node()),s=-1,o=e.length;++s()=>i;function pr(i,{sourceEvent:t,subject:e,target:n,identifier:s,active:o,x:r,y:a,dx:l,dy:c,dispatch:h}){Object.defineProperties(this,{type:{value:i,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:r,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:h}})}function vv(i){return!i.ctrlKey&&!i.button}function wv(){return this.parentNode}function kv(i,t){return t??{x:i.x,y:i.y}}function Mv(){return navigator.maxTouchPoints||"ontouchstart"in this}function Sv(){var i,t,e,n,s=vv,o=wv,r=kv,a=Mv,l={},c=nd("start","drag","end"),h=0,u=0;function d(b){b.on("mousedown.drag",f).filter(a).on("touchstart.drag",m).on("touchmove.drag",_,yv).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(b,y){if(!n&&s.call(this,b,y)){var k=v(this,o.call(this,b,y),b,y,"mouse");k&&(an(b.view).on("mousemove.drag",g,Bi).on("mouseup.drag",p,Bi),function(w){var M=w.document.documentElement,S=an(w).on("dragstart.drag",hi,Bi);"onselectstart"in M?S.on("selectstart.drag",hi,Bi):(M.__noselect=M.style.MozUserSelect,M.style.MozUserSelect="none")}(b.view),Vo(b),e=!1,i=b.clientX,t=b.clientY,k("start",b))}}function g(b){if(hi(b),!e){var y=b.clientX-i,k=b.clientY-t;e=y*y+k*k>u}l.mouse("drag",b)}function p(b){an(b.view).on("mousemove.drag mouseup.drag",null),function(y,k){var w=y.document.documentElement,M=an(y).on("dragstart.drag",null);k&&(M.on("click.drag",hi,Bi),setTimeout(function(){M.on("click.drag",null)},0)),"onselectstart"in w?M.on("selectstart.drag",null):(w.style.MozUserSelect=w.__noselect,delete w.__noselect)}(b.view,e),hi(b),l.mouse("end",b)}function m(b,y){if(s.call(this,b,y)){var k,w,M=b.changedTouches,S=o.call(this,b,y),P=M.length;for(k=0;kt.scales[Xt].max?t.scales[Xt].max:o,o=ot.scales[le].max?t.scales[le].max:r,r=r{if(wt){ui=wt.datasetIndex,qe=wt.index,mr=!0;let s=t.data.datasets[ui].data[qe];qs==="radar"||qs==="polarArea"?s=function(o,r){let a,l,c;o.touches?(a=o.touches[0].clientX-r.canvas.getBoundingClientRect().left,l=o.touches[0].clientY-r.canvas.getBoundingClientRect().top):(a=o.clientX-r.canvas.getBoundingClientRect().left,l=o.clientY-r.canvas.getBoundingClientRect().top);let h=r.scales[xe],u=Math.sqrt(Math.pow(a-h.xCenter,2)+Math.pow(l-h.yCenter,2)),d=h.drawingArea/(h.max-h.min);return c=h.options.ticks.reverse?h.max-u/d:h.min+u/d,c=Ks(c,r.config.options.plugins.dragData.round),c=c>r.scales[xe].max?r.scales[xe].max:c,c=c((n,s,o)=>{if(wt=s.getElementsAtEventForMode(n,"nearest",{intersect:!0},!1)[0],qs=s.config.type,wt){let r=wt.datasetIndex,a=wt.index;qc=function(u){try{return u()}catch{return""}}(()=>s.config.options.plugins.tooltip.animation);const l=s.data.datasets[r],c=s.getDatasetMeta(r);let h=l.data[a];if(Xt=c.xAxisID,le=c.yAxisID,xe=c.rAxisID,l.dragData===!1||s.config.options.scales[Xt]&&s.config.options.scales[Xt].dragData===!1||s.config.options.scales[le]&&s.config.options.scales[le].dragData===!1||s.config.options.scales[xe]&&s.config.options.scales[xe].rAxisID===!1||l.data[wt.index].dragData===!1)return void(wt=null);if(qs==="bar"){ud=s.config.options.scales[Xt].stacked;const u=s.data.datasets[0].data[0];dd=u!==null&&Array.isArray(u)&&u.length==2,fd=br(n,s,r,a)-h}(s.config.options.plugins.dragData.showTooltip===void 0||s.config.options.plugins.dragData.showTooltip)&&(s.config.options.plugins.tooltip||(s.config.options.plugins.tooltip={}),s.config.options.plugins.tooltip.animation=!1),typeof o=="function"&&wt&&o(n,r,a,h)===!1&&(wt=null)}})(e.sourceEvent,i,t.onDragStart)).on("drag",e=>Pv(e.sourceEvent,i,t,t.onDrag)).on("end",e=>((n,s,o)=>{if(qe=void 0,mr=!1,s.config.options.plugins.tooltip&&(s.config.options.plugins.tooltip.animation=qc,s.update("none")),typeof o=="function"&&wt){const r=wt.datasetIndex,a=wt.index;let l=function(c,h,u){const d=c.config.options.plugins.dragData;if(!d.magnet)return c.data.datasets[h].data[u];{const f=d.magnet;if(f.to&&typeof f.to=="function"){let g=c.data.datasets[h].data[u];return g=f.to(g),c.data.datasets[h].data[u]=g,c.update("none"),g}}}(s,r,a);return o(n,r,a,l)}})(e.sourceEvent,i,t.onDragEnd)))}},beforeEvent:function(i){if(mr)return i.tooltip&&i.tooltip.update(),!1}};ea.register(gd);function Cv(i){let t,e,n,s,o;return{c(){t=z("canvas"),e=ge(),n=z("canvas"),mi(t,"width","100%"),mi(t,"height","400px"),mi(n,"width","100%"),mi(n,"height","300px")},m(r,a){st(r,t,a),st(r,e,a),st(r,n,a),s||(o=[aa(i[0].call(null,t)),aa(i[1].call(null,n))],s=!0)},p:It,i:It,o:It,d(r){r&&(ot(t),ot(e),ot(n)),s=!1,On(o)}}}function Av(i,t,e){nn.register(...c_),nn.register(gd);let{lts:n}=t,{nearbyAmenities:s}=t,{greenspace:o}=t,r=null,a=["red","blue","green"];l();function l(){let u=n+s+o;e(2,n=100*n/u),e(3,s=100*s/u),e(4,o=100*o/u),r&&(r.data.datasets[0].data=[n,s,o],r.update())}function c(u){let d={type:"radar",data:{labels:["LTS","Amenities","Greenspace"],datasets:[{label:"Routing preferences",data:[n,s,o],pointHitRadius:25}]},options:{responsive:!1,onHover(f){const g=f.chart.getElementsAtEventForMode(f,"nearest",{intersect:!0},!1);f.native.target.style.cursor=g.length?"grab":"default"},plugins:{dragData:{round:1,showTooltip:!0,onDragStart(f){f.target.style.cursor="grabbing"},onDragEnd(f,g,p,m){f.target.style.cursor="default",p==0?e(2,n=m):p==1?e(3,s=m):p==2&&e(4,o=m),l()}}},scales:{r:{min:0,max:100,stepSize:1,pointLabels:{color:a,font:{weight:"bold",size:15}},ticks:{display:!1}}}}};new nn(u.getContext("2d"),d)}function h(u){let d={type:"bar",data:{labels:["LTS","Amenities","Greenspace"],datasets:[{label:"Routing preferences",data:[n,s,o],backgroundColor:a}]},options:{indexAxis:"y"}};r=new nn(u.getContext("2d"),d)}return i.$$set=u=>{"lts"in u&&e(2,n=u.lts),"nearbyAmenities"in u&&e(3,s=u.nearbyAmenities),"greenspace"in u&&e(4,o=u.greenspace)},[c,h,n,s,o]}class Dv extends An{constructor(t){super(),Dn(this,t,Av,Cv,Pi,{lts:2,nearbyAmenities:3,greenspace:4})}}function Kc(i,t,e){const n=i.slice();return n[17]=t[e],n[22]=t,n[23]=e,n}function Gc(i,t,e){const n=i.slice();return n[17]=t[e],n[20]=t,n[21]=e,n}function Zc(i,t,e){const n=i.slice();return n[17]=t[e],n[18]=t,n[19]=e,n}function Ov(i){let t,e,n,s,o,r,a,l,c,h,u,d,f,g,p,m;function _(w){i[10](w)}function x(w){i[11](w)}function v(w){i[12](w)}let b={};i[2].tradeoff_lts!==void 0&&(b.lts=i[2].tradeoff_lts),i[2].tradeoff_amenities!==void 0&&(b.nearbyAmenities=i[2].tradeoff_amenities),i[2].tradeoff_greenspace!==void 0&&(b.greenspace=i[2].tradeoff_greenspace),t=new Dv({props:b}),uo.push(()=>fo(t,"lts",_)),uo.push(()=>fo(t,"nearbyAmenities",x)),uo.push(()=>fo(t,"greenspace",v));let y=xi(["lts1","lts2","lts3","lts4"]),k=[];for(let w=0;w<4;w+=1)k[w]=Jc(Kc(i,y,w));return{c(){Pd(t.$$.fragment),o=ge(),r=z("ul");for(let w=0;w<4;w+=1)k[w].c();a=ge(),l=z("div"),c=z("label"),h=Pe(`Give roads a good score if they have at least this many nearby amenities: - `),u=z("input"),d=ge(),f=z("button"),f.textContent="Recalculate",St(u,"type","number"),St(u,"min","0"),St(f,"type","button")},m(w,M){Cd(t,w,M),st(w,o,M),st(w,r,M);for(let S=0;S<4;S+=1)k[S]&&k[S].m(r,null);st(w,a,M),st(w,l,M),N(l,c),N(c,h),N(c,u),ft(u,i[2].minimum_amenities),st(w,d,M),st(w,f,M),g=!0,p||(m=[Gt(u,"input",i[14]),Gt(f,"click",i[15])],p=!0)},p(w,M){const S={};if(!e&&M&4&&(e=!0,S.lts=w[2].tradeoff_lts,go(()=>e=!1)),!n&&M&4&&(n=!0,S.nearbyAmenities=w[2].tradeoff_amenities,go(()=>n=!1)),!s&&M&4&&(s=!0,S.greenspace=w[2].tradeoff_greenspace,go(()=>s=!1)),t.$set(S),M&4){y=xi(["lts1","lts2","lts3","lts4"]);let P;for(P=0;P<4;P+=1){const D=Kc(w,y,P);k[P]?k[P].p(D,M):(k[P]=Jc(D),k[P].c(),k[P].m(r,null))}for(;P<4;P+=1)k[P].d(1)}M&4&&Ge(u.value)!==w[2].minimum_amenities&&ft(u,w[2].minimum_amenities)},i(w){g||(fe(t.$$.fragment,w),g=!0)},o(w){De(t.$$.fragment,w),g=!1},d(w){w&&(ot(o),ot(r),ot(a),ot(l),ot(d),ot(f)),Ad(t,w),yr(k,w),p=!1,On(m)}}}function Tv(i){let t,e=xi(["lts1","lts2","lts3","lts4"]),n=[];for(let s=0;s<4;s+=1)n[s]=Qc(Gc(i,e,s));return{c(){t=z("ul");for(let s=0;s<4;s+=1)n[s].c()},m(s,o){st(s,t,o);for(let r=0;r<4;r+=1)n[r]&&n[r].m(t,null)},p(s,o){if(o&9){e=xi(["lts1","lts2","lts3","lts4"]);let r;for(r=0;r<4;r+=1){const a=Gc(s,e,r);n[r]?n[r].p(a,o):(n[r]=Qc(a),n[r].c(),n[r].m(t,null))}for(;r<4;r+=1)n[r].d(1)}},i:It,o:It,d(s){s&&ot(t),yr(n,s)}}}function Lv(i){let t,e=xi(Object.keys(i[4])),n=[];for(let s=0;si[5].call(s))},m(v,b){st(v,t,b),N(t,e),N(e,n),N(e,s),N(s,o),N(s,r),N(s,a),N(s,l),Ps(s,i[1],!0),st(v,c,b),~h&&_[h].m(v,b),st(v,d,b),f=!0,g||(p=Gt(s,"change",i[5]),g=!0)},p(v,[b]){b&2&&Ps(s,v[1]);let y=h;h=x(v),h===y?~h&&_[h].p(v,b):(u&&(_r(),De(_[y],1,1,()=>{_[y]=null}),xr()),~h?(u=_[h],u?u.p(v,b):(u=_[h]=m[h](v),u.c()),fe(u,1),u.m(d.parentNode,d)):u=null)},i(v){f||(fe(u),f=!0)},o(v){De(u),f=!1},d(v){v&&(ot(t),ot(c),ot(d)),~h&&_[h].d(v),g=!1,p()}}}function Ev(i,t,e){let{cost:n}=t,s="Distance",o={tradeoff_lts:50,tradeoff_amenities:30,tradeoff_greenspace:20,lts1:0,lts2:.2,lts3:.6,lts4:1,minimum_amenities:1},r={lts1:1,lts2:1,lts3:1,lts4:1},a={};for(let b of["cycleway","footway","living_street","motorway","motorway_link","path","pedestrian","primary","primary_link","residential","secondary","secondary_link","service","steps","tertiary","tertiary_link","track","trunk","trunk_link","unclassified"])a[b]=1;function l(b){b=="OsmHighwayType"?e(0,n={OsmHighwayType:a}):b=="ByLTS"?e(0,n={ByLTS:r}):b=="Generalized"?e(0,n={Generalized:o}):e(0,n=b)}function c(){s=nh(this),e(1,s)}function h(b){a[b]=Ge(this.value),e(4,a)}const u=()=>e(0,n);function d(b){r[b]=Ge(this.value),e(3,r)}const f=()=>e(0,n);function g(b){i.$$.not_equal(o.tradeoff_lts,b)&&(o.tradeoff_lts=b,e(2,o))}function p(b){i.$$.not_equal(o.tradeoff_amenities,b)&&(o.tradeoff_amenities=b,e(2,o))}function m(b){i.$$.not_equal(o.tradeoff_greenspace,b)&&(o.tradeoff_greenspace=b,e(2,o))}function _(b){o[b]=Ge(this.value),e(2,o)}function x(){o.minimum_amenities=Ge(this.value),e(2,o)}const v=()=>e(0,n);return i.$$set=b=>{"cost"in b&&e(0,n=b.cost)},i.$$.update=()=>{i.$$.dirty&2&&l(s)},[n,s,o,r,a,c,h,u,d,f,g,p,m,_,x,v]}class vw extends An{constructor(t){super(),Dn(this,t,Ev,Rv,Pi,{cost:0})}}function eh(i){let t;return{c(){t=z("div"),t.textContent="Loading",St(t,"class","svelte-1uuov7f")},m(e,n){st(e,t,n)},d(e){e&&ot(t)}}}function Iv(i){let t,e=i[0]&&eh();return{c(){e&&e.c(),t=Gs()},m(n,s){e&&e.m(n,s),st(n,t,s)},p(n,[s]){n[0]?e||(e=eh(),e.c(),e.m(t.parentNode,t)):e&&(e.d(1),e=null)},i:It,o:It,d(n){n&&ot(t),e&&e.d(n)}}}function Fv(i,t,e){let{loading:n=!1}=t;return i.$$set=s=>{"loading"in s&&e(0,n=s.loading)},[n]}class ww extends An{constructor(t){super(),Dn(this,t,Fv,Iv,Pi,{loading:0})}}export{Nv as C,Bv as G,Ho as J,ww as L,Vd as _,vw as a}; diff --git a/assets/Loading-a8d2f85e.js b/assets/Loading-a8d2f85e.js new file mode 100644 index 0000000..b1f9ab5 --- /dev/null +++ b/assets/Loading-a8d2f85e.js @@ -0,0 +1,39 @@ +var pd=Object.defineProperty;var md=(i,t,e)=>t in i?pd(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var A=(i,t,e)=>(md(i,typeof t!="symbol"?t+"":t,e),e);import{af as bd,ag as _d,S as Dn,i as On,s as Pi,D as Zs,l as Z,t as pe,r as _r,b as De,u as xr,v as J,ah as xd,T as ho,a7 as yd,U as uo,ai as aa,E as Ft,G as vd,J as wd,K as kd,N as Md,Y as Sd,e as z,g as Gt,j as ft,k as nh,n as F,p as Cs,q as $t,C as sh,f as Dt,z as mi,I as la,w as Ci,a6 as yr,x as ys,V as Ge,y as fo,ab as xi,c as Pd,h as St,a as Cd,A as go,d as Ad,ac as vr,aa as oh}from"./Legend-36db5a45.js";function Dd(i,t,e,n,s){let o=!1;i.getSource(t)&&(o=!0,i.removeSource(t));const r=()=>{n(t)&&(i.addSource(t,e),s())};if(o){const a=()=>{t&&(i.getSource(t)?setTimeout(a,1):r())};a()}else r()}function Od(i,t,e){bd().then(()=>{let n=_d(i);if(!n)return;n.getSource(t)===e&&n.removeSource(t)})}function ca(i){let t=i[0],e,n,s=ha(i);return{c(){s.c(),e=Zs()},m(o,r){s.m(o,r),Z(o,e,r),n=!0},p(o,r){r&1&&Pi(t,t=o[0])?(_r(),De(s,1,1,Ft),xr(),s=ha(o),s.c(),pe(s,1),s.m(e.parentNode,e)):s.p(o,r)},i(o){n||(pe(s),n=!0)},o(o){De(s),n=!1},d(o){o&&J(e),s.d(o)}}}function ha(i){let t;const e=i[15].default,n=vd(e,i,i[14],null);return{c(){n&&n.c()},m(s,o){n&&n.m(s,o),t=!0},p(s,o){n&&n.p&&(!t||o&16384)&&wd(n,e,s,s[14],t?Md(e,s[14],o,null):kd(s[14]),null)},i(s){t||(pe(n,s),t=!0)},o(s){De(n,s),t=!1},d(s){n&&n.d(s)}}}function Td(i){let t,e,n=i[0]&&ca(i);return{c(){n&&n.c(),t=Zs()},m(s,o){n&&n.m(s,o),Z(s,t,o),e=!0},p(s,[o]){s[0]?n?(n.p(s,o),o&1&&pe(n,1)):(n=ca(s),n.c(),pe(n,1),n.m(t.parentNode,t)):n&&(_r(),De(n,1,1,()=>{n=null}),xr())},i(s){e||(pe(n),e=!0)},o(s){De(n),e=!1},d(s){s&&J(t),n&&n.d(s)}}}function Ld(i,t,e){let n,s,o,{$$slots:r={},$$scope:a}=t,{id:l=Sd("geojson")}=t,{data:c}=t,{generateId:h=!1}=t,{promoteId:u=void 0}=t,{filter:d=void 0}=t,{lineMetrics:f=void 0}=t,{cluster:g=void 0}=t;const{map:p,cluster:m,self:b}=xd();ho(i,p,_=>e(13,s=_)),ho(i,m,_=>e(16,o=_)),ho(i,b,_=>e(0,n=_));let x,w=!0;return yd(()=>{n&&x&&s&&(Od(p,n,x),uo(b,n=null,n),e(11,x=void 0))}),i.$$set=_=>{"id"in _&&e(4,l=_.id),"data"in _&&e(5,c=_.data),"generateId"in _&&e(6,h=_.generateId),"promoteId"in _&&e(7,u=_.promoteId),"filter"in _&&e(8,d=_.filter),"lineMetrics"in _&&e(9,f=_.lineMetrics),"cluster"in _&&e(10,g=_.cluster),"$$scope"in _&&e(14,a=_.$$scope)},i.$$.update=()=>{i.$$.dirty&1024&&uo(m,o=g,o),i.$$.dirty&12273&&s&&n!==l&&(uo(b,n=l,n),Dd(s,n,aa({type:"geojson",data:c,filter:d,lineMetrics:f,generateId:h,promoteId:u,cluster:!!g,clusterMinPoints:g==null?void 0:g.minPoints,clusterMaxZoom:g==null?void 0:g.maxZoom,clusterRadius:g==null?void 0:g.radius,clusterProperties:g==null?void 0:g.properties}),_=>s&&_===n,()=>{n&&(e(11,x=s==null?void 0:s.getSource(n)),e(12,w=!0))})),i.$$.dirty&8208&&(s==null||s.on("style.load",()=>{e(11,x=s==null?void 0:s.getSource(l))})),i.$$.dirty&6176&&x&&(w?e(12,w=!1):x.setData(c)),i.$$.dirty&3072&&(x==null||x.setClusterOptions(aa({cluster:!!g,clusterMaxZoom:g==null?void 0:g.maxZoom,clusterRadius:g==null?void 0:g.radius})))},[n,p,m,b,l,c,h,u,d,f,g,x,w,s,a,r]}class Bv extends Dn{constructor(t){super(),On(this,t,Ld,Td,Pi,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}}let B;const rh=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&rh.decode();let Gi=null;function cn(){return(Gi===null||Gi.byteLength===0)&&(Gi=new Uint8Array(B.memory.buffer)),Gi}function Ke(i,t){return i=i>>>0,rh.decode(cn().subarray(i,i+t))}const ue=new Array(128).fill(void 0);ue.push(void 0,null,!0,!1);let hn=ue.length;function Y(i){hn===ue.length&&ue.push(ue.length+1);const t=hn;return hn=ue[t],ue[t]=i,t}function R(i){return ue[i]}function Rd(i){i<132||(ue[i]=hn,hn=i)}function ve(i){const t=R(i);return Rd(i),t}let Je=0;const vs=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},Ed=typeof vs.encodeInto=="function"?function(i,t){return vs.encodeInto(i,t)}:function(i,t){const e=vs.encode(i);return t.set(e),{read:i.length,written:e.length}};function po(i,t,e){if(e===void 0){const a=vs.encode(i),l=t(a.length,1)>>>0;return cn().subarray(l,l+a.length).set(a),Je=a.length,l}let n=i.length,s=t(n,1)>>>0;const o=cn();let r=0;for(;r127)break;o[s+r]=a}if(r!==n){r!==0&&(i=i.slice(r)),s=e(s,n,n=r+i.length*3,1)>>>0;const a=cn().subarray(s+r,s+n),l=Ed(i,a);r+=l.written}return Je=r,s}function Ai(i){return i==null}let Zi=null;function st(){return(Zi===null||Zi.byteLength===0)&&(Zi=new Int32Array(B.memory.buffer)),Zi}let Ji=null;function ah(){return(Ji===null||Ji.byteLength===0)&&(Ji=new Float64Array(B.memory.buffer)),Ji}let Qi=null;function Id(){return(Qi===null||Qi.byteLength===0)&&(Qi=new BigInt64Array(B.memory.buffer)),Qi}function jo(i){const t=typeof i;if(t=="number"||t=="boolean"||i==null)return`${i}`;if(t=="string")return`"${i}"`;if(t=="symbol"){const s=i.description;return s==null?"Symbol":`Symbol(${s})`}if(t=="function"){const s=i.name;return typeof s=="string"&&s.length>0?`Function(${s})`:"Function"}if(Array.isArray(i)){const s=i.length;let o="[";s>0&&(o+=jo(i[0]));for(let r=1;r1)n=e[1];else return toString.call(i);if(n=="Object")try{return"Object("+JSON.stringify(i)+")"}catch{return"Object"}return i instanceof Error?`${i.name}: ${i.message} +${i.stack}`:n}function Fd(i,t){const e=t(i.length*1,1)>>>0;return cn().set(i,e/1),Je=i.length,e}function $d(i,t){return i=i>>>0,ah().subarray(i/8,i/8+t)}function $e(i,t){try{return i.apply(this,t)}catch(e){B.__wbindgen_exn_store(Y(e))}}class Ho{static __wrap(t){t=t>>>0;const e=Object.create(Ho.prototype);return e.__wbg_ptr=t,e}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,t}free(){const t=this.__destroy_into_raw();B.__wbg_jsnetwork_free(t)}constructor(t){try{const o=B.__wbindgen_add_to_stack_pointer(-16),r=Fd(t,B.__wbindgen_malloc),a=Je;B.jsnetwork_new(o,r,a);var e=st()[o/4+0],n=st()[o/4+1],s=st()[o/4+2];if(s)throw ve(n);return Ho.__wrap(e)}finally{B.__wbindgen_add_to_stack_pointer(16)}}recalculate(t){let e,n;try{const h=B.__wbindgen_add_to_stack_pointer(-16);B.jsnetwork_recalculate(h,this.__wbg_ptr,Y(t));var s=st()[h/4+0],o=st()[h/4+1],r=st()[h/4+2],a=st()[h/4+3],l=s,c=o;if(a)throw l=0,c=0,ve(r);return e=l,n=c,Ke(l,c)}finally{B.__wbindgen_add_to_stack_pointer(16),B.__wbindgen_free(e,n,1)}}updateCostFunction(t){try{const s=B.__wbindgen_add_to_stack_pointer(-16);B.jsnetwork_updateCostFunction(s,this.__wbg_ptr,Y(t));var e=st()[s/4+0],n=st()[s/4+1];if(n)throw ve(e)}finally{B.__wbindgen_add_to_stack_pointer(16)}}getBounds(){try{const s=B.__wbindgen_add_to_stack_pointer(-16);B.jsnetwork_getBounds(s,this.__wbg_ptr);var t=st()[s/4+0],e=st()[s/4+1],n=$d(t,e).slice();return B.__wbindgen_free(t,e*8),n}finally{B.__wbindgen_add_to_stack_pointer(16)}}debugNetwork(){let t,e;try{const c=B.__wbindgen_add_to_stack_pointer(-16);B.jsnetwork_debugNetwork(c,this.__wbg_ptr);var n=st()[c/4+0],s=st()[c/4+1],o=st()[c/4+2],r=st()[c/4+3],a=n,l=s;if(r)throw a=0,l=0,ve(o);return t=a,e=l,Ke(a,l)}finally{B.__wbindgen_add_to_stack_pointer(16),B.__wbindgen_free(t,e,1)}}}async function zd(i,t){if(typeof Response=="function"&&i instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(i,t)}catch(n){if(i.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}const e=await i.arrayBuffer();return await WebAssembly.instantiate(e,t)}else{const e=await WebAssembly.instantiate(i,t);return e instanceof WebAssembly.Instance?{instance:e,module:i}:e}}function Bd(){const i={};return i.wbg={},i.wbg.__wbindgen_string_new=function(t,e){const n=Ke(t,e);return Y(n)},i.wbg.__wbindgen_is_bigint=function(t){return typeof R(t)=="bigint"},i.wbg.__wbindgen_bigint_from_u64=function(t){const e=BigInt.asUintN(64,t);return Y(e)},i.wbg.__wbindgen_jsval_eq=function(t,e){return R(t)===R(e)},i.wbg.__wbindgen_object_drop_ref=function(t){ve(t)},i.wbg.__wbindgen_string_get=function(t,e){const n=R(e),s=typeof n=="string"?n:void 0;var o=Ai(s)?0:po(s,B.__wbindgen_malloc,B.__wbindgen_realloc),r=Je;st()[t/4+1]=r,st()[t/4+0]=o},i.wbg.__wbindgen_number_get=function(t,e){const n=R(e),s=typeof n=="number"?n:void 0;ah()[t/8+1]=Ai(s)?0:s,st()[t/4+0]=!Ai(s)},i.wbg.__wbindgen_is_string=function(t){return typeof R(t)=="string"},i.wbg.__wbindgen_is_object=function(t){const e=R(t);return typeof e=="object"&&e!==null},i.wbg.__wbindgen_is_undefined=function(t){return R(t)===void 0},i.wbg.__wbindgen_in=function(t,e){return R(t)in R(e)},i.wbg.__wbindgen_error_new=function(t,e){const n=new Error(Ke(t,e));return Y(n)},i.wbg.__wbindgen_object_clone_ref=function(t){const e=R(t);return Y(e)},i.wbg.__wbindgen_jsval_loose_eq=function(t,e){return R(t)==R(e)},i.wbg.__wbindgen_boolean_get=function(t){const e=R(t);return typeof e=="boolean"?e?1:0:2},i.wbg.__wbindgen_number_new=function(t){return Y(t)},i.wbg.__wbg_getwithrefkey_3b3c46ba20582127=function(t,e){const n=R(t)[R(e)];return Y(n)},i.wbg.__wbg_new_abda76e883ba8a5f=function(){const t=new Error;return Y(t)},i.wbg.__wbg_stack_658279fe44541cf6=function(t,e){const n=R(e).stack,s=po(n,B.__wbindgen_malloc,B.__wbindgen_realloc),o=Je;st()[t/4+1]=o,st()[t/4+0]=s},i.wbg.__wbg_error_f851667af71bcfc6=function(t,e){let n,s;try{n=t,s=e,console.error(Ke(t,e))}finally{B.__wbindgen_free(n,s,1)}},i.wbg.__wbg_getwithrefkey_5e6d9547403deab8=function(t,e){const n=R(t)[R(e)];return Y(n)},i.wbg.__wbg_set_841ac57cff3d672b=function(t,e,n){R(t)[ve(e)]=ve(n)},i.wbg.__wbg_now_0cfdc90c97d0c24b=function(t){return R(t).now()},i.wbg.__wbg_debug_9a6b3243fbbebb61=function(t){console.debug(R(t))},i.wbg.__wbg_error_788ae33f81d3b84b=function(t){console.error(R(t))},i.wbg.__wbg_info_2e30e8204b29d91d=function(t){console.info(R(t))},i.wbg.__wbg_log_1d3ae0273d8f4f8a=function(t){console.log(R(t))},i.wbg.__wbg_warn_d60e832f9882c1b2=function(t){console.warn(R(t))},i.wbg.__wbg_get_44be0491f933a435=function(t,e){const n=R(t)[e>>>0];return Y(n)},i.wbg.__wbg_length_fff51ee6522a1a18=function(t){return R(t).length},i.wbg.__wbg_new_898a68150f225f2e=function(){const t=new Array;return Y(t)},i.wbg.__wbindgen_is_function=function(t){return typeof R(t)=="function"},i.wbg.__wbg_newnoargs_581967eacc0e2604=function(t,e){const n=new Function(Ke(t,e));return Y(n)},i.wbg.__wbg_next_526fc47e980da008=function(t){const e=R(t).next;return Y(e)},i.wbg.__wbg_next_ddb3312ca1c4e32a=function(){return $e(function(t){const e=R(t).next();return Y(e)},arguments)},i.wbg.__wbg_done_5c1f01fb660d73b5=function(t){return R(t).done},i.wbg.__wbg_value_1695675138684bd5=function(t){const e=R(t).value;return Y(e)},i.wbg.__wbg_iterator_97f0c81209c6c35a=function(){return Y(Symbol.iterator)},i.wbg.__wbg_get_97b561fb56f034b5=function(){return $e(function(t,e){const n=Reflect.get(R(t),R(e));return Y(n)},arguments)},i.wbg.__wbg_call_cb65541d95d71282=function(){return $e(function(t,e){const n=R(t).call(R(e));return Y(n)},arguments)},i.wbg.__wbg_new_b51585de1b234aff=function(){const t=new Object;return Y(t)},i.wbg.__wbg_self_1ff1d729e9aae938=function(){return $e(function(){const t=self.self;return Y(t)},arguments)},i.wbg.__wbg_window_5f4faef6c12b79ec=function(){return $e(function(){const t=window.window;return Y(t)},arguments)},i.wbg.__wbg_globalThis_1d39714405582d3c=function(){return $e(function(){const t=globalThis.globalThis;return Y(t)},arguments)},i.wbg.__wbg_global_651f05c6a0944d1c=function(){return $e(function(){const t=global.global;return Y(t)},arguments)},i.wbg.__wbg_set_502d29070ea18557=function(t,e,n){R(t)[e>>>0]=ve(n)},i.wbg.__wbg_instanceof_ArrayBuffer_39ac22089b74fddb=function(t){let e;try{e=R(t)instanceof ArrayBuffer}catch{e=!1}return e},i.wbg.__wbg_isSafeInteger_bb8e18dd21c97288=function(t){return Number.isSafeInteger(R(t))},i.wbg.__wbg_entries_e51f29c7bba0c054=function(t){const e=Object.entries(R(t));return Y(e)},i.wbg.__wbg_buffer_085ec1f694018c4f=function(t){const e=R(t).buffer;return Y(e)},i.wbg.__wbg_new_8125e318e6245eed=function(t){const e=new Uint8Array(R(t));return Y(e)},i.wbg.__wbg_set_5cf90238115182c3=function(t,e,n){R(t).set(R(e),n>>>0)},i.wbg.__wbg_length_72e2208bbc0efc61=function(t){return R(t).length},i.wbg.__wbg_instanceof_Uint8Array_d8d9cb2b8e8ac1d4=function(t){let e;try{e=R(t)instanceof Uint8Array}catch{e=!1}return e},i.wbg.__wbindgen_bigint_get_as_i64=function(t,e){const n=R(e),s=typeof n=="bigint"?n:void 0;Id()[t/8+1]=Ai(s)?BigInt(0):s,st()[t/4+0]=!Ai(s)},i.wbg.__wbindgen_debug_string=function(t,e){const n=jo(R(e)),s=po(n,B.__wbindgen_malloc,B.__wbindgen_realloc),o=Je;st()[t/4+1]=o,st()[t/4+0]=s},i.wbg.__wbindgen_throw=function(t,e){throw new Error(Ke(t,e))},i.wbg.__wbindgen_memory=function(){const t=B.memory;return Y(t)},i}function Nd(i,t){return B=i.exports,Vd.__wbindgen_wasm_module=t,Qi=null,Ji=null,Zi=null,Gi=null,B}async function Vd(i){if(B!==void 0)return B;typeof i>"u"&&(i="/od2net/assets/wasm_od2net_bg.wasm");const t=Bd();(typeof i=="string"||typeof Request=="function"&&i instanceof Request||typeof URL=="function"&&i instanceof URL)&&(i=fetch(i));const{instance:e,module:n}=await zd(await i,t);return Nd(e,n)}function Wd(i){let t,e,n,s,o,r,a,l,c,h,u,d;return{c(){t=z("div"),e=z("label"),n=Gt(`Or load an example: + `),s=z("select"),o=z("option"),o.textContent="Custom file loaded",r=z("option"),r.textContent="Antwerp",a=z("option"),a.textContent="Berlin",l=z("option"),l.textContent="South London",c=z("option"),c.textContent="Paris",h=z("option"),h.textContent="Seattle",o.__value="",ft(o,o.__value),r.__value="antwerp",ft(r,r.__value),a.__value="berlin",ft(a,a.__value),l.__value="london",ft(l,l.__value),c.__value="paris",ft(c,c.__value),h.__value="seattle",ft(h,h.__value),i[0]===void 0&&nh(()=>i[1].call(s))},m(f,g){Z(f,t,g),F(t,e),F(e,n),F(e,s),F(s,o),F(s,r),F(s,a),F(s,l),F(s,c),F(s,h),Cs(s,i[0],!0),u||(d=$t(s,"change",i[1]),u=!0)},p(f,[g]){g&1&&Cs(s,f[0])},i:Ft,o:Ft,d(f){f&&J(t),u=!1,d()}}}function jd(i,t,e){let{example:n}=t;function s(){n=sh(this),e(0,n)}return i.$$set=o=>{"example"in o&&e(0,n=o.example)},[n,s]}class Nv extends Dn{constructor(t){super(),On(this,t,jd,Wd,Pi,{example:0})}}/*! + * @kurkle/color v0.3.2 + * https://github.com/kurkle/color#readme + * (c) 2023 Jukka Kurkela + * Released under the MIT License + */function Tn(i){return i+.5|0}const we=(i,t,e)=>Math.max(Math.min(i,e),t);function tn(i){return we(Tn(i*2.55),0,255)}function Ce(i){return we(Tn(i*255),0,255)}function le(i){return we(Tn(i/2.55)/100,0,1)}function ua(i){return we(Tn(i*100),0,100)}const Tt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Yo=[..."0123456789ABCDEF"],Hd=i=>Yo[i&15],Yd=i=>Yo[(i&240)>>4]+Yo[i&15],Bn=i=>(i&240)>>4===(i&15),Xd=i=>Bn(i.r)&&Bn(i.g)&&Bn(i.b)&&Bn(i.a);function Ud(i){var t=i.length,e;return i[0]==="#"&&(t===4||t===5?e={r:255&Tt[i[1]]*17,g:255&Tt[i[2]]*17,b:255&Tt[i[3]]*17,a:t===5?Tt[i[4]]*17:255}:(t===7||t===9)&&(e={r:Tt[i[1]]<<4|Tt[i[2]],g:Tt[i[3]]<<4|Tt[i[4]],b:Tt[i[5]]<<4|Tt[i[6]],a:t===9?Tt[i[7]]<<4|Tt[i[8]]:255})),e}const qd=(i,t)=>i<255?t(i):"";function Kd(i){var t=Xd(i)?Hd:Yd;return i?"#"+t(i.r)+t(i.g)+t(i.b)+qd(i.a,t):void 0}const Gd=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function lh(i,t,e){const n=t*Math.min(e,1-e),s=(o,r=(o+i/30)%12)=>e-n*Math.max(Math.min(r-3,9-r,1),-1);return[s(0),s(8),s(4)]}function Zd(i,t,e){const n=(s,o=(s+i/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[n(5),n(3),n(1)]}function Jd(i,t,e){const n=lh(i,1,.5);let s;for(t+e>1&&(s=1/(t+e),t*=s,e*=s),s=0;s<3;s++)n[s]*=1-t-e,n[s]+=t;return n}function Qd(i,t,e,n,s){return i===s?(t-e)/n+(t.5?h/(2-o-r):h/(o+r),l=Qd(e,n,s,h,o),l=l*60+.5),[l|0,c||0,a]}function kr(i,t,e,n){return(Array.isArray(t)?i(t[0],t[1],t[2]):i(t,e,n)).map(Ce)}function Mr(i,t,e){return kr(lh,i,t,e)}function tf(i,t,e){return kr(Jd,i,t,e)}function ef(i,t,e){return kr(Zd,i,t,e)}function ch(i){return(i%360+360)%360}function nf(i){const t=Gd.exec(i);let e=255,n;if(!t)return;t[5]!==n&&(e=t[6]?tn(+t[5]):Ce(+t[5]));const s=ch(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?n=tf(s,o,r):t[1]==="hsv"?n=ef(s,o,r):n=Mr(s,o,r),{r:n[0],g:n[1],b:n[2],a:e}}function sf(i,t){var e=wr(i);e[0]=ch(e[0]+t),e=Mr(e),i.r=e[0],i.g=e[1],i.b=e[2]}function of(i){if(!i)return;const t=wr(i),e=t[0],n=ua(t[1]),s=ua(t[2]);return i.a<255?`hsla(${e}, ${n}%, ${s}%, ${le(i.a)})`:`hsl(${e}, ${n}%, ${s}%)`}const da={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},fa={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function rf(){const i={},t=Object.keys(fa),e=Object.keys(da);let n,s,o,r,a;for(n=0;n>16&255,o>>8&255,o&255]}return i}let Nn;function af(i){Nn||(Nn=rf(),Nn.transparent=[0,0,0,0]);const t=Nn[i.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const lf=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function cf(i){const t=lf.exec(i);let e=255,n,s,o;if(t){if(t[7]!==n){const r=+t[7];e=t[8]?tn(r):we(r*255,0,255)}return n=+t[1],s=+t[3],o=+t[5],n=255&(t[2]?tn(n):we(n,0,255)),s=255&(t[4]?tn(s):we(s,0,255)),o=255&(t[6]?tn(o):we(o,0,255)),{r:n,g:s,b:o,a:e}}}function hf(i){return i&&(i.a<255?`rgba(${i.r}, ${i.g}, ${i.b}, ${le(i.a)})`:`rgb(${i.r}, ${i.g}, ${i.b})`)}const mo=i=>i<=.0031308?i*12.92:Math.pow(i,1/2.4)*1.055-.055,ri=i=>i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4);function uf(i,t,e){const n=ri(le(i.r)),s=ri(le(i.g)),o=ri(le(i.b));return{r:Ce(mo(n+e*(ri(le(t.r))-n))),g:Ce(mo(s+e*(ri(le(t.g))-s))),b:Ce(mo(o+e*(ri(le(t.b))-o))),a:i.a+e*(t.a-i.a)}}function Vn(i,t,e){if(i){let n=wr(i);n[t]=Math.max(0,Math.min(n[t]+n[t]*e,t===0?360:1)),n=Mr(n),i.r=n[0],i.g=n[1],i.b=n[2]}}function hh(i,t){return i&&Object.assign(t||{},i)}function ga(i){var t={r:0,g:0,b:0,a:255};return Array.isArray(i)?i.length>=3&&(t={r:i[0],g:i[1],b:i[2],a:255},i.length>3&&(t.a=Ce(i[3]))):(t=hh(i,{r:0,g:0,b:0,a:1}),t.a=Ce(t.a)),t}function df(i){return i.charAt(0)==="r"?cf(i):nf(i)}let uh=class Xo{constructor(t){if(t instanceof Xo)return t;const e=typeof t;let n;e==="object"?n=ga(t):e==="string"&&(n=Ud(t)||af(t)||df(t)),this._rgb=n,this._valid=!!n}get valid(){return this._valid}get rgb(){var t=hh(this._rgb);return t&&(t.a=le(t.a)),t}set rgb(t){this._rgb=ga(t)}rgbString(){return this._valid?hf(this._rgb):void 0}hexString(){return this._valid?Kd(this._rgb):void 0}hslString(){return this._valid?of(this._rgb):void 0}mix(t,e){if(t){const n=this.rgb,s=t.rgb;let o;const r=e===o?.5:e,a=2*r-1,l=n.a-s.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-c,n.r=255&c*n.r+o*s.r+.5,n.g=255&c*n.g+o*s.g+.5,n.b=255&c*n.b+o*s.b+.5,n.a=r*n.a+(1-r)*s.a,this.rgb=n}return this}interpolate(t,e){return t&&(this._rgb=uf(this._rgb,t._rgb,e)),this}clone(){return new Xo(this.rgb)}alpha(t){return this._rgb.a=Ce(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=Tn(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){const e=this._rgb;return e.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Vn(this._rgb,2,t),this}darken(t){return Vn(this._rgb,2,-t),this}saturate(t){return Vn(this._rgb,1,t),this}desaturate(t){return Vn(this._rgb,1,-t),this}rotate(t){return sf(this._rgb,t),this}};/*! + * Chart.js v4.4.0 + * https://www.chartjs.org + * (c) 2023 Chart.js Contributors + * Released under the MIT License + */function ne(){}const ff=(()=>{let i=0;return()=>i++})();function j(i){return i===null||typeof i>"u"}function Q(i){if(Array.isArray&&Array.isArray(i))return!0;const t=Object.prototype.toString.call(i);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function N(i){return i!==null&&Object.prototype.toString.call(i)==="[object Object]"}function rt(i){return(typeof i=="number"||i instanceof Number)&&isFinite(+i)}function Ct(i,t){return rt(i)?i:t}function E(i,t){return typeof i>"u"?t:i}const gf=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100:+i/t,dh=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100*t:+i;function G(i,t,e){if(i&&typeof i.call=="function")return i.apply(e,t)}function X(i,t,e,n){let s,o,r;if(Q(i))if(o=i.length,n)for(s=o-1;s>=0;s--)t.call(e,i[s],s);else for(s=0;si,x:i=>i.x,y:i=>i.y};function bf(i){const t=i.split("."),e=[];let n="";for(const s of t)n+=s,n.endsWith("\\")?n=n.slice(0,-1)+".":(e.push(n),n="");return e}function _f(i){const t=bf(i);return e=>{for(const n of t){if(n==="")break;e=e&&e[n]}return e}}function Oe(i,t){return(pa[t]||(pa[t]=_f(t)))(i)}function Sr(i){return i.charAt(0).toUpperCase()+i.slice(1)}const yn=i=>typeof i<"u",Te=i=>typeof i=="function",ma=(i,t)=>{if(i.size!==t.size)return!1;for(const e of i)if(!t.has(e))return!1;return!0};function xf(i){return i.type==="mouseup"||i.type==="click"||i.type==="contextmenu"}const et=Math.PI,tt=2*et,yf=tt+et,Os=Number.POSITIVE_INFINITY,vf=et/180,ut=et/2,ze=et/4,ba=et*2/3,ke=Math.log10,Zt=Math.sign;function dn(i,t,e){return Math.abs(i-t)s-o).pop(),t}function yi(i){return!isNaN(parseFloat(i))&&isFinite(i)}function kf(i,t){const e=Math.round(i);return e-t<=i&&e+t>=i}function gh(i,t,e){let n,s,o;for(n=0,s=i.length;nl&&c=Math.min(t,e)-n&&i<=Math.max(t,e)+n}function Cr(i,t,e){e=e||(r=>i[r]1;)o=s+n>>1,e(o)?s=o:n=o;return{lo:s,hi:n}}const fe=(i,t,e,n)=>Cr(i,e,n?s=>{const o=i[s][t];return oi[s][t]Cr(i,e,n=>i[n][t]>=e);function Cf(i,t,e){let n=0,s=i.length;for(;nn&&i[s-1]>e;)s--;return n>0||s{const n="_onData"+Sr(e),s=i[e];Object.defineProperty(i,e,{configurable:!0,enumerable:!1,value(...o){const r=s.apply(this,o);return i._chartjs.listeners.forEach(a=>{typeof a[n]=="function"&&a[n](...o)}),r}})})}function ya(i,t){const e=i._chartjs;if(!e)return;const n=e.listeners,s=n.indexOf(t);s!==-1&&n.splice(s,1),!(n.length>0)&&(mh.forEach(o=>{delete i[o]}),delete i._chartjs)}function bh(i){const t=new Set(i);return t.size===i.length?i:Array.from(t)}const _h=function(){return typeof window>"u"?function(i){return i()}:window.requestAnimationFrame}();function xh(i,t){let e=[],n=!1;return function(...s){e=s,n||(n=!0,_h.call(window,()=>{n=!1,i.apply(t,e)}))}}function Df(i,t){let e;return function(...n){return t?(clearTimeout(e),e=setTimeout(i,t,n)):i.apply(this,n),t}}const Ar=i=>i==="start"?"left":i==="end"?"right":"center",bt=(i,t,e)=>i==="start"?t:i==="end"?e:(t+e)/2,Of=(i,t,e,n)=>i===(n?"left":"right")?e:i==="center"?(t+e)/2:t;function yh(i,t,e){const n=t.length;let s=0,o=n;if(i._sorted){const{iScale:r,_parsed:a}=i,l=r.axis,{min:c,max:h,minDefined:u,maxDefined:d}=r.getUserBounds();u&&(s=gt(Math.min(fe(a,l,c).lo,e?n:fe(t,l,r.getPixelForValue(c)).lo),0,n-1)),d?o=gt(Math.max(fe(a,r.axis,h,!0).hi+1,e?0:fe(t,l,r.getPixelForValue(h),!0).hi+1),s,n)-s:o=n-s}return{start:s,count:o}}function vh(i){const{xScale:t,yScale:e,_scaleRanges:n}=i,s={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!n)return i._scaleRanges=s,!0;const o=n.xmin!==t.min||n.xmax!==t.max||n.ymin!==e.min||n.ymax!==e.max;return Object.assign(n,s),o}const Wn=i=>i===0||i===1,va=(i,t,e)=>-(Math.pow(2,10*(i-=1))*Math.sin((i-t)*tt/e)),wa=(i,t,e)=>Math.pow(2,-10*i)*Math.sin((i-t)*tt/e)+1,fn={linear:i=>i,easeInQuad:i=>i*i,easeOutQuad:i=>-i*(i-2),easeInOutQuad:i=>(i/=.5)<1?.5*i*i:-.5*(--i*(i-2)-1),easeInCubic:i=>i*i*i,easeOutCubic:i=>(i-=1)*i*i+1,easeInOutCubic:i=>(i/=.5)<1?.5*i*i*i:.5*((i-=2)*i*i+2),easeInQuart:i=>i*i*i*i,easeOutQuart:i=>-((i-=1)*i*i*i-1),easeInOutQuart:i=>(i/=.5)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2),easeInQuint:i=>i*i*i*i*i,easeOutQuint:i=>(i-=1)*i*i*i*i+1,easeInOutQuint:i=>(i/=.5)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2),easeInSine:i=>-Math.cos(i*ut)+1,easeOutSine:i=>Math.sin(i*ut),easeInOutSine:i=>-.5*(Math.cos(et*i)-1),easeInExpo:i=>i===0?0:Math.pow(2,10*(i-1)),easeOutExpo:i=>i===1?1:-Math.pow(2,-10*i)+1,easeInOutExpo:i=>Wn(i)?i:i<.5?.5*Math.pow(2,10*(i*2-1)):.5*(-Math.pow(2,-10*(i*2-1))+2),easeInCirc:i=>i>=1?i:-(Math.sqrt(1-i*i)-1),easeOutCirc:i=>Math.sqrt(1-(i-=1)*i),easeInOutCirc:i=>(i/=.5)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1),easeInElastic:i=>Wn(i)?i:va(i,.075,.3),easeOutElastic:i=>Wn(i)?i:wa(i,.075,.3),easeInOutElastic(i){return Wn(i)?i:i<.5?.5*va(i*2,.1125,.45):.5+.5*wa(i*2-1,.1125,.45)},easeInBack(i){return i*i*((1.70158+1)*i-1.70158)},easeOutBack(i){return(i-=1)*i*((1.70158+1)*i+1.70158)+1},easeInOutBack(i){let t=1.70158;return(i/=.5)<1?.5*(i*i*(((t*=1.525)+1)*i-t)):.5*((i-=2)*i*(((t*=1.525)+1)*i+t)+2)},easeInBounce:i=>1-fn.easeOutBounce(1-i),easeOutBounce(i){return i<1/2.75?7.5625*i*i:i<2/2.75?7.5625*(i-=1.5/2.75)*i+.75:i<2.5/2.75?7.5625*(i-=2.25/2.75)*i+.9375:7.5625*(i-=2.625/2.75)*i+.984375},easeInOutBounce:i=>i<.5?fn.easeInBounce(i*2)*.5:fn.easeOutBounce(i*2-1)*.5+.5};function Dr(i){if(i&&typeof i=="object"){const t=i.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function ka(i){return Dr(i)?i:new uh(i)}function bo(i){return Dr(i)?i:new uh(i).saturate(.5).darken(.1).hexString()}const Tf=["x","y","borderWidth","radius","tension"],Lf=["color","borderColor","backgroundColor"];function Rf(i){i.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),i.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),i.set("animations",{colors:{type:"color",properties:Lf},numbers:{type:"number",properties:Tf}}),i.describe("animations",{_fallback:"animation"}),i.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function Ef(i){i.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const Ma=new Map;function If(i,t){t=t||{};const e=i+JSON.stringify(t);let n=Ma.get(e);return n||(n=new Intl.NumberFormat(i,t),Ma.set(e,n)),n}function Ln(i,t,e){return If(t,e).format(i)}const wh={values(i){return Q(i)?i:""+i},numeric(i,t,e){if(i===0)return"0";const n=this.chart.options.locale;let s,o=i;if(e.length>1){const c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),o=Ff(i,e)}const r=ke(Math.abs(o)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),Ln(i,n,l)},logarithmic(i,t,e){if(i===0)return"0";const n=e[t].significand||i/Math.pow(10,Math.floor(ke(i)));return[1,2,3,5,10,15].includes(n)||t>.8*e.length?wh.numeric.call(this,i,t,e):""}};function Ff(i,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&i!==Math.floor(i)&&(e=i-Math.floor(i)),e}var Js={formatters:wh};function $f(i){i.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Js.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),i.route("scale.ticks","color","","color"),i.route("scale.grid","color","","borderColor"),i.route("scale.border","color","","borderColor"),i.route("scale.title","color","","color"),i.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),i.describe("scales",{_fallback:"scale"}),i.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const ii=Object.create(null),qo=Object.create(null);function gn(i,t){if(!t)return i;const e=t.split(".");for(let n=0,s=e.length;nn.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(n,s)=>bo(s.backgroundColor),this.hoverBorderColor=(n,s)=>bo(s.borderColor),this.hoverColor=(n,s)=>bo(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return _o(this,t,e)}get(t){return gn(this,t)}describe(t,e){return _o(qo,t,e)}override(t,e){return _o(ii,t,e)}route(t,e,n,s){const o=gn(this,t),r=gn(this,n),a="_"+e;Object.defineProperties(o,{[a]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const l=this[a],c=r[s];return N(l)?Object.assign({},c,l):E(l,c)},set(l){this[a]=l}}})}apply(t){t.forEach(e=>e(this))}};var at=new zf({_scriptable:i=>!i.startsWith("on"),_indexable:i=>i!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Rf,Ef,$f]);function Bf(i){return!i||j(i.size)||j(i.family)?null:(i.style?i.style+" ":"")+(i.weight?i.weight+" ":"")+i.size+"px "+i.family}function Ts(i,t,e,n,s){let o=t[s];return o||(o=t[s]=i.measureText(s).width,e.push(s)),o>n&&(n=o),n}function Nf(i,t,e,n){n=n||{};let s=n.data=n.data||{},o=n.garbageCollect=n.garbageCollect||[];n.font!==t&&(s=n.data={},o=n.garbageCollect=[],n.font=t),i.save(),i.font=t;let r=0;const a=e.length;let l,c,h,u,d;for(l=0;le.length){for(l=0;l0&&i.stroke()}}function ge(i,t,e){return e=e||.5,!t||i&&i.x>t.left-e&&i.xt.top-e&&i.y0&&o.strokeColor!=="";let l,c;for(i.save(),i.font=s.string,jf(i,o),l=0;l+i||0;function Or(i,t){const e={},n=N(t),s=n?Object.keys(t):t,o=N(i)?n?r=>E(i[r],i[t[r]]):r=>i[r]:()=>i;for(const r of s)e[r]=Kf(o(r));return e}function Mh(i){return Or(i,{top:"y",right:"x",bottom:"y",left:"x"})}function Qe(i){return Or(i,["topLeft","topRight","bottomLeft","bottomRight"])}function yt(i){const t=Mh(i);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function dt(i,t){i=i||{},t=t||at.font;let e=E(i.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let n=E(i.style,t.style);n&&!(""+n).match(Uf)&&(console.warn('Invalid font style specified: "'+n+'"'),n=void 0);const s={family:E(i.family,t.family),lineHeight:qf(E(i.lineHeight,t.lineHeight),e),size:e,style:n,weight:E(i.weight,t.weight),string:""};return s.string=Bf(s),s}function en(i,t,e,n){let s=!0,o,r,a;for(o=0,r=i.length;oe&&a===0?0:a+l;return{min:r(n,-Math.abs(o)),max:r(s,o)}}function Ee(i,t){return Object.assign(Object.create(i),t)}function Tr(i,t=[""],e,n,s=()=>i[0]){const o=e||i;typeof n>"u"&&(n=Ah("_fallback",i));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:i,_rootScopes:o,_fallback:n,_getTarget:s,override:a=>Tr([a,...i],t,o,n)};return new Proxy(r,{deleteProperty(a,l){return delete a[l],delete a._keys,delete i[0][l],!0},get(a,l){return Ph(a,l,()=>sg(l,t,i,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(i[0])},has(a,l){return Ca(a).includes(l)},ownKeys(a){return Ca(a)},set(a,l,c){const h=a._storage||(a._storage=s());return a[l]=h[l]=c,delete a._keys,!0}})}function vi(i,t,e,n){const s={_cacheable:!1,_proxy:i,_context:t,_subProxy:e,_stack:new Set,_descriptors:Sh(i,n),setContext:o=>vi(i,o,e,n),override:o=>vi(i.override(o),t,e,n)};return new Proxy(s,{deleteProperty(o,r){return delete o[r],delete i[r],!0},get(o,r,a){return Ph(o,r,()=>Jf(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(i,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(i,r)},getPrototypeOf(){return Reflect.getPrototypeOf(i)},has(o,r){return Reflect.has(i,r)},ownKeys(){return Reflect.ownKeys(i)},set(o,r,a){return i[r]=a,delete o[r],!0}})}function Sh(i,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:n=t.indexable,_allKeys:s=t.allKeys}=i;return{allKeys:s,scriptable:e,indexable:n,isScriptable:Te(e)?e:()=>e,isIndexable:Te(n)?n:()=>n}}const Zf=(i,t)=>i?i+Sr(t):t,Lr=(i,t)=>N(t)&&i!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function Ph(i,t,e){if(Object.prototype.hasOwnProperty.call(i,t))return i[t];const n=e();return i[t]=n,n}function Jf(i,t,e){const{_proxy:n,_context:s,_subProxy:o,_descriptors:r}=i;let a=n[t];return Te(a)&&r.isScriptable(t)&&(a=Qf(t,a,i,e)),Q(a)&&a.length&&(a=tg(t,a,i,r.isIndexable)),Lr(t,a)&&(a=vi(a,s,o&&o[t],r)),a}function Qf(i,t,e,n){const{_proxy:s,_context:o,_subProxy:r,_stack:a}=e;if(a.has(i))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+i);a.add(i);let l=t(o,r||n);return a.delete(i),Lr(i,l)&&(l=Rr(s._scopes,s,i,l)),l}function tg(i,t,e,n){const{_proxy:s,_context:o,_subProxy:r,_descriptors:a}=e;if(typeof o.index<"u"&&n(i))return t[o.index%t.length];if(N(t[0])){const l=t,c=s._scopes.filter(h=>h!==l);t=[];for(const h of l){const u=Rr(c,s,i,h);t.push(vi(u,o,r&&r[i],a))}}return t}function Ch(i,t,e){return Te(i)?i(t,e):i}const eg=(i,t)=>i===!0?t:typeof i=="string"?Oe(t,i):void 0;function ig(i,t,e,n,s){for(const o of t){const r=eg(e,o);if(r){i.add(r);const a=Ch(r._fallback,e,s);if(typeof a<"u"&&a!==e&&a!==n)return a}else if(r===!1&&typeof n<"u"&&e!==n)return null}return!1}function Rr(i,t,e,n){const s=t._rootScopes,o=Ch(t._fallback,e,n),r=[...i,...s],a=new Set;a.add(n);let l=Pa(a,r,e,o||e,n);return l===null||typeof o<"u"&&o!==e&&(l=Pa(a,r,o,l,n),l===null)?!1:Tr(Array.from(a),[""],s,o,()=>ng(t,e,n))}function Pa(i,t,e,n,s){for(;e;)e=ig(i,t,e,n,s);return e}function ng(i,t,e){const n=i._getTarget();t in n||(n[t]={});const s=n[t];return Q(s)&&N(e)?e:s||{}}function sg(i,t,e,n){let s;for(const o of t)if(s=Ah(Zf(o,i),e),typeof s<"u")return Lr(i,s)?Rr(e,n,i,s):s}function Ah(i,t){for(const e of t){if(!e)continue;const n=e[i];if(typeof n<"u")return n}}function Ca(i){let t=i._keys;return t||(t=i._keys=og(i._scopes)),t}function og(i){const t=new Set;for(const e of i)for(const n of Object.keys(e).filter(s=>!s.startsWith("_")))t.add(n);return Array.from(t)}function Dh(i,t,e,n){const{iScale:s}=i,{key:o="r"}=this._parsing,r=new Array(n);let a,l,c,h;for(a=0,l=n;ati==="x"?"y":"x";function ag(i,t,e,n){const s=i.skip?t:i,o=t,r=e.skip?t:e,a=Uo(o,s),l=Uo(r,o);let c=a/(a+l),h=l/(a+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const u=n*c,d=n*h;return{previous:{x:o.x-u*(r.x-s.x),y:o.y-u*(r.y-s.y)},next:{x:o.x+d*(r.x-s.x),y:o.y+d*(r.y-s.y)}}}function lg(i,t,e){const n=i.length;let s,o,r,a,l,c=wi(i,0);for(let h=0;h!c.skip)),t.cubicInterpolationMode==="monotone")hg(i,s);else{let c=n?i[i.length-1]:i[0];for(o=0,r=i.length;oi.ownerDocument.defaultView.getComputedStyle(i,null);function fg(i,t){return eo(i).getPropertyValue(t)}const gg=["top","right","bottom","left"];function ti(i,t,e){const n={};e=e?"-"+e:"";for(let s=0;s<4;s++){const o=gg[s];n[o]=parseFloat(i[t+"-"+o+e])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}const pg=(i,t,e)=>(i>0||t>0)&&(!e||!e.shadowRoot);function mg(i,t){const e=i.touches,n=e&&e.length?e[0]:i,{offsetX:s,offsetY:o}=n;let r=!1,a,l;if(pg(s,o,i.target))a=s,l=o;else{const c=t.getBoundingClientRect();a=n.clientX-c.left,l=n.clientY-c.top,r=!0}return{x:a,y:l,box:r}}function He(i,t){if("native"in i)return i;const{canvas:e,currentDevicePixelRatio:n}=t,s=eo(e),o=s.boxSizing==="border-box",r=ti(s,"padding"),a=ti(s,"border","width"),{x:l,y:c,box:h}=mg(i,e),u=r.left+(h&&a.left),d=r.top+(h&&a.top);let{width:f,height:g}=t;return o&&(f-=r.width+a.width,g-=r.height+a.height),{x:Math.round((l-u)/f*e.width/n),y:Math.round((c-d)/g*e.height/n)}}function bg(i,t,e){let n,s;if(t===void 0||e===void 0){const o=Er(i);if(!o)t=i.clientWidth,e=i.clientHeight;else{const r=o.getBoundingClientRect(),a=eo(o),l=ti(a,"border","width"),c=ti(a,"padding");t=r.width-c.width-l.width,e=r.height-c.height-l.height,n=Ls(a.maxWidth,o,"clientWidth"),s=Ls(a.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:n||Os,maxHeight:s||Os}}const Hn=i=>Math.round(i*10)/10;function _g(i,t,e,n){const s=eo(i),o=ti(s,"margin"),r=Ls(s.maxWidth,i,"clientWidth")||Os,a=Ls(s.maxHeight,i,"clientHeight")||Os,l=bg(i,t,e);let{width:c,height:h}=l;if(s.boxSizing==="content-box"){const d=ti(s,"border","width"),f=ti(s,"padding");c-=f.width+d.width,h-=f.height+d.height}return c=Math.max(0,c-o.width),h=Math.max(0,n?c/n:h-o.height),c=Hn(Math.min(c,r,l.maxWidth)),h=Hn(Math.min(h,a,l.maxHeight)),c&&!h&&(h=Hn(c/2)),(t!==void 0||e!==void 0)&&n&&l.height&&h>l.height&&(h=l.height,c=Hn(Math.floor(h*n))),{width:c,height:h}}function Aa(i,t,e){const n=t||1,s=Math.floor(i.height*n),o=Math.floor(i.width*n);i.height=Math.floor(i.height),i.width=Math.floor(i.width);const r=i.canvas;return r.style&&(e||!r.style.height&&!r.style.width)&&(r.style.height=`${i.height}px`,r.style.width=`${i.width}px`),i.currentDevicePixelRatio!==n||r.height!==s||r.width!==o?(i.currentDevicePixelRatio=n,r.height=s,r.width=o,i.ctx.setTransform(n,0,0,n,0,0),!0):!1}const xg=function(){let i=!1;try{const t={get passive(){return i=!0,!1}};window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch{}return i}();function Da(i,t){const e=fg(i,t),n=e&&e.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function Ye(i,t,e,n){return{x:i.x+e*(t.x-i.x),y:i.y+e*(t.y-i.y)}}function yg(i,t,e,n){return{x:i.x+e*(t.x-i.x),y:n==="middle"?e<.5?i.y:t.y:n==="after"?e<1?i.y:t.y:e>0?t.y:i.y}}function vg(i,t,e,n){const s={x:i.cp2x,y:i.cp2y},o={x:t.cp1x,y:t.cp1y},r=Ye(i,s,e),a=Ye(s,o,e),l=Ye(o,t,e),c=Ye(r,a,e),h=Ye(a,l,e);return Ye(c,h,e)}const wg=function(i,t){return{x(e){return i+i+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,n){return e-n},leftForLtr(e,n){return e-n}}},kg=function(){return{x(i){return i},setWidth(i){},textAlign(i){return i},xPlus(i,t){return i+t},leftForLtr(i,t){return i}}};function bi(i,t,e){return i?wg(t,e):kg()}function Lh(i,t){let e,n;(t==="ltr"||t==="rtl")&&(e=i.canvas.style,n=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),i.prevTextDirection=n)}function Rh(i,t){t!==void 0&&(delete i.prevTextDirection,i.canvas.style.setProperty("direction",t[0],t[1]))}function Eh(i){return i==="angle"?{between:vn,compare:Mf,normalize:At}:{between:de,compare:(t,e)=>t-e,normalize:t=>t}}function Oa({start:i,end:t,count:e,loop:n,style:s}){return{start:i%e,end:t%e,loop:n&&(t-i+1)%e===0,style:s}}function Mg(i,t,e){const{property:n,start:s,end:o}=e,{between:r,normalize:a}=Eh(n),l=t.length;let{start:c,end:h,loop:u}=i,d,f;if(u){for(c+=l,h+=l,d=0,f=l;dl(s,w,b)&&a(s,w)!==0,y=()=>a(o,b)===0||l(o,w,b),k=()=>p||_(),v=()=>!p||y();for(let M=h,S=h;M<=u;++M)x=t[M%r],!x.skip&&(b=c(x[n]),b!==w&&(p=l(b,s,o),m===null&&k()&&(m=a(b,s)===0?M:S),m!==null&&v()&&(g.push(Oa({start:m,end:M,loop:d,count:r,style:f})),m=null),S=M,w=b));return m!==null&&g.push(Oa({start:m,end:u,loop:d,count:r,style:f})),g}function Fh(i,t){const e=[],n=i.segments;for(let s=0;ss&&i[o%t].skip;)o--;return o%=t,{start:s,end:o}}function Pg(i,t,e,n){const s=i.length,o=[];let r=t,a=i[t],l;for(l=t+1;l<=e;++l){const c=i[l%s];c.skip||c.stop?a.skip||(n=!1,o.push({start:t%s,end:(l-1)%s,loop:n}),t=r=c.stop?l:null):(r=l,a.skip&&(t=l)),a=c}return r!==null&&o.push({start:t%s,end:r%s,loop:n}),o}function Cg(i,t){const e=i.points,n=i.options.spanGaps,s=e.length;if(!s)return[];const o=!!i._loop,{start:r,end:a}=Sg(e,s,o,n);if(n===!0)return Ta(i,[{start:r,end:a,loop:o}],e,t);const l=aa({chart:t,initial:e.initial,numSteps:r,currentStep:Math.min(n-e.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=_h.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((n,s)=>{if(!n.running||!n.items.length)return;const o=n.items;let r=o.length-1,a=!1,l;for(;r>=0;--r)l=o[r],l._active?(l._total>n.duration&&(n.duration=l._total),l.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(s.draw(),this._notify(s,n,t,"progress")),o.length||(n.running=!1,this._notify(s,n,t,"complete"),n.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let n=e.get(t);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,n)),n}listen(t,e,n){this._getAnims(t).listeners[e].push(n)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((n,s)=>Math.max(n,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const n=e.items;let s=n.length-1;for(;s>=0;--s)n[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}};var se=new Og;const Ra="transparent",Tg={boolean(i,t,e){return e>.5?t:i},color(i,t,e){const n=ka(i||Ra),s=n.valid&&ka(t||Ra);return s&&s.valid?s.mix(n,e).hexString():t},number(i,t,e){return i+(t-i)*e}};let Lg=class{constructor(t,e,n,s){const o=e[n];s=en([t.to,s,o,t.from]);const r=en([t.from,o,s]);this._active=!0,this._fn=t.fn||Tg[t.type||typeof r],this._easing=fn[t.easing]||fn.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=n,this._from=r,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,n){if(this._active){this._notify(!1);const s=this._target[this._prop],o=n-this._start,r=this._duration-o;this._start=n,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=en([t.to,e,s,t.from]),this._from=en([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,n=this._duration,s=this._prop,o=this._from,r=this._loop,a=this._to;let l;if(this._active=o!==a&&(r||e1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,n)=>{t.push({res:e,rej:n})})}_notify(t){const e=t?"res":"rej",n=this._promises||[];for(let s=0;s{const o=t[s];if(!N(o))return;const r={};for(const a of e)r[a]=o[a];(Q(o.properties)&&o.properties||[s]).forEach(a=>{(a===s||!n.has(a))&&n.set(a,r)})})}_animateOptions(t,e){const n=e.options,s=Eg(t,n);if(!s)return[];const o=this._createAnimations(s,n);return n.$shared&&Rg(t.options.$animations,n).then(()=>{t.options=n},()=>{}),o}_createAnimations(t,e){const n=this._properties,s=[],o=t.$animations||(t.$animations={}),r=Object.keys(e),a=Date.now();let l;for(l=r.length-1;l>=0;--l){const c=r[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,e));continue}const h=e[c];let u=o[c];const d=n.get(c);if(u)if(d&&u.active()){u.update(d,h,a);continue}else u.cancel();if(!d||!d.duration){t[c]=h;continue}o[c]=u=new Lg(d,t,c,h),s.push(u)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const n=this._createAnimations(t,e);if(n.length)return se.add(this._chart,n),!0}};function Rg(i,t){const e=[],n=Object.keys(t);for(let s=0;s0||!e&&o<0)return s.index}return null}function za(i,t){const{chart:e,_cachedMeta:n}=i,s=e._stacks||(e._stacks={}),{iScale:o,vScale:r,index:a}=n,l=o.axis,c=r.axis,h=zg(o,r,n),u=t.length;let d;for(let f=0;fe[n].axis===t).shift()}function Vg(i,t){return Ee(i,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Wg(i,t,e){return Ee(i,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function Di(i,t){const e=i.controller.index,n=i.vScale&&i.vScale.axis;if(n){t=t||i._parsed;for(const s of t){const o=s._stacks;if(!o||o[n]===void 0||o[n][e]===void 0)return;delete o[n][e],o[n]._visualValues!==void 0&&o[n]._visualValues[e]!==void 0&&delete o[n]._visualValues[e]}}}const yo=i=>i==="reset"||i==="none",Ba=(i,t)=>t?i:Object.assign({},i),jg=(i,t,e)=>i&&!t.hidden&&t._stacked&&{keys:zh(e,!0),values:null};var Vi;let Ie=(Vi=class{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Fa(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&Di(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,n=this.getDataset(),s=(u,d,f,g)=>u==="x"?d:u==="r"?g:f,o=e.xAxisID=E(n.xAxisID,xo(t,"x")),r=e.yAxisID=E(n.yAxisID,xo(t,"y")),a=e.rAxisID=E(n.rAxisID,xo(t,"r")),l=e.indexAxis,c=e.iAxisID=s(l,o,r,a),h=e.vAxisID=s(l,r,o,a);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(r),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&ya(this._data,this),t._stacked&&Di(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),n=this._data;if(N(e))this._data=$g(e);else if(n!==e){if(n){ya(n,this);const s=this._cachedMeta;Di(s),s._parsed=[]}e&&Object.isExtensible(e)&&Af(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,n=this.getDataset();let s=!1;this._dataCheck();const o=e._stacked;e._stacked=Fa(e.vScale,e),e.stack!==n.stack&&(s=!0,Di(e),e.stack=n.stack),this._resyncElements(t),(s||o!==e._stacked)&&za(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),n=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:n,_data:s}=this,{iScale:o,_stacked:r}=n,a=o.axis;let l=t===0&&e===s.length?!0:n._sorted,c=t>0&&n._parsed[t-1],h,u,d;if(this._parsing===!1)n._parsed=s,n._sorted=!0,d=s;else{Q(s[t])?d=this.parseArrayData(n,s,t,e):N(s[t])?d=this.parseObjectData(n,s,t,e):d=this.parsePrimitiveData(n,s,t,e);const f=()=>u[a]===null||c&&u[a]p||u=0;--d)if(!g()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,n=[];let s,o,r;for(s=0,o=e.length;s=0&&tthis.getContext(n,s,e),p=c.resolveNamedOptions(d,f,g,u);return p.$shared&&(p.$shared=l,o[r]=Object.freeze(Ba(p,l))),p}_resolveAnimations(t,e,n){const s=this.chart,o=this._cachedDataOpts,r=`animation-${e}`,a=o[r];if(a)return a;let l;if(s.options.animation!==!1){const h=this.chart.config,u=h.datasetAnimationScopeKeys(this._type,e),d=h.getOptionScopes(this.getDataset(),u);l=h.createResolver(d,this.getContext(t,n,e))}const c=new $h(s,l&&l.animations);return l&&l._cacheable&&(o[r]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||yo(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const n=this.resolveDataElementOptions(t,e),s=this._sharedOptions,o=this.getSharedOptions(n),r=this.includeOptions(e,o)||o!==s;return this.updateSharedOptions(o,e,n),{sharedOptions:o,includeOptions:r}}updateElement(t,e,n,s){yo(s)?Object.assign(t,n):this._resolveAnimations(e,s).update(t,n)}updateSharedOptions(t,e,n){t&&!yo(e)&&this._resolveAnimations(void 0,e).update(t,n)}_setStyle(t,e,n,s){t.active=s;const o=this.getStyle(e,s);this._resolveAnimations(e,n,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,n){this._setStyle(t,n,"active",!1)}setHoverStyle(t,e,n){this._setStyle(t,n,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,n=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const s=n.length,o=e.length,r=Math.min(o,s);r&&this.parse(0,r),o>s?this._insertElements(s,o-s,t):o{for(c.length+=e,a=c.length-1;a>=r;a--)c[a]=c[a-e]};for(l(o),a=t;as-o))}return i._cache.$bar}function Yg(i){const t=i.iScale,e=Hg(t,i.type);let n=t._length,s,o,r,a;const l=()=>{r===32767||r===-32768||(yn(a)&&(n=Math.min(n,Math.abs(r-a)||n)),a=r)};for(s=0,o=e.length;s0?s[i-1]:null,a=iMath.abs(a)&&(l=a,c=r),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:s,end:o,min:r,max:a}}function Bh(i,t,e,n){return Q(i)?qg(i,t,e,n):t[e.axis]=e.parse(i,n),t}function Na(i,t,e,n){const s=i.iScale,o=i.vScale,r=s.getLabels(),a=s===o,l=[];let c,h,u,d;for(c=e,h=e+n;c=e?1:-1)}function Gg(i){let t,e,n,s,o;return i.horizontal?(t=i.base>i.x,e="left",n="right"):(t=i.basel.controller.options.grouped),o=n.options.stacked,r=[],a=l=>{const c=l.controller.getParsed(e),h=c&&c[l.vScale.axis];if(j(h)||isNaN(h))return!0};for(const l of s)if(!(e!==void 0&&a(l))&&((o===!1||r.indexOf(l.stack)===-1||o===void 0&&l.stack===void 0)&&r.push(l.stack),l.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,n){const s=this._getStacks(t,n),o=e!==void 0?s.indexOf(e):-1;return o===-1?s.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,n=e.iScale,s=[];let o,r;for(o=0,r=e.data.length;o=0;--n)e=Math.max(e,t[n].size(this.resolveDataElementOptions(n))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,n=this.chart.data.labels||[],{xScale:s,yScale:o}=e,r=this.getParsed(t),a=s.getLabelForValue(r.x),l=o.getLabelForValue(r.y),c=r._custom;return{label:n[t]||"",value:"("+a+", "+l+(c?", "+c:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,n,s){const o=s==="reset",{iScale:r,vScale:a}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(e,s),h=r.axis,u=a.axis;for(let d=e;dvn(w,a,l,!0)?1:Math.max(_,_*e,y,y*e),g=(w,_,y)=>vn(w,a,l,!0)?-1:Math.min(_,_*e,y,y*e),p=f(0,c,u),m=f(ut,h,d),b=g(et,c,u),x=g(et+ut,h,d);n=(p-b)/2,s=(m-x)/2,o=-(p+b)/2,r=-(m+x)/2}return{ratioX:n,ratioY:s,offsetX:o,offsetY:r}}var di;let Ir=(di=class extends Ie{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const n=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=n;else{let o=l=>+n[l];if(N(n[t])){const{key:l="value"}=this._parsing;o=c=>+Oe(n[c],l)}let r,a;for(r=t,a=t+e;r0&&!isNaN(t)?tt*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,n=this.chart,s=n.data.labels||[],o=Ln(e._parsed[t],n.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let e=0;const n=this.chart;let s,o,r,a,l;if(!t){for(s=0,o=n.data.datasets.length;st!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),A(di,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:n,color:s}}=t.legend.options;return e.labels.map((o,r)=>{const l=t.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:n,hidden:!t.getDataVisibility(r),index:r}})}return[]}},onClick(t,e,n){n.chart.toggleDataVisibility(e.index),n.chart.update()}}}}),di);var Hi;let np=(Hi=class extends Ie{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:n,data:s=[],_dataset:o}=e,r=this.chart._animationsDisabled;let{start:a,count:l}=yh(e,s,r);this._drawStart=a,this._drawCount=l,vh(e)&&(a=0,l=s.length),n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!o._decimated,n.points=s;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(n,void 0,{animated:!r,options:c},t),this.updateElements(s,a,l,t)}updateElements(t,e,n,s){const o=s==="reset",{iScale:r,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:h,includeOptions:u}=this._getSharedOptions(e,s),d=r.axis,f=a.axis,{spanGaps:g,segment:p}=this.options,m=yi(g)?g:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||o||s==="none",x=e+n,w=t.length;let _=e>0&&this.getParsed(e-1);for(let y=0;y=x){v.skip=!0;continue}const M=this.getParsed(y),S=j(M[f]),C=v[d]=r.getPixelForValue(M[d],y),D=v[f]=o||S?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,M,l):M[f],y);v.skip=isNaN(C)||isNaN(D)||S,v.stop=y>0&&Math.abs(M[d]-_[d])>m,p&&(v.parsed=M,v.raw=c.data[y]),u&&(v.options=h||this.resolveDataElementOptions(y,k.active?"active":s)),b||this.updateElement(k,y,v,s),_=M}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,n=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return n;const o=s[0].size(this.resolveDataElementOptions(0)),r=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(n,o,r)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},A(Hi,"id","line"),A(Hi,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),A(Hi,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}}),Hi);var Yi;let Nh=(Yi=class extends Ie{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,n=this.chart,s=n.data.labels||[],o=Ln(e._parsed[t].r,n.options.locale);return{label:s[t]||"",value:o}}parseObjectData(t,e,n,s){return Dh.bind(this)(t,e,n,s)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((n,s)=>{const o=this.getParsed(s).r;!isNaN(o)&&this.chart.getDataVisibility(s)&&(oe.max&&(e.max=o))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,n=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(s/2,0),r=Math.max(n.cutoutPercentage?o/100*n.cutoutPercentage:1,0),a=(o-r)/t.getVisibleDatasetCount();this.outerRadius=o-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(t,e,n,s){const o=s==="reset",r=this.chart,l=r.options.animation,c=this._cachedMeta.rScale,h=c.xCenter,u=c.yCenter,d=c.getIndexAngle(0)-.5*et;let f=d,g;const p=360/this.countVisibleElements();for(g=0;g{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,n){return this.chart.getDataVisibility(t)?Wt(this.resolveDataElementOptions(t,e).angle||n):0}},A(Yi,"id","polarArea"),A(Yi,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),A(Yi,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:n,color:s}}=t.legend.options;return e.labels.map((o,r)=>{const l=t.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:n,hidden:!t.getDataVisibility(r),index:r}})}return[]}},onClick(t,e,n){n.chart.toggleDataVisibility(e.index),n.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}}),Yi);var fs;let sp=(fs=class extends Ir{},A(fs,"id","pie"),A(fs,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"}),fs);var Xi;let op=(Xi=class extends Ie{getLabelAndValue(t){const e=this._cachedMeta.vScale,n=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(n[e.axis])}}parseObjectData(t,e,n,s){return Dh.bind(this)(t,e,n,s)}update(t){const e=this._cachedMeta,n=e.dataset,s=e.data||[],o=e.iScale.getLabels();if(n.points=s,t!=="resize"){const r=this.resolveDatasetElementOptions(t);this.options.showLine||(r.borderWidth=0);const a={_loop:!0,_fullLoop:o.length===s.length,options:r};this.updateElement(n,void 0,a,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,n,s){const o=this._cachedMeta.rScale,r=s==="reset";for(let a=e;a0&&this.getParsed(e-1);for(let _=e;_0&&Math.abs(k[f]-w[f])>b,m&&(v.parsed=k,v.raw=c.data[_]),d&&(v.options=u||this.resolveDataElementOptions(_,y.active?"active":s)),x||this.updateElement(y,_,v,s),w=k}this.updateSharedOptions(u,s,h)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let a=0;for(let l=e.length-1;l>=0;--l)a=Math.max(a,e[l].size(this.resolveDataElementOptions(l))/2);return a>0&&a}const n=t.dataset,s=n.options&&n.options.borderWidth||0;if(!e.length)return s;const o=e[0].size(this.resolveDataElementOptions(0)),r=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,o,r)/2}},A(Ui,"id","scatter"),A(Ui,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),A(Ui,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}}),Ui);var ap=Object.freeze({__proto__:null,BarController:tp,BubbleController:ep,DoughnutController:Ir,LineController:np,PieController:sp,PolarAreaController:Nh,RadarController:op,ScatterController:rp});function Ne(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Fr{constructor(t){A(this,"options");this.options=t||{}}static override(t){Object.assign(Fr.prototype,t)}init(){}formats(){return Ne()}parse(){return Ne()}format(){return Ne()}add(){return Ne()}diff(){return Ne()}startOf(){return Ne()}endOf(){return Ne()}}var lp={_date:Fr};function cp(i,t,e,n){const{controller:s,data:o,_sorted:r}=i,a=s._cachedMeta.iScale;if(a&&t===a.axis&&t!=="r"&&r&&o.length){const l=a._reversePixels?Pf:fe;if(n){if(s._sharedOptions){const c=o[0],h=typeof c.getRange=="function"&&c.getRange(t);if(h){const u=l(o,t,e-h),d=l(o,t,e+h);return{lo:u.lo,hi:d.hi}}}}else return l(o,t,e)}return{lo:0,hi:o.length-1}}function Rn(i,t,e,n,s){const o=i.getSortedVisibleDatasetMetas(),r=e[t];for(let a=0,l=o.length;a{l[r](t[e],s)&&(o.push({element:l,datasetIndex:c,index:h}),a=a||l.inRange(t.x,t.y,s))}),n&&!a?[]:o}var fp={evaluateInteractionItems:Rn,modes:{index(i,t,e,n){const s=He(t,i),o=e.axis||"x",r=e.includeInvisible||!1,a=e.intersect?wo(i,s,o,n,r):ko(i,s,o,!1,n,r),l=[];return a.length?(i.getSortedVisibleDatasetMetas().forEach(c=>{const h=a[0].index,u=c.data[h];u&&!u.skip&&l.push({element:u,datasetIndex:c.index,index:h})}),l):[]},dataset(i,t,e,n){const s=He(t,i),o=e.axis||"xy",r=e.includeInvisible||!1;let a=e.intersect?wo(i,s,o,n,r):ko(i,s,o,!1,n,r);if(a.length>0){const l=a[0].datasetIndex,c=i.getDatasetMeta(l).data;a=[];for(let h=0;he.pos===t)}function Ha(i,t){return i.filter(e=>Vh.indexOf(e.pos)===-1&&e.box.axis===t)}function Ti(i,t){return i.sort((e,n)=>{const s=t?n:e,o=t?e:n;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function gp(i){const t=[];let e,n,s,o,r,a;for(e=0,n=(i||[]).length;ec.box.fullSize),!0),n=Ti(Oi(t,"left"),!0),s=Ti(Oi(t,"right")),o=Ti(Oi(t,"top"),!0),r=Ti(Oi(t,"bottom")),a=Ha(t,"x"),l=Ha(t,"y");return{fullSize:e,leftAndTop:n.concat(o),rightAndBottom:s.concat(l).concat(r).concat(a),chartArea:Oi(t,"chartArea"),vertical:n.concat(s).concat(l),horizontal:o.concat(r).concat(a)}}function Ya(i,t,e,n){return Math.max(i[e],t[e])+Math.max(i[n],t[n])}function Wh(i,t){i.top=Math.max(i.top,t.top),i.left=Math.max(i.left,t.left),i.bottom=Math.max(i.bottom,t.bottom),i.right=Math.max(i.right,t.right)}function _p(i,t,e,n){const{pos:s,box:o}=e,r=i.maxPadding;if(!N(s)){e.size&&(i[s]-=e.size);const u=n[e.stack]||{size:0,count:1};u.size=Math.max(u.size,e.horizontal?o.height:o.width),e.size=u.size/u.count,i[s]+=e.size}o.getPadding&&Wh(r,o.getPadding());const a=Math.max(0,t.outerWidth-Ya(r,i,"left","right")),l=Math.max(0,t.outerHeight-Ya(r,i,"top","bottom")),c=a!==i.w,h=l!==i.h;return i.w=a,i.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function xp(i){const t=i.maxPadding;function e(n){const s=Math.max(t[n]-i[n],0);return i[n]+=s,s}i.y+=e("top"),i.x+=e("left"),e("right"),e("bottom")}function yp(i,t){const e=t.maxPadding;function n(s){const o={left:0,top:0,right:0,bottom:0};return s.forEach(r=>{o[r]=Math.max(t[r],e[r])}),o}return n(i?["left","right"]:["top","bottom"])}function nn(i,t,e,n){const s=[];let o,r,a,l,c,h;for(o=0,r=i.length,c=0;o{typeof p.beforeLayout=="function"&&p.beforeLayout()});const h=l.reduce((p,m)=>m.box.options&&m.box.options.display===!1?p:p+1,0)||1,u=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/h,hBoxMaxHeight:r/2}),d=Object.assign({},s);Wh(d,yt(n));const f=Object.assign({maxPadding:d,w:o,h:r,x:s.left,y:s.top},s),g=mp(l.concat(c),u);nn(a.fullSize,f,u,g),nn(l,f,u,g),nn(c,f,u,g)&&nn(l,f,u,g),xp(f),Xa(a.leftAndTop,f,u,g),f.x+=f.w,f.y+=f.h,Xa(a.rightAndBottom,f,u,g),i.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},X(a.chartArea,p=>{const m=p.box;Object.assign(m,i.chartArea),m.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};let jh=class{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,n){}removeEventListener(t,e,n){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,n,s){return e=Math.max(0,e||t.width),n=n||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):n)}}isAttached(t){return!0}updateConfig(t){}},vp=class extends jh{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}};const ws="$chartjs",wp={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Ua=i=>i===null||i==="";function kp(i,t){const e=i.style,n=i.getAttribute("height"),s=i.getAttribute("width");if(i[ws]={initial:{height:n,width:s,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",Ua(s)){const o=Da(i,"width");o!==void 0&&(i.width=o)}if(Ua(n))if(i.style.height==="")i.height=i.width/(t||2);else{const o=Da(i,"height");o!==void 0&&(i.height=o)}return i}const Hh=xg?{passive:!0}:!1;function Mp(i,t,e){i.addEventListener(t,e,Hh)}function Sp(i,t,e){i.canvas.removeEventListener(t,e,Hh)}function Pp(i,t){const e=wp[i.type]||i.type,{x:n,y:s}=He(i,t);return{type:e,chart:t,native:i,x:n!==void 0?n:null,y:s!==void 0?s:null}}function Rs(i,t){for(const e of i)if(e===t||e.contains(t))return!0}function Cp(i,t,e){const n=i.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||Rs(a.addedNodes,n),r=r&&!Rs(a.removedNodes,n);r&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function Ap(i,t,e){const n=i.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||Rs(a.removedNodes,n),r=r&&!Rs(a.addedNodes,n);r&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}const kn=new Map;let qa=0;function Yh(){const i=window.devicePixelRatio;i!==qa&&(qa=i,kn.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function Dp(i,t){kn.size||window.addEventListener("resize",Yh),kn.set(i,t)}function Op(i){kn.delete(i),kn.size||window.removeEventListener("resize",Yh)}function Tp(i,t,e){const n=i.canvas,s=n&&Er(n);if(!s)return;const o=xh((a,l)=>{const c=s.clientWidth;e(a,l),c{const l=a[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||o(c,h)});return r.observe(s),Dp(i,o),r}function Mo(i,t,e){e&&e.disconnect(),t==="resize"&&Op(i)}function Lp(i,t,e){const n=i.canvas,s=xh(o=>{i.ctx!==null&&e(Pp(o,i))},i);return Mp(n,t,s),s}let Rp=class extends jh{acquireContext(t,e){const n=t&&t.getContext&&t.getContext("2d");return n&&n.canvas===t?(kp(t,e),n):null}releaseContext(t){const e=t.canvas;if(!e[ws])return!1;const n=e[ws].initial;["height","width"].forEach(o=>{const r=n[o];j(r)?e.removeAttribute(o):e.setAttribute(o,r)});const s=n.style||{};return Object.keys(s).forEach(o=>{e.style[o]=s[o]}),e.width=e.width,delete e[ws],!0}addEventListener(t,e,n){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),r={attach:Cp,detach:Ap,resize:Tp}[e]||Lp;s[e]=r(t,e,n)}removeEventListener(t,e){const n=t.$proxies||(t.$proxies={}),s=n[e];if(!s)return;({attach:Mo,detach:Mo,resize:Mo}[e]||Sp)(t,e,s),n[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,n,s){return _g(t,e,n,s)}isAttached(t){const e=Er(t);return!!(e&&e.isConnected)}};function Ep(i){return!Th()||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?vp:Rp}var gs;let me=(gs=class{constructor(){A(this,"x");A(this,"y");A(this,"active",!1);A(this,"options");A(this,"$animations")}tooltipPosition(t){const{x:e,y:n}=this.getProps(["x","y"],t);return{x:e,y:n}}hasValue(){return yi(this.x)&&yi(this.y)}getProps(t,e){const n=this.$animations;if(!e||!n)return this;const s={};return t.forEach(o=>{s[o]=n[o]&&n[o].active()?n[o]._to:this[o]}),s}},A(gs,"defaults",{}),A(gs,"defaultRoutes"),gs);function Ip(i,t){const e=i.options.ticks,n=Fp(i),s=Math.min(e.maxTicksLimit||n,n),o=e.major.enabled?zp(t):[],r=o.length,a=o[0],l=o[r-1],c=[];if(r>s)return Bp(t,c,o,r/s),c;const h=$p(o,t,s);if(r>0){let u,d;const f=r>1?Math.round((l-a)/(r-1)):null;for(Xn(t,c,h,j(f)?0:a-f,a),u=0,d=r-1;us)return l}return Math.max(s,1)}function zp(i){const t=[];let e,n;for(e=0,n=i.length;ei==="left"?"right":i==="right"?"left":i,Ka=(i,t,e)=>t==="top"||t==="left"?i[t]+e:i[t]-e,Ga=(i,t)=>Math.min(t||i,i);function Za(i,t){const e=[],n=i.length/t,s=i.length;let o=0;for(;or+a)))return l}function jp(i,t){X(i,e=>{const n=e.gc,s=n.length/2;let o;if(s>t){for(o=0;on?n:e,n=s&&e>n?e:n,{min:Ct(e,Ct(n,e)),max:Ct(n,Ct(e,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){G(this.options.beforeUpdate,[this])}update(t,e,n){const{beginAtZero:s,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=n=Object.assign({left:0,right:0,top:0,bottom:0},n),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+n.left+n.right:this.height+n.top+n.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=Gf(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a=o||n<=1||!this.isHorizontal()){this.labelRotation=s;return}const h=this._getLabelSizes(),u=h.widest.width,d=h.highest.height,f=gt(this.chart.width-u,0,this.maxWidth);a=t.offset?this.maxWidth/n:f/(n-1),u+6>a&&(a=f/(n-(t.offset?.5:1)),l=this.maxHeight-Li(t.grid)-e.padding-Ja(t.title,this.chart.options.font),c=Math.sqrt(u*u+d*d),r=Pr(Math.min(Math.asin(gt((h.highest.height+6)/a,-1,1)),Math.asin(gt(l/c,-1,1))-Math.asin(gt(d/c,-1,1)))),r=Math.max(s,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){G(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){G(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:n,title:s,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){const l=Ja(s,e.options.font);if(a?(t.width=this.maxWidth,t.height=Li(o)+l):(t.height=this.maxHeight,t.width=Li(o)+l),n.display&&this.ticks.length){const{first:c,last:h,widest:u,highest:d}=this._getLabelSizes(),f=n.padding*2,g=Wt(this.labelRotation),p=Math.cos(g),m=Math.sin(g);if(a){const b=n.mirror?0:m*u.width+p*d.height;t.height=Math.min(this.maxHeight,t.height+b+f)}else{const b=n.mirror?0:p*u.width+m*d.height;t.width=Math.min(this.maxWidth,t.width+b+f)}this._calculatePadding(c,h,m,p)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,n,s){const{ticks:{align:o,padding:r},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,u=this.right-this.getPixelForTick(this.ticks.length-1);let d=0,f=0;l?c?(d=s*t.width,f=n*e.height):(d=n*t.height,f=s*e.width):o==="start"?f=e.width:o==="end"?d=t.width:o!=="inner"&&(d=t.width/2,f=e.width/2),this.paddingLeft=Math.max((d-h+r)*this.width/(this.width-h),0),this.paddingRight=Math.max((f-u+r)*this.width/(this.width-u),0)}else{let h=e.height/2,u=t.height/2;o==="start"?(h=0,u=t.height):o==="end"&&(h=e.height,u=0),this.paddingTop=h+r,this.paddingBottom=u+r}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){G(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,n;for(e=0,n=t.length;e({width:r[S]||0,height:a[S]||0});return{first:M(0),last:M(e-1),widest:M(k),highest:M(v),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return Sf(this._alignToPixels?Be(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&ta*s?a/n:l/s:l*s0}_computeGridLineItems(t){const e=this.axis,n=this.chart,s=this.options,{grid:o,position:r,border:a}=s,l=o.offset,c=this.isHorizontal(),u=this.ticks.length+(l?1:0),d=Li(o),f=[],g=a.setContext(this.getContext()),p=g.display?g.width:0,m=p/2,b=function(O){return Be(n,O,p)};let x,w,_,y,k,v,M,S,C,D,T,I;if(r==="top")x=b(this.bottom),v=this.bottom-d,S=x-m,D=b(t.top)+m,I=t.bottom;else if(r==="bottom")x=b(this.top),D=t.top,I=b(t.bottom)-m,v=x+m,S=this.top+d;else if(r==="left")x=b(this.right),k=this.right-d,M=x-m,C=b(t.left)+m,T=t.right;else if(r==="right")x=b(this.left),C=t.left,T=b(t.right)-m,k=x+m,M=this.left+d;else if(e==="x"){if(r==="center")x=b((t.top+t.bottom)/2+.5);else if(N(r)){const O=Object.keys(r)[0],L=r[O];x=b(this.chart.scales[O].getPixelForValue(L))}D=t.top,I=t.bottom,v=x+m,S=v+d}else if(e==="y"){if(r==="center")x=b((t.left+t.right)/2);else if(N(r)){const O=Object.keys(r)[0],L=r[O];x=b(this.chart.scales[O].getPixelForValue(L))}k=x-m,M=k-d,C=t.left,T=t.right}const $=E(s.ticks.maxTicksLimit,u),P=Math.max(1,Math.ceil(u/$));for(w=0;wo.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const e=this.options.grid,n=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,r;const a=(l,c,h)=>{!h.width||!h.color||(n.save(),n.lineWidth=h.width,n.strokeStyle=h.color,n.setLineDash(h.borderDash||[]),n.lineDashOffset=h.borderDashOffset,n.beginPath(),n.moveTo(l.x,l.y),n.lineTo(c.x,c.y),n.stroke(),n.restore())};if(e.display)for(o=0,r=s.length;o{this.draw(o)}}]:[{z:n,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+"AxisID",s=[];let o,r;for(o=0,r=e.length;o{const n=e.split("."),s=n.pop(),o=[i].concat(n).join("."),r=t[e].split("."),a=r.pop(),l=r.join(".");at.route(o,s,l,a)})}function Gp(i){return"id"in i&&"defaults"in i}let Zp=class{constructor(){this.controllers=new Un(Ie,"datasets",!0),this.elements=new Un(me,"elements"),this.plugins=new Un(Object,"plugins"),this.scales=new Un(En,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,n){[...e].forEach(s=>{const o=n||this._getRegistryForType(s);n||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):X(s,r=>{const a=n||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,e,n){const s=Sr(t);G(n["before"+s],[],n),e[t](n),G(n["after"+s],[],n)}_getRegistryForType(t){for(let e=0;eo.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(s(e,n),t,"stop"),this._notify(s(n,e),t,"start")}};function Qp(i){const t={},e=[],n=Object.keys(Ut.plugins.items);for(let o=0;o1&&Qa(i[0].toLowerCase());if(n)return n}throw new Error(`Cannot determine type of '${i}' axis. Please provide 'axis' or 'position' option.`)}function tl(i,t,e){if(e[t+"AxisID"]===i)return{axis:t}}function rm(i,t){if(t.data&&t.data.datasets){const e=t.data.datasets.filter(n=>n.xAxisID===i||n.yAxisID===i);if(e.length)return tl(i,"x",e[0])||tl(i,"y",e[0])}return{}}function am(i,t){const e=ii[i.type]||{scales:{}},n=t.scales||{},s=Go(i.type,t),o=Object.create(null);return Object.keys(n).forEach(r=>{const a=n[r];if(!N(a))return console.error(`Invalid scale configuration for scale: ${r}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);const l=Zo(r,a,rm(r,i),at.scales[a.type]),c=sm(l,s),h=e.scales||{};o[r]=un(Object.create(null),[{axis:l},a,h[l],h[c]])}),i.data.datasets.forEach(r=>{const a=r.type||i.type,l=r.indexAxis||Go(a,t),h=(ii[a]||{}).scales||{};Object.keys(h).forEach(u=>{const d=nm(u,l),f=r[d+"AxisID"]||d;o[f]=o[f]||Object.create(null),un(o[f],[{axis:d},n[f],h[u]])})}),Object.keys(o).forEach(r=>{const a=o[r];un(a,[at.scales[a.type],at.scale])}),o}function Uh(i){const t=i.options||(i.options={});t.plugins=E(t.plugins,{}),t.scales=am(i,t)}function qh(i){return i=i||{},i.datasets=i.datasets||[],i.labels=i.labels||[],i}function lm(i){return i=i||{},i.data=qh(i.data),Uh(i),i}const el=new Map,Kh=new Set;function qn(i,t){let e=el.get(i);return e||(e=t(),el.set(i,e),Kh.add(e)),e}const Ri=(i,t,e)=>{const n=Oe(t,e);n!==void 0&&i.add(n)};let cm=class{constructor(t){this._config=lm(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=qh(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),Uh(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return qn(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return qn(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return qn(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,n=this.type;return qn(`${n}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const n=this._scopeCache;let s=n.get(t);return(!s||e)&&(s=new Map,n.set(t,s)),s}getOptionScopes(t,e,n){const{options:s,type:o}=this,r=this._cachedScopes(t,n),a=r.get(e);if(a)return a;const l=new Set;e.forEach(h=>{t&&(l.add(t),h.forEach(u=>Ri(l,t,u))),h.forEach(u=>Ri(l,s,u)),h.forEach(u=>Ri(l,ii[o]||{},u)),h.forEach(u=>Ri(l,at,u)),h.forEach(u=>Ri(l,qo,u))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Kh.has(e)&&r.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,ii[e]||{},at.datasets[e]||{},{type:e},at,qo]}resolveNamedOptions(t,e,n,s=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=il(this._resolverCache,t,s);let l=r;if(um(r,e)){o.$shared=!1,n=Te(n)?n():n;const c=this.createResolver(t,n,a);l=vi(r,n,c)}for(const c of e)o[c]=l[c];return o}createResolver(t,e,n=[""],s){const{resolver:o}=il(this._resolverCache,t,n);return N(e)?vi(o,e,void 0,s):o}};function il(i,t,e){let n=i.get(t);n||(n=new Map,i.set(t,n));const s=e.join();let o=n.get(s);return o||(o={resolver:Tr(t,e),subPrefixes:e.filter(a=>!a.toLowerCase().includes("hover"))},n.set(s,o)),o}const hm=i=>N(i)&&Object.getOwnPropertyNames(i).reduce((t,e)=>t||Te(i[e]),!1);function um(i,t){const{isScriptable:e,isIndexable:n}=Sh(i);for(const s of t){const o=e(s),r=n(s),a=(r||o)&&i[s];if(o&&(Te(a)||hm(a))||r&&Q(a))return!0}return!1}var dm="4.4.0";const fm=["top","bottom","left","right","chartArea"];function nl(i,t){return i==="top"||i==="bottom"||fm.indexOf(i)===-1&&t==="x"}function sl(i,t){return function(e,n){return e[i]===n[i]?e[t]-n[t]:e[i]-n[i]}}function ol(i){const t=i.chart,e=t.options.animation;t.notifyPlugins("afterRender"),G(e&&e.onComplete,[i],t)}function gm(i){const t=i.chart,e=t.options.animation;G(e&&e.onProgress,[i],t)}function Gh(i){return Th()&&typeof i=="string"?i=document.getElementById(i):i&&i.length&&(i=i[0]),i&&i.canvas&&(i=i.canvas),i}const ks={},rl=i=>{const t=Gh(i);return Object.values(ks).filter(e=>e.canvas===t).pop()};function pm(i,t,e){const n=Object.keys(i);for(const s of n){const o=+s;if(o>=t){const r=i[s];delete i[s],(e>0||o>t)&&(i[o+e]=r)}}}function mm(i,t,e,n){return!e||i.type==="mouseout"?null:n?t:i}function Kn(i,t,e){return i.options.clip?i[e]:t[e]}function bm(i,t){const{xScale:e,yScale:n}=i;return e&&n?{left:Kn(e,t,"left"),right:Kn(e,t,"right"),top:Kn(n,t,"top"),bottom:Kn(n,t,"bottom")}:t}var xe;let sn=(xe=class{static register(...t){Ut.add(...t),al()}static unregister(...t){Ut.remove(...t),al()}constructor(t,e){const n=this.config=new cm(e),s=Gh(t),o=rl(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const r=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||Ep(s)),this.platform.updateConfig(n);const a=this.platform.acquireContext(s,r.aspectRatio),l=a&&a.canvas,c=l&&l.height,h=l&&l.width;if(this.id=ff(),this.ctx=a,this.canvas=l,this.width=h,this.height=c,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Jp,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Df(u=>this.update(u),r.resizeDelay||0),this._dataChanges=[],ks[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}se.listen(this,"complete",ol),se.listen(this,"progress",gm),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:n,height:s,_aspectRatio:o}=this;return j(t)?e&&o?o:s?n/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return Ut}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Aa(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Sa(this.canvas,this.ctx),this}stop(){return se.stop(this),this}resize(t,e){se.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const n=this.options,s=this.canvas,o=n.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(s,t,e,o),a=n.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,Aa(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),G(n.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};X(e,(n,s)=>{n.id=s})}buildOrUpdateScales(){const t=this.options,e=t.scales,n=this.scales,s=Object.keys(n).reduce((r,a)=>(r[a]=!1,r),{});let o=[];e&&(o=o.concat(Object.keys(e).map(r=>{const a=e[r],l=Zo(r,a),c=l==="r",h=l==="x";return{options:a,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),X(o,r=>{const a=r.options,l=a.id,c=Zo(l,a),h=E(a.type,r.dtype);(a.position===void 0||nl(a.position,c)!==nl(r.dposition))&&(a.position=r.dposition),s[l]=!0;let u=null;if(l in n&&n[l].type===h)u=n[l];else{const d=Ut.getScale(h);u=new d({id:l,type:h,ctx:this.ctx,chart:this}),n[u.id]=u}u.init(a,t)}),X(s,(r,a)=>{r||delete n[a]}),X(n,r=>{_t.configure(this,r,r.options),_t.addBox(this,r)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,n=t.length;if(t.sort((s,o)=>s.index-o.index),n>e){for(let s=e;se.length&&delete this._stacks,t.forEach((n,s)=>{e.filter(o=>o===n._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let n,s;for(this._removeUnreferencedMetasets(),n=0,s=e.length;n{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const n=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let c=0,h=this.data.datasets.length;c{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(sl("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){X(this.scales,t=>{_t.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),n=new Set(t.events);(!ma(e,n)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:n,start:s,count:o}of e){const r=n==="_removeElements"?-o:o;pm(t,s,r)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,n=o=>new Set(t.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),s=n(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;_t.update(this,this.width,this.height,t);const e=this.chartArea,n=e.width<=0||e.height<=0;this._layers=[],X(this.boxes,s=>{n&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,n=this.data.datasets.length;e=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,n=t._clip,s=!n.disabled,o=bm(t,this.chartArea),r={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(s&&Qs(e,{left:n.left===!1?0:o.left-n.left,right:n.right===!1?this.width:o.right+n.right,top:n.top===!1?0:o.top-n.top,bottom:n.bottom===!1?this.height:o.bottom+n.bottom}),t.controller.draw(),s&&to(e),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return ge(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,n,s){const o=fp.modes[e];return typeof o=="function"?o(this,t,n,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],n=this._metasets;let s=n.filter(o=>o&&o._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},n.push(s)),s}getContext(){return this.$context||(this.$context=Ee(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const n=this.getDatasetMeta(t);return typeof n.hidden=="boolean"?!n.hidden:!e.hidden}setDatasetVisibility(t,e){const n=this.getDatasetMeta(t);n.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,n){const s=n?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,s);yn(e)?(o.data[e].hidden=!n,this.update()):(this.setDatasetVisibility(t,n),r.update(o,{visible:n}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),se.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,o,r),t[o]=r},s=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};X(this.options.events,o=>n(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,n=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let r;const a=()=>{s("attach",a),this.attached=!0,this.resize(),n("resize",o),n("detach",r)};r=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),n("attach",a)},e.isAttached(this.canvas)?a():r()}unbindEvents(){X(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},X(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,n){const s=n?"set":"remove";let o,r,a,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=t.length;a{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[r],index:r}});!As(n,e)&&(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,e))}notifyPlugins(t,e,n){return this._plugins.notify(this,t,e,n)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,n){const s=this.options.hover,o=(l,c)=>l.filter(h=>!c.some(u=>h.datasetIndex===u.datasetIndex&&h.index===u.index)),r=o(e,t),a=n?t:o(t,e);r.length&&this.updateHoverStyle(r,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,e){const n={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",n,s)===!1)return;const o=this._handleEvent(t,e,n.inChartArea);return n.cancelable=!1,this.notifyPlugins("afterEvent",n,s),(o||n.changed)&&this.render(),this}_handleEvent(t,e,n){const{_active:s=[],options:o}=this,r=e,a=this._getActiveElements(t,s,n,r),l=xf(t),c=mm(t,this._lastEvent,n,l);n&&(this._lastEvent=null,G(o.onHover,[t,a,this],this),l&&G(o.onClick,[t,a,this],this));const h=!As(a,s);return(h||e)&&(this._active=a,this._updateHoverStyles(a,s,e)),this._lastEvent=c,h}_getActiveElements(t,e,n,s){if(t.type==="mouseout")return[];if(!n)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}},A(xe,"defaults",at),A(xe,"instances",ks),A(xe,"overrides",ii),A(xe,"registry",Ut),A(xe,"version",dm),A(xe,"getChart",rl),xe);function al(){return X(sn.instances,i=>i._plugins.invalidate())}function _m(i,t,e){const{startAngle:n,pixelMargin:s,x:o,y:r,outerRadius:a,innerRadius:l}=t;let c=s/a;i.beginPath(),i.arc(o,r,a,n-c,e+c),l>s?(c=s/l,i.arc(o,r,l,e+c,n-c,!0)):i.arc(o,r,s,e+ut,n-ut),i.closePath(),i.clip()}function xm(i){return Or(i,["outerStart","outerEnd","innerStart","innerEnd"])}function ym(i,t,e,n){const s=xm(i.options.borderRadius),o=(e-t)/2,r=Math.min(o,n*t/2),a=l=>{const c=(e-Math.min(o,l))*n/2;return gt(l,0,Math.min(o,c))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:gt(s.innerStart,0,r),innerEnd:gt(s.innerEnd,0,r)}}function ai(i,t,e,n){return{x:e+i*Math.cos(t),y:n+i*Math.sin(t)}}function Es(i,t,e,n,s,o){const{x:r,y:a,startAngle:l,pixelMargin:c,innerRadius:h}=t,u=Math.max(t.outerRadius+n+e-c,0),d=h>0?h+n+e+c:0;let f=0;const g=s-l;if(n){const P=h>0?h-n:0,O=u>0?u-n:0,L=(P+O)/2,ht=L!==0?g*L/(L+n):g;f=(g-ht)/2}const p=Math.max(.001,g*u-e/et)/u,m=(g-p)/2,b=l+m+f,x=s-m-f,{outerStart:w,outerEnd:_,innerStart:y,innerEnd:k}=ym(t,d,u,x-b),v=u-w,M=u-_,S=b+w/v,C=x-_/M,D=d+y,T=d+k,I=b+y/D,$=x-k/T;if(i.beginPath(),o){const P=(S+C)/2;if(i.arc(r,a,u,S,P),i.arc(r,a,u,P,C),_>0){const it=ai(M,C,r,a);i.arc(it.x,it.y,_,C,x+ut)}const O=ai(T,x,r,a);if(i.lineTo(O.x,O.y),k>0){const it=ai(T,$,r,a);i.arc(it.x,it.y,k,x+ut,$+Math.PI)}const L=(x-k/d+(b+y/d))/2;if(i.arc(r,a,d,x-k/d,L,!0),i.arc(r,a,d,L,b+y/d,!0),y>0){const it=ai(D,I,r,a);i.arc(it.x,it.y,y,I+Math.PI,b-ut)}const ht=ai(v,b,r,a);if(i.lineTo(ht.x,ht.y),w>0){const it=ai(v,S,r,a);i.arc(it.x,it.y,w,b-ut,S)}}else{i.moveTo(r,a);const P=Math.cos(S)*u+r,O=Math.sin(S)*u+a;i.lineTo(P,O);const L=Math.cos(C)*u+r,ht=Math.sin(C)*u+a;i.lineTo(L,ht)}i.closePath()}function vm(i,t,e,n,s){const{fullCircles:o,startAngle:r,circumference:a}=t;let l=t.endAngle;if(o){Es(i,t,e,n,l,s);for(let c=0;c=tt||vn(r,l,c),m=de(a,h+f,u+f);return p&&m}getCenterPoint(e){const{x:n,y:s,startAngle:o,endAngle:r,innerRadius:a,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:c,spacing:h}=this.options,u=(o+r)/2,d=(a+l+h+c)/2;return{x:n+Math.cos(u)*d,y:s+Math.sin(u)*d}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){const{options:n,circumference:s}=this,o=(n.offset||0)/4,r=(n.spacing||0)/2,a=n.circular;if(this.pixelMargin=n.borderAlign==="inner"?.33:0,this.fullCircles=s>tt?Math.floor(s/tt):0,s===0||this.innerRadius<0||this.outerRadius<0)return;e.save();const l=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(l)*o,Math.sin(l)*o);const c=1-Math.sin(Math.min(et,s||0)),h=o*c;e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,vm(e,this,h,r,a),wm(e,this,h,r,a),e.restore()}},A(fi,"id","arc"),A(fi,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),A(fi,"defaultRoutes",{backgroundColor:"backgroundColor"}),A(fi,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"}),fi);function Zh(i,t,e=t){i.lineCap=E(e.borderCapStyle,t.borderCapStyle),i.setLineDash(E(e.borderDash,t.borderDash)),i.lineDashOffset=E(e.borderDashOffset,t.borderDashOffset),i.lineJoin=E(e.borderJoinStyle,t.borderJoinStyle),i.lineWidth=E(e.borderWidth,t.borderWidth),i.strokeStyle=E(e.borderColor,t.borderColor)}function Mm(i,t,e){i.lineTo(e.x,e.y)}function Sm(i){return i.stepped?Vf:i.tension||i.cubicInterpolationMode==="monotone"?Wf:Mm}function Jh(i,t,e={}){const n=i.length,{start:s=0,end:o=n-1}=e,{start:r,end:a}=t,l=Math.max(s,r),c=Math.min(o,a),h=sa&&o>a;return{count:n,start:l,loop:t.loop,ilen:c(r+(c?a-_:_))%o,w=()=>{p!==m&&(i.lineTo(h,m),i.lineTo(h,p),i.lineTo(h,b))};for(l&&(f=s[x(0)],i.moveTo(f.x,f.y)),d=0;d<=a;++d){if(f=s[x(d)],f.skip)continue;const _=f.x,y=f.y,k=_|0;k===g?(ym&&(m=y),h=(u*h+_)/++u):(w(),i.lineTo(_,y),g=k,u=0,p=m=y),b=y}w()}function Jo(i){const t=i.options,e=t.borderDash&&t.borderDash.length;return!i._decimated&&!i._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?Cm:Pm}function Am(i){return i.stepped?yg:i.tension||i.cubicInterpolationMode==="monotone"?vg:Ye}function Dm(i,t,e,n){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,n)&&s.closePath()),Zh(i,t.options),i.stroke(s)}function Om(i,t,e,n){const{segments:s,options:o}=t,r=Jo(t);for(const a of s)Zh(i,o,a.style),i.beginPath(),r(i,t,a,{start:e,end:e+n-1})&&i.closePath(),i.stroke()}const Tm=typeof Path2D=="function";function Lm(i,t,e,n){Tm&&!t.options.segment?Dm(i,t,e,n):Om(i,t,e,n)}var gi;let io=(gi=class extends me{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const n=this.options;if((n.tension||n.cubicInterpolationMode==="monotone")&&!n.stepped&&!this._pointsUpdated){const s=n.spanGaps?this._loop:this._fullLoop;dg(this._points,n,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Cg(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,n=t.length;return n&&e[t[n-1].end]}interpolate(t,e){const n=this.options,s=t[e],o=this.points,r=Fh(this,{property:e,start:s,end:s});if(!r.length)return;const a=[],l=Am(n);let c,h;for(c=0,h=r.length;ct!=="borderDash"&&t!=="fill"}),gi);function ll(i,t,e,n){const s=i.options,{[e]:o}=i.getProps([e],n);return Math.abs(t-o)i.replace("rgb(","rgba(").replace(")",", 0.5)"));function tu(i){return Qo[i%Qo.length]}function eu(i){return cl[i%cl.length]}function Vm(i,t){return i.borderColor=tu(t),i.backgroundColor=eu(t),++t}function Wm(i,t){return i.backgroundColor=i.data.map(()=>tu(t++)),t}function jm(i,t){return i.backgroundColor=i.data.map(()=>eu(t++)),t}function Hm(i){let t=0;return(e,n)=>{const s=i.getDatasetMeta(n).controller;s instanceof Ir?t=Wm(e,t):s instanceof Nh?t=jm(e,t):s&&(t=Vm(e,t))}}function hl(i){let t;for(t in i)if(i[t].borderColor||i[t].backgroundColor)return!0;return!1}function Ym(i){return i&&(i.borderColor||i.backgroundColor)}var Xm={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(i,t,e){if(!e.enabled)return;const{data:{datasets:n},options:s}=i.config,{elements:o}=s;if(!e.forceOverride&&(hl(n)||Ym(s)||o&&hl(o)))return;const r=Hm(i);n.forEach(r)}};function Um(i,t,e,n,s){const o=s.samples||n;if(o>=e)return i.slice(t,t+e);const r=[],a=(e-2)/(o-2);let l=0;const c=t+e-1;let h=t,u,d,f,g,p;for(r[l++]=i[h],u=0;uf&&(f=g,d=i[x],p=x);r[l++]=d,h=p}return r[l++]=i[c],r}function qm(i,t,e,n){let s=0,o=0,r,a,l,c,h,u,d,f,g,p;const m=[],b=t+e-1,x=i[t].x,_=i[b].x-x;for(r=t;rp&&(p=c,d=r),s=(o*s+a.x)/++o;else{const k=r-1;if(!j(u)&&!j(d)){const v=Math.min(u,d),M=Math.max(u,d);v!==f&&v!==k&&m.push({...i[v],x:s}),M!==f&&M!==k&&m.push({...i[M],x:s})}r>0&&k!==f&&m.push(i[k]),m.push(a),h=y,o=0,g=p=c,u=d=f=r}}return m}function iu(i){if(i._decimated){const t=i._data;delete i._decimated,delete i._data,Object.defineProperty(i,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function ul(i){i.data.datasets.forEach(t=>{iu(t)})}function Km(i,t){const e=t.length;let n=0,s;const{iScale:o}=i,{min:r,max:a,minDefined:l,maxDefined:c}=o.getUserBounds();return l&&(n=gt(fe(t,o.axis,r).lo,0,e-1)),c?s=gt(fe(t,o.axis,a).hi+1,n,e)-n:s=e-n,{start:n,count:s}}var Gm={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(i,t,e)=>{if(!e.enabled){ul(i);return}const n=i.width;i.data.datasets.forEach((s,o)=>{const{_data:r,indexAxis:a}=s,l=i.getDatasetMeta(o),c=r||s.data;if(en([a,i.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;const h=i.scales[l.xAxisID];if(h.type!=="linear"&&h.type!=="time"||i.options.parsing)return;let{start:u,count:d}=Km(l,c);const f=e.threshold||4*n;if(d<=f){iu(s);return}j(r)&&(s._data=c,delete s.data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(p){this._data=p}}));let g;switch(e.algorithm){case"lttb":g=Um(c,u,d,n,e);break;case"min-max":g=qm(c,u,d,n);break;default:throw new Error(`Unsupported decimation algorithm '${e.algorithm}'`)}s._decimated=g})},destroy(i){ul(i)}};function Zm(i,t,e){const n=i.segments,s=i.points,o=t.points,r=[];for(const a of n){let{start:l,end:c}=a;c=$r(l,c,s);const h=tr(e,s[l],s[c],a.loop);if(!t.segments){r.push({source:a,target:h,start:s[l],end:s[c]});continue}const u=Fh(t,h);for(const d of u){const f=tr(e,o[d.start],o[d.end],d.loop),g=Ih(a,s,f);for(const p of g)r.push({source:p,target:d,start:{[e]:dl(h,f,"start",Math.max)},end:{[e]:dl(h,f,"end",Math.min)}})}}return r}function tr(i,t,e,n){if(n)return;let s=t[i],o=e[i];return i==="angle"&&(s=At(s),o=At(o)),{property:i,start:s,end:o}}function Jm(i,t){const{x:e=null,y:n=null}=i||{},s=t.points,o=[];return t.segments.forEach(({start:r,end:a})=>{a=$r(r,a,s);const l=s[r],c=s[a];n!==null?(o.push({x:l.x,y:n}),o.push({x:c.x,y:n})):e!==null&&(o.push({x:e,y:l.y}),o.push({x:e,y:c.y}))}),o}function $r(i,t,e){for(;t>i;t--){const n=e[t];if(!isNaN(n.x)&&!isNaN(n.y))break}return t}function dl(i,t,e,n){return i&&t?n(i[e],t[e]):i?i[e]:t?t[e]:0}function nu(i,t){let e=[],n=!1;return Q(i)?(n=!0,e=i):e=Jm(i,t),e.length?new io({points:e,options:{tension:0},_loop:n,_fullLoop:n}):null}function fl(i){return i&&i.fill!==!1}function Qm(i,t,e){let s=i[t].fill;const o=[t];let r;if(!e)return s;for(;s!==!1&&o.indexOf(s)===-1;){if(!rt(s))return s;if(r=i[s],!r)return!1;if(r.visible)return s;o.push(s),s=r.fill}return!1}function tb(i,t,e){const n=sb(i);if(N(n))return isNaN(n.value)?!1:n;let s=parseFloat(n);return rt(s)&&Math.floor(s)===s?eb(n[0],t,s,e):["origin","start","end","stack","shape"].indexOf(n)>=0&&n}function eb(i,t,e,n){return(i==="-"||i==="+")&&(e=t+e),e===t||e<0||e>=n?!1:e}function ib(i,t){let e=null;return i==="start"?e=t.bottom:i==="end"?e=t.top:N(i)?e=t.getPixelForValue(i.value):t.getBasePixel&&(e=t.getBasePixel()),e}function nb(i,t,e){let n;return i==="start"?n=e:i==="end"?n=t.options.reverse?t.min:t.max:N(i)?n=i.value:n=t.getBaseValue(),n}function sb(i){const t=i.options,e=t.fill;let n=E(e&&e.target,e);return n===void 0&&(n=!!t.backgroundColor),n===!1||n===null?!1:n===!0?"origin":n}function ob(i){const{scale:t,index:e,line:n}=i,s=[],o=n.segments,r=n.points,a=rb(t,e);a.push(nu({x:null,y:t.bottom},n));for(let l=0;l=0;--r){const a=s[r].$filler;a&&(a.line.updateControlPoints(o,a.axis),n&&a.fill&&Co(i.ctx,a,o))}},beforeDatasetsDraw(i,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;const n=i.getSortedVisibleDatasetMetas();for(let s=n.length-1;s>=0;--s){const o=n[s].$filler;fl(o)&&Co(i.ctx,o,i.chartArea)}},beforeDatasetDraw(i,t,e){const n=t.meta.$filler;!fl(n)||e.drawTime!=="beforeDatasetDraw"||Co(i.ctx,n,i.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const bl=(i,t)=>{let{boxHeight:e=t,boxWidth:n=t}=i;return i.usePointStyle&&(e=Math.min(e,t),n=i.pointStyleWidth||Math.min(n,t)),{boxWidth:n,boxHeight:e,itemHeight:Math.max(t,e)}},bb=(i,t)=>i!==null&&t!==null&&i.datasetIndex===t.datasetIndex&&i.index===t.index;class _l extends me{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,n){this.maxWidth=t,this.maxHeight=e,this._margins=n,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=G(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(n=>t.filter(n,this.chart.data))),t.sort&&(e=e.sort((n,s)=>t.sort(n,s,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}const n=t.labels,s=dt(n.font),o=s.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=bl(n,o);let c,h;e.font=s.string,this.isHorizontal()?(c=this.maxWidth,h=this._fitRows(r,o,a,l)+10):(h=this.maxHeight,c=this._fitCols(r,s,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,n,s){const{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],h=s+a;let u=t;o.textAlign="left",o.textBaseline="middle";let d=-1,f=-h;return this.legendItems.forEach((g,p)=>{const m=n+e/2+o.measureText(g.text).width;(p===0||c[c.length-1]+m+2*a>r)&&(u+=h,c[c.length-(p>0?0:1)]=0,f+=h,d++),l[p]={left:0,top:f,row:d,width:m,height:s},c[c.length-1]+=m+a}),u}_fitCols(t,e,n,s){const{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],h=r-t;let u=a,d=0,f=0,g=0,p=0;return this.legendItems.forEach((m,b)=>{const{itemWidth:x,itemHeight:w}=_b(n,e,o,m,s);b>0&&f+w+2*a>h&&(u+=d+a,c.push({width:d,height:f}),g+=d+a,p++,d=f=0),l[b]={left:g,top:f,col:p,width:x,height:w},d=Math.max(d,x),f+=w+a}),u+=d,c.push({width:d,height:f}),u}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:n,labels:{padding:s},rtl:o}}=this,r=bi(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=bt(n,this.left+s,this.right-this.lineWidths[a]);for(const c of e)a!==c.row&&(a=c.row,l=bt(n,this.left+s,this.right-this.lineWidths[a])),c.top+=this.top+t+s,c.left=r.leftForLtr(r.x(l),c.width),l+=c.width+s}else{let a=0,l=bt(n,this.top+t+s,this.bottom-this.columnSizes[a].height);for(const c of e)c.col!==a&&(a=c.col,l=bt(n,this.top+t+s,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+s,c.left=r.leftForLtr(r.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;Qs(t,this),this._draw(),to(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:n,ctx:s}=this,{align:o,labels:r}=t,a=at.color,l=bi(t.rtl,this.left,this.width),c=dt(r.font),{padding:h}=r,u=c.size,d=u/2;let f;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:g,boxHeight:p,itemHeight:m}=bl(r,u),b=function(k,v,M){if(isNaN(g)||g<=0||isNaN(p)||p<0)return;s.save();const S=E(M.lineWidth,1);if(s.fillStyle=E(M.fillStyle,a),s.lineCap=E(M.lineCap,"butt"),s.lineDashOffset=E(M.lineDashOffset,0),s.lineJoin=E(M.lineJoin,"miter"),s.lineWidth=S,s.strokeStyle=E(M.strokeStyle,a),s.setLineDash(E(M.lineDash,[])),r.usePointStyle){const C={radius:p*Math.SQRT2/2,pointStyle:M.pointStyle,rotation:M.rotation,borderWidth:S},D=l.xPlus(k,g/2),T=v+d;kh(s,C,D,T,r.pointStyleWidth&&g)}else{const C=v+Math.max((u-p)/2,0),D=l.leftForLtr(k,g),T=Qe(M.borderRadius);s.beginPath(),Object.values(T).some(I=>I!==0)?wn(s,{x:D,y:C,w:g,h:p,radius:T}):s.rect(D,C,g,p),s.fill(),S!==0&&s.stroke()}s.restore()},x=function(k,v,M){ni(s,M.text,k,v+m/2,c,{strikethrough:M.hidden,textAlign:l.textAlign(M.textAlign)})},w=this.isHorizontal(),_=this._computeTitleHeight();w?f={x:bt(o,this.left+h,this.right-n[0]),y:this.top+h+_,line:0}:f={x:this.left+h,y:bt(o,this.top+_+h,this.bottom-e[0].height),line:0},Lh(this.ctx,t.textDirection);const y=m+h;this.legendItems.forEach((k,v)=>{s.strokeStyle=k.fontColor,s.fillStyle=k.fontColor;const M=s.measureText(k.text).width,S=l.textAlign(k.textAlign||(k.textAlign=r.textAlign)),C=g+d+M;let D=f.x,T=f.y;l.setWidth(this.width),w?v>0&&D+C+h>this.right&&(T=f.y+=y,f.line++,D=f.x=bt(o,this.left+h,this.right-n[f.line])):v>0&&T+y>this.bottom&&(D=f.x=D+e[f.line].width+h,f.line++,T=f.y=bt(o,this.top+_+h,this.bottom-e[f.line].height));const I=l.x(D);if(b(I,T,k),D=Of(S,D+g+d,w?D+C:this.right,t.rtl),x(l.x(D),T,k),w)f.x+=C+h;else if(typeof k.text!="string"){const $=c.lineHeight;f.y+=ou(k,$)+h}else f.y+=y}),Rh(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,n=dt(e.font),s=yt(e.padding);if(!e.display)return;const o=bi(t.rtl,this.left,this.width),r=this.ctx,a=e.position,l=n.size/2,c=s.top+l;let h,u=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),h=this.top+c,u=bt(t.align,u,this.right-d);else{const g=this.columnSizes.reduce((p,m)=>Math.max(p,m.height),0);h=c+bt(t.align,this.top,this.bottom-g-t.labels.padding-this._computeTitleHeight())}const f=bt(a,u,u+d);r.textAlign=o.textAlign(Ar(a)),r.textBaseline="middle",r.strokeStyle=e.color,r.fillStyle=e.color,r.font=n.string,ni(r,e.text,f,h,n)}_computeTitleHeight(){const t=this.options.title,e=dt(t.font),n=yt(t.padding);return t.display?e.lineHeight+n.height:0}_getLegendItemAt(t,e){let n,s,o;if(de(t,this.left,this.right)&&de(e,this.top,this.bottom)){for(o=this.legendHitBoxes,n=0;no.length>r.length?o:r)),t+e.size/2+n.measureText(s).width}function yb(i,t,e){let n=i;return typeof t.text!="string"&&(n=ou(t,e)),n}function ou(i,t){const e=i.text?i.text.length:0;return t*e}function vb(i,t){return!!((i==="mousemove"||i==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(i==="click"||i==="mouseup"))}var wb={id:"legend",_element:_l,start(i,t,e){const n=i.legend=new _l({ctx:i.ctx,options:e,chart:i});_t.configure(i,n,e),_t.addBox(i,n)},stop(i){_t.removeBox(i,i.legend),delete i.legend},beforeUpdate(i,t,e){const n=i.legend;_t.configure(i,n,e),n.options=e},afterUpdate(i){const t=i.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(i,t){t.replay||i.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(i,t,e){const n=t.datasetIndex,s=e.chart;s.isDatasetVisible(n)?(s.hide(n),t.hidden=!0):(s.show(n),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:i=>i.chart.options.color,boxWidth:40,padding:10,generateLabels(i){const t=i.data.datasets,{labels:{usePointStyle:e,pointStyle:n,textAlign:s,color:o,useBorderRadius:r,borderRadius:a}}=i.legend.options;return i._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(e?0:void 0),h=yt(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:c.borderColor,pointStyle:n||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:r&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:i=>i.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:i=>!i.startsWith("on"),labels:{_scriptable:i=>!["generateLabels","filter","sort"].includes(i)}}};class zr extends me{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const n=this.options;if(this.left=0,this.top=0,!n.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;const s=Q(n.text)?n.text.length:1;this._padding=yt(n.padding);const o=s*dt(n.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:e,left:n,bottom:s,right:o,options:r}=this,a=r.align;let l=0,c,h,u;return this.isHorizontal()?(h=bt(a,n,o),u=e+t,c=o-n):(r.position==="left"?(h=n+t,u=bt(a,s,e),l=et*-.5):(h=o-t,u=bt(a,e,s),l=et*.5),c=s-e),{titleX:h,titleY:u,maxWidth:c,rotation:l}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const n=dt(e.font),o=n.lineHeight/2+this._padding.top,{titleX:r,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(o);ni(t,e.text,0,0,n,{color:e.color,maxWidth:l,rotation:c,textAlign:Ar(e.align),textBaseline:"middle",translation:[r,a]})}}function kb(i,t){const e=new zr({ctx:i.ctx,options:t,chart:i});_t.configure(i,e,t),_t.addBox(i,e),i.titleBlock=e}var Mb={id:"title",_element:zr,start(i,t,e){kb(i,e)},stop(i){const t=i.titleBlock;_t.removeBox(i,t),delete i.titleBlock},beforeUpdate(i,t,e){const n=i.titleBlock;_t.configure(i,n,e),n.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Gn=new WeakMap;var Sb={id:"subtitle",start(i,t,e){const n=new zr({ctx:i.ctx,options:e,chart:i});_t.configure(i,n,e),_t.addBox(i,n),Gn.set(i,n)},stop(i){_t.removeBox(i,Gn.get(i)),Gn.delete(i)},beforeUpdate(i,t,e){const n=Gn.get(i);_t.configure(i,n,e),n.options=e},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const on={average(i){if(!i.length)return!1;let t,e,n=0,s=0,o=0;for(t=0,e=i.length;t-1?i.split(` +`):i}function Pb(i,t){const{element:e,datasetIndex:n,index:s}=t,o=i.getDatasetMeta(n).controller,{label:r,value:a}=o.getLabelAndValue(s);return{chart:i,label:r,parsed:o.getParsed(s),raw:i.data.datasets[n].data[s],formattedValue:a,dataset:o.getDataset(),dataIndex:s,datasetIndex:n,element:e}}function xl(i,t){const e=i.chart.ctx,{body:n,footer:s,title:o}=i,{boxWidth:r,boxHeight:a}=t,l=dt(t.bodyFont),c=dt(t.titleFont),h=dt(t.footerFont),u=o.length,d=s.length,f=n.length,g=yt(t.padding);let p=g.height,m=0,b=n.reduce((_,y)=>_+y.before.length+y.lines.length+y.after.length,0);if(b+=i.beforeBody.length+i.afterBody.length,u&&(p+=u*c.lineHeight+(u-1)*t.titleSpacing+t.titleMarginBottom),b){const _=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;p+=f*_+(b-f)*l.lineHeight+(b-1)*t.bodySpacing}d&&(p+=t.footerMarginTop+d*h.lineHeight+(d-1)*t.footerSpacing);let x=0;const w=function(_){m=Math.max(m,e.measureText(_).width+x)};return e.save(),e.font=c.string,X(i.title,w),e.font=l.string,X(i.beforeBody.concat(i.afterBody),w),x=t.displayColors?r+2+t.boxPadding:0,X(n,_=>{X(_.before,w),X(_.lines,w),X(_.after,w)}),x=0,e.font=h.string,X(i.footer,w),e.restore(),m+=g.width,{width:m,height:p}}function Cb(i,t){const{y:e,height:n}=t;return ei.height-n/2?"bottom":"center"}function Ab(i,t,e,n){const{x:s,width:o}=n,r=e.caretSize+e.caretPadding;if(i==="left"&&s+o+r>t.width||i==="right"&&s-o-r<0)return!0}function Db(i,t,e,n){const{x:s,width:o}=e,{width:r,chartArea:{left:a,right:l}}=i;let c="center";return n==="center"?c=s<=(a+l)/2?"left":"right":s<=o/2?c="left":s>=r-o/2&&(c="right"),Ab(c,i,t,e)&&(c="center"),c}function yl(i,t,e){const n=e.yAlign||t.yAlign||Cb(i,e);return{xAlign:e.xAlign||t.xAlign||Db(i,t,e,n),yAlign:n}}function Ob(i,t){let{x:e,width:n}=i;return t==="right"?e-=n:t==="center"&&(e-=n/2),e}function Tb(i,t,e){let{y:n,height:s}=i;return t==="top"?n+=e:t==="bottom"?n-=s+e:n-=s/2,n}function vl(i,t,e,n){const{caretSize:s,caretPadding:o,cornerRadius:r}=i,{xAlign:a,yAlign:l}=e,c=s+o,{topLeft:h,topRight:u,bottomLeft:d,bottomRight:f}=Qe(r);let g=Ob(t,a);const p=Tb(t,l,c);return l==="center"?a==="left"?g+=c:a==="right"&&(g-=c):a==="left"?g-=Math.max(h,d)+s:a==="right"&&(g+=Math.max(u,f)+s),{x:gt(g,0,n.width-t.width),y:gt(p,0,n.height-t.height)}}function Zn(i,t,e){const n=yt(e.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-n.right:i.x+n.left}function wl(i){return Yt([],oe(i))}function Lb(i,t,e){return Ee(i,{tooltip:t,tooltipItems:e,type:"tooltip"})}function kl(i,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?i.override(e):i}const ru={beforeTitle:ne,title(i){if(i.length>0){const t=i[0],e=t.chart.data.labels,n=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(n>0&&t.dataIndex"u"?ru[t].call(e,n):s}var Wo;let Ml=(Wo=class extends me{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,n=this.options.setContext(this.getContext()),s=n.enabled&&e.options.animation&&n.animations,o=new $h(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=Lb(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:n}=e,s=vt(n,"beforeTitle",this,t),o=vt(n,"title",this,t),r=vt(n,"afterTitle",this,t);let a=[];return a=Yt(a,oe(s)),a=Yt(a,oe(o)),a=Yt(a,oe(r)),a}getBeforeBody(t,e){return wl(vt(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:n}=e,s=[];return X(t,o=>{const r={before:[],lines:[],after:[]},a=kl(n,o);Yt(r.before,oe(vt(a,"beforeLabel",this,o))),Yt(r.lines,vt(a,"label",this,o)),Yt(r.after,oe(vt(a,"afterLabel",this,o))),s.push(r)}),s}getAfterBody(t,e){return wl(vt(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:n}=e,s=vt(n,"beforeFooter",this,t),o=vt(n,"footer",this,t),r=vt(n,"afterFooter",this,t);let a=[];return a=Yt(a,oe(s)),a=Yt(a,oe(o)),a=Yt(a,oe(r)),a}_createItems(t){const e=this._active,n=this.chart.data,s=[],o=[],r=[];let a=[],l,c;for(l=0,c=e.length;lt.filter(h,u,d,n))),t.itemSort&&(a=a.sort((h,u)=>t.itemSort(h,u,n))),X(a,h=>{const u=kl(t.callbacks,h);s.push(vt(u,"labelColor",this,h)),o.push(vt(u,"labelPointStyle",this,h)),r.push(vt(u,"labelTextColor",this,h))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(t,e){const n=this.options.setContext(this.getContext()),s=this._active;let o,r=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const a=on[n.position].call(this,s,this._eventPosition);r=this._createItems(n),this.title=this.getTitle(r,n),this.beforeBody=this.getBeforeBody(r,n),this.body=this.getBody(r,n),this.afterBody=this.getAfterBody(r,n),this.footer=this.getFooter(r,n);const l=this._size=xl(this,n),c=Object.assign({},a,l),h=yl(this.chart,n,c),u=vl(n,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:u.x,y:u.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,n,s){const o=this.getCaretPosition(t,n,s);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,n){const{xAlign:s,yAlign:o}=this,{caretSize:r,cornerRadius:a}=n,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:u}=Qe(a),{x:d,y:f}=t,{width:g,height:p}=e;let m,b,x,w,_,y;return o==="center"?(_=f+p/2,s==="left"?(m=d,b=m-r,w=_+r,y=_-r):(m=d+g,b=m+r,w=_-r,y=_+r),x=m):(s==="left"?b=d+Math.max(l,h)+r:s==="right"?b=d+g-Math.max(c,u)-r:b=this.caretX,o==="top"?(w=f,_=w-r,m=b-r,x=b+r):(w=f+p,_=w+r,m=b+r,x=b-r),y=w),{x1:m,x2:b,x3:x,y1:w,y2:_,y3:y}}drawTitle(t,e,n){const s=this.title,o=s.length;let r,a,l;if(o){const c=bi(n.rtl,this.x,this.width);for(t.x=Zn(this,n.titleAlign,n),e.textAlign=c.textAlign(n.titleAlign),e.textBaseline="middle",r=dt(n.titleFont),a=n.titleSpacing,e.fillStyle=n.titleColor,e.font=r.string,l=0;lx!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,wn(t,{x:p,y:g,w:c,h:l,radius:b}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),wn(t,{x:m,y:g+1,w:c-2,h:l-2,radius:b}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(p,g,c,l),t.strokeRect(p,g,c,l),t.fillStyle=r.backgroundColor,t.fillRect(m,g+1,c-2,l-2))}t.fillStyle=this.labelTextColors[n]}drawBody(t,e,n){const{body:s}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:h}=n,u=dt(n.bodyFont);let d=u.lineHeight,f=0;const g=bi(n.rtl,this.x,this.width),p=function(M){e.fillText(M,g.x(t.x+f),t.y+d/2),t.y+=d+o},m=g.textAlign(r);let b,x,w,_,y,k,v;for(e.textAlign=r,e.textBaseline="middle",e.font=u.string,t.x=Zn(this,m,n),e.fillStyle=n.bodyColor,X(this.beforeBody,p),f=a&&m!=="right"?r==="center"?c/2+h:c+2+h:0,_=0,k=s.length;_0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,n=this.$animations,s=n&&n.x,o=n&&n.y;if(s||o){const r=on[t.position].call(this,this._active,this._eventPosition);if(!r)return;const a=this._size=xl(this,t),l=Object.assign({},r,this._size),c=yl(e,t,l),h=vl(t,l,c,e);(s._to!==h.x||o._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let n=this.opacity;if(!n)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;const r=yt(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=n,this.drawBackground(o,t,s,e),Lh(t,e.textDirection),o.y+=r.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),Rh(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const n=this._active,s=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!As(n,s),r=this._positionChanged(s,e);(o||r)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,n=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],r=this._getActiveElements(t,o,e,n),a=this._positionChanged(r,t),l=e||!As(r,o)||a;return l&&(this._active=r,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,n,s){const o=this.options;if(t.type==="mouseout")return[];if(!s)return e;const r=this.chart.getElementsAtEventForMode(t,o.mode,o,n);return o.reverse&&r.reverse(),r}_positionChanged(t,e){const{caretX:n,caretY:s,options:o}=this,r=on[o.position].call(this,t,e);return r!==!1&&(n!==r.x||s!==r.y)}},A(Wo,"positioners",on),Wo);var Rb={id:"tooltip",_element:Ml,positioners:on,afterInit(i,t,e){e&&(i.tooltip=new Ml({chart:i,options:e}))},beforeUpdate(i,t,e){i.tooltip&&i.tooltip.initialize(e)},reset(i,t,e){i.tooltip&&i.tooltip.initialize(e)},afterDraw(i){const t=i.tooltip;if(t&&t._willRender()){const e={tooltip:t};if(i.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(i.ctx),i.notifyPlugins("afterTooltipDraw",e)}},afterEvent(i,t){if(i.tooltip){const e=t.replay;i.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(i,t)=>t.bodyFont.size,boxWidth:(i,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:ru},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:i=>i!=="filter"&&i!=="itemSort"&&i!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},Eb=Object.freeze({__proto__:null,Colors:Xm,Decimation:Gm,Filler:mb,Legend:wb,SubTitle:Sb,Title:Mb,Tooltip:Rb});const Ib=(i,t,e,n)=>(typeof t=="string"?(e=i.push(t)-1,n.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function Fb(i,t,e,n){const s=i.indexOf(t);if(s===-1)return Ib(i,t,e,n);const o=i.lastIndexOf(t);return s!==o?e:s}const $b=(i,t)=>i===null?null:gt(Math.round(i),0,t);function Sl(i){const t=this.getLabels();return i>=0&&ie.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}},A(ps,"id","category"),A(ps,"defaults",{ticks:{callback:Sl}}),ps);function Bb(i,t){const e=[],{bounds:s,step:o,min:r,max:a,precision:l,count:c,maxTicks:h,maxDigits:u,includeBounds:d}=i,f=o||1,g=h-1,{min:p,max:m}=t,b=!j(r),x=!j(a),w=!j(c),_=(m-p)/(u+1);let y=_a((m-p)/g/f)*f,k,v,M,S;if(y<1e-14&&!b&&!x)return[{value:p},{value:m}];S=Math.ceil(m/y)-Math.floor(p/y),S>g&&(y=_a(S*y/g/f)*f),j(l)||(k=Math.pow(10,l),y=Math.ceil(y*k)/k),s==="ticks"?(v=Math.floor(p/y)*y,M=Math.ceil(m/y)*y):(v=p,M=m),b&&x&&o&&kf((a-r)/o,y/1e3)?(S=Math.round(Math.min((a-r)/y,h)),y=(a-r)/S,v=r,M=a):w?(v=b?r:v,M=x?a:M,S=c-1,y=(M-v)/S):(S=(M-v)/y,dn(S,Math.round(S),y/1e3)?S=Math.round(S):S=Math.ceil(S));const C=Math.max(xa(y),xa(v));k=Math.pow(10,j(l)?C:l),v=Math.round(v*k)/k,M=Math.round(M*k)/k;let D=0;for(b&&(d&&v!==r?(e.push({value:r}),va)break;e.push({value:T})}return x&&d&&M!==a?e.length&&dn(e[e.length-1].value,a,Pl(a,_,i))?e[e.length-1].value=a:e.push({value:a}):(!x||M===a)&&e.push({value:M}),e}function Pl(i,t,{horizontal:e,minRotation:n}){const s=Wt(n),o=(e?Math.sin(s):Math.cos(s))||.001,r=.75*t*(""+i).length;return Math.min(t/o,r)}let Is=class extends En{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return j(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:n}=this.getUserBounds();let{min:s,max:o}=this;const r=l=>s=e?s:l,a=l=>o=n?o:l;if(t){const l=Zt(s),c=Zt(o);l<0&&c<0?a(0):l>0&&c>0&&r(0)}if(s===o){let l=o===0?1:Math.abs(o*.05);a(o+l),t||r(s-l)}this.min=s,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:n}=t,s;return n?(s=Math.ceil(this.max/n)-Math.floor(this.min/n)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${n} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let n=this.getTickLimit();n=Math.max(2,n);const s={maxTicks:n,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,r=Bb(s,o);return t.bounds==="ticks"&&gh(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const t=this.ticks;let e=this.min,n=this.max;if(super.configure(),this.options.offset&&t.length){const s=(n-e)/Math.max(t.length-1,1)/2;e-=s,n+=s}this._startValue=e,this._endValue=n,this._valueRange=n-e}getLabelForValue(t){return Ln(t,this.chart.options.locale,this.options.ticks.format)}};var ms;let Nb=(ms=class extends Is{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=rt(t)?t:0,this.max=rt(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,n=Wt(this.options.ticks.minRotation),s=(t?Math.sin(n):Math.cos(n))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}},A(ms,"id","linear"),A(ms,"defaults",{ticks:{callback:Js.formatters.numeric}}),ms);const Mn=i=>Math.floor(ke(i)),Ve=(i,t)=>Math.pow(10,Mn(i)+t);function Cl(i){return i/Math.pow(10,Mn(i))===1}function Al(i,t,e){const n=Math.pow(10,e),s=Math.floor(i/n);return Math.ceil(t/n)-s}function Vb(i,t){const e=t-i;let n=Mn(e);for(;Al(i,t,n)>10;)n++;for(;Al(i,t,n)<10;)n--;return Math.min(n,Mn(i))}function Wb(i,{min:t,max:e}){t=Ct(i.min,t);const n=[],s=Mn(t);let o=Vb(t,e),r=o<0?Math.pow(10,Math.abs(o)):1;const a=Math.pow(10,o),l=s>o?Math.pow(10,s):0,c=Math.round((t-l)*r)/r,h=Math.floor((t-l)/a/10)*a*10;let u=Math.floor((c-h)/Math.pow(10,o)),d=Ct(i.min,Math.round((l+h+u*Math.pow(10,o))*r)/r);for(;d=10?u=u<15?15:20:u++,u>=20&&(o++,u=2,r=o>=0?1:r),d=Math.round((l+h+u*Math.pow(10,o))*r)/r;const f=Ct(i.max,d);return n.push({value:f,major:Cl(f),significand:u}),n}var bs;let jb=(bs=class extends En{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const n=Is.prototype.parse.apply(this,[t,e]);if(n===0){this._zero=!0;return}return rt(n)&&n>0?n:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=rt(t)?Math.max(0,t):null,this.max=rt(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!rt(this._userMin)&&(this.min=t===Ve(this.min,0)?Ve(this.min,-1):Ve(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let n=this.min,s=this.max;const o=a=>n=t?n:a,r=a=>s=e?s:a;n===s&&(n<=0?(o(1),r(10)):(o(Ve(n,-1)),r(Ve(s,1)))),n<=0&&o(Ve(s,-1)),s<=0&&r(Ve(n,1)),this.min=n,this.max=s}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},n=Wb(e,this);return t.bounds==="ticks"&&gh(n,this,"value"),t.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}getLabelForValue(t){return t===void 0?"0":Ln(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=ke(t),this._valueRange=ke(this.max)-ke(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(ke(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}},A(bs,"id","logarithmic"),A(bs,"defaults",{ticks:{callback:Js.formatters.logarithmic,major:{enabled:!0}}}),bs);function er(i){const t=i.ticks;if(t.display&&i.display){const e=yt(t.backdropPadding);return E(t.font&&t.font.size,at.font.size)+e.height}return 0}function Hb(i,t,e){return e=Q(e)?e:[e],{w:Nf(i,t.string,e),h:e.length*t.lineHeight}}function Dl(i,t,e,n,s){return i===n||i===s?{start:t-e/2,end:t+e/2}:is?{start:t-e,end:t}:{start:t,end:t+e}}function Yb(i){const t={l:i.left+i._padding.left,r:i.right-i._padding.right,t:i.top+i._padding.top,b:i.bottom-i._padding.bottom},e=Object.assign({},t),n=[],s=[],o=i._pointLabels.length,r=i.options.pointLabels,a=r.centerPointLabels?et/o:0;for(let l=0;lt.r&&(a=(n.end-t.r)/o,i.r=Math.max(i.r,t.r+a)),s.startt.b&&(l=(s.end-t.b)/r,i.b=Math.max(i.b,t.b+l))}function Ub(i,t,e){const n=i.drawingArea,{extra:s,additionalAngle:o,padding:r,size:a}=e,l=i.getPointPosition(t,n+s+r,o),c=Math.round(Pr(At(l.angle+ut))),h=Jb(l.y,a.h,c),u=Gb(c),d=Zb(l.x,a.w,u);return{visible:!0,x:l.x,y:h,textAlign:u,left:d,top:h,right:d+a.w,bottom:h+a.h}}function qb(i,t){if(!t)return!0;const{left:e,top:n,right:s,bottom:o}=i;return!(ge({x:e,y:n},t)||ge({x:e,y:o},t)||ge({x:s,y:n},t)||ge({x:s,y:o},t))}function Kb(i,t,e){const n=[],s=i._pointLabels.length,o=i.options,{centerPointLabels:r,display:a}=o.pointLabels,l={extra:er(o)/2,additionalAngle:r?et/s:0};let c;for(let h=0;h270||e<90)&&(i-=t),i}function Qb(i,t,e){const{left:n,top:s,right:o,bottom:r}=e,{backdropColor:a}=t;if(!j(a)){const l=Qe(t.borderRadius),c=yt(t.backdropPadding);i.fillStyle=a;const h=n-c.left,u=s-c.top,d=o-n+c.width,f=r-s+c.height;Object.values(l).some(g=>g!==0)?(i.beginPath(),wn(i,{x:h,y:u,w:d,h:f,radius:l}),i.fill()):i.fillRect(h,u,d,f)}}function t_(i,t){const{ctx:e,options:{pointLabels:n}}=i;for(let s=t-1;s>=0;s--){const o=i._pointLabelItems[s];if(!o.visible)continue;const r=n.setContext(i.getPointLabelContext(s));Qb(e,r,o);const a=dt(r.font),{x:l,y:c,textAlign:h}=o;ni(e,i._pointLabels[s],l,c+a.lineHeight/2,a,{color:r.color,textAlign:h,textBaseline:"middle"})}}function au(i,t,e,n){const{ctx:s}=i;if(e)s.arc(i.xCenter,i.yCenter,t,0,tt);else{let o=i.getPointPosition(0,t);s.moveTo(o.x,o.y);for(let r=1;r{const s=G(this.options.pointLabels.callback,[e,n],this);return s||s===0?s:""}).filter((e,n)=>this.chart.getDataVisibility(n))}fit(){const t=this.options;t.display&&t.pointLabels.display?Yb(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,n,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((n-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,n,s))}getIndexAngle(t){const e=tt/(this._pointLabels.length||1),n=this.options.startAngle||0;return At(t*e+Wt(n))}getDistanceFromCenterForValue(t){if(j(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(j(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t{if(u!==0){l=this.getDistanceFromCenterForValue(h.value);const d=this.getContext(u),f=s.setContext(d),g=o.setContext(d);e_(this,f,l,r,g)}}),n.display){for(t.save(),a=r-1;a>=0;a--){const h=n.setContext(this.getPointLabelContext(a)),{color:u,lineWidth:d}=h;!d||!u||(t.lineWidth=d,t.strokeStyle=u,t.setLineDash(h.borderDash),t.lineDashOffset=h.borderDashOffset,l=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),c=this.getPointPosition(a,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,n=e.ticks;if(!n.display)return;const s=this.getIndexAngle(0);let o,r;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&!e.reverse)return;const c=n.setContext(this.getContext(l)),h=dt(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=h.string,r=t.measureText(a.label).width,t.fillStyle=c.backdropColor;const u=yt(c.backdropPadding);t.fillRect(-r/2-u.left,-o-h.size/2-u.top,r+u.width,h.size+u.height)}ni(t,a.label,0,-o,h,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}},A(pi,"id","radialLinear"),A(pi,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Js.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),A(pi,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),A(pi,"descriptors",{angleLines:{_fallback:"grid"}}),pi);const no={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},kt=Object.keys(no);function Ol(i,t){return i-t}function Tl(i,t){if(j(t))return null;const e=i._adapter,{parser:n,round:s,isoWeekday:o}=i._parseOpts;let r=t;return typeof n=="function"&&(r=n(r)),rt(r)||(r=typeof n=="string"?e.parse(r,n):e.parse(r)),r===null?null:(s&&(r=s==="week"&&(yi(o)||o===!0)?e.startOf(r,"isoWeek",o):e.startOf(r,s)),+r)}function Ll(i,t,e,n){const s=kt.length;for(let o=kt.indexOf(i);o=kt.indexOf(e);o--){const r=kt[o];if(no[r].common&&i._adapter.diff(s,n,r)>=t-1)return r}return kt[e?kt.indexOf(e):0]}function o_(i){for(let t=kt.indexOf(i)+1,e=kt.length;t=t?e[n]:e[s];i[o]=!0}}function r_(i,t,e,n){const s=i._adapter,o=+s.startOf(t[0].value,n),r=t[t.length-1].value;let a,l;for(a=o;a<=r;a=+s.add(a,1,n))l=e[a],l>=0&&(t[l].major=!0);return t}function El(i,t,e){const n=[],s={},o=t.length;let r,a;for(r=0;r+t.value))}initOffsets(t=[]){let e=0,n=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?n=o:n=(o-this.getDecimalForValue(t[t.length-2]))/2);const r=t.length<3?.5:.25;e=gt(e,0,r),n=gt(n,0,r),this._offsets={start:e,end:n,factor:1/(e+1+n)}}_generate(){const t=this._adapter,e=this.min,n=this.max,s=this.options,o=s.time,r=o.unit||Ll(o.minUnit,e,n,this._getLabelCapacity(e)),a=E(s.ticks.stepSize,1),l=r==="week"?o.isoWeekday:!1,c=yi(l)||l===!0,h={};let u=e,d,f;if(c&&(u=+t.startOf(u,"isoWeek",l)),u=+t.startOf(u,c?"day":r),t.diff(n,e,r)>1e5*a)throw new Error(e+" and "+n+" are too far apart with stepSize of "+a+" "+r);const g=s.ticks.source==="data"&&this.getDataTimestamps();for(d=u,f=0;d+p)}getLabelForValue(t){const e=this._adapter,n=this.options.time;return n.tooltipFormat?e.format(t,n.tooltipFormat):e.format(t,n.displayFormats.datetime)}format(t,e){const s=this.options.time.displayFormats,o=this._unit,r=e||s[o];return this._adapter.format(t,r)}_tickFormatFunction(t,e,n,s){const o=this.options,r=o.ticks.callback;if(r)return G(r,[t,e,n],this);const a=o.time.displayFormats,l=this._unit,c=this._majorUnit,h=l&&a[l],u=c&&a[c],d=n[e],f=c&&u&&d&&d.major;return this._adapter.format(t,s||(f?u:h))}generateTickLabels(t){let e,n,s;for(e=0,n=t.length;e0?a:1}getDataTimestamps(){let t=this._cache.data||[],e,n;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,n=s.length;e=i[n].pos&&t<=i[s].pos&&({lo:n,hi:s}=fe(i,"pos",t)),{pos:o,time:a}=i[n],{pos:r,time:l}=i[s]):(t>=i[n].time&&t<=i[s].time&&({lo:n,hi:s}=fe(i,"time",t)),{time:o,pos:a}=i[n],{time:r,pos:l}=i[s]);const c=r-o;return c?a+(l-a)*(t-o)/c:a}var xs;let a_=(xs=class extends ir{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=Jn(e,this.min),this._tableRange=Jn(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:n}=this,s=[],o=[];let r,a,l,c,h;for(r=0,a=t.length;r=e&&c<=n&&s.push(c);if(s.length<2)return[{time:e,pos:0},{time:n,pos:1}];for(r=0,a=s.length;rs-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),n=this.getLabelTimestamps();return e.length&&n.length?t=this.normalize(e.concat(n)):t=e.length?e:n,t=this._cache.all=t,t}getDecimalForValue(t){return(Jn(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,n=this.getDecimalForPixel(t)/e.factor-e.end;return Jn(this._table,n*this._tableRange+this._minPos,!0)}},A(xs,"id","timeseries"),A(xs,"defaults",ir.defaults),xs);var l_=Object.freeze({__proto__:null,CategoryScale:zb,LinearScale:Nb,LogarithmicScale:jb,RadialLinearScale:n_,TimeScale:ir,TimeSeriesScale:a_});const c_=[ap,Nm,Eb,l_];/*! + * Chart.js v3.9.1 + * https://www.chartjs.org + * (c) 2022 Chart.js Contributors + * Released under the MIT License + */const h_=function(){let i=0;return function(){return i++}}();function q(i){return i===null||typeof i>"u"}function nt(i){if(Array.isArray&&Array.isArray(i))return!0;const t=Object.prototype.toString.call(i);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function H(i){return i!==null&&Object.prototype.toString.call(i)==="[object Object]"}const pt=i=>(typeof i=="number"||i instanceof Number)&&isFinite(+i);function Rt(i,t){return pt(i)?i:t}function W(i,t){return typeof i>"u"?t:i}const u_=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100:i/t,lu=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100*t:+i;function ot(i,t,e){if(i&&typeof i.call=="function")return i.apply(e,t)}function U(i,t,e,n){let s,o,r;if(nt(i))if(o=i.length,n)for(s=o-1;s>=0;s--)t.call(e,i[s],s);else for(s=0;si,x:i=>i.x,y:i=>i.y};function Le(i,t){return(Il[t]||(Il[t]=g_(t)))(i)}function g_(i){const t=p_(i);return e=>{for(const n of t){if(n==="")break;e=e&&e[n]}return e}}function p_(i){const t=i.split("."),e=[];let n="";for(const s of t)n+=s,n.endsWith("\\")?n=n.slice(0,-1)+".":(e.push(n),n="");return e}function Br(i){return i.charAt(0).toUpperCase()+i.slice(1)}const zt=i=>typeof i<"u",Re=i=>typeof i=="function",Fl=(i,t)=>{if(i.size!==t.size)return!1;for(const e of i)if(!t.has(e))return!1;return!0};function m_(i){return i.type==="mouseup"||i.type==="click"||i.type==="contextmenu"}const ct=Math.PI,K=2*ct,b_=K+ct,zs=Number.POSITIVE_INFINITY,__=ct/180,lt=ct/2,Ei=ct/4,$l=ct*2/3,It=Math.log10,Jt=Math.sign;function zl(i){const t=Math.round(i);i=mn(i,t,i/1e3)?t:i;const e=Math.pow(10,Math.floor(It(i))),n=i/e;return(n<=1?1:n<=2?2:n<=5?5:10)*e}function x_(i){const t=[],e=Math.sqrt(i);let n;for(n=1;ns-o).pop(),t}function ki(i){return!isNaN(parseFloat(i))&&isFinite(i)}function mn(i,t,e){return Math.abs(i-t)=i}function hu(i,t,e){let n,s,o;for(n=0,s=i.length;nl&&c=Math.min(t,e)-n&&i<=Math.max(t,e)+n}function Vr(i,t,e){e=e||(r=>i[r]1;)o=s+n>>1,e(o)?s=o:n=o;return{lo:s,hi:n}}const Ze=(i,t,e,n)=>Vr(i,e,n?s=>i[s][t]<=e:s=>i[s][t]Vr(i,e,n=>i[n][t]>=e);function M_(i,t,e){let n=0,s=i.length;for(;nn&&i[s-1]>e;)s--;return n>0||s{const n="_onData"+Br(e),s=i[e];Object.defineProperty(i,e,{configurable:!0,enumerable:!1,value(...o){const r=s.apply(this,o);return i._chartjs.listeners.forEach(a=>{typeof a[n]=="function"&&a[n](...o)}),r}})})}function Nl(i,t){const e=i._chartjs;if(!e)return;const n=e.listeners,s=n.indexOf(t);s!==-1&&n.splice(s,1),!(n.length>0)&&(du.forEach(o=>{delete i[o]}),delete i._chartjs)}function fu(i){const t=new Set;let e,n;for(e=0,n=i.length;e"u"?function(i){return i()}:window.requestAnimationFrame}();function pu(i,t,e){const n=e||(r=>Array.prototype.slice.call(r));let s=!1,o=[];return function(...r){o=n(r),s||(s=!0,gu.call(window,()=>{s=!1,i.apply(t,o)}))}}function P_(i,t){let e;return function(...n){return t?(clearTimeout(e),e=setTimeout(i,t,n)):i.apply(this,n),t}}const C_=i=>i==="start"?"left":i==="end"?"right":"center",Vl=(i,t,e)=>i==="start"?t:i==="end"?e:(t+e)/2;function mu(i,t,e){const n=t.length;let s=0,o=n;if(i._sorted){const{iScale:r,_parsed:a}=i,l=r.axis,{min:c,max:h,minDefined:u,maxDefined:d}=r.getUserBounds();u&&(s=xt(Math.min(Ze(a,r.axis,c).lo,e?n:Ze(t,l,r.getPixelForValue(c)).lo),0,n-1)),d?o=xt(Math.max(Ze(a,r.axis,h,!0).hi+1,e?0:Ze(t,l,r.getPixelForValue(h),!0).hi+1),s,n)-s:o=n-s}return{start:s,count:o}}function bu(i){const{xScale:t,yScale:e,_scaleRanges:n}=i,s={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!n)return i._scaleRanges=s,!0;const o=n.xmin!==t.min||n.xmax!==t.max||n.ymin!==e.min||n.ymax!==e.max;return Object.assign(n,s),o}const Qn=i=>i===0||i===1,Wl=(i,t,e)=>-(Math.pow(2,10*(i-=1))*Math.sin((i-t)*K/e)),jl=(i,t,e)=>Math.pow(2,-10*i)*Math.sin((i-t)*K/e)+1,bn={linear:i=>i,easeInQuad:i=>i*i,easeOutQuad:i=>-i*(i-2),easeInOutQuad:i=>(i/=.5)<1?.5*i*i:-.5*(--i*(i-2)-1),easeInCubic:i=>i*i*i,easeOutCubic:i=>(i-=1)*i*i+1,easeInOutCubic:i=>(i/=.5)<1?.5*i*i*i:.5*((i-=2)*i*i+2),easeInQuart:i=>i*i*i*i,easeOutQuart:i=>-((i-=1)*i*i*i-1),easeInOutQuart:i=>(i/=.5)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2),easeInQuint:i=>i*i*i*i*i,easeOutQuint:i=>(i-=1)*i*i*i*i+1,easeInOutQuint:i=>(i/=.5)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2),easeInSine:i=>-Math.cos(i*lt)+1,easeOutSine:i=>Math.sin(i*lt),easeInOutSine:i=>-.5*(Math.cos(ct*i)-1),easeInExpo:i=>i===0?0:Math.pow(2,10*(i-1)),easeOutExpo:i=>i===1?1:-Math.pow(2,-10*i)+1,easeInOutExpo:i=>Qn(i)?i:i<.5?.5*Math.pow(2,10*(i*2-1)):.5*(-Math.pow(2,-10*(i*2-1))+2),easeInCirc:i=>i>=1?i:-(Math.sqrt(1-i*i)-1),easeOutCirc:i=>Math.sqrt(1-(i-=1)*i),easeInOutCirc:i=>(i/=.5)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1),easeInElastic:i=>Qn(i)?i:Wl(i,.075,.3),easeOutElastic:i=>Qn(i)?i:jl(i,.075,.3),easeInOutElastic(i){return Qn(i)?i:i<.5?.5*Wl(i*2,.1125,.45):.5+.5*jl(i*2-1,.1125,.45)},easeInBack(i){return i*i*((1.70158+1)*i-1.70158)},easeOutBack(i){return(i-=1)*i*((1.70158+1)*i+1.70158)+1},easeInOutBack(i){let t=1.70158;return(i/=.5)<1?.5*(i*i*(((t*=1.525)+1)*i-t)):.5*((i-=2)*i*(((t*=1.525)+1)*i+t)+2)},easeInBounce:i=>1-bn.easeOutBounce(1-i),easeOutBounce(i){return i<1/2.75?7.5625*i*i:i<2/2.75?7.5625*(i-=1.5/2.75)*i+.75:i<2.5/2.75?7.5625*(i-=2.25/2.75)*i+.9375:7.5625*(i-=2.625/2.75)*i+.984375},easeInOutBounce:i=>i<.5?bn.easeInBounce(i*2)*.5:bn.easeOutBounce(i*2-1)*.5+.5};/*! + * @kurkle/color v0.2.1 + * https://github.com/kurkle/color#readme + * (c) 2022 Jukka Kurkela + * Released under the MIT License + */function In(i){return i+.5|0}const Se=(i,t,e)=>Math.max(Math.min(i,e),t);function rn(i){return Se(In(i*2.55),0,255)}function Ae(i){return Se(In(i*255),0,255)}function ce(i){return Se(In(i/2.55)/100,0,1)}function Hl(i){return Se(In(i*100),0,100)}const Lt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},sr=[..."0123456789ABCDEF"],A_=i=>sr[i&15],D_=i=>sr[(i&240)>>4]+sr[i&15],ts=i=>(i&240)>>4===(i&15),O_=i=>ts(i.r)&&ts(i.g)&&ts(i.b)&&ts(i.a);function T_(i){var t=i.length,e;return i[0]==="#"&&(t===4||t===5?e={r:255&Lt[i[1]]*17,g:255&Lt[i[2]]*17,b:255&Lt[i[3]]*17,a:t===5?Lt[i[4]]*17:255}:(t===7||t===9)&&(e={r:Lt[i[1]]<<4|Lt[i[2]],g:Lt[i[3]]<<4|Lt[i[4]],b:Lt[i[5]]<<4|Lt[i[6]],a:t===9?Lt[i[7]]<<4|Lt[i[8]]:255})),e}const L_=(i,t)=>i<255?t(i):"";function R_(i){var t=O_(i)?A_:D_;return i?"#"+t(i.r)+t(i.g)+t(i.b)+L_(i.a,t):void 0}const E_=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function _u(i,t,e){const n=t*Math.min(e,1-e),s=(o,r=(o+i/30)%12)=>e-n*Math.max(Math.min(r-3,9-r,1),-1);return[s(0),s(8),s(4)]}function I_(i,t,e){const n=(s,o=(s+i/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[n(5),n(3),n(1)]}function F_(i,t,e){const n=_u(i,1,.5);let s;for(t+e>1&&(s=1/(t+e),t*=s,e*=s),s=0;s<3;s++)n[s]*=1-t-e,n[s]+=t;return n}function $_(i,t,e,n,s){return i===s?(t-e)/n+(t.5?h/(2-o-r):h/(o+r),l=$_(e,n,s,h,o),l=l*60+.5),[l|0,c||0,a]}function jr(i,t,e,n){return(Array.isArray(t)?i(t[0],t[1],t[2]):i(t,e,n)).map(Ae)}function Hr(i,t,e){return jr(_u,i,t,e)}function z_(i,t,e){return jr(F_,i,t,e)}function B_(i,t,e){return jr(I_,i,t,e)}function xu(i){return(i%360+360)%360}function N_(i){const t=E_.exec(i);let e=255,n;if(!t)return;t[5]!==n&&(e=t[6]?rn(+t[5]):Ae(+t[5]));const s=xu(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?n=z_(s,o,r):t[1]==="hsv"?n=B_(s,o,r):n=Hr(s,o,r),{r:n[0],g:n[1],b:n[2],a:e}}function V_(i,t){var e=Wr(i);e[0]=xu(e[0]+t),e=Hr(e),i.r=e[0],i.g=e[1],i.b=e[2]}function W_(i){if(!i)return;const t=Wr(i),e=t[0],n=Hl(t[1]),s=Hl(t[2]);return i.a<255?`hsla(${e}, ${n}%, ${s}%, ${ce(i.a)})`:`hsl(${e}, ${n}%, ${s}%)`}const Yl={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Xl={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function j_(){const i={},t=Object.keys(Xl),e=Object.keys(Yl);let n,s,o,r,a;for(n=0;n>16&255,o>>8&255,o&255]}return i}let es;function H_(i){es||(es=j_(),es.transparent=[0,0,0,0]);const t=es[i.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const Y_=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function X_(i){const t=Y_.exec(i);let e=255,n,s,o;if(t){if(t[7]!==n){const r=+t[7];e=t[8]?rn(r):Se(r*255,0,255)}return n=+t[1],s=+t[3],o=+t[5],n=255&(t[2]?rn(n):Se(n,0,255)),s=255&(t[4]?rn(s):Se(s,0,255)),o=255&(t[6]?rn(o):Se(o,0,255)),{r:n,g:s,b:o,a:e}}}function U_(i){return i&&(i.a<255?`rgba(${i.r}, ${i.g}, ${i.b}, ${ce(i.a)})`:`rgb(${i.r}, ${i.g}, ${i.b})`)}const Ao=i=>i<=.0031308?i*12.92:Math.pow(i,1/2.4)*1.055-.055,li=i=>i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4);function q_(i,t,e){const n=li(ce(i.r)),s=li(ce(i.g)),o=li(ce(i.b));return{r:Ae(Ao(n+e*(li(ce(t.r))-n))),g:Ae(Ao(s+e*(li(ce(t.g))-s))),b:Ae(Ao(o+e*(li(ce(t.b))-o))),a:i.a+e*(t.a-i.a)}}function is(i,t,e){if(i){let n=Wr(i);n[t]=Math.max(0,Math.min(n[t]+n[t]*e,t===0?360:1)),n=Hr(n),i.r=n[0],i.g=n[1],i.b=n[2]}}function yu(i,t){return i&&Object.assign(t||{},i)}function Ul(i){var t={r:0,g:0,b:0,a:255};return Array.isArray(i)?i.length>=3&&(t={r:i[0],g:i[1],b:i[2],a:255},i.length>3&&(t.a=Ae(i[3]))):(t=yu(i,{r:0,g:0,b:0,a:1}),t.a=Ae(t.a)),t}function K_(i){return i.charAt(0)==="r"?X_(i):N_(i)}class Ns{constructor(t){if(t instanceof Ns)return t;const e=typeof t;let n;e==="object"?n=Ul(t):e==="string"&&(n=T_(t)||H_(t)||K_(t)),this._rgb=n,this._valid=!!n}get valid(){return this._valid}get rgb(){var t=yu(this._rgb);return t&&(t.a=ce(t.a)),t}set rgb(t){this._rgb=Ul(t)}rgbString(){return this._valid?U_(this._rgb):void 0}hexString(){return this._valid?R_(this._rgb):void 0}hslString(){return this._valid?W_(this._rgb):void 0}mix(t,e){if(t){const n=this.rgb,s=t.rgb;let o;const r=e===o?.5:e,a=2*r-1,l=n.a-s.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-c,n.r=255&c*n.r+o*s.r+.5,n.g=255&c*n.g+o*s.g+.5,n.b=255&c*n.b+o*s.b+.5,n.a=r*n.a+(1-r)*s.a,this.rgb=n}return this}interpolate(t,e){return t&&(this._rgb=q_(this._rgb,t._rgb,e)),this}clone(){return new Ns(this.rgb)}alpha(t){return this._rgb.a=Ae(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=In(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){const e=this._rgb;return e.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return is(this._rgb,2,t),this}darken(t){return is(this._rgb,2,-t),this}saturate(t){return is(this._rgb,1,t),this}desaturate(t){return is(this._rgb,1,-t),this}rotate(t){return V_(this._rgb,t),this}}function vu(i){return new Ns(i)}function wu(i){if(i&&typeof i=="object"){const t=i.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function ql(i){return wu(i)?i:vu(i)}function Do(i){return wu(i)?i:vu(i).saturate(.5).darken(.1).hexString()}const si=Object.create(null),or=Object.create(null);function _n(i,t){if(!t)return i;const e=t.split(".");for(let n=0,s=e.length;ne.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(e,n)=>Do(n.backgroundColor),this.hoverBorderColor=(e,n)=>Do(n.borderColor),this.hoverColor=(e,n)=>Do(n.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t)}set(t,e){return Oo(this,t,e)}get(t){return _n(this,t)}describe(t,e){return Oo(or,t,e)}override(t,e){return Oo(si,t,e)}route(t,e,n,s){const o=_n(this,t),r=_n(this,n),a="_"+e;Object.defineProperties(o,{[a]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const l=this[a],c=r[s];return H(l)?Object.assign({},c,l):W(l,c)},set(l){this[a]=l}}})}}var V=new G_({_scriptable:i=>!i.startsWith("on"),_indexable:i=>i!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}});function Z_(i){return!i||q(i.size)||q(i.family)?null:(i.style?i.style+" ":"")+(i.weight?i.weight+" ":"")+i.size+"px "+i.family}function Vs(i,t,e,n,s){let o=t[s];return o||(o=t[s]=i.measureText(s).width,e.push(s)),o>n&&(n=o),n}function J_(i,t,e,n){n=n||{};let s=n.data=n.data||{},o=n.garbageCollect=n.garbageCollect||[];n.font!==t&&(s=n.data={},o=n.garbageCollect=[],n.font=t),i.save(),i.font=t;let r=0;const a=e.length;let l,c,h,u,d;for(l=0;le.length){for(l=0;l0&&i.stroke()}}function Cn(i,t,e){return e=e||.5,!t||i&&i.x>t.left-e&&i.xt.top-e&&i.y0&&o.strokeColor!=="";let l,c;for(i.save(),i.font=s.string,i0(i,o),l=0;l+i||0;function Yr(i,t){const e={},n=H(t),s=n?Object.keys(t):t,o=H(i)?n?r=>W(i[r],i[t[r]]):r=>i[r]:()=>i;for(const r of s)e[r]=a0(o(r));return e}function Su(i){return Yr(i,{top:"y",right:"x",bottom:"y",left:"x"})}function _i(i){return Yr(i,["topLeft","topRight","bottomLeft","bottomRight"])}function Bt(i){const t=Su(i);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function Ot(i,t){i=i||{},t=t||V.font;let e=W(i.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let n=W(i.style,t.style);n&&!(""+n).match(o0)&&(console.warn('Invalid font style specified: "'+n+'"'),n="");const s={family:W(i.family,t.family),lineHeight:r0(W(i.lineHeight,t.lineHeight),e),size:e,style:n,weight:W(i.weight,t.weight),string:""};return s.string=Z_(s),s}function ns(i,t,e,n){let s=!0,o,r,a;for(o=0,r=i.length;oe&&a===0?0:a+l;return{min:r(n,-Math.abs(o)),max:r(s,o)}}function Fe(i,t){return Object.assign(Object.create(i),t)}function Xr(i,t=[""],e=i,n,s=()=>i[0]){zt(n)||(n=Du("_fallback",i));const o={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:i,_rootScopes:e,_fallback:n,_getTarget:s,override:r=>Xr([r,...i],t,e,n)};return new Proxy(o,{deleteProperty(r,a){return delete r[a],delete r._keys,delete i[0][a],!0},get(r,a){return Cu(r,a,()=>m0(a,t,i,r))},getOwnPropertyDescriptor(r,a){return Reflect.getOwnPropertyDescriptor(r._scopes[0],a)},getPrototypeOf(){return Reflect.getPrototypeOf(i[0])},has(r,a){return Zl(r).includes(a)},ownKeys(r){return Zl(r)},set(r,a,l){const c=r._storage||(r._storage=s());return r[a]=c[a]=l,delete r._keys,!0}})}function Mi(i,t,e,n){const s={_cacheable:!1,_proxy:i,_context:t,_subProxy:e,_stack:new Set,_descriptors:Pu(i,n),setContext:o=>Mi(i,o,e,n),override:o=>Mi(i.override(o),t,e,n)};return new Proxy(s,{deleteProperty(o,r){return delete o[r],delete i[r],!0},get(o,r,a){return Cu(o,r,()=>h0(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(i,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(i,r)},getPrototypeOf(){return Reflect.getPrototypeOf(i)},has(o,r){return Reflect.has(i,r)},ownKeys(){return Reflect.ownKeys(i)},set(o,r,a){return i[r]=a,delete o[r],!0}})}function Pu(i,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:n=t.indexable,_allKeys:s=t.allKeys}=i;return{allKeys:s,scriptable:e,indexable:n,isScriptable:Re(e)?e:()=>e,isIndexable:Re(n)?n:()=>n}}const c0=(i,t)=>i?i+Br(t):t,Ur=(i,t)=>H(t)&&i!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function Cu(i,t,e){if(Object.prototype.hasOwnProperty.call(i,t))return i[t];const n=e();return i[t]=n,n}function h0(i,t,e){const{_proxy:n,_context:s,_subProxy:o,_descriptors:r}=i;let a=n[t];return Re(a)&&r.isScriptable(t)&&(a=u0(t,a,i,e)),nt(a)&&a.length&&(a=d0(t,a,i,r.isIndexable)),Ur(t,a)&&(a=Mi(a,s,o&&o[t],r)),a}function u0(i,t,e,n){const{_proxy:s,_context:o,_subProxy:r,_stack:a}=e;if(a.has(i))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+i);return a.add(i),t=t(o,r||n),a.delete(i),Ur(i,t)&&(t=qr(s._scopes,s,i,t)),t}function d0(i,t,e,n){const{_proxy:s,_context:o,_subProxy:r,_descriptors:a}=e;if(zt(o.index)&&n(i))t=t[o.index%t.length];else if(H(t[0])){const l=t,c=s._scopes.filter(h=>h!==l);t=[];for(const h of l){const u=qr(c,s,i,h);t.push(Mi(u,o,r&&r[i],a))}}return t}function Au(i,t,e){return Re(i)?i(t,e):i}const f0=(i,t)=>i===!0?t:typeof i=="string"?Le(t,i):void 0;function g0(i,t,e,n,s){for(const o of t){const r=f0(e,o);if(r){i.add(r);const a=Au(r._fallback,e,s);if(zt(a)&&a!==e&&a!==n)return a}else if(r===!1&&zt(n)&&e!==n)return null}return!1}function qr(i,t,e,n){const s=t._rootScopes,o=Au(t._fallback,e,n),r=[...i,...s],a=new Set;a.add(n);let l=Gl(a,r,e,o||e,n);return l===null||zt(o)&&o!==e&&(l=Gl(a,r,o,l,n),l===null)?!1:Xr(Array.from(a),[""],s,o,()=>p0(t,e,n))}function Gl(i,t,e,n,s){for(;e;)e=g0(i,t,e,n,s);return e}function p0(i,t,e){const n=i._getTarget();t in n||(n[t]={});const s=n[t];return nt(s)&&H(e)?e:s}function m0(i,t,e,n){let s;for(const o of t)if(s=Du(c0(o,i),e),zt(s))return Ur(i,s)?qr(e,n,i,s):s}function Du(i,t){for(const e of t){if(!e)continue;const n=e[i];if(zt(n))return n}}function Zl(i){let t=i._keys;return t||(t=i._keys=b0(i._scopes)),t}function b0(i){const t=new Set;for(const e of i)for(const n of Object.keys(e).filter(s=>!s.startsWith("_")))t.add(n);return Array.from(t)}function Ou(i,t,e,n){const{iScale:s}=i,{key:o="r"}=this._parsing,r=new Array(n);let a,l,c,h;for(a=0,l=n;ati==="x"?"y":"x";function x0(i,t,e,n){const s=i.skip?t:i,o=t,r=e.skip?t:e,a=nr(o,s),l=nr(r,o);let c=a/(a+l),h=l/(a+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const u=n*c,d=n*h;return{previous:{x:o.x-u*(r.x-s.x),y:o.y-u*(r.y-s.y)},next:{x:o.x+d*(r.x-s.x),y:o.y+d*(r.y-s.y)}}}function y0(i,t,e){const n=i.length;let s,o,r,a,l,c=Si(i,0);for(let h=0;h!c.skip)),t.cubicInterpolationMode==="monotone")w0(i,s);else{let c=n?i[i.length-1]:i[0];for(o=0,r=i.length;owindow.getComputedStyle(i,null);function S0(i,t){return so(i).getPropertyValue(t)}const P0=["top","right","bottom","left"];function ei(i,t,e){const n={};e=e?"-"+e:"";for(let s=0;s<4;s++){const o=P0[s];n[o]=parseFloat(i[t+"-"+o+e])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}const C0=(i,t,e)=>(i>0||t>0)&&(!e||!e.shadowRoot);function A0(i,t){const e=i.touches,n=e&&e.length?e[0]:i,{offsetX:s,offsetY:o}=n;let r=!1,a,l;if(C0(s,o,i.target))a=s,l=o;else{const c=t.getBoundingClientRect();a=n.clientX-c.left,l=n.clientY-c.top,r=!0}return{x:a,y:l,box:r}}function Xe(i,t){if("native"in i)return i;const{canvas:e,currentDevicePixelRatio:n}=t,s=so(e),o=s.boxSizing==="border-box",r=ei(s,"padding"),a=ei(s,"border","width"),{x:l,y:c,box:h}=A0(i,e),u=r.left+(h&&a.left),d=r.top+(h&&a.top);let{width:f,height:g}=t;return o&&(f-=r.width+a.width,g-=r.height+a.height),{x:Math.round((l-u)/f*e.width/n),y:Math.round((c-d)/g*e.height/n)}}function D0(i,t,e){let n,s;if(t===void 0||e===void 0){const o=Kr(i);if(!o)t=i.clientWidth,e=i.clientHeight;else{const r=o.getBoundingClientRect(),a=so(o),l=ei(a,"border","width"),c=ei(a,"padding");t=r.width-c.width-l.width,e=r.height-c.height-l.height,n=Hs(a.maxWidth,o,"clientWidth"),s=Hs(a.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:n||zs,maxHeight:s||zs}}const To=i=>Math.round(i*10)/10;function O0(i,t,e,n){const s=so(i),o=ei(s,"margin"),r=Hs(s.maxWidth,i,"clientWidth")||zs,a=Hs(s.maxHeight,i,"clientHeight")||zs,l=D0(i,t,e);let{width:c,height:h}=l;if(s.boxSizing==="content-box"){const u=ei(s,"border","width"),d=ei(s,"padding");c-=d.width+u.width,h-=d.height+u.height}return c=Math.max(0,c-o.width),h=Math.max(0,n?Math.floor(c/n):h-o.height),c=To(Math.min(c,r,l.maxWidth)),h=To(Math.min(h,a,l.maxHeight)),c&&!h&&(h=To(c/2)),{width:c,height:h}}function Jl(i,t,e){const n=t||1,s=Math.floor(i.height*n),o=Math.floor(i.width*n);i.height=s/n,i.width=o/n;const r=i.canvas;return r.style&&(e||!r.style.height&&!r.style.width)&&(r.style.height=`${i.height}px`,r.style.width=`${i.width}px`),i.currentDevicePixelRatio!==n||r.height!==s||r.width!==o?(i.currentDevicePixelRatio=n,r.height=s,r.width=o,i.ctx.setTransform(n,0,0,n,0,0),!0):!1}const T0=function(){let i=!1;try{const t={get passive(){return i=!0,!1}};window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch{}return i}();function Ql(i,t){const e=S0(i,t),n=e&&e.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function Ue(i,t,e,n){return{x:i.x+e*(t.x-i.x),y:i.y+e*(t.y-i.y)}}function L0(i,t,e,n){return{x:i.x+e*(t.x-i.x),y:n==="middle"?e<.5?i.y:t.y:n==="after"?e<1?i.y:t.y:e>0?t.y:i.y}}function R0(i,t,e,n){const s={x:i.cp2x,y:i.cp2y},o={x:t.cp1x,y:t.cp1y},r=Ue(i,s,e),a=Ue(s,o,e),l=Ue(o,t,e),c=Ue(r,a,e),h=Ue(a,l,e);return Ue(c,h,e)}const tc=new Map;function E0(i,t){t=t||{};const e=i+JSON.stringify(t);let n=tc.get(e);return n||(n=new Intl.NumberFormat(i,t),tc.set(e,n)),n}function Fn(i,t,e){return E0(t,e).format(i)}const I0=function(i,t){return{x(e){return i+i+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,n){return e-n},leftForLtr(e,n){return e-n}}},F0=function(){return{x(i){return i},setWidth(i){},textAlign(i){return i},xPlus(i,t){return i+t},leftForLtr(i,t){return i}}};function Lo(i,t,e){return i?I0(t,e):F0()}function $0(i,t){let e,n;(t==="ltr"||t==="rtl")&&(e=i.canvas.style,n=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),i.prevTextDirection=n)}function z0(i,t){t!==void 0&&(delete i.prevTextDirection,i.canvas.style.setProperty("direction",t[0],t[1]))}function Ru(i){return i==="angle"?{between:Pn,compare:v_,normalize:Vt}:{between:Bs,compare:(t,e)=>t-e,normalize:t=>t}}function ec({start:i,end:t,count:e,loop:n,style:s}){return{start:i%e,end:t%e,loop:n&&(t-i+1)%e===0,style:s}}function B0(i,t,e){const{property:n,start:s,end:o}=e,{between:r,normalize:a}=Ru(n),l=t.length;let{start:c,end:h,loop:u}=i,d,f;if(u){for(c+=l,h+=l,d=0,f=l;dl(s,w,b)&&a(s,w)!==0,y=()=>a(o,b)===0||l(o,w,b),k=()=>p||_(),v=()=>!p||y();for(let M=h,S=h;M<=u;++M)x=t[M%r],!x.skip&&(b=c(x[n]),b!==w&&(p=l(b,s,o),m===null&&k()&&(m=a(b,s)===0?M:S),m!==null&&v()&&(g.push(ec({start:m,end:M,loop:d,count:r,style:f})),m=null),S=M,w=b));return m!==null&&g.push(ec({start:m,end:u,loop:d,count:r,style:f})),g}function V0(i,t){const e=[],n=i.segments;for(let s=0;ss&&i[o%t].skip;)o--;return o%=t,{start:s,end:o}}function j0(i,t,e,n){const s=i.length,o=[];let r=t,a=i[t],l;for(l=t+1;l<=e;++l){const c=i[l%s];c.skip||c.stop?a.skip||(n=!1,o.push({start:t%s,end:(l-1)%s,loop:n}),t=r=c.stop?l:null):(r=l,a.skip&&(t=l)),a=c}return r!==null&&o.push({start:t%s,end:r%s,loop:n}),o}function H0(i,t){const e=i.points,n=i.options.spanGaps,s=e.length;if(!s)return[];const o=!!i._loop,{start:r,end:a}=W0(e,s,o,n);if(n===!0)return ic(i,[{start:r,end:a,loop:o}],e,t);const l=aa({chart:t,initial:e.initial,numSteps:r,currentStep:Math.min(n-e.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=gu.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((n,s)=>{if(!n.running||!n.items.length)return;const o=n.items;let r=o.length-1,a=!1,l;for(;r>=0;--r)l=o[r],l._active?(l._total>n.duration&&(n.duration=l._total),l.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(s.draw(),this._notify(s,n,t,"progress")),o.length||(n.running=!1,this._notify(s,n,t,"complete"),n.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let n=e.get(t);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,n)),n}listen(t,e,n){this._getAnims(t).listeners[e].push(n)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((n,s)=>Math.max(n,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const n=e.items;let s=n.length-1;for(;s>=0;--s)n[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var re=new U0;const sc="transparent",q0={boolean(i,t,e){return e>.5?t:i},color(i,t,e){const n=ql(i||sc),s=n.valid&&ql(t||sc);return s&&s.valid?s.mix(n,e).hexString():t},number(i,t,e){return i+(t-i)*e}};class K0{constructor(t,e,n,s){const o=e[n];s=ns([t.to,s,o,t.from]);const r=ns([t.from,o,s]);this._active=!0,this._fn=t.fn||q0[t.type||typeof r],this._easing=bn[t.easing]||bn.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=n,this._from=r,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,n){if(this._active){this._notify(!1);const s=this._target[this._prop],o=n-this._start,r=this._duration-o;this._start=n,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=ns([t.to,e,s,t.from]),this._from=ns([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,n=this._duration,s=this._prop,o=this._from,r=this._loop,a=this._to;let l;if(this._active=o!==a&&(r||e1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,n)=>{t.push({res:e,rej:n})})}_notify(t){const e=t?"res":"rej",n=this._promises||[];for(let s=0;si!=="onProgress"&&i!=="onComplete"&&i!=="fn"});V.set("animations",{colors:{type:"color",properties:Z0},numbers:{type:"number",properties:G0}});V.describe("animations",{_fallback:"animation"});V.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:i=>i|0}}}});class Eu{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!H(t))return;const e=this._properties;Object.getOwnPropertyNames(t).forEach(n=>{const s=t[n];if(!H(s))return;const o={};for(const r of J0)o[r]=s[r];(nt(s.properties)&&s.properties||[n]).forEach(r=>{(r===n||!e.has(r))&&e.set(r,o)})})}_animateOptions(t,e){const n=e.options,s=tx(t,n);if(!s)return[];const o=this._createAnimations(s,n);return n.$shared&&Q0(t.options.$animations,n).then(()=>{t.options=n},()=>{}),o}_createAnimations(t,e){const n=this._properties,s=[],o=t.$animations||(t.$animations={}),r=Object.keys(e),a=Date.now();let l;for(l=r.length-1;l>=0;--l){const c=r[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,e));continue}const h=e[c];let u=o[c];const d=n.get(c);if(u)if(d&&u.active()){u.update(d,h,a);continue}else u.cancel();if(!d||!d.duration){t[c]=h;continue}o[c]=u=new K0(d,t,c,h),s.push(u)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const n=this._createAnimations(t,e);if(n.length)return re.add(this._chart,n),!0}}function Q0(i,t){const e=[],n=Object.keys(t);for(let s=0;s0||!e&&o<0)return s.index}return null}function cc(i,t){const{chart:e,_cachedMeta:n}=i,s=e._stacks||(e._stacks={}),{iScale:o,vScale:r,index:a}=n,l=o.axis,c=r.axis,h=sx(o,r,n),u=t.length;let d;for(let f=0;fe[n].axis===t).shift()}function ax(i,t){return Fe(i,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function lx(i,t,e){return Fe(i,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function Ii(i,t){const e=i.controller.index,n=i.vScale&&i.vScale.axis;if(n){t=t||i._parsed;for(const s of t){const o=s._stacks;if(!o||o[n]===void 0||o[n][e]===void 0)return;delete o[n][e]}}}const Eo=i=>i==="reset"||i==="none",hc=(i,t)=>t?i:Object.assign({},i),cx=(i,t,e)=>i&&!t.hidden&&t._stacked&&{keys:Iu(e,!0),values:null};class Ht{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=ac(t.vScale,t),this.addElements()}updateIndex(t){this.index!==t&&Ii(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,n=this.getDataset(),s=(u,d,f,g)=>u==="x"?d:u==="r"?g:f,o=e.xAxisID=W(n.xAxisID,Ro(t,"x")),r=e.yAxisID=W(n.yAxisID,Ro(t,"y")),a=e.rAxisID=W(n.rAxisID,Ro(t,"r")),l=e.indexAxis,c=e.iAxisID=s(l,o,r,a),h=e.vAxisID=s(l,r,o,a);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(r),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Nl(this._data,this),t._stacked&&Ii(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),n=this._data;if(H(e))this._data=nx(e);else if(n!==e){if(n){Nl(n,this);const s=this._cachedMeta;Ii(s),s._parsed=[]}e&&Object.isExtensible(e)&&S_(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,n=this.getDataset();let s=!1;this._dataCheck();const o=e._stacked;e._stacked=ac(e.vScale,e),e.stack!==n.stack&&(s=!0,Ii(e),e.stack=n.stack),this._resyncElements(t),(s||o!==e._stacked)&&cc(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),n=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:n,_data:s}=this,{iScale:o,_stacked:r}=n,a=o.axis;let l=t===0&&e===s.length?!0:n._sorted,c=t>0&&n._parsed[t-1],h,u,d;if(this._parsing===!1)n._parsed=s,n._sorted=!0,d=s;else{nt(s[t])?d=this.parseArrayData(n,s,t,e):H(s[t])?d=this.parseObjectData(n,s,t,e):d=this.parsePrimitiveData(n,s,t,e);const f=()=>u[a]===null||c&&u[a]p||u=0;--d)if(!g()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,n=[];let s,o,r;for(s=0,o=e.length;s=0&&tthis.getContext(n,s),p=c.resolveNamedOptions(d,f,g,u);return p.$shared&&(p.$shared=l,o[r]=Object.freeze(hc(p,l))),p}_resolveAnimations(t,e,n){const s=this.chart,o=this._cachedDataOpts,r=`animation-${e}`,a=o[r];if(a)return a;let l;if(s.options.animation!==!1){const h=this.chart.config,u=h.datasetAnimationScopeKeys(this._type,e),d=h.getOptionScopes(this.getDataset(),u);l=h.createResolver(d,this.getContext(t,n,e))}const c=new Eu(s,l&&l.animations);return l&&l._cacheable&&(o[r]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Eo(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const n=this.resolveDataElementOptions(t,e),s=this._sharedOptions,o=this.getSharedOptions(n),r=this.includeOptions(e,o)||o!==s;return this.updateSharedOptions(o,e,n),{sharedOptions:o,includeOptions:r}}updateElement(t,e,n,s){Eo(s)?Object.assign(t,n):this._resolveAnimations(e,s).update(t,n)}updateSharedOptions(t,e,n){t&&!Eo(e)&&this._resolveAnimations(void 0,e).update(t,n)}_setStyle(t,e,n,s){t.active=s;const o=this.getStyle(e,s);this._resolveAnimations(e,n,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,n){this._setStyle(t,n,"active",!1)}setHoverStyle(t,e,n){this._setStyle(t,n,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,n=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const s=n.length,o=e.length,r=Math.min(o,s);r&&this.parse(0,r),o>s?this._insertElements(s,o-s,t):o{for(c.length+=e,a=c.length-1;a>=r;a--)c[a]=c[a-e]};for(l(o),a=t;as-o))}return i._cache.$bar}function ux(i){const t=i.iScale,e=hx(t,i.type);let n=t._length,s,o,r,a;const l=()=>{r===32767||r===-32768||(zt(a)&&(n=Math.min(n,Math.abs(r-a)||n)),a=r)};for(s=0,o=e.length;s0?s[i-1]:null,a=iMath.abs(a)&&(l=a,c=r),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:s,end:o,min:r,max:a}}function Fu(i,t,e,n){return nt(i)?gx(i,t,e,n):t[e.axis]=e.parse(i,n),t}function uc(i,t,e,n){const s=i.iScale,o=i.vScale,r=s.getLabels(),a=s===o,l=[];let c,h,u,d;for(c=e,h=e+n;c=e?1:-1)}function mx(i){let t,e,n,s,o;return i.horizontal?(t=i.base>i.x,e="left",n="right"):(t=i.basel.controller.options.grouped),o=n.options.stacked,r=[],a=l=>{const c=l.controller.getParsed(e),h=c&&c[l.vScale.axis];if(q(h)||isNaN(h))return!0};for(const l of s)if(!(e!==void 0&&a(l))&&((o===!1||r.indexOf(l.stack)===-1||o===void 0&&l.stack===void 0)&&r.push(l.stack),l.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,n){const s=this._getStacks(t,n),o=e!==void 0?s.indexOf(e):-1;return o===-1?s.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,n=e.iScale,s=[];let o,r;for(o=0,r=e.data.length;o=0;--n)e=Math.max(e,t[n].size(this.resolveDataElementOptions(n))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,{xScale:n,yScale:s}=e,o=this.getParsed(t),r=n.getLabelForValue(o.x),a=s.getLabelForValue(o.y),l=o._custom;return{label:e.label,value:"("+r+", "+a+(l?", "+l:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,n,s){const o=s==="reset",{iScale:r,vScale:a}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(e,s),h=r.axis,u=a.axis;for(let d=e;dPn(w,a,l,!0)?1:Math.max(_,_*e,y,y*e),g=(w,_,y)=>Pn(w,a,l,!0)?-1:Math.min(_,_*e,y,y*e),p=f(0,c,u),m=f(lt,h,d),b=g(ct,c,u),x=g(ct+lt,h,d);n=(p-b)/2,s=(m-x)/2,o=-(p+b)/2,r=-(m+x)/2}return{ratioX:n,ratioY:s,offsetX:o,offsetY:r}}class $n extends Ht{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const n=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=n;else{let o=l=>+n[l];if(H(n[t])){const{key:l="value"}=this._parsing;o=c=>+Le(n[c],l)}let r,a;for(r=t,a=t+e;r0&&!isNaN(t)?K*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,n=this.chart,s=n.data.labels||[],o=Fn(e._parsed[t],n.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let e=0;const n=this.chart;let s,o,r,a,l;if(!t){for(s=0,o=n.data.datasets.length;si!=="spacing",_indexable:i=>i!=="spacing"};$n.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(i){const t=i.data;if(t.labels.length&&t.datasets.length){const{labels:{pointStyle:e}}=i.legend.options;return t.labels.map((n,s)=>{const r=i.getDatasetMeta(0).controller.getStyle(s);return{text:n,fillStyle:r.backgroundColor,strokeStyle:r.borderColor,lineWidth:r.borderWidth,pointStyle:e,hidden:!i.getDataVisibility(s),index:s}})}return[]}},onClick(i,t,e){e.chart.toggleDataVisibility(t.index),e.chart.update()}},tooltip:{callbacks:{title(){return""},label(i){let t=i.label;const e=": "+i.formattedValue;return nt(t)?(t=t.slice(),t[0]+=e):t+=e,t}}}}};class Jr extends Ht{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:n,data:s=[],_dataset:o}=e,r=this.chart._animationsDisabled;let{start:a,count:l}=mu(e,s,r);this._drawStart=a,this._drawCount=l,bu(e)&&(a=0,l=s.length),n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!o._decimated,n.points=s;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(n,void 0,{animated:!r,options:c},t),this.updateElements(s,a,l,t)}updateElements(t,e,n,s){const o=s==="reset",{iScale:r,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:h,includeOptions:u}=this._getSharedOptions(e,s),d=r.axis,f=a.axis,{spanGaps:g,segment:p}=this.options,m=ki(g)?g:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||o||s==="none";let x=e>0&&this.getParsed(e-1);for(let w=e;w0&&Math.abs(y[d]-x[d])>m,p&&(k.parsed=y,k.raw=c.data[w]),u&&(k.options=h||this.resolveDataElementOptions(w,_.active?"active":s)),b||this.updateElement(_,w,k,s),x=y}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,n=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return n;const o=s[0].size(this.resolveDataElementOptions(0)),r=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(n,o,r)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}Jr.id="line";Jr.defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};Jr.overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};class Qr extends Ht{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,n=this.chart,s=n.data.labels||[],o=Fn(e._parsed[t].r,n.options.locale);return{label:s[t]||"",value:o}}parseObjectData(t,e,n,s){return Ou.bind(this)(t,e,n,s)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((n,s)=>{const o=this.getParsed(s).r;!isNaN(o)&&this.chart.getDataVisibility(s)&&(oe.max&&(e.max=o))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,n=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(s/2,0),r=Math.max(n.cutoutPercentage?o/100*n.cutoutPercentage:1,0),a=(o-r)/t.getVisibleDatasetCount();this.outerRadius=o-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(t,e,n,s){const o=s==="reset",r=this.chart,l=r.options.animation,c=this._cachedMeta.rScale,h=c.xCenter,u=c.yCenter,d=c.getIndexAngle(0)-.5*ct;let f=d,g;const p=360/this.countVisibleElements();for(g=0;g{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,n){return this.chart.getDataVisibility(t)?jt(this.resolveDataElementOptions(t,e).angle||n):0}}Qr.id="polarArea";Qr.defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};Qr.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(i){const t=i.data;if(t.labels.length&&t.datasets.length){const{labels:{pointStyle:e}}=i.legend.options;return t.labels.map((n,s)=>{const r=i.getDatasetMeta(0).controller.getStyle(s);return{text:n,fillStyle:r.backgroundColor,strokeStyle:r.borderColor,lineWidth:r.borderWidth,pointStyle:e,hidden:!i.getDataVisibility(s),index:s}})}return[]}},onClick(i,t,e){e.chart.toggleDataVisibility(t.index),e.chart.update()}},tooltip:{callbacks:{title(){return""},label(i){return i.chart.data.labels[i.dataIndex]+": "+i.formattedValue}}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};class $u extends $n{}$u.id="pie";$u.defaults={cutout:0,rotation:0,circumference:360,radius:"100%"};class ta extends Ht{getLabelAndValue(t){const e=this._cachedMeta.vScale,n=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(n[e.axis])}}parseObjectData(t,e,n,s){return Ou.bind(this)(t,e,n,s)}update(t){const e=this._cachedMeta,n=e.dataset,s=e.data||[],o=e.iScale.getLabels();if(n.points=s,t!=="resize"){const r=this.resolveDatasetElementOptions(t);this.options.showLine||(r.borderWidth=0);const a={_loop:!0,_fullLoop:o.length===s.length,options:r};this.updateElement(n,void 0,a,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,n,s){const o=this._cachedMeta.rScale,r=s==="reset";for(let a=e;a{s[o]=n[o]&&n[o].active()?n[o]._to:this[o]}),s}}be.defaults={};be.defaultRoutes=void 0;const zu={values(i){return nt(i)?i:""+i},numeric(i,t,e){if(i===0)return"0";const n=this.chart.options.locale;let s,o=i;if(e.length>1){const c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),o=vx(i,e)}const r=It(Math.abs(o)),a=Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),Fn(i,n,l)},logarithmic(i,t,e){if(i===0)return"0";const n=i/Math.pow(10,Math.floor(It(i)));return n===1||n===2||n===5?zu.numeric.call(this,i,t,e):""}};function vx(i,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&i!==Math.floor(i)&&(e=i-Math.floor(i)),e}var oo={formatters:zu};V.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",grace:0,grid:{display:!0,lineWidth:1,drawBorder:!0,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(i,t)=>t.lineWidth,tickColor:(i,t)=>t.color,offset:!1,borderDash:[],borderDashOffset:0,borderWidth:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:oo.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}});V.route("scale.ticks","color","","color");V.route("scale.grid","color","","borderColor");V.route("scale.grid","borderColor","","borderColor");V.route("scale.title","color","","color");V.describe("scale",{_fallback:!1,_scriptable:i=>!i.startsWith("before")&&!i.startsWith("after")&&i!=="callback"&&i!=="parser",_indexable:i=>i!=="borderDash"&&i!=="tickBorderDash"});V.describe("scales",{_fallback:"scale"});V.describe("scale.ticks",{_scriptable:i=>i!=="backdropPadding"&&i!=="callback",_indexable:i=>i!=="backdropPadding"});function wx(i,t){const e=i.options.ticks,n=e.maxTicksLimit||kx(i),s=e.major.enabled?Sx(t):[],o=s.length,r=s[0],a=s[o-1],l=[];if(o>n)return Px(t,l,s,o/n),l;const c=Mx(s,t,n);if(o>0){let h,u;const d=o>1?Math.round((a-r)/(o-1)):null;for(os(t,l,c,q(d)?0:r-d,r),h=0,u=o-1;hs)return l}return Math.max(s,1)}function Sx(i){const t=[];let e,n;for(e=0,n=i.length;ei==="left"?"right":i==="right"?"left":i,gc=(i,t,e)=>t==="top"||t==="left"?i[t]+e:i[t]-e;function pc(i,t){const e=[],n=i.length/t,s=i.length;let o=0;for(;or+a)))return l}function Ox(i,t){U(i,e=>{const n=e.gc,s=n.length/2;let o;if(s>t){for(o=0;on?n:e,n=s&&e>n?e:n,{min:Rt(e,Rt(n,e)),max:Rt(n,Rt(e,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){ot(this.options.beforeUpdate,[this])}update(t,e,n){const{beginAtZero:s,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=n=Object.assign({left:0,right:0,top:0,bottom:0},n),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+n.left+n.right:this.height+n.top+n.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=l0(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a=o||n<=1||!this.isHorizontal()){this.labelRotation=s;return}const h=this._getLabelSizes(),u=h.widest.width,d=h.highest.height,f=xt(this.chart.width-u,0,this.maxWidth);a=t.offset?this.maxWidth/n:f/(n-1),u+6>a&&(a=f/(n-(t.offset?.5:1)),l=this.maxHeight-Fi(t.grid)-e.padding-mc(t.title,this.chart.options.font),c=Math.sqrt(u*u+d*d),r=Nr(Math.min(Math.asin(xt((h.highest.height+6)/a,-1,1)),Math.asin(xt(l/c,-1,1))-Math.asin(xt(d/c,-1,1)))),r=Math.max(s,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){ot(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){ot(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:n,title:s,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){const l=mc(s,e.options.font);if(a?(t.width=this.maxWidth,t.height=Fi(o)+l):(t.height=this.maxHeight,t.width=Fi(o)+l),n.display&&this.ticks.length){const{first:c,last:h,widest:u,highest:d}=this._getLabelSizes(),f=n.padding*2,g=jt(this.labelRotation),p=Math.cos(g),m=Math.sin(g);if(a){const b=n.mirror?0:m*u.width+p*d.height;t.height=Math.min(this.maxHeight,t.height+b+f)}else{const b=n.mirror?0:p*u.width+m*d.height;t.width=Math.min(this.maxWidth,t.width+b+f)}this._calculatePadding(c,h,m,p)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,n,s){const{ticks:{align:o,padding:r},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,u=this.right-this.getPixelForTick(this.ticks.length-1);let d=0,f=0;l?c?(d=s*t.width,f=n*e.height):(d=n*t.height,f=s*e.width):o==="start"?f=e.width:o==="end"?d=t.width:o!=="inner"&&(d=t.width/2,f=e.width/2),this.paddingLeft=Math.max((d-h+r)*this.width/(this.width-h),0),this.paddingRight=Math.max((f-u+r)*this.width/(this.width-u),0)}else{let h=e.height/2,u=t.height/2;o==="start"?(h=0,u=t.height):o==="end"&&(h=e.height,u=0),this.paddingTop=h+r,this.paddingBottom=u+r}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){ot(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,n;for(e=0,n=t.length;e({width:o[v]||0,height:r[v]||0});return{first:k(0),last:k(e-1),widest:k(_),highest:k(y),widths:o,heights:r}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return w_(this._alignToPixels?We(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&ta*s?a/n:l/s:l*s0}_computeGridLineItems(t){const e=this.axis,n=this.chart,s=this.options,{grid:o,position:r}=s,a=o.offset,l=this.isHorizontal(),h=this.ticks.length+(a?1:0),u=Fi(o),d=[],f=o.setContext(this.getContext()),g=f.drawBorder?f.borderWidth:0,p=g/2,m=function(P){return We(n,P,g)};let b,x,w,_,y,k,v,M,S,C,D,T;if(r==="top")b=m(this.bottom),k=this.bottom-u,M=b-p,C=m(t.top)+p,T=t.bottom;else if(r==="bottom")b=m(this.top),C=t.top,T=m(t.bottom)-p,k=b+p,M=this.top+u;else if(r==="left")b=m(this.right),y=this.right-u,v=b-p,S=m(t.left)+p,D=t.right;else if(r==="right")b=m(this.left),S=t.left,D=m(t.right)-p,y=b+p,v=this.left+u;else if(e==="x"){if(r==="center")b=m((t.top+t.bottom)/2+.5);else if(H(r)){const P=Object.keys(r)[0],O=r[P];b=m(this.chart.scales[P].getPixelForValue(O))}C=t.top,T=t.bottom,k=b+p,M=k+u}else if(e==="y"){if(r==="center")b=m((t.left+t.right)/2);else if(H(r)){const P=Object.keys(r)[0],O=r[P];b=m(this.chart.scales[P].getPixelForValue(O))}y=b-p,v=y-u,S=t.left,D=t.right}const I=W(s.ticks.maxTicksLimit,h),$=Math.max(1,Math.ceil(h/I));for(x=0;xo.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const e=this.options.grid,n=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,r;const a=(l,c,h)=>{!h.width||!h.color||(n.save(),n.lineWidth=h.width,n.strokeStyle=h.color,n.setLineDash(h.borderDash||[]),n.lineDashOffset=h.borderDashOffset,n.beginPath(),n.moveTo(l.x,l.y),n.lineTo(c.x,c.y),n.stroke(),n.restore())};if(e.display)for(o=0,r=s.length;o{this.draw(s)}}]:[{z:n,draw:s=>{this.drawBackground(),this.drawGrid(s),this.drawTitle()}},{z:n+1,draw:()=>{this.drawBorder()}},{z:e,draw:s=>{this.drawLabels(s)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+"AxisID",s=[];let o,r;for(o=0,r=e.length;o{const n=e.split("."),s=n.pop(),o=[i].concat(n).join("."),r=t[e].split("."),a=r.pop(),l=r.join(".");V.route(o,s,l,a)})}function $x(i){return"id"in i&&"defaults"in i}class zx{constructor(){this.controllers=new rs(Ht,"datasets",!0),this.elements=new rs(be,"elements"),this.plugins=new rs(Object,"plugins"),this.scales=new rs(oi,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,n){[...e].forEach(s=>{const o=n||this._getRegistryForType(s);n||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):U(s,r=>{const a=n||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,e,n){const s=Br(t);ot(n["before"+s],[],n),e[t](n),ot(n["after"+s],[],n)}_getRegistryForType(t){for(let e=0;e0&&this.getParsed(e-1);for(let _=e;_0&&Math.abs(k[f]-w[f])>b,m&&(v.parsed=k,v.raw=c.data[_]),d&&(v.options=u||this.resolveDataElementOptions(_,y.active?"active":s)),x||this.updateElement(y,_,v,s),w=k}this.updateSharedOptions(u,s,h)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let a=0;for(let l=e.length-1;l>=0;--l)a=Math.max(a,e[l].size(this.resolveDataElementOptions(l))/2);return a>0&&a}const n=t.dataset,s=n.options&&n.options.borderWidth||0;if(!e.length)return s;const o=e[0].size(this.resolveDataElementOptions(0)),r=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,o,r)/2}}ea.id="scatter";ea.defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};ea.overrides={interaction:{mode:"point"},plugins:{tooltip:{callbacks:{title(){return""},label(i){return"("+i.label+", "+i.formattedValue+")"}}}},scales:{x:{type:"linear"},y:{type:"linear"}}};function je(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class ar{constructor(t){this.options=t||{}}init(t){}formats(){return je()}parse(t,e){return je()}format(t,e){return je()}add(t,e,n){return je()}diff(t,e,n){return je()}startOf(t,e,n){return je()}endOf(t,e){return je()}}ar.override=function(i){Object.assign(ar.prototype,i)};var Bx={_date:ar};function Nx(i,t,e,n){const{controller:s,data:o,_sorted:r}=i,a=s._cachedMeta.iScale;if(a&&t===a.axis&&t!=="r"&&r&&o.length){const l=a._reversePixels?k_:Ze;if(n){if(s._sharedOptions){const c=o[0],h=typeof c.getRange=="function"&&c.getRange(t);if(h){const u=l(o,t,e-h),d=l(o,t,e+h);return{lo:u.lo,hi:d.hi}}}}else return l(o,t,e)}return{lo:0,hi:o.length-1}}function zn(i,t,e,n,s){const o=i.getSortedVisibleDatasetMetas(),r=e[t];for(let a=0,l=o.length;a{l[r](t[e],s)&&(o.push({element:l,datasetIndex:c,index:h}),a=a||l.inRange(t.x,t.y,s))}),n&&!a?[]:o}var Hx={evaluateInteractionItems:zn,modes:{index(i,t,e,n){const s=Xe(t,i),o=e.axis||"x",r=e.includeInvisible||!1,a=e.intersect?Fo(i,s,o,n,r):$o(i,s,o,!1,n,r),l=[];return a.length?(i.getSortedVisibleDatasetMetas().forEach(c=>{const h=a[0].index,u=c.data[h];u&&!u.skip&&l.push({element:u,datasetIndex:c.index,index:h})}),l):[]},dataset(i,t,e,n){const s=Xe(t,i),o=e.axis||"xy",r=e.includeInvisible||!1;let a=e.intersect?Fo(i,s,o,n,r):$o(i,s,o,!1,n,r);if(a.length>0){const l=a[0].datasetIndex,c=i.getDatasetMeta(l).data;a=[];for(let h=0;he.pos===t)}function _c(i,t){return i.filter(e=>Bu.indexOf(e.pos)===-1&&e.box.axis===t)}function zi(i,t){return i.sort((e,n)=>{const s=t?n:e,o=t?e:n;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function Yx(i){const t=[];let e,n,s,o,r,a;for(e=0,n=(i||[]).length;ec.box.fullSize),!0),n=zi($i(t,"left"),!0),s=zi($i(t,"right")),o=zi($i(t,"top"),!0),r=zi($i(t,"bottom")),a=_c(t,"x"),l=_c(t,"y");return{fullSize:e,leftAndTop:n.concat(o),rightAndBottom:s.concat(l).concat(r).concat(a),chartArea:$i(t,"chartArea"),vertical:n.concat(s).concat(l),horizontal:o.concat(r).concat(a)}}function xc(i,t,e,n){return Math.max(i[e],t[e])+Math.max(i[n],t[n])}function Nu(i,t){i.top=Math.max(i.top,t.top),i.left=Math.max(i.left,t.left),i.bottom=Math.max(i.bottom,t.bottom),i.right=Math.max(i.right,t.right)}function Kx(i,t,e,n){const{pos:s,box:o}=e,r=i.maxPadding;if(!H(s)){e.size&&(i[s]-=e.size);const u=n[e.stack]||{size:0,count:1};u.size=Math.max(u.size,e.horizontal?o.height:o.width),e.size=u.size/u.count,i[s]+=e.size}o.getPadding&&Nu(r,o.getPadding());const a=Math.max(0,t.outerWidth-xc(r,i,"left","right")),l=Math.max(0,t.outerHeight-xc(r,i,"top","bottom")),c=a!==i.w,h=l!==i.h;return i.w=a,i.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function Gx(i){const t=i.maxPadding;function e(n){const s=Math.max(t[n]-i[n],0);return i[n]+=s,s}i.y+=e("top"),i.x+=e("left"),e("right"),e("bottom")}function Zx(i,t){const e=t.maxPadding;function n(s){const o={left:0,top:0,right:0,bottom:0};return s.forEach(r=>{o[r]=Math.max(t[r],e[r])}),o}return n(i?["left","right"]:["top","bottom"])}function an(i,t,e,n){const s=[];let o,r,a,l,c,h;for(o=0,r=i.length,c=0;o{typeof p.beforeLayout=="function"&&p.beforeLayout()});const h=l.reduce((p,m)=>m.box.options&&m.box.options.display===!1?p:p+1,0)||1,u=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/h,hBoxMaxHeight:r/2}),d=Object.assign({},s);Nu(d,Bt(n));const f=Object.assign({maxPadding:d,w:o,h:r,x:s.left,y:s.top},s),g=Ux(l.concat(c),u);an(a.fullSize,f,u,g),an(l,f,u,g),an(c,f,u,g)&&an(l,f,u,g),Gx(f),yc(a.leftAndTop,f,u,g),f.x+=f.w,f.y+=f.h,yc(a.rightAndBottom,f,u,g),i.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},U(a.chartArea,p=>{const m=p.box;Object.assign(m,i.chartArea),m.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class Vu{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,n){}removeEventListener(t,e,n){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,n,s){return e=Math.max(0,e||t.width),n=n||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):n)}}isAttached(t){return!0}updateConfig(t){}}class Jx extends Vu{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Ms="$chartjs",Qx={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},vc=i=>i===null||i==="";function ty(i,t){const e=i.style,n=i.getAttribute("height"),s=i.getAttribute("width");if(i[Ms]={initial:{height:n,width:s,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",vc(s)){const o=Ql(i,"width");o!==void 0&&(i.width=o)}if(vc(n))if(i.style.height==="")i.height=i.width/(t||2);else{const o=Ql(i,"height");o!==void 0&&(i.height=o)}return i}const Wu=T0?{passive:!0}:!1;function ey(i,t,e){i.addEventListener(t,e,Wu)}function iy(i,t,e){i.canvas.removeEventListener(t,e,Wu)}function ny(i,t){const e=Qx[i.type]||i.type,{x:n,y:s}=Xe(i,t);return{type:e,chart:t,native:i,x:n!==void 0?n:null,y:s!==void 0?s:null}}function Ys(i,t){for(const e of i)if(e===t||e.contains(t))return!0}function sy(i,t,e){const n=i.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||Ys(a.addedNodes,n),r=r&&!Ys(a.removedNodes,n);r&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function oy(i,t,e){const n=i.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||Ys(a.removedNodes,n),r=r&&!Ys(a.addedNodes,n);r&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}const An=new Map;let wc=0;function ju(){const i=window.devicePixelRatio;i!==wc&&(wc=i,An.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function ry(i,t){An.size||window.addEventListener("resize",ju),An.set(i,t)}function ay(i){An.delete(i),An.size||window.removeEventListener("resize",ju)}function ly(i,t,e){const n=i.canvas,s=n&&Kr(n);if(!s)return;const o=pu((a,l)=>{const c=s.clientWidth;e(a,l),c{const l=a[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||o(c,h)});return r.observe(s),ry(i,o),r}function zo(i,t,e){e&&e.disconnect(),t==="resize"&&ay(i)}function cy(i,t,e){const n=i.canvas,s=pu(o=>{i.ctx!==null&&e(ny(o,i))},i,o=>{const r=o[0];return[r,r.offsetX,r.offsetY]});return ey(n,t,s),s}class hy extends Vu{acquireContext(t,e){const n=t&&t.getContext&&t.getContext("2d");return n&&n.canvas===t?(ty(t,e),n):null}releaseContext(t){const e=t.canvas;if(!e[Ms])return!1;const n=e[Ms].initial;["height","width"].forEach(o=>{const r=n[o];q(r)?e.removeAttribute(o):e.setAttribute(o,r)});const s=n.style||{};return Object.keys(s).forEach(o=>{e.style[o]=s[o]}),e.width=e.width,delete e[Ms],!0}addEventListener(t,e,n){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),r={attach:sy,detach:oy,resize:ly}[e]||cy;s[e]=r(t,e,n)}removeEventListener(t,e){const n=t.$proxies||(t.$proxies={}),s=n[e];if(!s)return;({attach:zo,detach:zo,resize:zo}[e]||iy)(t,e,s),n[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,n,s){return O0(t,e,n,s)}isAttached(t){const e=Kr(t);return!!(e&&e.isConnected)}}function uy(i){return!Lu()||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?Jx:hy}class dy{constructor(){this._init=[]}notify(t,e,n,s){e==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const o=s?this._descriptors(t).filter(s):this._descriptors(t),r=this._notify(o,t,e,n);return e==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall")),r}_notify(t,e,n,s){s=s||{};for(const o of t){const r=o.plugin,a=r[n],l=[e,s,o.options];if(ot(a,l,r)===!1&&s.cancelable)return!1}return!0}invalidate(){q(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const n=t&&t.config,s=W(n.options&&n.options.plugins,{}),o=fy(n);return s===!1&&!e?[]:py(t,o,s,e)}_notifyStateChanges(t){const e=this._oldCache||[],n=this._cache,s=(o,r)=>o.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(s(e,n),t,"stop"),this._notify(s(n,e),t,"start")}}function fy(i){const t={},e=[],n=Object.keys(Kt.plugins.items);for(let o=0;o{const l=n[a];if(!H(l))return console.error(`Invalid scale configuration for scale: ${a}`);if(l._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);const c=cr(a,l),h=_y(c,s),u=e.scales||{};o[c]=o[c]||a,r[a]=pn(Object.create(null),[{axis:c},l,u[c],u[h]])}),i.data.datasets.forEach(a=>{const l=a.type||i.type,c=a.indexAxis||lr(l,t),u=(si[l]||{}).scales||{};Object.keys(u).forEach(d=>{const f=by(d,c),g=a[f+"AxisID"]||o[f]||f;r[g]=r[g]||Object.create(null),pn(r[g],[{axis:f},n[g],u[d]])})}),Object.keys(r).forEach(a=>{const l=r[a];pn(l,[V.scales[l.type],V.scale])}),r}function Hu(i){const t=i.options||(i.options={});t.plugins=W(t.plugins,{}),t.scales=yy(i,t)}function Yu(i){return i=i||{},i.datasets=i.datasets||[],i.labels=i.labels||[],i}function vy(i){return i=i||{},i.data=Yu(i.data),Hu(i),i}const kc=new Map,Xu=new Set;function cs(i,t){let e=kc.get(i);return e||(e=t(),kc.set(i,e),Xu.add(e)),e}const Bi=(i,t,e)=>{const n=Le(t,e);n!==void 0&&i.add(n)};class wy{constructor(t){this._config=vy(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Yu(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),Hu(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return cs(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return cs(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return cs(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,n=this.type;return cs(`${n}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const n=this._scopeCache;let s=n.get(t);return(!s||e)&&(s=new Map,n.set(t,s)),s}getOptionScopes(t,e,n){const{options:s,type:o}=this,r=this._cachedScopes(t,n),a=r.get(e);if(a)return a;const l=new Set;e.forEach(h=>{t&&(l.add(t),h.forEach(u=>Bi(l,t,u))),h.forEach(u=>Bi(l,s,u)),h.forEach(u=>Bi(l,si[o]||{},u)),h.forEach(u=>Bi(l,V,u)),h.forEach(u=>Bi(l,or,u))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Xu.has(e)&&r.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,si[e]||{},V.datasets[e]||{},{type:e},V,or]}resolveNamedOptions(t,e,n,s=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=Mc(this._resolverCache,t,s);let l=r;if(My(r,e)){o.$shared=!1,n=Re(n)?n():n;const c=this.createResolver(t,n,a);l=Mi(r,n,c)}for(const c of e)o[c]=l[c];return o}createResolver(t,e,n=[""],s){const{resolver:o}=Mc(this._resolverCache,t,n);return H(e)?Mi(o,e,void 0,s):o}}function Mc(i,t,e){let n=i.get(t);n||(n=new Map,i.set(t,n));const s=e.join();let o=n.get(s);return o||(o={resolver:Xr(t,e),subPrefixes:e.filter(a=>!a.toLowerCase().includes("hover"))},n.set(s,o)),o}const ky=i=>H(i)&&Object.getOwnPropertyNames(i).reduce((t,e)=>t||Re(i[e]),!1);function My(i,t){const{isScriptable:e,isIndexable:n}=Pu(i);for(const s of t){const o=e(s),r=n(s),a=(r||o)&&i[s];if(o&&(Re(a)||ky(a))||r&&nt(a))return!0}return!1}var Sy="3.9.1";const Py=["top","bottom","left","right","chartArea"];function Sc(i,t){return i==="top"||i==="bottom"||Py.indexOf(i)===-1&&t==="x"}function Pc(i,t){return function(e,n){return e[i]===n[i]?e[t]-n[t]:e[i]-n[i]}}function Cc(i){const t=i.chart,e=t.options.animation;t.notifyPlugins("afterRender"),ot(e&&e.onComplete,[i],t)}function Cy(i){const t=i.chart,e=t.options.animation;ot(e&&e.onProgress,[i],t)}function Uu(i){return Lu()&&typeof i=="string"?i=document.getElementById(i):i&&i.length&&(i=i[0]),i&&i.canvas&&(i=i.canvas),i}const Xs={},qu=i=>{const t=Uu(i);return Object.values(Xs).filter(e=>e.canvas===t).pop()};function Ay(i,t,e){const n=Object.keys(i);for(const s of n){const o=+s;if(o>=t){const r=i[s];delete i[s],(e>0||o>t)&&(i[o+e]=r)}}}function Dy(i,t,e,n){return!e||i.type==="mouseout"?null:n?t:i}class ia{constructor(t,e){const n=this.config=new wy(e),s=Uu(t),o=qu(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const r=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||uy(s)),this.platform.updateConfig(n);const a=this.platform.acquireContext(s,r.aspectRatio),l=a&&a.canvas,c=l&&l.height,h=l&&l.width;if(this.id=h_(),this.ctx=a,this.canvas=l,this.width=h,this.height=c,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new dy,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=P_(u=>this.update(u),r.resizeDelay||0),this._dataChanges=[],Xs[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}re.listen(this,"complete",Cc),re.listen(this,"progress",Cy),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:n,height:s,_aspectRatio:o}=this;return q(t)?e&&o?o:s?n/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Jl(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Kl(this.canvas,this.ctx),this}stop(){return re.stop(this),this}resize(t,e){re.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const n=this.options,s=this.canvas,o=n.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(s,t,e,o),a=n.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,Jl(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),ot(n.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};U(e,(n,s)=>{n.id=s})}buildOrUpdateScales(){const t=this.options,e=t.scales,n=this.scales,s=Object.keys(n).reduce((r,a)=>(r[a]=!1,r),{});let o=[];e&&(o=o.concat(Object.keys(e).map(r=>{const a=e[r],l=cr(r,a),c=l==="r",h=l==="x";return{options:a,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),U(o,r=>{const a=r.options,l=a.id,c=cr(l,a),h=W(a.type,r.dtype);(a.position===void 0||Sc(a.position,c)!==Sc(r.dposition))&&(a.position=r.dposition),s[l]=!0;let u=null;if(l in n&&n[l].type===h)u=n[l];else{const d=Kt.getScale(h);u=new d({id:l,type:h,ctx:this.ctx,chart:this}),n[u.id]=u}u.init(a,t)}),U(s,(r,a)=>{r||delete n[a]}),U(n,r=>{ls.configure(this,r,r.options),ls.addBox(this,r)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,n=t.length;if(t.sort((s,o)=>s.index-o.index),n>e){for(let s=e;se.length&&delete this._stacks,t.forEach((n,s)=>{e.filter(o=>o===n._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let n,s;for(this._removeUnreferencedMetasets(),n=0,s=e.length;n{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const n=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let c=0,h=this.data.datasets.length;c{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Pc("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){U(this.scales,t=>{ls.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),n=new Set(t.events);(!Fl(e,n)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:n,start:s,count:o}of e){const r=n==="_removeElements"?-o:o;Ay(t,s,r)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,n=o=>new Set(t.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),s=n(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;ls.update(this,this.width,this.height,t);const e=this.chartArea,n=e.width<=0||e.height<=0;this._layers=[],U(this.boxes,s=>{n&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,n=this.data.datasets.length;e=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,n=t._clip,s=!n.disabled,o=this.chartArea,r={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(s&&ku(e,{left:n.left===!1?0:o.left-n.left,right:n.right===!1?this.width:o.right+n.right,top:n.top===!1?0:o.top-n.top,bottom:n.bottom===!1?this.height:o.bottom+n.bottom}),t.controller.draw(),s&&Mu(e),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return Cn(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,n,s){const o=Hx.modes[e];return typeof o=="function"?o(this,t,n,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],n=this._metasets;let s=n.filter(o=>o&&o._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},n.push(s)),s}getContext(){return this.$context||(this.$context=Fe(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const n=this.getDatasetMeta(t);return typeof n.hidden=="boolean"?!n.hidden:!e.hidden}setDatasetVisibility(t,e){const n=this.getDatasetMeta(t);n.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,n){const s=n?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,s);zt(e)?(o.data[e].hidden=!n,this.update()):(this.setDatasetVisibility(t,n),r.update(o,{visible:n}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),re.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,o,r),t[o]=r},s=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};U(this.options.events,o=>n(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,n=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let r;const a=()=>{s("attach",a),this.attached=!0,this.resize(),n("resize",o),n("detach",r)};r=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),n("attach",a)},e.isAttached(this.canvas)?a():r()}unbindEvents(){U(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},U(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,n){const s=n?"set":"remove";let o,r,a,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=t.length;a{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[r],index:r}});!Fs(n,e)&&(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,e))}notifyPlugins(t,e,n){return this._plugins.notify(this,t,e,n)}_updateHoverStyles(t,e,n){const s=this.options.hover,o=(l,c)=>l.filter(h=>!c.some(u=>h.datasetIndex===u.datasetIndex&&h.index===u.index)),r=o(e,t),a=n?t:o(t,e);r.length&&this.updateHoverStyle(r,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,e){const n={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",n,s)===!1)return;const o=this._handleEvent(t,e,n.inChartArea);return n.cancelable=!1,this.notifyPlugins("afterEvent",n,s),(o||n.changed)&&this.render(),this}_handleEvent(t,e,n){const{_active:s=[],options:o}=this,r=e,a=this._getActiveElements(t,s,n,r),l=m_(t),c=Dy(t,this._lastEvent,n,l);n&&(this._lastEvent=null,ot(o.onHover,[t,a,this],this),l&&ot(o.onClick,[t,a,this],this));const h=!Fs(a,s);return(h||e)&&(this._active=a,this._updateHoverStyles(a,s,e)),this._lastEvent=c,h}_getActiveElements(t,e,n,s){if(t.type==="mouseout")return[];if(!n)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}}const Ac=()=>U(ia.instances,i=>i._plugins.invalidate()),_e=!0;Object.defineProperties(ia,{defaults:{enumerable:_e,value:V},instances:{enumerable:_e,value:Xs},overrides:{enumerable:_e,value:si},registry:{enumerable:_e,value:Kt},version:{enumerable:_e,value:Sy},getChart:{enumerable:_e,value:qu},register:{enumerable:_e,value:(...i)=>{Kt.add(...i),Ac()}},unregister:{enumerable:_e,value:(...i)=>{Kt.remove(...i),Ac()}}});function Ku(i,t,e){const{startAngle:n,pixelMargin:s,x:o,y:r,outerRadius:a,innerRadius:l}=t;let c=s/a;i.beginPath(),i.arc(o,r,a,n-c,e+c),l>s?(c=s/l,i.arc(o,r,l,e+c,n-c,!0)):i.arc(o,r,s,e+lt,n-lt),i.closePath(),i.clip()}function Oy(i){return Yr(i,["outerStart","outerEnd","innerStart","innerEnd"])}function Ty(i,t,e,n){const s=Oy(i.options.borderRadius),o=(e-t)/2,r=Math.min(o,n*t/2),a=l=>{const c=(e-Math.min(o,l))*n/2;return xt(l,0,Math.min(o,c))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:xt(s.innerStart,0,r),innerEnd:xt(s.innerEnd,0,r)}}function ci(i,t,e,n){return{x:e+i*Math.cos(t),y:n+i*Math.sin(t)}}function hr(i,t,e,n,s,o){const{x:r,y:a,startAngle:l,pixelMargin:c,innerRadius:h}=t,u=Math.max(t.outerRadius+n+e-c,0),d=h>0?h+n+e+c:0;let f=0;const g=s-l;if(n){const P=h>0?h-n:0,O=u>0?u-n:0,L=(P+O)/2,ht=L!==0?g*L/(L+n):g;f=(g-ht)/2}const p=Math.max(.001,g*u-e/ct)/u,m=(g-p)/2,b=l+m+f,x=s-m-f,{outerStart:w,outerEnd:_,innerStart:y,innerEnd:k}=Ty(t,d,u,x-b),v=u-w,M=u-_,S=b+w/v,C=x-_/M,D=d+y,T=d+k,I=b+y/D,$=x-k/T;if(i.beginPath(),o){if(i.arc(r,a,u,S,C),_>0){const L=ci(M,C,r,a);i.arc(L.x,L.y,_,C,x+lt)}const P=ci(T,x,r,a);if(i.lineTo(P.x,P.y),k>0){const L=ci(T,$,r,a);i.arc(L.x,L.y,k,x+lt,$+Math.PI)}if(i.arc(r,a,d,x-k/d,b+y/d,!0),y>0){const L=ci(D,I,r,a);i.arc(L.x,L.y,y,I+Math.PI,b-lt)}const O=ci(v,b,r,a);if(i.lineTo(O.x,O.y),w>0){const L=ci(v,S,r,a);i.arc(L.x,L.y,w,b-lt,S)}}else{i.moveTo(r,a);const P=Math.cos(S)*u+r,O=Math.sin(S)*u+a;i.lineTo(P,O);const L=Math.cos(C)*u+r,ht=Math.sin(C)*u+a;i.lineTo(L,ht)}i.closePath()}function Ly(i,t,e,n,s){const{fullCircles:o,startAngle:r,circumference:a}=t;let l=t.endAngle;if(o){hr(i,t,e,n,r+K,s);for(let c=0;c=K||Pn(o,a,l),p=Bs(r,c+d,h+d);return g&&p}getCenterPoint(t){const{x:e,y:n,startAngle:s,endAngle:o,innerRadius:r,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius","circumference"],t),{offset:l,spacing:c}=this.options,h=(s+o)/2,u=(r+a+c+l)/2;return{x:e+Math.cos(h)*u,y:n+Math.sin(h)*u}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:n}=this,s=(e.offset||0)/2,o=(e.spacing||0)/2,r=e.circular;if(this.pixelMargin=e.borderAlign==="inner"?.33:0,this.fullCircles=n>K?Math.floor(n/K):0,n===0||this.innerRadius<0||this.outerRadius<0)return;t.save();let a=0;if(s){a=s/2;const c=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(c)*a,Math.sin(c)*a),this.circumference>=ct&&(a=s)}t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor;const l=Ly(t,this,a,o,r);Ey(t,this,a,o,l,r),t.restore()}}na.id="arc";na.defaults={borderAlign:"center",borderColor:"#fff",borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0};na.defaultRoutes={backgroundColor:"backgroundColor"};function Gu(i,t,e=t){i.lineCap=W(e.borderCapStyle,t.borderCapStyle),i.setLineDash(W(e.borderDash,t.borderDash)),i.lineDashOffset=W(e.borderDashOffset,t.borderDashOffset),i.lineJoin=W(e.borderJoinStyle,t.borderJoinStyle),i.lineWidth=W(e.borderWidth,t.borderWidth),i.strokeStyle=W(e.borderColor,t.borderColor)}function Iy(i,t,e){i.lineTo(e.x,e.y)}function Fy(i){return i.stepped?t0:i.tension||i.cubicInterpolationMode==="monotone"?e0:Iy}function Zu(i,t,e={}){const n=i.length,{start:s=0,end:o=n-1}=e,{start:r,end:a}=t,l=Math.max(s,r),c=Math.min(o,a),h=sa&&o>a;return{count:n,start:l,loop:t.loop,ilen:c(r+(c?a-_:_))%o,w=()=>{p!==m&&(i.lineTo(h,m),i.lineTo(h,p),i.lineTo(h,b))};for(l&&(f=s[x(0)],i.moveTo(f.x,f.y)),d=0;d<=a;++d){if(f=s[x(d)],f.skip)continue;const _=f.x,y=f.y,k=_|0;k===g?(ym&&(m=y),h=(u*h+_)/++u):(w(),i.lineTo(_,y),g=k,u=0,p=m=y),b=y}w()}function ur(i){const t=i.options,e=t.borderDash&&t.borderDash.length;return!i._decimated&&!i._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?zy:$y}function By(i){return i.stepped?L0:i.tension||i.cubicInterpolationMode==="monotone"?R0:Ue}function Ny(i,t,e,n){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,n)&&s.closePath()),Gu(i,t.options),i.stroke(s)}function Vy(i,t,e,n){const{segments:s,options:o}=t,r=ur(t);for(const a of s)Gu(i,o,a.style),i.beginPath(),r(i,t,a,{start:e,end:e+n-1})&&i.closePath(),i.stroke()}const Wy=typeof Path2D=="function";function jy(i,t,e,n){Wy&&!t.options.segment?Ny(i,t,e,n):Vy(i,t,e,n)}class ro extends be{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const n=this.options;if((n.tension||n.cubicInterpolationMode==="monotone")&&!n.stepped&&!this._pointsUpdated){const s=n.spanGaps?this._loop:this._fullLoop;M0(this._points,n,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=H0(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,n=t.length;return n&&e[t[n-1].end]}interpolate(t,e){const n=this.options,s=t[e],o=this.points,r=V0(this,{property:e,start:s,end:s});if(!r.length)return;const a=[],l=By(n);let c,h;for(c=0,h=r.length;ci!=="borderDash"&&i!=="fill"};function Dc(i,t,e,n){const s=i.options,{[e]:o}=i.getProps([e],n);return Math.abs(t-o)-1?i.split(` +`):i}function Ky(i,t){const{element:e,datasetIndex:n,index:s}=t,o=i.getDatasetMeta(n).controller,{label:r,value:a}=o.getLabelAndValue(s);return{chart:i,label:r,parsed:o.getParsed(s),raw:i.data.datasets[n].data[s],formattedValue:a,dataset:o.getDataset(),dataIndex:s,datasetIndex:n,element:e}}function Oc(i,t){const e=i.chart.ctx,{body:n,footer:s,title:o}=i,{boxWidth:r,boxHeight:a}=t,l=Ot(t.bodyFont),c=Ot(t.titleFont),h=Ot(t.footerFont),u=o.length,d=s.length,f=n.length,g=Bt(t.padding);let p=g.height,m=0,b=n.reduce((_,y)=>_+y.before.length+y.lines.length+y.after.length,0);if(b+=i.beforeBody.length+i.afterBody.length,u&&(p+=u*c.lineHeight+(u-1)*t.titleSpacing+t.titleMarginBottom),b){const _=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;p+=f*_+(b-f)*l.lineHeight+(b-1)*t.bodySpacing}d&&(p+=t.footerMarginTop+d*h.lineHeight+(d-1)*t.footerSpacing);let x=0;const w=function(_){m=Math.max(m,e.measureText(_).width+x)};return e.save(),e.font=c.string,U(i.title,w),e.font=l.string,U(i.beforeBody.concat(i.afterBody),w),x=t.displayColors?r+2+t.boxPadding:0,U(n,_=>{U(_.before,w),U(_.lines,w),U(_.after,w)}),x=0,e.font=h.string,U(i.footer,w),e.restore(),m+=g.width,{width:m,height:p}}function Gy(i,t){const{y:e,height:n}=t;return ei.height-n/2?"bottom":"center"}function Zy(i,t,e,n){const{x:s,width:o}=n,r=e.caretSize+e.caretPadding;if(i==="left"&&s+o+r>t.width||i==="right"&&s-o-r<0)return!0}function Jy(i,t,e,n){const{x:s,width:o}=e,{width:r,chartArea:{left:a,right:l}}=i;let c="center";return n==="center"?c=s<=(a+l)/2?"left":"right":s<=o/2?c="left":s>=r-o/2&&(c="right"),Zy(c,i,t,e)&&(c="center"),c}function Tc(i,t,e){const n=e.yAlign||t.yAlign||Gy(i,e);return{xAlign:e.xAlign||t.xAlign||Jy(i,t,e,n),yAlign:n}}function Qy(i,t){let{x:e,width:n}=i;return t==="right"?e-=n:t==="center"&&(e-=n/2),e}function t1(i,t,e){let{y:n,height:s}=i;return t==="top"?n+=e:t==="bottom"?n-=s+e:n-=s/2,n}function Lc(i,t,e,n){const{caretSize:s,caretPadding:o,cornerRadius:r}=i,{xAlign:a,yAlign:l}=e,c=s+o,{topLeft:h,topRight:u,bottomLeft:d,bottomRight:f}=_i(r);let g=Qy(t,a);const p=t1(t,l,c);return l==="center"?a==="left"?g+=c:a==="right"&&(g-=c):a==="left"?g-=Math.max(h,d)+s:a==="right"&&(g+=Math.max(u,f)+s),{x:xt(g,0,n.width-t.width),y:xt(p,0,n.height-t.height)}}function hs(i,t,e){const n=Bt(e.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-n.right:i.x+n.left}function Rc(i){return Xt([],ae(i))}function e1(i,t,e){return Fe(i,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Ec(i,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?i.override(e):i}class i1 extends be{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart||t._chart,this._chart=this.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,n=this.options.setContext(this.getContext()),s=n.enabled&&e.options.animation&&n.animations,o=new Eu(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=e1(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:n}=e,s=n.beforeTitle.apply(this,[t]),o=n.title.apply(this,[t]),r=n.afterTitle.apply(this,[t]);let a=[];return a=Xt(a,ae(s)),a=Xt(a,ae(o)),a=Xt(a,ae(r)),a}getBeforeBody(t,e){return Rc(e.callbacks.beforeBody.apply(this,[t]))}getBody(t,e){const{callbacks:n}=e,s=[];return U(t,o=>{const r={before:[],lines:[],after:[]},a=Ec(n,o);Xt(r.before,ae(a.beforeLabel.call(this,o))),Xt(r.lines,a.label.call(this,o)),Xt(r.after,ae(a.afterLabel.call(this,o))),s.push(r)}),s}getAfterBody(t,e){return Rc(e.callbacks.afterBody.apply(this,[t]))}getFooter(t,e){const{callbacks:n}=e,s=n.beforeFooter.apply(this,[t]),o=n.footer.apply(this,[t]),r=n.afterFooter.apply(this,[t]);let a=[];return a=Xt(a,ae(s)),a=Xt(a,ae(o)),a=Xt(a,ae(r)),a}_createItems(t){const e=this._active,n=this.chart.data,s=[],o=[],r=[];let a=[],l,c;for(l=0,c=e.length;lt.filter(h,u,d,n))),t.itemSort&&(a=a.sort((h,u)=>t.itemSort(h,u,n))),U(a,h=>{const u=Ec(t.callbacks,h);s.push(u.labelColor.call(this,h)),o.push(u.labelPointStyle.call(this,h)),r.push(u.labelTextColor.call(this,h))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(t,e){const n=this.options.setContext(this.getContext()),s=this._active;let o,r=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const a=Ss[n.position].call(this,s,this._eventPosition);r=this._createItems(n),this.title=this.getTitle(r,n),this.beforeBody=this.getBeforeBody(r,n),this.body=this.getBody(r,n),this.afterBody=this.getAfterBody(r,n),this.footer=this.getFooter(r,n);const l=this._size=Oc(this,n),c=Object.assign({},a,l),h=Tc(this.chart,n,c),u=Lc(n,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:u.x,y:u.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,n,s){const o=this.getCaretPosition(t,n,s);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,n){const{xAlign:s,yAlign:o}=this,{caretSize:r,cornerRadius:a}=n,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:u}=_i(a),{x:d,y:f}=t,{width:g,height:p}=e;let m,b,x,w,_,y;return o==="center"?(_=f+p/2,s==="left"?(m=d,b=m-r,w=_+r,y=_-r):(m=d+g,b=m+r,w=_-r,y=_+r),x=m):(s==="left"?b=d+Math.max(l,h)+r:s==="right"?b=d+g-Math.max(c,u)-r:b=this.caretX,o==="top"?(w=f,_=w-r,m=b-r,x=b+r):(w=f+p,_=w+r,m=b+r,x=b-r),y=w),{x1:m,x2:b,x3:x,y1:w,y2:_,y3:y}}drawTitle(t,e,n){const s=this.title,o=s.length;let r,a,l;if(o){const c=Lo(n.rtl,this.x,this.width);for(t.x=hs(this,n.titleAlign,n),e.textAlign=c.textAlign(n.titleAlign),e.textBaseline="middle",r=Ot(n.titleFont),a=n.titleSpacing,e.fillStyle=n.titleColor,e.font=r.string,l=0;lw!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,js(t,{x:m,y:p,w:c,h:l,radius:x}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),js(t,{x:b,y:p+1,w:c-2,h:l-2,radius:x}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(m,p,c,l),t.strokeRect(m,p,c,l),t.fillStyle=r.backgroundColor,t.fillRect(b,p+1,c-2,l-2))}t.fillStyle=this.labelTextColors[n]}drawBody(t,e,n){const{body:s}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:h}=n,u=Ot(n.bodyFont);let d=u.lineHeight,f=0;const g=Lo(n.rtl,this.x,this.width),p=function(M){e.fillText(M,g.x(t.x+f),t.y+d/2),t.y+=d+o},m=g.textAlign(r);let b,x,w,_,y,k,v;for(e.textAlign=r,e.textBaseline="middle",e.font=u.string,t.x=hs(this,m,n),e.fillStyle=n.bodyColor,U(this.beforeBody,p),f=a&&m!=="right"?r==="center"?c/2+h:c+2+h:0,_=0,k=s.length;_0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,n=this.$animations,s=n&&n.x,o=n&&n.y;if(s||o){const r=Ss[t.position].call(this,this._active,this._eventPosition);if(!r)return;const a=this._size=Oc(this,t),l=Object.assign({},r,this._size),c=Tc(e,t,l),h=Lc(t,l,c,e);(s._to!==h.x||o._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let n=this.opacity;if(!n)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;const r=Bt(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=n,this.drawBackground(o,t,s,e),$0(t,e.textDirection),o.y+=r.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),z0(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const n=this._active,s=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!Fs(n,s),r=this._positionChanged(s,e);(o||r)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,n=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],r=this._getActiveElements(t,o,e,n),a=this._positionChanged(r,t),l=e||!Fs(r,o)||a;return l&&(this._active=r,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,n,s){const o=this.options;if(t.type==="mouseout")return[];if(!s)return e;const r=this.chart.getElementsAtEventForMode(t,o.mode,o,n);return o.reverse&&r.reverse(),r}_positionChanged(t,e){const{caretX:n,caretY:s,options:o}=this,r=Ss[o.position].call(this,t,e);return r!==!1&&(n!==r.x||s!==r.y)}}i1.positioners=Ss;const n1=(i,t,e,n)=>(typeof t=="string"?(e=i.push(t)-1,n.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function s1(i,t,e,n){const s=i.indexOf(t);if(s===-1)return n1(i,t,e,n);const o=i.lastIndexOf(t);return s!==o?e:s}const o1=(i,t)=>i===null?null:xt(Math.round(i),0,t);class dr extends oi{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const n=this.getLabels();for(const{index:s,label:o}of e)n[s]===o&&n.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(q(t))return null;const n=this.getLabels();return e=isFinite(e)&&n[e]===t?e:s1(n,t,W(e,t),this._addedLabels),o1(e,n.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:n,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(n=0),e||(s=this.getLabels().length-1)),this.min=n,this.max=s}buildTicks(){const t=this.min,e=this.max,n=this.options.offset,s=[];let o=this.getLabels();o=t===0&&e===o.length-1?o:o.slice(t,e+1),this._valueRange=Math.max(o.length-(n?0:1),1),this._startValue=this.min-(n?.5:0);for(let r=t;r<=e;r++)s.push({value:r});return s}getLabelForValue(t){const e=this.getLabels();return t>=0&&te.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}dr.id="category";dr.defaults={ticks:{callback:dr.prototype.getLabelForValue}};function r1(i,t){const e=[],{bounds:s,step:o,min:r,max:a,precision:l,count:c,maxTicks:h,maxDigits:u,includeBounds:d}=i,f=o||1,g=h-1,{min:p,max:m}=t,b=!q(r),x=!q(a),w=!q(c),_=(m-p)/(u+1);let y=zl((m-p)/g/f)*f,k,v,M,S;if(y<1e-14&&!b&&!x)return[{value:p},{value:m}];S=Math.ceil(m/y)-Math.floor(p/y),S>g&&(y=zl(S*y/g/f)*f),q(l)||(k=Math.pow(10,l),y=Math.ceil(y*k)/k),s==="ticks"?(v=Math.floor(p/y)*y,M=Math.ceil(m/y)*y):(v=p,M=m),b&&x&&o&&y_((a-r)/o,y/1e3)?(S=Math.round(Math.min((a-r)/y,h)),y=(a-r)/S,v=r,M=a):w?(v=b?r:v,M=x?a:M,S=c-1,y=(M-v)/S):(S=(M-v)/y,mn(S,Math.round(S),y/1e3)?S=Math.round(S):S=Math.ceil(S));const C=Math.max(Bl(y),Bl(v));k=Math.pow(10,q(l)?C:l),v=Math.round(v*k)/k,M=Math.round(M*k)/k;let D=0;for(b&&(d&&v!==r?(e.push({value:r}),vs=e?s:l,a=l=>o=n?o:l;if(t){const l=Jt(s),c=Jt(o);l<0&&c<0?a(0):l>0&&c>0&&r(0)}if(s===o){let l=1;(o>=Number.MAX_SAFE_INTEGER||s<=Number.MIN_SAFE_INTEGER)&&(l=Math.abs(o*.05)),a(o+l),t||r(s-l)}this.min=s,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:n}=t,s;return n?(s=Math.ceil(this.max/n)-Math.floor(this.min/n)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${n} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let n=this.getTickLimit();n=Math.max(2,n);const s={maxTicks:n,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,r=r1(s,o);return t.bounds==="ticks"&&hu(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const t=this.ticks;let e=this.min,n=this.max;if(super.configure(),this.options.offset&&t.length){const s=(n-e)/Math.max(t.length-1,1)/2;e-=s,n+=s}this._startValue=e,this._endValue=n,this._valueRange=n-e}getLabelForValue(t){return Fn(t,this.chart.options.locale,this.options.ticks.format)}}class Qu extends Us{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=pt(t)?t:0,this.max=pt(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,n=jt(this.options.ticks.minRotation),s=(t?Math.sin(n):Math.cos(n))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}Qu.id="linear";Qu.defaults={ticks:{callback:oo.formatters.numeric}};function Fc(i){return i/Math.pow(10,Math.floor(It(i)))===1}function a1(i,t){const e=Math.floor(It(t.max)),n=Math.ceil(t.max/Math.pow(10,e)),s=[];let o=Rt(i.min,Math.pow(10,Math.floor(It(t.min)))),r=Math.floor(It(o)),a=Math.floor(o/Math.pow(10,r)),l=r<0?Math.pow(10,Math.abs(r)):1;do s.push({value:o,major:Fc(o)}),++a,a===10&&(a=1,++r,l=r>=0?1:l),o=Math.round(a*Math.pow(10,r)*l)/l;while(r0?n:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=pt(t)?Math.max(0,t):null,this.max=pt(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let n=this.min,s=this.max;const o=l=>n=t?n:l,r=l=>s=e?s:l,a=(l,c)=>Math.pow(10,Math.floor(It(l))+c);n===s&&(n<=0?(o(1),r(10)):(o(a(n,-1)),r(a(s,1)))),n<=0&&o(a(s,-1)),s<=0&&r(a(n,1)),this._zero&&this.min!==this._suggestedMin&&n===a(this.min,0)&&o(a(n,-1)),this.min=n,this.max=s}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},n=a1(e,this);return t.bounds==="ticks"&&hu(n,this,"value"),t.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}getLabelForValue(t){return t===void 0?"0":Fn(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=It(t),this._valueRange=It(this.max)-It(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(It(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}td.id="logarithmic";td.defaults={ticks:{callback:oo.formatters.logarithmic,major:{enabled:!0}}};function fr(i){const t=i.ticks;if(t.display&&i.display){const e=Bt(t.backdropPadding);return W(t.font&&t.font.size,V.font.size)+e.height}return 0}function l1(i,t,e){return e=nt(e)?e:[e],{w:J_(i,t.string,e),h:e.length*t.lineHeight}}function $c(i,t,e,n,s){return i===n||i===s?{start:t-e/2,end:t+e/2}:is?{start:t-e,end:t}:{start:t,end:t+e}}function c1(i){const t={l:i.left+i._padding.left,r:i.right-i._padding.right,t:i.top+i._padding.top,b:i.bottom-i._padding.bottom},e=Object.assign({},t),n=[],s=[],o=i._pointLabels.length,r=i.options.pointLabels,a=r.centerPointLabels?ct/o:0;for(let l=0;lt.r&&(a=(n.end-t.r)/o,i.r=Math.max(i.r,t.r+a)),s.startt.b&&(l=(s.end-t.b)/r,i.b=Math.max(i.b,t.b+l))}function u1(i,t,e){const n=[],s=i._pointLabels.length,o=i.options,r=fr(o)/2,a=i.drawingArea,l=o.pointLabels.centerPointLabels?ct/s:0;for(let c=0;c270||e<90)&&(i-=t),i}function p1(i,t){const{ctx:e,options:{pointLabels:n}}=i;for(let s=t-1;s>=0;s--){const o=n.setContext(i.getPointLabelContext(s)),r=Ot(o.font),{x:a,y:l,textAlign:c,left:h,top:u,right:d,bottom:f}=i._pointLabelItems[s],{backdropColor:g}=o;if(!q(g)){const p=_i(o.borderRadius),m=Bt(o.backdropPadding);e.fillStyle=g;const b=h-m.left,x=u-m.top,w=d-h+m.width,_=f-u+m.height;Object.values(p).some(y=>y!==0)?(e.beginPath(),js(e,{x:b,y:x,w,h:_,radius:p}),e.fill()):e.fillRect(b,x,w,_)}Ws(e,i._pointLabels[s],a,l+r.lineHeight/2,r,{color:o.color,textAlign:c,textBaseline:"middle"})}}function ed(i,t,e,n){const{ctx:s}=i;if(e)s.arc(i.xCenter,i.yCenter,t,0,K);else{let o=i.getPointPosition(0,t);s.moveTo(o.x,o.y);for(let r=1;r{const s=ot(this.options.pointLabels.callback,[e,n],this);return s||s===0?s:""}).filter((e,n)=>this.chart.getDataVisibility(n))}fit(){const t=this.options;t.display&&t.pointLabels.display?c1(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,n,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((n-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,n,s))}getIndexAngle(t){const e=K/(this._pointLabels.length||1),n=this.options.startAngle||0;return Vt(t*e+jt(n))}getDistanceFromCenterForValue(t){if(q(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(q(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t{if(h!==0){a=this.getDistanceFromCenterForValue(c.value);const u=s.setContext(this.getContext(h-1));m1(this,u,a,o)}}),n.display){for(t.save(),r=o-1;r>=0;r--){const c=n.setContext(this.getPointLabelContext(r)),{color:h,lineWidth:u}=c;!u||!h||(t.lineWidth=u,t.strokeStyle=h,t.setLineDash(c.borderDash),t.lineDashOffset=c.borderDashOffset,a=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),l=this.getPointPosition(r,a),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,n=e.ticks;if(!n.display)return;const s=this.getIndexAngle(0);let o,r;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&!e.reverse)return;const c=n.setContext(this.getContext(l)),h=Ot(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=h.string,r=t.measureText(a.label).width,t.fillStyle=c.backdropColor;const u=Bt(c.backdropPadding);t.fillRect(-r/2-u.left,-o-h.size/2-u.top,r+u.width,h.size+u.height)}Ws(t,a.label,0,-o,h,{color:c.color})}),t.restore()}drawTitle(){}}ao.id="radialLinear";ao.defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:oo.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(i){return i},padding:5,centerPointLabels:!1}};ao.defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};ao.descriptors={angleLines:{_fallback:"grid"}};const lo={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Mt=Object.keys(lo);function _1(i,t){return i-t}function zc(i,t){if(q(t))return null;const e=i._adapter,{parser:n,round:s,isoWeekday:o}=i._parseOpts;let r=t;return typeof n=="function"&&(r=n(r)),pt(r)||(r=typeof n=="string"?e.parse(r,n):e.parse(r)),r===null?null:(s&&(r=s==="week"&&(ki(o)||o===!0)?e.startOf(r,"isoWeek",o):e.startOf(r,s)),+r)}function Bc(i,t,e,n){const s=Mt.length;for(let o=Mt.indexOf(i);o=Mt.indexOf(e);o--){const r=Mt[o];if(lo[r].common&&i._adapter.diff(s,n,r)>=t-1)return r}return Mt[e?Mt.indexOf(e):0]}function y1(i){for(let t=Mt.indexOf(i)+1,e=Mt.length;t=t?e[n]:e[s];i[o]=!0}}function v1(i,t,e,n){const s=i._adapter,o=+s.startOf(t[0].value,n),r=t[t.length-1].value;let a,l;for(a=o;a<=r;a=+s.add(a,1,n))l=e[a],l>=0&&(t[l].major=!0);return t}function Vc(i,t,e){const n=[],s={},o=t.length;let r,a;for(r=0;r+t.value))}initOffsets(t){let e=0,n=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?n=o:n=(o-this.getDecimalForValue(t[t.length-2]))/2);const r=t.length<3?.5:.25;e=xt(e,0,r),n=xt(n,0,r),this._offsets={start:e,end:n,factor:1/(e+1+n)}}_generate(){const t=this._adapter,e=this.min,n=this.max,s=this.options,o=s.time,r=o.unit||Bc(o.minUnit,e,n,this._getLabelCapacity(e)),a=W(o.stepSize,1),l=r==="week"?o.isoWeekday:!1,c=ki(l)||l===!0,h={};let u=e,d,f;if(c&&(u=+t.startOf(u,"isoWeek",l)),u=+t.startOf(u,c?"day":r),t.diff(n,e,r)>1e5*a)throw new Error(e+" and "+n+" are too far apart with stepSize of "+a+" "+r);const g=s.ticks.source==="data"&&this.getDataTimestamps();for(d=u,f=0;dp-m).map(p=>+p)}getLabelForValue(t){const e=this._adapter,n=this.options.time;return n.tooltipFormat?e.format(t,n.tooltipFormat):e.format(t,n.displayFormats.datetime)}_tickFormatFunction(t,e,n,s){const o=this.options,r=o.time.displayFormats,a=this._unit,l=this._majorUnit,c=a&&r[a],h=l&&r[l],u=n[e],d=l&&h&&u&&u.major,f=this._adapter.format(t,s||(d?h:c)),g=o.ticks.callback;return g?ot(g,[f,e,n],this):f}generateTickLabels(t){let e,n,s;for(e=0,n=t.length;e0?a:1}getDataTimestamps(){let t=this._cache.data||[],e,n;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,n=s.length;e=i[n].pos&&t<=i[s].pos&&({lo:n,hi:s}=Ze(i,"pos",t)),{pos:o,time:a}=i[n],{pos:r,time:l}=i[s]):(t>=i[n].time&&t<=i[s].time&&({lo:n,hi:s}=Ze(i,"time",t)),{time:o,pos:a}=i[n],{time:r,pos:l}=i[s]);const c=r-o;return c?a+(l-a)*(t-o)/c:a}class id extends co{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=us(e,this.min),this._tableRange=us(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:n}=this,s=[],o=[];let r,a,l,c,h;for(r=0,a=t.length;r=e&&c<=n&&s.push(c);if(s.length<2)return[{time:e,pos:0},{time:n,pos:1}];for(r=0,a=s.length;r{}};function nd(){for(var i,t=0,e=arguments.length,n={};t=0&&(n=e.slice(s+1),e=e.slice(0,s)),e&&!t.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:n}})}function M1(i,t){for(var e,n=0,s=i.length;n0)for(var e,n,s=new Array(e),o=0;o=0&&(t=i.slice(0,e))!=="xmlns"&&(i=i.slice(e+1)),jc.hasOwnProperty(t)?{space:jc[t],local:i}:i}function S1(i){return function(){var t=this.ownerDocument,e=this.namespaceURI;return e===gr&&t.documentElement.namespaceURI===gr?t.createElement(i):t.createElementNS(e,i)}}function P1(i){return function(){return this.ownerDocument.createElementNS(i.space,i.local)}}function Hc(i){var t=sd(i);return(t.local?P1:S1)(t)}function C1(){}function Yc(i){return i==null?C1:function(){return this.querySelector(i)}}function A1(i){return i==null?[]:Array.isArray(i)?i:Array.from(i)}function D1(){return[]}function Xc(i){return function(t){return t.matches(i)}}var O1=Array.prototype.find;function T1(){return this.firstElementChild}var L1=Array.prototype.filter;function R1(){return Array.from(this.children)}function Uc(i){return new Array(i.length)}function qs(i,t){this.ownerDocument=i.ownerDocument,this.namespaceURI=i.namespaceURI,this._next=null,this._parent=i,this.__data__=t}function E1(i){return function(){return i}}function I1(i,t,e,n,s,o){for(var r,a=0,l=t.length,c=o.length;at?1:i>=t?0:NaN}function N1(i){return function(){this.removeAttribute(i)}}function V1(i){return function(){this.removeAttributeNS(i.space,i.local)}}function W1(i,t){return function(){this.setAttribute(i,t)}}function j1(i,t){return function(){this.setAttributeNS(i.space,i.local,t)}}function H1(i,t){return function(){var e=t.apply(this,arguments);e==null?this.removeAttribute(i):this.setAttribute(i,e)}}function Y1(i,t){return function(){var e=t.apply(this,arguments);e==null?this.removeAttributeNS(i.space,i.local):this.setAttributeNS(i.space,i.local,e)}}function od(i){return i.ownerDocument&&i.ownerDocument.defaultView||i.document&&i||i.defaultView}function X1(i){return function(){this.style.removeProperty(i)}}function U1(i,t,e){return function(){this.style.setProperty(i,t,e)}}function q1(i,t,e){return function(){var n=t.apply(this,arguments);n==null?this.style.removeProperty(i):this.style.setProperty(i,n,e)}}function K1(i,t){return i.style.getPropertyValue(t)||od(i).getComputedStyle(i,null).getPropertyValue(t)}function G1(i){return function(){delete this[i]}}function Z1(i,t){return function(){this[i]=t}}function J1(i,t){return function(){var e=t.apply(this,arguments);e==null?delete this[i]:this[i]=e}}function rd(i){return i.trim().split(/^|\s+/)}function ra(i){return i.classList||new ad(i)}function ad(i){this._node=i,this._names=rd(i.getAttribute("class")||"")}function ld(i,t){for(var e=ra(i),n=-1,s=t.length;++n=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}})}function pv(i){return function(){var t=this.__on;if(t){for(var e,n=0,s=-1,o=t.length;n=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(i){return this._names.indexOf(i)>=0}};var xv=[null];function Et(i,t){this._groups=i,this._parents=t}function ln(i){return typeof i=="string"?new Et([[document.querySelector(i)]],[document.documentElement]):new Et([[i]],xv)}function qc(i,t){if(i=function(o){let r;for(;r=o.sourceEvent;)o=r;return o}(i),t===void 0&&(t=i.currentTarget),t){var e=t.ownerSVGElement||t;if(e.createSVGPoint){var n=e.createSVGPoint();return n.x=i.clientX,n.y=i.clientY,[(n=n.matrixTransform(t.getScreenCTM().inverse())).x,n.y]}if(t.getBoundingClientRect){var s=t.getBoundingClientRect();return[i.clientX-s.left-t.clientLeft,i.clientY-s.top-t.clientTop]}}return[i.pageX,i.pageY]}Et.prototype={constructor:Et,select:function(i){typeof i!="function"&&(i=Yc(i));for(var t=this._groups,e=t.length,n=new Array(e),s=0;s=y&&(y=_+1);!(w=m[y])&&++y=0;)(n=s[o])&&(r&&4^n.compareDocumentPosition(r)&&r.parentNode.insertBefore(n,r),r=n);return this},sort:function(i){function t(u,d){return u&&d?i(u.__data__,d.__data__):!u-!d}i||(i=B1);for(var e=this._groups,n=e.length,s=new Array(n),o=0;o1?this.each((t==null?X1:typeof t=="function"?q1:U1)(i,t,e??"")):K1(this.node(),i)},property:function(i,t){return arguments.length>1?this.each((t==null?G1:typeof t=="function"?J1:Z1)(i,t)):this.node()[i]},classed:function(i,t){var e=rd(i+"");if(arguments.length<2){for(var n=ra(this.node()),s=-1,o=e.length;++s()=>i;function pr(i,{sourceEvent:t,subject:e,target:n,identifier:s,active:o,x:r,y:a,dx:l,dy:c,dispatch:h}){Object.defineProperties(this,{type:{value:i,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:r,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:h}})}function vv(i){return!i.ctrlKey&&!i.button}function wv(){return this.parentNode}function kv(i,t){return t??{x:i.x,y:i.y}}function Mv(){return navigator.maxTouchPoints||"ontouchstart"in this}function Sv(){var i,t,e,n,s=vv,o=wv,r=kv,a=Mv,l={},c=nd("start","drag","end"),h=0,u=0;function d(_){_.on("mousedown.drag",f).filter(a).on("touchstart.drag",m).on("touchmove.drag",b,yv).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(_,y){if(!n&&s.call(this,_,y)){var k=w(this,o.call(this,_,y),_,y,"mouse");k&&(ln(_.view).on("mousemove.drag",g,Ni).on("mouseup.drag",p,Ni),function(v){var M=v.document.documentElement,S=ln(v).on("dragstart.drag",hi,Ni);"onselectstart"in M?S.on("selectstart.drag",hi,Ni):(M.__noselect=M.style.MozUserSelect,M.style.MozUserSelect="none")}(_.view),Vo(_),e=!1,i=_.clientX,t=_.clientY,k("start",_))}}function g(_){if(hi(_),!e){var y=_.clientX-i,k=_.clientY-t;e=y*y+k*k>u}l.mouse("drag",_)}function p(_){ln(_.view).on("mousemove.drag mouseup.drag",null),function(y,k){var v=y.document.documentElement,M=ln(y).on("dragstart.drag",null);k&&(M.on("click.drag",hi,Ni),setTimeout(function(){M.on("click.drag",null)},0)),"onselectstart"in v?M.on("selectstart.drag",null):(v.style.MozUserSelect=v.__noselect,delete v.__noselect)}(_.view,e),hi(_),l.mouse("end",_)}function m(_,y){if(s.call(this,_,y)){var k,v,M=_.changedTouches,S=o.call(this,_,y),C=M.length;for(k=0;kt.scales[qt].max?t.scales[qt].max:o,o=ot.scales[he].max?t.scales[he].max:r,r=r{if(wt){ui=wt.datasetIndex,qe=wt.index,mr=!0;let s=t.data.datasets[ui].data[qe];Ks==="radar"||Ks==="polarArea"?s=function(o,r){let a,l,c;o.touches?(a=o.touches[0].clientX-r.canvas.getBoundingClientRect().left,l=o.touches[0].clientY-r.canvas.getBoundingClientRect().top):(a=o.clientX-r.canvas.getBoundingClientRect().left,l=o.clientY-r.canvas.getBoundingClientRect().top);let h=r.scales[ye],u=Math.sqrt(Math.pow(a-h.xCenter,2)+Math.pow(l-h.yCenter,2)),d=h.drawingArea/(h.max-h.min);return c=h.options.ticks.reverse?h.max-u/d:h.min+u/d,c=Gs(c,r.config.options.plugins.dragData.round),c=c>r.scales[ye].max?r.scales[ye].max:c,c=c((n,s,o)=>{if(wt=s.getElementsAtEventForMode(n,"nearest",{intersect:!0},!1)[0],Ks=s.config.type,wt){let r=wt.datasetIndex,a=wt.index;Kc=function(u){try{return u()}catch{return""}}(()=>s.config.options.plugins.tooltip.animation);const l=s.data.datasets[r],c=s.getDatasetMeta(r);let h=l.data[a];if(qt=c.xAxisID,he=c.yAxisID,ye=c.rAxisID,l.dragData===!1||s.config.options.scales[qt]&&s.config.options.scales[qt].dragData===!1||s.config.options.scales[he]&&s.config.options.scales[he].dragData===!1||s.config.options.scales[ye]&&s.config.options.scales[ye].rAxisID===!1||l.data[wt.index].dragData===!1)return void(wt=null);if(Ks==="bar"){ud=s.config.options.scales[qt].stacked;const u=s.data.datasets[0].data[0];dd=u!==null&&Array.isArray(u)&&u.length==2,fd=br(n,s,r,a)-h}(s.config.options.plugins.dragData.showTooltip===void 0||s.config.options.plugins.dragData.showTooltip)&&(s.config.options.plugins.tooltip||(s.config.options.plugins.tooltip={}),s.config.options.plugins.tooltip.animation=!1),typeof o=="function"&&wt&&o(n,r,a,h)===!1&&(wt=null)}})(e.sourceEvent,i,t.onDragStart)).on("drag",e=>Pv(e.sourceEvent,i,t,t.onDrag)).on("end",e=>((n,s,o)=>{if(qe=void 0,mr=!1,s.config.options.plugins.tooltip&&(s.config.options.plugins.tooltip.animation=Kc,s.update("none")),typeof o=="function"&&wt){const r=wt.datasetIndex,a=wt.index;let l=function(c,h,u){const d=c.config.options.plugins.dragData;if(!d.magnet)return c.data.datasets[h].data[u];{const f=d.magnet;if(f.to&&typeof f.to=="function"){let g=c.data.datasets[h].data[u];return g=f.to(g),c.data.datasets[h].data[u]=g,c.update("none"),g}}}(s,r,a);return o(n,r,a,l)}})(e.sourceEvent,i,t.onDragEnd)))}},beforeEvent:function(i){if(mr)return i.tooltip&&i.tooltip.update(),!1}};ia.register(gd);function Cv(i){let t,e,n,s,o;return{c(){t=z("canvas"),e=Dt(),n=z("canvas"),mi(t,"width","100%"),mi(t,"height","400px"),mi(n,"width","100%"),mi(n,"height","300px")},m(r,a){Z(r,t,a),Z(r,e,a),Z(r,n,a),s||(o=[la(i[0].call(null,t)),la(i[1].call(null,n))],s=!0)},p:Ft,i:Ft,o:Ft,d(r){r&&(J(t),J(e),J(n)),s=!1,Ci(o)}}}function Av(i,t,e){sn.register(...c_),sn.register(gd);let{lts:n}=t,{nearbyAmenities:s}=t,{greenspace:o}=t,r=null,a=["red","blue","green"];l();function l(){let u=n+s+o;e(2,n=100*n/u),e(3,s=100*s/u),e(4,o=100*o/u),r&&(r.data.datasets[0].data=[n,s,o],r.update())}function c(u){let d={type:"radar",data:{labels:["LTS","Amenities","Greenspace"],datasets:[{label:"Routing preferences",data:[n,s,o],pointHitRadius:25}]},options:{responsive:!1,onHover(f){const g=f.chart.getElementsAtEventForMode(f,"nearest",{intersect:!0},!1);f.native.target.style.cursor=g.length?"grab":"default"},plugins:{dragData:{round:1,showTooltip:!0,onDragStart(f){f.target.style.cursor="grabbing"},onDragEnd(f,g,p,m){f.target.style.cursor="default",p==0?e(2,n=m):p==1?e(3,s=m):p==2&&e(4,o=m),l()}}},scales:{r:{min:0,max:100,stepSize:1,pointLabels:{color:a,font:{weight:"bold",size:15}},ticks:{display:!1}}}}};new sn(u.getContext("2d"),d)}function h(u){let d={type:"bar",data:{labels:["LTS","Amenities","Greenspace"],datasets:[{label:"Routing preferences",data:[n,s,o],backgroundColor:a}]},options:{indexAxis:"y"}};r=new sn(u.getContext("2d"),d)}return i.$$set=u=>{"lts"in u&&e(2,n=u.lts),"nearbyAmenities"in u&&e(3,s=u.nearbyAmenities),"greenspace"in u&&e(4,o=u.greenspace)},[c,h,n,s,o]}class Dv extends Dn{constructor(t){super(),On(this,t,Av,Cv,Pi,{lts:2,nearbyAmenities:3,greenspace:4})}}function Gc(i,t,e){const n=i.slice();return n[21]=t[e],n[26]=t,n[27]=e,n}function Zc(i,t,e){const n=i.slice();return n[21]=t[e],n[24]=t,n[25]=e,n}function Jc(i,t,e){const n=i.slice();return n[21]=t[e],n[22]=t,n[23]=e,n}function Ov(i){let t,e,n,s,o,r,a,l,c,h,u,d,f,g,p,m;function b(v){i[14](v)}function x(v){i[15](v)}function w(v){i[16](v)}let _={};i[3].tradeoff_lts!==void 0&&(_.lts=i[3].tradeoff_lts),i[3].tradeoff_amenities!==void 0&&(_.nearbyAmenities=i[3].tradeoff_amenities),i[3].tradeoff_greenspace!==void 0&&(_.greenspace=i[3].tradeoff_greenspace),t=new Dv({props:_}),ys.push(()=>fo(t,"lts",b)),ys.push(()=>fo(t,"nearbyAmenities",x)),ys.push(()=>fo(t,"greenspace",w));let y=xi(["lts1","lts2","lts3","lts4"]),k=[];for(let v=0;v<4;v+=1)k[v]=Qc(Gc(i,y,v));return{c(){Pd(t.$$.fragment),o=Dt(),r=z("ul");for(let v=0;v<4;v+=1)k[v].c();a=Dt(),l=z("div"),c=z("label"),h=Gt(`Give roads a good score if they have at least this many nearby amenities: + `),u=z("input"),d=Dt(),f=z("button"),f.textContent="Recalculate",St(u,"type","number"),St(u,"min","0"),St(f,"type","button")},m(v,M){Cd(t,v,M),Z(v,o,M),Z(v,r,M);for(let S=0;S<4;S+=1)k[S]&&k[S].m(r,null);Z(v,a,M),Z(v,l,M),F(l,c),F(c,h),F(c,u),ft(u,i[3].minimum_amenities),Z(v,d,M),Z(v,f,M),g=!0,p||(m=[$t(u,"input",i[18]),$t(f,"click",i[19])],p=!0)},p(v,M){const S={};if(!e&&M&8&&(e=!0,S.lts=v[3].tradeoff_lts,go(()=>e=!1)),!n&&M&8&&(n=!0,S.nearbyAmenities=v[3].tradeoff_amenities,go(()=>n=!1)),!s&&M&8&&(s=!0,S.greenspace=v[3].tradeoff_greenspace,go(()=>s=!1)),t.$set(S),M&8){y=xi(["lts1","lts2","lts3","lts4"]);let C;for(C=0;C<4;C+=1){const D=Gc(v,y,C);k[C]?k[C].p(D,M):(k[C]=Qc(D),k[C].c(),k[C].m(r,null))}for(;C<4;C+=1)k[C].d(1)}M&8&&Ge(u.value)!==v[3].minimum_amenities&&ft(u,v[3].minimum_amenities)},i(v){g||(pe(t.$$.fragment,v),g=!0)},o(v){De(t.$$.fragment,v),g=!1},d(v){v&&(J(o),J(r),J(a),J(l),J(d),J(f)),Ad(t,v),vr(k,v),p=!1,Ci(m)}}}function Tv(i){let t,e=xi(["lts1","lts2","lts3","lts4"]),n=[];for(let s=0;s<4;s+=1)n[s]=th(Zc(i,e,s));return{c(){t=z("ul");for(let s=0;s<4;s+=1)n[s].c()},m(s,o){Z(s,t,o);for(let r=0;r<4;r+=1)n[r]&&n[r].m(t,null)},p(s,o){if(o&17){e=xi(["lts1","lts2","lts3","lts4"]);let r;for(r=0;r<4;r+=1){const a=Zc(s,e,r);n[r]?n[r].p(a,o):(n[r]=th(a),n[r].c(),n[r].m(t,null))}for(;r<4;r+=1)n[r].d(1)}},i:Ft,o:Ft,d(s){s&&J(t),vr(n,s)}}}function Lv(i){let t,e=xi(Object.keys(i[5])),n=[];for(let s=0;sconfig.json file",g=Dt(),p=z("pre"),m=Gt('"cost": '),x=Gt(b),w=Dt(),_=z("button"),_.textContent="See cost function JSON",y=Dt(),v&&v.c(),M=Zs(),o.__value="Distance",ft(o,o.__value),r.__value="Generalized",ft(r,r.__value),a.__value="ByLTS",ft(a,a.__value),l.__value="OsmHighwayType",ft(l,l.__value),i[1]===void 0&&nh(()=>i[6].call(s)),u.autofocus=!0},m(P,O){Z(P,t,O),F(t,e),F(e,n),F(e,s),F(s,o),F(s,r),F(s,a),F(s,l),Cs(s,i[1],!0),Z(P,c,O),Z(P,h,O),F(h,u),F(h,d),F(h,f),F(h,g),F(h,p),F(p,m),F(p,x),i[8](h),Z(P,w,O),Z(P,_,O),Z(P,y,O),~k&&I[k].m(P,O),Z(P,M,O),S=!0,u.focus(),C||(D=[$t(s,"change",i[6]),$t(u,"click",i[7]),$t(_,"click",i[9])],C=!0)},p(P,[O]){O&2&&Cs(s,P[1]),(!S||O&1)&&b!==(b=JSON.stringify(P[0],null,2)+"")&&yr(x,b);let L=k;k=$(P),k===L?~k&&I[k].p(P,O):(v&&(_r(),De(I[L],1,1,()=>{I[L]=null}),xr()),~k?(v=I[k],v?v.p(P,O):(v=I[k]=T[k](P),v.c()),pe(v,1),v.m(M.parentNode,M)):v=null)},i(P){S||(pe(v),S=!0)},o(P){De(v),S=!1},d(P){P&&(J(t),J(c),J(h),J(w),J(_),J(y),J(M)),i[8](null),~k&&I[k].d(P),C=!1,Ci(D)}}}function Ev(i,t,e){let{cost:n}=t,s,o="Distance",r={tradeoff_lts:50,tradeoff_amenities:30,tradeoff_greenspace:20,lts1:0,lts2:.2,lts3:.6,lts4:1,minimum_amenities:1},a={lts1:1,lts2:1,lts3:1,lts4:1},l={};for(let M of["cycleway","footway","living_street","motorway","motorway_link","path","pedestrian","primary","primary_link","residential","secondary","secondary_link","service","steps","tertiary","tertiary_link","track","trunk","trunk_link","unclassified"])l[M]=1;function c(M){M=="OsmHighwayType"?e(0,n={OsmHighwayType:l}):M=="ByLTS"?e(0,n={ByLTS:a}):M=="Generalized"?e(0,n={Generalized:r}):e(0,n=M)}function h(){o=sh(this),e(1,o)}const u=()=>s.close();function d(M){ys[M?"unshift":"push"](()=>{s=M,e(2,s)})}const f=()=>s.showModal();function g(M){l[M]=Ge(this.value),e(5,l)}const p=()=>e(0,n);function m(M){a[M]=Ge(this.value),e(4,a)}const b=()=>e(0,n);function x(M){i.$$.not_equal(r.tradeoff_lts,M)&&(r.tradeoff_lts=M,e(3,r))}function w(M){i.$$.not_equal(r.tradeoff_amenities,M)&&(r.tradeoff_amenities=M,e(3,r))}function _(M){i.$$.not_equal(r.tradeoff_greenspace,M)&&(r.tradeoff_greenspace=M,e(3,r))}function y(M){r[M]=Ge(this.value),e(3,r)}function k(){r.minimum_amenities=Ge(this.value),e(3,r)}const v=()=>e(0,n);return i.$$set=M=>{"cost"in M&&e(0,n=M.cost)},i.$$.update=()=>{i.$$.dirty&2&&c(o)},[n,o,s,r,a,l,h,u,d,f,g,p,m,b,x,w,_,y,k,v]}class vw extends Dn{constructor(t){super(),On(this,t,Ev,Rv,Pi,{cost:0})}}function ih(i){let t;return{c(){t=z("div"),t.textContent="Loading",St(t,"class","svelte-1uuov7f")},m(e,n){Z(e,t,n)},d(e){e&&J(t)}}}function Iv(i){let t,e=i[0]&&ih();return{c(){e&&e.c(),t=Zs()},m(n,s){e&&e.m(n,s),Z(n,t,s)},p(n,[s]){n[0]?e||(e=ih(),e.c(),e.m(t.parentNode,t)):e&&(e.d(1),e=null)},i:Ft,o:Ft,d(n){n&&J(t),e&&e.d(n)}}}function Fv(i,t,e){let{loading:n=!1}=t;return i.$$set=s=>{"loading"in s&&e(0,n=s.loading)},[n]}class ww extends Dn{constructor(t){super(),On(this,t,Fv,Iv,Pi,{loading:0})}}export{Nv as C,Bv as G,Ho as J,ww as L,Vd as _,vw as a}; diff --git a/assets/x2-91d17a8b.js b/assets/x2-340aa4e6.js similarity index 99% rename from assets/x2-91d17a8b.js rename to assets/x2-340aa4e6.js index da99306..11e3702 100644 --- a/assets/x2-91d17a8b.js +++ b/assets/x2-340aa4e6.js @@ -1,4 +1,4 @@ -import{S as te,i as ne,s as se,G as fe,e as E,h as P,z as G,l as I,I as Q,q as O,J as ue,K as ce,N as pe,O as de,t as h,b as C,v as S,w as me,Q as ge,R as _e,T as U,U as V,m as be,L as he,c as D,f as j,a as q,d as J,o as we,H as Le,x as T,y as H,g as W,n as M,A as K,r as X,u as Y,M as ye,_ as ve,V as ae,j as $,D as Ce,E as ke,W as Me}from"./Legend-36db5a45.js";import{L as Be,C as ze,_ as Ee,J as Ie,a as Se,G as De}from"./Loading-65ee842b.js";import{S as qe,L as Je}from"./SidebarControls-5b3d2c73.js";function Ne(a){let e,t,l,n,o,f,c;const s=a[16].default,r=fe(s,a,a[15],null);return{c(){e=E("div"),r&&r.c(),P(e,"tabindex",t=a[1]?0:void 0),P(e,"role",l=a[1]?"button":void 0),G(e,"z-index",a[2])},m(i,p){I(i,e,p),r&&r.m(e,null),o=!0,f||(c=[Q(a[6].call(null,e)),Q(n=Oe.call(null,e,a[0])),O(e,"click",a[17]),O(e,"dblclick",a[18]),O(e,"contextmenu",a[19]),O(e,"mouseenter",a[20]),O(e,"mouseleave",a[21]),O(e,"mousemove",a[22]),O(e,"keydown",a[7])],f=!0)},p(i,[p]){r&&r.p&&(!o||p&32768)&&ue(r,s,i,i[15],o?pe(s,i[15],p,null):ce(i[15]),null),(!o||p&2&&t!==(t=i[1]?0:void 0))&&P(e,"tabindex",t),(!o||p&2&&l!==(l=i[1]?"button":void 0))&&P(e,"role",l),n&&de(n.update)&&p&1&&n.update.call(null,i[0]),p&4&&G(e,"z-index",i[2])},i(i){o||(h(r,i),o=!0)},o(i){C(r,i),o=!1},d(i){i&&S(e),r&&r.d(i),f=!1,me(c)}}}function Oe(a,e){const t=a.className;function l(n){n?a.className=`${t} ${n}`:a.className=t}return l(e),{update:l}}function Pe(a,e,t){let l,n,o,{$$slots:f={},$$scope:c}=e,{lngLat:s}=e,{class:r=void 0}=e,{interactive:i=!0}=e,{asButton:p=!1}=e,{draggable:w=!1}=e,{feature:B=null}=e,{offset:y=void 0}=e,{zIndex:d=void 0}=e;const v=ge(),{map:N,layerEvent:A,self:m}=_e();U(a,N,u=>t(24,o=u)),U(a,A,u=>t(23,l=u)),U(a,m,u=>t(14,n=u));function _(u){V(m,n=new be.Marker({element:u,draggable:w,offset:y}).setLngLat(s).addTo(o),n);const R=()=>L("dragstart"),F=()=>{g(),L("drag")},Z=()=>{g(),L("dragend")};return w&&(n.on("dragstart",R),n.on("drag",F),n.on("dragend",Z)),{destroy(){w&&(n==null||n.off("dragstart",R),n==null||n.off("drag",F),n==null||n.off("dragend",Z)),n==null||n.remove()}}}function g(){let u=n==null?void 0:n.getLngLat();u&&(Array.isArray(s)?t(9,s=[u.lng,u.lat]):s&&"lon"in s?t(9,s={lon:u.lng,lat:u.lat}):t(9,s=u))}function z(u){u.key===" "&&(u.preventDefault(),u.stopPropagation(),L("click"))}function L(u){if(!i)return;let R=n==null?void 0:n.getLngLat();if(!R)return;const F=[R.lng,R.lat];let Z={map:o,marker:n,lngLat:F,features:[{type:"Feature",properties:(B==null?void 0:B.properties)??{},geometry:{type:"Point",coordinates:F}}]};V(A,l={...Z,layerType:"marker",type:u},l),v(u,Z)}const b=()=>L("click"),k=()=>L("dblclick"),le=()=>L("contextmenu"),oe=u=>{L("mouseenter")},ie=()=>{L("mouseleave")},re=()=>L("mousemove");return a.$$set=u=>{"lngLat"in u&&t(9,s=u.lngLat),"class"in u&&t(0,r=u.class),"interactive"in u&&t(10,i=u.interactive),"asButton"in u&&t(1,p=u.asButton),"draggable"in u&&t(11,w=u.draggable),"feature"in u&&t(12,B=u.feature),"offset"in u&&t(13,y=u.offset),"zIndex"in u&&t(2,d=u.zIndex),"$$scope"in u&&t(15,c=u.$$scope)},a.$$.update=()=>{a.$$.dirty&16896&&(n==null||n.setLngLat(s)),a.$$.dirty&24576&&(n==null||n.setOffset(y??[0,0]))},[r,p,d,N,A,m,_,z,L,s,i,w,B,y,n,c,f,b,k,le,oe,ie,re]}class je extends te{constructor(e){super(),ne(this,e,Pe,Ne,se,{lngLat:9,class:0,interactive:10,asButton:1,draggable:11,feature:12,offset:13,zIndex:2})}}const Ae=` +import{S as te,i as ne,s as se,G as fe,e as E,h as P,z as G,l as I,I as Q,q as O,J as ue,K as ce,N as pe,O as de,t as h,b as C,v as S,w as me,Q as ge,R as _e,T as U,U as V,m as be,L as he,c as D,f as j,a as q,d as J,o as we,H as Le,x as T,y as H,g as W,n as M,A as K,r as X,u as Y,M as ye,_ as ve,V as ae,j as $,D as Ce,E as ke,W as Me}from"./Legend-36db5a45.js";import{L as Be,C as ze,_ as Ee,J as Ie,a as Se,G as De}from"./Loading-a8d2f85e.js";import{S as qe,L as Je}from"./SidebarControls-5b3d2c73.js";function Ne(a){let e,t,l,n,o,f,c;const s=a[16].default,r=fe(s,a,a[15],null);return{c(){e=E("div"),r&&r.c(),P(e,"tabindex",t=a[1]?0:void 0),P(e,"role",l=a[1]?"button":void 0),G(e,"z-index",a[2])},m(i,p){I(i,e,p),r&&r.m(e,null),o=!0,f||(c=[Q(a[6].call(null,e)),Q(n=Oe.call(null,e,a[0])),O(e,"click",a[17]),O(e,"dblclick",a[18]),O(e,"contextmenu",a[19]),O(e,"mouseenter",a[20]),O(e,"mouseleave",a[21]),O(e,"mousemove",a[22]),O(e,"keydown",a[7])],f=!0)},p(i,[p]){r&&r.p&&(!o||p&32768)&&ue(r,s,i,i[15],o?pe(s,i[15],p,null):ce(i[15]),null),(!o||p&2&&t!==(t=i[1]?0:void 0))&&P(e,"tabindex",t),(!o||p&2&&l!==(l=i[1]?"button":void 0))&&P(e,"role",l),n&&de(n.update)&&p&1&&n.update.call(null,i[0]),p&4&&G(e,"z-index",i[2])},i(i){o||(h(r,i),o=!0)},o(i){C(r,i),o=!1},d(i){i&&S(e),r&&r.d(i),f=!1,me(c)}}}function Oe(a,e){const t=a.className;function l(n){n?a.className=`${t} ${n}`:a.className=t}return l(e),{update:l}}function Pe(a,e,t){let l,n,o,{$$slots:f={},$$scope:c}=e,{lngLat:s}=e,{class:r=void 0}=e,{interactive:i=!0}=e,{asButton:p=!1}=e,{draggable:w=!1}=e,{feature:B=null}=e,{offset:y=void 0}=e,{zIndex:d=void 0}=e;const v=ge(),{map:N,layerEvent:A,self:m}=_e();U(a,N,u=>t(24,o=u)),U(a,A,u=>t(23,l=u)),U(a,m,u=>t(14,n=u));function _(u){V(m,n=new be.Marker({element:u,draggable:w,offset:y}).setLngLat(s).addTo(o),n);const R=()=>L("dragstart"),F=()=>{g(),L("drag")},Z=()=>{g(),L("dragend")};return w&&(n.on("dragstart",R),n.on("drag",F),n.on("dragend",Z)),{destroy(){w&&(n==null||n.off("dragstart",R),n==null||n.off("drag",F),n==null||n.off("dragend",Z)),n==null||n.remove()}}}function g(){let u=n==null?void 0:n.getLngLat();u&&(Array.isArray(s)?t(9,s=[u.lng,u.lat]):s&&"lon"in s?t(9,s={lon:u.lng,lat:u.lat}):t(9,s=u))}function z(u){u.key===" "&&(u.preventDefault(),u.stopPropagation(),L("click"))}function L(u){if(!i)return;let R=n==null?void 0:n.getLngLat();if(!R)return;const F=[R.lng,R.lat];let Z={map:o,marker:n,lngLat:F,features:[{type:"Feature",properties:(B==null?void 0:B.properties)??{},geometry:{type:"Point",coordinates:F}}]};V(A,l={...Z,layerType:"marker",type:u},l),v(u,Z)}const b=()=>L("click"),k=()=>L("dblclick"),le=()=>L("contextmenu"),oe=u=>{L("mouseenter")},ie=()=>{L("mouseleave")},re=()=>L("mousemove");return a.$$set=u=>{"lngLat"in u&&t(9,s=u.lngLat),"class"in u&&t(0,r=u.class),"interactive"in u&&t(10,i=u.interactive),"asButton"in u&&t(1,p=u.asButton),"draggable"in u&&t(11,w=u.draggable),"feature"in u&&t(12,B=u.feature),"offset"in u&&t(13,y=u.offset),"zIndex"in u&&t(2,d=u.zIndex),"$$scope"in u&&t(15,c=u.$$scope)},a.$$.update=()=>{a.$$.dirty&16896&&(n==null||n.setLngLat(s)),a.$$.dirty&24576&&(n==null||n.setOffset(y??[0,0]))},[r,p,d,N,A,m,_,z,L,s,i,w,B,y,n,c,f,b,k,le,oe,ie,re]}class je extends te{constructor(e){super(),ne(this,e,Pe,Ne,se,{lngLat:9,class:0,interactive:10,asButton:1,draggable:11,feature:12,offset:13,zIndex:2})}}const Ae=` diff --git a/assets/x3-b502fe4b.js b/assets/x3-6481bdb1.js similarity index 99% rename from assets/x3-b502fe4b.js rename to assets/x3-6481bdb1.js index 945fc3f..de89d6b 100644 --- a/assets/x3-b502fe4b.js +++ b/assets/x3-6481bdb1.js @@ -1,4 +1,4 @@ -import{S as me,i as de,s as ge,ab as Z,e as g,f as q,z as E,l as h,E as se,v as w,ac as oe,g as G,n as k,a6 as he,L as we,c as N,a as j,t as v,b as C,d as B,o as ke,H as ye,x as V,y as te,h as K,q as x,A as ne,r as $e,u as be,M as ve,_ as Ce,$ as Se,a3 as A,ad as ie,C as Fe,j as Y,k as Le,p as ae,w as Ne,ae as ee,a0 as je,a9 as Be,aa as H,a2 as Me,a4 as Oe,a5 as qe}from"./Legend-36db5a45.js";import{L as Ee,C as Je,_ as Te,J as Ae,a as He,G as Pe}from"./Loading-65ee842b.js";function re(s,t,n){const e=s.slice();return e[2]=t[n],e}function fe(s,t,n){const e=s.slice();return e[5]=t[n],e}function pe(s){let t,n;return{c(){t=g("span"),n=G(`  +import{S as me,i as de,s as ge,ab as Z,e as g,f as q,z as E,l as h,E as se,v as w,ac as oe,g as G,n as k,a6 as he,L as we,c as N,a as j,t as v,b as C,d as B,o as ke,H as ye,x as V,y as te,h as K,q as x,A as ne,r as $e,u as be,M as ve,_ as Ce,$ as Se,a3 as A,ad as ie,C as Fe,j as Y,k as Le,p as ae,w as Ne,ae as ee,a0 as je,a9 as Be,aa as H,a2 as Me,a4 as Oe,a5 as qe}from"./Legend-36db5a45.js";import{L as Ee,C as Je,_ as Te,J as Ae,a as He,G as Pe}from"./Loading-a8d2f85e.js";function re(s,t,n){const e=s.slice();return e[2]=t[n],e}function fe(s,t,n){const e=s.slice();return e[5]=t[n],e}function pe(s){let t,n;return{c(){t=g("span"),n=G(`  `),E(t,"background",s[5]),E(t,"width","100%"),E(t,"border","1px solid black")},m(e,o){h(e,t,o),k(t,n)},p(e,o){o&1&&E(t,"background",e[5])},d(e){e&&w(t)}}}function ue(s){let t,n=s[2].toFixed(1)+"",e;return{c(){t=g("span"),e=G(n)},m(o,l){h(o,t,l),k(t,e)},p(o,l){l&2&&n!==(n=o[2].toFixed(1)+"")&&he(e,n)},d(o){o&&w(t)}}}function De(s){let t,n,e,o=Z(s[0]),l=[];for(let i=0;i{"colorScale"in l&&n(0,e=l.colorScale),"limits"in l&&n(1,o=l.limits)},[e,o]}class Ie extends me{constructor(t){super(),de(this,t,Ge,De,ge,{colorScale:0,limits:1})}}function ce(s){let t,n,e,o,l,p,r,i,c,a,_,$,S,F,J,M,P,m,d,O,L,I,D,R,z;const U=[ze,Re],T=[];function W(f,y){return f[5]=="lts"?0:1}_=W(s),$=T[_]=U[_](s);function u(f){s[21](f)}let b={};return s[1]!==void 0&&(b.cost=s[1]),L=new He({props:b}),V.push(()=>te(L,"cost",u)),{c(){t=g("hr"),n=q(),e=g("div"),o=g("label"),l=G(`Color edges by: `),p=g("select"),r=g("option"),r.textContent="LTS",i=g("option"),i.textContent="Edge cost (relative to length)",c=g("option"),c.textContent="Nearby amenities",a=q(),$.c(),S=q(),F=g("div"),J=g("label"),M=g("input"),P=G(` Show cyclists not allowed`),m=q(),d=g("hr"),O=q(),N(L.$$.fragment),r.__value="lts",Y(r,r.__value),i.__value="cost",Y(i,i.__value),c.__value="nearby_amenities",Y(c,c.__value),s[5]===void 0&&Le(()=>s[19].call(p)),K(M,"type","checkbox"),E(J,"color",A.lts_not_allowed)},m(f,y){h(f,t,y),h(f,n,y),h(f,e,y),k(e,o),k(o,l),k(o,p),k(p,r),k(p,i),k(p,c),ae(p,s[5],!0),h(f,a,y),T[_].m(f,y),h(f,S,y),h(f,F,y),k(F,J),k(J,M),M.checked=s[6],k(J,P),h(f,m,y),h(f,d,y),h(f,O,y),j(L,f,y),D=!0,R||(z=[x(p,"change",s[19]),x(M,"change",s[20])],R=!0)},p(f,y){y&32&&ae(p,f[5]);let X=_;_=W(f),_===X?T[_].p(f,y):($e(),C(T[X],1,1,()=>{T[X]=null}),be(),$=T[_],$?$.p(f,y):($=T[_]=U[_](f),$.c()),v($,1),$.m(S.parentNode,S)),y&64&&(M.checked=f[6]);const le={};!I&&y&2&&(I=!0,le.cost=f[1],ne(()=>I=!1)),L.$set(le)},i(f){D||(v($),v(L.$$.fragment,f),D=!0)},o(f){C($),C(L.$$.fragment,f),D=!1},d(f){f&&(w(t),w(n),w(e),w(a),w(S),w(F),w(m),w(d),w(O)),T[_].d(f),B(L,f),R=!1,Ne(z)}}}function Re(s){let t,n;return t=new Ie({props:{colorScale:ee,limits:Q(s[5],s[9],s[10])}}),{c(){N(t.$$.fragment)},m(e,o){j(t,e,o),n=!0},p(e,o){const l={};o&1568&&(l.limits=Q(e[5],e[9],e[10])),t.$set(l)},i(e){n||(v(t.$$.fragment,e),n=!0)},o(e){C(t.$$.fragment,e),n=!1},d(e){B(t,e)}}}function ze(s){let t,n,e,o;return t=new Be({props:{rows:[[`${H.lts1}: ${s[8][1].toFixed(0)}% of roads by distance`,A.lts1],[`${H.lts2}: ${s[8][2].toFixed(0)}%`,A.lts2],[`${H.lts3}: ${s[8][3].toFixed(0)}%`,A.lts3],[`${H.lts4}: ${s[8][4].toFixed(0)}%`,A.lts4]]}}),{c(){N(t.$$.fragment),n=q(),e=g("p"),e.innerHTML='Note: LTS model from BikeOttawa'},m(l,p){j(t,l,p),h(l,n,p),h(l,e,p),o=!0},p(l,p){const r={};p&256&&(r.rows=[[`${H.lts1}: ${l[8][1].toFixed(0)}% of roads by distance`,A.lts1],[`${H.lts2}: ${l[8][2].toFixed(0)}%`,A.lts2],[`${H.lts3}: ${l[8][3].toFixed(0)}%`,A.lts3],[`${H.lts4}: ${l[8][4].toFixed(0)}%`,A.lts4]]),t.$set(r)},i(l){o||(v(t.$$.fragment,l),o=!0)},o(l){C(t.$$.fragment,l),o=!1},d(l){l&&(w(n),w(e)),B(t,l)}}}function Ue(s){let t,n,e,o,l,p,r,i,c,a,_,$,S,F,J;n=new ye({props:{app:"costs"}});function M(d){s[18](d)}let P={};s[0]!==void 0&&(P.example=s[0]),a=new Je({props:P}),V.push(()=>te(a,"example",M));let m=s[3]&&ce(s);return{c(){t=g("div"),N(n.$$.fragment),e=q(),o=g("label"),l=G("Open an "),p=g("i"),p.textContent=".osm.pbf",r=G(` file diff --git a/edge_cost.html b/edge_cost.html index e9a584b..3a9035f 100644 --- a/edge_cost.html +++ b/edge_cost.html @@ -4,9 +4,9 @@ od2net edge cost mode - + - + diff --git a/interactive.html b/interactive.html index 58afdf6..b79d696 100644 --- a/interactive.html +++ b/interactive.html @@ -4,9 +4,9 @@ od2net interactive mode - + - +