@tomdraper/claude-usage 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +50 -0
- package/bin/claude-usage.js +3 -0
- package/dist/cli/index.js +591 -0
- package/dist/dashboard/assets/index-BI_JjCY6.css +2 -0
- package/dist/dashboard/assets/index-BtSpo2ZF.js +4 -0
- package/dist/dashboard/favicon.svg +16 -0
- package/dist/dashboard/index.html +20 -0
- package/package.json +54 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})(),typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`);var e={},t=Symbol(),n=`http://www.w3.org/1999/xhtml`,r=Array.isArray,i=Array.prototype.indexOf,a=Array.prototype.includes,o=Array.from,s=Object.defineProperty,c=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyDescriptors,u=Object.prototype,d=Array.prototype,f=Object.getPrototypeOf,p=Object.isExtensible,m=()=>{};function h(e){for(var t=0;t<e.length;t++)e[t]()}function g(){var e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function _(e,t){if(Array.isArray(e))return e;if(t===void 0||!(Symbol.iterator in e))return Array.from(e);let n=[];for(let r of e)if(n.push(r),n.length===t)break;return n}var v=1024,y=2048,b=4096,x=8192,S=16384,C=32768,w=1<<25,T=65536,E=1<<19,D=1<<20,ee=1<<25,te=65536,ne=1<<21,re=1<<22,ie=1<<23,ae=Symbol(`$state`),oe=Symbol(`legacy props`),se=Symbol(``),ce=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"},le=!!globalThis.document?.contentType&&globalThis.document.contentType.includes(`xml`);function ue(e){throw Error(`https://svelte.dev/e/lifecycle_outside_component`)}function de(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function fe(e,t,n){throw Error(`https://svelte.dev/e/each_key_duplicate`)}function pe(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function me(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function he(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function ge(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function _e(e){throw Error(`https://svelte.dev/e/props_invalid_value`)}function ve(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function ye(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function be(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function xe(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}function Se(){console.warn(`https://svelte.dev/e/derived_inert`)}function Ce(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function we(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var O=!1;function Te(e){O=e}var k;function Ee(t){if(t===null)throw Ce(),e;return k=t}function De(){return Ee(Yt(k))}function A(t){if(O){if(Yt(k)!==null)throw Ce(),e;k=t}}function Oe(e=1){if(O){for(var t=e,n=k;t--;)n=Yt(n);k=n}}function ke(e=!0){for(var t=0,n=k;;){if(n.nodeType===8){var r=n.data;if(r===`]`){if(t===0)return n;--t}else (r===`[`||r===`[!`||r[0]===`[`&&!isNaN(Number(r.slice(1))))&&(t+=1)}var i=Yt(n);e&&n.remove(),n=i}}function Ae(t){if(!t||t.nodeType!==8)throw Ce(),e;return t.data}function je(e){return e===this.v}function Me(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function Ne(e){return!Me(e,this.v)}var Pe=!1,Fe=!1,j=null;function Ie(e){j=e}function Le(e,t=!1,n){j={p:j,i:!1,c:null,e:null,s:e,x:null,r:B,l:Fe&&!t?{s:null,u:null,$:[]}:null}}function Re(e){var t=j,n=t.e;if(n!==null){t.e=null;for(var r of n)ln(r)}return e!==void 0&&(t.x=e),t.i=!0,j=t.p,e??{}}function ze(){return!Fe||j!==null&&j.l===null}var Be=[];function Ve(){var e=Be;Be=[],h(e)}function He(e){if(Be.length===0&&!tt){var t=Be;queueMicrotask(()=>{t===Be&&Ve()})}Be.push(e)}function Ue(e){var t=B;if(t===null)return z.f|=ie,e;if(!(t.f&32768)&&!(t.f&4))throw e;We(e,t)}function We(e,t){for(;t!==null;){if(t.f&128){if(!(t.f&32768))throw e;try{t.b.error(e);return}catch(t){e=t}}t=t.parent}throw e}var Ge=~(y|b|v);function M(e,t){e.f=e.f&Ge|t}function Ke(e){e.f&512||e.deps===null?M(e,v):M(e,b)}function qe(e){if(e!==null)for(let t of e)!(t.f&2)||!(t.f&65536)||(t.f^=te,qe(t.deps))}function Je(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),qe(e.deps),M(e,v)}var Ye=!1,Xe=!1;function Ze(e){var t=Xe;try{return Xe=!1,[e(),Xe]}finally{Xe=t}}var Qe=new Set,N=null,$e=null,et=null,tt=!1,nt=!1,rt=null,it=null,at=0,ot=1,st=class e{id=ot++;current=new Map;previous=new Map;#e=new Set;#t=new Set;#n=new Set;#r=new Map;#i=new Map;#a=null;#o=[];#s=[];#c=new Set;#l=new Set;#u=new Map;#d=new Set;is_fork=!1;#f=!1;#p=new Set;#m(){return this.is_fork||this.#i.size>0}#h(){for(let n of this.#p)for(let r of n.#i.keys()){for(var e=!1,t=r;t.parent!==null;){if(this.#u.has(t)){e=!0;break}t=t.parent}if(!e)return!0}return!1}skip_effect(e){this.#u.has(e)||this.#u.set(e,{d:[],m:[]}),this.#d.delete(e)}unskip_effect(e,t=e=>this.schedule(e)){var n=this.#u.get(e);if(n){this.#u.delete(e);for(var r of n.d)M(r,y),t(r);for(r of n.m)M(r,b),t(r)}this.#d.add(e)}#g(){if(at++>1e3&&(Qe.delete(this),ct()),!this.#m()){for(let e of this.#c)this.#l.delete(e),M(e,y),this.schedule(e);for(let e of this.#l)M(e,b),this.schedule(e)}let t=this.#o;this.#o=[],this.apply();var n=rt=[],r=[],i=it=[];for(let e of t)try{this.#_(e,n,r)}catch(t){throw ht(e),t}if(N=null,i.length>0){var a=e.ensure();for(let e of i)a.schedule(e)}if(rt=null,it=null,this.#m()||this.#h()){this.#v(r),this.#v(n);for(let[e,t]of this.#u)mt(e,t)}else{this.#r.size===0&&Qe.delete(this),this.#c.clear(),this.#l.clear();for(let e of this.#e)e(this);this.#e.clear(),ut(r),ut(n),this.#a?.resolve()}var o=N;if(this.#o.length>0){let e=o??=this;e.#o.push(...this.#o.filter(t=>!e.#o.includes(t)))}o!==null&&(Qe.add(o),o.#g()),Pe&&!Qe.has(this)&&this.#y()}#_(e,t,n){e.f^=v;for(var r=e.first;r!==null;){var i=r.f,a=(i&96)!=0;if(!(a&&i&1024||i&8192||this.#u.has(r))&&r.fn!==null){a?r.f^=v:i&4?t.push(r):Pe&&i&16777224?n.push(r):Kn(r)&&(i&16&&this.#l.add(r),Zn(r));var o=r.first;if(o!==null){r=o;continue}}for(;r!==null;){var s=r.next;if(s!==null){r=s;break}r=r.parent}}}#v(e){for(var t=0;t<e.length;t+=1)Je(e[t],this.#c,this.#l)}capture(e,n,r=!1){e.v!==t&&!this.previous.has(e)&&this.previous.set(e,e.v),e.f&8388608||(this.current.set(e,[n,r]),$e?.set(e,n)),this.is_fork||(e.v=n)}activate(){N=this}deactivate(){N=null,$e=null}flush(){try{nt=!0,N=this,this.#g()}finally{at=0,et=null,rt=null,it=null,nt=!1,N=null,$e=null,Nt.clear()}}discard(){for(let e of this.#t)e(this);this.#t.clear(),this.#n.clear(),Qe.delete(this)}register_created_effect(e){this.#s.push(e)}#y(){for(let l of Qe){var e=l.id<this.id,t=[];for(let[r,[i,a]]of this.current){if(l.current.has(r)){var n=l.current.get(r)[0];if(e&&i!==n)l.current.set(r,[i,a]);else continue}t.push(r)}var r=[...l.current.keys()].filter(e=>!this.current.has(e));if(r.length===0)e&&l.discard();else if(t.length>0){if(e)for(let e of this.#d)l.unskip_effect(e,e=>{e.f&4194320?l.schedule(e):l.#v([e])});l.activate();var i=new Set,a=new Map;for(var o of t)dt(o,r,i,a);a=new Map;var s=[...l.current.keys()].filter(e=>this.current.has(e)?this.current.get(e)[0]!==e:!0);for(let e of this.#s)!(e.f&155648)&&ft(e,s,a)&&(e.f&4194320?(M(e,y),l.schedule(e)):l.#c.add(e));if(l.#o.length>0){l.apply();for(var c of l.#o)l.#_(c,[],[]);l.#o=[]}l.deactivate()}}for(let e of Qe)e.#p.has(this)&&(e.#p.delete(this),e.#p.size===0&&!e.#m()&&(e.activate(),e.#g()))}increment(e,t){let n=this.#r.get(t)??0;if(this.#r.set(t,n+1),e){let e=this.#i.get(t)??0;this.#i.set(t,e+1)}}decrement(e,t,n){let r=this.#r.get(t)??0;if(r===1?this.#r.delete(t):this.#r.set(t,r-1),e){let e=this.#i.get(t)??0;e===1?this.#i.delete(t):this.#i.set(t,e-1)}this.#f||n||(this.#f=!0,He(()=>{this.#f=!1,this.flush()}))}transfer_effects(e,t){for(let t of e)this.#c.add(t);for(let e of t)this.#l.add(e);e.clear(),t.clear()}oncommit(e){this.#e.add(e)}ondiscard(e){this.#t.add(e)}on_fork_commit(e){this.#n.add(e)}run_fork_commit_callbacks(){for(let e of this.#n)e(this);this.#n.clear()}settled(){return(this.#a??=g()).promise}static ensure(){if(N===null){let t=N=new e;nt||(Qe.add(N),tt||He(()=>{N===t&&t.flush()}))}return N}apply(){if(!Pe||!this.is_fork&&Qe.size===1){$e=null;return}$e=new Map;for(let[e,[t]]of this.current)$e.set(e,t);for(let n of Qe)if(!(n===this||n.is_fork)){var e=!1,t=!1;if(n.id<this.id)for(let[r,[,i]]of n.current)i||(e||=this.current.has(r),t||=!this.current.has(r));if(e&&t)this.#p.add(n);else for(let[e,t]of n.previous)$e.has(e)||$e.set(e,t)}}schedule(e){if(et=e,e.b?.is_pending&&e.f&16777228&&!(e.f&32768)){e.b.defer_effect(e);return}for(var t=e;t.parent!==null;){t=t.parent;var n=t.f;if(rt!==null&&t===B&&(Pe||(z===null||!(z.f&2))&&!Ye))return;if(n&96){if(!(n&1024))return;t.f^=v}}this.#o.push(t)}};function ct(){try{ge()}catch(e){We(e,et)}}var lt=null;function ut(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if(!(r.f&24576)&&Kn(r)&&(lt=new Set,Zn(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&Sn(r),lt?.size>0)){Nt.clear();for(let e of lt){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)lt.has(n)&&(lt.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||Zn(n)}}lt.clear()}}lt=null}}function dt(e,t,n,r){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(let i of e.reactions){let e=i.f;e&2?dt(i,t,n,r):e&4194320&&!(e&2048)&&ft(i,t,r)&&(M(i,y),pt(i))}}function ft(e,t,n){let r=n.get(e);if(r!==void 0)return r;if(e.deps!==null)for(let r of e.deps){if(a.call(t,r))return!0;if(r.f&2&&ft(r,t,n))return n.set(r,!0),!0}return n.set(e,!1),!1}function pt(e){N.schedule(e)}function mt(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),M(e,v);for(var n=e.first;n!==null;)mt(n,t),n=n.next}}function ht(e){M(e,v);for(var t=e.first;t!==null;)ht(t),t=t.next}function gt(e){let t=0,n=Ft(0),r;return()=>{on()&&(V(n),pn(()=>(t===0&&(r=er(()=>e(()=>zt(n)))),t+=1,()=>{He(()=>{--t,t===0&&(r?.(),r=void 0,zt(n))})})))}}var _t=T|E;function vt(e,t,n,r){new yt(e,t,n,r)}var yt=class{parent;is_pending=!1;transform_error;#e;#t=O?k:null;#n;#r;#i;#a=null;#o=null;#s=null;#c=null;#l=0;#u=0;#d=!1;#f=new Set;#p=new Set;#m=null;#h=gt(()=>(this.#m=Ft(this.#l),()=>{this.#m=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=B;t.b=this,t.f|=128,n(e)},this.parent=B.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=hn(()=>{if(O){let e=this.#t;De();let t=e.data===`[!`;if(e.data.startsWith(`[?`)){let t=JSON.parse(e.data.slice(2));this.#_(t)}else t?this.#v():this.#g()}else this.#y()},_t),O&&(this.#e=k)}#g(){try{this.#a=gn(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed;t&&(this.#s=gn(()=>{t(this.#e,()=>e,()=>()=>{})}))}#v(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=gn(()=>e(this.#e)),He(()=>{var e=this.#c=document.createDocumentFragment(),t=qt();e.append(t),this.#a=this.#x(()=>gn(()=>this.#r(t))),this.#u===0&&(this.#e.before(e),this.#c=null,Cn(this.#o,()=>{this.#o=null}),this.#b(N))}))}#y(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=gn(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();Dn(this.#a,e);let t=this.#n.pending;this.#o=gn(()=>t(this.#e))}else this.#b(N)}catch(e){this.error(e)}}#b(e){this.is_pending=!1,e.transfer_effects(this.#f,this.#p)}defer_effect(e){Je(e,this.#f,this.#p)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#n.pending}#x(e){var t=B,n=z,r=j;Pn(this.#i),Nn(this.#i),Ie(this.#i.ctx);try{return st.ensure(),e()}catch(e){return Ue(e),null}finally{Pn(t),Nn(n),Ie(r)}}#S(e,t){if(!this.has_pending_snippet()){this.parent&&this.parent.#S(e,t);return}this.#u+=e,this.#u===0&&(this.#b(t),this.#o&&Cn(this.#o,()=>{this.#o=null}),this.#c&&=(this.#e.before(this.#c),null))}update_pending_count(e,t){this.#S(e,t),this.#l+=e,!(!this.#m||this.#d)&&(this.#d=!0,He(()=>{this.#d=!1,this.#m&&Lt(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),V(this.#m)}error(e){if(!this.#n.onerror&&!this.#n.failed)throw e;N?.is_fork?(this.#a&&N.skip_effect(this.#a),this.#o&&N.skip_effect(this.#o),this.#s&&N.skip_effect(this.#s),N.on_fork_commit(()=>{this.#C(e)})):this.#C(e)}#C(e){this.#a&&=(bn(this.#a),null),this.#o&&=(bn(this.#o),null),this.#s&&=(bn(this.#s),null),O&&(Ee(this.#t),Oe(),Ee(ke()));var t=this.#n.onerror;let n=this.#n.failed;var r=!1,i=!1;let a=()=>{if(r){we();return}r=!0,i&&xe(),this.#s!==null&&Cn(this.#s,()=>{this.#s=null}),this.#x(()=>{this.#y()})},o=e=>{try{i=!0,t?.(e,a),i=!1}catch(e){We(e,this.#i&&this.#i.parent)}n&&(this.#s=this.#x(()=>{try{return gn(()=>{var t=B;t.b=this,t.f|=128,n(this.#e,()=>e,()=>a)})}catch(e){return We(e,this.#i.parent),null}}))};He(()=>{var t;try{t=this.transform_error(e)}catch(e){We(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(o,e=>We(e,this.#i&&this.#i.parent)):o(t)})}};function bt(e,t,n,r){let i=ze()?wt:Et;var a=e.filter(e=>!e.settled);if(n.length===0&&a.length===0){r(t.map(i));return}var o=B,s=xt(),c=a.length===1?a[0].promise:a.length>1?Promise.all(a.map(e=>e.promise)):null;function l(e){s();try{r(e)}catch(e){o.f&16384||We(e,o)}St()}if(n.length===0){c.then(()=>l(t.map(i)));return}var u=Ct();function d(){Promise.all(n.map(e=>Tt(e))).then(e=>l([...t.map(i),...e])).catch(e=>We(e,o)).finally(()=>u())}c?c.then(()=>{s(),d(),St()}):d()}function xt(){var e=B,t=z,n=j,r=N;return function(i=!0){Pn(e),Nn(t),Ie(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function St(e=!0){Pn(null),Nn(null),Ie(null),e&&N?.deactivate()}function Ct(){var e=B,t=e.b,n=N,r=t.is_rendered();return t.update_pending_count(1,n),n.increment(r,e),(i=!1)=>{t.update_pending_count(-1,n),n.decrement(r,e,i)}}function wt(e){var n=2|y;return B!==null&&(B.f|=E),{ctx:j,deps:null,effects:null,equals:je,f:n,fn:e,reactions:null,rv:0,v:t,wv:0,parent:B,ac:null}}function Tt(e,n,r){let i=B;i===null&&de();var a=void 0,o=Ft(t),s=!z,c=new Map;return fn(()=>{var t=B,n=g();a=n.promise;try{Promise.resolve(e()).then(n.resolve,n.reject).finally(St)}catch(e){n.reject(e),St()}var r=N;if(s){if(t.f&32768)var l=Ct();if(i.b.is_rendered())c.get(r)?.reject(ce),c.delete(r);else{for(let e of c.values())e.reject(ce);c.clear()}c.set(r,n)}let u=(e,n=void 0)=>{if(l&&l(n===ce),!(n===ce||t.f&16384)){if(r.activate(),n)o.f|=ie,Lt(o,n);else{o.f&8388608&&(o.f^=ie),Lt(o,e);for(let[e,t]of c){if(c.delete(e),e===r)break;t.reject(ce)}}r.deactivate()}};n.promise.then(u,e=>u(null,e||`unknown`))}),sn(()=>{for(let e of c.values())e.reject(ce)}),new Promise(e=>{function t(n){function r(){n===a?e(o):t(a)}n.then(r,r)}t(a)})}function P(e){let t=wt(e);return Pe||In(t),t}function Et(e){let t=wt(e);return t.equals=Ne,t}function Dt(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)bn(t[n])}}function Ot(e){var t,n=B,r=e.parent;if(!An&&r!==null&&r.f&24576)return Se(),e.v;Pn(r);try{e.f&=~te,Dt(e),t=Jn(e)}finally{Pn(n)}return t}function kt(e){var t=Ot(e);if(!e.equals(t)&&(e.wv=Gn(),(!N?.is_fork||e.deps===null)&&(N===null?e.v=t:N.capture(e,t,!0),e.deps===null))){M(e,v);return}An||($e===null?Ke(e):(on()||N?.is_fork)&&$e.set(e,t))}function At(e){if(e.effects!==null)for(let t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac?.abort(ce),t.teardown=m,t.ac=null,Xn(t,0),vn(t))}function jt(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&Zn(t)}var Mt=new Set,Nt=new Map,Pt=!1;function Ft(e,t){return{f:0,v:e,reactions:null,equals:je,rv:0,wv:0}}function F(e,t){let n=Ft(e,t);return In(n),n}function It(e,t=!1,n=!0){let r=Ft(e);return t||(r.equals=Ne),Fe&&n&&j!==null&&j.l!==null&&(j.l.s??=[]).push(r),r}function I(e,t,n=!1){return z!==null&&(!Mn||z.f&131072)&&ze()&&z.f&4325394&&(Fn===null||!a.call(Fn,e))&&be(),Lt(e,n?Vt(t):t,it)}function Lt(e,t,n=null){if(!e.equals(t)){Nt.set(e,An?t:e.v);var r=st.ensure();if(r.capture(e,t),e.f&2){let t=e;e.f&2048&&Ot(t),$e===null&&Ke(t)}e.wv=Gn(),Bt(e,y,n),ze()&&B!==null&&B.f&1024&&!(B.f&96)&&(zn===null?Bn([e]):zn.push(e)),!r.is_fork&&Mt.size>0&&!Pt&&Rt()}return t}function Rt(){Pt=!1;for(let e of Mt)e.f&1024&&M(e,b),Kn(e)&&Zn(e);Mt.clear()}function zt(e){I(e,e.v+1)}function Bt(e,t,n){var r=e.reactions;if(r!==null)for(var i=ze(),a=r.length,o=0;o<a;o++){var s=r[o],c=s.f;if(!(!i&&s===B)){var l=(c&y)===0;if(l&&M(s,t),c&2){var u=s;$e?.delete(u),c&65536||(c&512&&(B===null||!(B.f&2097152))&&(s.f|=te),Bt(u,b,n))}else if(l){var d=s;c&16&<!==null&<.add(d),n===null?pt(d):n.push(d)}}}}function Vt(e){if(typeof e!=`object`||!e||ae in e)return e;let n=f(e);if(n!==u&&n!==d)return e;var i=new Map,a=r(e),o=F(0),s=null,l=Un,p=e=>{if(Un===l)return e();var t=z,n=Un;Nn(null),Wn(l);var r=e();return Nn(t),Wn(n),r};return a&&i.set(`length`,F(e.length,s)),new Proxy(e,{defineProperty(e,t,n){(!(`value`in n)||n.configurable===!1||n.enumerable===!1||n.writable===!1)&&ve();var r=i.get(t);return r===void 0?p(()=>{var e=F(n.value,s);return i.set(t,e),e}):I(r,n.value,!0),!0},deleteProperty(e,n){var r=i.get(n);if(r===void 0){if(n in e){let e=p(()=>F(t,s));i.set(n,e),zt(o)}}else I(r,t),zt(o);return!0},get(n,r,a){if(r===ae)return e;var o=i.get(r),l=r in n;if(o===void 0&&(!l||c(n,r)?.writable)&&(o=p(()=>F(Vt(l?n[r]:t),s)),i.set(r,o)),o!==void 0){var u=V(o);return u===t?void 0:u}return Reflect.get(n,r,a)},getOwnPropertyDescriptor(e,n){var r=Reflect.getOwnPropertyDescriptor(e,n);if(r&&`value`in r){var a=i.get(n);a&&(r.value=V(a))}else if(r===void 0){var o=i.get(n),s=o?.v;if(o!==void 0&&s!==t)return{enumerable:!0,configurable:!0,value:s,writable:!0}}return r},has(e,n){if(n===ae)return!0;var r=i.get(n),a=r!==void 0&&r.v!==t||Reflect.has(e,n);return(r!==void 0||B!==null&&(!a||c(e,n)?.writable))&&(r===void 0&&(r=p(()=>F(a?Vt(e[n]):t,s)),i.set(n,r)),V(r)===t)?!1:a},set(e,n,r,l){var u=i.get(n),d=n in e;if(a&&n===`length`)for(var f=r;f<u.v;f+=1){var m=i.get(f+``);m===void 0?f in e&&(m=p(()=>F(t,s)),i.set(f+``,m)):I(m,t)}if(u===void 0)(!d||c(e,n)?.writable)&&(u=p(()=>F(void 0,s)),I(u,Vt(r)),i.set(n,u));else{d=u.v!==t;var h=p(()=>Vt(r));I(u,h)}var g=Reflect.getOwnPropertyDescriptor(e,n);if(g?.set&&g.set.call(l,r),!d){if(a&&typeof n==`string`){var _=i.get(`length`),v=Number(n);Number.isInteger(v)&&v>=_.v&&I(_,v+1)}zt(o)}return!0},ownKeys(e){V(o);var n=Reflect.ownKeys(e).filter(e=>{var n=i.get(e);return n===void 0||n.v!==t});for(var[r,a]of i)a.v!==t&&!(r in e)&&n.push(r);return n},setPrototypeOf(){ye()}})}var Ht,Ut,Wt,Gt;function Kt(){if(Ht===void 0){Ht=window,Ut=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;Wt=c(t,`firstChild`).get,Gt=c(t,`nextSibling`).get,p(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),p(n)&&(n.__t=void 0)}}function qt(e=``){return document.createTextNode(e)}function Jt(e){return Wt.call(e)}function Yt(e){return Gt.call(e)}function L(e,t){if(!O)return Jt(e);var n=Jt(k);if(n===null)n=k.appendChild(qt());else if(t&&n.nodeType!==3){var r=qt();return n?.before(r),Ee(r),r}return t&&en(n),Ee(n),n}function Xt(e,t=!1){if(!O){var n=Jt(e);return n instanceof Comment&&n.data===``?Yt(n):n}if(t){if(k?.nodeType!==3){var r=qt();return k?.before(r),Ee(r),r}en(k)}return k}function R(e,t=1,n=!1){let r=O?k:e;for(var i;t--;)i=r,r=Yt(r);if(!O)return r;if(n){if(r?.nodeType!==3){var a=qt();return r===null?i?.after(a):r.before(a),Ee(a),a}en(r)}return Ee(r),r}function Zt(e){e.textContent=``}function Qt(){return!Pe||lt!==null?!1:(B.f&C)!==0}function $t(e,t,n){let r=n?{is:n}:void 0;return document.createElementNS(t??`http://www.w3.org/1999/xhtml`,e,r)}function en(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===3;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function tn(e){var t=z,n=B;Nn(null),Pn(null);try{return e()}finally{Nn(t),Pn(n)}}function nn(e){B===null&&(z===null&&he(e),me()),An&&pe(e)}function rn(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function an(e,t){var n=B;n!==null&&n.f&8192&&(e|=x);var r={ctx:j,deps:null,nodes:null,f:e|y|512,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};N?.register_created_effect(r);var i=r;if(e&4)rt===null?st.ensure().schedule(r):rt.push(r);else if(t!==null){try{Zn(r)}catch(e){throw bn(r),e}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&!(i.f&524288)&&(i=i.first,e&16&&e&65536&&i!==null&&(i.f|=T))}if(i!==null&&(i.parent=n,n!==null&&rn(i,n),z!==null&&z.f&2&&!(e&64))){var a=z;(a.effects??=[]).push(i)}return r}function on(){return z!==null&&!Mn}function sn(e){let t=an(8,null);return M(t,v),t.teardown=e,t}function cn(e){nn(`$effect`);var t=B.f;if(!z&&t&32&&!(t&32768)){var n=j;(n.e??=[]).push(e)}else return ln(e)}function ln(e){return an(4|D,e)}function un(e){st.ensure();let t=an(64|E,e);return(e={})=>new Promise(n=>{e.outro?Cn(t,()=>{bn(t),n(void 0)}):(bn(t),n(void 0))})}function dn(e){return an(4,e)}function fn(e){return an(re|E,e)}function pn(e,t=0){return an(8|t,e)}function mn(e,t=[],n=[],r=[]){bt(r,t,n,t=>{an(8,()=>e(...t.map(V)))})}function hn(e,t=0){return an(16|t,e)}function gn(e){return an(32|E,e)}function _n(e){var t=e.teardown;if(t!==null){let e=An,n=z;jn(!0),Nn(null);try{t.call(null)}finally{jn(e),Nn(n)}}}function vn(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&tn(()=>{e.abort(ce)});var r=n.next;n.f&64?n.parent=null:bn(n,t),n=r}}function yn(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||bn(t),t=n}}function bn(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(xn(e.nodes.start,e.nodes.end),n=!0),M(e,w),vn(e,t&&!n),Xn(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();_n(e),e.f^=w,e.f|=S;var i=e.parent;i!==null&&i.first!==null&&Sn(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function xn(e,t){for(;e!==null;){var n=e===t?null:Yt(e);e.remove(),e=n}}function Sn(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function Cn(e,t,n=!0){var r=[];wn(e,r,!0);var i=()=>{n&&bn(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function wn(e,t,n){if(!(e.f&8192)){e.f^=x;var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)(e.is_global||n)&&t.push(e);for(var i=e.first;i!==null;){var a=i.next;if(!(i.f&64)){var o=(i.f&65536)!=0||(i.f&32)!=0&&(e.f&16)!=0;wn(i,t,o?n:!1)}i=a}}}function Tn(e){En(e,!0)}function En(e,t){if(e.f&8192){e.f^=x,e.f&1024||(M(e,y),st.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=(n.f&65536)!=0||(n.f&32)!=0;En(n,i?t:!1),n=r}var a=e.nodes&&e.nodes.t;if(a!==null)for(let e of a)(e.is_global||t)&&e.in()}}function Dn(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:Yt(n);t.append(n),n=i}}var On=null,kn=!1,An=!1;function jn(e){An=e}var z=null,Mn=!1;function Nn(e){z=e}var B=null;function Pn(e){B=e}var Fn=null;function In(e){z!==null&&(!Pe||z.f&2)&&(Fn===null?Fn=[e]:Fn.push(e))}var Ln=null,Rn=0,zn=null;function Bn(e){zn=e}var Vn=1,Hn=0,Un=Hn;function Wn(e){Un=e}function Gn(){return++Vn}function Kn(e){var t=e.f;if(t&2048)return!0;if(t&2&&(e.f&=~te),t&4096){for(var n=e.deps,r=n.length,i=0;i<r;i++){var a=n[i];if(Kn(a)&&kt(a),a.wv>e.wv)return!0}t&512&&$e===null&&M(e,v)}return!1}function qn(e,t,n=!0){var r=e.reactions;if(r!==null&&!(!Pe&&Fn!==null&&a.call(Fn,e)))for(var i=0;i<r.length;i++){var o=r[i];o.f&2?qn(o,t,!1):t===o&&(n?M(o,y):o.f&1024&&M(o,b),pt(o))}}function Jn(e){var t=Ln,n=Rn,r=zn,i=z,a=Fn,o=j,s=Mn,c=Un,l=e.f;Ln=null,Rn=0,zn=null,z=l&96?null:e,Fn=null,Ie(e.ctx),Mn=!1,Un=++Hn,e.ac!==null&&(tn(()=>{e.ac.abort(ce)}),e.ac=null);try{e.f|=ne;var u=e.fn,d=u();e.f|=C;var f=e.deps,p=N?.is_fork;if(Ln!==null){var m;if(p||Xn(e,Rn),f!==null&&Rn>0)for(f.length=Rn+Ln.length,m=0;m<Ln.length;m++)f[Rn+m]=Ln[m];else e.deps=f=Ln;if(on()&&e.f&512)for(m=Rn;m<f.length;m++)(f[m].reactions??=[]).push(e)}else !p&&f!==null&&Rn<f.length&&(Xn(e,Rn),f.length=Rn);if(ze()&&zn!==null&&!Mn&&f!==null&&!(e.f&6146))for(m=0;m<zn.length;m++)qn(zn[m],e);if(i!==null&&i!==e){if(Hn++,i.deps!==null)for(let e=0;e<n;e+=1)i.deps[e].rv=Hn;if(t!==null)for(let e of t)e.rv=Hn;zn!==null&&(r===null?r=zn:r.push(...zn))}return e.f&8388608&&(e.f^=ie),d}catch(e){return Ue(e)}finally{e.f^=ne,Ln=t,Rn=n,zn=r,z=i,Fn=a,Ie(o),Mn=s,Un=c}}function Yn(e,n){let r=n.reactions;if(r!==null){var o=i.call(r,e);if(o!==-1){var s=r.length-1;s===0?r=n.reactions=null:(r[o]=r[s],r.pop())}}if(r===null&&n.f&2&&(Ln===null||!a.call(Ln,n))){var c=n;c.f&512&&(c.f^=512,c.f&=~te),c.v!==t&&Ke(c),At(c),Xn(c,0)}}function Xn(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)Yn(e,n[r])}function Zn(e){var t=e.f;if(!(t&16384)){M(e,v);var n=B,r=kn;B=e,kn=!0;try{t&16777232?yn(e):vn(e),_n(e);var i=Jn(e);e.teardown=typeof i==`function`?i:null,e.wv=Vn}finally{kn=r,B=n}}}function V(e){var t=(e.f&2)!=0;if(On?.add(e),z!==null&&!Mn&&!(B!==null&&B.f&16384)&&(Fn===null||!a.call(Fn,e))){var n=z.deps;if(z.f&2097152)e.rv<Hn&&(e.rv=Hn,Ln===null&&n!==null&&n[Rn]===e?Rn++:Ln===null?Ln=[e]:Ln.push(e));else{(z.deps??=[]).push(e);var r=e.reactions;r===null?e.reactions=[z]:a.call(r,z)||r.push(z)}}if(An&&Nt.has(e))return Nt.get(e);if(t){var i=e;if(An){var o=i.v;return(!(i.f&1024)&&i.reactions!==null||$n(i))&&(o=Ot(i)),Nt.set(i,o),o}var s=(i.f&512)==0&&!Mn&&z!==null&&(kn||(z.f&512)!=0),c=(i.f&C)===0;Kn(i)&&(s&&(i.f|=512),kt(i)),s&&!c&&(jt(i),Qn(i))}if($e?.has(e))return $e.get(e);if(e.f&8388608)throw e.v;return e.v}function Qn(e){if(e.f|=512,e.deps!==null)for(let t of e.deps)(t.reactions??=[]).push(e),t.f&2&&!(t.f&512)&&(jt(t),Qn(t))}function $n(e){if(e.v===t)return!0;if(e.deps===null)return!1;for(let t of e.deps)if(Nt.has(t)||t.f&2&&$n(t))return!0;return!1}function er(e){var t=Mn;try{return Mn=!0,e()}finally{Mn=t}}var tr=Symbol(`events`),nr=new Set,rr=new Set;function ir(e,t,n,r={}){function i(e){if(r.capture||lr.call(t,e),!e.cancelBubble)return tn(()=>n?.call(this,e))}return e.startsWith(`pointer`)||e.startsWith(`touch`)||e===`wheel`?He(()=>{t.addEventListener(e,i,r)}):t.addEventListener(e,i,r),i}function ar(e,t,n,r,i){var a={capture:r,passive:i},o=ir(e,t,n,a);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&sn(()=>{t.removeEventListener(e,o,a)})}function or(e,t,n){(t[tr]??={})[e]=n}function sr(e){for(var t=0;t<e.length;t++)nr.add(e[t]);for(var n of rr)n(e)}var cr=null;function lr(e){var t=this,n=t.ownerDocument,r=e.type,i=e.composedPath?.()||[],a=i[0]||e.target;cr=e;var o=0,c=cr===e&&e[tr];if(c){var l=i.indexOf(c);if(l!==-1&&(t===document||t===window)){e[tr]=t;return}var u=i.indexOf(t);if(u===-1)return;l<=u&&(o=l)}if(a=i[o]||e.target,a!==t){s(e,`currentTarget`,{configurable:!0,get(){return a||n}});var d=z,f=B;Nn(null),Pn(null);try{for(var p,m=[];a!==null;){var h=a.assignedSlot||a.parentNode||a.host||null;try{var g=a[tr]?.[r];g!=null&&(!a.disabled||e.target===a)&&g.call(a,e)}catch(e){p?m.push(e):p=e}if(e.cancelBubble||h===t||h===null)break;a=h}if(p){for(let e of m)queueMicrotask(()=>{throw e});throw p}}finally{e[tr]=t,delete e.currentTarget,Nn(d),Pn(f)}}}var ur=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function dr(e){return ur?.createHTML(e)??e}function fr(e){var t=$t(`template`);return t.innerHTML=dr(e.replaceAll(`<!>`,`<!---->`)),t.content}function pr(e,t){var n=B;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function H(e,t){var n=(t&1)!=0,r=(t&2)!=0,i,a=!e.startsWith(`<!>`);return()=>{if(O)return pr(k,null),k;i===void 0&&(i=fr(a?e:`<!>`+e),n||(i=Jt(i)));var t=r||Ut?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=Jt(t),s=t.lastChild;pr(o,s)}else pr(t,t);return t}}function mr(e,t,n=`svg`){var r=!e.startsWith(`<!>`),i=(t&1)!=0,a=`<${n}>${r?e:`<!>`+e}</${n}>`,o;return()=>{if(O)return pr(k,null),k;if(!o){var e=Jt(fr(a));if(i)for(o=document.createDocumentFragment();Jt(e);)o.appendChild(Jt(e));else o=Jt(e)}var t=o.cloneNode(!0);if(i){var n=Jt(t),r=t.lastChild;pr(n,r)}else pr(t,t);return t}}function hr(e,t){return mr(e,t,`svg`)}function gr(){if(O)return pr(k,null),k;var e=document.createDocumentFragment(),t=document.createComment(``),n=qt();return e.append(t,n),pr(t,n),e}function U(e,t){if(O){var n=B;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=k),De();return}e!==null&&e.before(t)}[...`allowfullscreen.async.autofocus.autoplay.checked.controls.default.disabled.formnovalidate.indeterminate.inert.ismap.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.seamless.selected.webkitdirectory.defer.disablepictureinpicture.disableremoteplayback`.split(`.`)];var _r=[`touchstart`,`touchmove`];function vr(e){return _r.includes(e)}function W(e,t){var n=t==null?``:typeof t==`object`?`${t}`:t;n!==(e.__t??=e.nodeValue)&&(e.__t=n,e.nodeValue=`${n}`)}function yr(e,t){return xr(e,t)}var br=new Map;function xr(t,{target:n,anchor:r,props:i={},events:a,context:s,intro:c=!0,transformError:l}){Kt();var u=void 0,d=un(()=>{var c=r??n.appendChild(qt());vt(c,{pending:()=>{}},n=>{Le({});var r=j;if(s&&(r.c=s),a&&(i.$$events=a),O&&pr(n,null),u=t(n,i)||{},O&&(B.nodes.end=k,k===null||k.nodeType!==8||k.data!==`]`))throw Ce(),e;Re()},l);var d=new Set,f=e=>{for(var t=0;t<e.length;t++){var r=e[t];if(!d.has(r)){d.add(r);var i=vr(r);for(let e of[n,document]){var a=br.get(e);a===void 0&&(a=new Map,br.set(e,a));var o=a.get(r);o===void 0?(e.addEventListener(r,lr,{passive:i}),a.set(r,1)):a.set(r,o+1)}}}};return f(o(nr)),rr.add(f),()=>{for(var e of d)for(let r of[n,document]){var t=br.get(r),i=t.get(e);--i==0?(r.removeEventListener(e,lr),t.delete(e),t.size===0&&br.delete(r)):t.set(e,i)}rr.delete(f),c!==r&&c.parentNode?.removeChild(c)}});return Sr.set(u,d),u}var Sr=new WeakMap,Cr=class{anchor;#e=new Map;#t=new Map;#n=new Map;#r=new Set;#i=!0;constructor(e,t=!0){this.anchor=e,this.#i=t}#a=e=>{if(this.#e.has(e)){var t=this.#e.get(e),n=this.#t.get(t);if(n)Tn(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&(this.#t.set(t,r.effect),this.#n.delete(t),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),n=r.effect)}for(let[t,n]of this.#e){if(this.#e.delete(t),t===e)break;let r=this.#n.get(n);r&&(bn(r.effect),this.#n.delete(n))}for(let[e,r]of this.#t){if(e===t||this.#r.has(e))continue;let i=()=>{if(Array.from(this.#e.values()).includes(e)){var t=document.createDocumentFragment();Dn(r,t),t.append(qt()),this.#n.set(e,{effect:r,fragment:t})}else bn(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),Cn(r,i,!1)):i()}}};#o=e=>{this.#e.delete(e);let t=Array.from(this.#e.values());for(let[e,n]of this.#n)t.includes(e)||(bn(n.effect),this.#n.delete(e))};ensure(e,t){var n=N,r=Qt();if(t&&!this.#t.has(e)&&!this.#n.has(e))if(r){var i=document.createDocumentFragment(),a=qt();i.append(a),this.#n.set(e,{effect:gn(()=>t(a)),fragment:i})}else this.#t.set(e,gn(()=>t(this.anchor)));if(this.#e.set(n,e),r){for(let[t,r]of this.#t)t===e?n.unskip_effect(r):n.skip_effect(r);for(let[t,r]of this.#n)t===e?n.unskip_effect(r.effect):n.skip_effect(r.effect);n.oncommit(this.#a),n.ondiscard(this.#o)}else O&&(this.anchor=k),this.#a(n)}};function wr(e,t,...n){var r=new Cr(e);hn(()=>{let e=t()??null;r.ensure(e,e&&(t=>e(t,...n)))},T)}function Tr(e){j===null&&ue(`onMount`),Fe&&j.l!==null?Er(j).m.push(e):cn(()=>{let t=er(e);if(typeof t==`function`)return t})}function Er(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}function Dr(e,t,n=!1){var r;O&&(r=k,De());var i=new Cr(e),a=n?T:0;function o(e,t){if(O){var n=Ae(r);if(e!==parseInt(n.substring(1))){var a=ke();Ee(a),i.anchor=a,Te(!1),i.ensure(e,t),Te(!0);return}}i.ensure(e,t)}hn(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}function Or(e,t){return t}function kr(e,t,n){for(var r=[],i=t.length,a,s=t.length,c=0;c<i;c++){let n=t[c];Cn(n,()=>{if(a){if(a.pending.delete(n),a.done.add(n),a.pending.size===0){var t=e.outrogroups;Ar(e,o(a.done)),t.delete(a),t.size===0&&(e.outrogroups=null)}}else --s},!1)}if(s===0){var l=r.length===0&&n!==null;if(l){var u=n,d=u.parentNode;Zt(d),d.append(u),e.items.clear()}Ar(e,t,!l)}else a={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(a)}function Ar(e,t,n=!0){var r;if(e.pending.size>0){r=new Set;for(let t of e.pending.values())for(let n of t)r.add(e.items.get(n).e)}for(var i=0;i<t.length;i++){var a=t[i];r?.has(a)?(a.f|=ee,Dn(a,document.createDocumentFragment())):bn(t[i],n)}}var jr;function Mr(e,t,n,i,a,s=null){var c=e,l=new Map;if(t&4){var u=e;c=O?Ee(Jt(u)):u.appendChild(qt())}O&&De();var d=null,f=Et(()=>{var e=n();return r(e)?e:e==null?[]:o(e)}),p,m=new Map,h=!0;function g(e){v.effect.f&16384||(v.pending.delete(e),v.fallback=d,Pr(v,p,c,t,i),d!==null&&(p.length===0?d.f&33554432?(d.f^=ee,Ir(d,null,c)):Tn(d):Cn(d,()=>{d=null})))}function _(e){v.pending.delete(e)}var v={effect:hn(()=>{p=V(f);var e=p.length;let r=!1;O&&Ae(c)===`[!`!=(e===0)&&(c=ke(),Ee(c),Te(!1),r=!0);for(var o=new Set,u=N,v=Qt(),y=0;y<e;y+=1){O&&k.nodeType===8&&k.data===`]`&&(c=k,r=!0,Te(!1));var b=p[y],x=i(b,y),S=h?null:l.get(x);S?(S.v&&Lt(S.v,b),S.i&&Lt(S.i,y),v&&u.unskip_effect(S.e)):(S=Fr(l,h?c:jr??=qt(),b,x,y,a,t,n),h||(S.e.f|=ee),l.set(x,S)),o.add(x)}if(e===0&&s&&!d&&(h?d=gn(()=>s(c)):(d=gn(()=>s(jr??=qt())),d.f|=ee)),e>o.size&&fe(``,``,``),O&&e>0&&Ee(ke()),!h)if(m.set(u,o),v){for(let[e,t]of l)o.has(e)||u.skip_effect(t.e);u.oncommit(g),u.ondiscard(_)}else g(u);r&&Te(!0),V(f)}),flags:t,items:l,pending:m,outrogroups:null,fallback:d};h=!1,O&&(c=k)}function Nr(e){for(;e!==null&&!(e.f&32);)e=e.next;return e}function Pr(e,t,n,r,i){var a=(r&8)!=0,s=t.length,c=e.items,l=Nr(e.effect.first),u,d=null,f,p=[],m=[],h,g,_,v;if(a)for(v=0;v<s;v+=1)h=t[v],g=i(h,v),_=c.get(g).e,_.f&33554432||(_.nodes?.a?.measure(),(f??=new Set).add(_));for(v=0;v<s;v+=1){if(h=t[v],g=i(h,v),_=c.get(g).e,e.outrogroups!==null)for(let t of e.outrogroups)t.pending.delete(_),t.done.delete(_);if(_.f&8192&&(Tn(_),a&&(_.nodes?.a?.unfix(),(f??=new Set).delete(_))),_.f&33554432)if(_.f^=ee,_===l)Ir(_,null,n);else{var y=d?d.next:l;_===e.effect.last&&(e.effect.last=_.prev),_.prev&&(_.prev.next=_.next),_.next&&(_.next.prev=_.prev),Lr(e,d,_),Lr(e,_,y),Ir(_,y,n),d=_,p=[],m=[],l=Nr(d.next);continue}if(_!==l){if(u!==void 0&&u.has(_)){if(p.length<m.length){var b=m[0],x;d=b.prev;var S=p[0],C=p[p.length-1];for(x=0;x<p.length;x+=1)Ir(p[x],b,n);for(x=0;x<m.length;x+=1)u.delete(m[x]);Lr(e,S.prev,C.next),Lr(e,d,S),Lr(e,C,b),l=b,d=C,--v,p=[],m=[]}else u.delete(_),Ir(_,l,n),Lr(e,_.prev,_.next),Lr(e,_,d===null?e.effect.first:d.next),Lr(e,d,_),d=_;continue}for(p=[],m=[];l!==null&&l!==_;)(u??=new Set).add(l),m.push(l),l=Nr(l.next);if(l===null)continue}_.f&33554432||p.push(_),d=_,l=Nr(_.next)}if(e.outrogroups!==null){for(let t of e.outrogroups)t.pending.size===0&&(Ar(e,o(t.done)),e.outrogroups?.delete(t));e.outrogroups.size===0&&(e.outrogroups=null)}if(l!==null||u!==void 0){var w=[];if(u!==void 0)for(_ of u)_.f&8192||w.push(_);for(;l!==null;)!(l.f&8192)&&l!==e.fallback&&w.push(l),l=Nr(l.next);var T=w.length;if(T>0){var E=r&4&&s===0?n:null;if(a){for(v=0;v<T;v+=1)w[v].nodes?.a?.measure();for(v=0;v<T;v+=1)w[v].nodes?.a?.fix()}kr(e,w,E)}}a&&He(()=>{if(f!==void 0)for(_ of f)_.nodes?.a?.apply()})}function Fr(e,t,n,r,i,a,o,s){var c=o&1?o&16?Ft(n):It(n,!1,!1):null,l=o&2?Ft(i):null;return{v:c,i:l,e:gn(()=>(a(t,c??n,l??i,s),()=>{e.delete(r)}))}}function Ir(e,t,n){if(e.nodes)for(var r=e.nodes.start,i=e.nodes.end,a=t&&!(t.f&33554432)?t.nodes.start:n;r!==null;){var o=Yt(r);if(a.before(r),r===i)return;r=o}}function Lr(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function Rr(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Rr(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function zr(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Rr(e))&&(r&&(r+=` `),r+=t);return r}function Br(e){return typeof e==`object`?zr(e):e??``}var Vr=[...`
|
|
2
|
+
\r\f\xA0\v`];function Hr(e,t,n){var r=e==null?``:``+e;if(t&&(r=r?r+` `+t:t),n){for(var i of Object.keys(n))if(n[i])r=r?r+` `+i:i;else if(r.length)for(var a=i.length,o=0;(o=r.indexOf(i,o))>=0;){var s=o+a;(o===0||Vr.includes(r[o-1]))&&(s===r.length||Vr.includes(r[s]))?r=(o===0?``:r.substring(0,o))+r.substring(s+1):o=s}}return r===``?null:r}function Ur(e,t=!1){var n=t?` !important;`:`;`,r=``;for(var i of Object.keys(e)){var a=e[i];a!=null&&a!==``&&(r+=` `+i+`: `+a+n)}return r}function Wr(e){return e[0]!==`-`||e[1]!==`-`?e.toLowerCase():e}function Gr(e,t){if(t){var n=``,r,i;if(Array.isArray(t)?(r=t[0],i=t[1]):r=t,e){e=String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g,``).trim();var a=!1,o=0,s=!1,c=[];r&&c.push(...Object.keys(r).map(Wr)),i&&c.push(...Object.keys(i).map(Wr));var l=0,u=-1;let t=e.length;for(var d=0;d<t;d++){var f=e[d];if(s?f===`/`&&e[d-1]===`*`&&(s=!1):a?a===f&&(a=!1):f===`/`&&e[d+1]===`*`?s=!0:f===`"`||f===`'`?a=f:f===`(`?o++:f===`)`&&o--,!s&&a===!1&&o===0){if(f===`:`&&u===-1)u=d;else if(f===`;`||d===t-1){if(u!==-1){var p=Wr(e.substring(l,u).trim());if(!c.includes(p)){f!==`;`&&d++;var m=e.substring(l,d).trim();n+=` `+m+`;`}}l=d+1,u=-1}}}}return r&&(n+=Ur(r)),i&&(n+=Ur(i,!0)),n=n.trim(),n===``?null:n}return e==null?null:String(e)}function Kr(e,t,n,r,i,a){var o=e.__className;if(O||o!==n||o===void 0){var s=Hr(n,r,a);(!O||s!==e.getAttribute(`class`))&&(s==null?e.removeAttribute(`class`):t?e.className=s:e.setAttribute(`class`,s)),e.__className=n}else if(a&&i!==a)for(var c in a){var l=!!a[c];(i==null||l!==!!i[c])&&e.classList.toggle(c,l)}return a}function qr(e,t={},n,r){for(var i in n){var a=n[i];t[i]!==a&&(n[i]==null?e.style.removeProperty(i):e.style.setProperty(i,a,r))}}function Jr(e,t,n,r){var i=e.__style;if(O||i!==t){var a=Gr(t,r);(!O||a!==e.getAttribute(`style`))&&(a==null?e.removeAttribute(`style`):e.style.cssText=a),e.__style=t}else r&&(Array.isArray(r)?(qr(e,n?.[0],r[0]),qr(e,n?.[1],r[1],`important`)):qr(e,n,r));return r}var Yr=Symbol(`is custom element`),Xr=Symbol(`is html`),Zr=le?`link`:`LINK`;function Qr(e,t,n,r){var i=$r(e);O&&(i[t]=e.getAttribute(t),t===`src`||t===`srcset`||t===`href`&&e.nodeName===Zr)||i[t]!==(i[t]=n)&&(t===`loading`&&(e[se]=n),n==null?e.removeAttribute(t):typeof n!=`string`&&ti(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function $r(e){return e.__attributes??={[Yr]:e.nodeName.includes(`-`),[Xr]:e.namespaceURI===n}}var ei=new Map;function ti(e){var t=e.getAttribute(`is`)||e.nodeName,n=ei.get(t);if(n)return n;ei.set(t,n=[]);for(var r,i=e,a=Element.prototype;a!==i;){for(var o in r=l(i),r)r[o].set&&n.push(o);i=f(i)}return n}function ni(e,t){return e===t||e?.[ae]===t}function ri(e={},t,n,r){var i=j.r,a=B;return dn(()=>{var o,s;return pn(()=>{o=s,s=r?.()||[],er(()=>{e!==n(...s)&&(t(e,...s),o&&ni(n(...o),e)&&t(null,...o))})}),()=>{let r=a;for(;r!==i&&r.parent!==null&&r.parent.f&33554432;)r=r.parent;let o=()=>{s&&ni(n(...s),e)&&t(null,...s)},c=r.teardown;r.teardown=()=>{o(),c?.()}}}),e}function ii(e,t,n,r){var i=!Fe||(n&2)!=0,a=(n&8)!=0,o=(n&16)!=0,s=r,l=!0,u=()=>(l&&(l=!1,s=o?er(r):r),s);let d;if(a){var f=ae in e||oe in e;d=c(e,t)?.set??(f&&t in e?n=>e[t]=n:void 0)}var p,m=!1;a?[p,m]=Ze(()=>e[t]):p=e[t],p===void 0&&r!==void 0&&(p=u(),d&&(i&&_e(t),d(p)));var h=i?()=>{var n=e[t];return n===void 0?u():(l=!0,n)}:()=>{var n=e[t];return n!==void 0&&(s=void 0),n===void 0?s:n};if(i&&!(n&4))return h;if(d){var g=e.$$legacy;return(function(e,t){return arguments.length>0?((!i||!t||g||m)&&d(t?h():e),e):h()})}var _=!1,v=(n&1?wt:Et)(()=>(_=!1,h()));a&&V(v);var y=B;return(function(e,t){if(arguments.length>0){let n=t?V(v):i&&a?Vt(e):e;return I(v,n),_=!0,s!==void 0&&(s=n),e}return An&&_||y.f&16384?v.v:V(v)})}function ai(e){return e+.5|0}var oi=(e,t,n)=>Math.max(Math.min(e,n),t);function si(e){return oi(ai(e*2.55),0,255)}function ci(e){return oi(ai(e*255),0,255)}function li(e){return oi(ai(e/2.55)/100,0,1)}function ui(e){return oi(ai(e*100),0,100)}var di={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},fi=[...`0123456789ABCDEF`],pi=e=>fi[e&15],mi=e=>fi[(e&240)>>4]+fi[e&15],hi=e=>(e&240)>>4==(e&15),gi=e=>hi(e.r)&&hi(e.g)&&hi(e.b)&&hi(e.a);function _i(e){var t=e.length,n;return e[0]===`#`&&(t===4||t===5?n={r:255&di[e[1]]*17,g:255&di[e[2]]*17,b:255&di[e[3]]*17,a:t===5?di[e[4]]*17:255}:(t===7||t===9)&&(n={r:di[e[1]]<<4|di[e[2]],g:di[e[3]]<<4|di[e[4]],b:di[e[5]]<<4|di[e[6]],a:t===9?di[e[7]]<<4|di[e[8]]:255})),n}var vi=(e,t)=>e<255?t(e):``;function yi(e){var t=gi(e)?pi:mi;return e?`#`+t(e.r)+t(e.g)+t(e.b)+vi(e.a,t):void 0}var bi=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function xi(e,t,n){let r=t*Math.min(n,1-n),i=(t,i=(t+e/30)%12)=>n-r*Math.max(Math.min(i-3,9-i,1),-1);return[i(0),i(8),i(4)]}function Si(e,t,n){let r=(r,i=(r+e/60)%6)=>n-n*t*Math.max(Math.min(i,4-i,1),0);return[r(5),r(3),r(1)]}function Ci(e,t,n){let r=xi(e,1,.5),i;for(t+n>1&&(i=1/(t+n),t*=i,n*=i),i=0;i<3;i++)r[i]*=1-t-n,r[i]+=t;return r}function wi(e,t,n,r,i){return e===i?(t-n)/r+(t<n?6:0):t===i?(n-e)/r+2:(e-t)/r+4}function Ti(e){let t=e.r/255,n=e.g/255,r=e.b/255,i=Math.max(t,n,r),a=Math.min(t,n,r),o=(i+a)/2,s,c,l;return i!==a&&(l=i-a,c=o>.5?l/(2-i-a):l/(i+a),s=wi(t,n,r,l,i),s=s*60+.5),[s|0,c||0,o]}function Ei(e,t,n,r){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,n,r)).map(ci)}function Di(e,t,n){return Ei(xi,e,t,n)}function Oi(e,t,n){return Ei(Ci,e,t,n)}function ki(e,t,n){return Ei(Si,e,t,n)}function Ai(e){return(e%360+360)%360}function ji(e){let t=bi.exec(e),n=255,r;if(!t)return;t[5]!==r&&(n=t[6]?si(+t[5]):ci(+t[5]));let i=Ai(+t[2]),a=t[3]/100,o=t[4]/100;return r=t[1]===`hwb`?Oi(i,a,o):t[1]===`hsv`?ki(i,a,o):Di(i,a,o),{r:r[0],g:r[1],b:r[2],a:n}}function Mi(e,t){var n=Ti(e);n[0]=Ai(n[0]+t),n=Di(n),e.r=n[0],e.g=n[1],e.b=n[2]}function Ni(e){if(!e)return;let t=Ti(e),n=t[0],r=ui(t[1]),i=ui(t[2]);return e.a<255?`hsla(${n}, ${r}%, ${i}%, ${li(e.a)})`:`hsl(${n}, ${r}%, ${i}%)`}var Pi={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`},Fi={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 Ii(){let e={},t=Object.keys(Fi),n=Object.keys(Pi),r,i,a,o,s;for(r=0;r<t.length;r++){for(o=s=t[r],i=0;i<n.length;i++)a=n[i],s=s.replace(a,Pi[a]);a=parseInt(Fi[o],16),e[s]=[a>>16&255,a>>8&255,a&255]}return e}var Li;function Ri(e){Li||(Li=Ii(),Li.transparent=[0,0,0,0]);let t=Li[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}var zi=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function Bi(e){let t=zi.exec(e),n=255,r,i,a;if(t){if(t[7]!==r){let e=+t[7];n=t[8]?si(e):oi(e*255,0,255)}return r=+t[1],i=+t[3],a=+t[5],r=255&(t[2]?si(r):oi(r,0,255)),i=255&(t[4]?si(i):oi(i,0,255)),a=255&(t[6]?si(a):oi(a,0,255)),{r,g:i,b:a,a:n}}}function Vi(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${li(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}var Hi=e=>e<=.0031308?e*12.92:e**(1/2.4)*1.055-.055,Ui=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4;function Wi(e,t,n){let r=Ui(li(e.r)),i=Ui(li(e.g)),a=Ui(li(e.b));return{r:ci(Hi(r+n*(Ui(li(t.r))-r))),g:ci(Hi(i+n*(Ui(li(t.g))-i))),b:ci(Hi(a+n*(Ui(li(t.b))-a))),a:e.a+n*(t.a-e.a)}}function Gi(e,t,n){if(e){let r=Ti(e);r[t]=Math.max(0,Math.min(r[t]+r[t]*n,t===0?360:1)),r=Di(r),e.r=r[0],e.g=r[1],e.b=r[2]}}function Ki(e,t){return e&&Object.assign(t||{},e)}function qi(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=ci(e[3]))):(t=Ki(e,{r:0,g:0,b:0,a:1}),t.a=ci(t.a)),t}function Ji(e){return e.charAt(0)===`r`?Bi(e):ji(e)}var Yi=class e{constructor(t){if(t instanceof e)return t;let n=typeof t,r;n===`object`?r=qi(t):n===`string`&&(r=_i(t)||Ri(t)||Ji(t)),this._rgb=r,this._valid=!!r}get valid(){return this._valid}get rgb(){var e=Ki(this._rgb);return e&&(e.a=li(e.a)),e}set rgb(e){this._rgb=qi(e)}rgbString(){return this._valid?Vi(this._rgb):void 0}hexString(){return this._valid?yi(this._rgb):void 0}hslString(){return this._valid?Ni(this._rgb):void 0}mix(e,t){if(e){let n=this.rgb,r=e.rgb,i,a=t===i?.5:t,o=2*a-1,s=n.a-r.a,c=((o*s===-1?o:(o+s)/(1+o*s))+1)/2;i=1-c,n.r=255&c*n.r+i*r.r+.5,n.g=255&c*n.g+i*r.g+.5,n.b=255&c*n.b+i*r.b+.5,n.a=a*n.a+(1-a)*r.a,this.rgb=n}return this}interpolate(e,t){return e&&(this._rgb=Wi(this._rgb,e._rgb,t)),this}clone(){return new e(this.rgb)}alpha(e){return this._rgb.a=ci(e),this}clearer(e){let t=this._rgb;return t.a*=1-e,this}greyscale(){let e=this._rgb;return e.r=e.g=e.b=ai(e.r*.3+e.g*.59+e.b*.11),this}opaquer(e){let t=this._rgb;return t.a*=1+e,this}negate(){let e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return Gi(this._rgb,2,e),this}darken(e){return Gi(this._rgb,2,-e),this}saturate(e){return Gi(this._rgb,1,e),this}desaturate(e){return Gi(this._rgb,1,-e),this}rotate(e){return Mi(this._rgb,e),this}};function Xi(){}var Zi=(()=>{let e=0;return()=>e++})();function G(e){return e==null}function K(e){if(Array.isArray&&Array.isArray(e))return!0;let t=Object.prototype.toString.call(e);return t.slice(0,7)===`[object`&&t.slice(-6)===`Array]`}function q(e){return e!==null&&Object.prototype.toString.call(e)===`[object Object]`}function Qi(e){return(typeof e==`number`||e instanceof Number)&&isFinite(+e)}function $i(e,t){return Qi(e)?e:t}function J(e,t){return e===void 0?t:e}var ea=(e,t)=>typeof e==`string`&&e.endsWith(`%`)?parseFloat(e)/100:+e/t,ta=(e,t)=>typeof e==`string`&&e.endsWith(`%`)?parseFloat(e)/100*t:+e;function Y(e,t,n){if(e&&typeof e.call==`function`)return e.apply(n,t)}function X(e,t,n,r){let i,a,o;if(K(e))if(a=e.length,r)for(i=a-1;i>=0;i--)t.call(n,e[i],i);else for(i=0;i<a;i++)t.call(n,e[i],i);else if(q(e))for(o=Object.keys(e),a=o.length,i=0;i<a;i++)t.call(n,e[o[i]],o[i])}function na(e,t){let n,r,i,a;if(!e||!t||e.length!==t.length)return!1;for(n=0,r=e.length;n<r;++n)if(i=e[n],a=t[n],i.datasetIndex!==a.datasetIndex||i.index!==a.index)return!1;return!0}function ra(e){if(K(e))return e.map(ra);if(q(e)){let t=Object.create(null),n=Object.keys(e),r=n.length,i=0;for(;i<r;++i)t[n[i]]=ra(e[n[i]]);return t}return e}function ia(e){return[`__proto__`,`prototype`,`constructor`].indexOf(e)===-1}function aa(e,t,n,r){if(!ia(e))return;let i=t[e],a=n[e];q(i)&&q(a)?oa(i,a,r):t[e]=ra(a)}function oa(e,t,n){let r=K(t)?t:[t],i=r.length;if(!q(e))return e;n||={};let a=n.merger||aa,o;for(let t=0;t<i;++t){if(o=r[t],!q(o))continue;let i=Object.keys(o);for(let t=0,r=i.length;t<r;++t)a(i[t],e,o,n)}return e}function sa(e,t){return oa(e,t,{merger:ca})}function ca(e,t,n){if(!ia(e))return;let r=t[e],i=n[e];q(r)&&q(i)?sa(r,i):Object.prototype.hasOwnProperty.call(t,e)||(t[e]=ra(i))}var la={"":e=>e,x:e=>e.x,y:e=>e.y};function ua(e){let t=e.split(`.`),n=[],r=``;for(let e of t)r+=e,r.endsWith(`\\`)?r=r.slice(0,-1)+`.`:(n.push(r),r=``);return n}function da(e){let t=ua(e);return e=>{for(let n of t){if(n===``)break;e&&=e[n]}return e}}function fa(e,t){return(la[t]||(la[t]=da(t)))(e)}function pa(e){return e.charAt(0).toUpperCase()+e.slice(1)}var ma=e=>e!==void 0,ha=e=>typeof e==`function`,ga=(e,t)=>{if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0};function _a(e){return e.type===`mouseup`||e.type===`click`||e.type===`contextmenu`}var Z=Math.PI,Q=2*Z;Q+Z;var va=1/0,ya=Z/180,$=Z/2,ba=Z/4,xa=Z*2/3,Sa=Math.log10,Ca=Math.sign;function wa(e,t,n){return Math.abs(e-t)<n}function Ta(e){let t=Math.round(e);e=wa(e,t,e/1e3)?t:e;let n=10**Math.floor(Sa(e)),r=e/n;return(r<=1?1:r<=2?2:r<=5?5:10)*n}function Ea(e){let t=[],n=Math.sqrt(e),r;for(r=1;r<n;r++)e%r===0&&(t.push(r),t.push(e/r));return n===(n|0)&&t.push(n),t.sort((e,t)=>e-t).pop(),t}function Da(e){return typeof e==`symbol`||typeof e==`object`&&!!e&&!(Symbol.toPrimitive in e||`toString`in e||`valueOf`in e)}function Oa(e){return!Da(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function ka(e,t){let n=Math.round(e);return n-t<=e&&n+t>=e}function Aa(e,t,n){let r,i,a;for(r=0,i=e.length;r<i;r++)a=e[r][n],isNaN(a)||(t.min=Math.min(t.min,a),t.max=Math.max(t.max,a))}function ja(e){return Z/180*e}function Ma(e){return 180/Z*e}function Na(e){if(!Qi(e))return;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n++;return n}function Pa(e,t){let n=t.x-e.x,r=t.y-e.y,i=Math.sqrt(n*n+r*r),a=Math.atan2(r,n);return a<-.5*Z&&(a+=Q),{angle:a,distance:i}}function Fa(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function Ia(e){return(e%Q+Q)%Q}function La(e,t,n,r){let i=Ia(e),a=Ia(t),o=Ia(n),s=Ia(a-i),c=Ia(o-i),l=Ia(i-a),u=Ia(i-o);return i===a||i===o||r&&a===o||s>c&&l<u}function Ra(e,t,n){return Math.max(t,Math.min(n,e))}function za(e){return Ra(e,-32768,32767)}function Ba(e,t,n,r=1e-6){return e>=Math.min(t,n)-r&&e<=Math.max(t,n)+r}function Va(e,t,n){n||=(n=>e[n]<t);let r=e.length-1,i=0,a;for(;r-i>1;)a=i+r>>1,n(a)?i=a:r=a;return{lo:i,hi:r}}var Ha=(e,t,n,r)=>Va(e,n,r?r=>{let i=e[r][t];return i<n||i===n&&e[r+1][t]===n}:r=>e[r][t]<n),Ua=(e,t,n)=>Va(e,n,r=>e[r][t]>=n);function Wa(e,t,n){let r=0,i=e.length;for(;r<i&&e[r]<t;)r++;for(;i>r&&e[i-1]>n;)i--;return r>0||i<e.length?e.slice(r,i):e}var Ga=[`push`,`pop`,`shift`,`splice`,`unshift`];function Ka(e,t){if(e._chartjs){e._chartjs.listeners.push(t);return}Object.defineProperty(e,`_chartjs`,{configurable:!0,enumerable:!1,value:{listeners:[t]}}),Ga.forEach(t=>{let n=`_onData`+pa(t),r=e[t];Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value(...t){let i=r.apply(this,t);return e._chartjs.listeners.forEach(e=>{typeof e[n]==`function`&&e[n](...t)}),i}})})}function qa(e,t){let n=e._chartjs;if(!n)return;let r=n.listeners,i=r.indexOf(t);i!==-1&&r.splice(i,1),!(r.length>0)&&(Ga.forEach(t=>{delete e[t]}),delete e._chartjs)}function Ja(e){let t=new Set(e);return t.size===e.length?e:Array.from(t)}var Ya=function(){return typeof window>`u`?function(e){return e()}:window.requestAnimationFrame}();function Xa(e,t){let n=[],r=!1;return function(...i){n=i,r||(r=!0,Ya.call(window,()=>{r=!1,e.apply(t,n)}))}}function Za(e,t){let n;return function(...r){return t?(clearTimeout(n),n=setTimeout(e,t,r)):e.apply(this,r),t}}var Qa=e=>e===`start`?`left`:e===`end`?`right`:`center`,$a=(e,t,n)=>e===`start`?t:e===`end`?n:(t+n)/2,eo=e=>e===0||e===1,to=(e,t,n)=>-(2**(10*--e)*Math.sin((e-t)*Q/n)),no=(e,t,n)=>2**(-10*e)*Math.sin((e-t)*Q/n)+1,ro={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>--e*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-(--e*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>--e*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*$)+1,easeOutSine:e=>Math.sin(e*$),easeInOutSine:e=>-.5*(Math.cos(Z*e)-1),easeInExpo:e=>e===0?0:2**(10*(e-1)),easeOutExpo:e=>e===1?1:-(2**(-10*e))+1,easeInOutExpo:e=>eo(e)?e:e<.5?.5*2**(10*(e*2-1)):.5*(-(2**(-10*(e*2-1)))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1- --e*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>eo(e)?e:to(e,.075,.3),easeOutElastic:e=>eo(e)?e:no(e,.075,.3),easeInOutElastic(e){let t=.1125,n=.45;return eo(e)?e:e<.5?.5*to(e*2,t,n):.5+.5*no(e*2-1,t,n)},easeInBack(e){let t=1.70158;return e*e*((t+1)*e-t)},easeOutBack(e){let t=1.70158;return--e*e*((t+1)*e+t)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-ro.easeOutBounce(1-e),easeOutBounce(e){let t=7.5625,n=2.75;return e<1/n?t*e*e:e<2/n?t*(e-=1.5/n)*e+.75:e<2.5/n?t*(e-=2.25/n)*e+.9375:t*(e-=2.625/n)*e+.984375},easeInOutBounce:e=>e<.5?ro.easeInBounce(e*2)*.5:ro.easeOutBounce(e*2-1)*.5+.5};function io(e){if(e&&typeof e==`object`){let t=e.toString();return t===`[object CanvasPattern]`||t===`[object CanvasGradient]`}return!1}function ao(e){return io(e)?e:new Yi(e)}function oo(e){return io(e)?e:new Yi(e).saturate(.5).darken(.1).hexString()}var so=[`x`,`y`,`borderWidth`,`radius`,`tension`],co=[`color`,`borderColor`,`backgroundColor`];function lo(e){e.set(`animation`,{delay:void 0,duration:1e3,easing:`easeOutQuart`,fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe(`animation`,{_fallback:!1,_indexable:!1,_scriptable:e=>e!==`onProgress`&&e!==`onComplete`&&e!==`fn`}),e.set(`animations`,{colors:{type:`color`,properties:co},numbers:{type:`number`,properties:so}}),e.describe(`animations`,{_fallback:`animation`}),e.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:e=>e|0}}}})}function uo(e){e.set(`layout`,{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}var fo=new Map;function po(e,t){t||={};let n=e+JSON.stringify(t),r=fo.get(n);return r||(r=new Intl.NumberFormat(e,t),fo.set(n,r)),r}function mo(e,t,n){return po(t,n).format(e)}var ho={values(e){return K(e)?e:``+e},numeric(e,t,n){if(e===0)return`0`;let r=this.chart.options.locale,i,a=e;if(n.length>1){let t=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(t<1e-4||t>0x38d7ea4c68000)&&(i=`scientific`),a=go(e,n)}let o=Sa(Math.abs(a)),s=isNaN(o)?1:Math.max(Math.min(-1*Math.floor(o),20),0),c={notation:i,minimumFractionDigits:s,maximumFractionDigits:s};return Object.assign(c,this.options.ticks.format),mo(e,r,c)},logarithmic(e,t,n){if(e===0)return`0`;let r=n[t].significand||e/10**Math.floor(Sa(e));return[1,2,3,5,10,15].includes(r)||t>.8*n.length?ho.numeric.call(this,e,t,n):``}};function go(e,t){let n=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(n)>=1&&e!==Math.floor(e)&&(n=e-Math.floor(e)),n}var _o={formatters:ho};function vo(e){e.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:(e,t)=>t.lineWidth,tickColor:(e,t)=>t.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:_o.formatters.values,minor:{},major:{},align:`center`,crossAlign:`near`,showLabelBackdrop:!1,backdropColor:`rgba(255, 255, 255, 0.75)`,backdropPadding:2}}),e.route(`scale.ticks`,`color`,``,`color`),e.route(`scale.grid`,`color`,``,`borderColor`),e.route(`scale.border`,`color`,``,`borderColor`),e.route(`scale.title`,`color`,``,`color`),e.describe(`scale`,{_fallback:!1,_scriptable:e=>!e.startsWith(`before`)&&!e.startsWith(`after`)&&e!==`callback`&&e!==`parser`,_indexable:e=>e!==`borderDash`&&e!==`tickBorderDash`&&e!==`dash`}),e.describe(`scales`,{_fallback:`scale`}),e.describe(`scale.ticks`,{_scriptable:e=>e!==`backdropPadding`&&e!==`callback`,_indexable:e=>e!==`backdropPadding`})}var yo=Object.create(null),bo=Object.create(null);function xo(e,t){if(!t)return e;let n=t.split(`.`);for(let t=0,r=n.length;t<r;++t){let r=n[t];e=e[r]||(e[r]=Object.create(null))}return e}function So(e,t,n){return typeof t==`string`?oa(xo(e,t),n):oa(xo(e,``),t)}var Co=new class{constructor(e,t){this.animation=void 0,this.backgroundColor=`rgba(0,0,0,0.1)`,this.borderColor=`rgba(0,0,0,0.1)`,this.color=`#666`,this.datasets={},this.devicePixelRatio=e=>e.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,t)=>oo(t.backgroundColor),this.hoverBorderColor=(e,t)=>oo(t.borderColor),this.hoverColor=(e,t)=>oo(t.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(e),this.apply(t)}set(e,t){return So(this,e,t)}get(e){return xo(this,e)}describe(e,t){return So(bo,e,t)}override(e,t){return So(yo,e,t)}route(e,t,n,r){let i=xo(this,e),a=xo(this,n),o=`_`+t;Object.defineProperties(i,{[o]:{value:i[t],writable:!0},[t]:{enumerable:!0,get(){let e=this[o],t=a[r];return q(e)?Object.assign({},t,e):J(e,t)},set(e){this[o]=e}}})}apply(e){e.forEach(e=>e(this))}}({_scriptable:e=>!e.startsWith(`on`),_indexable:e=>e!==`events`,hover:{_fallback:`interaction`},interaction:{_scriptable:!1,_indexable:!1}},[lo,uo,vo]);function wo(e){return!e||G(e.size)||G(e.family)?null:(e.style?e.style+` `:``)+(e.weight?e.weight+` `:``)+e.size+`px `+e.family}function To(e,t,n,r,i){let a=t[i];return a||(a=t[i]=e.measureText(i).width,n.push(i)),a>r&&(r=a),r}function Eo(e,t,n,r){r||={};let i=r.data=r.data||{},a=r.garbageCollect=r.garbageCollect||[];r.font!==t&&(i=r.data={},a=r.garbageCollect=[],r.font=t),e.save(),e.font=t;let o=0,s=n.length,c,l,u,d,f;for(c=0;c<s;c++)if(d=n[c],d!=null&&!K(d))o=To(e,i,a,o,d);else if(K(d))for(l=0,u=d.length;l<u;l++)f=d[l],f!=null&&!K(f)&&(o=To(e,i,a,o,f));e.restore();let p=a.length/2;if(p>n.length){for(c=0;c<p;c++)delete i[a[c]];a.splice(0,p)}return o}function Do(e,t,n){let r=e.currentDevicePixelRatio,i=n===0?0:Math.max(n/2,.5);return Math.round((t-i)*r)/r+i}function Oo(e,t){!t&&!e||(t||=e.getContext(`2d`),t.save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function ko(e,t,n,r){Ao(e,t,n,r,null)}function Ao(e,t,n,r,i){let a,o,s,c,l,u,d,f,p=t.pointStyle,m=t.rotation,h=t.radius,g=(m||0)*ya;if(p&&typeof p==`object`&&(a=p.toString(),a===`[object HTMLImageElement]`||a===`[object HTMLCanvasElement]`)){e.save(),e.translate(n,r),e.rotate(g),e.drawImage(p,-p.width/2,-p.height/2,p.width,p.height),e.restore();return}if(!(isNaN(h)||h<=0)){switch(e.beginPath(),p){default:i?e.ellipse(n,r,i/2,h,0,0,Q):e.arc(n,r,h,0,Q),e.closePath();break;case`triangle`:u=i?i/2:h,e.moveTo(n+Math.sin(g)*u,r-Math.cos(g)*h),g+=xa,e.lineTo(n+Math.sin(g)*u,r-Math.cos(g)*h),g+=xa,e.lineTo(n+Math.sin(g)*u,r-Math.cos(g)*h),e.closePath();break;case`rectRounded`:l=h*.516,c=h-l,o=Math.cos(g+ba)*c,d=Math.cos(g+ba)*(i?i/2-l:c),s=Math.sin(g+ba)*c,f=Math.sin(g+ba)*(i?i/2-l:c),e.arc(n-d,r-s,l,g-Z,g-$),e.arc(n+f,r-o,l,g-$,g),e.arc(n+d,r+s,l,g,g+$),e.arc(n-f,r+o,l,g+$,g+Z),e.closePath();break;case`rect`:if(!m){c=Math.SQRT1_2*h,u=i?i/2:c,e.rect(n-u,r-c,2*u,2*c);break}g+=ba;case`rectRot`:d=Math.cos(g)*(i?i/2:h),o=Math.cos(g)*h,s=Math.sin(g)*h,f=Math.sin(g)*(i?i/2:h),e.moveTo(n-d,r-s),e.lineTo(n+f,r-o),e.lineTo(n+d,r+s),e.lineTo(n-f,r+o),e.closePath();break;case`crossRot`:g+=ba;case`cross`:d=Math.cos(g)*(i?i/2:h),o=Math.cos(g)*h,s=Math.sin(g)*h,f=Math.sin(g)*(i?i/2:h),e.moveTo(n-d,r-s),e.lineTo(n+d,r+s),e.moveTo(n+f,r-o),e.lineTo(n-f,r+o);break;case`star`:d=Math.cos(g)*(i?i/2:h),o=Math.cos(g)*h,s=Math.sin(g)*h,f=Math.sin(g)*(i?i/2:h),e.moveTo(n-d,r-s),e.lineTo(n+d,r+s),e.moveTo(n+f,r-o),e.lineTo(n-f,r+o),g+=ba,d=Math.cos(g)*(i?i/2:h),o=Math.cos(g)*h,s=Math.sin(g)*h,f=Math.sin(g)*(i?i/2:h),e.moveTo(n-d,r-s),e.lineTo(n+d,r+s),e.moveTo(n+f,r-o),e.lineTo(n-f,r+o);break;case`line`:o=i?i/2:Math.cos(g)*h,s=Math.sin(g)*h,e.moveTo(n-o,r-s),e.lineTo(n+o,r+s);break;case`dash`:e.moveTo(n,r),e.lineTo(n+Math.cos(g)*(i?i/2:h),r+Math.sin(g)*h);break;case!1:e.closePath();break}e.fill(),t.borderWidth>0&&e.stroke()}}function jo(e,t,n){return n||=.5,!t||e&&e.x>t.left-n&&e.x<t.right+n&&e.y>t.top-n&&e.y<t.bottom+n}function Mo(e,t){e.save(),e.beginPath(),e.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),e.clip()}function No(e){e.restore()}function Po(e,t){t.translation&&e.translate(t.translation[0],t.translation[1]),G(t.rotation)||e.rotate(t.rotation),t.color&&(e.fillStyle=t.color),t.textAlign&&(e.textAlign=t.textAlign),t.textBaseline&&(e.textBaseline=t.textBaseline)}function Fo(e,t,n,r,i){if(i.strikethrough||i.underline){let a=e.measureText(r),o=t-a.actualBoundingBoxLeft,s=t+a.actualBoundingBoxRight,c=n-a.actualBoundingBoxAscent,l=n+a.actualBoundingBoxDescent,u=i.strikethrough?(c+l)/2:l;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=i.decorationWidth||2,e.moveTo(o,u),e.lineTo(s,u),e.stroke()}}function Io(e,t){let n=e.fillStyle;e.fillStyle=t.color,e.fillRect(t.left,t.top,t.width,t.height),e.fillStyle=n}function Lo(e,t,n,r,i,a={}){let o=K(t)?t:[t],s=a.strokeWidth>0&&a.strokeColor!==``,c,l;for(e.save(),e.font=i.string,Po(e,a),c=0;c<o.length;++c)l=o[c],a.backdrop&&Io(e,a.backdrop),s&&(a.strokeColor&&(e.strokeStyle=a.strokeColor),G(a.strokeWidth)||(e.lineWidth=a.strokeWidth),e.strokeText(l,n,r,a.maxWidth)),e.fillText(l,n,r,a.maxWidth),Fo(e,n,r,l,a),r+=Number(i.lineHeight);e.restore()}function Ro(e,t){let{x:n,y:r,w:i,h:a,radius:o}=t;e.arc(n+o.topLeft,r+o.topLeft,o.topLeft,1.5*Z,Z,!0),e.lineTo(n,r+a-o.bottomLeft),e.arc(n+o.bottomLeft,r+a-o.bottomLeft,o.bottomLeft,Z,$,!0),e.lineTo(n+i-o.bottomRight,r+a),e.arc(n+i-o.bottomRight,r+a-o.bottomRight,o.bottomRight,$,0,!0),e.lineTo(n+i,r+o.topRight),e.arc(n+i-o.topRight,r+o.topRight,o.topRight,0,-$,!0),e.lineTo(n+o.topLeft,r)}var zo=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Bo=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Vo(e,t){let n=(``+e).match(zo);if(!n||n[1]===`normal`)return t*1.2;switch(e=+n[2],n[3]){case`px`:return e;case`%`:e/=100;break}return t*e}var Ho=e=>+e||0;function Uo(e,t){let n={},r=q(t),i=r?Object.keys(t):t,a=q(e)?r?n=>J(e[n],e[t[n]]):t=>e[t]:()=>e;for(let e of i)n[e]=Ho(a(e));return n}function Wo(e){return Uo(e,{top:`y`,right:`x`,bottom:`y`,left:`x`})}function Go(e){return Uo(e,[`topLeft`,`topRight`,`bottomLeft`,`bottomRight`])}function Ko(e){let t=Wo(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function qo(e,t){e||={},t||=Co.font;let n=J(e.size,t.size);typeof n==`string`&&(n=parseInt(n,10));let r=J(e.style,t.style);r&&!(``+r).match(Bo)&&(console.warn(`Invalid font style specified: "`+r+`"`),r=void 0);let i={family:J(e.family,t.family),lineHeight:Vo(J(e.lineHeight,t.lineHeight),n),size:n,style:r,weight:J(e.weight,t.weight),string:``};return i.string=wo(i),i}function Jo(e,t,n,r){let i=!0,a,o,s;for(a=0,o=e.length;a<o;++a)if(s=e[a],s!==void 0&&(t!==void 0&&typeof s==`function`&&(s=s(t),i=!1),n!==void 0&&K(s)&&(s=s[n%s.length],i=!1),s!==void 0))return r&&!i&&(r.cacheable=!1),s}function Yo(e,t,n){let{min:r,max:i}=e,a=ta(t,(i-r)/2),o=(e,t)=>n&&e===0?0:e+t;return{min:o(r,-Math.abs(a)),max:o(i,a)}}function Xo(e,t){return Object.assign(Object.create(e),t)}function Zo(e,t=[``],n,r,i=()=>e[0]){let a=n||e;return r===void 0&&(r=ps(`_fallback`,e)),new Proxy({[Symbol.toStringTag]:`Object`,_cacheable:!0,_scopes:e,_rootScopes:a,_fallback:r,_getTarget:i,override:n=>Zo([n,...e],t,a,r)},{deleteProperty(t,n){return delete t[n],delete t._keys,delete e[0][n],!0},get(n,r){return ns(n,r,()=>fs(r,t,e,n))},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e._scopes[0],t)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(e,t){return ms(e).includes(t)},ownKeys(e){return ms(e)},set(e,t,n){let r=e._storage||=i();return e[t]=r[t]=n,delete e._keys,!0}})}function Qo(e,t,n,r){let i={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:$o(e,r),setContext:t=>Qo(e,t,n,r),override:i=>Qo(e.override(i),t,n,r)};return new Proxy(i,{deleteProperty(t,n){return delete t[n],delete e[n],!0},get(e,t,n){return ns(e,t,()=>rs(e,t,n))},getOwnPropertyDescriptor(t,n){return t._descriptors.allKeys?Reflect.has(e,n)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,n)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(t,n){return Reflect.has(e,n)},ownKeys(){return Reflect.ownKeys(e)},set(t,n,r){return e[n]=r,delete t[n],!0}})}function $o(e,t={scriptable:!0,indexable:!0}){let{_scriptable:n=t.scriptable,_indexable:r=t.indexable,_allKeys:i=t.allKeys}=e;return{allKeys:i,scriptable:n,indexable:r,isScriptable:ha(n)?n:()=>n,isIndexable:ha(r)?r:()=>r}}var es=(e,t)=>e?e+pa(t):t,ts=(e,t)=>q(t)&&e!==`adapters`&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function ns(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||t===`constructor`)return e[t];let r=n();return e[t]=r,r}function rs(e,t,n){let{_proxy:r,_context:i,_subProxy:a,_descriptors:o}=e,s=r[t];return ha(s)&&o.isScriptable(t)&&(s=is(t,s,e,n)),K(s)&&s.length&&(s=as(t,s,e,o.isIndexable)),ts(t,s)&&(s=Qo(s,i,a&&a[t],o)),s}function is(e,t,n,r){let{_proxy:i,_context:a,_subProxy:o,_stack:s}=n;if(s.has(e))throw Error(`Recursion detected: `+Array.from(s).join(`->`)+`->`+e);s.add(e);let c=t(a,o||r);return s.delete(e),ts(e,c)&&(c=ls(i._scopes,i,e,c)),c}function as(e,t,n,r){let{_proxy:i,_context:a,_subProxy:o,_descriptors:s}=n;if(a.index!==void 0&&r(e))return t[a.index%t.length];if(q(t[0])){let n=t,r=i._scopes.filter(e=>e!==n);t=[];for(let c of n){let n=ls(r,i,e,c);t.push(Qo(n,a,o&&o[e],s))}}return t}function os(e,t,n){return ha(e)?e(t,n):e}var ss=(e,t)=>e===!0?t:typeof e==`string`?fa(t,e):void 0;function cs(e,t,n,r,i){for(let a of t){let t=ss(n,a);if(t){e.add(t);let a=os(t._fallback,n,i);if(a!==void 0&&a!==n&&a!==r)return a}else if(t===!1&&r!==void 0&&n!==r)return null}return!1}function ls(e,t,n,r){let i=t._rootScopes,a=os(t._fallback,n,r),o=[...e,...i],s=new Set;s.add(r);let c=us(s,o,n,a||n,r);return c===null||a!==void 0&&a!==n&&(c=us(s,o,a,c,r),c===null)?!1:Zo(Array.from(s),[``],i,a,()=>ds(t,n,r))}function us(e,t,n,r,i){for(;n;)n=cs(e,t,n,r,i);return n}function ds(e,t,n){let r=e._getTarget();t in r||(r[t]={});let i=r[t];return K(i)&&q(n)?n:i||{}}function fs(e,t,n,r){let i;for(let a of t)if(i=ps(es(a,e),n),i!==void 0)return ts(e,i)?ls(n,r,e,i):i}function ps(e,t){for(let n of t){if(!n)continue;let t=n[e];if(t!==void 0)return t}}function ms(e){let t=e._keys;return t||=e._keys=hs(e._scopes),t}function hs(e){let t=new Set;for(let n of e)for(let e of Object.keys(n).filter(e=>!e.startsWith(`_`)))t.add(e);return Array.from(t)}function gs(e,t,n,r){let{iScale:i}=e,{key:a=`r`}=this._parsing,o=Array(r),s,c,l,u;for(s=0,c=r;s<c;++s)l=s+n,u=t[l],o[s]={r:i.parse(fa(u,a),l)};return o}function _s(){return typeof window<`u`&&typeof document<`u`}function vs(e){let t=e.parentNode;return t&&t.toString()===`[object ShadowRoot]`&&(t=t.host),t}function ys(e,t,n){let r;return typeof e==`string`?(r=parseInt(e,10),e.indexOf(`%`)!==-1&&(r=r/100*t.parentNode[n])):r=e,r}var bs=e=>e.ownerDocument.defaultView.getComputedStyle(e,null);function xs(e,t){return bs(e).getPropertyValue(t)}var Ss=[`top`,`right`,`bottom`,`left`];function Cs(e,t,n){let r={};n=n?`-`+n:``;for(let i=0;i<4;i++){let a=Ss[i];r[a]=parseFloat(e[t+`-`+a+n])||0}return r.width=r.left+r.right,r.height=r.top+r.bottom,r}var ws=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function Ts(e,t){let n=e.touches,r=n&&n.length?n[0]:e,{offsetX:i,offsetY:a}=r,o=!1,s,c;if(ws(i,a,e.target))s=i,c=a;else{let e=t.getBoundingClientRect();s=r.clientX-e.left,c=r.clientY-e.top,o=!0}return{x:s,y:c,box:o}}function Es(e,t){if(`native`in e)return e;let{canvas:n,currentDevicePixelRatio:r}=t,i=bs(n),a=i.boxSizing===`border-box`,o=Cs(i,`padding`),s=Cs(i,`border`,`width`),{x:c,y:l,box:u}=Ts(e,n),d=o.left+(u&&s.left),f=o.top+(u&&s.top),{width:p,height:m}=t;return a&&(p-=o.width+s.width,m-=o.height+s.height),{x:Math.round((c-d)/p*n.width/r),y:Math.round((l-f)/m*n.height/r)}}function Ds(e,t,n){let r,i;if(t===void 0||n===void 0){let a=e&&vs(e);if(!a)t=e.clientWidth,n=e.clientHeight;else{let e=a.getBoundingClientRect(),o=bs(a),s=Cs(o,`border`,`width`),c=Cs(o,`padding`);t=e.width-c.width-s.width,n=e.height-c.height-s.height,r=ys(o.maxWidth,a,`clientWidth`),i=ys(o.maxHeight,a,`clientHeight`)}}return{width:t,height:n,maxWidth:r||va,maxHeight:i||va}}var Os=e=>Math.round(e*10)/10;function ks(e,t,n,r){let i=bs(e),a=Cs(i,`margin`),o=ys(i.maxWidth,e,`clientWidth`)||va,s=ys(i.maxHeight,e,`clientHeight`)||va,c=Ds(e,t,n),{width:l,height:u}=c;if(i.boxSizing===`content-box`){let e=Cs(i,`border`,`width`),t=Cs(i,`padding`);l-=t.width+e.width,u-=t.height+e.height}return l=Math.max(0,l-a.width),u=Math.max(0,r?l/r:u-a.height),l=Os(Math.min(l,o,c.maxWidth)),u=Os(Math.min(u,s,c.maxHeight)),l&&!u&&(u=Os(l/2)),(t!==void 0||n!==void 0)&&r&&c.height&&u>c.height&&(u=c.height,l=Os(Math.floor(u*r))),{width:l,height:u}}function As(e,t,n){let r=t||1,i=Os(e.height*r),a=Os(e.width*r);e.height=Os(e.height),e.width=Os(e.width);let o=e.canvas;return o.style&&(n||!o.style.height&&!o.style.width)&&(o.style.height=`${e.height}px`,o.style.width=`${e.width}px`),e.currentDevicePixelRatio!==r||o.height!==i||o.width!==a?(e.currentDevicePixelRatio=r,o.height=i,o.width=a,e.ctx.setTransform(r,0,0,r,0,0),!0):!1}var js=function(){let e=!1;try{let t={get passive(){return e=!0,!1}};_s()&&(window.addEventListener(`test`,null,t),window.removeEventListener(`test`,null,t))}catch{}return e}();function Ms(e,t){let n=xs(e,t),r=n&&n.match(/^(\d+)(\.\d+)?px$/);return r?+r[1]:void 0}var Ns=function(e,t){return{x(n){return e+e+t-n},setWidth(e){t=e},textAlign(e){return e===`center`?e:e===`right`?`left`:`right`},xPlus(e,t){return e-t},leftForLtr(e,t){return e-t}}},Ps=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function Fs(e,t,n){return e?Ns(t,n):Ps()}function Is(e,t){let n,r;(t===`ltr`||t===`rtl`)&&(n=e.canvas.style,r=[n.getPropertyValue(`direction`),n.getPropertyPriority(`direction`)],n.setProperty(`direction`,t,`important`),e.prevTextDirection=r)}function Ls(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty(`direction`,t[0],t[1]))}function Rs(e,t,n){return e.options.clip?e[n]:t[n]}function zs(e,t){let{xScale:n,yScale:r}=e;return n&&r?{left:Rs(n,t,`left`),right:Rs(n,t,`right`),top:Rs(r,t,`top`),bottom:Rs(r,t,`bottom`)}:t}function Bs(e,t){let n=t._clip;if(n.disabled)return!1;let r=zs(t,e.chartArea);return{left:n.left===!1?0:r.left-(n.left===!0?0:n.left),right:n.right===!1?e.width:r.right+(n.right===!0?0:n.right),top:n.top===!1?0:r.top-(n.top===!0?0:n.top),bottom:n.bottom===!1?e.height:r.bottom+(n.bottom===!0?0:n.bottom)}}var Vs=new class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,t,n,r){let i=t.listeners[r],a=t.duration;i.forEach(r=>r({chart:e,initial:t.initial,numSteps:a,currentStep:Math.min(n-t.start,a)}))}_refresh(){this._request||=(this._running=!0,Ya.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let t=0;this._charts.forEach((n,r)=>{if(!n.running||!n.items.length)return;let i=n.items,a=i.length-1,o=!1,s;for(;a>=0;--a)s=i[a],s._active?(s._total>n.duration&&(n.duration=s._total),s.tick(e),o=!0):(i[a]=i[i.length-1],i.pop());o&&(r.draw(),this._notify(r,n,e,`progress`)),i.length||(n.running=!1,this._notify(r,n,e,`complete`),n.initial=!1),t+=i.length}),this._lastDate=e,t===0&&(this._running=!1)}_getAnims(e){let t=this._charts,n=t.get(e);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},t.set(e,n)),n}listen(e,t,n){this._getAnims(e).listeners[t].push(n)}add(e,t){!t||!t.length||this._getAnims(e).items.push(...t)}has(e){return this._getAnims(e).items.length>0}start(e){let t=this._charts.get(e);t&&(t.running=!0,t.start=Date.now(),t.duration=t.items.reduce((e,t)=>Math.max(e,t._duration),0),this._refresh())}running(e){if(!this._running)return!1;let t=this._charts.get(e);return!(!t||!t.running||!t.items.length)}stop(e){let t=this._charts.get(e);if(!t||!t.items.length)return;let n=t.items,r=n.length-1;for(;r>=0;--r)n[r].cancel();t.items=[],this._notify(e,t,Date.now(),`complete`)}remove(e){return this._charts.delete(e)}},Hs=`transparent`,Us={boolean(e,t,n){return n>.5?t:e},color(e,t,n){let r=ao(e||Hs),i=r.valid&&ao(t||Hs);return i&&i.valid?i.mix(r,n).hexString():t},number(e,t,n){return e+(t-e)*n}},Ws=class{constructor(e,t,n,r){let i=t[n];r=Jo([e.to,r,i,e.from]);let a=Jo([e.from,i,r]);this._active=!0,this._fn=e.fn||Us[e.type||typeof a],this._easing=ro[e.easing]||ro.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=t,this._prop=n,this._from=a,this._to=r,this._promises=void 0}active(){return this._active}update(e,t,n){if(this._active){this._notify(!1);let r=this._target[this._prop],i=n-this._start,a=this._duration-i;this._start=n,this._duration=Math.floor(Math.max(a,e.duration)),this._total+=i,this._loop=!!e.loop,this._to=Jo([e.to,t,r,e.from]),this._from=Jo([e.from,r,t])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){let t=e-this._start,n=this._duration,r=this._prop,i=this._from,a=this._loop,o=this._to,s;if(this._active=i!==o&&(a||t<n),!this._active){this._target[r]=o,this._notify(!0);return}if(t<0){this._target[r]=i;return}s=t/n%2,s=a&&s>1?2-s:s,s=this._easing(Math.min(1,Math.max(0,s))),this._target[r]=this._fn(i,o,s)}wait(){let e=this._promises||=[];return new Promise((t,n)=>{e.push({res:t,rej:n})})}_notify(e){let t=e?`res`:`rej`,n=this._promises||[];for(let e=0;e<n.length;e++)n[e][t]()}},Gs=class{constructor(e,t){this._chart=e,this._properties=new Map,this.configure(t)}configure(e){if(!q(e))return;let t=Object.keys(Co.animation),n=this._properties;Object.getOwnPropertyNames(e).forEach(r=>{let i=e[r];if(!q(i))return;let a={};for(let e of t)a[e]=i[e];(K(i.properties)&&i.properties||[r]).forEach(e=>{(e===r||!n.has(e))&&n.set(e,a)})})}_animateOptions(e,t){let n=t.options,r=qs(e,n);if(!r)return[];let i=this._createAnimations(r,n);return n.$shared&&Ks(e.options.$animations,n).then(()=>{e.options=n},()=>{}),i}_createAnimations(e,t){let n=this._properties,r=[],i=e.$animations||={},a=Object.keys(t),o=Date.now(),s;for(s=a.length-1;s>=0;--s){let c=a[s];if(c.charAt(0)===`$`)continue;if(c===`options`){r.push(...this._animateOptions(e,t));continue}let l=t[c],u=i[c],d=n.get(c);if(u)if(d&&u.active()){u.update(d,l,o);continue}else u.cancel();if(!d||!d.duration){e[c]=l;continue}i[c]=u=new Ws(d,e,c,l),r.push(u)}return r}update(e,t){if(this._properties.size===0){Object.assign(e,t);return}let n=this._createAnimations(e,t);if(n.length)return Vs.add(this._chart,n),!0}};function Ks(e,t){let n=[],r=Object.keys(t);for(let t=0;t<r.length;t++){let i=e[r[t]];i&&i.active()&&n.push(i.wait())}return Promise.all(n)}function qs(e,t){if(!t)return;let n=e.options;if(!n){e.options=t;return}return n.$shared&&(e.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function Js(e,t){let n=e&&e.options||{},r=n.reverse,i=n.min===void 0?t:0,a=n.max===void 0?t:0;return{start:r?a:i,end:r?i:a}}function Ys(e,t,n){if(n===!1)return!1;let r=Js(e,n),i=Js(t,n);return{top:i.end,right:r.end,bottom:i.start,left:r.start}}function Xs(e){let t,n,r,i;return q(e)?(t=e.top,n=e.right,r=e.bottom,i=e.left):t=n=r=i=e,{top:t,right:n,bottom:r,left:i,disabled:e===!1}}function Zs(e,t){let n=[],r=e._getSortedDatasetMetas(t),i,a;for(i=0,a=r.length;i<a;++i)n.push(r[i].index);return n}function Qs(e,t,n,r={}){let i=e.keys,a=r.mode===`single`,o,s,c,l;if(t===null)return;let u=!1;for(o=0,s=i.length;o<s;++o){if(c=+i[o],c===n){if(u=!0,r.all)continue;break}l=e.values[c],Qi(l)&&(a||t===0||Ca(t)===Ca(l))&&(t+=l)}return!u&&!r.all?0:t}function $s(e,t){let{iScale:n,vScale:r}=t,i=n.axis===`x`?`x`:`y`,a=r.axis===`x`?`x`:`y`,o=Object.keys(e),s=Array(o.length),c,l,u;for(c=0,l=o.length;c<l;++c)u=o[c],s[c]={[i]:u,[a]:e[u]};return s}function ec(e,t){let n=e&&e.options.stacked;return n||n===void 0&&t.stack!==void 0}function tc(e,t,n){return`${e.id}.${t.id}.${n.stack||n.type}`}function nc(e){let{min:t,max:n,minDefined:r,maxDefined:i}=e.getUserBounds();return{min:r?t:-1/0,max:i?n:1/0}}function rc(e,t,n){let r=e[t]||(e[t]={});return r[n]||(r[n]={})}function ic(e,t,n,r){for(let i of t.getMatchingVisibleMetas(r).reverse()){let t=e[i.index];if(n&&t>0||!n&&t<0)return i.index}return null}function ac(e,t){let{chart:n,_cachedMeta:r}=e,i=n._stacks||={},{iScale:a,vScale:o,index:s}=r,c=a.axis,l=o.axis,u=tc(a,o,r),d=t.length,f;for(let e=0;e<d;++e){let n=t[e],{[c]:a,[l]:d}=n,p=n._stacks||={};f=p[l]=rc(i,u,a),f[s]=d,f._top=ic(f,o,!0,r.type),f._bottom=ic(f,o,!1,r.type);let m=f._visualValues||={};m[s]=d}}function oc(e,t){let n=e.scales;return Object.keys(n).filter(e=>n[e].axis===t).shift()}function sc(e,t){return Xo(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:`default`,type:`dataset`})}function cc(e,t,n){return Xo(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:`default`,type:`data`})}function lc(e,t){let n=e.controller.index,r=e.vScale&&e.vScale.axis;if(r){t||=e._parsed;for(let e of t){let t=e._stacks;if(!t||t[r]===void 0||t[r][n]===void 0)return;delete t[r][n],t[r]._visualValues!==void 0&&t[r]._visualValues[n]!==void 0&&delete t[r]._visualValues[n]}}}var uc=e=>e===`reset`||e===`none`,dc=(e,t)=>t?e:Object.assign({},e),fc=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:Zs(n,!0),values:null},pc=class{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(e,t){this.chart=e,this._ctx=e.ctx,this.index=t,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(){let e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=ec(e.vScale,e),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(e){this.index!==e&&lc(this._cachedMeta),this.index=e}linkScales(){let e=this.chart,t=this._cachedMeta,n=this.getDataset(),r=(e,t,n,r)=>e===`x`?t:e===`r`?r:n,i=t.xAxisID=J(n.xAxisID,oc(e,`x`)),a=t.yAxisID=J(n.yAxisID,oc(e,`y`)),o=t.rAxisID=J(n.rAxisID,oc(e,`r`)),s=t.indexAxis,c=t.iAxisID=r(s,i,a,o),l=t.vAxisID=r(s,a,i,o);t.xScale=this.getScaleForId(i),t.yScale=this.getScaleForId(a),t.rScale=this.getScaleForId(o),t.iScale=this.getScaleForId(c),t.vScale=this.getScaleForId(l)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){let t=this._cachedMeta;return e===t.iScale?t.vScale:t.iScale}reset(){this._update(`reset`)}_destroy(){let e=this._cachedMeta;this._data&&qa(this._data,this),e._stacked&&lc(e)}_dataCheck(){let e=this.getDataset(),t=e.data||=[],n=this._data;if(q(t)){let e=this._cachedMeta;this._data=$s(t,e)}else if(n!==t){if(n){qa(n,this);let e=this._cachedMeta;lc(e),e._parsed=[]}t&&Object.isExtensible(t)&&Ka(t,this),this._syncList=[],this._data=t}}addElements(){let e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){let t=this._cachedMeta,n=this.getDataset(),r=!1;this._dataCheck();let i=t._stacked;t._stacked=ec(t.vScale,t),t.stack!==n.stack&&(r=!0,lc(t),t.stack=n.stack),this._resyncElements(e),(r||i!==t._stacked)&&(ac(this,t._parsed),t._stacked=ec(t.vScale,t))}configure(){let e=this.chart.config,t=e.datasetScopeKeys(this._type),n=e.getOptionScopes(this.getDataset(),t,!0);this.options=e.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,t){let{_cachedMeta:n,_data:r}=this,{iScale:i,_stacked:a}=n,o=i.axis,s=e===0&&t===r.length?!0:n._sorted,c=e>0&&n._parsed[e-1],l,u,d;if(this._parsing===!1)n._parsed=r,n._sorted=!0,d=r;else{d=K(r[e])?this.parseArrayData(n,r,e,t):q(r[e])?this.parseObjectData(n,r,e,t):this.parsePrimitiveData(n,r,e,t);let i=()=>u[o]===null||c&&u[o]<c[o];for(l=0;l<t;++l)n._parsed[l+e]=u=d[l],s&&(i()&&(s=!1),c=u);n._sorted=s}a&&ac(this,d)}parsePrimitiveData(e,t,n,r){let{iScale:i,vScale:a}=e,o=i.axis,s=a.axis,c=i.getLabels(),l=i===a,u=Array(r),d,f,p;for(d=0,f=r;d<f;++d)p=d+n,u[d]={[o]:l||i.parse(c[p],p),[s]:a.parse(t[p],p)};return u}parseArrayData(e,t,n,r){let{xScale:i,yScale:a}=e,o=Array(r),s,c,l,u;for(s=0,c=r;s<c;++s)l=s+n,u=t[l],o[s]={x:i.parse(u[0],l),y:a.parse(u[1],l)};return o}parseObjectData(e,t,n,r){let{xScale:i,yScale:a}=e,{xAxisKey:o=`x`,yAxisKey:s=`y`}=this._parsing,c=Array(r),l,u,d,f;for(l=0,u=r;l<u;++l)d=l+n,f=t[d],c[l]={x:i.parse(fa(f,o),d),y:a.parse(fa(f,s),d)};return c}getParsed(e){return this._cachedMeta._parsed[e]}getDataElement(e){return this._cachedMeta.data[e]}applyStack(e,t,n){let r=this.chart,i=this._cachedMeta,a=t[e.axis];return Qs({keys:Zs(r,!0),values:t._stacks[e.axis]._visualValues},a,i.index,{mode:n})}updateRangeFromParsed(e,t,n,r){let i=n[t.axis],a=i===null?NaN:i,o=r&&n._stacks[t.axis];r&&o&&(r.values=o,a=Qs(r,i,this._cachedMeta.index)),e.min=Math.min(e.min,a),e.max=Math.max(e.max,a)}getMinMax(e,t){let n=this._cachedMeta,r=n._parsed,i=n._sorted&&e===n.iScale,a=r.length,o=this._getOtherScale(e),s=fc(t,n,this.chart),c={min:1/0,max:-1/0},{min:l,max:u}=nc(o),d,f;function p(){f=r[d];let t=f[o.axis];return!Qi(f[e.axis])||l>t||u<t}for(d=0;d<a&&!(!p()&&(this.updateRangeFromParsed(c,e,f,s),i));++d);if(i){for(d=a-1;d>=0;--d)if(!p()){this.updateRangeFromParsed(c,e,f,s);break}}return c}getAllParsedValues(e){let t=this._cachedMeta._parsed,n=[],r,i,a;for(r=0,i=t.length;r<i;++r)a=t[r][e.axis],Qi(a)&&n.push(a);return n}getMaxOverflow(){return!1}getLabelAndValue(e){let t=this._cachedMeta,n=t.iScale,r=t.vScale,i=this.getParsed(e);return{label:n?``+n.getLabelForValue(i[n.axis]):``,value:r?``+r.getLabelForValue(i[r.axis]):``}}_update(e){let t=this._cachedMeta;this.update(e||`default`),t._clip=Xs(J(this.options.clip,Ys(t.xScale,t.yScale,this.getMaxOverflow())))}update(e){}draw(){let e=this._ctx,t=this.chart,n=this._cachedMeta,r=n.data||[],i=t.chartArea,a=[],o=this._drawStart||0,s=this._drawCount||r.length-o,c=this.options.drawActiveElementsOnTop,l;for(n.dataset&&n.dataset.draw(e,i,o,s),l=o;l<o+s;++l){let t=r[l];t.hidden||(t.active&&c?a.push(t):t.draw(e,i))}for(l=0;l<a.length;++l)a[l].draw(e,i)}getStyle(e,t){let n=t?`active`:`default`;return e===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(n):this.resolveDataElementOptions(e||0,n)}getContext(e,t,n){let r=this.getDataset(),i;if(e>=0&&e<this._cachedMeta.data.length){let t=this._cachedMeta.data[e];i=t.$context||=cc(this.getContext(),e,t),i.parsed=this.getParsed(e),i.raw=r.data[e],i.index=i.dataIndex=e}else i=this.$context||=sc(this.chart.getContext(),this.index),i.dataset=r,i.index=i.datasetIndex=this.index;return i.active=!!t,i.mode=n,i}resolveDatasetElementOptions(e){return this._resolveElementOptions(this.datasetElementType.id,e)}resolveDataElementOptions(e,t){return this._resolveElementOptions(this.dataElementType.id,t,e)}_resolveElementOptions(e,t=`default`,n){let r=t===`active`,i=this._cachedDataOpts,a=e+`-`+t,o=i[a],s=this.enableOptionSharing&&ma(n);if(o)return dc(o,s);let c=this.chart.config,l=c.datasetElementScopeKeys(this._type,e),u=r?[`${e}Hover`,`hover`,e,``]:[e,``],d=c.getOptionScopes(this.getDataset(),l),f=Object.keys(Co.elements[e]),p=c.resolveNamedOptions(d,f,()=>this.getContext(n,r,t),u);return p.$shared&&(p.$shared=s,i[a]=Object.freeze(dc(p,s))),p}_resolveAnimations(e,t,n){let r=this.chart,i=this._cachedDataOpts,a=`animation-${t}`,o=i[a];if(o)return o;let s;if(r.options.animation!==!1){let r=this.chart.config,i=r.datasetAnimationScopeKeys(this._type,t),a=r.getOptionScopes(this.getDataset(),i);s=r.createResolver(a,this.getContext(e,n,t))}let c=new Gs(r,s&&s.animations);return s&&s._cacheable&&(i[a]=Object.freeze(c)),c}getSharedOptions(e){if(e.$shared)return this._sharedOptions||=Object.assign({},e)}includeOptions(e,t){return!t||uc(e)||this.chart._animationsDisabled}_getSharedOptions(e,t){let n=this.resolveDataElementOptions(e,t),r=this._sharedOptions,i=this.getSharedOptions(n),a=this.includeOptions(t,i)||i!==r;return this.updateSharedOptions(i,t,n),{sharedOptions:i,includeOptions:a}}updateElement(e,t,n,r){uc(r)?Object.assign(e,n):this._resolveAnimations(t,r).update(e,n)}updateSharedOptions(e,t,n){e&&!uc(t)&&this._resolveAnimations(void 0,t).update(e,n)}_setStyle(e,t,n,r){e.active=r;let i=this.getStyle(t,r);this._resolveAnimations(t,n,r).update(e,{options:!r&&this.getSharedOptions(i)||i})}removeHoverStyle(e,t,n){this._setStyle(e,n,`active`,!1)}setHoverStyle(e,t,n){this._setStyle(e,n,`active`,!0)}_removeDatasetHoverStyle(){let e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,`active`,!1)}_setDatasetHoverStyle(){let e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,`active`,!0)}_resyncElements(e){let t=this._data,n=this._cachedMeta.data;for(let[e,t,n]of this._syncList)this[e](t,n);this._syncList=[];let r=n.length,i=t.length,a=Math.min(i,r);a&&this.parse(0,a),i>r?this._insertElements(r,i-r,e):i<r&&this._removeElements(i,r-i)}_insertElements(e,t,n=!0){let r=this._cachedMeta,i=r.data,a=e+t,o,s=e=>{for(e.length+=t,o=e.length-1;o>=a;o--)e[o]=e[o-t]};for(s(i),o=e;o<a;++o)i[o]=new this.dataElementType;this._parsing&&s(r._parsed),this.parse(e,t),n&&this.updateElements(i,e,t,`reset`)}updateElements(e,t,n,r){}_removeElements(e,t){let n=this._cachedMeta;if(this._parsing){let r=n._parsed.splice(e,t);n._stacked&&lc(n,r)}n.data.splice(e,t)}_sync(e){if(this._parsing)this._syncList.push(e);else{let[t,n,r]=e;this[t](n,r)}this.chart._dataChanges.push([this.index,...e])}_onDataPush(){let e=arguments.length;this._sync([`_insertElements`,this.getDataset().data.length-e,e])}_onDataPop(){this._sync([`_removeElements`,this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync([`_removeElements`,0,1])}_onDataSplice(e,t){t&&this._sync([`_removeElements`,e,t]);let n=arguments.length-2;n&&this._sync([`_insertElements`,e,n])}_onDataUnshift(){this._sync([`_insertElements`,0,arguments.length])}};function mc(e,t){if(!e._cache.$bar){let n=e.getMatchingVisibleMetas(t),r=[];for(let t=0,i=n.length;t<i;t++)r=r.concat(n[t].controller.getAllParsedValues(e));e._cache.$bar=Ja(r.sort((e,t)=>e-t))}return e._cache.$bar}function hc(e){let t=e.iScale,n=mc(t,e.type),r=t._length,i,a,o,s,c=()=>{o===32767||o===-32768||(ma(s)&&(r=Math.min(r,Math.abs(o-s)||r)),s=o)};for(i=0,a=n.length;i<a;++i)o=t.getPixelForValue(n[i]),c();for(s=void 0,i=0,a=t.ticks.length;i<a;++i)o=t.getPixelForTick(i),c();return r}function gc(e,t,n,r){let i=n.barThickness,a,o;return G(i)?(a=t.min*n.categoryPercentage,o=n.barPercentage):(a=i*r,o=1),{chunk:a/r,ratio:o,start:t.pixels[e]-a/2}}function _c(e,t,n,r){let i=t.pixels,a=i[e],o=e>0?i[e-1]:null,s=e<i.length-1?i[e+1]:null,c=n.categoryPercentage;o===null&&(o=a-(s===null?t.end-t.start:s-a)),s===null&&(s=a+a-o);let l=a-(a-Math.min(o,s))/2*c;return{chunk:Math.abs(s-o)/2*c/r,ratio:n.barPercentage,start:l}}function vc(e,t,n,r){let i=n.parse(e[0],r),a=n.parse(e[1],r),o=Math.min(i,a),s=Math.max(i,a),c=o,l=s;Math.abs(o)>Math.abs(s)&&(c=s,l=o),t[n.axis]=l,t._custom={barStart:c,barEnd:l,start:i,end:a,min:o,max:s}}function yc(e,t,n,r){return K(e)?vc(e,t,n,r):t[n.axis]=n.parse(e,r),t}function bc(e,t,n,r){let i=e.iScale,a=e.vScale,o=i.getLabels(),s=i===a,c=[],l,u,d,f;for(l=n,u=n+r;l<u;++l)f=t[l],d={},d[i.axis]=s||i.parse(o[l],l),c.push(yc(f,d,a,l));return c}function xc(e){return e&&e.barStart!==void 0&&e.barEnd!==void 0}function Sc(e,t,n){return e===0?(t.isHorizontal()?1:-1)*(t.min>=n?1:-1):Ca(e)}function Cc(e){let t,n,r,i,a;return e.horizontal?(t=e.base>e.x,n=`left`,r=`right`):(t=e.base<e.y,n=`bottom`,r=`top`),t?(i=`end`,a=`start`):(i=`start`,a=`end`),{start:n,end:r,reverse:t,top:i,bottom:a}}function wc(e,t,n,r){let i=t.borderSkipped,a={};if(!i){e.borderSkipped=a;return}if(i===!0){e.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}let{start:o,end:s,reverse:c,top:l,bottom:u}=Cc(e);i===`middle`&&n&&(e.enableBorderRadius=!0,(n._top||0)===r?i=l:(n._bottom||0)===r?i=u:(a[Tc(u,o,s,c)]=!0,i=l)),a[Tc(i,o,s,c)]=!0,e.borderSkipped=a}function Tc(e,t,n,r){return r?(e=Ec(e,t,n),e=Dc(e,n,t)):e=Dc(e,t,n),e}function Ec(e,t,n){return e===t?n:e===n?t:e}function Dc(e,t,n){return e===`start`?t:e===`end`?n:e}function Oc(e,{inflateAmount:t},n){e.inflateAmount=t===`auto`?n===1?.33:0:t}var kc=class extends pc{static id=`bar`;static defaults={datasetElementType:!1,dataElementType:`bar`,categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:`number`,properties:[`x`,`y`,`base`,`width`,`height`]}}};static overrides={scales:{_index_:{type:`category`,offset:!0,grid:{offset:!0}},_value_:{type:`linear`,beginAtZero:!0}}};parsePrimitiveData(e,t,n,r){return bc(e,t,n,r)}parseArrayData(e,t,n,r){return bc(e,t,n,r)}parseObjectData(e,t,n,r){let{iScale:i,vScale:a}=e,{xAxisKey:o=`x`,yAxisKey:s=`y`}=this._parsing,c=i.axis===`x`?o:s,l=a.axis===`x`?o:s,u=[],d,f,p,m;for(d=n,f=n+r;d<f;++d)m=t[d],p={},p[i.axis]=i.parse(fa(m,c),d),u.push(yc(fa(m,l),p,a,d));return u}updateRangeFromParsed(e,t,n,r){super.updateRangeFromParsed(e,t,n,r);let i=n._custom;i&&t===this._cachedMeta.vScale&&(e.min=Math.min(e.min,i.min),e.max=Math.max(e.max,i.max))}getMaxOverflow(){return 0}getLabelAndValue(e){let{iScale:t,vScale:n}=this._cachedMeta,r=this.getParsed(e),i=r._custom,a=xc(i)?`[`+i.start+`, `+i.end+`]`:``+n.getLabelForValue(r[n.axis]);return{label:``+t.getLabelForValue(r[t.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();let e=this._cachedMeta;e.stack=this.getDataset().stack}update(e){let t=this._cachedMeta;this.updateElements(t.data,0,t.data.length,e)}updateElements(e,t,n,r){let i=r===`reset`,{index:a,_cachedMeta:{vScale:o}}=this,s=o.getBasePixel(),c=o.isHorizontal(),l=this._getRuler(),{sharedOptions:u,includeOptions:d}=this._getSharedOptions(t,r);for(let f=t;f<t+n;f++){let t=this.getParsed(f),n=i||G(t[o.axis])?{base:s,head:s}:this._calculateBarValuePixels(f),p=this._calculateBarIndexPixels(f,l),m=(t._stacks||{})[o.axis],h={horizontal:c,base:n.base,enableBorderRadius:!m||xc(t._custom)||a===m._top||a===m._bottom,x:c?n.head:p.center,y:c?p.center:n.head,height:c?p.size:Math.abs(n.size),width:c?Math.abs(n.size):p.size};d&&(h.options=u||this.resolveDataElementOptions(f,e[f].active?`active`:r));let g=h.options||e[f].options;wc(h,g,m,a),Oc(h,g,l.ratio),this.updateElement(e[f],f,h,r)}}_getStacks(e,t){let{iScale:n}=this._cachedMeta,r=n.getMatchingVisibleMetas(this._type).filter(e=>e.controller.options.grouped),i=n.options.stacked,a=[],o=this._cachedMeta.controller.getParsed(t),s=o&&o[n.axis],c=e=>{let t=e._parsed.find(e=>e[n.axis]===s),r=t&&t[e.vScale.axis];if(G(r)||isNaN(r))return!0};for(let n of r)if(!(t!==void 0&&c(n))&&((i===!1||a.indexOf(n.stack)===-1||i===void 0&&n.stack===void 0)&&a.push(n.stack),n.index===e))break;return a.length||a.push(void 0),a}_getStackCount(e){return this._getStacks(void 0,e).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){let e=this.chart.scales,t=this.chart.options.indexAxis;return Object.keys(e).filter(n=>e[n].axis===t).shift()}_getAxis(){let e={},t=this.getFirstScaleIdForIndexAxis();for(let n of this.chart.data.datasets)e[J(this.chart.options.indexAxis===`x`?n.xAxisID:n.yAxisID,t)]=!0;return Object.keys(e)}_getStackIndex(e,t,n){let r=this._getStacks(e,n),i=t===void 0?-1:r.indexOf(t);return i===-1?r.length-1:i}_getRuler(){let e=this.options,t=this._cachedMeta,n=t.iScale,r=[],i,a;for(i=0,a=t.data.length;i<a;++i)r.push(n.getPixelForValue(this.getParsed(i)[n.axis],i));let o=e.barThickness;return{min:o||hc(t),pixels:r,start:n._startPixel,end:n._endPixel,stackCount:this._getStackCount(),scale:n,grouped:e.grouped,ratio:o?1:e.categoryPercentage*e.barPercentage}}_calculateBarValuePixels(e){let{_cachedMeta:{vScale:t,_stacked:n,index:r},options:{base:i,minBarLength:a}}=this,o=i||0,s=this.getParsed(e),c=s._custom,l=xc(c),u=s[t.axis],d=0,f=n?this.applyStack(t,s,n):u,p,m;f!==u&&(d=f-u,f=u),l&&(u=c.barStart,f=c.barEnd-c.barStart,u!==0&&Ca(u)!==Ca(c.barEnd)&&(d=0),d+=u);let h=!G(i)&&!l?i:d,g=t.getPixelForValue(h);if(p=this.chart.getDataVisibility(e)?t.getPixelForValue(d+f):g,m=p-g,Math.abs(m)<a){m=Sc(m,t,o)*a,u===o&&(g-=m/2);let e=t.getPixelForDecimal(0),i=t.getPixelForDecimal(1);g=Math.max(Math.min(g,Math.max(e,i)),Math.min(e,i)),p=g+m,n&&!l&&(s._stacks[t.axis]._visualValues[r]=t.getValueForPixel(p)-t.getValueForPixel(g))}if(g===t.getPixelForValue(o)){let e=Ca(m)*t.getLineWidthForValue(o)/2;g+=e,m-=e}return{size:m,base:g,head:p,center:p+m/2}}_calculateBarIndexPixels(e,t){let n=t.scale,r=this.options,i=r.skipNull,a=J(r.maxBarThickness,1/0),o,s,c=this._getAxisCount();if(t.grouped){let n=i?this._getStackCount(e):t.stackCount,l=r.barThickness===`flex`?_c(e,t,r,n*c):gc(e,t,r,n*c),u=this.chart.options.indexAxis===`x`?this.getDataset().xAxisID:this.getDataset().yAxisID,d=this._getAxis().indexOf(J(u,this.getFirstScaleIdForIndexAxis())),f=this._getStackIndex(this.index,this._cachedMeta.stack,i?e:void 0)+d;o=l.start+l.chunk*f+l.chunk/2,s=Math.min(a,l.chunk*l.ratio)}else o=n.getPixelForValue(this.getParsed(e)[n.axis],e),s=Math.min(a,t.min*t.ratio);return{base:o-s/2,head:o+s/2,center:o,size:s}}draw(){let e=this._cachedMeta,t=e.vScale,n=e.data,r=n.length,i=0;for(;i<r;++i)this.getParsed(i)[t.axis]!==null&&!n[i].hidden&&n[i].draw(this._ctx)}};function Ac(e,t,n){let r=1,i=1,a=0,o=0;if(t<Q){let s=e,c=s+t,l=Math.cos(s),u=Math.sin(s),d=Math.cos(c),f=Math.sin(c),p=(e,t,r)=>La(e,s,c,!0)?1:Math.max(t,t*n,r,r*n),m=(e,t,r)=>La(e,s,c,!0)?-1:Math.min(t,t*n,r,r*n),h=p(0,l,d),g=p($,u,f),_=m(Z,l,d),v=m(Z+$,u,f);r=(h-_)/2,i=(g-v)/2,a=-(h+_)/2,o=-(g+v)/2}return{ratioX:r,ratioY:i,offsetX:a,offsetY:o}}var jc=class extends pc{static id=`doughnut`;static defaults={datasetElementType:!1,dataElementType:`arc`,animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:`number`,properties:[`circumference`,`endAngle`,`innerRadius`,`outerRadius`,`startAngle`,`x`,`y`,`offset`,`borderWidth`,`spacing`]}},cutout:`50%`,rotation:0,circumference:360,radius:`100%`,spacing:0,indexAxis:`r`};static descriptors={_scriptable:e=>e!==`spacing`,_indexable:e=>e!==`spacing`&&!e.startsWith(`borderDash`)&&!e.startsWith(`hoverBorderDash`)};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){let t=e.data,{labels:{pointStyle:n,textAlign:r,color:i,useBorderRadius:a,borderRadius:o}}=e.legend.options;return t.labels.length&&t.datasets.length?t.labels.map((t,s)=>{let c=e.getDatasetMeta(0).controller.getStyle(s);return{text:t,fillStyle:c.backgroundColor,fontColor:i,hidden:!e.getDataVisibility(s),lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:c.borderWidth,strokeStyle:c.borderColor,textAlign:r,pointStyle:n,borderRadius:a&&(o||c.borderRadius),index:s}}):[]}},onClick(e,t,n){n.chart.toggleDataVisibility(t.index),n.chart.update()}}}};constructor(e,t){super(e,t),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(e,t){let n=this.getDataset().data,r=this._cachedMeta;if(this._parsing===!1)r._parsed=n;else{let i=e=>+n[e];if(q(n[e])){let{key:e=`value`}=this._parsing;i=t=>+fa(n[t],e)}let a,o;for(a=e,o=e+t;a<o;++a)r._parsed[a]=i(a)}}_getRotation(){return ja(this.options.rotation-90)}_getCircumference(){return ja(this.options.circumference)}_getRotationExtents(){let e=Q,t=-Q;for(let n=0;n<this.chart.data.datasets.length;++n)if(this.chart.isDatasetVisible(n)&&this.chart.getDatasetMeta(n).type===this._type){let r=this.chart.getDatasetMeta(n).controller,i=r._getRotation(),a=r._getCircumference();e=Math.min(e,i),t=Math.max(t,i+a)}return{rotation:e,circumference:t-e}}update(e){let{chartArea:t}=this.chart,n=this._cachedMeta,r=n.data,i=this.getMaxBorderWidth()+this.getMaxOffset(r)+this.options.spacing,a=Math.max((Math.min(t.width,t.height)-i)/2,0),o=Math.min(ea(this.options.cutout,a),1),s=this._getRingWeight(this.index),{circumference:c,rotation:l}=this._getRotationExtents(),{ratioX:u,ratioY:d,offsetX:f,offsetY:p}=Ac(l,c,o),m=(t.width-i)/u,h=(t.height-i)/d,g=Math.max(Math.min(m,h)/2,0),_=ta(this.options.radius,g),v=(_-Math.max(_*o,0))/this._getVisibleDatasetWeightTotal();this.offsetX=f*_,this.offsetY=p*_,n.total=this.calculateTotal(),this.outerRadius=_-v*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-v*s,0),this.updateElements(r,0,r.length,e)}_circumference(e,t){let n=this.options,r=this._cachedMeta,i=this._getCircumference();return t&&n.animation.animateRotate||!this.chart.getDataVisibility(e)||r._parsed[e]===null||r.data[e].hidden?0:this.calculateCircumference(r._parsed[e]*i/Q)}updateElements(e,t,n,r){let i=r===`reset`,a=this.chart,o=a.chartArea,s=a.options.animation,c=(o.left+o.right)/2,l=(o.top+o.bottom)/2,u=i&&s.animateScale,d=u?0:this.innerRadius,f=u?0:this.outerRadius,{sharedOptions:p,includeOptions:m}=this._getSharedOptions(t,r),h=this._getRotation(),g;for(g=0;g<t;++g)h+=this._circumference(g,i);for(g=t;g<t+n;++g){let t=this._circumference(g,i),n=e[g],a={x:c+this.offsetX,y:l+this.offsetY,startAngle:h,endAngle:h+t,circumference:t,outerRadius:f,innerRadius:d};m&&(a.options=p||this.resolveDataElementOptions(g,n.active?`active`:r)),h+=t,this.updateElement(n,g,a,r)}}calculateTotal(){let e=this._cachedMeta,t=e.data,n=0,r;for(r=0;r<t.length;r++){let i=e._parsed[r];i!==null&&!isNaN(i)&&this.chart.getDataVisibility(r)&&!t[r].hidden&&(n+=Math.abs(i))}return n}calculateCircumference(e){let t=this._cachedMeta.total;return t>0&&!isNaN(e)?Math.abs(e)/t*Q:0}getLabelAndValue(e){let t=this._cachedMeta,n=this.chart,r=n.data.labels||[],i=mo(t._parsed[e],n.options.locale);return{label:r[e]||``,value:i}}getMaxBorderWidth(e){let t=0,n=this.chart,r,i,a,o,s;if(!e){for(r=0,i=n.data.datasets.length;r<i;++r)if(n.isDatasetVisible(r)){a=n.getDatasetMeta(r),e=a.data,o=a.controller;break}}if(!e)return 0;for(r=0,i=e.length;r<i;++r)s=o.resolveDataElementOptions(r),s.borderAlign!==`inner`&&(t=Math.max(t,s.borderWidth||0,s.hoverBorderWidth||0));return t}getMaxOffset(e){let t=0;for(let n=0,r=e.length;n<r;++n){let e=this.resolveDataElementOptions(n);t=Math.max(t,e.offset||0,e.hoverOffset||0)}return t}_getRingWeightOffset(e){let t=0;for(let n=0;n<e;++n)this.chart.isDatasetVisible(n)&&(t+=this._getRingWeight(n));return t}_getRingWeight(e){return Math.max(J(this.chart.data.datasets[e].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}},Mc=class extends pc{static id=`polarArea`;static defaults={dataElementType:`arc`,animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:`number`,properties:[`x`,`y`,`startAngle`,`endAngle`,`innerRadius`,`outerRadius`]}},indexAxis:`r`,startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){let t=e.data;if(t.labels.length&&t.datasets.length){let{labels:{pointStyle:n,color:r}}=e.legend.options;return t.labels.map((t,i)=>{let a=e.getDatasetMeta(0).controller.getStyle(i);return{text:t,fillStyle:a.backgroundColor,strokeStyle:a.borderColor,fontColor:r,lineWidth:a.borderWidth,pointStyle:n,hidden:!e.getDataVisibility(i),index:i}})}return[]}},onClick(e,t,n){n.chart.toggleDataVisibility(t.index),n.chart.update()}}},scales:{r:{type:`radialLinear`,angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(e,t){super(e,t),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(e){let t=this._cachedMeta,n=this.chart,r=n.data.labels||[],i=mo(t._parsed[e].r,n.options.locale);return{label:r[e]||``,value:i}}parseObjectData(e,t,n,r){return gs.bind(this)(e,t,n,r)}update(e){let t=this._cachedMeta.data;this._updateRadius(),this.updateElements(t,0,t.length,e)}getMinMax(){let e=this._cachedMeta,t={min:1/0,max:-1/0};return e.data.forEach((e,n)=>{let r=this.getParsed(n).r;!isNaN(r)&&this.chart.getDataVisibility(n)&&(r<t.min&&(t.min=r),r>t.max&&(t.max=r))}),t}_updateRadius(){let e=this.chart,t=e.chartArea,n=e.options,r=Math.min(t.right-t.left,t.bottom-t.top),i=Math.max(r/2,0),a=(i-Math.max(n.cutoutPercentage?i/100*n.cutoutPercentage:1,0))/e.getVisibleDatasetCount();this.outerRadius=i-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(e,t,n,r){let i=r===`reset`,a=this.chart,o=a.options.animation,s=this._cachedMeta.rScale,c=s.xCenter,l=s.yCenter,u=s.getIndexAngle(0)-.5*Z,d=u,f,p=360/this.countVisibleElements();for(f=0;f<t;++f)d+=this._computeAngle(f,r,p);for(f=t;f<t+n;f++){let t=e[f],n=d,m=d+this._computeAngle(f,r,p),h=a.getDataVisibility(f)?s.getDistanceFromCenterForValue(this.getParsed(f).r):0;d=m,i&&(o.animateScale&&(h=0),o.animateRotate&&(n=m=u));let g={x:c,y:l,innerRadius:0,outerRadius:h,startAngle:n,endAngle:m,options:this.resolveDataElementOptions(f,t.active?`active`:r)};this.updateElement(t,f,g,r)}}countVisibleElements(){let e=this._cachedMeta,t=0;return e.data.forEach((e,n)=>{!isNaN(this.getParsed(n).r)&&this.chart.getDataVisibility(n)&&t++}),t}_computeAngle(e,t,n){return this.chart.getDataVisibility(e)?ja(this.resolveDataElementOptions(e,t).angle||n):0}};function Nc(){throw Error(`This method is not implemented: Check that a complete date adapter is provided.`)}var Pc={_date:class e{static override(t){Object.assign(e.prototype,t)}options;constructor(e){this.options=e||{}}init(){}formats(){return Nc()}parse(){return Nc()}format(){return Nc()}add(){return Nc()}diff(){return Nc()}startOf(){return Nc()}endOf(){return Nc()}}};function Fc(e,t,n,r){let{controller:i,data:a,_sorted:o}=e,s=i._cachedMeta.iScale,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(s&&t===s.axis&&t!==`r`&&o&&a.length){let o=s._reversePixels?Ua:Ha;if(!r){let r=o(a,t,n);if(c){let{vScale:t}=i._cachedMeta,{_parsed:n}=e,a=n.slice(0,r.lo+1).reverse().findIndex(e=>!G(e[t.axis]));r.lo-=Math.max(0,a);let o=n.slice(r.hi).findIndex(e=>!G(e[t.axis]));r.hi+=Math.max(0,o)}return r}else if(i._sharedOptions){let e=a[0],r=typeof e.getRange==`function`&&e.getRange(t);if(r){let e=o(a,t,n-r),i=o(a,t,n+r);return{lo:e.lo,hi:i.hi}}}}return{lo:0,hi:a.length-1}}function Ic(e,t,n,r,i){let a=e.getSortedVisibleDatasetMetas(),o=n[t];for(let e=0,n=a.length;e<n;++e){let{index:n,data:s}=a[e],{lo:c,hi:l}=Fc(a[e],t,o,i);for(let e=c;e<=l;++e){let t=s[e];t.skip||r(t,n,e)}}}function Lc(e){let t=e.indexOf(`x`)!==-1,n=e.indexOf(`y`)!==-1;return function(e,r){let i=t?Math.abs(e.x-r.x):0,a=n?Math.abs(e.y-r.y):0;return Math.sqrt(i**2+a**2)}}function Rc(e,t,n,r,i){let a=[];return!i&&!e.isPointInArea(t)||Ic(e,n,t,function(n,o,s){!i&&!jo(n,e.chartArea,0)||n.inRange(t.x,t.y,r)&&a.push({element:n,datasetIndex:o,index:s})},!0),a}function zc(e,t,n,r){let i=[];function a(e,n,a){let{startAngle:o,endAngle:s}=e.getProps([`startAngle`,`endAngle`],r),{angle:c}=Pa(e,{x:t.x,y:t.y});La(c,o,s)&&i.push({element:e,datasetIndex:n,index:a})}return Ic(e,n,t,a),i}function Bc(e,t,n,r,i,a){let o=[],s=Lc(n),c=1/0;function l(n,l,u){let d=n.inRange(t.x,t.y,i);if(r&&!d)return;let f=n.getCenterPoint(i);if(!(a||e.isPointInArea(f))&&!d)return;let p=s(t,f);p<c?(o=[{element:n,datasetIndex:l,index:u}],c=p):p===c&&o.push({element:n,datasetIndex:l,index:u})}return Ic(e,n,t,l),o}function Vc(e,t,n,r,i,a){return!a&&!e.isPointInArea(t)?[]:n===`r`&&!r?zc(e,t,n,i):Bc(e,t,n,r,i,a)}function Hc(e,t,n,r,i){let a=[],o=n===`x`?`inXRange`:`inYRange`,s=!1;return Ic(e,n,t,(e,r,c)=>{e[o]&&e[o](t[n],i)&&(a.push({element:e,datasetIndex:r,index:c}),s||=e.inRange(t.x,t.y,i))}),r&&!s?[]:a}var Uc={evaluateInteractionItems:Ic,modes:{index(e,t,n,r){let i=Es(t,e),a=n.axis||`x`,o=n.includeInvisible||!1,s=n.intersect?Rc(e,i,a,r,o):Vc(e,i,a,!1,r,o),c=[];return s.length?(e.getSortedVisibleDatasetMetas().forEach(e=>{let t=s[0].index,n=e.data[t];n&&!n.skip&&c.push({element:n,datasetIndex:e.index,index:t})}),c):[]},dataset(e,t,n,r){let i=Es(t,e),a=n.axis||`xy`,o=n.includeInvisible||!1,s=n.intersect?Rc(e,i,a,r,o):Vc(e,i,a,!1,r,o);if(s.length>0){let t=s[0].datasetIndex,n=e.getDatasetMeta(t).data;s=[];for(let e=0;e<n.length;++e)s.push({element:n[e],datasetIndex:t,index:e})}return s},point(e,t,n,r){return Rc(e,Es(t,e),n.axis||`xy`,r,n.includeInvisible||!1)},nearest(e,t,n,r){let i=Es(t,e),a=n.axis||`xy`,o=n.includeInvisible||!1;return Vc(e,i,a,n.intersect,r,o)},x(e,t,n,r){return Hc(e,Es(t,e),`x`,n.intersect,r)},y(e,t,n,r){return Hc(e,Es(t,e),`y`,n.intersect,r)}}},Wc=[`left`,`top`,`right`,`bottom`];function Gc(e,t){return e.filter(e=>e.pos===t)}function Kc(e,t){return e.filter(e=>Wc.indexOf(e.pos)===-1&&e.box.axis===t)}function qc(e,t){return e.sort((e,n)=>{let r=t?n:e,i=t?e:n;return r.weight===i.weight?r.index-i.index:r.weight-i.weight})}function Jc(e){let t=[],n,r,i,a,o,s;for(n=0,r=(e||[]).length;n<r;++n)i=e[n],{position:a,options:{stack:o,stackWeight:s=1}}=i,t.push({index:n,box:i,pos:a,horizontal:i.isHorizontal(),weight:i.weight,stack:o&&a+o,stackWeight:s});return t}function Yc(e){let t={};for(let n of e){let{stack:e,pos:r,stackWeight:i}=n;if(!e||!Wc.includes(r))continue;let a=t[e]||(t[e]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=i}return t}function Xc(e,t){let n=Yc(e),{vBoxMaxWidth:r,hBoxMaxHeight:i}=t,a,o,s;for(a=0,o=e.length;a<o;++a){s=e[a];let{fullSize:o}=s.box,c=n[s.stack],l=c&&s.stackWeight/c.weight;s.horizontal?(s.width=l?l*r:o&&t.availableWidth,s.height=i):(s.width=r,s.height=l?l*i:o&&t.availableHeight)}return n}function Zc(e){let t=Jc(e),n=qc(t.filter(e=>e.box.fullSize),!0),r=qc(Gc(t,`left`),!0),i=qc(Gc(t,`right`)),a=qc(Gc(t,`top`),!0),o=qc(Gc(t,`bottom`)),s=Kc(t,`x`),c=Kc(t,`y`);return{fullSize:n,leftAndTop:r.concat(a),rightAndBottom:i.concat(c).concat(o).concat(s),chartArea:Gc(t,`chartArea`),vertical:r.concat(i).concat(c),horizontal:a.concat(o).concat(s)}}function Qc(e,t,n,r){return Math.max(e[n],t[n])+Math.max(e[r],t[r])}function $c(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function el(e,t,n,r){let{pos:i,box:a}=n,o=e.maxPadding;if(!q(i)){n.size&&(e[i]-=n.size);let t=r[n.stack]||{size:0,count:1};t.size=Math.max(t.size,n.horizontal?a.height:a.width),n.size=t.size/t.count,e[i]+=n.size}a.getPadding&&$c(o,a.getPadding());let s=Math.max(0,t.outerWidth-Qc(o,e,`left`,`right`)),c=Math.max(0,t.outerHeight-Qc(o,e,`top`,`bottom`)),l=s!==e.w,u=c!==e.h;return e.w=s,e.h=c,n.horizontal?{same:l,other:u}:{same:u,other:l}}function tl(e){let t=e.maxPadding;function n(n){let r=Math.max(t[n]-e[n],0);return e[n]+=r,r}e.y+=n(`top`),e.x+=n(`left`),n(`right`),n(`bottom`)}function nl(e,t){let n=t.maxPadding;function r(e){let r={left:0,top:0,right:0,bottom:0};return e.forEach(e=>{r[e]=Math.max(t[e],n[e])}),r}return r(e?[`left`,`right`]:[`top`,`bottom`])}function rl(e,t,n,r){let i=[],a,o,s,c,l,u;for(a=0,o=e.length,l=0;a<o;++a){s=e[a],c=s.box,c.update(s.width||t.w,s.height||t.h,nl(s.horizontal,t));let{same:o,other:d}=el(t,n,s,r);l|=o&&i.length,u||=d,c.fullSize||i.push(s)}return l&&rl(i,t,n,r)||u}function il(e,t,n,r,i){e.top=n,e.left=t,e.right=t+r,e.bottom=n+i,e.width=r,e.height=i}function al(e,t,n,r){let i=n.padding,{x:a,y:o}=t;for(let s of e){let e=s.box,c=r[s.stack]||{count:1,placed:0,weight:1},l=s.stackWeight/c.weight||1;if(s.horizontal){let r=t.w*l,a=c.size||e.height;ma(c.start)&&(o=c.start),e.fullSize?il(e,i.left,o,n.outerWidth-i.right-i.left,a):il(e,t.left+c.placed,o,r,a),c.start=o,c.placed+=r,o=e.bottom}else{let r=t.h*l,o=c.size||e.width;ma(c.start)&&(a=c.start),e.fullSize?il(e,a,i.top,o,n.outerHeight-i.bottom-i.top):il(e,a,t.top+c.placed,o,r),c.start=a,c.placed+=r,a=e.right}}t.x=a,t.y=o}var ol={addBox(e,t){e.boxes||=[],t.fullSize=t.fullSize||!1,t.position=t.position||`top`,t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(e){t.draw(e)}}]},e.boxes.push(t)},removeBox(e,t){let n=e.boxes?e.boxes.indexOf(t):-1;n!==-1&&e.boxes.splice(n,1)},configure(e,t,n){t.fullSize=n.fullSize,t.position=n.position,t.weight=n.weight},update(e,t,n,r){if(!e)return;let i=Ko(e.options.layout.padding),a=Math.max(t-i.width,0),o=Math.max(n-i.height,0),s=Zc(e.boxes),c=s.vertical,l=s.horizontal;X(e.boxes,e=>{typeof e.beforeLayout==`function`&&e.beforeLayout()});let u=c.reduce((e,t)=>t.box.options&&t.box.options.display===!1?e:e+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:n,padding:i,availableWidth:a,availableHeight:o,vBoxMaxWidth:a/2/u,hBoxMaxHeight:o/2}),f=Object.assign({},i);$c(f,Ko(r));let p=Object.assign({maxPadding:f,w:a,h:o,x:i.left,y:i.top},i),m=Xc(c.concat(l),d);rl(s.fullSize,p,d,m),rl(c,p,d,m),rl(l,p,d,m)&&rl(c,p,d,m),tl(p),al(s.leftAndTop,p,d,m),p.x+=p.w,p.y+=p.h,al(s.rightAndBottom,p,d,m),e.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},X(s.chartArea,t=>{let n=t.box;Object.assign(n,e.chartArea),n.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})})}},sl=class{acquireContext(e,t){}releaseContext(e){return!1}addEventListener(e,t,n){}removeEventListener(e,t,n){}getDevicePixelRatio(){return 1}getMaximumSize(e,t,n,r){return t=Math.max(0,t||e.width),n||=e.height,{width:t,height:Math.max(0,r?Math.floor(t/r):n)}}isAttached(e){return!0}updateConfig(e){}},cl=class extends sl{acquireContext(e){return e&&e.getContext&&e.getContext(`2d`)||null}updateConfig(e){e.options.animation=!1}},ll=`$chartjs`,ul={touchstart:`mousedown`,touchmove:`mousemove`,touchend:`mouseup`,pointerenter:`mouseenter`,pointerdown:`mousedown`,pointermove:`mousemove`,pointerup:`mouseup`,pointerleave:`mouseout`,pointerout:`mouseout`},dl=e=>e===null||e===``;function fl(e,t){let n=e.style,r=e.getAttribute(`height`),i=e.getAttribute(`width`);if(e[ll]={initial:{height:r,width:i,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||`block`,n.boxSizing=n.boxSizing||`border-box`,dl(i)){let t=Ms(e,`width`);t!==void 0&&(e.width=t)}if(dl(r))if(e.style.height===``)e.height=e.width/(t||2);else{let t=Ms(e,`height`);t!==void 0&&(e.height=t)}return e}var pl=js?{passive:!0}:!1;function ml(e,t,n){e&&e.addEventListener(t,n,pl)}function hl(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,pl)}function gl(e,t){let n=ul[e.type]||e.type,{x:r,y:i}=Es(e,t);return{type:n,chart:t,native:e,x:r===void 0?null:r,y:i===void 0?null:i}}function _l(e,t){for(let n of e)if(n===t||n.contains(t))return!0}function vl(e,t,n){let r=e.canvas,i=new MutationObserver(e=>{let t=!1;for(let n of e)t||=_l(n.addedNodes,r),t&&=!_l(n.removedNodes,r);t&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}function yl(e,t,n){let r=e.canvas,i=new MutationObserver(e=>{let t=!1;for(let n of e)t||=_l(n.removedNodes,r),t&&=!_l(n.addedNodes,r);t&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}var bl=new Map,xl=0;function Sl(){let e=window.devicePixelRatio;e!==xl&&(xl=e,bl.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function Cl(e,t){bl.size||window.addEventListener(`resize`,Sl),bl.set(e,t)}function wl(e){bl.delete(e),bl.size||window.removeEventListener(`resize`,Sl)}function Tl(e,t,n){let r=e.canvas,i=r&&vs(r);if(!i)return;let a=Xa((e,t)=>{let r=i.clientWidth;n(e,t),r<i.clientWidth&&n()},window),o=new ResizeObserver(e=>{let t=e[0],n=t.contentRect.width,r=t.contentRect.height;n===0&&r===0||a(n,r)});return o.observe(i),Cl(e,a),o}function El(e,t,n){n&&n.disconnect(),t===`resize`&&wl(e)}function Dl(e,t,n){let r=e.canvas,i=Xa(t=>{e.ctx!==null&&n(gl(t,e))},e);return ml(r,t,i),i}var Ol=class extends sl{acquireContext(e,t){let n=e&&e.getContext&&e.getContext(`2d`);return n&&n.canvas===e?(fl(e,t),n):null}releaseContext(e){let t=e.canvas;if(!t[ll])return!1;let n=t[ll].initial;[`height`,`width`].forEach(e=>{let r=n[e];G(r)?t.removeAttribute(e):t.setAttribute(e,r)});let r=n.style||{};return Object.keys(r).forEach(e=>{t.style[e]=r[e]}),t.width=t.width,delete t[ll],!0}addEventListener(e,t,n){this.removeEventListener(e,t);let r=e.$proxies||={};r[t]=({attach:vl,detach:yl,resize:Tl}[t]||Dl)(e,t,n)}removeEventListener(e,t){let n=e.$proxies||={},r=n[t];r&&(({attach:El,detach:El,resize:El}[t]||hl)(e,t,r),n[t]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,t,n,r){return ks(e,t,n,r)}isAttached(e){let t=e&&vs(e);return!!(t&&t.isConnected)}};function kl(e){return!_s()||typeof OffscreenCanvas<`u`&&e instanceof OffscreenCanvas?cl:Ol}var Al=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(e){let{x:t,y:n}=this.getProps([`x`,`y`],e);return{x:t,y:n}}hasValue(){return Oa(this.x)&&Oa(this.y)}getProps(e,t){let n=this.$animations;if(!t||!n)return this;let r={};return e.forEach(e=>{r[e]=n[e]&&n[e].active()?n[e]._to:this[e]}),r}};function jl(e,t){let n=e.options.ticks,r=Ml(e),i=Math.min(n.maxTicksLimit||r,r),a=n.major.enabled?Pl(t):[],o=a.length,s=a[0],c=a[o-1],l=[];if(o>i)return Fl(t,l,a,o/i),l;let u=Nl(a,t,i);if(o>0){let e,n,r=o>1?Math.round((c-s)/(o-1)):null;for(Il(t,l,u,G(r)?0:s-r,s),e=0,n=o-1;e<n;e++)Il(t,l,u,a[e],a[e+1]);return Il(t,l,u,c,G(r)?t.length:c+r),l}return Il(t,l,u),l}function Ml(e){let t=e.options.offset,n=e._tickSize(),r=e._length/n+ +!t,i=e._maxLength/n;return Math.floor(Math.min(r,i))}function Nl(e,t,n){let r=Ll(e),i=t.length/n;if(!r)return Math.max(i,1);let a=Ea(r);for(let e=0,t=a.length-1;e<t;e++){let t=a[e];if(t>i)return t}return Math.max(i,1)}function Pl(e){let t=[],n,r;for(n=0,r=e.length;n<r;n++)e[n].major&&t.push(n);return t}function Fl(e,t,n,r){let i=0,a=n[0],o;for(r=Math.ceil(r),o=0;o<e.length;o++)o===a&&(t.push(e[o]),i++,a=n[i*r])}function Il(e,t,n,r,i){let a=J(r,0),o=Math.min(J(i,e.length),e.length),s=0,c,l,u;for(n=Math.ceil(n),i&&(c=i-r,n=c/Math.floor(c/n)),u=a;u<0;)s++,u=Math.round(a+s*n);for(l=Math.max(a,0);l<o;l++)l===u&&(t.push(e[l]),s++,u=Math.round(a+s*n))}function Ll(e){let t=e.length,n,r;if(t<2)return!1;for(r=e[0],n=1;n<t;++n)if(e[n]-e[n-1]!==r)return!1;return r}var Rl=e=>e===`left`?`right`:e===`right`?`left`:e,zl=(e,t,n)=>t===`top`||t===`left`?e[t]+n:e[t]-n,Bl=(e,t)=>Math.min(t||e,e);function Vl(e,t){let n=[],r=e.length/t,i=e.length,a=0;for(;a<i;a+=r)n.push(e[Math.floor(a)]);return n}function Hl(e,t,n){let r=e.ticks.length,i=Math.min(t,r-1),a=e._startPixel,o=e._endPixel,s=1e-6,c=e.getPixelForTick(i),l;if(!(n&&(l=r===1?Math.max(c-a,o-c):t===0?(e.getPixelForTick(1)-c)/2:(c-e.getPixelForTick(i-1))/2,c+=i<t?l:-l,c<a-s||c>o+s)))return c}function Ul(e,t){X(e,e=>{let n=e.gc,r=n.length/2,i;if(r>t){for(i=0;i<r;++i)delete e.data[n[i]];n.splice(0,r)}})}function Wl(e){return e.drawTicks?e.tickLength:0}function Gl(e,t){if(!e.display)return 0;let n=qo(e.font,t),r=Ko(e.padding);return(K(e.text)?e.text.length:1)*n.lineHeight+r.height}function Kl(e,t){return Xo(e,{scale:t,type:`scale`})}function ql(e,t,n){return Xo(e,{tick:n,index:t,type:`tick`})}function Jl(e,t,n){let r=Qa(e);return(n&&t!==`right`||!n&&t===`right`)&&(r=Rl(r)),r}function Yl(e,t,n,r){let{top:i,left:a,bottom:o,right:s,chart:c}=e,{chartArea:l,scales:u}=c,d=0,f,p,m,h=o-i,g=s-a;if(e.isHorizontal()){if(p=$a(r,a,s),q(n)){let e=Object.keys(n)[0],r=n[e];m=u[e].getPixelForValue(r)+h-t}else m=n===`center`?(l.bottom+l.top)/2+h-t:zl(e,n,t);f=s-a}else{if(q(n)){let e=Object.keys(n)[0],r=n[e];p=u[e].getPixelForValue(r)-g+t}else p=n===`center`?(l.left+l.right)/2-g+t:zl(e,n,t);m=$a(r,o,i),d=n===`left`?-$:$}return{titleX:p,titleY:m,maxWidth:f,rotation:d}}var Xl=class e extends Al{constructor(e){super(),this.id=e.id,this.type=e.type,this.options=void 0,this.ctx=e.ctx,this.chart=e.chart,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._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(e){this.options=e.setContext(this.getContext()),this.axis=e.axis,this._userMin=this.parse(e.min),this._userMax=this.parse(e.max),this._suggestedMin=this.parse(e.suggestedMin),this._suggestedMax=this.parse(e.suggestedMax)}parse(e,t){return e}getUserBounds(){let{_userMin:e,_userMax:t,_suggestedMin:n,_suggestedMax:r}=this;return e=$i(e,1/0),t=$i(t,-1/0),n=$i(n,1/0),r=$i(r,-1/0),{min:$i(e,n),max:$i(t,r),minDefined:Qi(e),maxDefined:Qi(t)}}getMinMax(e){let{min:t,max:n,minDefined:r,maxDefined:i}=this.getUserBounds(),a;if(r&&i)return{min:t,max:n};let o=this.getMatchingVisibleMetas();for(let s=0,c=o.length;s<c;++s)a=o[s].controller.getMinMax(this,e),r||(t=Math.min(t,a.min)),i||(n=Math.max(n,a.max));return t=i&&t>n?n:t,n=r&&t>n?t:n,{min:$i(t,$i(n,t)),max:$i(n,$i(t,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||=this._computeLabelItems(e)}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){Y(this.options.beforeUpdate,[this])}update(e,t,n){let{beginAtZero:r,grace:i,ticks:a}=this.options,o=a.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=t,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=Yo(this,i,r),!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let s=o<this.ticks.length;this._convertTicksToLabels(s?Vl(this.ticks,o):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source===`auto`)&&(this.ticks=jl(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),s&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let e=this.options.reverse,t,n;this.isHorizontal()?(t=this.left,n=this.right):(t=this.top,n=this.bottom,e=!e),this._startPixel=t,this._endPixel=n,this._reversePixels=e,this._length=n-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){Y(this.options.afterUpdate,[this])}beforeSetDimensions(){Y(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){Y(this.options.afterSetDimensions,[this])}_callHooks(e){this.chart.notifyPlugins(e,this.getContext()),Y(this.options[e],[this])}beforeDataLimits(){this._callHooks(`beforeDataLimits`)}determineDataLimits(){}afterDataLimits(){this._callHooks(`afterDataLimits`)}beforeBuildTicks(){this._callHooks(`beforeBuildTicks`)}buildTicks(){return[]}afterBuildTicks(){this._callHooks(`afterBuildTicks`)}beforeTickToLabelConversion(){Y(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(e){let t=this.options.ticks,n,r,i;for(n=0,r=e.length;n<r;n++)i=e[n],i.label=Y(t.callback,[i.value,n,e],this)}afterTickToLabelConversion(){Y(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){Y(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){let e=this.options,t=e.ticks,n=Bl(this.ticks.length,e.ticks.maxTicksLimit),r=t.minRotation||0,i=t.maxRotation,a=r,o,s,c;if(!this._isVisible()||!t.display||r>=i||n<=1||!this.isHorizontal()){this.labelRotation=r;return}let l=this._getLabelSizes(),u=l.widest.width,d=l.highest.height,f=Ra(this.chart.width-u,0,this.maxWidth);o=e.offset?this.maxWidth/n:f/(n-1),u+6>o&&(o=f/(n-(e.offset?.5:1)),s=this.maxHeight-Wl(e.grid)-t.padding-Gl(e.title,this.chart.options.font),c=Math.sqrt(u*u+d*d),a=Ma(Math.min(Math.asin(Ra((l.highest.height+6)/o,-1,1)),Math.asin(Ra(s/c,-1,1))-Math.asin(Ra(d/c,-1,1)))),a=Math.max(r,Math.min(i,a))),this.labelRotation=a}afterCalculateLabelRotation(){Y(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){Y(this.options.beforeFit,[this])}fit(){let e={width:0,height:0},{chart:t,options:{ticks:n,title:r,grid:i}}=this,a=this._isVisible(),o=this.isHorizontal();if(a){let a=Gl(r,t.options.font);if(o?(e.width=this.maxWidth,e.height=Wl(i)+a):(e.height=this.maxHeight,e.width=Wl(i)+a),n.display&&this.ticks.length){let{first:t,last:r,widest:i,highest:a}=this._getLabelSizes(),s=n.padding*2,c=ja(this.labelRotation),l=Math.cos(c),u=Math.sin(c);if(o){let t=n.mirror?0:u*i.width+l*a.height;e.height=Math.min(this.maxHeight,e.height+t+s)}else{let t=n.mirror?0:l*i.width+u*a.height;e.width=Math.min(this.maxWidth,e.width+t+s)}this._calculatePadding(t,r,u,l)}}this._handleMargins(),o?(this.width=this._length=t.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=t.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,t,n,r){let{ticks:{align:i,padding:a},position:o}=this.options,s=this.labelRotation!==0,c=o!==`top`&&this.axis===`x`;if(this.isHorizontal()){let o=this.getPixelForTick(0)-this.left,l=this.right-this.getPixelForTick(this.ticks.length-1),u=0,d=0;s?c?(u=r*e.width,d=n*t.height):(u=n*e.height,d=r*t.width):i===`start`?d=t.width:i===`end`?u=e.width:i!==`inner`&&(u=e.width/2,d=t.width/2),this.paddingLeft=Math.max((u-o+a)*this.width/(this.width-o),0),this.paddingRight=Math.max((d-l+a)*this.width/(this.width-l),0)}else{let n=t.height/2,r=e.height/2;i===`start`?(n=0,r=e.height):i===`end`&&(n=t.height,r=0),this.paddingTop=n+a,this.paddingBottom=r+a}}_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(){Y(this.options.afterFit,[this])}isHorizontal(){let{axis:e,position:t}=this.options;return t===`top`||t===`bottom`||e===`x`}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let t,n;for(t=0,n=e.length;t<n;t++)G(e[t].label)&&(e.splice(t,1),n--,t--);this.afterTickToLabelConversion()}_getLabelSizes(){let e=this._labelSizes;if(!e){let t=this.options.ticks.sampleSize,n=this.ticks;t<n.length&&(n=Vl(n,t)),this._labelSizes=e=this._computeLabelSizes(n,n.length,this.options.ticks.maxTicksLimit)}return e}_computeLabelSizes(e,t,n){let{ctx:r,_longestTextCache:i}=this,a=[],o=[],s=Math.floor(t/Bl(t,n)),c=0,l=0,u,d,f,p,m,h,g,_,v,y,b;for(u=0;u<t;u+=s){if(p=e[u].label,m=this._resolveTickFontOptions(u),r.font=h=m.string,g=i[h]=i[h]||{data:{},gc:[]},_=m.lineHeight,v=y=0,!G(p)&&!K(p))v=To(r,g.data,g.gc,v,p),y=_;else if(K(p))for(d=0,f=p.length;d<f;++d)b=p[d],!G(b)&&!K(b)&&(v=To(r,g.data,g.gc,v,b),y+=_);a.push(v),o.push(y),c=Math.max(v,c),l=Math.max(y,l)}Ul(i,t);let x=a.indexOf(c),S=o.indexOf(l),C=e=>({width:a[e]||0,height:o[e]||0});return{first:C(0),last:C(t-1),widest:C(x),highest:C(S),widths:a,heights:o}}getLabelForValue(e){return e}getPixelForValue(e,t){return NaN}getValueForPixel(e){}getPixelForTick(e){let t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);let t=this._startPixel+e*this._length;return za(this._alignToPixels?Do(this.chart,t,0):t)}getDecimalForPixel(e){let t=(e-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:e,max:t}=this;return e<0&&t<0?t:e>0&&t>0?e:0}getContext(e){let t=this.ticks||[];if(e>=0&&e<t.length){let n=t[e];return n.$context||=ql(this.getContext(),e,n)}return this.$context||=Kl(this.chart.getContext(),this)}_tickSize(){let e=this.options.ticks,t=ja(this.labelRotation),n=Math.abs(Math.cos(t)),r=Math.abs(Math.sin(t)),i=this._getLabelSizes(),a=e.autoSkipPadding||0,o=i?i.widest.width+a:0,s=i?i.highest.height+a:0;return this.isHorizontal()?s*n>o*r?o/n:s/r:s*r<o*n?s/n:o/r}_isVisible(){let e=this.options.display;return e===`auto`?this.getMatchingVisibleMetas().length>0:!!e}_computeGridLineItems(e){let t=this.axis,n=this.chart,r=this.options,{grid:i,position:a,border:o}=r,s=i.offset,c=this.isHorizontal(),l=this.ticks.length+ +!!s,u=Wl(i),d=[],f=o.setContext(this.getContext()),p=f.display?f.width:0,m=p/2,h=function(e){return Do(n,e,p)},g,_,v,y,b,x,S,C,w,T,E,D;if(a===`top`)g=h(this.bottom),x=this.bottom-u,C=g-m,T=h(e.top)+m,D=e.bottom;else if(a===`bottom`)g=h(this.top),T=e.top,D=h(e.bottom)-m,x=g+m,C=this.top+u;else if(a===`left`)g=h(this.right),b=this.right-u,S=g-m,w=h(e.left)+m,E=e.right;else if(a===`right`)g=h(this.left),w=e.left,E=h(e.right)-m,b=g+m,S=this.left+u;else if(t===`x`){if(a===`center`)g=h((e.top+e.bottom)/2+.5);else if(q(a)){let e=Object.keys(a)[0],t=a[e];g=h(this.chart.scales[e].getPixelForValue(t))}T=e.top,D=e.bottom,x=g+m,C=x+u}else if(t===`y`){if(a===`center`)g=h((e.left+e.right)/2);else if(q(a)){let e=Object.keys(a)[0],t=a[e];g=h(this.chart.scales[e].getPixelForValue(t))}b=g-m,S=b-u,w=e.left,E=e.right}let ee=J(r.ticks.maxTicksLimit,l),te=Math.max(1,Math.ceil(l/ee));for(_=0;_<l;_+=te){let e=this.getContext(_),t=i.setContext(e),r=o.setContext(e),a=t.lineWidth,l=t.color,u=r.dash||[],f=r.dashOffset,p=t.tickWidth,m=t.tickColor,h=t.tickBorderDash||[],g=t.tickBorderDashOffset;v=Hl(this,_,s),v!==void 0&&(y=Do(n,v,a),c?b=S=w=E=y:x=C=T=D=y,d.push({tx1:b,ty1:x,tx2:S,ty2:C,x1:w,y1:T,x2:E,y2:D,width:a,color:l,borderDash:u,borderDashOffset:f,tickWidth:p,tickColor:m,tickBorderDash:h,tickBorderDashOffset:g}))}return this._ticksLength=l,this._borderValue=g,d}_computeLabelItems(e){let t=this.axis,n=this.options,{position:r,ticks:i}=n,a=this.isHorizontal(),o=this.ticks,{align:s,crossAlign:c,padding:l,mirror:u}=i,d=Wl(n.grid),f=d+l,p=u?-l:f,m=-ja(this.labelRotation),h=[],g,_,v,y,b,x,S,C,w,T,E,D,ee=`middle`;if(r===`top`)x=this.bottom-p,S=this._getXAxisLabelAlignment();else if(r===`bottom`)x=this.top+p,S=this._getXAxisLabelAlignment();else if(r===`left`){let e=this._getYAxisLabelAlignment(d);S=e.textAlign,b=e.x}else if(r===`right`){let e=this._getYAxisLabelAlignment(d);S=e.textAlign,b=e.x}else if(t===`x`){if(r===`center`)x=(e.top+e.bottom)/2+f;else if(q(r)){let e=Object.keys(r)[0],t=r[e];x=this.chart.scales[e].getPixelForValue(t)+f}S=this._getXAxisLabelAlignment()}else if(t===`y`){if(r===`center`)b=(e.left+e.right)/2-f;else if(q(r)){let e=Object.keys(r)[0],t=r[e];b=this.chart.scales[e].getPixelForValue(t)}S=this._getYAxisLabelAlignment(d).textAlign}t===`y`&&(s===`start`?ee=`top`:s===`end`&&(ee=`bottom`));let te=this._getLabelSizes();for(g=0,_=o.length;g<_;++g){v=o[g],y=v.label;let e=i.setContext(this.getContext(g));C=this.getPixelForTick(g)+i.labelOffset,w=this._resolveTickFontOptions(g),T=w.lineHeight,E=K(y)?y.length:1;let t=E/2,n=e.color,s=e.textStrokeColor,l=e.textStrokeWidth,d=S;a?(b=C,S===`inner`&&(d=g===_-1?this.options.reverse?`left`:`right`:g===0?this.options.reverse?`right`:`left`:`center`),D=r===`top`?c===`near`||m!==0?-E*T+T/2:c===`center`?-te.highest.height/2-t*T+T:-te.highest.height+T/2:c===`near`||m!==0?T/2:c===`center`?te.highest.height/2-t*T:te.highest.height-E*T,u&&(D*=-1),m!==0&&!e.showLabelBackdrop&&(b+=T/2*Math.sin(m))):(x=C,D=(1-E)*T/2);let f;if(e.showLabelBackdrop){let t=Ko(e.backdropPadding),n=te.heights[g],r=te.widths[g],i=D-t.top,a=0-t.left;switch(ee){case`middle`:i-=n/2;break;case`bottom`:i-=n;break}switch(S){case`center`:a-=r/2;break;case`right`:a-=r;break;case`inner`:g===_-1?a-=r:g>0&&(a-=r/2);break}f={left:a,top:i,width:r+t.width,height:n+t.height,color:e.backdropColor}}h.push({label:y,font:w,textOffset:D,options:{rotation:m,color:n,strokeColor:s,strokeWidth:l,textAlign:d,textBaseline:ee,translation:[b,x],backdrop:f}})}return h}_getXAxisLabelAlignment(){let{position:e,ticks:t}=this.options;if(-ja(this.labelRotation))return e===`top`?`left`:`right`;let n=`center`;return t.align===`start`?n=`left`:t.align===`end`?n=`right`:t.align===`inner`&&(n=`inner`),n}_getYAxisLabelAlignment(e){let{position:t,ticks:{crossAlign:n,mirror:r,padding:i}}=this.options,a=this._getLabelSizes(),o=e+i,s=a.widest.width,c,l;return t===`left`?r?(l=this.right+i,n===`near`?c=`left`:n===`center`?(c=`center`,l+=s/2):(c=`right`,l+=s)):(l=this.right-o,n===`near`?c=`right`:n===`center`?(c=`center`,l-=s/2):(c=`left`,l=this.left)):t===`right`?r?(l=this.left+i,n===`near`?c=`right`:n===`center`?(c=`center`,l-=s/2):(c=`left`,l-=s)):(l=this.left+o,n===`near`?c=`left`:n===`center`?(c=`center`,l+=s/2):(c=`right`,l=this.right)):c=`right`,{textAlign:c,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;let e=this.chart,t=this.options.position;if(t===`left`||t===`right`)return{top:0,left:this.left,bottom:e.height,right:this.right};if(t===`top`||t===`bottom`)return{top:this.top,left:0,bottom:this.bottom,right:e.width}}drawBackground(){let{ctx:e,options:{backgroundColor:t},left:n,top:r,width:i,height:a}=this;t&&(e.save(),e.fillStyle=t,e.fillRect(n,r,i,a),e.restore())}getLineWidthForValue(e){let t=this.options.grid;if(!this._isVisible()||!t.display)return 0;let n=this.ticks.findIndex(t=>t.value===e);return n>=0?t.setContext(this.getContext(n)).lineWidth:0}drawGrid(e){let t=this.options.grid,n=this.ctx,r=this._gridLineItems||=this._computeGridLineItems(e),i,a,o=(e,t,r)=>{!r.width||!r.color||(n.save(),n.lineWidth=r.width,n.strokeStyle=r.color,n.setLineDash(r.borderDash||[]),n.lineDashOffset=r.borderDashOffset,n.beginPath(),n.moveTo(e.x,e.y),n.lineTo(t.x,t.y),n.stroke(),n.restore())};if(t.display)for(i=0,a=r.length;i<a;++i){let e=r[i];t.drawOnChartArea&&o({x:e.x1,y:e.y1},{x:e.x2,y:e.y2},e),t.drawTicks&&o({x:e.tx1,y:e.ty1},{x:e.tx2,y:e.ty2},{color:e.tickColor,width:e.tickWidth,borderDash:e.tickBorderDash,borderDashOffset:e.tickBorderDashOffset})}}drawBorder(){let{chart:e,ctx:t,options:{border:n,grid:r}}=this,i=n.setContext(this.getContext()),a=n.display?i.width:0;if(!a)return;let o=r.setContext(this.getContext(0)).lineWidth,s=this._borderValue,c,l,u,d;this.isHorizontal()?(c=Do(e,this.left,a)-a/2,l=Do(e,this.right,o)+o/2,u=d=s):(u=Do(e,this.top,a)-a/2,d=Do(e,this.bottom,o)+o/2,c=l=s),t.save(),t.lineWidth=i.width,t.strokeStyle=i.color,t.beginPath(),t.moveTo(c,u),t.lineTo(l,d),t.stroke(),t.restore()}drawLabels(e){if(!this.options.ticks.display)return;let t=this.ctx,n=this._computeLabelArea();n&&Mo(t,n);let r=this.getLabelItems(e);for(let e of r){let n=e.options,r=e.font,i=e.label,a=e.textOffset;Lo(t,i,0,a,r,n)}n&&No(t)}drawTitle(){let{ctx:e,options:{position:t,title:n,reverse:r}}=this;if(!n.display)return;let i=qo(n.font),a=Ko(n.padding),o=n.align,s=i.lineHeight/2;t===`bottom`||t===`center`||q(t)?(s+=a.bottom,K(n.text)&&(s+=i.lineHeight*(n.text.length-1))):s+=a.top;let{titleX:c,titleY:l,maxWidth:u,rotation:d}=Yl(this,s,t,o);Lo(e,n.text,0,0,i,{color:n.color,maxWidth:u,rotation:d,textAlign:Jl(o,t,r),textBaseline:`middle`,translation:[c,l]})}draw(e){this._isVisible()&&(this.drawBackground(),this.drawGrid(e),this.drawBorder(),this.drawTitle(),this.drawLabels(e))}_layers(){let t=this.options,n=t.ticks&&t.ticks.z||0,r=J(t.grid&&t.grid.z,-1),i=J(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==e.prototype.draw?[{z:n,draw:e=>{this.draw(e)}}]:[{z:r,draw:e=>{this.drawBackground(),this.drawGrid(e),this.drawTitle()}},{z:i,draw:()=>{this.drawBorder()}},{z:n,draw:e=>{this.drawLabels(e)}}]}getMatchingVisibleMetas(e){let t=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+`AxisID`,r=[],i,a;for(i=0,a=t.length;i<a;++i){let a=t[i];a[n]===this.id&&(!e||a.type===e)&&r.push(a)}return r}_resolveTickFontOptions(e){return qo(this.options.ticks.setContext(this.getContext(e)).font)}_maxDigits(){let e=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/e}},Zl=class{constructor(e,t,n){this.type=e,this.scope=t,this.override=n,this.items=Object.create(null)}isForType(e){return Object.prototype.isPrototypeOf.call(this.type.prototype,e.prototype)}register(e){let t=Object.getPrototypeOf(e),n;eu(t)&&(n=this.register(t));let r=this.items,i=e.id,a=this.scope+`.`+i;if(!i)throw Error(`class does not have id: `+e);return i in r?a:(r[i]=e,Ql(e,a,n),this.override&&Co.override(e.id,e.overrides),a)}get(e){return this.items[e]}unregister(e){let t=this.items,n=e.id,r=this.scope;n in t&&delete t[n],r&&n in Co[r]&&(delete Co[r][n],this.override&&delete yo[n])}};function Ql(e,t,n){let r=oa(Object.create(null),[n?Co.get(n):{},Co.get(t),e.defaults]);Co.set(t,r),e.defaultRoutes&&$l(t,e.defaultRoutes),e.descriptors&&Co.describe(t,e.descriptors)}function $l(e,t){Object.keys(t).forEach(n=>{let r=n.split(`.`),i=r.pop(),a=[e].concat(r).join(`.`),o=t[n].split(`.`),s=o.pop(),c=o.join(`.`);Co.route(a,i,c,s)})}function eu(e){return`id`in e&&`defaults`in e}var tu=new class{constructor(){this.controllers=new Zl(pc,`datasets`,!0),this.elements=new Zl(Al,`elements`),this.plugins=new Zl(Object,`plugins`),this.scales=new Zl(Xl,`scales`),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each(`register`,e)}remove(...e){this._each(`unregister`,e)}addControllers(...e){this._each(`register`,e,this.controllers)}addElements(...e){this._each(`register`,e,this.elements)}addPlugins(...e){this._each(`register`,e,this.plugins)}addScales(...e){this._each(`register`,e,this.scales)}getController(e){return this._get(e,this.controllers,`controller`)}getElement(e){return this._get(e,this.elements,`element`)}getPlugin(e){return this._get(e,this.plugins,`plugin`)}getScale(e){return this._get(e,this.scales,`scale`)}removeControllers(...e){this._each(`unregister`,e,this.controllers)}removeElements(...e){this._each(`unregister`,e,this.elements)}removePlugins(...e){this._each(`unregister`,e,this.plugins)}removeScales(...e){this._each(`unregister`,e,this.scales)}_each(e,t,n){[...t].forEach(t=>{let r=n||this._getRegistryForType(t);n||r.isForType(t)||r===this.plugins&&t.id?this._exec(e,r,t):X(t,t=>{let r=n||this._getRegistryForType(t);this._exec(e,r,t)})})}_exec(e,t,n){let r=pa(e);Y(n[`before`+r],[],n),t[e](n),Y(n[`after`+r],[],n)}_getRegistryForType(e){for(let t=0;t<this._typedRegistries.length;t++){let n=this._typedRegistries[t];if(n.isForType(e))return n}return this.plugins}_get(e,t,n){let r=t.get(e);if(r===void 0)throw Error(`"`+e+`" is not a registered `+n+`.`);return r}},nu=class{constructor(){this._init=void 0}notify(e,t,n,r){if(t===`beforeInit`&&(this._init=this._createDescriptors(e,!0),this._notify(this._init,e,`install`)),this._init===void 0)return;let i=r?this._descriptors(e).filter(r):this._descriptors(e),a=this._notify(i,e,t,n);return t===`afterDestroy`&&(this._notify(i,e,`stop`),this._notify(this._init,e,`uninstall`),this._init=void 0),a}_notify(e,t,n,r){r||={};for(let i of e){let e=i.plugin,a=e[n];if(Y(a,[t,r,i.options],e)===!1&&r.cancelable)return!1}return!0}invalidate(){G(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(e){if(this._cache)return this._cache;let t=this._cache=this._createDescriptors(e);return this._notifyStateChanges(e),t}_createDescriptors(e,t){let n=e&&e.config,r=J(n.options&&n.options.plugins,{}),i=ru(n);return r===!1&&!t?[]:au(e,i,r,t)}_notifyStateChanges(e){let t=this._oldCache||[],n=this._cache,r=(e,t)=>e.filter(e=>!t.some(t=>e.plugin.id===t.plugin.id));this._notify(r(t,n),e,`stop`),this._notify(r(n,t),e,`start`)}};function ru(e){let t={},n=[],r=Object.keys(tu.plugins.items);for(let e=0;e<r.length;e++)n.push(tu.getPlugin(r[e]));let i=e.plugins||[];for(let e=0;e<i.length;e++){let r=i[e];n.indexOf(r)===-1&&(n.push(r),t[r.id]=!0)}return{plugins:n,localIds:t}}function iu(e,t){return!t&&e===!1?null:e===!0?{}:e}function au(e,{plugins:t,localIds:n},r,i){let a=[],o=e.getContext();for(let s of t){let t=s.id,c=iu(r[t],i);c!==null&&a.push({plugin:s,options:ou(e.config,{plugin:s,local:n[t]},c,o)})}return a}function ou(e,{plugin:t,local:n},r,i){let a=e.pluginScopeKeys(t),o=e.getOptionScopes(r,a);return n&&t.defaults&&o.push(t.defaults),e.createResolver(o,i,[``],{scriptable:!1,indexable:!1,allKeys:!0})}function su(e,t){let n=Co.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||`x`}function cu(e,t){let n=e;return e===`_index_`?n=t:e===`_value_`&&(n=t===`x`?`y`:`x`),n}function lu(e,t){return e===t?`_index_`:`_value_`}function uu(e){if(e===`x`||e===`y`||e===`r`)return e}function du(e){if(e===`top`||e===`bottom`)return`x`;if(e===`left`||e===`right`)return`y`}function fu(e,...t){if(uu(e))return e;for(let n of t){let t=n.axis||du(n.position)||e.length>1&&uu(e[0].toLowerCase());if(t)return t}throw Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function pu(e,t,n){if(n[t+`AxisID`]===e)return{axis:t}}function mu(e,t){if(t.data&&t.data.datasets){let n=t.data.datasets.filter(t=>t.xAxisID===e||t.yAxisID===e);if(n.length)return pu(e,`x`,n[0])||pu(e,`y`,n[0])}return{}}function hu(e,t){let n=yo[e.type]||{scales:{}},r=t.scales||{},i=su(e.type,t),a=Object.create(null);return Object.keys(r).forEach(t=>{let o=r[t];if(!q(o))return console.error(`Invalid scale configuration for scale: ${t}`);if(o._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${t}`);let s=fu(t,o,mu(t,e),Co.scales[o.type]),c=lu(s,i),l=n.scales||{};a[t]=sa(Object.create(null),[{axis:s},o,l[s],l[c]])}),e.data.datasets.forEach(n=>{let i=n.type||e.type,o=n.indexAxis||su(i,t),s=(yo[i]||{}).scales||{};Object.keys(s).forEach(e=>{let t=cu(e,o),i=n[t+`AxisID`]||t;a[i]=a[i]||Object.create(null),sa(a[i],[{axis:t},r[i],s[e]])})}),Object.keys(a).forEach(e=>{let t=a[e];sa(t,[Co.scales[t.type],Co.scale])}),a}function gu(e){let t=e.options||={};t.plugins=J(t.plugins,{}),t.scales=hu(e,t)}function _u(e){return e||={},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function vu(e){return e||={},e.data=_u(e.data),gu(e),e}var yu=new Map,bu=new Set;function xu(e,t){let n=yu.get(e);return n||(n=t(),yu.set(e,n),bu.add(n)),n}var Su=(e,t,n)=>{let r=fa(t,n);r!==void 0&&e.add(r)},Cu=class{constructor(e){this._config=vu(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=_u(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){let e=this._config;this.clearCache(),gu(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return xu(e,()=>[[`datasets.${e}`,``]])}datasetAnimationScopeKeys(e,t){return xu(`${e}.transition.${t}`,()=>[[`datasets.${e}.transitions.${t}`,`transitions.${t}`],[`datasets.${e}`,``]])}datasetElementScopeKeys(e,t){return xu(`${e}-${t}`,()=>[[`datasets.${e}.elements.${t}`,`datasets.${e}`,`elements.${t}`,``]])}pluginScopeKeys(e){let t=e.id,n=this.type;return xu(`${n}-plugin-${t}`,()=>[[`plugins.${t}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,t){let n=this._scopeCache,r=n.get(e);return(!r||t)&&(r=new Map,n.set(e,r)),r}getOptionScopes(e,t,n){let{options:r,type:i}=this,a=this._cachedScopes(e,n),o=a.get(t);if(o)return o;let s=new Set;t.forEach(t=>{e&&(s.add(e),t.forEach(t=>Su(s,e,t))),t.forEach(e=>Su(s,r,e)),t.forEach(e=>Su(s,yo[i]||{},e)),t.forEach(e=>Su(s,Co,e)),t.forEach(e=>Su(s,bo,e))});let c=Array.from(s);return c.length===0&&c.push(Object.create(null)),bu.has(t)&&a.set(t,c),c}chartOptionScopes(){let{options:e,type:t}=this;return[e,yo[t]||{},Co.datasets[t]||{},{type:t},Co,bo]}resolveNamedOptions(e,t,n,r=[``]){let i={$shared:!0},{resolver:a,subPrefixes:o}=wu(this._resolverCache,e,r),s=a;if(Eu(a,t)){i.$shared=!1,n=ha(n)?n():n;let t=this.createResolver(e,n,o);s=Qo(a,n,t)}for(let e of t)i[e]=s[e];return i}createResolver(e,t,n=[``],r){let{resolver:i}=wu(this._resolverCache,e,n);return q(t)?Qo(i,t,void 0,r):i}};function wu(e,t,n){let r=e.get(t);r||(r=new Map,e.set(t,r));let i=n.join(),a=r.get(i);return a||(a={resolver:Zo(t,n),subPrefixes:n.filter(e=>!e.toLowerCase().includes(`hover`))},r.set(i,a)),a}var Tu=e=>q(e)&&Object.getOwnPropertyNames(e).some(t=>ha(e[t]));function Eu(e,t){let{isScriptable:n,isIndexable:r}=$o(e);for(let i of t){let t=n(i),a=r(i),o=(a||t)&&e[i];if(t&&(ha(o)||Tu(o))||a&&K(o))return!0}return!1}var Du=`4.5.1`,Ou=[`top`,`bottom`,`left`,`right`,`chartArea`];function ku(e,t){return e===`top`||e===`bottom`||Ou.indexOf(e)===-1&&t===`x`}function Au(e,t){return function(n,r){return n[e]===r[e]?n[t]-r[t]:n[e]-r[e]}}function ju(e){let t=e.chart,n=t.options.animation;t.notifyPlugins(`afterRender`),Y(n&&n.onComplete,[e],t)}function Mu(e){let t=e.chart,n=t.options.animation;Y(n&&n.onProgress,[e],t)}function Nu(e){return _s()&&typeof e==`string`?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}var Pu={},Fu=e=>{let t=Nu(e);return Object.values(Pu).filter(e=>e.canvas===t).pop()};function Iu(e,t,n){let r=Object.keys(e);for(let i of r){let r=+i;if(r>=t){let a=e[i];delete e[i],(n>0||r>t)&&(e[r+n]=a)}}}function Lu(e,t,n,r){return!n||e.type===`mouseout`?null:r?t:e}var Ru=class{static defaults=Co;static instances=Pu;static overrides=yo;static registry=tu;static version=Du;static getChart=Fu;static register(...e){tu.add(...e),zu()}static unregister(...e){tu.remove(...e),zu()}constructor(e,t){let n=this.config=new Cu(t),r=Nu(e),i=Fu(r);if(i)throw Error(`Canvas is already in use. Chart with ID '`+i.id+`' must be destroyed before the canvas with ID '`+i.canvas.id+`' can be reused.`);let a=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||(kl(r))),this.platform.updateConfig(n);let o=this.platform.acquireContext(r,a.aspectRatio),s=o&&o.canvas,c=s&&s.height,l=s&&s.width;if(this.id=Zi(),this.ctx=o,this.canvas=s,this.width=l,this.height=c,this._options=a,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 nu,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Za(e=>this.update(e),a.resizeDelay||0),this._dataChanges=[],Pu[this.id]=this,!o||!s){console.error(`Failed to create chart: can't acquire context from the given item`);return}Vs.listen(this,`complete`,ju),Vs.listen(this,`progress`,Mu),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:e,maintainAspectRatio:t},width:n,height:r,_aspectRatio:i}=this;return G(e)?t&&i?i:r?n/r:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return tu}_initialize(){return this.notifyPlugins(`beforeInit`),this.options.responsive?this.resize():As(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins(`afterInit`),this}clear(){return Oo(this.canvas,this.ctx),this}stop(){return Vs.stop(this),this}resize(e,t){Vs.running(this)?this._resizeBeforeDraw={width:e,height:t}:this._resize(e,t)}_resize(e,t){let n=this.options,r=this.canvas,i=n.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(r,e,t,i),o=n.devicePixelRatio||this.platform.getDevicePixelRatio(),s=this.width?`resize`:`attach`;this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,As(this,o,!0)&&(this.notifyPlugins(`resize`,{size:a}),Y(n.onResize,[this,a],this),this.attached&&this._doResize(s)&&this.render())}ensureScalesHaveIDs(){X(this.options.scales||{},(e,t)=>{e.id=t})}buildOrUpdateScales(){let e=this.options,t=e.scales,n=this.scales,r=Object.keys(n).reduce((e,t)=>(e[t]=!1,e),{}),i=[];t&&(i=i.concat(Object.keys(t).map(e=>{let n=t[e],r=fu(e,n),i=r===`r`,a=r===`x`;return{options:n,dposition:i?`chartArea`:a?`bottom`:`left`,dtype:i?`radialLinear`:a?`category`:`linear`}}))),X(i,t=>{let i=t.options,a=i.id,o=fu(a,i),s=J(i.type,t.dtype);(i.position===void 0||ku(i.position,o)!==ku(t.dposition))&&(i.position=t.dposition),r[a]=!0;let c=null;a in n&&n[a].type===s?c=n[a]:(c=new(tu.getScale(s))({id:a,type:s,ctx:this.ctx,chart:this}),n[c.id]=c),c.init(i,e)}),X(r,(e,t)=>{e||delete n[t]}),X(n,e=>{ol.configure(this,e,e.options),ol.addBox(this,e)})}_updateMetasets(){let e=this._metasets,t=this.data.datasets.length,n=e.length;if(e.sort((e,t)=>e.index-t.index),n>t){for(let e=t;e<n;++e)this._destroyDatasetMeta(e);e.splice(t,n-t)}this._sortedMetasets=e.slice(0).sort(Au(`order`,`index`))}_removeUnreferencedMetasets(){let{_metasets:e,data:{datasets:t}}=this;e.length>t.length&&delete this._stacks,e.forEach((e,n)=>{t.filter(t=>t===e._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){let e=[],t=this.data.datasets,n,r;for(this._removeUnreferencedMetasets(),n=0,r=t.length;n<r;n++){let r=t[n],i=this.getDatasetMeta(n),a=r.type||this.config.type;if(i.type&&i.type!==a&&(this._destroyDatasetMeta(n),i=this.getDatasetMeta(n)),i.type=a,i.indexAxis=r.indexAxis||su(a,this.options),i.order=r.order||0,i.index=n,i.label=``+r.label,i.visible=this.isDatasetVisible(n),i.controller)i.controller.updateIndex(n),i.controller.linkScales();else{let t=tu.getController(a),{datasetElementType:r,dataElementType:o}=Co.datasets[a];Object.assign(t,{dataElementType:tu.getElement(o),datasetElementType:r&&tu.getElement(r)}),i.controller=new t(this,n),e.push(i.controller)}}return this._updateMetasets(),e}_resetElements(){X(this.data.datasets,(e,t)=>{this.getDatasetMeta(t).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins(`reset`)}update(e){let t=this.config;t.update();let n=this._options=t.createResolver(t.chartOptionScopes(),this.getContext()),r=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins(`beforeUpdate`,{mode:e,cancelable:!0})===!1)return;let i=this.buildOrUpdateControllers();this.notifyPlugins(`beforeElementsUpdate`);let a=0;for(let e=0,t=this.data.datasets.length;e<t;e++){let{controller:t}=this.getDatasetMeta(e),n=!r&&i.indexOf(t)===-1;t.buildOrUpdateElements(n),a=Math.max(+t.getMaxOverflow(),a)}a=this._minPadding=n.layout.autoPadding?a:0,this._updateLayout(a),r||X(i,e=>{e.reset()}),this._updateDatasets(e),this.notifyPlugins(`afterUpdate`,{mode:e}),this._layers.sort(Au(`z`,`_idx`));let{_active:o,_lastEvent:s}=this;s?this._eventHandler(s,!0):o.length&&this._updateHoverStyles(o,o,!0),this.render()}_updateScales(){X(this.scales,e=>{ol.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let e=this.options;(!ga(new Set(Object.keys(this._listeners)),new Set(e.events))||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:e}=this,t=this._getUniformDataChanges()||[];for(let{method:n,start:r,count:i}of t)Iu(e,r,n===`_removeElements`?-i:i)}_getUniformDataChanges(){let e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];let t=this.data.datasets.length,n=t=>new Set(e.filter(e=>e[0]===t).map((e,t)=>t+`,`+e.splice(1).join(`,`))),r=n(0);for(let e=1;e<t;e++)if(!ga(r,n(e)))return;return Array.from(r).map(e=>e.split(`,`)).map(e=>({method:e[1],start:+e[2],count:+e[3]}))}_updateLayout(e){if(this.notifyPlugins(`beforeLayout`,{cancelable:!0})===!1)return;ol.update(this,this.width,this.height,e);let t=this.chartArea,n=t.width<=0||t.height<=0;this._layers=[],X(this.boxes,e=>{n&&e.position===`chartArea`||(e.configure&&e.configure(),this._layers.push(...e._layers()))},this),this._layers.forEach((e,t)=>{e._idx=t}),this.notifyPlugins(`afterLayout`)}_updateDatasets(e){if(this.notifyPlugins(`beforeDatasetsUpdate`,{mode:e,cancelable:!0})!==!1){for(let e=0,t=this.data.datasets.length;e<t;++e)this.getDatasetMeta(e).controller.configure();for(let t=0,n=this.data.datasets.length;t<n;++t)this._updateDataset(t,ha(e)?e({datasetIndex:t}):e);this.notifyPlugins(`afterDatasetsUpdate`,{mode:e})}}_updateDataset(e,t){let n=this.getDatasetMeta(e),r={meta:n,index:e,mode:t,cancelable:!0};this.notifyPlugins(`beforeDatasetUpdate`,r)!==!1&&(n.controller._update(t),r.cancelable=!1,this.notifyPlugins(`afterDatasetUpdate`,r))}render(){this.notifyPlugins(`beforeRender`,{cancelable:!0})!==!1&&(Vs.has(this)?this.attached&&!Vs.running(this)&&Vs.start(this):(this.draw(),ju({chart:this})))}draw(){let e;if(this._resizeBeforeDraw){let{width:e,height:t}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(e,t)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins(`beforeDraw`,{cancelable:!0})===!1)return;let t=this._layers;for(e=0;e<t.length&&t[e].z<=0;++e)t[e].draw(this.chartArea);for(this._drawDatasets();e<t.length;++e)t[e].draw(this.chartArea);this.notifyPlugins(`afterDraw`)}_getSortedDatasetMetas(e){let t=this._sortedMetasets,n=[],r,i;for(r=0,i=t.length;r<i;++r){let i=t[r];(!e||i.visible)&&n.push(i)}return n}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins(`beforeDatasetsDraw`,{cancelable:!0})===!1)return;let e=this.getSortedVisibleDatasetMetas();for(let t=e.length-1;t>=0;--t)this._drawDataset(e[t]);this.notifyPlugins(`afterDatasetsDraw`)}_drawDataset(e){let t=this.ctx,n={meta:e,index:e.index,cancelable:!0},r=Bs(this,e);this.notifyPlugins(`beforeDatasetDraw`,n)!==!1&&(r&&Mo(t,r),e.controller.draw(),r&&No(t),n.cancelable=!1,this.notifyPlugins(`afterDatasetDraw`,n))}isPointInArea(e){return jo(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,t,n,r){let i=Uc.modes[t];return typeof i==`function`?i(this,e,n,r):[]}getDatasetMeta(e){let t=this.data.datasets[e],n=this._metasets,r=n.filter(e=>e&&e._dataset===t).pop();return r||(r={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:t&&t.order||0,index:e,_dataset:t,_parsed:[],_sorted:!1},n.push(r)),r}getContext(){return this.$context||=Xo(null,{chart:this,type:`chart`})}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){let t=this.data.datasets[e];if(!t)return!1;let n=this.getDatasetMeta(e);return typeof n.hidden==`boolean`?!n.hidden:!t.hidden}setDatasetVisibility(e,t){let n=this.getDatasetMeta(e);n.hidden=!t}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,t,n){let r=n?`show`:`hide`,i=this.getDatasetMeta(e),a=i.controller._resolveAnimations(void 0,r);ma(t)?(i.data[t].hidden=!n,this.update()):(this.setDatasetVisibility(e,n),a.update(i,{visible:n}),this.update(t=>t.datasetIndex===e?r:void 0))}hide(e,t){this._updateVisibility(e,t,!1)}show(e,t){this._updateVisibility(e,t,!0)}_destroyDatasetMeta(e){let t=this._metasets[e];t&&t.controller&&t.controller._destroy(),delete this._metasets[e]}_stop(){let e,t;for(this.stop(),Vs.remove(this),e=0,t=this.data.datasets.length;e<t;++e)this._destroyDatasetMeta(e)}destroy(){this.notifyPlugins(`beforeDestroy`);let{canvas:e,ctx:t}=this;this._stop(),this.config.clearCache(),e&&(this.unbindEvents(),Oo(e,t),this.platform.releaseContext(t),this.canvas=null,this.ctx=null),delete Pu[this.id],this.notifyPlugins(`afterDestroy`)}toBase64Image(...e){return this.canvas.toDataURL(...e)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){let e=this._listeners,t=this.platform,n=(n,r)=>{t.addEventListener(this,n,r),e[n]=r},r=(e,t,n)=>{e.offsetX=t,e.offsetY=n,this._eventHandler(e)};X(this.options.events,e=>n(e,r))}bindResponsiveEvents(){this._responsiveListeners||={};let e=this._responsiveListeners,t=this.platform,n=(n,r)=>{t.addEventListener(this,n,r),e[n]=r},r=(n,r)=>{e[n]&&(t.removeEventListener(this,n,r),delete e[n])},i=(e,t)=>{this.canvas&&this.resize(e,t)},a,o=()=>{r(`attach`,o),this.attached=!0,this.resize(),n(`resize`,i),n(`detach`,a)};a=()=>{this.attached=!1,r(`resize`,i),this._stop(),this._resize(0,0),n(`attach`,o)},t.isAttached(this.canvas)?o():a()}unbindEvents(){X(this._listeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._listeners={},X(this._responsiveListeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,t,n){let r=n?`set`:`remove`,i,a,o,s;for(t===`dataset`&&(i=this.getDatasetMeta(e[0].datasetIndex),i.controller[`_`+r+`DatasetHoverStyle`]()),o=0,s=e.length;o<s;++o){a=e[o];let t=a&&this.getDatasetMeta(a.datasetIndex).controller;t&&t[r+`HoverStyle`](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(e){let t=this._active||[],n=e.map(({datasetIndex:e,index:t})=>{let n=this.getDatasetMeta(e);if(!n)throw Error(`No dataset found at index `+e);return{datasetIndex:e,element:n.data[t],index:t}});na(n,t)||(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,t))}notifyPlugins(e,t,n){return this._plugins.notify(this,e,t,n)}isPluginEnabled(e){return this._plugins._cache.filter(t=>t.plugin.id===e).length===1}_updateHoverStyles(e,t,n){let r=this.options.hover,i=(e,t)=>e.filter(e=>!t.some(t=>e.datasetIndex===t.datasetIndex&&e.index===t.index)),a=i(t,e),o=n?e:i(e,t);a.length&&this.updateHoverStyle(a,r.mode,!1),o.length&&r.mode&&this.updateHoverStyle(o,r.mode,!0)}_eventHandler(e,t){let n={event:e,replay:t,cancelable:!0,inChartArea:this.isPointInArea(e)},r=t=>(t.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins(`beforeEvent`,n,r)===!1)return;let i=this._handleEvent(e,t,n.inChartArea);return n.cancelable=!1,this.notifyPlugins(`afterEvent`,n,r),(i||n.changed)&&this.render(),this}_handleEvent(e,t,n){let{_active:r=[],options:i}=this,a=t,o=this._getActiveElements(e,r,n,a),s=_a(e),c=Lu(e,this._lastEvent,n,s);n&&(this._lastEvent=null,Y(i.onHover,[e,o,this],this),s&&Y(i.onClick,[e,o,this],this));let l=!na(o,r);return(l||t)&&(this._active=o,this._updateHoverStyles(o,r,t)),this._lastEvent=c,l}_getActiveElements(e,t,n,r){if(e.type===`mouseout`)return[];if(!n)return t;let i=this.options.hover;return this.getElementsAtEventForMode(e,i.mode,i,r)}};function zu(){return X(Ru.instances,e=>e._plugins.invalidate())}function Bu(e,t,n){let{startAngle:r,x:i,y:a,outerRadius:o,innerRadius:s,options:c}=t,{borderWidth:l,borderJoinStyle:u}=c,d=Math.min(l/o,Ia(r-n));if(e.beginPath(),e.arc(i,a,o-l/2,r+d/2,n-d/2),s>0){let t=Math.min(l/s,Ia(r-n));e.arc(i,a,s+l/2,n-t/2,r+t/2,!0)}else{let t=Math.min(l/2,o*Ia(r-n));if(u===`round`)e.arc(i,a,t,n-Z/2,r+Z/2,!0);else if(u===`bevel`){let o=2*t*t,s=-o*Math.cos(n+Z/2)+i,c=-o*Math.sin(n+Z/2)+a,l=o*Math.cos(r+Z/2)+i,u=o*Math.sin(r+Z/2)+a;e.lineTo(s,c),e.lineTo(l,u)}}e.closePath(),e.moveTo(0,0),e.rect(0,0,e.canvas.width,e.canvas.height),e.clip(`evenodd`)}function Vu(e,t,n){let{startAngle:r,pixelMargin:i,x:a,y:o,outerRadius:s,innerRadius:c}=t,l=i/s;e.beginPath(),e.arc(a,o,s,r-l,n+l),c>i?(l=i/c,e.arc(a,o,c,n+l,r-l,!0)):e.arc(a,o,i,n+$,r-$),e.closePath(),e.clip()}function Hu(e){return Uo(e,[`outerStart`,`outerEnd`,`innerStart`,`innerEnd`])}function Uu(e,t,n,r){let i=Hu(e.options.borderRadius),a=(n-t)/2,o=Math.min(a,r*t/2),s=e=>{let t=(n-Math.min(a,e))*r/2;return Ra(e,0,Math.min(a,t))};return{outerStart:s(i.outerStart),outerEnd:s(i.outerEnd),innerStart:Ra(i.innerStart,0,o),innerEnd:Ra(i.innerEnd,0,o)}}function Wu(e,t,n,r){return{x:n+e*Math.cos(t),y:r+e*Math.sin(t)}}function Gu(e,t,n,r,i,a){let{x:o,y:s,startAngle:c,pixelMargin:l,innerRadius:u}=t,d=Math.max(t.outerRadius+r+n-l,0),f=u>0?u+r+n+l:0,p=0,m=i-c;if(r){let e=((u>0?u-r:0)+(d>0?d-r:0))/2;p=(m-(e===0?m:m*e/(e+r)))/2}let h=(m-Math.max(.001,m*d-n/Z)/d)/2,g=c+h+p,_=i-h-p,{outerStart:v,outerEnd:y,innerStart:b,innerEnd:x}=Uu(t,f,d,_-g),S=d-v,C=d-y,w=g+v/S,T=_-y/C,E=f+b,D=f+x,ee=g+b/E,te=_-x/D;if(e.beginPath(),a){let t=(w+T)/2;if(e.arc(o,s,d,w,t),e.arc(o,s,d,t,T),y>0){let t=Wu(C,T,o,s);e.arc(t.x,t.y,y,T,_+$)}let n=Wu(D,_,o,s);if(e.lineTo(n.x,n.y),x>0){let t=Wu(D,te,o,s);e.arc(t.x,t.y,x,_+$,te+Math.PI)}let r=(_-x/f+(g+b/f))/2;if(e.arc(o,s,f,_-x/f,r,!0),e.arc(o,s,f,r,g+b/f,!0),b>0){let t=Wu(E,ee,o,s);e.arc(t.x,t.y,b,ee+Math.PI,g-$)}let i=Wu(S,g,o,s);if(e.lineTo(i.x,i.y),v>0){let t=Wu(S,w,o,s);e.arc(t.x,t.y,v,g-$,w)}}else{e.moveTo(o,s);let t=Math.cos(w)*d+o,n=Math.sin(w)*d+s;e.lineTo(t,n);let r=Math.cos(T)*d+o,i=Math.sin(T)*d+s;e.lineTo(r,i)}e.closePath()}function Ku(e,t,n,r,i){let{fullCircles:a,startAngle:o,circumference:s}=t,c=t.endAngle;if(a){Gu(e,t,n,r,c,i);for(let t=0;t<a;++t)e.fill();isNaN(s)||(c=o+(s%Q||Q))}return Gu(e,t,n,r,c,i),e.fill(),c}function qu(e,t,n,r,i){let{fullCircles:a,startAngle:o,circumference:s,options:c}=t,{borderWidth:l,borderJoinStyle:u,borderDash:d,borderDashOffset:f,borderRadius:p}=c,m=c.borderAlign===`inner`;if(!l)return;e.setLineDash(d||[]),e.lineDashOffset=f,m?(e.lineWidth=l*2,e.lineJoin=u||`round`):(e.lineWidth=l,e.lineJoin=u||`bevel`);let h=t.endAngle;if(a){Gu(e,t,n,r,h,i);for(let t=0;t<a;++t)e.stroke();isNaN(s)||(h=o+(s%Q||Q))}m&&Vu(e,t,h),c.selfJoin&&h-o>=Z&&p===0&&u!==`miter`&&Bu(e,t,h),a||(Gu(e,t,n,r,h,i),e.stroke())}var Ju=class extends Al{static id=`arc`;static defaults={borderAlign:`center`,borderColor:`#fff`,borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:`backgroundColor`};static descriptors={_scriptable:!0,_indexable:e=>e!==`borderDash`};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(e){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,e&&Object.assign(this,e)}inRange(e,t,n){let{angle:r,distance:i}=Pa(this.getProps([`x`,`y`],n),{x:e,y:t}),{startAngle:a,endAngle:o,innerRadius:s,outerRadius:c,circumference:l}=this.getProps([`startAngle`,`endAngle`,`innerRadius`,`outerRadius`,`circumference`],n),u=(this.options.spacing+this.options.borderWidth)/2,d=J(l,o-a),f=La(r,a,o)&&a!==o,p=d>=Q||f,m=Ba(i,s+u,c+u);return p&&m}getCenterPoint(e){let{x:t,y:n,startAngle:r,endAngle:i,innerRadius:a,outerRadius:o}=this.getProps([`x`,`y`,`startAngle`,`endAngle`,`innerRadius`,`outerRadius`],e),{offset:s,spacing:c}=this.options,l=(r+i)/2,u=(a+o+c+s)/2;return{x:t+Math.cos(l)*u,y:n+Math.sin(l)*u}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){let{options:t,circumference:n}=this,r=(t.offset||0)/4,i=(t.spacing||0)/2,a=t.circular;if(this.pixelMargin=t.borderAlign===`inner`?.33:0,this.fullCircles=n>Q?Math.floor(n/Q):0,n===0||this.innerRadius<0||this.outerRadius<0)return;e.save();let o=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(o)*r,Math.sin(o)*r);let s=r*(1-Math.sin(Math.min(Z,n||0)));e.fillStyle=t.backgroundColor,e.strokeStyle=t.borderColor,Ku(e,this,s,i,a),qu(e,this,s,i,a),e.restore()}};function Yu(e,t){let{x:n,y:r,base:i,width:a,height:o}=e.getProps([`x`,`y`,`base`,`width`,`height`],t),s,c,l,u,d;return e.horizontal?(d=o/2,s=Math.min(n,i),c=Math.max(n,i),l=r-d,u=r+d):(d=a/2,s=n-d,c=n+d,l=Math.min(r,i),u=Math.max(r,i)),{left:s,top:l,right:c,bottom:u}}function Xu(e,t,n,r){return e?0:Ra(t,n,r)}function Zu(e,t,n){let r=e.options.borderWidth,i=e.borderSkipped,a=Wo(r);return{t:Xu(i.top,a.top,0,n),r:Xu(i.right,a.right,0,t),b:Xu(i.bottom,a.bottom,0,n),l:Xu(i.left,a.left,0,t)}}function Qu(e,t,n){let{enableBorderRadius:r}=e.getProps([`enableBorderRadius`]),i=e.options.borderRadius,a=Go(i),o=Math.min(t,n),s=e.borderSkipped,c=r||q(i);return{topLeft:Xu(!c||s.top||s.left,a.topLeft,0,o),topRight:Xu(!c||s.top||s.right,a.topRight,0,o),bottomLeft:Xu(!c||s.bottom||s.left,a.bottomLeft,0,o),bottomRight:Xu(!c||s.bottom||s.right,a.bottomRight,0,o)}}function $u(e){let t=Yu(e),n=t.right-t.left,r=t.bottom-t.top,i=Zu(e,n/2,r/2),a=Qu(e,n/2,r/2);return{outer:{x:t.left,y:t.top,w:n,h:r,radius:a},inner:{x:t.left+i.l,y:t.top+i.t,w:n-i.l-i.r,h:r-i.t-i.b,radius:{topLeft:Math.max(0,a.topLeft-Math.max(i.t,i.l)),topRight:Math.max(0,a.topRight-Math.max(i.t,i.r)),bottomLeft:Math.max(0,a.bottomLeft-Math.max(i.b,i.l)),bottomRight:Math.max(0,a.bottomRight-Math.max(i.b,i.r))}}}}function ed(e,t,n,r){let i=t===null,a=n===null,o=e&&!(i&&a)&&Yu(e,r);return o&&(i||Ba(t,o.left,o.right))&&(a||Ba(n,o.top,o.bottom))}function td(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}function nd(e,t){e.rect(t.x,t.y,t.w,t.h)}function rd(e,t,n={}){let r=e.x===n.x?0:-t,i=e.y===n.y?0:-t,a=(e.x+e.w===n.x+n.w?0:t)-r,o=(e.y+e.h===n.y+n.h?0:t)-i;return{x:e.x+r,y:e.y+i,w:e.w+a,h:e.h+o,radius:e.radius}}var id=class extends Al{static id=`bar`;static defaults={borderSkipped:`start`,borderWidth:0,borderRadius:0,inflateAmount:`auto`,pointStyle:void 0};static defaultRoutes={backgroundColor:`backgroundColor`,borderColor:`borderColor`};constructor(e){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,e&&Object.assign(this,e)}draw(e){let{inflateAmount:t,options:{borderColor:n,backgroundColor:r}}=this,{inner:i,outer:a}=$u(this),o=td(a.radius)?Ro:nd;e.save(),(a.w!==i.w||a.h!==i.h)&&(e.beginPath(),o(e,rd(a,t,i)),e.clip(),o(e,rd(i,-t,a)),e.fillStyle=n,e.fill(`evenodd`)),e.beginPath(),o(e,rd(i,t)),e.fillStyle=r,e.fill(),e.restore()}inRange(e,t,n){return ed(this,e,t,n)}inXRange(e,t){return ed(this,e,null,t)}inYRange(e,t){return ed(this,null,e,t)}getCenterPoint(e){let{x:t,y:n,base:r,horizontal:i}=this.getProps([`x`,`y`,`base`,`horizontal`],e);return{x:i?(t+r)/2:t,y:i?n:(n+r)/2}}getRange(e){return e===`x`?this.width/2:this.height/2}},ad={average(e){if(!e.length)return!1;let t,n,r=new Set,i=0,a=0;for(t=0,n=e.length;t<n;++t){let n=e[t].element;if(n&&n.hasValue()){let e=n.tooltipPosition();r.add(e.x),i+=e.y,++a}}return a===0||r.size===0?!1:{x:[...r].reduce((e,t)=>e+t)/r.size,y:i/a}},nearest(e,t){if(!e.length)return!1;let n=t.x,r=t.y,i=1/0,a,o,s;for(a=0,o=e.length;a<o;++a){let n=e[a].element;if(n&&n.hasValue()){let e=Fa(t,n.getCenterPoint());e<i&&(i=e,s=n)}}if(s){let e=s.tooltipPosition();n=e.x,r=e.y}return{x:n,y:r}}};function od(e,t){return t&&(K(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function sd(e){return(typeof e==`string`||e instanceof String)&&e.indexOf(`
|
|
3
|
+
`)>-1?e.split(`
|
|
4
|
+
`):e}function cd(e,t){let{element:n,datasetIndex:r,index:i}=t,a=e.getDatasetMeta(r).controller,{label:o,value:s}=a.getLabelAndValue(i);return{chart:e,label:o,parsed:a.getParsed(i),raw:e.data.datasets[r].data[i],formattedValue:s,dataset:a.getDataset(),dataIndex:i,datasetIndex:r,element:n}}function ld(e,t){let n=e.chart.ctx,{body:r,footer:i,title:a}=e,{boxWidth:o,boxHeight:s}=t,c=qo(t.bodyFont),l=qo(t.titleFont),u=qo(t.footerFont),d=a.length,f=i.length,p=r.length,m=Ko(t.padding),h=m.height,g=0,_=r.reduce((e,t)=>e+t.before.length+t.lines.length+t.after.length,0);if(_+=e.beforeBody.length+e.afterBody.length,d&&(h+=d*l.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),_){let e=t.displayColors?Math.max(s,c.lineHeight):c.lineHeight;h+=p*e+(_-p)*c.lineHeight+(_-1)*t.bodySpacing}f&&(h+=t.footerMarginTop+f*u.lineHeight+(f-1)*t.footerSpacing);let v=0,y=function(e){g=Math.max(g,n.measureText(e).width+v)};return n.save(),n.font=l.string,X(e.title,y),n.font=c.string,X(e.beforeBody.concat(e.afterBody),y),v=t.displayColors?o+2+t.boxPadding:0,X(r,e=>{X(e.before,y),X(e.lines,y),X(e.after,y)}),v=0,n.font=u.string,X(e.footer,y),n.restore(),g+=m.width,{width:g,height:h}}function ud(e,t){let{y:n,height:r}=t;return n<r/2?`top`:n>e.height-r/2?`bottom`:`center`}function dd(e,t,n,r){let{x:i,width:a}=r,o=n.caretSize+n.caretPadding;if(e===`left`&&i+a+o>t.width||e===`right`&&i-a-o<0)return!0}function fd(e,t,n,r){let{x:i,width:a}=n,{width:o,chartArea:{left:s,right:c}}=e,l=`center`;return r===`center`?l=i<=(s+c)/2?`left`:`right`:i<=a/2?l=`left`:i>=o-a/2&&(l=`right`),dd(l,e,t,n)&&(l=`center`),l}function pd(e,t,n){let r=n.yAlign||t.yAlign||ud(e,n);return{xAlign:n.xAlign||t.xAlign||fd(e,t,n,r),yAlign:r}}function md(e,t){let{x:n,width:r}=e;return t===`right`?n-=r:t===`center`&&(n-=r/2),n}function hd(e,t,n){let{y:r,height:i}=e;return t===`top`?r+=n:t===`bottom`?r-=i+n:r-=i/2,r}function gd(e,t,n,r){let{caretSize:i,caretPadding:a,cornerRadius:o}=e,{xAlign:s,yAlign:c}=n,l=i+a,{topLeft:u,topRight:d,bottomLeft:f,bottomRight:p}=Go(o),m=md(t,s),h=hd(t,c,l);return c===`center`?s===`left`?m+=l:s===`right`&&(m-=l):s===`left`?m-=Math.max(u,f)+i:s===`right`&&(m+=Math.max(d,p)+i),{x:Ra(m,0,r.width-t.width),y:Ra(h,0,r.height-t.height)}}function _d(e,t,n){let r=Ko(n.padding);return t===`center`?e.x+e.width/2:t===`right`?e.x+e.width-r.right:e.x+r.left}function vd(e){return od([],sd(e))}function yd(e,t,n){return Xo(e,{tooltip:t,tooltipItems:n,type:`tooltip`})}function bd(e,t){let n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}var xd={beforeTitle:Xi,title(e){if(e.length>0){let t=e[0],n=t.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode===`dataset`)return t.dataset.label||``;if(t.label)return t.label;if(r>0&&t.dataIndex<r)return n[t.dataIndex]}return``},afterTitle:Xi,beforeBody:Xi,beforeLabel:Xi,label(e){if(this&&this.options&&this.options.mode===`dataset`)return e.label+`: `+e.formattedValue||e.formattedValue;let t=e.dataset.label||``;t&&(t+=`: `);let n=e.formattedValue;return G(n)||(t+=n),t},labelColor(e){let t=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:t.borderColor,backgroundColor:t.backgroundColor,borderWidth:t.borderWidth,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){let t=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:t.pointStyle,rotation:t.rotation}},afterLabel:Xi,afterBody:Xi,beforeFooter:Xi,footer:Xi,afterFooter:Xi};function Sd(e,t,n,r){let i=e[t].call(n,r);return i===void 0?xd[t].call(n,r):i}var Cd=class extends Al{static positioners=ad;constructor(e){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=e.chart,this.options=e.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(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){let e=this._cachedAnimations;if(e)return e;let t=this.chart,n=this.options.setContext(this.getContext()),r=n.enabled&&t.options.animation&&n.animations,i=new Gs(this.chart,r);return r._cacheable&&(this._cachedAnimations=Object.freeze(i)),i}getContext(){return this.$context||=yd(this.chart.getContext(),this,this._tooltipItems)}getTitle(e,t){let{callbacks:n}=t,r=Sd(n,`beforeTitle`,this,e),i=Sd(n,`title`,this,e),a=Sd(n,`afterTitle`,this,e),o=[];return o=od(o,sd(r)),o=od(o,sd(i)),o=od(o,sd(a)),o}getBeforeBody(e,t){return vd(Sd(t.callbacks,`beforeBody`,this,e))}getBody(e,t){let{callbacks:n}=t,r=[];return X(e,e=>{let t={before:[],lines:[],after:[]},i=bd(n,e);od(t.before,sd(Sd(i,`beforeLabel`,this,e))),od(t.lines,Sd(i,`label`,this,e)),od(t.after,sd(Sd(i,`afterLabel`,this,e))),r.push(t)}),r}getAfterBody(e,t){return vd(Sd(t.callbacks,`afterBody`,this,e))}getFooter(e,t){let{callbacks:n}=t,r=Sd(n,`beforeFooter`,this,e),i=Sd(n,`footer`,this,e),a=Sd(n,`afterFooter`,this,e),o=[];return o=od(o,sd(r)),o=od(o,sd(i)),o=od(o,sd(a)),o}_createItems(e){let t=this._active,n=this.chart.data,r=[],i=[],a=[],o=[],s,c;for(s=0,c=t.length;s<c;++s)o.push(cd(this.chart,t[s]));return e.filter&&(o=o.filter((t,r,i)=>e.filter(t,r,i,n))),e.itemSort&&(o=o.sort((t,r)=>e.itemSort(t,r,n))),X(o,t=>{let n=bd(e.callbacks,t);r.push(Sd(n,`labelColor`,this,t)),i.push(Sd(n,`labelPointStyle`,this,t)),a.push(Sd(n,`labelTextColor`,this,t))}),this.labelColors=r,this.labelPointStyles=i,this.labelTextColors=a,this.dataPoints=o,o}update(e,t){let n=this.options.setContext(this.getContext()),r=this._active,i,a=[];if(!r.length)this.opacity!==0&&(i={opacity:0});else{let e=ad[n.position].call(this,r,this._eventPosition);a=this._createItems(n),this.title=this.getTitle(a,n),this.beforeBody=this.getBeforeBody(a,n),this.body=this.getBody(a,n),this.afterBody=this.getAfterBody(a,n),this.footer=this.getFooter(a,n);let t=this._size=ld(this,n),o=Object.assign({},e,t),s=pd(this.chart,n,o),c=gd(n,o,s,this.chart);this.xAlign=s.xAlign,this.yAlign=s.yAlign,i={opacity:1,x:c.x,y:c.y,width:t.width,height:t.height,caretX:e.x,caretY:e.y}}this._tooltipItems=a,this.$context=void 0,i&&this._resolveAnimations().update(this,i),e&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:t})}drawCaret(e,t,n,r){let i=this.getCaretPosition(e,n,r);t.lineTo(i.x1,i.y1),t.lineTo(i.x2,i.y2),t.lineTo(i.x3,i.y3)}getCaretPosition(e,t,n){let{xAlign:r,yAlign:i}=this,{caretSize:a,cornerRadius:o}=n,{topLeft:s,topRight:c,bottomLeft:l,bottomRight:u}=Go(o),{x:d,y:f}=e,{width:p,height:m}=t,h,g,_,v,y,b;return i===`center`?(y=f+m/2,r===`left`?(h=d,g=h-a,v=y+a,b=y-a):(h=d+p,g=h+a,v=y-a,b=y+a),_=h):(g=r===`left`?d+Math.max(s,l)+a:r===`right`?d+p-Math.max(c,u)-a:this.caretX,i===`top`?(v=f,y=v-a,h=g-a,_=g+a):(v=f+m,y=v+a,h=g+a,_=g-a),b=v),{x1:h,x2:g,x3:_,y1:v,y2:y,y3:b}}drawTitle(e,t,n){let r=this.title,i=r.length,a,o,s;if(i){let c=Fs(n.rtl,this.x,this.width);for(e.x=_d(this,n.titleAlign,n),t.textAlign=c.textAlign(n.titleAlign),t.textBaseline=`middle`,a=qo(n.titleFont),o=n.titleSpacing,t.fillStyle=n.titleColor,t.font=a.string,s=0;s<i;++s)t.fillText(r[s],c.x(e.x),e.y+a.lineHeight/2),e.y+=a.lineHeight+o,s+1===i&&(e.y+=n.titleMarginBottom-o)}}_drawColorBox(e,t,n,r,i){let a=this.labelColors[n],o=this.labelPointStyles[n],{boxHeight:s,boxWidth:c}=i,l=qo(i.bodyFont),u=_d(this,`left`,i),d=r.x(u),f=s<l.lineHeight?(l.lineHeight-s)/2:0,p=t.y+f;if(i.usePointStyle){let t={radius:Math.min(c,s)/2,pointStyle:o.pointStyle,rotation:o.rotation,borderWidth:1},n=r.leftForLtr(d,c)+c/2,l=p+s/2;e.strokeStyle=i.multiKeyBackground,e.fillStyle=i.multiKeyBackground,ko(e,t,n,l),e.strokeStyle=a.borderColor,e.fillStyle=a.backgroundColor,ko(e,t,n,l)}else{e.lineWidth=q(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,e.strokeStyle=a.borderColor,e.setLineDash(a.borderDash||[]),e.lineDashOffset=a.borderDashOffset||0;let t=r.leftForLtr(d,c),n=r.leftForLtr(r.xPlus(d,1),c-2),o=Go(a.borderRadius);Object.values(o).some(e=>e!==0)?(e.beginPath(),e.fillStyle=i.multiKeyBackground,Ro(e,{x:t,y:p,w:c,h:s,radius:o}),e.fill(),e.stroke(),e.fillStyle=a.backgroundColor,e.beginPath(),Ro(e,{x:n,y:p+1,w:c-2,h:s-2,radius:o}),e.fill()):(e.fillStyle=i.multiKeyBackground,e.fillRect(t,p,c,s),e.strokeRect(t,p,c,s),e.fillStyle=a.backgroundColor,e.fillRect(n,p+1,c-2,s-2))}e.fillStyle=this.labelTextColors[n]}drawBody(e,t,n){let{body:r}=this,{bodySpacing:i,bodyAlign:a,displayColors:o,boxHeight:s,boxWidth:c,boxPadding:l}=n,u=qo(n.bodyFont),d=u.lineHeight,f=0,p=Fs(n.rtl,this.x,this.width),m=function(n){t.fillText(n,p.x(e.x+f),e.y+d/2),e.y+=d+i},h=p.textAlign(a),g,_,v,y,b,x,S;for(t.textAlign=a,t.textBaseline=`middle`,t.font=u.string,e.x=_d(this,h,n),t.fillStyle=n.bodyColor,X(this.beforeBody,m),f=o&&h!==`right`?a===`center`?c/2+l:c+2+l:0,y=0,x=r.length;y<x;++y){for(g=r[y],_=this.labelTextColors[y],t.fillStyle=_,X(g.before,m),v=g.lines,o&&v.length&&(this._drawColorBox(t,e,y,p,n),d=Math.max(u.lineHeight,s)),b=0,S=v.length;b<S;++b)m(v[b]),d=u.lineHeight;X(g.after,m)}f=0,d=u.lineHeight,X(this.afterBody,m),e.y-=i}drawFooter(e,t,n){let r=this.footer,i=r.length,a,o;if(i){let s=Fs(n.rtl,this.x,this.width);for(e.x=_d(this,n.footerAlign,n),e.y+=n.footerMarginTop,t.textAlign=s.textAlign(n.footerAlign),t.textBaseline=`middle`,a=qo(n.footerFont),t.fillStyle=n.footerColor,t.font=a.string,o=0;o<i;++o)t.fillText(r[o],s.x(e.x),e.y+a.lineHeight/2),e.y+=a.lineHeight+n.footerSpacing}}drawBackground(e,t,n,r){let{xAlign:i,yAlign:a}=this,{x:o,y:s}=e,{width:c,height:l}=n,{topLeft:u,topRight:d,bottomLeft:f,bottomRight:p}=Go(r.cornerRadius);t.fillStyle=r.backgroundColor,t.strokeStyle=r.borderColor,t.lineWidth=r.borderWidth,t.beginPath(),t.moveTo(o+u,s),a===`top`&&this.drawCaret(e,t,n,r),t.lineTo(o+c-d,s),t.quadraticCurveTo(o+c,s,o+c,s+d),a===`center`&&i===`right`&&this.drawCaret(e,t,n,r),t.lineTo(o+c,s+l-p),t.quadraticCurveTo(o+c,s+l,o+c-p,s+l),a===`bottom`&&this.drawCaret(e,t,n,r),t.lineTo(o+f,s+l),t.quadraticCurveTo(o,s+l,o,s+l-f),a===`center`&&i===`left`&&this.drawCaret(e,t,n,r),t.lineTo(o,s+u),t.quadraticCurveTo(o,s,o+u,s),t.closePath(),t.fill(),r.borderWidth>0&&t.stroke()}_updateAnimationTarget(e){let t=this.chart,n=this.$animations,r=n&&n.x,i=n&&n.y;if(r||i){let n=ad[e.position].call(this,this._active,this._eventPosition);if(!n)return;let a=this._size=ld(this,e),o=Object.assign({},n,this._size),s=pd(t,e,o),c=gd(e,o,s,t);(r._to!==c.x||i._to!==c.y)&&(this.xAlign=s.xAlign,this.yAlign=s.yAlign,this.width=a.width,this.height=a.height,this.caretX=n.x,this.caretY=n.y,this._resolveAnimations().update(this,c))}}_willRender(){return!!this.opacity}draw(e){let t=this.options.setContext(this.getContext()),n=this.opacity;if(!n)return;this._updateAnimationTarget(t);let r={width:this.width,height:this.height},i={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;let a=Ko(t.padding),o=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;t.enabled&&o&&(e.save(),e.globalAlpha=n,this.drawBackground(i,e,r,t),Is(e,t.textDirection),i.y+=a.top,this.drawTitle(i,e,t),this.drawBody(i,e,t),this.drawFooter(i,e,t),Ls(e,t.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,t){let n=this._active,r=e.map(({datasetIndex:e,index:t})=>{let n=this.chart.getDatasetMeta(e);if(!n)throw Error(`Cannot find a dataset at index `+e);return{datasetIndex:e,element:n.data[t],index:t}}),i=!na(n,r),a=this._positionChanged(r,t);(i||a)&&(this._active=r,this._eventPosition=t,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,t,n=!0){if(t&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let r=this.options,i=this._active||[],a=this._getActiveElements(e,i,t,n),o=this._positionChanged(a,e),s=t||!na(a,i)||o;return s&&(this._active=a,(r.enabled||r.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,t))),s}_getActiveElements(e,t,n,r){let i=this.options;if(e.type===`mouseout`)return[];if(!r)return t.filter(e=>this.chart.data.datasets[e.datasetIndex]&&this.chart.getDatasetMeta(e.datasetIndex).controller.getParsed(e.index)!==void 0);let a=this.chart.getElementsAtEventForMode(e,i.mode,i,n);return i.reverse&&a.reverse(),a}_positionChanged(e,t){let{caretX:n,caretY:r,options:i}=this,a=ad[i.position].call(this,e,t);return a!==!1&&(n!==a.x||r!==a.y)}},wd={id:`tooltip`,_element:Cd,positioners:ad,afterInit(e,t,n){n&&(e.tooltip=new Cd({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){let t=e.tooltip;if(t&&t._willRender()){let n={tooltip:t};if(e.notifyPlugins(`beforeTooltipDraw`,{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins(`afterTooltipDraw`,n)}},afterEvent(e,t){if(e.tooltip){let n=t.replay;e.tooltip.handleEvent(t.event,n,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:(e,t)=>t.bodyFont.size,boxWidth:(e,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:xd},defaultRoutes:{bodyFont:`font`,footerFont:`font`,titleFont:`font`},descriptors:{_scriptable:e=>e!==`filter`&&e!==`itemSort`&&e!==`external`,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:`animation`}},additionalOptionScopes:[`interaction`]},Td=(e,t,n,r)=>(typeof t==`string`?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function Ed(e,t,n,r){let i=e.indexOf(t);return i===-1?Td(e,t,n,r):i===e.lastIndexOf(t)?i:n}var Dd=(e,t)=>e===null?null:Ra(Math.round(e),0,t);function Od(e){let t=this.getLabels();return e>=0&&e<t.length?t[e]:e}var kd=class extends Xl{static id=`category`;static defaults={ticks:{callback:Od}};constructor(e){super(e),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(e){let t=this._addedLabels;if(t.length){let e=this.getLabels();for(let{index:n,label:r}of t)e[n]===r&&e.splice(n,1);this._addedLabels=[]}super.init(e)}parse(e,t){if(G(e))return null;let n=this.getLabels();return t=isFinite(t)&&n[t]===e?t:Ed(n,e,J(t,e),this._addedLabels),Dd(t,n.length-1)}determineDataLimits(){let{minDefined:e,maxDefined:t}=this.getUserBounds(),{min:n,max:r}=this.getMinMax(!0);this.options.bounds===`ticks`&&(e||(n=0),t||(r=this.getLabels().length-1)),this.min=n,this.max=r}buildTicks(){let e=this.min,t=this.max,n=this.options.offset,r=[],i=this.getLabels();i=e===0&&t===i.length-1?i:i.slice(e,t+1),this._valueRange=Math.max(i.length-+!n,1),this._startValue=this.min-(n?.5:0);for(let n=e;n<=t;n++)r.push({value:n});return r}getLabelForValue(e){return Od.call(this,e)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(e){return typeof e!=`number`&&(e=this.parse(e)),e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getPixelForTick(e){let t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}};function Ad(e,t){let n=[],{bounds:r,step:i,min:a,max:o,precision:s,count:c,maxTicks:l,maxDigits:u,includeBounds:d}=e,f=i||1,p=l-1,{min:m,max:h}=t,g=!G(a),_=!G(o),v=!G(c),y=(h-m)/(u+1),b=Ta((h-m)/p/f)*f,x,S,C,w;if(b<1e-14&&!g&&!_)return[{value:m},{value:h}];w=Math.ceil(h/b)-Math.floor(m/b),w>p&&(b=Ta(w*b/p/f)*f),G(s)||(x=10**s,b=Math.ceil(b*x)/x),r===`ticks`?(S=Math.floor(m/b)*b,C=Math.ceil(h/b)*b):(S=m,C=h),g&&_&&i&&ka((o-a)/i,b/1e3)?(w=Math.round(Math.min((o-a)/b,l)),b=(o-a)/w,S=a,C=o):v?(S=g?a:S,C=_?o:C,w=c-1,b=(C-S)/w):(w=(C-S)/b,w=wa(w,Math.round(w),b/1e3)?Math.round(w):Math.ceil(w));let T=Math.max(Na(b),Na(S));x=10**(G(s)?T:s),S=Math.round(S*x)/x,C=Math.round(C*x)/x;let E=0;for(g&&(d&&S!==a?(n.push({value:a}),S<a&&E++,wa(Math.round((S+E*b)*x)/x,a,jd(a,y,e))&&E++):S<a&&E++);E<w;++E){let e=Math.round((S+E*b)*x)/x;if(_&&e>o)break;n.push({value:e})}return _&&d&&C!==o?n.length&&wa(n[n.length-1].value,o,jd(o,y,e))?n[n.length-1].value=o:n.push({value:o}):(!_||C===o)&&n.push({value:C}),n}function jd(e,t,{horizontal:n,minRotation:r}){let i=ja(r),a=(n?Math.sin(i):Math.cos(i))||.001,o=.75*t*(``+e).length;return Math.min(t/a,o)}var Md=class extends Xl{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,t){return G(e)||(typeof e==`number`||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){let{beginAtZero:e}=this.options,{minDefined:t,maxDefined:n}=this.getUserBounds(),{min:r,max:i}=this,a=e=>r=t?r:e,o=e=>i=n?i:e;if(e){let e=Ca(r),t=Ca(i);e<0&&t<0?o(0):e>0&&t>0&&a(0)}if(r===i){let t=i===0?1:Math.abs(i*.05);o(i+t),e||a(r-t)}this.min=r,this.max=i}getTickLimit(){let{maxTicksLimit:e,stepSize:t}=this.options.ticks,n;return t?(n=Math.ceil(this.max/t)-Math.floor(this.min/t)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${t} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),e||=11),e&&(n=Math.min(e,n)),n}computeTickLimit(){return 1/0}buildTicks(){let e=this.options,t=e.ticks,n=this.getTickLimit();n=Math.max(2,n);let r=Ad({maxTicks:n,bounds:e.bounds,min:e.min,max:e.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:t.includeBounds!==!1},this._range||this);return e.bounds===`ticks`&&Aa(r,this,`value`),e.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){let e=this.ticks,t=this.min,n=this.max;if(super.configure(),this.options.offset&&e.length){let r=(n-t)/Math.max(e.length-1,1)/2;t-=r,n+=r}this._startValue=t,this._endValue=n,this._valueRange=n-t}getLabelForValue(e){return mo(e,this.chart.options.locale,this.options.ticks.format)}},Nd=class extends Md{static id=`linear`;static defaults={ticks:{callback:_o.formatters.numeric}};determineDataLimits(){let{min:e,max:t}=this.getMinMax(!0);this.min=Qi(e)?e:0,this.max=Qi(t)?t:1,this.handleTickRangeOptions()}computeTickLimit(){let e=this.isHorizontal(),t=e?this.width:this.height,n=ja(this.options.ticks.minRotation),r=(e?Math.sin(n):Math.cos(n))||.001,i=this._resolveTickFontOptions(0);return Math.ceil(t/Math.min(40,i.lineHeight/r))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}},Pd=e=>Math.floor(Sa(e)),Fd=(e,t)=>10**(Pd(e)+t);function Id(e){return e/10**Pd(e)==1}function Ld(e,t,n){let r=10**n,i=Math.floor(e/r);return Math.ceil(t/r)-i}function Rd(e,t){let n=Pd(t-e);for(;Ld(e,t,n)>10;)n++;for(;Ld(e,t,n)<10;)n--;return Math.min(n,Pd(e))}function zd(e,{min:t,max:n}){t=$i(e.min,t);let r=[],i=Pd(t),a=Rd(t,n),o=a<0?10**Math.abs(a):1,s=10**a,c=i>a?10**i:0,l=Math.round((t-c)*o)/o,u=Math.floor((t-c)/s/10)*s*10,d=Math.floor((l-u)/10**a),f=$i(e.min,Math.round((c+u+d*10**a)*o)/o);for(;f<n;)r.push({value:f,major:Id(f),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(a++,d=2,o=a>=0?1:o),f=Math.round((c+u+d*10**a)*o)/o;let p=$i(e.max,f);return r.push({value:p,major:Id(p),significand:d}),r}(class extends Xl{static id=`logarithmic`;static defaults={ticks:{callback:_o.formatters.logarithmic,major:{enabled:!0}}};constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(e,t){let n=Md.prototype.parse.apply(this,[e,t]);if(n===0){this._zero=!0;return}return Qi(n)&&n>0?n:null}determineDataLimits(){let{min:e,max:t}=this.getMinMax(!0);this.min=Qi(e)?Math.max(0,e):null,this.max=Qi(t)?Math.max(0,t):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!Qi(this._userMin)&&(this.min=e===Fd(this.min,0)?Fd(this.min,-1):Fd(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:e,maxDefined:t}=this.getUserBounds(),n=this.min,r=this.max,i=t=>n=e?n:t,a=e=>r=t?r:e;n===r&&(n<=0?(i(1),a(10)):(i(Fd(n,-1)),a(Fd(r,1)))),n<=0&&i(Fd(r,-1)),r<=0&&a(Fd(n,1)),this.min=n,this.max=r}buildTicks(){let e=this.options,t=zd({min:this._userMin,max:this._userMax},this);return e.bounds===`ticks`&&Aa(t,this,`value`),e.reverse?(t.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),t}getLabelForValue(e){return e===void 0?`0`:mo(e,this.chart.options.locale,this.options.ticks.format)}configure(){let e=this.min;super.configure(),this._startValue=Sa(e),this._valueRange=Sa(this.max)-Sa(e)}getPixelForValue(e){return(e===void 0||e===0)&&(e=this.min),e===null||isNaN(e)?NaN:this.getPixelForDecimal(e===this.min?0:(Sa(e)-this._startValue)/this._valueRange)}getValueForPixel(e){let t=this.getDecimalForPixel(e);return 10**(this._startValue+t*this._valueRange)}});function Bd(e){let t=e.ticks;if(t.display&&e.display){let e=Ko(t.backdropPadding);return J(t.font&&t.font.size,Co.font.size)+e.height}return 0}function Vd(e,t,n){return n=K(n)?n:[n],{w:Eo(e,t.string,n),h:n.length*t.lineHeight}}function Hd(e,t,n,r,i){return e===r||e===i?{start:t-n/2,end:t+n/2}:e<r||e>i?{start:t-n,end:t}:{start:t,end:t+n}}function Ud(e){let t={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},n=Object.assign({},t),r=[],i=[],a=e._pointLabels.length,o=e.options.pointLabels,s=o.centerPointLabels?Z/a:0;for(let c=0;c<a;c++){let a=o.setContext(e.getPointLabelContext(c));i[c]=a.padding;let l=e.getPointPosition(c,e.drawingArea+i[c],s),u=qo(a.font),d=Vd(e.ctx,u,e._pointLabels[c]);r[c]=d;let f=Ia(e.getIndexAngle(c)+s),p=Math.round(Ma(f));Wd(n,t,f,Hd(p,l.x,d.w,0,180),Hd(p,l.y,d.h,90,270))}e.setCenterPoint(t.l-n.l,n.r-t.r,t.t-n.t,n.b-t.b),e._pointLabelItems=qd(e,r,i)}function Wd(e,t,n,r,i){let a=Math.abs(Math.sin(n)),o=Math.abs(Math.cos(n)),s=0,c=0;r.start<t.l?(s=(t.l-r.start)/a,e.l=Math.min(e.l,t.l-s)):r.end>t.r&&(s=(r.end-t.r)/a,e.r=Math.max(e.r,t.r+s)),i.start<t.t?(c=(t.t-i.start)/o,e.t=Math.min(e.t,t.t-c)):i.end>t.b&&(c=(i.end-t.b)/o,e.b=Math.max(e.b,t.b+c))}function Gd(e,t,n){let r=e.drawingArea,{extra:i,additionalAngle:a,padding:o,size:s}=n,c=e.getPointPosition(t,r+i+o,a),l=Math.round(Ma(Ia(c.angle+$))),u=Xd(c.y,s.h,l),d=Jd(l),f=Yd(c.x,s.w,d);return{visible:!0,x:c.x,y:u,textAlign:d,left:f,top:u,right:f+s.w,bottom:u+s.h}}function Kd(e,t){if(!t)return!0;let{left:n,top:r,right:i,bottom:a}=e;return!(jo({x:n,y:r},t)||jo({x:n,y:a},t)||jo({x:i,y:r},t)||jo({x:i,y:a},t))}function qd(e,t,n){let r=[],i=e._pointLabels.length,a=e.options,{centerPointLabels:o,display:s}=a.pointLabels,c={extra:Bd(a)/2,additionalAngle:o?Z/i:0},l;for(let a=0;a<i;a++){c.padding=n[a],c.size=t[a];let i=Gd(e,a,c);r.push(i),s===`auto`&&(i.visible=Kd(i,l),i.visible&&(l=i))}return r}function Jd(e){return e===0||e===180?`center`:e<180?`left`:`right`}function Yd(e,t,n){return n===`right`?e-=t:n===`center`&&(e-=t/2),e}function Xd(e,t,n){return n===90||n===270?e-=t/2:(n>270||n<90)&&(e-=t),e}function Zd(e,t,n){let{left:r,top:i,right:a,bottom:o}=n,{backdropColor:s}=t;if(!G(s)){let n=Go(t.borderRadius),c=Ko(t.backdropPadding);e.fillStyle=s;let l=r-c.left,u=i-c.top,d=a-r+c.width,f=o-i+c.height;Object.values(n).some(e=>e!==0)?(e.beginPath(),Ro(e,{x:l,y:u,w:d,h:f,radius:n}),e.fill()):e.fillRect(l,u,d,f)}}function Qd(e,t){let{ctx:n,options:{pointLabels:r}}=e;for(let i=t-1;i>=0;i--){let t=e._pointLabelItems[i];if(!t.visible)continue;let a=r.setContext(e.getPointLabelContext(i));Zd(n,a,t);let o=qo(a.font),{x:s,y:c,textAlign:l}=t;Lo(n,e._pointLabels[i],s,c+o.lineHeight/2,o,{color:a.color,textAlign:l,textBaseline:`middle`})}}function $d(e,t,n,r){let{ctx:i}=e;if(n)i.arc(e.xCenter,e.yCenter,t,0,Q);else{let n=e.getPointPosition(0,t);i.moveTo(n.x,n.y);for(let a=1;a<r;a++)n=e.getPointPosition(a,t),i.lineTo(n.x,n.y)}}function ef(e,t,n,r,i){let a=e.ctx,o=t.circular,{color:s,lineWidth:c}=t;!o&&!r||!s||!c||n<0||(a.save(),a.strokeStyle=s,a.lineWidth=c,a.setLineDash(i.dash||[]),a.lineDashOffset=i.dashOffset,a.beginPath(),$d(e,n,o,r),a.closePath(),a.stroke(),a.restore())}function tf(e,t,n){return Xo(e,{label:n,index:t,type:`pointLabel`})}var nf=class extends Md{static id=`radialLinear`;static defaults={display:!0,animate:!0,position:`chartArea`,angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:_o.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(e){return e},padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":`borderColor`,"pointLabels.color":`color`,"ticks.color":`color`};static descriptors={angleLines:{_fallback:`grid`}};constructor(e){super(e),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){let e=this._padding=Ko(Bd(this.options)/2),t=this.width=this.maxWidth-e.width,n=this.height=this.maxHeight-e.height;this.xCenter=Math.floor(this.left+t/2+e.left),this.yCenter=Math.floor(this.top+n/2+e.top),this.drawingArea=Math.floor(Math.min(t,n)/2)}determineDataLimits(){let{min:e,max:t}=this.getMinMax(!1);this.min=Qi(e)&&!isNaN(e)?e:0,this.max=Qi(t)&&!isNaN(t)?t:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Bd(this.options))}generateTickLabels(e){Md.prototype.generateTickLabels.call(this,e),this._pointLabels=this.getLabels().map((e,t)=>{let n=Y(this.options.pointLabels.callback,[e,t],this);return n||n===0?n:``}).filter((e,t)=>this.chart.getDataVisibility(t))}fit(){let e=this.options;e.display&&e.pointLabels.display?Ud(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(e,t,n,r){this.xCenter+=Math.floor((e-t)/2),this.yCenter+=Math.floor((n-r)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(e,t,n,r))}getIndexAngle(e){let t=Q/(this._pointLabels.length||1),n=this.options.startAngle||0;return Ia(e*t+ja(n))}getDistanceFromCenterForValue(e){if(G(e))return NaN;let t=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-e)*t:(e-this.min)*t}getValueForDistanceFromCenter(e){if(G(e))return NaN;let t=e/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-t:this.min+t}getPointLabelContext(e){let t=this._pointLabels||[];if(e>=0&&e<t.length){let n=t[e];return tf(this.getContext(),e,n)}}getPointPosition(e,t,n=0){let r=this.getIndexAngle(e)-$+n;return{x:Math.cos(r)*t+this.xCenter,y:Math.sin(r)*t+this.yCenter,angle:r}}getPointPositionForValue(e,t){return this.getPointPosition(e,this.getDistanceFromCenterForValue(t))}getBasePosition(e){return this.getPointPositionForValue(e||0,this.getBaseValue())}getPointLabelPosition(e){let{left:t,top:n,right:r,bottom:i}=this._pointLabelItems[e];return{left:t,top:n,right:r,bottom:i}}drawBackground(){let{backgroundColor:e,grid:{circular:t}}=this.options;if(e){let n=this.ctx;n.save(),n.beginPath(),$d(this,this.getDistanceFromCenterForValue(this._endValue),t,this._pointLabels.length),n.closePath(),n.fillStyle=e,n.fill(),n.restore()}}drawGrid(){let e=this.ctx,t=this.options,{angleLines:n,grid:r,border:i}=t,a=this._pointLabels.length,o,s,c;if(t.pointLabels.display&&Qd(this,a),r.display&&this.ticks.forEach((e,t)=>{if(t!==0||t===0&&this.min<0){s=this.getDistanceFromCenterForValue(e.value);let n=this.getContext(t),o=r.setContext(n),c=i.setContext(n);ef(this,o,s,a,c)}}),n.display){for(e.save(),o=a-1;o>=0;o--){let r=n.setContext(this.getPointLabelContext(o)),{color:i,lineWidth:a}=r;!a||!i||(e.lineWidth=a,e.strokeStyle=i,e.setLineDash(r.borderDash),e.lineDashOffset=r.borderDashOffset,s=this.getDistanceFromCenterForValue(t.reverse?this.min:this.max),c=this.getPointPosition(o,s),e.beginPath(),e.moveTo(this.xCenter,this.yCenter),e.lineTo(c.x,c.y),e.stroke())}e.restore()}}drawBorder(){}drawLabels(){let e=this.ctx,t=this.options,n=t.ticks;if(!n.display)return;let r=this.getIndexAngle(0),i,a;e.save(),e.translate(this.xCenter,this.yCenter),e.rotate(r),e.textAlign=`center`,e.textBaseline=`middle`,this.ticks.forEach((r,o)=>{if(o===0&&this.min>=0&&!t.reverse)return;let s=n.setContext(this.getContext(o)),c=qo(s.font);if(i=this.getDistanceFromCenterForValue(this.ticks[o].value),s.showLabelBackdrop){e.font=c.string,a=e.measureText(r.label).width,e.fillStyle=s.backdropColor;let t=Ko(s.backdropPadding);e.fillRect(-a/2-t.left,-i-c.size/2-t.top,a+t.width,c.size+t.height)}Lo(e,r.label,0,-i,c,{color:s.color,strokeColor:s.textStrokeColor,strokeWidth:s.textStrokeWidth})}),e.restore()}drawTitle(){}},rf={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}},af=Object.keys(rf);function of(e,t){return e-t}function sf(e,t){if(G(t))return null;let n=e._adapter,{parser:r,round:i,isoWeekday:a}=e._parseOpts,o=t;return typeof r==`function`&&(o=r(o)),Qi(o)||(o=typeof r==`string`?n.parse(o,r):n.parse(o)),o===null?null:(i&&(o=i===`week`&&(Oa(a)||a===!0)?n.startOf(o,`isoWeek`,a):n.startOf(o,i)),+o)}function cf(e,t,n,r){let i=af.length;for(let a=af.indexOf(e);a<i-1;++a){let e=rf[af[a]],i=e.steps?e.steps:2**53-1;if(e.common&&Math.ceil((n-t)/(i*e.size))<=r)return af[a]}return af[i-1]}function lf(e,t,n,r,i){for(let a=af.length-1;a>=af.indexOf(n);a--){let n=af[a];if(rf[n].common&&e._adapter.diff(i,r,n)>=t-1)return n}return af[n?af.indexOf(n):0]}function uf(e){for(let t=af.indexOf(e)+1,n=af.length;t<n;++t)if(rf[af[t]].common)return af[t]}function df(e,t,n){if(!n)e[t]=!0;else if(n.length){let{lo:r,hi:i}=Va(n,t),a=n[r]>=t?n[r]:n[i];e[a]=!0}}function ff(e,t,n,r){let i=e._adapter,a=+i.startOf(t[0].value,r),o=t[t.length-1].value,s,c;for(s=a;s<=o;s=+i.add(s,1,r))c=n[s],c>=0&&(t[c].major=!0);return t}function pf(e,t,n){let r=[],i={},a=t.length,o,s;for(o=0;o<a;++o)s=t[o],i[s]=o,r.push({value:s,major:!1});return a===0||!n?r:ff(e,r,i,n)}var mf=class extends Xl{static id=`time`;static defaults={bounds:`data`,adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:`millisecond`,displayFormats:{}},ticks:{source:`auto`,callback:!1,major:{enabled:!1}}};constructor(e){super(e),this._cache={data:[],labels:[],all:[]},this._unit=`day`,this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(e,t={}){let n=e.time||={},r=this._adapter=new Pc._date(e.adapters.date);r.init(t),sa(n.displayFormats,r.formats()),this._parseOpts={parser:n.parser,round:n.round,isoWeekday:n.isoWeekday},super.init(e),this._normalized=t.normalized}parse(e,t){return e===void 0?null:sf(this,e)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let e=this.options,t=this._adapter,n=e.time.unit||`day`,{min:r,max:i,minDefined:a,maxDefined:o}=this.getUserBounds();function s(e){!a&&!isNaN(e.min)&&(r=Math.min(r,e.min)),!o&&!isNaN(e.max)&&(i=Math.max(i,e.max))}(!a||!o)&&(s(this._getLabelBounds()),(e.bounds!==`ticks`||e.ticks.source!==`labels`)&&s(this.getMinMax(!1))),r=Qi(r)&&!isNaN(r)?r:+t.startOf(Date.now(),n),i=Qi(i)&&!isNaN(i)?i:+t.endOf(Date.now(),n)+1,this.min=Math.min(r,i-1),this.max=Math.max(r+1,i)}_getLabelBounds(){let e=this.getLabelTimestamps(),t=1/0,n=-1/0;return e.length&&(t=e[0],n=e[e.length-1]),{min:t,max:n}}buildTicks(){let e=this.options,t=e.time,n=e.ticks,r=n.source===`labels`?this.getLabelTimestamps():this._generate();e.bounds===`ticks`&&r.length&&(this.min=this._userMin||r[0],this.max=this._userMax||r[r.length-1]);let i=this.min,a=this.max,o=Wa(r,i,a);return this._unit=t.unit||(n.autoSkip?cf(t.minUnit,this.min,this.max,this._getLabelCapacity(i)):lf(this,o.length,t.minUnit,this.min,this.max)),this._majorUnit=!n.major.enabled||this._unit===`year`?void 0:uf(this._unit),this.initOffsets(r),e.reverse&&o.reverse(),pf(this,o,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(e=>+e.value))}initOffsets(e=[]){let t=0,n=0,r,i;this.options.offset&&e.length&&(r=this.getDecimalForValue(e[0]),t=e.length===1?1-r:(this.getDecimalForValue(e[1])-r)/2,i=this.getDecimalForValue(e[e.length-1]),n=e.length===1?i:(i-this.getDecimalForValue(e[e.length-2]))/2);let a=e.length<3?.5:.25;t=Ra(t,0,a),n=Ra(n,0,a),this._offsets={start:t,end:n,factor:1/(t+1+n)}}_generate(){let e=this._adapter,t=this.min,n=this.max,r=this.options,i=r.time,a=i.unit||cf(i.minUnit,t,n,this._getLabelCapacity(t)),o=J(r.ticks.stepSize,1),s=a===`week`?i.isoWeekday:!1,c=Oa(s)||s===!0,l={},u=t,d,f;if(c&&(u=+e.startOf(u,`isoWeek`,s)),u=+e.startOf(u,c?`day`:a),e.diff(n,t,a)>1e5*o)throw Error(t+` and `+n+` are too far apart with stepSize of `+o+` `+a);let p=r.ticks.source===`data`&&this.getDataTimestamps();for(d=u,f=0;d<n;d=+e.add(d,o,a),f++)df(l,d,p);return(d===n||r.bounds===`ticks`||f===1)&&df(l,d,p),Object.keys(l).sort(of).map(e=>+e)}getLabelForValue(e){let t=this._adapter,n=this.options.time;return n.tooltipFormat?t.format(e,n.tooltipFormat):t.format(e,n.displayFormats.datetime)}format(e,t){let n=this.options.time.displayFormats,r=this._unit,i=t||n[r];return this._adapter.format(e,i)}_tickFormatFunction(e,t,n,r){let i=this.options,a=i.ticks.callback;if(a)return Y(a,[e,t,n],this);let o=i.time.displayFormats,s=this._unit,c=this._majorUnit,l=s&&o[s],u=c&&o[c],d=n[t],f=c&&u&&d&&d.major;return this._adapter.format(e,r||(f?u:l))}generateTickLabels(e){let t,n,r;for(t=0,n=e.length;t<n;++t)r=e[t],r.label=this._tickFormatFunction(r.value,t,e)}getDecimalForValue(e){return e===null?NaN:(e-this.min)/(this.max-this.min)}getPixelForValue(e){let t=this._offsets,n=this.getDecimalForValue(e);return this.getPixelForDecimal((t.start+n)*t.factor)}getValueForPixel(e){let t=this._offsets,n=this.getDecimalForPixel(e)/t.factor-t.end;return this.min+n*(this.max-this.min)}_getLabelSize(e){let t=this.options.ticks,n=this.ctx.measureText(e).width,r=ja(this.isHorizontal()?t.maxRotation:t.minRotation),i=Math.cos(r),a=Math.sin(r),o=this._resolveTickFontOptions(0).size;return{w:n*i+o*a,h:n*a+o*i}}_getLabelCapacity(e){let t=this.options.time,n=t.displayFormats,r=n[t.unit]||n.millisecond,i=this._tickFormatFunction(e,0,pf(this,[e],this._majorUnit),r),a=this._getLabelSize(i),o=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return o>0?o:1}getDataTimestamps(){let e=this._cache.data||[],t,n;if(e.length)return e;let r=this.getMatchingVisibleMetas();if(this._normalized&&r.length)return this._cache.data=r[0].controller.getAllParsedValues(this);for(t=0,n=r.length;t<n;++t)e=e.concat(r[t].controller.getAllParsedValues(this));return this._cache.data=this.normalize(e)}getLabelTimestamps(){let e=this._cache.labels||[],t,n;if(e.length)return e;let r=this.getLabels();for(t=0,n=r.length;t<n;++t)e.push(sf(this,r[t]));return this._cache.labels=this._normalized?e:this.normalize(e)}normalize(e){return Ja(e.sort(of))}};function hf(e,t,n){let r=0,i=e.length-1,a,o,s,c;n?(t>=e[r].pos&&t<=e[i].pos&&({lo:r,hi:i}=Ha(e,`pos`,t)),{pos:a,time:s}=e[r],{pos:o,time:c}=e[i]):(t>=e[r].time&&t<=e[i].time&&({lo:r,hi:i}=Ha(e,`time`,t)),{time:a,pos:s}=e[r],{time:o,pos:c}=e[i]);let l=o-a;return l?s+(c-s)*(t-a)/l:s}(class extends mf{static id=`timeseries`;static defaults=mf.defaults;constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){let e=this._getTimestampsForTable(),t=this._table=this.buildLookupTable(e);this._minPos=hf(t,this.min),this._tableRange=hf(t,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){let{min:t,max:n}=this,r=[],i=[],a,o,s,c,l;for(a=0,o=e.length;a<o;++a)c=e[a],c>=t&&c<=n&&r.push(c);if(r.length<2)return[{time:t,pos:0},{time:n,pos:1}];for(a=0,o=r.length;a<o;++a)l=r[a+1],s=r[a-1],c=r[a],Math.round((l+s)/2)!==c&&i.push({time:c,pos:a/(o-1)});return i}_generate(){let e=this.min,t=this.max,n=super.getDataTimestamps();return(!n.includes(e)||!n.length)&&n.splice(0,0,e),(!n.includes(t)||n.length===1)&&n.push(t),n.sort((e,t)=>e-t)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;let t=this.getDataTimestamps(),n=this.getLabelTimestamps();return e=t.length&&n.length?this.normalize(t.concat(n)):t.length?t:n,e=this._cache.all=e,e}getDecimalForValue(e){return(hf(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){let t=this._offsets,n=this.getDecimalForPixel(e)/t.factor-t.end;return hf(this._table,n*this._tableRange+this._minPos,!0)}});function gf(e){return e==null||isNaN(e)?`-`:e>=1e9?(e/1e9).toFixed(1)+`B`:e>=1e6?(e/1e6).toFixed(1)+`M`:e>=1e3?(e/1e3).toFixed(1)+`K`:String(e)}function _f(e,t=`$`,n=1){if(e==null||isNaN(e))return`-`;let r=e*n;return r>=1e3?t+(r/1e3).toFixed(1)+`K`:t+r.toFixed(2)}var vf=[`#cc785c`,`#7c8cff`,`#5ccc9c`,`#cc5c8c`,`#ccb45c`,`#5cc4cc`],yf={color:`#6b6b6b`,borderColor:`#1e1e1e`,gridColor:`#1a1a1a`},bf=H(`<div class="h-full w-full pt-2"><canvas></canvas></div>`);function xf(e,t){Le(t,!0),Ru.register(kc,id,kd,Nd,wd);let n=ii(t,`barLabel`,3,`Tokens`),r=ii(t,`fmtCost`,3,_f),i,a,o=[],s=[];function c(e){if(e<=2)return 56;if(e<=7)return 36;if(e<=14)return 24}function l(e){return e>=1e6?(e/1e6).toFixed(1)+`M`:e>=1e3?(e/1e3).toFixed(0)+`K`:String(e)}Tr(()=>(o=t.points.map(e=>e.messages),s=t.points.map(e=>e.cost),a=new Ru(i,{type:`bar`,data:{labels:t.points.map(e=>e.label),datasets:[{label:`Tokens`,data:t.points.map(e=>e.tokens),backgroundColor:`#cc785c`,borderWidth:0,borderRadius:3,barThickness:c(t.points.length)}]},options:{responsive:!0,maintainAspectRatio:!1,interaction:{mode:`index`,intersect:!1},plugins:{legend:{display:!1},tooltip:{backgroundColor:`#111`,borderColor:`#23252a`,borderWidth:1,padding:10,titleFont:{size:11},bodyFont:{size:12},titleColor:`#666`,bodyColor:`#e8e8e8`,callbacks:{label:e=>{let t=e.dataIndex,i=[` ${n()}: ${l(e.raw)}`,` Messages: ${l(o[t])}`];return s[t]>0&&i.push(` Cost: ${r()(s[t])}`),i}}}},scales:{x:{grid:{color:yf.gridColor},border:{color:`transparent`},ticks:{maxTicksLimit:10,font:{size:11},color:yf.color,maxRotation:0}},y:{grid:{color:yf.gridColor},border:{color:`transparent`},beginAtZero:!0,ticks:{font:{size:11},color:yf.color,callback:e=>l(e)}}}}}),()=>a.destroy())),cn(()=>{a&&(o=t.points.map(e=>e.messages),s=t.points.map(e=>e.cost),a.data.labels=t.points.map(e=>e.label),a.data.datasets[0].data=t.points.map(e=>e.tokens),a.data.datasets[0].barThickness=c(t.points.length),a.update())});var u=bf();ri(L(u),e=>i=e,()=>i),A(u),U(e,u),Re()}var Sf=H(`<button class="hover:bg-(--hover-background) my-1.5 rounded w-full relative cursor-pointer flex items-center transition-opacity duration-150"><span class="text-sm flex items-center mx-2 z-10 py-0.5 text-(--text-muted2)"><span class="pr-1 font-semibold tabular-nums"> </span> <span class="px-1"> </span></span> <div class="h-full rounded absolute inset-0 transition-all duration-200"></div></button>`),Cf=H(`<div class="mt-2 flex flex-col min-h-16"></div>`);function wf(e,t){Le(t,!0);let n=ii(t,`metric`,3,`tokens`),r=ii(t,`selectedModel`,3,null),i=ii(t,`periodOverride`,3,null),a=ii(t,`callsOverride`,3,null),o=ii(t,`fmtCost`,3,_f);function s(e){return o()(e)}function c(e){if(a())return a().get(e.id)??0;let t=i()?.get(e.id);if(t){if(n()===`tokens`)return t.tokens;if(n()===`sessions`)return t.sessions;if(n()===`messages`)return t.messages;if(n()===`cost`)return t.cost}return n()===`sessions`?e.sessions:n()===`messages`?e.messages:n()===`cost`?e.costUSD:e.inputTokens+e.outputTokens+e.cacheReadTokens+e.cacheCreateTokens}function l(e){if(a())return gf(a().get(e.id)??0);let t=i()?.get(e.id);return n()===`cost`?s(t?t.cost:e.costUSD):gf(c(e))}let u=P(()=>[...t.modelUsage].filter(e=>c(e)>0).sort((e,t)=>c(t)-c(e))),d=P(()=>Math.max(...V(u).map(c)));function f(e){return V(d)>0?c(e)/V(d)*100:0}function p(e){t.onSelect(r()===e?null:e)}var m=Cf();Mr(m,21,()=>V(u),Or,(e,n)=>{let i=P(()=>vf[t.modelUsage.indexOf(V(n))%vf.length]),a=P(()=>r()!==null&&r()!==V(n).id);var o=Sf(),s=L(o),c=L(s),u=L(c,!0);A(c);var d=R(c,2),m=L(d,!0);A(d),A(s);var h=R(s,2);A(o),mn((e,t)=>{Jr(o,`opacity: ${V(a)?.35:1}`),W(u,e),W(m,V(n).name),Jr(h,`width: ${t??``}%; background-color: ${V(i)??``}`)},[()=>l(V(n)),()=>f(V(n))]),or(`click`,o,()=>p(V(n).id)),U(e,o)}),A(m),U(e,m),Re()}sr([`click`]);var Tf=H(`<div class="my-1.5 rounded w-full relative flex items-center"><span class="text-sm flex items-center mx-2 z-10 py-0.5 text-(--text-muted2) min-w-0"><span class="pr-1.5 font-semibold tabular-nums shrink-0"> </span> <span class="truncate"> </span></span> <div class="h-full rounded absolute inset-0 bg-accent transition-all duration-200"></div></div>`),Ef=H(`<div class="mt-2 flex flex-col min-h-16"></div>`);function Df(e,t){Le(t,!0);let n=ii(t,`metric`,3,`tokens`);function r(e){return n()===`messages`?e.messages:n()===`cost`?e.costEstimate:n()===`tokens`?e.tokensEstimate??0:e.sessions}function i(e){return n()===`cost`?`$`+e.costEstimate.toFixed(2):gf(r(e))}let a=P(()=>[...t.projects].sort((e,t)=>r(t)-r(e))),o=P(()=>Math.max(...V(a).map(r)));function s(e){return V(o)>0?r(e)/V(o)*100:0}var c=Ef();Mr(c,21,()=>V(a),Or,(e,t)=>{var n=Tf(),r=L(n),a=L(r),o=L(a,!0);A(a);var c=R(a,2),l=L(c,!0);A(c),A(r);var u=R(r,2);A(n),mn((e,r)=>{Qr(n,`title`,V(t).path),W(o,e),W(l,V(t).name),Jr(u,`width: ${r??``}%`)},[()=>i(V(t)),()=>s(V(t))]),U(e,n)}),A(c),U(e,c),Re()}var Of=H(`<button> </button>`),kf=H(`<nav class="mb-1 flex flex-wrap items-center justify-end gap-2"><div class="flex items-center gap-2 mr-1"><div class="text-sm text-[var(--text-muted3)] px-2 font-semibold"><a target="_blank" href="https://www.buymeacoffee.com/tomdraper" class="hover:text-[var(--highlight)]">Buy me a coffee</a></div> <div class="grid place-items-center px-1"><button aria-label="Settings" class="cursor-pointer"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-gear-fill text-[var(--text-muted3)] hover:text-[var(--highlight)]" viewBox="0 0 16 16"><path d="M9.405 1.05c-.413-1.4-2.397-1.4-2.81 0l-.1.34a1.464 1.464 0 0 1-2.105.872l-.31-.17c-1.283-.698-2.686.705-1.987 1.987l.169.311c.446.82.023 1.841-.872 2.105l-.34.1c-1.4.413-1.4 2.397 0 2.81l.34.1a1.464 1.464 0 0 1 .872 2.105l-.17.31c-.698 1.283.705 2.686 1.987 1.987l.311-.169a1.464 1.464 0 0 1 2.105.872l.1.34c.413 1.4 2.397 1.4 2.81 0l.1-.34a1.464 1.464 0 0 1 2.105-.872l.31.17c1.283.698 2.686-.705 1.987-1.987l-.169-.311a1.464 1.464 0 0 1 .872-2.105l.34-.1c1.4-.413 1.4-2.397 0-2.81l-.34-.1a1.464 1.464 0 0 1-.872-2.105l.17-.31c.698-1.283-.705-2.686-1.987-1.987l-.311.169a1.464 1.464 0 0 1-2.105-.872zM8 10.93a2.929 2.929 0 1 1 0-5.86 2.929 2.929 0 0 1 0 5.858z"></path></svg></button></div></div> <div class="border rounded-[var(--border-radius)] border-[var(--border-color)] text-[0.9em] text-[var(--text-muted3)] overflow-hidden flex flex-wrap"></div></nav>`);function Af(e,t){Le(t,!0);let n=[{label:`1 hour`,value:`1 hour`},{label:`24 hours`,value:`24 hours`},{label:`Week`,value:`week`},{label:`Month`,value:`month`},{label:`6 months`,value:`6 months`},{label:`All time`,value:`all time`}];var r=kf(),i=L(r),a=R(L(i),2),o=L(a);A(a),A(i);var s=R(i,2);Mr(s,21,()=>n,Or,(e,n)=>{let r=()=>V(n).label,i=()=>V(n).value;var a=Of(),o=L(a,!0);A(a),mn(()=>{Kr(a,1,`px-3 py-1 hover:text-[var(--text)] cursor-pointer transition-colors duration-50 ease-in-out ${t.filterPeriod===i()?`bg-[var(--highlight)] !text-black`:``}`),W(o,r())}),or(`click`,a,()=>t.onSelect(i())),U(e,a)}),A(s),A(r),or(`click`,o,function(...e){t.onSettings?.apply(this,e)}),U(e,r),Re()}sr([`click`]);var jf=H(`<div class="flex text-xs text-(--text-muted3)"><!></div>`),Mf=H(`<div><!></div>`),Nf=H(`<div><div class="flex items-center justify-between shrink-0"><h2 class="font-semibold"> </h2> <!></div> <!></div>`);function Pf(e,t){let n=ii(t,`class`,3,``),r=ii(t,`fitContent`,3,!1);var i=Nf(),a=L(i),o=L(a),s=L(o,!0);A(o);var c=R(o,2),l=e=>{var n=jf();wr(L(n),()=>t.actions),A(n),U(e,n)};Dr(c,e=>{t.actions&&e(l)}),A(a);var u=R(a,2),d=e=>{var n=Mf();wr(L(n),()=>t.children),A(n),mn(()=>Kr(n,1,Br(r()?``:`flex-1 min-h-0`))),U(e,n)};Dr(u,e=>{t.children&&e(d)}),A(i),mn(()=>{Kr(i,1,`rounded-(--border-radius) border border-(--border-color) text-sm px-4 py-3 relative flex flex-col ${n()??``}`),W(s,t.title)}),U(e,i)}var Ff=H(`<button class="flex items-center gap-2 w-full text-left rounded px-1 cursor-pointer transition-opacity duration-150"><span class="w-2 h-2 rounded-full shrink-0"></span> <span class="text-xs text-(--text-muted2) truncate flex-1"> </span> <span class="text-xs text-(--text-muted3) tabular-nums shrink-0"> </span></button>`),If=H(`<div class="flex items-center justify-center gap-4 pt-3 pb-2 px-1"><div class="relative shrink-0" style="width: 136px; height: 136px"><canvas style="position: absolute; inset: 0; width: 100%; height: 100%"></canvas></div> <div class="flex flex-col gap-1 w-40"></div></div>`);function Lf(e,t){Le(t,!0),Ru.register(jc,Ju,wd);let n=ii(t,`selectedTool`,3,null),r=P(()=>Object.entries(t.toolCounts).sort(([,e],[,t])=>t-e)),i=P(()=>V(r).slice(0,6));function a(e,t){return t===`Other`?`#444`:vf[e%vf.length]}function o(){let e=V(i),t=V(r).slice(6).reduce((e,[,t])=>e+t,0),n=e.map(([e])=>e),o=e.map(([,e])=>e),s=e.map(([e],t)=>a(t,e));return t>0&&(n.push(`Other`),o.push(t),s.push(`#444`)),{labels:n,data:o,colors:s}}let s,c;Tr(()=>{let{labels:e,data:r,colors:i}=o();return c=new Ru(s,{type:`doughnut`,data:{labels:e,datasets:[{data:r,backgroundColor:i,borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:`62%`,onClick:(e,r)=>{if(!r.length){t.onSelect(null);return}let i=c.data.labels?.[r[0].index];i!==`Other`&&t.onSelect(n()===i?null:i)},plugins:{legend:{display:!1},tooltip:{backgroundColor:`#111`,borderColor:`#23252a`,borderWidth:1,padding:10,titleFont:{size:11},bodyFont:{size:12},titleColor:`#666`,bodyColor:`#e8e8e8`,callbacks:{label:e=>` ${e.raw.toLocaleString()} calls`}}}}}),()=>c.destroy()}),cn(()=>{if(!c)return;let{labels:e,data:t,colors:n}=o();c.data.labels=e,c.data.datasets[0].data=t,c.data.datasets[0].backgroundColor=n,c.update()});var l=If(),u=L(l);ri(L(u),e=>s=e,()=>s),A(u);var d=R(u,2);Mr(d,21,()=>V(i),Or,(e,r,i)=>{var o=P(()=>_(V(r),2));let s=()=>V(o)[0],c=()=>V(o)[1],l=P(()=>n()!==null&&n()!==s());var u=Ff(),d=L(u),f=R(d,2),p=L(f,!0);A(f);var m=R(f,2),h=L(m,!0);A(m),A(u),mn((e,t)=>{Jr(u,`opacity: ${V(l)?.35:1}`),Jr(d,`background-color: ${e??``}`),W(p,s()),W(h,t)},[()=>a(i,s()),()=>c().toLocaleString()]),or(`click`,u,()=>t.onSelect(n()===s()?null:s())),U(e,u)}),A(d),A(l),U(e,l),Re()}sr([`click`]);var Rf=H(`<div class="relative flex justify-center pt-1"><div class="relative" style="width: min(100%, 320px)"><canvas></canvas> <span class="absolute text-xs text-(--text-muted3) left-1/2 -translate-x-1/2" style="top: 2%">12pm</span> <span class="absolute text-xs text-(--text-muted3) top-1/2 -translate-y-1/2" style="right: 1%">6pm</span> <span class="absolute text-xs text-(--text-muted3) left-1/2 -translate-x-1/2" style="bottom: 2%">12am</span> <span class="absolute text-xs text-(--text-muted3) top-1/2 -translate-y-1/2" style="left: 1%">6am</span></div></div>`);function zf(e,t){Le(t,!0),Ru.register(Mc,nf,Ju,wd);let n=ii(t,`selectedHour`,3,null);function r(e){return Array.from({length:24},(t,n)=>e[(n+12)%24])}function i(e,t){let n=Math.max(...e,1);return e.map((e,r)=>{let i=(r+12)%24;return`rgba(204, 120, 92, ${(t!==null&&i!==t?.15:.12+.88*e/n).toFixed(3)})`})}function a(e){return e===0?`12am`:e===12?`12pm`:e>12?`${e-12}pm`:`${e}am`}let o=Array.from({length:24},(e,t)=>a((t+12)%24)),s,c;Tr(()=>{let e=r(t.hourCounts);return c=new Ru(s,{type:`polarArea`,data:{labels:o,datasets:[{data:e,backgroundColor:i(e,n()),borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!0,aspectRatio:1,startAngle:-97.5,onClick:(e,r)=>{if(!r.length){t.onSelect(null);return}let i=(r[0].index+12)%24;t.onSelect(n()===i?null:i)},scales:{r:{display:!1,beginAtZero:!0}},plugins:{legend:{display:!1},tooltip:{backgroundColor:`#111`,borderColor:`#23252a`,borderWidth:1,padding:10,titleFont:{size:11},bodyFont:{size:12},titleColor:`#666`,bodyColor:`#e8e8e8`,callbacks:{title:e=>{let t=(e[0].dataIndex+12)%24,n=(t+1)%24;return`${a(t)} – ${a(n)}`},label:e=>` ${e.raw.toLocaleString()} messages`}}}}}),()=>c.destroy()}),cn(()=>{if(!c)return;let e=r(t.hourCounts);c.data.datasets[0].data=e,c.data.datasets[0].backgroundColor=i(e,n()),c.update()});var l=Rf(),u=L(l);ri(L(u),e=>s=e,()=>s),Oe(8),A(u),A(l),U(e,l),Re()}var Bf=H(`<button class="flex flex-col items-center flex-1 gap-1.5 cursor-pointer justify-end h-full"><div class="w-full rounded-sm transition-all duration-150"></div> <span class="text-[10px] text-(--text-muted3) leading-none shrink-0"> </span></button>`),Vf=H(`<div class="flex items-end gap-1.5 px-1 pb-1 pt-2 h-full"></div>`);function Hf(e,t){Le(t,!0);let n=ii(t,`selectedDayOfWeek`,3,null),r=[{label:`Mon`,day:1},{label:`Tue`,day:2},{label:`Wed`,day:3},{label:`Thu`,day:4},{label:`Fri`,day:5},{label:`Sat`,day:6},{label:`Sun`,day:0}],i=P(()=>Math.max(...t.dayCounts,1));var a=Vf();Mr(a,21,()=>r,Or,(e,r)=>{let a=()=>V(r).label,o=()=>V(r).day,s=P(()=>t.dayCounts[o()]),c=P(()=>V(s)/V(i)),l=P(()=>n()===o()),u=P(()=>n()!==null&&!V(l));var d=Bf(),f=L(d),p=R(f,2),m=L(p,!0);A(p),A(d),mn((e,t)=>{Qr(d,`title`,e),Jr(f,`height: ${t??``}px; background: var(--highlight); opacity: ${V(u)?.2:.85}`),W(m,a())},[()=>V(s).toLocaleString(),()=>Math.max(V(c)*68,2)]),or(`click`,d,()=>t.onSelect(V(l)?null:o())),U(e,d)}),A(a),U(e,a),Re()}sr([`click`]);var Uf=H(`<button class="flex items-center gap-2 w-full text-left rounded px-1 cursor-pointer transition-opacity duration-150"><span class="w-2 h-2 rounded-full shrink-0"></span> <span class="text-xs text-(--text-muted2) truncate flex-1"> </span> <span class="text-xs text-(--text-muted3) tabular-nums shrink-0"> </span></button>`),Wf=H(`<div class="flex items-center justify-center gap-4 pt-3 pb-2 px-1"><div class="relative shrink-0" style="width: 136px; height: 136px"><canvas style="position: absolute; inset: 0; width: 100%; height: 100%"></canvas></div> <div class="flex flex-col gap-1 w-40"></div></div>`);function Gf(e,t){Le(t,!0),Ru.register(jc,Ju,wd);let n=ii(t,`selectedStopReason`,3,null),r={end_turn:`End turn`,tool_use:`Tool use`,max_tokens:`Max tokens`,stop_sequence:`Stop sequence`,error:`Error`},i=P(()=>Object.entries(t.stopReasons).sort(([,e],[,t])=>t-e));function a(){return{labels:V(i).map(([e])=>r[e]??e),values:V(i).map(([,e])=>e),colors:V(i).map((e,t)=>vf[t%vf.length])}}let o,s;Tr(()=>{let{labels:e,values:r,colors:c}=a();return s=new Ru(o,{type:`doughnut`,data:{labels:e,datasets:[{data:r,backgroundColor:c,borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:`62%`,onClick:(e,r)=>{if(!r.length){t.onSelect(null);return}let a=V(i)[r[0].index]?.[0];a&&t.onSelect(n()===a?null:a)},plugins:{legend:{display:!1},tooltip:{backgroundColor:`#111`,borderColor:`#23252a`,borderWidth:1,padding:10,titleFont:{size:11},bodyFont:{size:12},titleColor:`#666`,bodyColor:`#e8e8e8`,callbacks:{label:e=>` ${e.raw.toLocaleString()}`}}}}}),()=>s.destroy()}),cn(()=>{if(!s)return;let{labels:e,values:t,colors:n}=a();s.data.labels=e,s.data.datasets[0].data=t,s.data.datasets[0].backgroundColor=n,s.update()});var c=Wf(),l=L(c);ri(L(l),e=>o=e,()=>o),A(l);var u=R(l,2);Mr(u,21,()=>V(i),Or,(e,i,a)=>{var o=P(()=>_(V(i),2));let s=()=>V(o)[0],c=()=>V(o)[1],l=P(()=>n()!==null&&n()!==s());var u=Uf(),d=L(u),f=R(d,2),p=L(f,!0);A(f);var m=R(f,2),h=L(m,!0);A(m),A(u),mn(e=>{Jr(u,`opacity: ${V(l)?.35:1}`),Jr(d,`background-color: ${vf[a%vf.length]??``}`),W(p,r[s()]??s()),W(h,e)},[()=>gf(c())]),or(`click`,u,()=>t.onSelect(n()===s()?null:s())),U(e,u)}),A(u),A(c),U(e,c),Re()}sr([`click`]);var Kf=[{code:`USD`,symbol:`$`,rate:1},{code:`EUR`,symbol:`€`,rate:.92},{code:`GBP`,symbol:`£`,rate:.79},{code:`CAD`,symbol:`$`,rate:1.36},{code:`AUD`,symbol:`$`,rate:1.53},{code:`CHF`,symbol:`Fr`,rate:.89},{code:`JPY`,symbol:`¥`,rate:149},{code:`INR`,symbol:`₹`,rate:83}],qf=H(`<button><span class="font-mono text-base w-5 text-center shrink-0"> </span> <span class="text-xs"> </span></button>`),Jf=H(`<div role="presentation" class="fixed inset-0 z-50 flex items-center justify-center" style="background: rgba(0,0,0,0.55); backdrop-filter: blur(4px)"><div class="rounded-(--border-radius) border border-(--border-color) bg-bg text-sm w-80 shadow-xl"><div class="flex items-center justify-between px-4 py-3 border-b border-(--border-color)"><h2 class="font-semibold">Settings</h2> <button class="text-(--text-muted3) hover:text-(--text) cursor-pointer transition-colors" aria-label="Close"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" viewBox="0 0 16 16"><path d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8z"></path></svg></button></div> <div class="px-4 py-3"><p class="text-xs text-(--text-muted3) mb-3">Currency <span class="ml-1 opacity-50">(approximate rates)</span></p> <div class="grid grid-cols-2 gap-1.5"></div></div></div></div>`);function Yf(e,t){Le(t,!0);function n(e){e.target===e.currentTarget&&t.onClose()}function r(e){e.key===`Escape`&&t.onClose()}var i=Jf();ar(`keydown`,Ht,r);var a=L(i),o=L(a),s=R(L(o),2);A(o);var c=R(o,2),l=R(L(c),2);Mr(l,21,()=>Kf,Or,(e,n)=>{var r=qf();let i;var a=L(r),o=L(a,!0);A(a);var s=R(a,2),c=L(s,!0);A(s),A(r),mn(()=>{i=Kr(r,1,`flex items-center gap-2 px-3 py-2 rounded-(--border-radius) border cursor-pointer transition-colors text-left`,null,i,{"border-(--highlight)":t.currency.code===V(n).code,"text-(--highlight)":t.currency.code===V(n).code,"border-(--border-color)":t.currency.code!==V(n).code,"text-(--text-muted2)":t.currency.code!==V(n).code,"hover:border-(--text-muted3)":t.currency.code!==V(n).code}),W(o,V(n).symbol),W(c,V(n).code)}),or(`click`,r,()=>t.onSelect(V(n))),U(e,r)}),A(l),A(c),A(a),A(i),or(`click`,i,n),or(`keydown`,i,()=>{}),or(`click`,s,function(...e){t.onClose?.apply(this,e)}),U(e,i),Re()}sr([`click`,`keydown`]);var Xf=hr(`<svg preserveAspectRatio="none" class="absolute bottom-0 left-0 right-0" style="width: 100%; height: 40px; pointer-events: none; display: block;"><defs><linearGradient x1="0" y1="0" x2="0" y2="1"><stop offset="0%" stop-color="var(--highlight)" stop-opacity="0.28"></stop><stop offset="100%" stop-color="var(--highlight)" stop-opacity="0"></stop></linearGradient></defs><path></path><path fill="none" stroke="var(--highlight)" stroke-width="1.5" vector-effect="non-scaling-stroke" stroke-opacity="0.65"></path></svg>`);function Zf(e,t){Le(t,!0);let n=Math.random().toString(36).slice(2),r=P(()=>Math.max(...t.values,1)),i=P(()=>t.values.some(e=>e>0)),a=P(()=>t.values.map((e,n)=>[t.values.length<=1?200/2:n/(t.values.length-1)*200,40-e/V(r)*40*.88]));function o(e){if(e.length<2)return``;let t=`M${e[0][0]},${e[0][1]}`;for(let n=0;n<e.length-1;n++){let[r,i]=e[n],[a,o]=e[n+1],s=(r+a)/2;t+=`C${s},${i} ${s},${o} ${a},${o}`}return t}let s=P(()=>o(V(a))),c=P(()=>V(s)?`${V(s)}L200,40L0,40Z`:``);var l=gr(),u=Xt(l),d=e=>{var t=Xf();Qr(t,`viewBox`,`0 0 200 40`);var r=L(t),i=L(r);A(r);var a=R(r),o=R(a);A(t),mn(()=>{Qr(i,`id`,`sg-${n??``}`),Qr(a,`d`,V(c)),Qr(a,`fill`,`url(#sg-${n??``})`),Qr(o,`d`,V(s))}),U(e,t)};Dr(u,e=>{V(i)&&V(s)&&e(d)}),U(e,l),Re()}var Qf=H(`<button class="flex items-center gap-2 w-full text-left rounded px-1 cursor-pointer transition-opacity duration-150"><span class="w-2 h-2 rounded-full shrink-0"></span> <span class="text-xs text-(--text-muted2) truncate flex-1"> </span> <span class="text-xs text-(--text-muted3) tabular-nums shrink-0"> </span></button>`),$f=H(`<div class="flex items-center justify-center gap-4 pt-3 pb-2 px-1"><div class="relative shrink-0" style="width: 136px; height: 136px"><canvas style="position: absolute; inset: 0; width: 100%; height: 100%"></canvas></div> <div class="flex flex-col gap-1 w-40"></div></div>`);function ep(e,t){Le(t,!0),Ru.register(jc,Ju,wd);let n=ii(t,`selectedEntrypoint`,3,null),r={cli:`CLI`,vscode:`VS Code`,jetbrains:`JetBrains`,cursor:`Cursor`,web:`Web`,api:`API`};function i(e){return r[e]??e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}let a=P(()=>Object.entries(t.entrypoints).sort(([,e],[,t])=>t-e));function o(e){return{labels:V(a).map(([e])=>i(e)),values:V(a).map(([,e])=>e),colors:V(a).map(([t],n)=>{let r=vf[n%vf.length];return e!==null&&e!==t?r+`40`:r})}}let s,c;Tr(()=>{let{labels:e,values:r,colors:i}=o(n());return c=new Ru(s,{type:`doughnut`,data:{labels:e,datasets:[{data:r,backgroundColor:i,borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:`62%`,onClick:(e,r)=>{if(!r.length){t.onSelect(null);return}let i=V(a)[r[0].index]?.[0];i&&t.onSelect(n()===i?null:i)},plugins:{legend:{display:!1},tooltip:{backgroundColor:`#111`,borderColor:`#23252a`,borderWidth:1,padding:10,titleFont:{size:11},bodyFont:{size:12},titleColor:`#666`,bodyColor:`#e8e8e8`,callbacks:{label:e=>` ${e.raw.toLocaleString()}`}}}}}),()=>c.destroy()}),cn(()=>{if(!c)return;let{labels:e,values:t,colors:r}=o(n());c.data.labels=e,c.data.datasets[0].data=t,c.data.datasets[0].backgroundColor=r,c.update()});var l=$f(),u=L(l);ri(L(u),e=>s=e,()=>s),A(u);var d=R(u,2);Mr(d,21,()=>V(a),Or,(e,r,a)=>{var o=P(()=>_(V(r),2));let s=()=>V(o)[0],c=()=>V(o)[1],l=P(()=>n()!==null&&n()!==s());var u=Qf(),d=L(u),f=R(d,2),p=L(f,!0);A(f);var m=R(f,2),h=L(m,!0);A(m),A(u),mn((e,t)=>{Jr(u,`opacity: ${V(l)?.35:1}`),Jr(d,`background-color: ${vf[a%vf.length]??``}`),W(p,e),W(h,t)},[()=>i(s()),()=>gf(c())]),or(`click`,u,()=>t.onSelect(n()===s()?null:s())),U(e,u)}),A(d),A(l),U(e,l),Re()}sr([`click`]);var tp=H(`<button class="hover:bg-(--hover-background) my-1.5 rounded w-full relative cursor-pointer flex items-center text-left transition-opacity duration-150"><span class="text-sm flex items-center mx-2 z-10 py-0.5 text-(--text-muted2) min-w-0"><span class="pr-1.5 font-semibold tabular-nums shrink-0"> </span> <span class="truncate"> </span></span> <div class="h-full rounded absolute inset-0 bg-accent transition-all duration-200"></div></button>`),np=H(`<div class="mt-2 flex flex-col min-h-16"></div>`);function rp(e,t){Le(t,!0);let n=ii(t,`metric`,3,`tokens`),r=ii(t,`selectedBranch`,3,null);function i(e){return n()===`cost`?`$`+e.toFixed(2):gf(e)}let a=P(()=>Math.max(...t.branches.map(e=>e.value),1));function o(e){t.onSelect(r()===e?null:e)}var s=np();Mr(s,21,()=>t.branches,Or,(e,t)=>{let n=()=>V(t).branch,s=()=>V(t).value,c=P(()=>r()!==null&&r()!==n());var l=tp(),u=L(l),d=L(u),f=L(d,!0);A(d);var p=R(d,2),m=L(p,!0);A(p),A(u);var h=R(u,2);A(l),mn(e=>{Jr(l,`opacity: ${V(c)?.35:1}`),W(f,e),W(m,n()),Jr(h,`width: ${s()/V(a)*100}%`)},[()=>i(s())]),or(`click`,l,()=>o(n())),U(e,l)}),A(s),U(e,s),Re()}sr([`click`]);var ip=H(`<div class="w-auto text-center pt-3 text-3xl font-bold text-(--highlight)"> </div> <!>`,1),ap=H(`<div class="w-auto text-center pt-3 text-3xl font-bold text-(--highlight)"> </div> <!>`,1),op=H(`<div class="w-auto text-center pt-3 text-3xl font-bold text-(--highlight)"> </div> <!>`,1),sp=H(`<div class="w-auto text-center pt-3 text-3xl font-bold text-(--highlight)"> </div> <!>`,1),cp=H(`<span class="px-[0.5em] text-(--text)">Calls</span>`),lp=H(`<span class="px-[0.5em] text-(--text)">Sessions</span>`),up=H(`<button> </button>`),dp=H(`<div class="pt-2 pb-1"><div class="flex justify-between text-xs text-(--text-muted3) mb-1.5"><span> </span> <span class="text-(--highlight) font-semibold"> </span></div> <div class="h-2 rounded-full overflow-hidden" style="background: var(--border-color)"><div class="h-full rounded-full"></div></div></div>`),fp=H(`<button> </button>`),pp=H(`<button> </button>`),mp=H(`<!> <div class="min-h-screen bg-bg font-sans text-text"><main class="p-4 md:p-8 lg:p-12"><!> <div class="flex flex-col xl:flex-row gap-4 mt-4"><div class="w-full xl:w-96 flex flex-col gap-4"><div class="grid grid-cols-2 gap-4"><!> <!> <!> <!></div> <!> <!> <!> <!> <!></div> <div class="flex grow flex-col gap-4"><!> <div class="flex flex-col md:flex-row gap-4"><div class="flex flex-col gap-4 grow"><!> <!></div> <div class="flex flex-col gap-4 w-full md:w-96"><!> <!></div></div></div></div></main></div>`,1);function hp(e,t){Le(t,!0);let n=F(null),r=F(null),i=F(null),a=F(`tokens`),o=F(`tokens`),s=F(null),c=F(null),l=F(`tokens`),u=F(null),d=F(!1),f=F(Vt(Kf[0])),p=F(null),m=F(null),h=F(null),g=F(`all time`);function _(e){return V(m)===null||parseInt(e.slice(11,13),10)===V(m)}function v(e){return V(h)===null||new Date(e.slice(0,10)+`T12:00:00Z`).getUTCDay()===V(h)}let y=P(()=>{let{symbol:e,rate:t}=V(f);return n=>_f(n,e,t)}),b={"1 hour":0,"24 hours":1,week:7,month:30,"6 months":180},x=P(()=>{let e=b[V(g)];if(e===void 0)return null;let t=new Date;return t.setDate(t.getDate()-e),t.toISOString().slice(0,10)}),S=P(()=>V(n)?V(x)===null?V(n).dailyActivity:V(n).dailyActivity.filter(e=>e.date>=V(x)):[]),C=P(()=>V(n)?V(x)===null?V(n).dailyModelTokens:V(n).dailyModelTokens.filter(e=>e.date>=V(x)):[]),w=P(()=>V(n)?new Map(V(n).modelUsage.map(e=>{let t=e.inputTokens+e.outputTokens+e.cacheReadTokens+e.cacheCreateTokens;return[e.id,t>0?e.costUSD/t:0]})):new Map),T=P(()=>{if(!V(n))return{};let e={};if(V(g)===`1 hour`){let t=new Date(Date.now()-36e5).toISOString().slice(0,16);for(let[r,i]of Object.entries(V(n).toolMiniutelyCounts))for(let[n,a]of Object.entries(i))n>=t&&_(n)&&v(n)&&(e[r]=(e[r]??0)+a)}else if(V(g)!==`1 hour`&&V(g)!==`all time`||V(m)!==null){let t=b[V(g)],r=t!==void 0&&t>0?t*24:null,i=r===null?`0000`:new Date(Date.now()-r*36e5).toISOString().slice(0,13);for(let[t,r]of Object.entries(V(n).toolHourlyCounts))for(let[n,a]of Object.entries(r))n>=i&&_(n)&&v(n)&&(V(x)===null||n.slice(0,10)>=V(x))&&(e[t]=(e[t]??0)+a)}else if(V(g)===`all time`&&V(h)===null)return V(n).toolCounts;else for(let[t,r]of Object.entries(V(n).toolDailyCounts))for(let[n,i]of Object.entries(r))(V(x)===null||n>=V(x))&&v(n)&&(e[t]=(e[t]??0)+i);return e}),E=P(()=>{if(!V(n)||!V(s))return 1;let e=V(n).toolCounts[V(s)]??0,t=V(T)[V(s)]??0;return e>0?t/e:0}),D=P(()=>{if(!V(n))return{};if(V(g)===`all time`&&V(m)===null&&V(h)===null)return V(n).stopReasons;let e={};if(V(g)===`1 hour`){let t=new Date(Date.now()-36e5).toISOString().slice(0,16);for(let[r,i]of Object.entries(V(n).stopReasonMiniutelyCounts))for(let[n,a]of Object.entries(i))n>=t&&v(n)&&(e[r]=(e[r]??0)+a)}else if(V(g)!==`1 hour`&&V(g)!==`all time`||V(m)!==null){let t=b[V(g)],r=t!==void 0&&t>0?t*24:null,i=r===null?`0000`:new Date(Date.now()-r*36e5).toISOString().slice(0,13);for(let[t,r]of Object.entries(V(n).stopReasonHourlyCounts))for(let[n,a]of Object.entries(r))n>=i&&_(n)&&v(n)&&(V(x)===null||n.slice(0,10)>=V(x))&&(e[t]=(e[t]??0)+a)}else for(let[t,r]of Object.entries(V(n).stopReasonDailyCounts))for(let[n,i]of Object.entries(r))(V(x)===null||n>=V(x))&&v(n)&&(e[t]=(e[t]??0)+i);return e}),ee=P(()=>{if(!V(n)||!V(p))return 1;let e=V(n).stopReasons[V(p)]??0,t=V(D)[V(p)]??0;return e>0?t/e:0}),te=P(()=>{if(!V(n)||!V(c))return 1;let e=V(n).branchCounts[V(c)]??0,t=V(de)[V(c)]??0;return e>0?t/e:0}),ne=P(()=>{if(!V(n))return{};let e={},t=t=>{for(let[n,r]of Object.entries(t))e[n]=(e[n]??0)+r},r=V(n).hourlyActivity.length>0?V(n).hourlyActivity[0].hour.slice(0,10):null;if(V(g)===`1 hour`){let e=new Date(Date.now()-36e5).toISOString().slice(0,16);V(n).minutelyActivity.filter(t=>t.minute>=e&&_(t.minute)&&v(t.minute)).forEach(e=>t(e.tokensByModel))}else if(V(m)!==null)V(n).hourlyActivity.filter(e=>_(e.hour)&&v(e.hour)&&(V(x)===null||e.hour.slice(0,10)>=V(x))).forEach(e=>t(e.tokensByModel));else if(V(g)!==`all time`){let i=b[V(g)],a=i!==void 0&&i>0?new Date(Date.now()-i*24*36e5).toISOString().slice(0,13):`0000`,o=a.slice(0,10);if(V(n).hourlyActivity.filter(e=>e.hour>=a&&_(e.hour)&&v(e.hour)).forEach(e=>t(e.tokensByModel)),r!==null&&o<r){let t={};for(let e of V(n).hourlyActivity)for(let[n,r]of Object.entries(e.tokensByModel))t[n]=(t[n]??0)+r;let i=V(n).dailyActivity.filter(e=>e.date>=o&&e.date<r&&v(e.date)).reduce((e,t)=>e+t.messageCount,0),a=V(n).dailyActivity.filter(e=>e.date<r).reduce((e,t)=>e+t.messageCount,0),s=a>0?i/a:0;for(let r of V(n).modelUsage){let n=r.inputTokens+r.outputTokens+r.cacheReadTokens+r.cacheCreateTokens,i=Math.max(0,n-(t[r.id]??0))*s;i>0&&(e[r.id]=(e[r.id]??0)+i)}}}else V(C).filter(e=>v(e.date)).forEach(e=>t(e.tokensByModel));return e}),re=P(()=>{if(!V(n))return[];let e=V(n).modelUsage.reduce((e,t)=>e+t.costUSD,0),t=V(n).totalMessages>0?e/V(n).totalMessages:0,r=V(n).totalMessages>0?V(n).totalTokens/V(n).totalMessages:0;if(V(s)){let e=V(n).toolProjectSessions[V(s)]??{},i=V(g)!==`all time`||V(m)!==null||V(h)!==null?V(E):1;return V(n).projects.map(a=>{let o=(e[a.path]??0)*i,s=o*(V(n).totalMessages/Math.max(V(n).totalSessions,1));return{...a,sessions:o,messages:s,costEstimate:s*t,tokensEstimate:s*r}}).filter(e=>e.sessions>0).sort((e,t)=>t.sessions-e.sessions)}if(V(i)){let e=V(n).modelProjectSessions[V(i)]??{},a=V(n).modelUsage.find(e=>e.id===V(i)),o=a?a.inputTokens+a.outputTokens+a.cacheReadTokens+a.cacheCreateTokens:0,s=(V(g)!==`all time`||V(m)!==null||V(h)!==null)&&o>0?(V(ne)[V(i)]??0)/o:1;return V(n).projects.map(i=>{let a=(e[i.path]??0)*s,o=a*(V(n).totalMessages/Math.max(V(n).totalSessions,1));return{...i,sessions:a,messages:o,costEstimate:o*t,tokensEstimate:o*r}}).filter(e=>e.sessions>0).sort((e,t)=>t.sessions-e.sessions)}if(V(p)){let e=V(n).stopReasonProjectSessions[V(p)]??{},i=V(g)!==`all time`||V(m)!==null||V(h)!==null?V(ee):1;return V(n).projects.map(a=>{let o=(e[a.path]??0)*i,s=o*(V(n).totalMessages/Math.max(V(n).totalSessions,1));return{...a,sessions:o,messages:s,costEstimate:s*t,tokensEstimate:s*r}}).filter(e=>e.sessions>0).sort((e,t)=>t.sessions-e.sessions)}if(V(c)){let e=V(n).branchProjectSessions[V(c)]??{},i=V(g)!==`all time`||V(m)!==null||V(h)!==null?V(te):1;return V(n).projects.map(a=>{let o=(e[a.path]??0)*i,s=o*(V(n).totalMessages/Math.max(V(n).totalSessions,1));return{...a,sessions:o,messages:s,costEstimate:s*t,tokensEstimate:s*r}}).filter(e=>e.sessions>0).sort((e,t)=>t.sessions-e.sessions)}let a=(e,t)=>Object.entries(V(n).projectHourlyMessages[e]??{}).filter(([e])=>e>=t&&_(e)&&v(e)).reduce((e,[,t])=>e+t,0),o=(e,t)=>V(m)===null?Object.entries(V(n).projectDailyMessages[e]??{}).filter(([e])=>(t===null||e>=t)&&v(e)).reduce((e,[,t])=>e+t,0):Object.entries(V(n).projectHourlyMessages[e]??{}).filter(([e])=>(t===null||e.slice(0,10)>=t)&&_(e)&&v(e)).reduce((e,[,t])=>e+t,0),l=V(n).projects.map(e=>{let n;if(V(g)===`1 hour`){let t=new Date(Date.now()-36e5).toISOString().slice(0,13);n=a(e.path,t)}else if(V(g)!==`1 hour`&&V(g)!==`all time`){let t=new Date(Date.now()-(b[V(g)]??0)*24*36e5).toISOString().slice(0,13);n=a(e.path,t)}else n=o(e.path,V(x));return{...e,messages:n,costEstimate:n*t,tokensEstimate:n*r}});return V(g)===`all time`&&V(h)===null?l:l.filter(e=>e.messages>0).sort((e,t)=>t.messages-e.messages)});function ie(e){return Object.entries(e).reduce((e,[t,n])=>e+n*(V(w).get(t)??0),0)}let ae=P(()=>{if(!V(n))return[];let e=e=>{if(!V(i))return 1;let t=e[V(i)]??0,n=Object.values(e).reduce((e,t)=>e+t,0);return n>0?t/n:0};if(V(g)===`1 hour`){let t=new Map(V(n).minutelyActivity.map(e=>[e.minute,e])),r=V(s)?V(n).toolMiniutelyCounts[V(s)]??{}:null,a=V(p)?V(n).stopReasonMiniutelyCounts[V(p)]??{}:null,o=V(c)?(V(n).branchMiniutelyCounts??{})[V(c)]??{}:null,l=V(u)?(V(n).entrypointMiniutelyCounts??{})[V(u)]??{}:null,d=[],f=new Date(Date.now()-36e5);f.setSeconds(0,0);let m=new Date;for(m.setSeconds(0,0);f<=m;){let n=f.toISOString().slice(0,16),s=t.get(n);d.push({label:f.toLocaleTimeString(`en-GB`,{hour:`2-digit`,minute:`2-digit`,hour12:!1}),tokens:r?r[n]??0:a?a[n]??0:o?o[n]??0:l?l[n]??0:s?V(i)?s.tokensByModel[V(i)]??0:Object.values(s.tokensByModel).reduce((e,t)=>e+t,0):0,messages:o?o[n]??0:l?l[n]??0:Math.round((s?.messageCount??0)*(s?e(s.tokensByModel):1)),cost:s?ie(V(i)?{[V(i)]:s.tokensByModel[V(i)]??0}:s.tokensByModel):0,sessions:0}),f.setMinutes(f.getMinutes()+1)}return d}if(V(g)===`24 hours`||V(g)===`week`){let t=V(g)===`24 hours`?24:168,r=new Map(V(n).hourlyActivity.map(e=>[e.hour,e])),a=V(s)?V(n).toolHourlyCounts[V(s)]??{}:null,o=V(p)?V(n).stopReasonHourlyCounts[V(p)]??{}:null,l=V(c)?(V(n).branchHourlyCounts??{})[V(c)]??{}:null,d=V(u)?(V(n).entrypointHourlyCounts??{})[V(u)]??{}:null,f=[],m=new Date(Date.now()-t*36e5);m.setMinutes(0,0,0);let h=new Date;for(h.setMinutes(0,0,0);m<=h;){let t=m.toISOString().slice(0,13),n=r.get(t);f.push({label:m.toLocaleString(`en-GB`,V(g)===`week`?{day:`numeric`,month:`short`,hour:`2-digit`,minute:`2-digit`,hour12:!1}:{hour:`2-digit`,minute:`2-digit`,hour12:!1}),tokens:a?a[t]??0:o?o[t]??0:l?l[t]??0:d?d[t]??0:n?V(i)?n.tokensByModel[V(i)]??0:Object.values(n.tokensByModel).reduce((e,t)=>e+t,0):0,messages:l?l[t]??0:d?d[t]??0:Math.round((n?.messageCount??0)*(n?e(n.tokensByModel):1)),cost:n?ie(V(i)?{[V(i)]:n.tokensByModel[V(i)]??0}:n.tokensByModel):0,sessions:Math.round((n?.sessionCount??0)*(n?e(n.tokensByModel):1))}),m.setHours(m.getHours()+1)}return f}let t=V(s)?V(n).toolDailyCounts[V(s)]??{}:null,r=V(p)?V(n).stopReasonDailyCounts[V(p)]??{}:null,a=V(c)?(V(n).branchDailyCounts??{})[V(c)]??{}:null,o=V(u)?(V(n).entrypointDailyCounts??{})[V(u)]??{}:null,l=V(n).hourlyActivity.length>0?V(n).hourlyActivity[0].hour.slice(0,10):null,d=new Map;for(let e of V(S))v(e.date)&&(l===null||e.date<l)&&d.set(e.date,e.messageCount);for(let e of V(n).hourlyActivity)if((V(x)===null||e.hour.slice(0,10)>=V(x))&&_(e.hour)&&v(e.hour)){let t=e.hour.slice(0,10);d.set(t,(d.get(t)??0)+e.messageCount)}let f=new Map(V(S).map(e=>[e.date,e.sessionCount])),h=new Map,y=new Map;if(V(i)){for(let t of V(n).hourlyActivity)if((V(x)===null||t.hour.slice(0,10)>=V(x))&&_(t.hour)&&v(t.hour)){let n=t.hour.slice(0,10),r=e(t.tokensByModel);h.set(n,(h.get(n)??0)+t.messageCount*r),y.set(n,(y.get(n)??0)+t.sessionCount*r)}}let b=new Map,C=new Map;for(let e of V(n).hourlyActivity){if(V(x)!==null&&e.hour.slice(0,10)<V(x)||!_(e.hour)||!v(e.hour))continue;let t=e.hour.slice(0,10),n=V(i)?e.tokensByModel[V(i)]??0:Object.values(e.tokensByModel).reduce((e,t)=>e+t,0);b.set(t,(b.get(t)??0)+n);let r=ie(V(i)?{[V(i)]:e.tokensByModel[V(i)]??0}:e.tokensByModel);C.set(t,(C.get(t)??0)+r)}if(V(m)===null&&l!==null){let e={};for(let t of V(n).hourlyActivity)for(let[n,r]of Object.entries(t.tokensByModel))e[n]=(e[n]??0)+r;let t=V(n).dailyActivity.filter(e=>e.date<l).reduce((e,t)=>e+t.messageCount,0);if(t>0)for(let r of V(S)){if(r.date>=l||!v(r.date))continue;let a=r.messageCount/t,o={};for(let t of V(n).modelUsage){let n=t.inputTokens+t.outputTokens+t.cacheReadTokens+t.cacheCreateTokens,r=Math.max(0,n-(e[t.id]??0))*a;r>0&&(o[t.id]=r)}let s=V(i)?o[V(i)]??0:Object.values(o).reduce((e,t)=>e+t,0);s>0&&(b.set(r.date,s),C.set(r.date,ie(V(i)?{[V(i)]:o[V(i)]??0}:o)))}}let w=[...d.keys(),...b.keys()].sort();if(w.length===0)return[];let T=V(x)??w[0],E=[],D=new Date(T+`T12:00:00Z`),ee=new Date;for(ee.setHours(23,59,59,0);D<=ee;){let e=D.toISOString().slice(0,10);E.push({label:new Date(e+`T12:00:00Z`).toLocaleDateString(`en-GB`,{day:`numeric`,month:`short`}),tokens:t?t[e]??0:r?r[e]??0:a?a[e]??0:o?o[e]??0:b.get(e)??0,messages:a?a[e]??0:o?o[e]??0:V(i)?Math.round(h.get(e)??0):d.get(e)??0,cost:C.get(e)??0,sessions:V(i)?Math.round(y.get(e)??0):f.get(e)??0}),D.setDate(D.getDate()+1)}return E}),oe=P(()=>{let e=V(ae),t=()=>[,,,,,,].fill(0);if(e.length===0)return{sessions:t(),messages:t(),tokens:t(),cost:t()};let n=e.length/6,r=[],i=[],a=[],o=[];for(let t=0;t<6;t++){let s=Math.floor(t*n),c=Math.max(Math.floor((t+1)*n),s+1),l=e.slice(s,c);r.push(l.reduce((e,t)=>e+t.sessions,0)),i.push(l.reduce((e,t)=>e+t.messages,0)),a.push(l.reduce((e,t)=>e+t.tokens,0)),o.push(l.reduce((e,t)=>e+t.cost,0))}return{sessions:r,messages:i,tokens:a,cost:o}}),se=P(()=>{if(!V(n))return{sessions:null,messages:null,cost:null,tokens:null};let e=V(g)===`all time`?V(n).modelUsage.reduce((e,t)=>e+t.costUSD,0):Object.entries(V(ne)).reduce((e,[t,n])=>e+n*(V(w).get(t)??0),0),t=V(n).hourlyActivity.length>0?V(n).hourlyActivity[0].hour.slice(0,10):null,r;if(V(g)===`1 hour`){let e=new Date(Date.now()-36e5).toISOString().slice(0,16);r=V(n).minutelyActivity.filter(t=>t.minute>=e&&_(t.minute)&&v(t.minute)).reduce((e,t)=>e+t.messageCount,0)}else if(V(m)!==null)r=V(n).hourlyActivity.filter(e=>_(e.hour)&&v(e.hour)&&(V(x)===null||e.hour.slice(0,10)>=V(x))).reduce((e,t)=>e+t.messageCount,0);else if(V(g)!==`all time`){let e=b[V(g)],i=e!==void 0&&e>0?new Date(Date.now()-e*24*36e5).toISOString().slice(0,13):`0000`;r=V(S).filter(e=>(t===null||e.date<t)&&v(e.date)).reduce((e,t)=>e+t.messageCount,0)+V(n).hourlyActivity.filter(e=>e.hour>=i&&_(e.hour)&&v(e.hour)).reduce((e,t)=>e+t.messageCount,0)}else r=V(n).hourlyActivity.filter(e=>(V(x)===null||e.hour.slice(0,10)>=V(x))&&v(e.hour)).reduce((e,t)=>e+t.messageCount,0);if(V(s)){let e=V(n).toolCounts[V(s)]??0,t=V(T)[V(s)]??0,r=V(n).toolSessionCounts[V(s)]??0,i=V(g)===`all time`&&V(h)===null&&V(m)===null;return{sessions:Math.round(i?r:r*V(E)),messages:i?e:t,cost:null,tokens:null}}if(V(p)){let e=V(n).stopReasons[V(p)]??0,t=V(D)[V(p)]??0,r=V(n).stopReasonSessionCounts[V(p)]??0,i=V(g)===`all time`&&V(h)===null&&V(m)===null;return{sessions:Math.round(i?r:r*V(ee)),messages:i?e:t,cost:null,tokens:null}}if(V(c)){let e=V(n).branchSessionCounts[V(c)]??0,t=V(n).branchCounts[V(c)]??0,r=V(g)===`all time`&&V(h)===null&&V(m)===null;return{sessions:Math.round(r?e:e*V(te)),messages:r?t:V(de)[V(c)]??0,cost:null,tokens:null}}if(V(i)){let e=V(n).modelUsage.find(e=>e.id===V(i)),t=e?e.inputTokens+e.outputTokens+e.cacheReadTokens+e.cacheCreateTokens:0,a=V(ne)[V(i)]??0,o=Object.values(V(ne)).reduce((e,t)=>e+t,0),s=o>0?a/o:0,c=V(g)===`all time`&&V(h)===null&&V(m)===null;return{sessions:c?e?.sessions??0:Math.round(V(ce)*s),messages:c?e?.messages??0:Math.round(r*s),cost:c?e?.costUSD??0:a*(V(w).get(V(i))??0),tokens:c?t:a}}return V(x)===null&&V(h)===null&&V(m)===null?{sessions:V(n).totalSessions,messages:r,cost:e,tokens:V(n).totalTokens}:{sessions:V(ce),messages:r,cost:e,tokens:Object.values(V(ne)).reduce((e,t)=>e+t,0)}}),ce=P(()=>{if(!V(n))return 0;let e=V(n).hourlyActivity.length>0?V(n).hourlyActivity[0].hour.slice(0,10):null;if(V(g)===`1 hour`){let e=new Date(Date.now()-36e5).toISOString().slice(0,13);return V(n).hourlyActivity.filter(t=>t.hour>=e&&v(t.hour)).reduce((e,t)=>e+t.sessionCount,0)}else if(V(m)!==null)return V(n).hourlyActivity.filter(e=>_(e.hour)&&v(e.hour)&&(V(x)===null||e.hour.slice(0,10)>=V(x))).reduce((e,t)=>e+t.sessionCount,0);else if(V(g)!==`all time`){let t=b[V(g)],r=t!==void 0&&t>0?new Date(Date.now()-t*24*36e5).toISOString().slice(0,13):`0000`;return V(S).filter(t=>(e===null||t.date<e)&&v(t.date)).reduce((e,t)=>e+t.sessionCount,0)+V(n).hourlyActivity.filter(e=>e.hour>=r&&_(e.hour)&&v(e.hour)).reduce((e,t)=>e+t.sessionCount,0)}else return V(S).filter(e=>v(e.date)).reduce((e,t)=>e+t.sessionCount,0)}),le=P(()=>{if(!V(n))return null;let e=Object.values(V(ne)).reduce((e,t)=>e+t,0);return new Map(V(n).modelUsage.map(t=>{let n=t.inputTokens+t.outputTokens+t.cacheReadTokens+t.cacheCreateTokens,r=V(ne)[t.id]??0,i=n>0?r/n:0,a=e>0?r/e:0;return[t.id,{tokens:r,sessions:Math.round(V(ce)*a),messages:Math.round(t.messages*i),cost:r*(V(w).get(t.id)??0)}]}))}),ue=P(()=>V(i)&&V(n)?V(n).modelToolNames[V(i)]??{}:V(T)),de=P(()=>{if(!V(n))return{};if(V(s)){let e=V(n).toolBranchSessions[V(s)]??{};return V(g)===`all time`&&V(m)===null&&V(h)===null?e:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t*V(E)]))}if(V(i)){let e=V(n).modelBranchSessions[V(i)]??{};if(V(g)===`all time`&&V(m)===null&&V(h)===null)return e;let t=V(n).modelUsage.find(e=>e.id===V(i)),r=t?t.inputTokens+t.outputTokens+t.cacheReadTokens+t.cacheCreateTokens:0,a=r>0?(V(ne)[V(i)]??0)/r:0;return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t*a]))}if(V(p)){let e=V(n).stopReasonBranchSessions[V(p)]??{};return V(g)===`all time`&&V(m)===null&&V(h)===null?e:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t*V(ee)]))}if(V(g)===`all time`&&V(m)===null&&V(h)===null)return V(n).branchCounts??{};let e={};if(V(g)===`1 hour`){let t=new Date(Date.now()-36e5).toISOString().slice(0,16);for(let[r,i]of Object.entries(V(n).branchMiniutelyCounts??{}))for(let[n,a]of Object.entries(i))n>=t&&_(n)&&v(n)&&(e[r]=(e[r]??0)+a)}else if(V(g)!==`1 hour`&&V(g)!==`all time`||V(m)!==null){let t=b[V(g)],r=t!==void 0&&t>0?t*24:null,i=r===null?`0000`:new Date(Date.now()-r*36e5).toISOString().slice(0,13);for(let[t,r]of Object.entries(V(n).branchHourlyCounts??{}))for(let[n,a]of Object.entries(r))n>=i&&_(n)&&v(n)&&(V(x)===null||n.slice(0,10)>=V(x))&&(e[t]=(e[t]??0)+a)}else for(let[t,r]of Object.entries(V(n).branchDailyCounts??{}))for(let[n,i]of Object.entries(r))(V(x)===null||n>=V(x))&&v(n)&&(e[t]=(e[t]??0)+i);return e}),fe=P(()=>{if(!V(n))return[];let e=V(n).modelUsage.reduce((e,t)=>e+t.costUSD,0),t=V(n).totalMessages>0?e/V(n).totalMessages:0,r=V(n).totalMessages>0?V(n).totalTokens/V(n).totalMessages:0,i=V(de),a=V(n).branchSessionCounts??{};return Object.keys({...i,...a}).map(e=>{let n=i[e]??0;return{branch:e,value:V(l)===`sessions`?a[e]??0:V(l)===`tokens`?Math.round(n*r):V(l)===`cost`?n*t:n}}).filter(e=>e.value>0).sort((e,t)=>t.value-e.value).slice(0,10)}),pe=P(()=>{if(!V(n))return null;let e=V(g)!==`all time`||V(m)!==null||V(h)!==null,t=V(i)?V(n).modelUsage.filter(e=>e.id===V(i)):V(n).modelUsage,r=0,a=0,o=0;for(let n of t){let t=n.inputTokens+n.outputTokens+n.cacheReadTokens+n.cacheCreateTokens,i=e&&t>0?(V(ne)[n.id]??0)/t:1;V(p)&&(i*=V(ee)),V(c)&&(i*=V(te)),r+=n.inputTokens*i,a+=n.cacheReadTokens*i,o+=n.cacheCreateTokens*i}let s=r+a+o;return{hitRate:s>0?a/s:0,totalCacheRead:a,totalCacheCreate:o,totalProcessed:s}}),me=P(()=>{if(!V(n))return{};if(V(s)){let e=V(n).toolStopReasons[V(s)]??{};return V(g)===`all time`&&V(m)===null&&V(h)===null?e:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,Math.round(t*V(E))]))}if(V(i)){let e=V(n).modelStopReasons[V(i)]??{};if(V(g)===`all time`&&V(m)===null&&V(h)===null)return e;let t=V(n).modelUsage.find(e=>e.id===V(i)),r=t?t.inputTokens+t.outputTokens+t.cacheReadTokens+t.cacheCreateTokens:0,a=r>0?(V(ne)[V(i)]??0)/r:0;return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,Math.round(t*a)]))}if(V(c)){let e=V(g)!==`all time`||V(m)!==null||V(h)!==null,t={};for(let[r,i]of Object.entries(V(n).stopReasonBranchSessions)){let n=i[V(c)]??0;n>0&&(t[r]=Math.round(e?n*V(te):n))}return t}return V(D)}),he=P(()=>{if(!V(n))return{};if(V(g)===`all time`&&V(m)===null&&V(h)===null)return V(n).entrypoints;let e={};if(V(g)===`1 hour`){let t=new Date(Date.now()-36e5).toISOString().slice(0,16);for(let[r,i]of Object.entries(V(n).entrypointMiniutelyCounts))for(let[n,a]of Object.entries(i))n>=t&&v(n)&&(e[r]=(e[r]??0)+a)}else if(V(g)!==`1 hour`&&V(g)!==`all time`||V(m)!==null){let t=b[V(g)],r=t!==void 0&&t>0?t*24:null,i=r===null?`0000`:new Date(Date.now()-r*36e5).toISOString().slice(0,13);for(let[t,r]of Object.entries(V(n).entrypointHourlyCounts))for(let[n,a]of Object.entries(r))n>=i&&_(n)&&v(n)&&(V(x)===null||n.slice(0,10)>=V(x))&&(e[t]=(e[t]??0)+a)}else for(let[t,r]of Object.entries(V(n).entrypointDailyCounts))for(let[n,i]of Object.entries(r))(V(x)===null||n>=V(x))&&v(n)&&(e[t]=(e[t]??0)+i);return e}),ge=P(()=>{let e=Array(24).fill(0);if(!V(n))return e;let t=V(s)?V(n).toolHourlyCounts[V(s)]??{}:V(p)?V(n).stopReasonHourlyCounts[V(p)]??{}:V(c)?(V(n).branchHourlyCounts??{})[V(c)]??{}:V(u)?(V(n).entrypointHourlyCounts??{})[V(u)]??{}:null,r=V(s)?V(n).toolMiniutelyCounts[V(s)]??{}:V(p)?V(n).stopReasonMiniutelyCounts[V(p)]??{}:V(c)?(V(n).branchMiniutelyCounts??{})[V(c)]??{}:V(u)?(V(n).entrypointMiniutelyCounts??{})[V(u)]??{}:null;if(t&&r){if(V(g)===`1 hour`){let t=new Date(Date.now()-36e5).toISOString().slice(0,16);for(let[n,i]of Object.entries(r))n<t||v(n)&&(e[parseInt(n.slice(11,13),10)]+=i)}else if(V(g)!==`1 hour`&&V(g)!==`all time`){let n=(b[V(g)]??0)*24,r=new Date(Date.now()-n*36e5).toISOString().slice(0,13);for(let[n,i]of Object.entries(t))n<r||v(n)&&(e[parseInt(n.slice(11,13),10)]+=i)}else for(let[n,r]of Object.entries(t))V(x)!==null&&n.slice(0,10)<V(x)||v(n)&&(e[parseInt(n.slice(11,13),10)]+=r);return e}let a=(t,n,r)=>{let a=parseInt(t.slice(11,13),10);e[a]+=V(i)?n[V(i)]??0:r};if(V(g)===`1 hour`){let t=new Date(Date.now()-36e5).toISOString().slice(0,16);for(let r of V(n).minutelyActivity){if(r.minute<t||!v(r.minute))continue;let n=parseInt(r.minute.slice(11,13),10);e[n]+=V(i)?r.tokensByModel[V(i)]??0:r.messageCount}}else if(V(g)===`24 hours`||V(g)===`week`||V(g)===`month`){let e=V(g)===`24 hours`?24:V(g)===`week`?168:720,t=new Date(Date.now()-e*36e5).toISOString().slice(0,13);for(let e of V(n).hourlyActivity)e.hour<t||v(e.hour)&&a(e.hour,e.tokensByModel,e.messageCount)}else for(let e of V(n).hourlyActivity)V(x)!==null&&e.hour.slice(0,10)<V(x)||v(e.hour)&&a(e.hour,e.tokensByModel,e.messageCount);return e}),_e=P(()=>{let e=Array(7).fill(0);if(!V(n))return e;let t=(t,n)=>{if(V(g)===`1 hour`){let t=new Date(Date.now()-36e5).toISOString().slice(0,16);for(let[r,i]of Object.entries(n))r<t||!_(r)||(e[new Date(r.slice(0,10)+`T12:00:00Z`).getUTCDay()]+=i)}else{let n=b[V(g)],r=n!==void 0&&n>0?n*24:null,i=r===null?`0000`:new Date(Date.now()-r*36e5).toISOString().slice(0,13);for(let[n,r]of Object.entries(t))n<i||!_(n)||!v(n)||V(x)!==null&&n.slice(0,10)<V(x)||(e[new Date(n.slice(0,10)+`T12:00:00Z`).getUTCDay()]+=r)}return e};if(V(s))return t(V(n).toolHourlyCounts[V(s)]??{},V(n).toolMiniutelyCounts[V(s)]??{});if(V(p))return t(V(n).stopReasonHourlyCounts[V(p)]??{},V(n).stopReasonMiniutelyCounts[V(p)]??{});if(V(c))return t((V(n).branchHourlyCounts??{})[V(c)]??{},(V(n).branchMiniutelyCounts??{})[V(c)]??{});let r=e=>V(i)?e.tokensByModel[V(i)]??0:e.messageCount;if(V(g)===`1 hour`){let t=new Date(Date.now()-36e5).toISOString().slice(0,16);for(let i of V(n).minutelyActivity)i.minute<t||!_(i.minute)||(e[new Date(i.minute.slice(0,10)+`T12:00:00Z`).getUTCDay()]+=r(i))}else if(V(g)===`24 hours`||V(g)===`week`||V(g)===`month`){let t=V(g)===`24 hours`?24:V(g)===`week`?168:720,i=new Date(Date.now()-t*36e5).toISOString().slice(0,13);for(let t of V(n).hourlyActivity)t.hour<i||!_(t.hour)||(e[new Date(t.hour.slice(0,10)+`T12:00:00Z`).getUTCDay()]+=r(t))}else for(let t of V(n).hourlyActivity)V(x)!==null&&t.hour.slice(0,10)<V(x)||!_(t.hour)||(e[new Date(t.hour.slice(0,10)+`T12:00:00Z`).getUTCDay()]+=r(t));return e});Tr(async()=>{try{let e=await fetch(`/api/data`);if(!e.ok)throw Error(`HTTP ${e.status}`);I(n,await e.json(),!0)}catch(e){I(r,e.message,!0)}});var ve=mp(),ye=Xt(ve),be=e=>{Yf(e,{get currency(){return V(f)},onSelect:e=>I(f,e,!0),onClose:()=>I(d,!1)})};Dr(ye,e=>{V(d)&&e(be)});var xe=R(ye,2),Se=L(xe),Ce=L(Se);Af(Ce,{get filterPeriod(){return V(g)},onSelect:e=>I(g,e,!0),onSettings:()=>I(d,!0)});var we=R(Ce,2),O=L(we),Te=L(O),k=L(Te);{let e=P(()=>V(s)?`Sessions (tool)`:V(p)?`Sessions (reason)`:V(c)?`Sessions (branch)`:`Sessions`);Pf(k,{get title(){return V(e)},class:`h-28 overflow-hidden`,children:(e,t)=>{var n=ip(),r=Xt(n),i=L(r,!0);A(r),Zf(R(r,2),{get values(){return V(oe).sessions}}),mn(e=>W(i,e),[()=>gf(V(se).sessions??0)]),U(e,n)},$$slots:{default:!0}})}var Ee=R(k,2);{let e=P(()=>V(s)?`Calls`:V(p)?`Turns`:`Messages`);Pf(Ee,{get title(){return V(e)},class:`h-28 overflow-hidden`,children:(e,t)=>{var n=ap(),r=Xt(n),i=L(r,!0);A(r),Zf(R(r,2),{get values(){return V(oe).messages}}),mn(e=>W(i,e),[()=>gf(V(se).messages)]),U(e,n)},$$slots:{default:!0}})}var De=R(Ee,2);Pf(De,{title:`Tokens`,class:`h-28 overflow-hidden`,children:(e,t)=>{var n=op(),r=Xt(n),i=L(r,!0);A(r),Zf(R(r,2),{get values(){return V(oe).tokens}}),mn(e=>W(i,e),[()=>gf(V(se).tokens)]),U(e,n)},$$slots:{default:!0}}),Pf(R(De,2),{title:`Cost`,class:`h-28 overflow-hidden`,children:(e,t)=>{var n=sp(),r=Xt(n),i=L(r,!0);A(r),Zf(R(r,2),{get values(){return V(oe).cost}}),mn(e=>W(i,e),[()=>V(y)(V(se).cost)]),U(e,n)},$$slots:{default:!0}}),A(Te);var Oe=R(Te,2);Pf(Oe,{title:`Models`,fitContent:!0,actions:e=>{var t=gr(),n=Xt(t),r=e=>{U(e,cp())},i=e=>{U(e,lp())},o=e=>{var t=gr();Mr(Xt(t),16,()=>[`tokens`,`messages`,`sessions`,`cost`],Or,(e,t)=>{var n=up(),r=L(n,!0);A(n),mn(e=>{Kr(n,1,`px-[0.5em] cursor-pointer transition-colors duration-50 ease-in-out ${V(a)===t?`text-(--text)`:`hover:text-(--text)`}`),W(r,e)},[()=>t.charAt(0).toUpperCase()+t.slice(1)]),or(`click`,n,()=>I(a,t,!0)),U(e,n)}),U(e,t)};Dr(n,e=>{V(s)?e(r):V(p)||V(c)?e(i,1):e(o,-1)}),U(e,t)},children:(e,t)=>{var r=gr(),o=Xt(r),l=e=>{{let t=P(()=>!V(s)&&!V(p)&&!V(c)&&(V(g)!==`all time`||V(m)!==null||V(h)!==null)?V(le):null),r=P(()=>V(s)?new Map(V(n).modelUsage.map(e=>[e.id,V(n).modelToolNames[e.id]?.[V(s)]??0])):V(p)?new Map(V(n).modelUsage.map(e=>[e.id,V(n).modelStopReasons[e.id]?.[V(p)]??0])):V(c)?new Map(V(n).modelUsage.map(e=>[e.id,V(n).modelBranchSessions[e.id]?.[V(c)]??0])):null);wf(e,{get modelUsage(){return V(n).modelUsage},get metric(){return V(a)},get selectedModel(){return V(i)},onSelect:e=>I(i,e,!0),get periodOverride(){return V(t)},get callsOverride(){return V(r)},get fmtCost(){return V(y)}})}};Dr(o,e=>{V(n)&&e(l)}),U(e,r)},$$slots:{actions:!0,default:!0}});var ke=R(Oe,2);Pf(ke,{title:`Cache Hit Rate`,fitContent:!0,children:(e,t)=>{var n=gr(),r=Xt(n),i=e=>{var t=dp(),n=L(t),r=L(n),i=L(r);A(r);var a=R(r,2),o=L(a);A(a),A(n);var s=R(n,2),c=L(s);A(s),A(t),mn((e,t,n)=>{W(i,`${e??``} tokens from cache`),W(o,`${t??``}%`),Jr(c,`width: ${n??``}%; background: var(--highlight)`)},[()=>gf(V(pe).totalCacheRead),()=>(V(pe).hitRate*100).toFixed(1),()=>(V(pe).hitRate*100).toFixed(2)]),U(e,t)};Dr(r,e=>{V(pe)&&e(i)}),U(e,n)},$$slots:{default:!0}});var Ae=R(ke,2);Pf(Ae,{title:`Stop Reasons`,class:`h-[200px]`,children:(e,t)=>{var r=gr(),i=Xt(r),a=e=>{Gf(e,{get stopReasons(){return V(me)},get selectedStopReason(){return V(p)},onSelect:e=>I(p,e,!0)})};Dr(i,e=>{V(n)&&e(a)}),U(e,r)},$$slots:{default:!0}});var je=R(Ae,2);Pf(je,{title:`Git Branches`,fitContent:!0,actions:e=>{var t=gr();Mr(Xt(t),16,()=>[`tokens`,`messages`,`sessions`,`cost`],Or,(e,t)=>{var n=fp(),r=L(n,!0);A(n),mn(e=>{Kr(n,1,`px-[0.5em] cursor-pointer transition-colors duration-50 ease-in-out ${V(l)===t?`text-(--text)`:`hover:text-(--text)`}`),W(r,e)},[()=>t.charAt(0).toUpperCase()+t.slice(1)]),or(`click`,n,()=>I(l,t,!0)),U(e,n)}),U(e,t)},children:(e,t)=>{var r=gr(),i=Xt(r),a=e=>{rp(e,{get branches(){return V(fe)},get metric(){return V(l)},get selectedBranch(){return V(c)},onSelect:e=>I(c,e,!0)})};Dr(i,e=>{V(n)&&V(fe).length>0&&e(a)}),U(e,r)},$$slots:{actions:!0,default:!0}});var Me=R(je,2),Ne=e=>{Pf(e,{title:`Entrypoints`,class:`h-[200px]`,children:(e,t)=>{ep(e,{get entrypoints(){return V(he)},get selectedEntrypoint(){return V(u)},onSelect:e=>I(u,e,!0)})},$$slots:{default:!0}})},Pe=P(()=>V(n)&&Object.keys(V(n).entrypoints).length>1);Dr(Me,e=>{V(Pe)&&e(Ne)}),A(O);var Fe=R(O,2),j=L(Fe);Pf(j,{title:`Activity`,class:`h-96`,children:(e,t)=>{var r=gr(),i=Xt(r),a=e=>{{let t=P(()=>V(s)?`Calls`:V(p)?`Turns`:V(c)||V(u)?`Messages`:`Tokens`);xf(e,{get points(){return V(ae)},get barLabel(){return V(t)},get fmtCost(){return V(y)}})}};Dr(i,e=>{V(n)&&e(a)}),U(e,r)},$$slots:{default:!0}});var Ie=R(j,2),ze=L(Ie),Be=L(ze);Pf(Be,{title:`Usage Time`,class:`h-[390px]`,children:(e,t)=>{var r=gr(),i=Xt(r),a=e=>{zf(e,{get hourCounts(){return V(ge)},get selectedHour(){return V(m)},onSelect:e=>I(m,e,!0)})};Dr(i,e=>{V(n)&&e(a)}),U(e,r)},$$slots:{default:!0}}),Pf(R(Be,2),{title:`Usage Day`,class:`h-[148px]`,children:(e,t)=>{var r=gr(),i=Xt(r),a=e=>{Hf(e,{get dayCounts(){return V(_e)},get selectedDayOfWeek(){return V(h)},onSelect:e=>I(h,e,!0)})};Dr(i,e=>{V(n)&&e(a)}),U(e,r)},$$slots:{default:!0}}),A(ze);var Ve=R(ze,2),He=L(Ve);Pf(He,{title:`Tool Calls`,class:`h-[200px]`,children:(e,t)=>{var r=gr(),i=Xt(r),a=e=>{Lf(e,{get toolCounts(){return V(ue)},get selectedTool(){return V(s)},onSelect:e=>I(s,e,!0)})};Dr(i,e=>{V(n)&&e(a)}),U(e,r)},$$slots:{default:!0}}),Pf(R(He,2),{title:`Projects`,fitContent:!0,actions:e=>{var t=gr();Mr(Xt(t),16,()=>[`tokens`,`messages`,`sessions`,`cost`],Or,(e,t)=>{var n=pp(),r=L(n,!0);A(n),mn(e=>{Kr(n,1,`px-[0.5em] cursor-pointer transition-colors duration-50 ease-in-out ${V(o)===t?`text-(--text)`:`hover:text-(--text)`}`),W(r,e)},[()=>t.charAt(0).toUpperCase()+t.slice(1)]),or(`click`,n,()=>I(o,t,!0)),U(e,n)}),U(e,t)},children:(e,t)=>{var r=gr(),i=Xt(r),a=e=>{Df(e,{get projects(){return V(re)},get metric(){return V(o)}})};Dr(i,e=>{V(n)&&e(a)}),U(e,r)},$$slots:{actions:!0,default:!0}}),A(Ve),A(Ie),A(Fe),A(we),A(Se),A(xe),U(e,ve),Re()}sr([`click`]),yr(hp,{target:document.getElementById(`app`)});
|