From ee64788f550e50ff191092f23f8d7141c4e5d2de Mon Sep 17 00:00:00 2001 From: SVM0N <61781578+SVM0N@users.noreply.github.com> Date: Sun, 24 May 2026 07:31:35 +0000 Subject: [PATCH] =?UTF-8?q?refactor:=20rename=20XLSXCardView=20=E2=86=92?= =?UTF-8?q?=20CardView?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Class-internal rename. The CARD_VIEW_TYPE string registered with Obsidian is unchanged, so the rename is purely cosmetic from the API's perspective. Sweeps 8 sites: class def + instantiation in main.ts, plus mention-only references in test-plugin-logic.mjs, xlsx-to-csv-roundtrip.mjs, src/mobile-templates.ts, docs/architecture.md, docs/dev-workflow.md. Closes the follow-up flagged in handoff.md after SWITCH TO CSV AS MAIN. Co-Authored-By: Claude Opus 4.7 (1M context) --- main.js | 2 +- main.ts | 4 ++-- test-plugin-logic.mjs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/main.js b/main.js index dd60b0b..0ad832f 100644 --- a/main.js +++ b/main.js @@ -9,7 +9,7 @@ `,R='"',K=R+R,B=!1,P=null,z=!1,O=((()=>{if(typeof g=="object"){if(typeof g.delimiter!="string"||r.BAD_DELIMITERS.filter(function(j){return g.delimiter.indexOf(j)!==-1}).length||(S=g.delimiter),typeof g.quotes!="boolean"&&typeof g.quotes!="function"&&!Array.isArray(g.quotes)||(x=g.quotes),typeof g.skipEmptyLines!="boolean"&&typeof g.skipEmptyLines!="string"||(B=g.skipEmptyLines),typeof g.newline=="string"&&(M=g.newline),typeof g.quoteChar=="string"&&(R=g.quoteChar),typeof g.header=="boolean"&&(k=g.header),Array.isArray(g.columns)){if(g.columns.length===0)throw new Error("Option columns is empty");P=g.columns}g.escapeChar!==void 0&&(K=g.escapeChar+R),g.escapeFormulae instanceof RegExp?z=g.escapeFormulae:typeof g.escapeFormulae=="boolean"&&g.escapeFormulae&&(z=/^[=+\-@\t\r].*$/)}})(),new RegExp(m(R),"g"));if(typeof p=="string"&&(p=JSON.parse(p)),Array.isArray(p)){if(!p.length||Array.isArray(p[0]))return G(null,p,B);if(typeof p[0]=="object")return G(P||Object.keys(p[0]),p,B)}else if(typeof p=="object")return typeof p.data=="string"&&(p.data=JSON.parse(p.data)),Array.isArray(p.data)&&(p.fields||(p.fields=p.meta&&p.meta.fields||P),p.fields||(p.fields=Array.isArray(p.data[0])?p.fields:typeof p.data[0]=="object"?Object.keys(p.data[0]):[]),Array.isArray(p.data[0])||typeof p.data[0]=="object"||(p.data=[p.data])),G(p.fields||[],p.data||[],B);throw new Error("Unable to serialize unrecognized input");function G(j,E,$){var N="",H=(typeof j=="string"&&(j=JSON.parse(j)),typeof E=="string"&&(E=JSON.parse(E)),Array.isArray(j)&&0{for(var T=0;Te-i*Math.max(Math.min(a-3,9-a,1),-1);return[n(0),n(8),n(4)]}function Rr(s,t,e){let i=(n,o=(n+s/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[i(5),i(3),i(1)]}function Fr(s,t,e){let i=Yn(s,1,.5),n;for(t+e>1&&(n=1/(t+e),t*=n,e*=n),n=0;n<3;n++)i[n]*=1-t-e,i[n]+=t;return i}function Ir(s,t,e,i,n){return s===n?(t-e)/i+(t.5?h/(2-o-a):h/(o+a),l=Ir(e,i,n,h,o),l=l*60+.5),[l|0,c||0,r]}function Ci(s,t,e,i){return(Array.isArray(t)?s(t[0],t[1],t[2]):s(t,e,i)).map(ee)}function Si(s,t,e){return Ci(Yn,s,t,e)}function Br(s,t,e){return Ci(Fr,s,t,e)}function zr(s,t,e){return Ci(Rr,s,t,e)}function Kn(s){return(s%360+360)%360}function Vr(s){let t=Or.exec(s),e=255,i;if(!t)return;t[5]!==i&&(e=t[6]?ts(+t[5]):ee(+t[5]));let n=Kn(+t[2]),o=+t[3]/100,a=+t[4]/100;return t[1]==="hwb"?i=Br(n,o,a):t[1]==="hsv"?i=zr(n,o,a):i=Si(n,o,a),{r:i[0],g:i[1],b:i[2],a:e}}function Nr(s,t){var e=ki(s);e[0]=Kn(e[0]+t),e=Si(e),s.r=e[0],s.g=e[1],s.b=e[2]}function Hr(s){if(!s)return;let t=ki(s),e=t[0],i=Wn(t[1]),n=Wn(t[2]);return s.a<255?`hsla(${e}, ${i}%, ${n}%, ${Xt(s.a)})`:`hsl(${e}, ${i}%, ${n}%)`}function Wr(){let s={},t=Object.keys(jn),e=Object.keys($n),i,n,o,a,r;for(i=0;i>16&255,o>>8&255,o&255]}return s}function $r(s){Ds||(Ds=Wr(),Ds.transparent=[0,0,0,0]);let t=Ds[s.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}function Ur(s){let t=jr.exec(s),e=255,i,n,o;if(t){if(t[7]!==i){let a=+t[7];e=t[8]?ts(a):te(a*255,0,255)}return i=+t[1],n=+t[3],o=+t[5],i=255&(t[2]?ts(i):te(i,0,255)),n=255&(t[4]?ts(n):te(n,0,255)),o=255&(t[6]?ts(o):te(o,0,255)),{r:i,g:n,b:o,a:e}}}function Yr(s){return s&&(s.a<255?`rgba(${s.r}, ${s.g}, ${s.b}, ${Xt(s.a)})`:`rgb(${s.r}, ${s.g}, ${s.b})`)}function Kr(s,t,e){let i=Pe(Xt(s.r)),n=Pe(Xt(s.g)),o=Pe(Xt(s.b));return{r:ee(_i(i+e*(Pe(Xt(t.r))-i))),g:ee(_i(n+e*(Pe(Xt(t.g))-n))),b:ee(_i(o+e*(Pe(Xt(t.b))-o))),a:s.a+e*(t.a-s.a)}}function Ts(s,t,e){if(s){let i=ki(s);i[t]=Math.max(0,Math.min(i[t]+i[t]*e,t===0?360:1)),i=Si(i),s.r=i[0],s.g=i[1],s.b=i[2]}}function Xn(s,t){return s&&Object.assign(t||{},s)}function Un(s){var t={r:0,g:0,b:0,a:255};return Array.isArray(s)?s.length>=3&&(t={r:s[0],g:s[1],b:s[2],a:255},s.length>3&&(t.a=ee(s[3]))):(t=Xn(s,{r:0,g:0,b:0,a:1}),t.a=ee(t.a)),t}function Xr(s){return s.charAt(0)==="r"?Ur(s):Vr(s)}var te,Lt,wi,Mr,Dr,Ms,Tr,Pr,Or,$n,jn,Ds,jr,_i,Pe,es,Gn=gi(()=>{te=(s,t,e)=>Math.max(Math.min(s,e),t);Lt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},wi=[..."0123456789ABCDEF"],Mr=s=>wi[s&15],Dr=s=>wi[(s&240)>>4]+wi[s&15],Ms=s=>(s&240)>>4===(s&15),Tr=s=>Ms(s.r)&&Ms(s.g)&&Ms(s.b)&&Ms(s.a);Pr=(s,t)=>s<255?t(s):"";Or=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;$n={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"},jn={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"};jr=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;_i=s=>s<=.0031308?s*12.92:Math.pow(s,1/2.4)*1.055-.055,Pe=s=>s<=.04045?s/12.92:Math.pow((s+.055)/1.055,2.4);es=class s{constructor(t){if(t instanceof s)return t;let e=typeof t,i;e==="object"?i=Un(t):e==="string"&&(i=Lr(t)||$r(t)||Xr(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=Xn(this._rgb);return t&&(t.a=Xt(t.a)),t}set rgb(t){this._rgb=Un(t)}rgbString(){return this._valid?Yr(this._rgb):void 0}hexString(){return this._valid?Ar(this._rgb):void 0}hslString(){return this._valid?Hr(this._rgb):void 0}mix(t,e){if(t){let i=this.rgb,n=t.rgb,o,a=e===o?.5:e,r=2*a-1,l=i.a-n.a,c=((r*l===-1?r:(r+l)/(1+r*l))+1)/2;o=1-c,i.r=255&c*i.r+o*n.r+.5,i.g=255&c*i.g+o*n.g+.5,i.b=255&c*i.b+o*n.b+.5,i.a=a*i.a+(1-a)*n.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=Kr(this._rgb,t._rgb,e)),this}clone(){return new s(this.rgb)}alpha(t){return this._rgb.a=ee(t),this}clearer(t){let e=this._rgb;return e.a*=1-t,this}greyscale(){let t=this._rgb,e=ss(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){let e=this._rgb;return e.a*=1+t,this}negate(){let t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Ts(this._rgb,2,t),this}darken(t){return Ts(this._rgb,2,-t),this}saturate(t){return Ts(this._rgb,1,t),this}desaturate(t){return Ts(this._rgb,1,-t),this}rotate(t){return Nr(this._rgb,t),this}}});function Ht(){}function Z(s){return s==null}function rt(s){if(Array.isArray&&Array.isArray(s))return!0;let t=Object.prototype.toString.call(s);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function tt(s){return s!==null&&Object.prototype.toString.call(s)==="[object Object]"}function ht(s){return(typeof s=="number"||s instanceof Number)&&isFinite(+s)}function kt(s,t){return ht(s)?s:t}function Q(s,t){return typeof s=="undefined"?t:s}function ot(s,t,e){if(s&&typeof s.call=="function")return s.apply(e,t)}function nt(s,t,e,i){let n,o,a;if(rt(s))if(o=s.length,i)for(n=o-1;n>=0;n--)t.call(e,s[n],n);else for(n=0;n{for(let i of t){if(i==="")break;e=e&&e[i]}return e}}function Qt(s,t){return(qn[t]||(qn[t]=Jr(t)))(s)}function Bs(s){return s.charAt(0).toUpperCase()+s.slice(1)}function co(s){return s.type==="mouseup"||s.type==="click"||s.type==="contextmenu"}function Be(s,t,e){return Math.abs(s-t)n-o).pop(),t}function el(s){return typeof s=="symbol"||typeof s=="object"&&s!==null&&!(Symbol.toPrimitive in s||"toString"in s||"valueOf"in s)}function ve(s){return!el(s)&&!isNaN(parseFloat(s))&&isFinite(s)}function uo(s,t){let e=Math.round(s);return e-t<=s&&e+t>=s}function Ai(s,t,e){let i,n,o;for(i=0,n=s.length;il&&c=Math.min(t,e)-i&&s<=Math.max(t,e)+i}function Vs(s,t,e){e=e||(a=>s[a]1;)o=n+i>>1,e(o)?n=o:i=o;return{lo:n,hi:i}}function po(s,t,e){let i=0,n=s.length;for(;ii&&s[n-1]>e;)n--;return i>0||n{let i="_onData"+Bs(e),n=s[e];Object.defineProperty(s,e,{configurable:!0,enumerable:!1,value(...o){let a=n.apply(this,o);return s._chartjs.listeners.forEach(r=>{typeof r[i]=="function"&&r[i](...o)}),a}})})}function Fi(s,t){let e=s._chartjs;if(!e)return;let i=e.listeners,n=i.indexOf(t);n!==-1&&i.splice(n,1),!(i.length>0)&&(mo.forEach(o=>{delete s[o]}),delete s._chartjs)}function Ii(s){let t=new Set(s);return t.size===s.length?s:Array.from(t)}function zi(s,t){let e=[],i=!1;return function(...n){e=n,i||(i=!0,Bi.call(window,()=>{i=!1,s.apply(t,e)}))}}function vo(s,t){let e;return function(...i){return t?(clearTimeout(e),e=setTimeout(s,t,i)):s.apply(this,i),t}}function Vi(s,t,e){let i=t.length,n=0,o=i;if(s._sorted){let{iScale:a,vScale:r,_parsed:l}=s,c=s.dataset&&s.dataset.options?s.dataset.options.spanGaps:null,h=a.axis,{min:d,max:u,minDefined:f,maxDefined:m}=a.getUserBounds();if(f){if(n=Math.min(Vt(l,h,d).lo,e?i:Vt(t,h,a.getPixelForValue(d)).lo),c){let b=l.slice(0,n+1).reverse().findIndex(v=>!Z(v[r.axis]));n-=Math.max(0,b)}n=gt(n,0,i-1)}if(m){let b=Math.max(Vt(l,a.axis,u,!0).hi+1,e?0:Vt(t,h,a.getPixelForValue(u),!0).hi+1);if(c){let v=l.slice(b-1).findIndex(y=>!Z(y[r.axis]));b+=Math.max(0,v)}o=gt(b,n,i)-n}else o=i-n}return{start:n,count:o}}function Ni(s){let{xScale:t,yScale:e,_scaleRanges:i}=s,n={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!i)return s._scaleRanges=n,!0;let o=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==e.min||i.ymax!==e.max;return Object.assign(i,n),o}function Hi(s){if(s&&typeof s=="object"){let t=s.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function Wi(s){return Hi(s)?s:new es(s)}function Ei(s){return Hi(s)?s:new es(s).saturate(.5).darken(.1).hexString()}function ol(s){s.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),s.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),s.set("animations",{colors:{type:"color",properties:nl},numbers:{type:"number",properties:il}}),s.describe("animations",{_fallback:"animation"}),s.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function al(s){s.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}function rl(s,t){t=t||{};let e=s+JSON.stringify(t),i=to.get(e);return i||(i=new Intl.NumberFormat(s,t),to.set(e,i)),i}function Ve(s,t,e){return rl(t,e).format(s)}function ll(s,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&s!==Math.floor(s)&&(e=s-Math.floor(s)),e}function cl(s){s.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Ne.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),s.route("scale.ticks","color","","color"),s.route("scale.grid","color","","borderColor"),s.route("scale.border","color","","borderColor"),s.route("scale.title","color","","color"),s.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),s.describe("scales",{_fallback:"scale"}),s.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}function is(s,t){if(!t)return s;let e=t.split(".");for(let i=0,n=e.length;ii&&(i=o),i}function _o(s,t,e,i){i=i||{};let n=i.data=i.data||{},o=i.garbageCollect=i.garbageCollect||[];i.font!==t&&(n=i.data={},o=i.garbageCollect=[],i.font=t),s.save(),s.font=t;let a=0,r=e.length,l,c,h,d,u;for(l=0;le.length){for(l=0;l0&&s.stroke()}}function Nt(s,t,e){return e=e||.5,!t||s&&s.x>t.left-e&&s.xt.top-e&&s.y0&&o.strokeColor!=="",l,c;for(s.save(),s.font=n.string,dl(s,o),l=0;lQ(s[a],s[t[a]]):a=>s[a]:()=>s;for(let a of n)e[a]=bl(o(a));return e}function Ui(s){return $s(s,{top:"y",right:"x",bottom:"y",left:"x"})}function re(s){return $s(s,["topLeft","topRight","bottomLeft","bottomRight"])}function xt(s){let t=Ui(s);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function ft(s,t){s=s||{},t=t||ct.font;let e=Q(s.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let i=Q(s.style,t.style);i&&!(""+i).match(pl)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);let n={family:Q(s.family,t.family),lineHeight:ml(Q(s.lineHeight,t.lineHeight),e),size:e,style:i,weight:Q(s.weight,t.weight),string:""};return n.string=hl(n),n}function We(s,t,e,i){let n=!0,o,a,r;for(o=0,a=s.length;oe&&r===0?0:r+l;return{min:a(i,-Math.abs(o)),max:a(n,o)}}function Jt(s,t){return Object.assign(Object.create(s),t)}function js(s,t=[""],e,i,n=()=>s[0]){let o=e||s;typeof i=="undefined"&&(i=Mo("_fallback",s));let a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:s,_rootScopes:o,_fallback:i,_getTarget:n,override:r=>js([r,...s],t,o,i)};return new Proxy(a,{deleteProperty(r,l){return delete r[l],delete r._keys,delete s[0][l],!0},get(r,l){return So(r,l,()=>Sl(l,t,s,r))},getOwnPropertyDescriptor(r,l){return Reflect.getOwnPropertyDescriptor(r._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(s[0])},has(r,l){return so(r).includes(l)},ownKeys(r){return so(r)},set(r,l,c){let h=r._storage||(r._storage=n());return r[l]=h[l]=c,delete r._keys,!0}})}function be(s,t,e,i){let n={_cacheable:!1,_proxy:s,_context:t,_subProxy:e,_stack:new Set,_descriptors:Yi(s,i),setContext:o=>be(s,o,e,i),override:o=>be(s.override(o),t,e,i)};return new Proxy(n,{deleteProperty(o,a){return delete o[a],delete s[a],!0},get(o,a,r){return So(o,a,()=>xl(o,a,r))},getOwnPropertyDescriptor(o,a){return o._descriptors.allKeys?Reflect.has(s,a)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(s,a)},getPrototypeOf(){return Reflect.getPrototypeOf(s)},has(o,a){return Reflect.has(s,a)},ownKeys(){return Reflect.ownKeys(s)},set(o,a,r){return s[a]=r,delete o[a],!0}})}function Yi(s,t={scriptable:!0,indexable:!0}){let{_scriptable:e=t.scriptable,_indexable:i=t.indexable,_allKeys:n=t.allKeys}=s;return{allKeys:n,scriptable:e,indexable:i,isScriptable:Gt(e)?e:()=>e,isIndexable:Gt(i)?i:()=>i}}function So(s,t,e){if(Object.prototype.hasOwnProperty.call(s,t)||t==="constructor")return s[t];let i=e();return s[t]=i,i}function xl(s,t,e){let{_proxy:i,_context:n,_subProxy:o,_descriptors:a}=s,r=i[t];return Gt(r)&&a.isScriptable(t)&&(r=yl(t,r,s,e)),rt(r)&&r.length&&(r=_l(t,r,s,a.isIndexable)),Ki(t,r)&&(r=be(r,n,o&&o[t],a)),r}function yl(s,t,e,i){let{_proxy:n,_context:o,_subProxy:a,_stack:r}=e;if(r.has(s))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+s);r.add(s);let l=t(o,a||i);return r.delete(s),Ki(s,l)&&(l=Xi(n._scopes,n,s,l)),l}function _l(s,t,e,i){let{_proxy:n,_context:o,_subProxy:a,_descriptors:r}=e;if(typeof o.index!="undefined"&&i(s))return t[o.index%t.length];if(tt(t[0])){let l=t,c=n._scopes.filter(h=>h!==l);t=[];for(let h of l){let d=Xi(c,n,s,h);t.push(be(d,o,a&&a[s],r))}}return t}function Eo(s,t,e){return Gt(s)?s(t,e):s}function kl(s,t,e,i,n){for(let o of t){let a=wl(e,o);if(a){s.add(a);let r=Eo(a._fallback,e,n);if(typeof r!="undefined"&&r!==e&&r!==i)return r}else if(a===!1&&typeof i!="undefined"&&e!==i)return null}return!1}function Xi(s,t,e,i){let n=t._rootScopes,o=Eo(t._fallback,e,i),a=[...s,...n],r=new Set;r.add(i);let l=eo(r,a,e,o||e,i);return l===null||typeof o!="undefined"&&o!==e&&(l=eo(r,a,o,l,i),l===null)?!1:js(Array.from(r),[""],n,o,()=>Cl(t,e,i))}function eo(s,t,e,i,n){for(;e;)e=kl(s,t,e,i,n);return e}function Cl(s,t,e){let i=s._getTarget();t in i||(i[t]={});let n=i[t];return rt(n)&&tt(e)?e:n||{}}function Sl(s,t,e,i){let n;for(let o of t)if(n=Mo(vl(o,s),e),typeof n!="undefined")return Ki(s,n)?Xi(e,i,s,n):n}function Mo(s,t){for(let e of t){if(!e)continue;let i=e[s];if(typeof i!="undefined")return i}}function so(s){let t=s._keys;return t||(t=s._keys=El(s._scopes)),t}function El(s){let t=new Set;for(let e of s)for(let i of Object.keys(e).filter(n=>!n.startsWith("_")))t.add(i);return Array.from(t)}function Gi(s,t,e,i){let{iScale:n}=s,{key:o="r"}=this._parsing,a=new Array(i),r,l,c,h;for(r=0,l=i;r!c.skip)),t.cubicInterpolationMode==="monotone")Pl(s,n);else{let c=i?s[s.length-1]:s[0];for(o=0,a=s.length;ol.height&&(h=l.height,c=ie(Math.floor(h*i))),{width:c,height:h}}function qi(s,t,e){let i=t||1,n=ie(s.height*i),o=ie(s.width*i);s.height=ie(s.height),s.width=ie(s.width);let a=s.canvas;return a.style&&(e||!a.style.height&&!a.style.width)&&(a.style.height=`${s.height}px`,a.style.width=`${s.width}px`),s.currentDevicePixelRatio!==i||a.height!==n||a.width!==o?(s.currentDevicePixelRatio=i,a.height=n,a.width=o,s.ctx.setTransform(i,0,0,i,0,0),!0):!1}function Qi(s,t){let e=Ol(s,t),i=e&&e.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function se(s,t,e,i){return{x:s.x+e*(t.x-s.x),y:s.y+e*(t.y-s.y)}}function Ao(s,t,e,i){return{x:s.x+e*(t.x-s.x),y:i==="middle"?e<.5?s.y:t.y:i==="after"?e<1?s.y:t.y:e>0?t.y:s.y}}function Oo(s,t,e,i){let n={x:s.cp2x,y:s.cp2y},o={x:t.cp1x,y:t.cp1y},a=se(s,n,e),r=se(n,o,e),l=se(o,t,e),c=se(a,r,e),h=se(r,l,e);return se(c,h,e)}function xe(s,t,e){return s?zl(t,e):Vl()}function Ji(s,t){let e,i;(t==="ltr"||t==="rtl")&&(e=s.canvas.style,i=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),s.prevTextDirection=i)}function Zi(s,t){t!==void 0&&(delete s.prevTextDirection,s.canvas.style.setProperty("direction",t[0],t[1]))}function Ro(s){return s==="angle"?{between:ze,compare:sl,normalize:bt}:{between:Wt,compare:(t,e)=>t-e,normalize:t=>t}}function io({start:s,end:t,count:e,loop:i,style:n}){return{start:s%e,end:t%e,loop:i&&(t-s+1)%e===0,style:n}}function Nl(s,t,e){let{property:i,start:n,end:o}=e,{between:a,normalize:r}=Ro(i),l=t.length,{start:c,end:h,loop:d}=s,u,f;if(d){for(c+=l,h+=l,u=0,f=l;ul(n,D,y)&&r(n,D)!==0,_=()=>r(o,y)===0||l(o,D,y),p=()=>b||C(),g=()=>!b||_();for(let x=h,k=h;x<=d;++x)w=t[x%a],!w.skip&&(y=c(w[i]),y!==D&&(b=l(y,n,o),v===null&&p()&&(v=r(y,n)===0?x:k),v!==null&&g()&&(m.push(io({start:v,end:x,loop:u,count:a,style:f})),v=null),k=x,D=y));return v!==null&&m.push(io({start:v,end:d,loop:u,count:a,style:f})),m}function en(s,t){let e=[],i=s.segments;for(let n=0;nn&&s[o%t].skip;)o--;return o%=t,{start:n,end:o}}function Wl(s,t,e,i){let n=s.length,o=[],a=t,r=s[t],l;for(l=t+1;l<=e;++l){let c=s[l%n];c.skip||c.stop?r.skip||(i=!1,o.push({start:t%n,end:(l-1)%n,loop:i}),t=a=c.stop?l:null):(a=l,r.skip&&(t=l)),r=c}return a!==null&&o.push({start:t%n,end:a%n,loop:i}),o}function Fo(s,t){let e=s.points,i=s.options.spanGaps,n=e.length;if(!n)return[];let o=!!s._loop,{start:a,end:r}=Hl(e,n,o,i);if(i===!0)return no(s,[{start:a,end:r,loop:o}],e,t);let l=r{Gn();ao=(()=>{let s=0;return()=>s++})();ro=(s,t)=>typeof s=="string"&&s.endsWith("%")?parseFloat(s)/100:+s/t,Ti=(s,t)=>typeof s=="string"&&s.endsWith("%")?parseFloat(s)/100*t:+s;qn={"":s=>s,x:s=>s.x,y:s=>s.y};Ie=s=>typeof s!="undefined",Gt=s=>typeof s=="function",Li=(s,t)=>{if(s.size!==t.size)return!1;for(let e of s)if(!t.has(e))return!1;return!0};st=Math.PI,lt=2*st,Zr=lt+st,Rs=Number.POSITIVE_INFINITY,tl=st/180,ut=st/2,pe=st/4,Qn=st*2/3,qt=Math.log10,At=Math.sign;Vt=(s,t,e,i)=>Vs(s,e,i?n=>{let o=s[n][t];return os[n][t]Vs(s,e,i=>s[i][t]>=e);mo=["push","pop","shift","splice","unshift"];Bi=function(){return typeof window=="undefined"?function(s){return s()}:window.requestAnimationFrame}();Ns=s=>s==="start"?"left":s==="end"?"right":"center",vt=(s,t,e)=>s==="start"?t:s==="end"?e:(t+e)/2,xo=(s,t,e,i)=>s===(i?"left":"right")?e:s==="center"?(t+e)/2:t;Ls=s=>s===0||s===1,Jn=(s,t,e)=>-(Math.pow(2,10*(s-=1))*Math.sin((s-t)*lt/e)),Zn=(s,t,e)=>Math.pow(2,-10*s)*Math.sin((s-t)*lt/e)+1,Ae={linear:s=>s,easeInQuad:s=>s*s,easeOutQuad:s=>-s*(s-2),easeInOutQuad:s=>(s/=.5)<1?.5*s*s:-.5*(--s*(s-2)-1),easeInCubic:s=>s*s*s,easeOutCubic:s=>(s-=1)*s*s+1,easeInOutCubic:s=>(s/=.5)<1?.5*s*s*s:.5*((s-=2)*s*s+2),easeInQuart:s=>s*s*s*s,easeOutQuart:s=>-((s-=1)*s*s*s-1),easeInOutQuart:s=>(s/=.5)<1?.5*s*s*s*s:-.5*((s-=2)*s*s*s-2),easeInQuint:s=>s*s*s*s*s,easeOutQuint:s=>(s-=1)*s*s*s*s+1,easeInOutQuint:s=>(s/=.5)<1?.5*s*s*s*s*s:.5*((s-=2)*s*s*s*s+2),easeInSine:s=>-Math.cos(s*ut)+1,easeOutSine:s=>Math.sin(s*ut),easeInOutSine:s=>-.5*(Math.cos(st*s)-1),easeInExpo:s=>s===0?0:Math.pow(2,10*(s-1)),easeOutExpo:s=>s===1?1:-Math.pow(2,-10*s)+1,easeInOutExpo:s=>Ls(s)?s:s<.5?.5*Math.pow(2,10*(s*2-1)):.5*(-Math.pow(2,-10*(s*2-1))+2),easeInCirc:s=>s>=1?s:-(Math.sqrt(1-s*s)-1),easeOutCirc:s=>Math.sqrt(1-(s-=1)*s),easeInOutCirc:s=>(s/=.5)<1?-.5*(Math.sqrt(1-s*s)-1):.5*(Math.sqrt(1-(s-=2)*s)+1),easeInElastic:s=>Ls(s)?s:Jn(s,.075,.3),easeOutElastic:s=>Ls(s)?s:Zn(s,.075,.3),easeInOutElastic(s){return Ls(s)?s:s<.5?.5*Jn(s*2,.1125,.45):.5+.5*Zn(s*2-1,.1125,.45)},easeInBack(s){return s*s*((1.70158+1)*s-1.70158)},easeOutBack(s){return(s-=1)*s*((1.70158+1)*s+1.70158)+1},easeInOutBack(s){let t=1.70158;return(s/=.5)<1?.5*(s*s*(((t*=1.525)+1)*s-t)):.5*((s-=2)*s*(((t*=1.525)+1)*s+t)+2)},easeInBounce:s=>1-Ae.easeOutBounce(1-s),easeOutBounce(s){return s<1/2.75?7.5625*s*s:s<2/2.75?7.5625*(s-=1.5/2.75)*s+.75:s<2.5/2.75?7.5625*(s-=2.25/2.75)*s+.9375:7.5625*(s-=2.625/2.75)*s+.984375},easeInOutBounce:s=>s<.5?Ae.easeInBounce(s*2)*.5:Ae.easeOutBounce(s*2-1)*.5+.5};il=["x","y","borderWidth","radius","tension"],nl=["color","borderColor","backgroundColor"];to=new Map;yo={values(s){return rt(s)?s:""+s},numeric(s,t,e){if(s===0)return"0";let i=this.chart.options.locale,n,o=s;if(e.length>1){let c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(n="scientific"),o=ll(s,e)}let a=qt(Math.abs(o)),r=isNaN(a)?1:Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:n,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(l,this.options.ticks.format),Ve(s,i,l)},logarithmic(s,t,e){if(s===0)return"0";let i=e[t].significand||s/Math.pow(10,Math.floor(qt(s)));return[1,2,3,5,10,15].includes(i)||t>.8*e.length?yo.numeric.call(this,s,t,e):""}};Ne={formatters:yo};ne=Object.create(null),Hs=Object.create(null);Di=class{constructor(t,e){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=i=>i.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=(i,n)=>Ei(n.backgroundColor),this.hoverBorderColor=(i,n)=>Ei(n.borderColor),this.hoverColor=(i,n)=>Ei(n.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return Mi(this,t,e)}get(t){return is(this,t)}describe(t,e){return Mi(Hs,t,e)}override(t,e){return Mi(ne,t,e)}route(t,e,i,n){let o=is(this,t),a=is(this,i),r="_"+e;Object.defineProperties(o,{[r]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){let l=this[r],c=a[n];return tt(l)?Object.assign({},c,l):Q(l,c)},set(l){this[r]=l}}})}apply(t){t.forEach(e=>e(this))}},ct=new Di({_scriptable:s=>!s.startsWith("on"),_indexable:s=>s!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[ol,al,cl]);gl=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,pl=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;bl=s=>+s||0;vl=(s,t)=>s?s+Bs(t):t,Ki=(s,t)=>tt(t)&&s!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);wl=(s,t)=>s===!0?t:typeof s=="string"?Qt(t,s):void 0;Ml=Number.EPSILON||1e-14,Re=(s,t)=>ts==="x"?"y":"x";Ks=s=>s.ownerDocument.defaultView.getComputedStyle(s,null);Rl=["top","right","bottom","left"];Fl=(s,t,e)=>(s>0||t>0)&&(!e||!e.shadowRoot);ie=s=>Math.round(s*10)/10;Po=function(){let s=!1;try{let t={get passive(){return s=!0,!1}};Us()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch(t){}return s}();zl=function(s,t){return{x(e){return s+s+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,i){return e-i},leftForLtr(e,i){return e-i}}},Vl=function(){return{x(s){return s},setWidth(s){},textAlign(s){return s},xPlus(s,t){return s+t},leftForLtr(s,t){return s}}}});var mr={};Pn(mr,{Animation:()=>si,Animations:()=>ms,ArcElement:()=>ce,BarController:()=>we,BarElement:()=>De,BasePlatform:()=>bs,BasicPlatform:()=>ii,BubbleController:()=>ke,CategoryScale:()=>Ye,Chart:()=>Ut,Colors:()=>sr,DatasetController:()=>St,Decimation:()=>nr,DomPlatform:()=>oi,DoughnutController:()=>Yt,Element:()=>Mt,Filler:()=>ar,Interaction:()=>Na,Legend:()=>lr,LineController:()=>Ce,LineElement:()=>Rt,LinearScale:()=>Ke,LogarithmicScale:()=>Xe,PieController:()=>je,PointElement:()=>Me,PolarAreaController:()=>de,RadarController:()=>Se,RadialLinearScale:()=>he,Scale:()=>ge,ScatterController:()=>Ee,SubTitle:()=>hr,Ticks:()=>Ne,TimeScale:()=>fe,TimeSeriesScale:()=>Ge,Title:()=>cr,Tooltip:()=>ur,_adapters:()=>Va,_detectPlatform:()=>Ua,animator:()=>jt,controllers:()=>za,defaults:()=>ct,elements:()=>Za,layouts:()=>yt,plugins:()=>fr,registerables:()=>Ud,registry:()=>Ot,scales:()=>pr});function Kl(s,t){let e=[],i=Object.keys(t);for(let n=0;n0||!e&&o<0)return n.index}return null}function Ho(s,t){let{chart:e,_cachedMeta:i}=s,n=e._stacks||(e._stacks={}),{iScale:o,vScale:a,index:r}=i,l=o.axis,c=a.axis,h=Jl(o,a,i),d=t.length,u;for(let f=0;fe[i].axis===t).shift()}function ec(s,t){return Jt(s,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function sc(s,t,e){return Jt(s,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function ls(s,t){let e=s.controller.index,i=s.vScale&&s.vScale.axis;if(i){t=t||s._parsed;for(let n of t){let o=n._stacks;if(!o||o[i]===void 0||o[i][e]===void 0)return;delete o[i][e],o[i]._visualValues!==void 0&&o[i]._visualValues[e]!==void 0&&delete o[i]._visualValues[e]}}}function nc(s,t){if(!s._cache.$bar){let e=s.getMatchingVisibleMetas(t),i=[];for(let n=0,o=e.length;nn-o))}return s._cache.$bar}function oc(s){let t=s.iScale,e=nc(t,s.type),i=t._length,n,o,a,r,l=()=>{a===32767||a===-32768||(Ie(r)&&(i=Math.min(i,Math.abs(a-r)||i)),r=a)};for(n=0,o=e.length;n0?n[s-1]:null,r=sMath.abs(r)&&(l=r,c=a),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:n,end:o,min:a,max:r}}function Ba(s,t,e,i){return rt(s)?lc(s,t,e,i):t[e.axis]=e.parse(s,i),t}function $o(s,t,e,i){let n=s.iScale,o=s.vScale,a=n.getLabels(),r=n===o,l=[],c,h,d,u;for(c=e,h=e+i;c=e?1:-1)}function hc(s){let t,e,i,n,o;return s.horizontal?(t=s.base>s.x,e="left",i="right"):(t=s.baseze(D,r,l,!0)?1:Math.max(C,C*e,_,_*e),m=(D,C,_)=>ze(D,r,l,!0)?-1:Math.min(C,C*e,_,_*e),b=f(0,c,d),v=f(ut,h,u),y=m(st,c,d),w=m(st+ut,h,u);i=(b-y)/2,n=(v-w)/2,o=-(b+y)/2,a=-(v+w)/2}return{ratioX:i,ratioY:n,offsetX:o,offsetY:a}}function ye(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}function pc(s,t,e,i){let{controller:n,data:o,_sorted:a}=s,r=n._cachedMeta.iScale,l=s.dataset&&s.dataset.options?s.dataset.options.spanGaps:null;if(r&&t===r.axis&&t!=="r"&&a&&o.length){let c=r._reversePixels?go:Vt;if(i){if(n._sharedOptions){let h=o[0],d=typeof h.getRange=="function"&&h.getRange(t);if(d){let u=c(o,t,e-d),f=c(o,t,e+d);return{lo:u.lo,hi:f.hi}}}}else{let h=c(o,t,e);if(l){let{vScale:d}=n._cachedMeta,{_parsed:u}=s,f=u.slice(0,h.lo+1).reverse().findIndex(b=>!Z(b[d.axis]));h.lo-=Math.max(0,f);let m=u.slice(h.hi).findIndex(b=>!Z(b[d.axis]));h.hi+=Math.max(0,m)}return h}}return{lo:0,hi:o.length-1}}function _s(s,t,e,i,n){let o=s.getSortedVisibleDatasetMetas(),a=e[t];for(let r=0,l=o.length;r{l[a]&&l[a](t[e],n)&&(o.push({element:l,datasetIndex:c,index:h}),r=r||l.inRange(t.x,t.y,n))}),i&&!r?[]:o}function cs(s,t){return s.filter(e=>e.pos===t)}function Ko(s,t){return s.filter(e=>Ha.indexOf(e.pos)===-1&&e.box.axis===t)}function hs(s,t){return s.sort((e,i)=>{let n=t?i:e,o=t?e:i;return n.weight===o.weight?n.index-o.index:n.weight-o.weight})}function xc(s){let t=[],e,i,n,o,a,r;for(e=0,i=(s||[]).length;ec.box.fullSize),!0),i=hs(cs(t,"left"),!0),n=hs(cs(t,"right")),o=hs(cs(t,"top"),!0),a=hs(cs(t,"bottom")),r=Ko(t,"x"),l=Ko(t,"y");return{fullSize:e,leftAndTop:i.concat(o),rightAndBottom:n.concat(l).concat(a).concat(r),chartArea:cs(t,"chartArea"),vertical:i.concat(n).concat(l),horizontal:o.concat(a).concat(r)}}function Xo(s,t,e,i){return Math.max(s[e],t[e])+Math.max(s[i],t[i])}function Wa(s,t){s.top=Math.max(s.top,t.top),s.left=Math.max(s.left,t.left),s.bottom=Math.max(s.bottom,t.bottom),s.right=Math.max(s.right,t.right)}function kc(s,t,e,i){let{pos:n,box:o}=e,a=s.maxPadding;if(!tt(n)){e.size&&(s[n]-=e.size);let d=i[e.stack]||{size:0,count:1};d.size=Math.max(d.size,e.horizontal?o.height:o.width),e.size=d.size/d.count,s[n]+=e.size}o.getPadding&&Wa(a,o.getPadding());let r=Math.max(0,t.outerWidth-Xo(a,s,"left","right")),l=Math.max(0,t.outerHeight-Xo(a,s,"top","bottom")),c=r!==s.w,h=l!==s.h;return s.w=r,s.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function Cc(s){let t=s.maxPadding;function e(i){let n=Math.max(t[i]-s[i],0);return s[i]+=n,n}s.y+=e("top"),s.x+=e("left"),e("right"),e("bottom")}function Sc(s,t){let e=t.maxPadding;function i(n){let o={left:0,top:0,right:0,bottom:0};return n.forEach(a=>{o[a]=Math.max(t[a],e[a])}),o}return i(s?["left","right"]:["top","bottom"])}function fs(s,t,e,i){let n=[],o,a,r,l,c,h;for(o=0,a=s.length,c=0;o{let a=!1;for(let r of o)a=a||ni(r.addedNodes,i),a=a&&!ni(r.removedNodes,i);a&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}function Ac(s,t,e){let i=s.canvas,n=new MutationObserver(o=>{let a=!1;for(let r of o)a=a||ni(r.removedNodes,i),a=a&&!ni(r.addedNodes,i);a&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}function ja(){let s=window.devicePixelRatio;s!==Qo&&(Qo=s,vs.forEach((t,e)=>{e.currentDevicePixelRatio!==s&&t()}))}function Oc(s,t){vs.size||window.addEventListener("resize",ja),vs.set(s,t)}function Rc(s){vs.delete(s),vs.size||window.removeEventListener("resize",ja)}function Fc(s,t,e){let i=s.canvas,n=i&&Ys(i);if(!n)return;let o=zi((r,l)=>{let c=n.clientWidth;e(r,l),c{let l=r[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||o(c,h)});return a.observe(n),Oc(s,o),a}function hn(s,t,e){e&&e.disconnect(),t==="resize"&&Rc(s)}function Ic(s,t,e){let i=s.canvas,n=zi(o=>{s.ctx!==null&&e(Lc(o,s))},s);return Dc(i,t,n),n}function Ua(s){return!Us()||typeof OffscreenCanvas!="undefined"&&s instanceof OffscreenCanvas?ii:oi}function Bc(s,t){let e=s.options.ticks,i=zc(s),n=Math.min(e.maxTicksLimit||i,i),o=e.major.enabled?Nc(t):[],a=o.length,r=o[0],l=o[a-1],c=[];if(a>n)return Hc(t,c,o,a/n),c;let h=Vc(o,t,n);if(a>0){let d,u,f=a>1?Math.round((l-r)/(a-1)):null;for(Gs(t,c,h,Z(f)?0:r-f,r),d=0,u=a-1;dn)return l}return Math.max(n,1)}function Nc(s){let t=[],e,i;for(e=0,i=s.length;ea+r)))return l}function Uc(s,t){nt(s,e=>{let i=e.gc,n=i.length/2,o;if(n>t){for(o=0;o{let i=e.split("."),n=i.pop(),o=[s].concat(i).join("."),a=t[e].split("."),r=a.pop(),l=a.join(".");ct.route(o,n,l,r)})}function Jc(s){return"id"in s&&"defaults"in s}function Zc(s){let t={},e=[],i=Object.keys(Ot.plugins.items);for(let o=0;o1&&sa(s[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${s}' axis. Please provide 'axis' or 'position' option.`)}function ia(s,t,e){if(e[t+"AxisID"]===s)return{axis:t}}function ah(s,t){if(t.data&&t.data.datasets){let e=t.data.datasets.filter(i=>i.xAxisID===s||i.yAxisID===s);if(e.length)return ia(s,"x",e[0])||ia(s,"y",e[0])}return{}}function rh(s,t){let e=ne[s.type]||{scales:{}},i=t.scales||{},n=xn(s.type,t),o=Object.create(null);return Object.keys(i).forEach(a=>{let r=i[a];if(!tt(r))return console.error(`Invalid scale configuration for scale: ${a}`);if(r._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);let l=yn(a,r,ah(a,s),ct.scales[r.type]),c=nh(l,n),h=e.scales||{};o[a]=Fe(Object.create(null),[{axis:l},r,h[l],h[c]])}),s.data.datasets.forEach(a=>{let r=a.type||s.type,l=a.indexAxis||xn(r,t),h=(ne[r]||{}).scales||{};Object.keys(h).forEach(d=>{let u=ih(d,l),f=a[u+"AxisID"]||u;o[f]=o[f]||Object.create(null),Fe(o[f],[{axis:u},i[f],h[d]])})}),Object.keys(o).forEach(a=>{let r=o[a];Fe(r,[ct.scales[r.type],ct.scale])}),o}function Ya(s){let t=s.options||(s.options={});t.plugins=Q(t.plugins,{}),t.scales=rh(s,t)}function Ka(s){return s=s||{},s.datasets=s.datasets||[],s.labels=s.labels||[],s}function lh(s){return s=s||{},s.data=Ka(s.data),Ya(s),s}function qs(s,t){let e=na.get(s);return e||(e=t(),na.set(s,e),Xa.add(e)),e}function oa(s,t,e){let i=s.get(t);i||(i=new Map,s.set(t,i));let n=e.join(),o=i.get(n);return o||(o={resolver:js(t,e),subPrefixes:e.filter(r=>!r.toLowerCase().includes("hover"))},i.set(n,o)),o}function hh(s,t){let{isScriptable:e,isIndexable:i}=Yi(s);for(let n of t){let o=e(n),a=i(n),r=(a||o)&&s[n];if(o&&(Gt(r)||ch(r))||a&&rt(r))return!0}return!1}function aa(s,t){return s==="top"||s==="bottom"||uh.indexOf(s)===-1&&t==="x"}function ra(s,t){return function(e,i){return e[s]===i[s]?e[t]-i[t]:e[s]-i[s]}}function la(s){let t=s.chart,e=t.options.animation;t.notifyPlugins("afterRender"),ot(e&&e.onComplete,[s],t)}function fh(s){let t=s.chart,e=t.options.animation;ot(e&&e.onProgress,[s],t)}function Ga(s){return Us()&&typeof s=="string"?s=document.getElementById(s):s&&s.length&&(s=s[0]),s&&s.canvas&&(s=s.canvas),s}function gh(s,t,e){let i=Object.keys(s);for(let n of i){let o=+n;if(o>=t){let a=s[n];delete s[n],(e>0||o>t)&&(s[o+e]=a)}}}function ph(s,t,e,i){return!e||s.type==="mouseout"?null:i?t:s}function ha(){return nt(Ut.instances,s=>s._plugins.invalidate())}function mh(s,t,e){let{startAngle:i,x:n,y:o,outerRadius:a,innerRadius:r,options:l}=t,{borderWidth:c,borderJoinStyle:h}=l,d=Math.min(c/a,bt(i-e));if(s.beginPath(),s.arc(n,o,a-c/2,i+d/2,e-d/2),r>0){let u=Math.min(c/r,bt(i-e));s.arc(n,o,r+c/2,e-u/2,i+u/2,!0)}else{let u=Math.min(c/2,a*bt(i-e));if(h==="round")s.arc(n,o,u,e-st/2,i+st/2,!0);else if(h==="bevel"){let f=2*u*u,m=-f*Math.cos(e+st/2)+n,b=-f*Math.sin(e+st/2)+o,v=f*Math.cos(i+st/2)+n,y=f*Math.sin(i+st/2)+o;s.lineTo(m,b),s.lineTo(v,y)}}s.closePath(),s.moveTo(0,0),s.rect(0,0,s.canvas.width,s.canvas.height),s.clip("evenodd")}function bh(s,t,e){let{startAngle:i,pixelMargin:n,x:o,y:a,outerRadius:r,innerRadius:l}=t,c=n/r;s.beginPath(),s.arc(o,a,r,i-c,e+c),l>n?(c=n/l,s.arc(o,a,l,e+c,i-c,!0)):s.arc(o,a,n,e+ut,i-ut),s.closePath(),s.clip()}function vh(s){return $s(s,["outerStart","outerEnd","innerStart","innerEnd"])}function xh(s,t,e,i){let n=vh(s.options.borderRadius),o=(e-t)/2,a=Math.min(o,i*t/2),r=l=>{let c=(e-Math.min(o,l))*i/2;return gt(l,0,Math.min(o,c))};return{outerStart:r(n.outerStart),outerEnd:r(n.outerEnd),innerStart:gt(n.innerStart,0,a),innerEnd:gt(n.innerEnd,0,a)}}function $e(s,t,e,i){return{x:e+s*Math.cos(t),y:i+s*Math.sin(t)}}function ai(s,t,e,i,n,o){let{x:a,y:r,startAngle:l,pixelMargin:c,innerRadius:h}=t,d=Math.max(t.outerRadius+i+e-c,0),u=h>0?h+i+e+c:0,f=0,m=n-l;if(i){let P=h>0?h-i:0,z=d>0?d-i:0,O=(P+z)/2,G=O!==0?m*O/(O+i):m;f=(m-G)/2}let b=Math.max(.001,m*d-e/st)/d,v=(m-b)/2,y=l+v+f,w=n-v-f,{outerStart:D,outerEnd:C,innerStart:_,innerEnd:p}=xh(t,u,d,w-y),g=d-D,x=d-C,k=y+D/g,S=w-C/x,M=u+_,R=u+p,K=y+_/M,B=w-p/R;if(s.beginPath(),o){let P=(k+S)/2;if(s.arc(a,r,d,k,P),s.arc(a,r,d,P,S),C>0){let V=$e(x,S,a,r);s.arc(V.x,V.y,C,S,w+ut)}let z=$e(R,w,a,r);if(s.lineTo(z.x,z.y),p>0){let V=$e(R,B,a,r);s.arc(V.x,V.y,p,w+ut,B+Math.PI)}let O=(w-p/u+(y+_/u))/2;if(s.arc(a,r,u,w-p/u,O,!0),s.arc(a,r,u,O,y+_/u,!0),_>0){let V=$e(M,K,a,r);s.arc(V.x,V.y,_,K+Math.PI,y-ut)}let G=$e(g,y,a,r);if(s.lineTo(G.x,G.y),D>0){let V=$e(g,k,a,r);s.arc(V.x,V.y,D,y-ut,k)}}else{s.moveTo(a,r);let P=Math.cos(k)*d+a,z=Math.sin(k)*d+r;s.lineTo(P,z);let O=Math.cos(S)*d+a,G=Math.sin(S)*d+r;s.lineTo(O,G)}s.closePath()}function yh(s,t,e,i,n){let{fullCircles:o,startAngle:a,circumference:r}=t,l=t.endAngle;if(o){ai(s,t,e,i,l,n);for(let c=0;c=st&&f===0&&h!=="miter"&&mh(s,t,b),o||(ai(s,t,e,i,b,n),s.stroke())}function qa(s,t,e=t){s.lineCap=Q(e.borderCapStyle,t.borderCapStyle),s.setLineDash(Q(e.borderDash,t.borderDash)),s.lineDashOffset=Q(e.borderDashOffset,t.borderDashOffset),s.lineJoin=Q(e.borderJoinStyle,t.borderJoinStyle),s.lineWidth=Q(e.borderWidth,t.borderWidth),s.strokeStyle=Q(e.borderColor,t.borderColor)}function wh(s,t,e){s.lineTo(e.x,e.y)}function kh(s){return s.stepped?wo:s.tension||s.cubicInterpolationMode==="monotone"?ko:wh}function Qa(s,t,e={}){let i=s.length,{start:n=0,end:o=i-1}=e,{start:a,end:r}=t,l=Math.max(n,a),c=Math.min(o,r),h=nr&&o>r;return{count:i,start:l,loop:t.loop,ilen:c(a+(c?r-C:C))%o,D=()=>{b!==v&&(s.lineTo(h,v),s.lineTo(h,b),s.lineTo(h,y))};for(l&&(f=n[w(0)],s.moveTo(f.x,f.y)),u=0;u<=r;++u){if(f=n[w(u)],f.skip)continue;let C=f.x,_=f.y,p=C|0;p===m?(_v&&(v=_),h=(d*h+C)/++d):(D(),s.lineTo(C,_),m=p,d=0,b=v=_),y=_}D()}function wn(s){let t=s.options,e=t.borderDash&&t.borderDash.length;return!s._decimated&&!s._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?Sh:Ch}function Eh(s){return s.stepped?Ao:s.tension||s.cubicInterpolationMode==="monotone"?Oo:se}function Mh(s,t,e,i){let n=t._path;n||(n=t._path=new Path2D,t.path(n,e,i)&&n.closePath()),qa(s,t.options),s.stroke(n)}function Dh(s,t,e,i){let{segments:n,options:o}=t,a=wn(t);for(let r of n)qa(s,o,r.style),s.beginPath(),a(s,t,r,{start:e,end:e+i-1})&&s.closePath(),s.stroke()}function Lh(s,t,e,i){Th&&!t.options.segment?Mh(s,t,e,i):Dh(s,t,e,i)}function da(s,t,e,i){let n=s.options,{[e]:o}=s.getProps([e],i);return Math.abs(t-o)tr(t++)),t}function zh(s,t){return s.backgroundColor=s.data.map(()=>er(t++)),t}function Vh(s){let t=0;return(e,i)=>{let n=s.getDatasetMeta(i).controller;n instanceof Yt?t=Bh(e,t):n instanceof de?t=zh(e,t):n&&(t=Ih(e,t))}}function fa(s){let t;for(t in s)if(s[t].borderColor||s[t].backgroundColor)return!0;return!1}function Nh(s){return s&&(s.borderColor||s.backgroundColor)}function Hh(){return ct.borderColor!=="rgba(0,0,0,0.1)"||ct.backgroundColor!=="rgba(0,0,0,0.1)"}function Wh(s,t,e,i,n){let o=n.samples||i;if(o>=e)return s.slice(t,t+e);let a=[],r=(e-2)/(o-2),l=0,c=t+e-1,h=t,d,u,f,m,b;for(a[l++]=s[h],d=0;df&&(f=m,u=s[w],b=w);a[l++]=u,h=b}return a[l++]=s[c],a}function $h(s,t,e,i){let n=0,o=0,a,r,l,c,h,d,u,f,m,b,v=[],y=t+e-1,w=s[t].x,C=s[y].x-w;for(a=t;ab&&(b=c,u=a),n=(o*n+r.x)/++o;else{let p=a-1;if(!Z(d)&&!Z(u)){let g=Math.min(d,u),x=Math.max(d,u);g!==f&&g!==p&&v.push({...s[g],x:n}),x!==f&&x!==p&&v.push({...s[x],x:n})}a>0&&p!==f&&v.push(s[p]),v.push(r),h=_,o=0,m=b=c,d=u=f=a}}return v}function ir(s){if(s._decimated){let t=s._data;delete s._decimated,delete s._data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function ga(s){s.data.datasets.forEach(t=>{ir(t)})}function jh(s,t){let e=t.length,i=0,n,{iScale:o}=s,{min:a,max:r,minDefined:l,maxDefined:c}=o.getUserBounds();return l&&(i=gt(Vt(t,o.axis,a).lo,0,e-1)),c?n=gt(Vt(t,o.axis,r).hi+1,i,e)-i:n=e-i,{start:i,count:n}}function Uh(s,t,e){let i=s.segments,n=s.points,o=t.points,a=[];for(let r of i){let{start:l,end:c}=r;c=ci(l,c,n);let h=Cn(e,n[l],n[c],r.loop);if(!t.segments){a.push({source:r,target:h,start:n[l],end:n[c]});continue}let d=en(t,h);for(let u of d){let f=Cn(e,o[u.start],o[u.end],u.loop),m=tn(r,n,f);for(let b of m)a.push({source:b,target:u,start:{[e]:pa(h,f,"start",Math.max)},end:{[e]:pa(h,f,"end",Math.min)}})}}return a}function Cn(s,t,e,i){if(i)return;let n=t[s],o=e[s];return s==="angle"&&(n=bt(n),o=bt(o)),{property:s,start:n,end:o}}function Yh(s,t){let{x:e=null,y:i=null}=s||{},n=t.points,o=[];return t.segments.forEach(({start:a,end:r})=>{r=ci(a,r,n);let l=n[a],c=n[r];i!==null?(o.push({x:l.x,y:i}),o.push({x:c.x,y:i})):e!==null&&(o.push({x:e,y:l.y}),o.push({x:e,y:c.y}))}),o}function ci(s,t,e){for(;t>s;t--){let i=e[t];if(!isNaN(i.x)&&!isNaN(i.y))break}return t}function pa(s,t,e,i){return s&&t?i(s[e],t[e]):s?s[e]:t?t[e]:0}function or(s,t){let e=[],i=!1;return rt(s)?(i=!0,e=s):e=Yh(s,t),e.length?new Rt({points:e,options:{tension:0},_loop:i,_fullLoop:i}):null}function ma(s){return s&&s.fill!==!1}function Kh(s,t,e){let n=s[t].fill,o=[t],a;if(!e)return n;for(;n!==!1&&o.indexOf(n)===-1;){if(!ht(n))return n;if(a=s[n],!a)return!1;if(a.visible)return n;o.push(n),n=a.fill}return!1}function Xh(s,t,e){let i=Jh(s);if(tt(i))return isNaN(i.value)?!1:i;let n=parseFloat(i);return ht(n)&&Math.floor(n)===n?Gh(i[0],t,n,e):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function Gh(s,t,e,i){return(s==="-"||s==="+")&&(e=t+e),e===t||e<0||e>=i?!1:e}function qh(s,t){let e=null;return s==="start"?e=t.bottom:s==="end"?e=t.top:tt(s)?e=t.getPixelForValue(s.value):t.getBasePixel&&(e=t.getBasePixel()),e}function Qh(s,t,e){let i;return s==="start"?i=e:s==="end"?i=t.options.reverse?t.min:t.max:tt(s)?i=s.value:i=t.getBaseValue(),i}function Jh(s){let t=s.options,e=t.fill,i=Q(e&&e.target,e);return i===void 0&&(i=!!t.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function Zh(s){let{scale:t,index:e,line:i}=s,n=[],o=i.segments,a=i.points,r=td(t,e);r.push(or({x:null,y:t.bottom},i));for(let l=0;lo.length>a.length?o:a)),t+e.size/2+i.measureText(n).width}function fd(s,t,e){let i=s;return typeof t.text!="string"&&(i=rr(t,e)),i}function rr(s,t){let e=s.text?s.text.length:0;return t*e}function gd(s,t){return!!((s==="mousemove"||s==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(s==="click"||s==="mouseup"))}function pd(s,t){let e=new xs({ctx:s.ctx,options:t,chart:s});yt.configure(s,e,t),yt.addBox(s,e),s.titleBlock=e}function $t(s,t){return t&&(rt(t)?Array.prototype.push.apply(s,t):s.push(t)),s}function Zt(s){return(typeof s=="string"||s instanceof String)&&s.indexOf(` `)>-1?s.split(` -`):s}function md(s,t){let{element:e,datasetIndex:i,index:n}=t,o=s.getDatasetMeta(i).controller,{label:a,value:r}=o.getLabelAndValue(n);return{chart:s,label:a,parsed:o.getParsed(n),raw:s.data.datasets[i].data[n],formattedValue:r,dataset:o.getDataset(),dataIndex:n,datasetIndex:i,element:e}}function _a(s,t){let e=s.chart.ctx,{body:i,footer:n,title:o}=s,{boxWidth:a,boxHeight:r}=t,l=ft(t.bodyFont),c=ft(t.titleFont),h=ft(t.footerFont),d=o.length,u=n.length,f=i.length,m=xt(t.padding),b=m.height,v=0,y=i.reduce((C,_)=>C+_.before.length+_.lines.length+_.after.length,0);if(y+=s.beforeBody.length+s.afterBody.length,d&&(b+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),y){let C=t.displayColors?Math.max(r,l.lineHeight):l.lineHeight;b+=f*C+(y-f)*l.lineHeight+(y-1)*t.bodySpacing}u&&(b+=t.footerMarginTop+u*h.lineHeight+(u-1)*t.footerSpacing);let w=0,D=function(C){v=Math.max(v,e.measureText(C).width+w)};return e.save(),e.font=c.string,nt(s.title,D),e.font=l.string,nt(s.beforeBody.concat(s.afterBody),D),w=t.displayColors?a+2+t.boxPadding:0,nt(i,C=>{nt(C.before,D),nt(C.lines,D),nt(C.after,D)}),w=0,e.font=h.string,nt(s.footer,D),e.restore(),v+=m.width,{width:v,height:b}}function bd(s,t){let{y:e,height:i}=t;return es.height-i/2?"bottom":"center"}function vd(s,t,e,i){let{x:n,width:o}=i,a=e.caretSize+e.caretPadding;if(s==="left"&&n+o+a>t.width||s==="right"&&n-o-a<0)return!0}function xd(s,t,e,i){let{x:n,width:o}=e,{width:a,chartArea:{left:r,right:l}}=s,c="center";return i==="center"?c=n<=(r+l)/2?"left":"right":n<=o/2?c="left":n>=a-o/2&&(c="right"),vd(c,s,t,e)&&(c="center"),c}function wa(s,t,e){let i=e.yAlign||t.yAlign||bd(s,e);return{xAlign:e.xAlign||t.xAlign||xd(s,t,e,i),yAlign:i}}function yd(s,t){let{x:e,width:i}=s;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function _d(s,t,e){let{y:i,height:n}=s;return t==="top"?i+=e:t==="bottom"?i-=n+e:i-=n/2,i}function ka(s,t,e,i){let{caretSize:n,caretPadding:o,cornerRadius:a}=s,{xAlign:r,yAlign:l}=e,c=n+o,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:f}=re(a),m=yd(t,r),b=_d(t,l,c);return l==="center"?r==="left"?m+=c:r==="right"&&(m-=c):r==="left"?m-=Math.max(h,u)+n:r==="right"&&(m+=Math.max(d,f)+n),{x:gt(m,0,i.width-t.width),y:gt(b,0,i.height-t.height)}}function Js(s,t,e){let i=xt(e.padding);return t==="center"?s.x+s.width/2:t==="right"?s.x+s.width-i.right:s.x+i.left}function Ca(s){return $t([],Zt(s))}function wd(s,t,e){return Jt(s,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Sa(s,t){let e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?s.override(e):s}function Ct(s,t,e,i){let n=s[t].call(e,i);return typeof n=="undefined"?dr[t].call(e,i):n}function Cd(s,t,e,i){let n=s.indexOf(t);if(n===-1)return kd(s,t,e,i);let o=s.lastIndexOf(t);return n!==o?e:n}function Ea(s){let t=this.getLabels();return s>=0&&sm&&(_=Pi(k*_/m/f)*f),Z(l)||(p=Math.pow(10,l),_=Math.ceil(_*p)/p),n==="ticks"?(g=Math.floor(b/_)*_,x=Math.ceil(v/_)*_):(g=b,x=v),y&&w&&o&&uo((r-a)/o,_/1e3)?(k=Math.round(Math.min((r-a)/_,h)),_=(r-a)/k,g=a,x=r):D?(g=y?a:g,x=w?r:x,k=c-1,_=(x-g)/k):(k=(x-g)/_,Be(k,Math.round(k),_/1e3)?k=Math.round(k):k=Math.ceil(k));let S=Math.max(Oi(_),Oi(g));p=Math.pow(10,Z(l)?S:l),g=Math.round(g*p)/p,x=Math.round(x*p)/p;let M=0;for(y&&(u&&g!==a?(e.push({value:a}),gr)break;e.push({value:R})}return w&&u&&x!==r?e.length&&Be(e[e.length-1].value,r,Ma(r,C,s))?e[e.length-1].value=r:e.push({value:r}):(!w||x===r)&&e.push({value:x}),e}function Ma(s,t,{horizontal:e,minRotation:i}){let n=Pt(i),o=(e?Math.sin(n):Math.cos(n))||.001,a=.75*t*(""+s).length;return Math.min(t/o,a)}function Da(s){return s/Math.pow(10,ys(s))===1}function Ta(s,t,e){let i=Math.pow(10,e),n=Math.floor(s/i);return Math.ceil(t/i)-n}function Md(s,t){let e=t-s,i=ys(e);for(;Ta(s,t,i)>10;)i++;for(;Ta(s,t,i)<10;)i--;return Math.min(i,ys(s))}function Dd(s,{min:t,max:e}){t=kt(s.min,t);let i=[],n=ys(t),o=Md(t,e),a=o<0?Math.pow(10,Math.abs(o)):1,r=Math.pow(10,o),l=n>o?Math.pow(10,n):0,c=Math.round((t-l)*a)/a,h=Math.floor((t-l)/r/10)*r*10,d=Math.floor((c-h)/Math.pow(10,o)),u=kt(s.min,Math.round((l+h+d*Math.pow(10,o))*a)/a);for(;u=10?d=d<15?15:20:d++,d>=20&&(o++,d=2,a=o>=0?1:a),u=Math.round((l+h+d*Math.pow(10,o))*a)/a;let f=kt(s.max,u);return i.push({value:f,major:Da(f),significand:d}),i}function Sn(s){let t=s.ticks;if(t.display&&s.display){let e=xt(t.backdropPadding);return Q(t.font&&t.font.size,ct.font.size)+e.height}return 0}function Td(s,t,e){return e=rt(e)?e:[e],{w:_o(s,t.string,e),h:e.length*t.lineHeight}}function La(s,t,e,i,n){return s===i||s===n?{start:t-e/2,end:t+e/2}:sn?{start:t-e,end:t}:{start:t,end:t+e}}function Ld(s){let t={l:s.left+s._padding.left,r:s.right-s._padding.right,t:s.top+s._padding.top,b:s.bottom-s._padding.bottom},e=Object.assign({},t),i=[],n=[],o=s._pointLabels.length,a=s.options.pointLabels,r=a.centerPointLabels?st/o:0;for(let l=0;lt.r&&(r=(i.end-t.r)/o,s.r=Math.max(s.r,t.r+r)),n.startt.b&&(l=(n.end-t.b)/a,s.b=Math.max(s.b,t.b+l))}function Ad(s,t,e){let i=s.drawingArea,{extra:n,additionalAngle:o,padding:a,size:r}=e,l=s.getPointPosition(t,i+n+a,o),c=Math.round(zs(bt(l.angle+ut))),h=Bd(l.y,r.h,c),d=Fd(c),u=Id(l.x,r.w,d);return{visible:!0,x:l.x,y:h,textAlign:d,left:u,top:h,right:u+r.w,bottom:h+r.h}}function Od(s,t){if(!t)return!0;let{left:e,top:i,right:n,bottom:o}=s;return!(Nt({x:e,y:i},t)||Nt({x:e,y:o},t)||Nt({x:n,y:i},t)||Nt({x:n,y:o},t))}function Rd(s,t,e){let i=[],n=s._pointLabels.length,o=s.options,{centerPointLabels:a,display:r}=o.pointLabels,l={extra:Sn(o)/2,additionalAngle:a?st/n:0},c;for(let h=0;h270||e<90)&&(s-=t),s}function zd(s,t,e){let{left:i,top:n,right:o,bottom:a}=e,{backdropColor:r}=t;if(!Z(r)){let l=re(t.borderRadius),c=xt(t.backdropPadding);s.fillStyle=r;let h=i-c.left,d=n-c.top,u=o-i+c.width,f=a-n+c.height;Object.values(l).some(m=>m!==0)?(s.beginPath(),He(s,{x:h,y:d,w:u,h:f,radius:l}),s.fill()):s.fillRect(h,d,u,f)}}function Vd(s,t){let{ctx:e,options:{pointLabels:i}}=s;for(let n=t-1;n>=0;n--){let o=s._pointLabelItems[n];if(!o.visible)continue;let a=i.setContext(s.getPointLabelContext(n));zd(e,a,o);let r=ft(a.font),{x:l,y:c,textAlign:h}=o;ae(e,s._pointLabels[n],l,c+r.lineHeight/2,r,{color:a.color,textAlign:h,textBaseline:"middle"})}}function gr(s,t,e,i){let{ctx:n}=s;if(e)n.arc(s.xCenter,s.yCenter,t,0,lt);else{let o=s.getPointPosition(0,t);n.moveTo(o.x,o.y);for(let a=1;a=Et.indexOf(e);o--){let a=Et[o];if(hi[a].common&&s._adapter.diff(n,i,a)>=t-1)return a}return Et[e?Et.indexOf(e):0]}function $d(s){for(let t=Et.indexOf(s)+1,e=Et.length;t=t?e[i]:e[n];s[o]=!0}}function jd(s,t,e,i){let n=s._adapter,o=+n.startOf(t[0].value,i),a=t[t.length-1].value,r,l;for(r=o;r<=a;r=+n.add(r,1,i))l=e[r],l>=0&&(t[l].major=!0);return t}function Fa(s,t,e){let i=[],n={},o=t.length,a,r;for(a=0;a=s[i].pos&&t<=s[n].pos&&({lo:i,hi:n}=Vt(s,"pos",t)),{pos:o,time:r}=s[i],{pos:a,time:l}=s[n]):(t>=s[i].time&&t<=s[n].time&&({lo:i,hi:n}=Vt(s,"time",t)),{time:o,pos:r}=s[i],{time:a,pos:l}=s[n]);let c=a-o;return c?r+(l-r)*(t-o)/c:r}var pn,jt,Bo,Yl,si,ms,an,Wo,ic,St,we,ke,Yt,Ce,de,je,Se,Ee,za,mn,Va,Na,Ha,yt,bs,ii,ti,Ec,qo,$a,vs,Qo,oi,Mt,$c,Jo,Zo,ge,Ue,bn,Ot,vn,na,Xa,us,_n,ch,dh,uh,ei,ca,Ut,ce,Th,Rt,Me,De,Za,kn,ua,sr,nr,ri,ar,ya,hd,li,lr,xs,cr,Qs,hr,gs,dr,ps,ur,fr,kd,Sd,Ye,qe,Ke,ys,_e,Xe,he,hi,Et,fe,Ge,pr,Ud,br=gi(()=>{Io();pn=class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,n){let o=e.listeners[n],a=e.duration;o.forEach(r=>r({chart:t,initial:e.initial,numSteps:a,currentStep:Math.min(i-e.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=Bi.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,n)=>{if(!i.running||!i.items.length)return;let o=i.items,a=o.length-1,r=!1,l;for(;a>=0;--a)l=o[a],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(t),r=!0):(o[a]=o[o.length-1],o.pop());r&&(n.draw(),this._notify(n,i,t,"progress")),o.length||(i.running=!1,this._notify(n,i,t,"complete"),i.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){let e=this._charts,i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){let e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((i,n)=>Math.max(i,n._duration),0),this._refresh())}running(t){if(!this._running)return!1;let e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){let e=this._charts.get(t);if(!e||!e.items.length)return;let i=e.items,n=i.length-1;for(;n>=0;--n)i[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}},jt=new pn,Bo="transparent",Yl={boolean(s,t,e){return e>.5?t:s},color(s,t,e){let i=Wi(s||Bo),n=i.valid&&Wi(t||Bo);return n&&n.valid?n.mix(i,e).hexString():t},number(s,t,e){return s+(t-s)*e}},si=class{constructor(t,e,i,n){let o=e[i];n=We([t.to,n,o,t.from]);let a=We([t.from,o,n]);this._active=!0,this._fn=t.fn||Yl[t.type||typeof a],this._easing=Ae[t.easing]||Ae.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=a,this._to=n,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);let n=this._target[this._prop],o=i-this._start,a=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=We([t.to,e,n,t.from]),this._from=We([t.from,n,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){let e=t-this._start,i=this._duration,n=this._prop,o=this._from,a=this._loop,r=this._to,l;if(this._active=o!==r&&(a||e1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[n]=this._fn(o,r,l)}wait(){let t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){let e=t?"res":"rej",i=this._promises||[];for(let n=0;n{let o=t[n];if(!tt(o))return;let a={};for(let r of e)a[r]=o[r];(rt(o.properties)&&o.properties||[n]).forEach(r=>{(r===n||!i.has(r))&&i.set(r,a)})})}_animateOptions(t,e){let i=e.options,n=Xl(t,i);if(!n)return[];let o=this._createAnimations(n,i);return i.$shared&&Kl(t.options.$animations,i).then(()=>{t.options=i},()=>{}),o}_createAnimations(t,e){let i=this._properties,n=[],o=t.$animations||(t.$animations={}),a=Object.keys(e),r=Date.now(),l;for(l=a.length-1;l>=0;--l){let c=a[l];if(c.charAt(0)==="$")continue;if(c==="options"){n.push(...this._animateOptions(t,e));continue}let h=e[c],d=o[c],u=i.get(c);if(d)if(u&&d.active()){d.update(u,h,r);continue}else d.cancel();if(!u||!u.duration){t[c]=h;continue}o[c]=d=new si(u,t,c,h),n.push(d)}return n}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}let i=this._createAnimations(t,e);if(i.length)return jt.add(this._chart,i),!0}};an=s=>s==="reset"||s==="none",Wo=(s,t)=>t?s:Object.assign({},s),ic=(s,t,e)=>s&&!t.hidden&&t._stacked&&{keys:Ia(e,!0),values:null},St=class{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){let t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=nn(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&ls(this._cachedMeta),this.index=t}linkScales(){let t=this.chart,e=this._cachedMeta,i=this.getDataset(),n=(d,u,f,m)=>d==="x"?u:d==="r"?m:f,o=e.xAxisID=Q(i.xAxisID,on(t,"x")),a=e.yAxisID=Q(i.yAxisID,on(t,"y")),r=e.rAxisID=Q(i.rAxisID,on(t,"r")),l=e.indexAxis,c=e.iAxisID=n(l,o,a,r),h=e.vAxisID=n(l,a,o,r);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(a),e.rScale=this.getScaleForId(r),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){let e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){let t=this._cachedMeta;this._data&&Fi(this._data,this),t._stacked&&ls(t)}_dataCheck(){let t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(tt(e)){let n=this._cachedMeta;this._data=Ql(e,n)}else if(i!==e){if(i){Fi(i,this);let n=this._cachedMeta;ls(n),n._parsed=[]}e&&Object.isExtensible(e)&&bo(e,this),this._syncList=[],this._data=e}}addElements(){let t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){let e=this._cachedMeta,i=this.getDataset(),n=!1;this._dataCheck();let o=e._stacked;e._stacked=nn(e.vScale,e),e.stack!==i.stack&&(n=!0,ls(e),e.stack=i.stack),this._resyncElements(t),(n||o!==e._stacked)&&(Ho(this,e._parsed),e._stacked=nn(e.vScale,e))}configure(){let t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){let{_cachedMeta:i,_data:n}=this,{iScale:o,_stacked:a}=i,r=o.axis,l=t===0&&e===n.length?!0:i._sorted,c=t>0&&i._parsed[t-1],h,d,u;if(this._parsing===!1)i._parsed=n,i._sorted=!0,u=n;else{rt(n[t])?u=this.parseArrayData(i,n,t,e):tt(n[t])?u=this.parseObjectData(i,n,t,e):u=this.parsePrimitiveData(i,n,t,e);let f=()=>d[r]===null||c&&d[r]b||d=0;--u)if(!m()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){let e=this._cachedMeta._parsed,i=[],n,o,a;for(n=0,o=e.length;n=0&&tthis.getContext(i,n,e),b=c.resolveNamedOptions(u,f,m,d);return b.$shared&&(b.$shared=l,o[a]=Object.freeze(Wo(b,l))),b}_resolveAnimations(t,e,i){let n=this.chart,o=this._cachedDataOpts,a=`animation-${e}`,r=o[a];if(r)return r;let l;if(n.options.animation!==!1){let h=this.chart.config,d=h.datasetAnimationScopeKeys(this._type,e),u=h.getOptionScopes(this.getDataset(),d);l=h.createResolver(u,this.getContext(t,i,e))}let c=new ms(n,l&&l.animations);return l&&l._cacheable&&(o[a]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||an(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){let i=this.resolveDataElementOptions(t,e),n=this._sharedOptions,o=this.getSharedOptions(i),a=this.includeOptions(e,o)||o!==n;return this.updateSharedOptions(o,e,i),{sharedOptions:o,includeOptions:a}}updateElement(t,e,i,n){an(n)?Object.assign(t,i):this._resolveAnimations(e,n).update(t,i)}updateSharedOptions(t,e,i){t&&!an(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,n){t.active=n;let o=this.getStyle(e,n);this._resolveAnimations(e,i,n).update(t,{options:!n&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){let e=this._data,i=this._cachedMeta.data;for(let[r,l,c]of this._syncList)this[r](l,c);this._syncList=[];let n=i.length,o=e.length,a=Math.min(o,n);a&&this.parse(0,a),o>n?this._insertElements(n,o-n,t):o{for(c.length+=e,r=c.length-1;r>=a;r--)c[r]=c[r-e]};for(l(o),r=t;rh.controller.options.grouped),o=i.options.stacked,a=[],r=this._cachedMeta.controller.getParsed(e),l=r&&r[i.axis],c=h=>{let d=h._parsed.find(f=>f[i.axis]===l),u=d&&d[h.vScale.axis];if(Z(u)||isNaN(u))return!0};for(let h of n)if(!(e!==void 0&&c(h))&&((o===!1||a.indexOf(h.stack)===-1||o===void 0&&h.stack===void 0)&&a.push(h.stack),h.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){let t=this.chart.scales,e=this.chart.options.indexAxis;return Object.keys(t).filter(i=>t[i].axis===e).shift()}_getAxis(){let t={},e=this.getFirstScaleIdForIndexAxis();for(let i of this.chart.data.datasets)t[Q(this.chart.options.indexAxis==="x"?i.xAxisID:i.yAxisID,e)]=!0;return Object.keys(t)}_getStackIndex(t,e,i){let n=this._getStacks(t,i),o=e!==void 0?n.indexOf(e):-1;return o===-1?n.length-1:o}_getRuler(){let t=this.options,e=this._cachedMeta,i=e.iScale,n=[],o,a;for(o=0,a=e.data.length;o=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:n,yScale:o}=e,a=this.getParsed(t),r=n.getLabelForValue(a.x),l=o.getLabelForValue(a.y),c=a._custom;return{label:i[t]||"",value:"("+r+", "+l+(c?", "+c:"")+")"}}update(t){let e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,n){let o=n==="reset",{iScale:a,vScale:r}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(e,n),h=a.axis,d=r.axis;for(let u=e;u+i[l];if(tt(i[t])){let{key:l="value"}=this._parsing;o=c=>+Qt(i[c],l)}let a,r;for(a=t,r=t+e;a0&&!isNaN(t)?lt*(Math.abs(t)/e):0}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=Ve(e._parsed[t],i.options.locale);return{label:n[t]||"",value:o}}getMaxBorderWidth(t){let e=0,i=this.chart,n,o,a,r,l;if(!t){for(n=0,o=i.data.datasets.length;nt!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),I(Yt,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data,{labels:{pointStyle:i,textAlign:n,color:o,useBorderRadius:a,borderRadius:r}}=t.legend.options;return e.labels.length&&e.datasets.length?e.labels.map((l,c)=>{let d=t.getDatasetMeta(0).controller.getStyle(c);return{text:l,fillStyle:d.backgroundColor,fontColor:o,hidden:!t.getDataVisibility(c),lineDash:d.borderDash,lineDashOffset:d.borderDashOffset,lineJoin:d.borderJoinStyle,lineWidth:d.borderWidth,strokeStyle:d.borderColor,textAlign:n,pointStyle:i,borderRadius:a&&(r||d.borderRadius),index:c}}):[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}});Ce=class extends St{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){let e=this._cachedMeta,{dataset:i,data:n=[],_dataset:o}=e,a=this.chart._animationsDisabled,{start:r,count:l}=Vi(e,n,a);this._drawStart=r,this._drawCount=l,Ni(e)&&(r=0,l=n.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=n;let c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(i,void 0,{animated:!a,options:c},t),this.updateElements(n,r,l,t)}updateElements(t,e,i,n){let o=n==="reset",{iScale:a,vScale:r,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:h,includeOptions:d}=this._getSharedOptions(e,n),u=a.axis,f=r.axis,{spanGaps:m,segment:b}=this.options,v=ve(m)?m:Number.POSITIVE_INFINITY,y=this.chart._animationsDisabled||o||n==="none",w=e+i,D=t.length,C=e>0&&this.getParsed(e-1);for(let _=0;_=w){g.skip=!0;continue}let x=this.getParsed(_),k=Z(x[f]),S=g[u]=a.getPixelForValue(x[u],_),M=g[f]=o||k?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,x,l):x[f],_);g.skip=isNaN(S)||isNaN(M)||k,g.stop=_>0&&Math.abs(x[u]-C[u])>v,b&&(g.parsed=x,g.raw=c.data[_]),d&&(g.options=h||this.resolveDataElementOptions(_,p.active?"active":n)),y||this.updateElement(p,_,g,n),C=x}}getMaxOverflow(){let t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,n=t.data||[];if(!n.length)return i;let o=n[0].size(this.resolveDataElementOptions(0)),a=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(i,o,a)/2}draw(){let t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}};I(Ce,"id","line"),I(Ce,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),I(Ce,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});de=class extends St{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=Ve(e._parsed[t].r,i.options.locale);return{label:n[t]||"",value:o}}parseObjectData(t,e,i,n){return Gi.bind(this)(t,e,i,n)}update(t){let e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){let t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((i,n)=>{let o=this.getParsed(n).r;!isNaN(o)&&this.chart.getDataVisibility(n)&&(oe.max&&(e.max=o))}),e}_updateRadius(){let t=this.chart,e=t.chartArea,i=t.options,n=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(n/2,0),a=Math.max(i.cutoutPercentage?o/100*i.cutoutPercentage:1,0),r=(o-a)/t.getVisibleDatasetCount();this.outerRadius=o-r*this.index,this.innerRadius=this.outerRadius-r}updateElements(t,e,i,n){let o=n==="reset",a=this.chart,l=a.options.animation,c=this._cachedMeta.rScale,h=c.xCenter,d=c.yCenter,u=c.getIndexAngle(0)-.5*st,f=u,m,b=360/this.countVisibleElements();for(m=0;m{!isNaN(this.getParsed(n).r)&&this.chart.getDataVisibility(n)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?Pt(this.resolveDataElementOptions(t,e).angle||i):0}};I(de,"id","polarArea"),I(de,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),I(de,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data;if(e.labels.length&&e.datasets.length){let{labels:{pointStyle:i,color:n}}=t.legend.options;return e.labels.map((o,a)=>{let l=t.getDatasetMeta(0).controller.getStyle(a);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:n,lineWidth:l.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}});je=class extends Yt{};I(je,"id","pie"),I(je,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});Se=class extends St{getLabelAndValue(t){let e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,n){return Gi.bind(this)(t,e,i,n)}update(t){let e=this._cachedMeta,i=e.dataset,n=e.data||[],o=e.iScale.getLabels();if(i.points=n,t!=="resize"){let a=this.resolveDatasetElementOptions(t);this.options.showLine||(a.borderWidth=0);let r={_loop:!0,_fullLoop:o.length===n.length,options:a};this.updateElement(i,void 0,r,t)}this.updateElements(n,0,n.length,t)}updateElements(t,e,i,n){let o=this._cachedMeta.rScale,a=n==="reset";for(let r=e;r0&&this.getParsed(e-1);for(let C=e;C0&&Math.abs(p[f]-D[f])>y,v&&(g.parsed=p,g.raw=c.data[C]),u&&(g.options=d||this.resolveDataElementOptions(C,_.active?"active":n)),w||this.updateElement(_,C,g,n),D=p}this.updateSharedOptions(d,n,h)}getMaxOverflow(){let t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let r=0;for(let l=e.length-1;l>=0;--l)r=Math.max(r,e[l].size(this.resolveDataElementOptions(l))/2);return r>0&&r}let i=t.dataset,n=i.options&&i.options.borderWidth||0;if(!e.length)return n;let o=e[0].size(this.resolveDataElementOptions(0)),a=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(n,o,a)/2}};I(Ee,"id","scatter"),I(Ee,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),I(Ee,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}});za=Object.freeze({__proto__:null,BarController:we,BubbleController:ke,DoughnutController:Yt,LineController:Ce,PieController:je,PolarAreaController:de,RadarController:Se,ScatterController:Ee});mn=class s{constructor(t){I(this,"options");this.options=t||{}}static override(t){Object.assign(s.prototype,t)}init(){}formats(){return ye()}parse(){return ye()}format(){return ye()}add(){return ye()}diff(){return ye()}startOf(){return ye()}endOf(){return ye()}},Va={_date:mn};Na={evaluateInteractionItems:_s,modes:{index(s,t,e,i){let n=le(t,s),o=e.axis||"x",a=e.includeInvisible||!1,r=e.intersect?ln(s,n,o,i,a):cn(s,n,o,!1,i,a),l=[];return r.length?(s.getSortedVisibleDatasetMetas().forEach(c=>{let h=r[0].index,d=c.data[h];d&&!d.skip&&l.push({element:d,datasetIndex:c.index,index:h})}),l):[]},dataset(s,t,e,i){let n=le(t,s),o=e.axis||"xy",a=e.includeInvisible||!1,r=e.intersect?ln(s,n,o,i,a):cn(s,n,o,!1,i,a);if(r.length>0){let l=r[0].datasetIndex,c=s.getDatasetMeta(l).data;r=[];for(let h=0;h{typeof b.beforeLayout=="function"&&b.beforeLayout()});let h=l.reduce((b,v)=>v.box.options&&v.box.options.display===!1?b:b+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:e,padding:n,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/h,hBoxMaxHeight:a/2}),u=Object.assign({},n);Wa(u,xt(i));let f=Object.assign({maxPadding:u,w:o,h:a,x:n.left,y:n.top},n),m=_c(l.concat(c),d);fs(r.fullSize,f,d,m),fs(l,f,d,m),fs(c,f,d,m)&&fs(l,f,d,m),Cc(f),Go(r.leftAndTop,f,d,m),f.x+=f.w,f.y+=f.h,Go(r.rightAndBottom,f,d,m),s.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},nt(r.chartArea,b=>{let v=b.box;Object.assign(v,s.chartArea),v.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}},bs=class{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,n){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,n?Math.floor(e/n):i)}}isAttached(t){return!0}updateConfig(t){}},ii=class extends bs{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}},ti="$chartjs",Ec={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},qo=s=>s===null||s==="";$a=Po?{passive:!0}:!1;vs=new Map,Qo=0;oi=class extends bs{acquireContext(t,e){let i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(Mc(t,e),i):null}releaseContext(t){let e=t.canvas;if(!e[ti])return!1;let i=e[ti].initial;["height","width"].forEach(o=>{let a=i[o];Z(a)?e.removeAttribute(o):e.setAttribute(o,a)});let n=i.style||{};return Object.keys(n).forEach(o=>{e.style[o]=n[o]}),e.width=e.width,delete e[ti],!0}addEventListener(t,e,i){this.removeEventListener(t,e);let n=t.$proxies||(t.$proxies={}),a={attach:Pc,detach:Ac,resize:Fc}[e]||Ic;n[e]=a(t,e,i)}removeEventListener(t,e){let i=t.$proxies||(t.$proxies={}),n=i[e];if(!n)return;({attach:hn,detach:hn,resize:hn}[e]||Tc)(t,e,n),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,n){return Lo(t,e,i,n)}isAttached(t){let e=t&&Ys(t);return!!(e&&e.isConnected)}};Mt=class{constructor(){I(this,"x");I(this,"y");I(this,"active",!1);I(this,"options");I(this,"$animations")}tooltipPosition(t){let{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return ve(this.x)&&ve(this.y)}getProps(t,e){let i=this.$animations;if(!e||!i)return this;let n={};return t.forEach(o=>{n[o]=i[o]&&i[o].active()?i[o]._to:this[o]}),n}};I(Mt,"defaults",{}),I(Mt,"defaultRoutes");$c=s=>s==="left"?"right":s==="right"?"left":s,Jo=(s,t,e)=>t==="top"||t==="left"?s[t]+e:s[t]-e,Zo=(s,t)=>Math.min(t||s,s);ge=class s extends Mt{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.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(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:n}=this;return t=kt(t,Number.POSITIVE_INFINITY),e=kt(e,Number.NEGATIVE_INFINITY),i=kt(i,Number.POSITIVE_INFINITY),n=kt(n,Number.NEGATIVE_INFINITY),{min:kt(t,i),max:kt(e,n),minDefined:ht(t),maxDefined:ht(e)}}getMinMax(t){let{min:e,max:i,minDefined:n,maxDefined:o}=this.getUserBounds(),a;if(n&&o)return{min:e,max:i};let r=this.getMatchingVisibleMetas();for(let l=0,c=r.length;li?i:e,i=n&&e>i?e:i,{min:kt(e,kt(i,e)),max:kt(i,kt(e,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){ot(this.options.beforeUpdate,[this])}update(t,e,i){let{beginAtZero:n,grace:o,ticks:a}=this.options,r=a.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=Co(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let l=r=o||i<=1||!this.isHorizontal()){this.labelRotation=n;return}let h=this._getLabelSizes(),d=h.widest.width,u=h.highest.height,f=gt(this.chart.width-d,0,this.maxWidth);r=t.offset?this.maxWidth/i:f/(i-1),d+6>r&&(r=f/(i-(t.offset?.5:1)),l=this.maxHeight-ds(t.grid)-e.padding-ea(t.title,this.chart.options.font),c=Math.sqrt(d*d+u*u),a=zs(Math.min(Math.asin(gt((h.highest.height+6)/r,-1,1)),Math.asin(gt(l/c,-1,1))-Math.asin(gt(u/c,-1,1)))),a=Math.max(n,Math.min(o,a))),this.labelRotation=a}afterCalculateLabelRotation(){ot(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){ot(this.options.beforeFit,[this])}fit(){let t={width:0,height:0},{chart:e,options:{ticks:i,title:n,grid:o}}=this,a=this._isVisible(),r=this.isHorizontal();if(a){let l=ea(n,e.options.font);if(r?(t.width=this.maxWidth,t.height=ds(o)+l):(t.height=this.maxHeight,t.width=ds(o)+l),i.display&&this.ticks.length){let{first:c,last:h,widest:d,highest:u}=this._getLabelSizes(),f=i.padding*2,m=Pt(this.labelRotation),b=Math.cos(m),v=Math.sin(m);if(r){let y=i.mirror?0:v*d.width+b*u.height;t.height=Math.min(this.maxHeight,t.height+y+f)}else{let y=i.mirror?0:b*d.width+v*u.height;t.width=Math.min(this.maxWidth,t.width+y+f)}this._calculatePadding(c,h,v,b)}}this._handleMargins(),r?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,n){let{ticks:{align:o,padding:a},position:r}=this.options,l=this.labelRotation!==0,c=r!=="top"&&this.axis==="x";if(this.isHorizontal()){let h=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1),u=0,f=0;l?c?(u=n*t.width,f=i*e.height):(u=i*t.height,f=n*e.width):o==="start"?f=e.width:o==="end"?u=t.width:o!=="inner"&&(u=t.width/2,f=e.width/2),this.paddingLeft=Math.max((u-h+a)*this.width/(this.width-h),0),this.paddingRight=Math.max((f-d+a)*this.width/(this.width-d),0)}else{let h=e.height/2,d=t.height/2;o==="start"?(h=0,d=t.height):o==="end"&&(h=e.height,d=0),this.paddingTop=h+a,this.paddingBottom=d+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(){ot(this.options.afterFit,[this])}isHorizontal(){let{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,i;for(e=0,i=t.length;e({width:a[k]||0,height:r[k]||0});return{first:x(0),last:x(e-1),widest:x(p),highest:x(g),widths:a,heights:r}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){let e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);let e=this._startPixel+t*this._length;return fo(this._alignToPixels?oe(this.chart,e,0):e)}getDecimalForPixel(t){let e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){let e=this.ticks||[];if(t>=0&&tr*n?r/i:l/n:l*n0}_computeGridLineItems(t){let e=this.axis,i=this.chart,n=this.options,{grid:o,position:a,border:r}=n,l=o.offset,c=this.isHorizontal(),d=this.ticks.length+(l?1:0),u=ds(o),f=[],m=r.setContext(this.getContext()),b=m.display?m.width:0,v=b/2,y=function(z){return oe(i,z,b)},w,D,C,_,p,g,x,k,S,M,R,K;if(a==="top")w=y(this.bottom),g=this.bottom-u,k=w-v,M=y(t.top)+v,K=t.bottom;else if(a==="bottom")w=y(this.top),M=t.top,K=y(t.bottom)-v,g=w+v,k=this.top+u;else if(a==="left")w=y(this.right),p=this.right-u,x=w-v,S=y(t.left)+v,R=t.right;else if(a==="right")w=y(this.left),S=t.left,R=y(t.right)-v,p=w+v,x=this.left+u;else if(e==="x"){if(a==="center")w=y((t.top+t.bottom)/2+.5);else if(tt(a)){let z=Object.keys(a)[0],O=a[z];w=y(this.chart.scales[z].getPixelForValue(O))}M=t.top,K=t.bottom,g=w+v,k=g+u}else if(e==="y"){if(a==="center")w=y((t.left+t.right)/2);else if(tt(a)){let z=Object.keys(a)[0],O=a[z];w=y(this.chart.scales[z].getPixelForValue(O))}p=w-v,x=p-u,S=t.left,R=t.right}let B=Q(n.ticks.maxTicksLimit,d),P=Math.max(1,Math.ceil(d/B));for(D=0;D0&&(T-=H/2);break}E={left:T,top:U,width:H+$.width,height:N+$.height,color:P.backdropColor}}v.push({label:C,font:k,textOffset:R,options:{rotation:b,color:O,strokeColor:G,strokeWidth:V,textAlign:j,textBaseline:K,translation:[_,p],backdrop:E}})}return v}_getXAxisLabelAlignment(){let{position:t,ticks:e}=this.options;if(-Pt(this.labelRotation))return t==="top"?"left":"right";let n="center";return e.align==="start"?n="left":e.align==="end"?n="right":e.align==="inner"&&(n="inner"),n}_getYAxisLabelAlignment(t){let{position:e,ticks:{crossAlign:i,mirror:n,padding:o}}=this.options,a=this._getLabelSizes(),r=t+o,l=a.widest.width,c,h;return e==="left"?n?(h=this.right+o,i==="near"?c="left":i==="center"?(c="center",h+=l/2):(c="right",h+=l)):(h=this.right-r,i==="near"?c="right":i==="center"?(c="center",h-=l/2):(c="left",h=this.left)):e==="right"?n?(h=this.left+o,i==="near"?c="right":i==="center"?(c="center",h-=l/2):(c="left",h-=l)):(h=this.left+r,i==="near"?c="left":i==="center"?(c="center",h+=l/2):(c="right",h=this.right)):c="right",{textAlign:c,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;let t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){let{ctx:t,options:{backgroundColor:e},left:i,top:n,width:o,height:a}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,n,o,a),t.restore())}getLineWidthForValue(t){let e=this.options.grid;if(!this._isVisible()||!e.display)return 0;let n=this.ticks.findIndex(o=>o.value===t);return n>=0?e.setContext(this.getContext(n)).lineWidth:0}drawGrid(t){let e=this.options.grid,i=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t)),o,a,r=(l,c,h)=>{!h.width||!h.color||(i.save(),i.lineWidth=h.width,i.strokeStyle=h.color,i.setLineDash(h.borderDash||[]),i.lineDashOffset=h.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(e.display)for(o=0,a=n.length;o{this.draw(o)}}]:[{z:i,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){let e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",n=[],o,a;for(o=0,a=e.length;o{let o=i||this._getRegistryForType(n);i||o.isForType(n)||o===this.plugins&&n.id?this._exec(t,o,n):nt(n,a=>{let r=i||this._getRegistryForType(a);this._exec(t,r,a)})})}_exec(t,e,i){let n=Bs(t);ot(i["before"+n],[],i),e[t](i),ot(i["after"+n],[],i)}_getRegistryForType(t){for(let e=0;eo.filter(r=>!a.some(l=>r.plugin.id===l.plugin.id));this._notify(n(e,i),t,"stop"),this._notify(n(i,e),t,"start")}};na=new Map,Xa=new Set;us=(s,t,e)=>{let i=Qt(t,e);i!==void 0&&s.add(i)},_n=class{constructor(t){this._config=lh(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Ka(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){let t=this._config;this.clearCache(),Ya(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return qs(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return qs(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return qs(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){let e=t.id,i=this.type;return qs(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){let i=this._scopeCache,n=i.get(t);return(!n||e)&&(n=new Map,i.set(t,n)),n}getOptionScopes(t,e,i){let{options:n,type:o}=this,a=this._cachedScopes(t,i),r=a.get(e);if(r)return r;let l=new Set;e.forEach(h=>{t&&(l.add(t),h.forEach(d=>us(l,t,d))),h.forEach(d=>us(l,n,d)),h.forEach(d=>us(l,ne[o]||{},d)),h.forEach(d=>us(l,ct,d)),h.forEach(d=>us(l,Hs,d))});let c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Xa.has(e)&&a.set(e,c),c}chartOptionScopes(){let{options:t,type:e}=this;return[t,ne[e]||{},ct.datasets[e]||{},{type:e},ct,Hs]}resolveNamedOptions(t,e,i,n=[""]){let o={$shared:!0},{resolver:a,subPrefixes:r}=oa(this._resolverCache,t,n),l=a;if(hh(a,e)){o.$shared=!1,i=Gt(i)?i():i;let c=this.createResolver(t,i,r);l=be(a,i,c)}for(let c of e)o[c]=l[c];return o}createResolver(t,e,i=[""],n){let{resolver:o}=oa(this._resolverCache,t,i);return tt(e)?be(o,e,void 0,n):o}};ch=s=>tt(s)&&Object.getOwnPropertyNames(s).some(t=>Gt(s[t]));dh="4.5.1",uh=["top","bottom","left","right","chartArea"];ei={},ca=s=>{let t=Ga(s);return Object.values(ei).filter(e=>e.canvas===t).pop()};Ut=class{static register(...t){Ot.add(...t),ha()}static unregister(...t){Ot.remove(...t),ha()}constructor(t,e){let i=this.config=new _n(e),n=Ga(t),o=ca(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");let a=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||Ua(n)),this.platform.updateConfig(i);let r=this.platform.acquireContext(n,a.aspectRatio),l=r&&r.canvas,c=l&&l.height,h=l&&l.width;if(this.id=ao(),this.ctx=r,this.canvas=l,this.width=h,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 vn,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=vo(d=>this.update(d),a.resizeDelay||0),this._dataChanges=[],ei[this.id]=this,!r||!l){console.error("Failed to create chart: can't acquire context from the given item");return}jt.listen(this,"complete",la),jt.listen(this,"progress",fh),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:n,_aspectRatio:o}=this;return Z(t)?e&&o?o:n?i/n:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return Ot}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():qi(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return $i(this.canvas,this.ctx),this}stop(){return jt.stop(this),this}resize(t,e){jt.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){let i=this.options,n=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(n,t,e,o),r=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,qi(this,r,!0)&&(this.notifyPlugins("resize",{size:a}),ot(i.onResize,[this,a],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){let e=this.options.scales||{};nt(e,(i,n)=>{i.id=n})}buildOrUpdateScales(){let t=this.options,e=t.scales,i=this.scales,n=Object.keys(i).reduce((a,r)=>(a[r]=!1,a),{}),o=[];e&&(o=o.concat(Object.keys(e).map(a=>{let r=e[a],l=yn(a,r),c=l==="r",h=l==="x";return{options:r,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),nt(o,a=>{let r=a.options,l=r.id,c=yn(l,r),h=Q(r.type,a.dtype);(r.position===void 0||aa(r.position,c)!==aa(a.dposition))&&(r.position=a.dposition),n[l]=!0;let d=null;if(l in i&&i[l].type===h)d=i[l];else{let u=Ot.getScale(h);d=new u({id:l,type:h,ctx:this.ctx,chart:this}),i[d.id]=d}d.init(r,t)}),nt(n,(a,r)=>{a||delete i[r]}),nt(i,a=>{yt.configure(this,a,a.options),yt.addBox(this,a)})}_updateMetasets(){let t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((n,o)=>n.index-o.index),i>e){for(let n=e;ne.length&&delete this._stacks,t.forEach((i,n)=>{e.filter(o=>o===i._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){let t=[],e=this.data.datasets,i,n;for(this._removeUnreferencedMetasets(),i=0,n=e.length;i{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){let e=this.config;e.update();let i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),n=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;let o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let c=0,h=this.data.datasets.length;c{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(ra("z","_idx"));let{_active:r,_lastEvent:l}=this;l?this._eventHandler(l,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){nt(this.scales,t=>{yt.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!Li(e,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(let{method:i,start:n,count:o}of e){let a=i==="_removeElements"?-o:o;gh(t,n,a)}}_getUniformDataChanges(){let t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];let e=this.data.datasets.length,i=o=>new Set(t.filter(a=>a[0]===o).map((a,r)=>r+","+a.splice(1).join(","))),n=i(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;yt.update(this,this.width,this.height,t);let e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],nt(this.boxes,n=>{i&&n.position==="chartArea"||(n.configure&&n.configure(),this._layers.push(...n._layers()))},this),this._layers.forEach((n,o)=>{n._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,i=this.data.datasets.length;e=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){let e=this.ctx,i={meta:t,index:t.index,cancelable:!0},n=sn(this,t);this.notifyPlugins("beforeDatasetDraw",i)!==!1&&(n&&as(e,n),t.controller.draw(),n&&rs(e),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(t){return Nt(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,n){let o=Na.modes[e];return typeof o=="function"?o(this,t,i,n):[]}getDatasetMeta(t){let e=this.data.datasets[t],i=this._metasets,n=i.filter(o=>o&&o._dataset===e).pop();return n||(n={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(n)),n}getContext(){return this.$context||(this.$context=Jt(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){let e=this.data.datasets[t];if(!e)return!1;let i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!e.hidden}setDatasetVisibility(t,e){let i=this.getDatasetMeta(t);i.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){let n=i?"show":"hide",o=this.getDatasetMeta(t),a=o.controller._resolveAnimations(void 0,n);Ie(e)?(o.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),a.update(o,{visible:i}),this.update(r=>r.datasetIndex===t?n:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){let e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),jt.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,o,a),t[o]=a},n=(o,a,r)=>{o.offsetX=a,o.offsetY=r,this._eventHandler(o)};nt(this.options.events,o=>i(o,n))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});let t=this._responsiveListeners,e=this.platform,i=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},n=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)},a,r=()=>{n("attach",r),this.attached=!0,this.resize(),i("resize",o),i("detach",a)};a=()=>{this.attached=!1,n("resize",o),this._stop(),this._resize(0,0),i("attach",r)},e.isAttached(this.canvas)?r():a()}unbindEvents(){nt(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},nt(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){let n=i?"set":"remove",o,a,r,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+n+"DatasetHoverStyle"]()),r=0,l=t.length;r{let r=this.getDatasetMeta(o);if(!r)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:r.data[a],index:a}});!os(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,i){let n=this.options.hover,o=(l,c)=>l.filter(h=>!c.some(d=>h.datasetIndex===d.datasetIndex&&h.index===d.index)),a=o(e,t),r=i?t:o(t,e);a.length&&this.updateHoverStyle(a,n.mode,!1),r.length&&n.mode&&this.updateHoverStyle(r,n.mode,!0)}_eventHandler(t,e){let i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},n=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,n)===!1)return;let o=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,n),(o||i.changed)&&this.render(),this}_handleEvent(t,e,i){let{_active:n=[],options:o}=this,a=e,r=this._getActiveElements(t,n,i,a),l=co(t),c=ph(t,this._lastEvent,i,l);i&&(this._lastEvent=null,ot(o.onHover,[t,r,this],this),l&&ot(o.onClick,[t,r,this],this));let h=!os(r,n);return(h||e)&&(this._active=r,this._updateHoverStyles(r,n,e)),this._lastEvent=c,h}_getActiveElements(t,e,i,n){if(t.type==="mouseout")return[];if(!i)return e;let o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,n)}};I(Ut,"defaults",ct),I(Ut,"instances",ei),I(Ut,"overrides",ne),I(Ut,"registry",Ot),I(Ut,"version",dh),I(Ut,"getChart",ca);ce=class extends Mt{constructor(e){super();I(this,"circumference");I(this,"endAngle");I(this,"fullCircles");I(this,"innerRadius");I(this,"outerRadius");I(this,"pixelMargin");I(this,"startAngle");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,i,n){let o=this.getProps(["x","y"],n),{angle:a,distance:r}=Ri(o,{x:e,y:i}),{startAngle:l,endAngle:c,innerRadius:h,outerRadius:d,circumference:u}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],n),f=(this.options.spacing+this.options.borderWidth)/2,m=Q(u,c-l),b=ze(a,l,c)&&l!==c,v=m>=lt||b,y=Wt(r,h+f,d+f);return v&&y}getCenterPoint(e){let{x:i,y:n,startAngle:o,endAngle:a,innerRadius:r,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:c,spacing:h}=this.options,d=(o+a)/2,u=(r+l+h+c)/2;return{x:i+Math.cos(d)*u,y:n+Math.sin(d)*u}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){let{options:i,circumference:n}=this,o=(i.offset||0)/4,a=(i.spacing||0)/2,r=i.circular;if(this.pixelMargin=i.borderAlign==="inner"?.33:0,this.fullCircles=n>lt?Math.floor(n/lt):0,n===0||this.innerRadius<0||this.outerRadius<0)return;e.save();let l=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(l)*o,Math.sin(l)*o);let c=1-Math.sin(Math.min(st,n||0)),h=o*c;e.fillStyle=i.backgroundColor,e.strokeStyle=i.borderColor,yh(e,this,h,a,r),_h(e,this,h,a,r),e.restore()}};I(ce,"id","arc"),I(ce,"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}),I(ce,"defaultRoutes",{backgroundColor:"backgroundColor"}),I(ce,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"});Th=typeof Path2D=="function";Rt=class extends Mt{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){let i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){let n=i.spanGaps?this._loop:this._fullLoop;To(this._points,i,t,n,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Fo(this,this.options.segment))}first(){let t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){let t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){let i=this.options,n=t[e],o=this.points,a=en(this,{property:e,start:n,end:n});if(!a.length)return;let r=[],l=Eh(i),c,h;for(c=0,h=a.length;ct!=="borderDash"&&t!=="fill"});Me=class extends Mt{constructor(e){super();I(this,"parsed");I(this,"skip");I(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,e&&Object.assign(this,e)}inRange(e,i,n){let o=this.options,{x:a,y:r}=this.getProps(["x","y"],n);return Math.pow(e-a,2)+Math.pow(i-r,2)s.replace("rgb(","rgba(").replace(")",", 0.5)"));sr={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(s,t,e){if(!e.enabled)return;let{data:{datasets:i},options:n}=s.config,{elements:o}=n,a=fa(i)||Nh(n)||o&&fa(o)||Hh();if(!e.forceOverride&&a)return;let r=Vh(s);i.forEach(r)}};nr={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(s,t,e)=>{if(!e.enabled){ga(s);return}let i=s.width;s.data.datasets.forEach((n,o)=>{let{_data:a,indexAxis:r}=n,l=s.getDatasetMeta(o),c=a||n.data;if(We([r,s.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;let h=s.scales[l.xAxisID];if(h.type!=="linear"&&h.type!=="time"||s.options.parsing)return;let{start:d,count:u}=jh(l,c),f=e.threshold||4*i;if(u<=f){ir(n);return}Z(a)&&(n._data=c,delete n.data,Object.defineProperty(n,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(b){this._data=b}}));let m;switch(e.algorithm){case"lttb":m=Wh(c,d,u,i,e);break;case"min-max":m=$h(c,d,u,i);break;default:throw new Error(`Unsupported decimation algorithm '${e.algorithm}'`)}n._decimated=m})},destroy(s){ga(s)}};ri=class{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){let{x:n,y:o,radius:a}=this;return e=e||{start:0,end:lt},t.arc(n,o,a,e.end,e.start,!0),!i.bounds}interpolate(t){let{x:e,y:i,radius:n}=this,o=t.angle;return{x:e+Math.cos(o)*n,y:i+Math.sin(o)*n,angle:o}}};ar={id:"filler",afterDatasetsUpdate(s,t,e){let i=(s.data.datasets||[]).length,n=[],o,a,r,l;for(a=0;a=0;--a){let r=n[a].$filler;r&&(r.line.updateControlPoints(o,r.axis),i&&r.fill&&fn(s.ctx,r,o))}},beforeDatasetsDraw(s,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;let i=s.getSortedVisibleDatasetMetas();for(let n=i.length-1;n>=0;--n){let o=i[n].$filler;ma(o)&&fn(s.ctx,o,s.chartArea)}},beforeDatasetDraw(s,t,e){let i=t.meta.$filler;!ma(i)||e.drawTime!=="beforeDatasetDraw"||fn(s.ctx,i,s.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}},ya=(s,t)=>{let{boxHeight:e=t,boxWidth:i=t}=s;return s.usePointStyle&&(e=Math.min(e,t),i=s.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:e,itemHeight:Math.max(t,e)}},hd=(s,t)=>s!==null&&t!==null&&s.datasetIndex===t.datasetIndex&&s.index===t.index,li=class extends Mt{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){let t=this.options.labels||{},e=ot(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(i=>t.filter(i,this.chart.data))),t.sort&&(e=e.sort((i,n)=>t.sort(i,n,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){let{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}let i=t.labels,n=ft(i.font),o=n.size,a=this._computeTitleHeight(),{boxWidth:r,itemHeight:l}=ya(i,o),c,h;e.font=n.string,this.isHorizontal()?(c=this.maxWidth,h=this._fitRows(a,o,r,l)+10):(h=this.maxHeight,c=this._fitCols(a,n,r,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,n){let{ctx:o,maxWidth:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],h=n+r,d=t;o.textAlign="left",o.textBaseline="middle";let u=-1,f=-h;return this.legendItems.forEach((m,b)=>{let v=i+e/2+o.measureText(m.text).width;(b===0||c[c.length-1]+v+2*r>a)&&(d+=h,c[c.length-(b>0?0:1)]=0,f+=h,u++),l[b]={left:0,top:f,row:u,width:v,height:n},c[c.length-1]+=v+r}),d}_fitCols(t,e,i,n){let{ctx:o,maxHeight:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],h=a-t,d=r,u=0,f=0,m=0,b=0;return this.legendItems.forEach((v,y)=>{let{itemWidth:w,itemHeight:D}=dd(i,e,o,v,n);y>0&&f+D+2*r>h&&(d+=u+r,c.push({width:u,height:f}),m+=u+r,b++,u=f=0),l[y]={left:m,top:f,col:b,width:w,height:D},u=Math.max(u,w),f+=D+r}),d+=u,c.push({width:u,height:f}),d}adjustHitBoxes(){if(!this.options.display)return;let t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:n},rtl:o}}=this,a=xe(o,this.left,this.width);if(this.isHorizontal()){let r=0,l=vt(i,this.left+n,this.right-this.lineWidths[r]);for(let c of e)r!==c.row&&(r=c.row,l=vt(i,this.left+n,this.right-this.lineWidths[r])),c.top+=this.top+t+n,c.left=a.leftForLtr(a.x(l),c.width),l+=c.width+n}else{let r=0,l=vt(i,this.top+t+n,this.bottom-this.columnSizes[r].height);for(let c of e)c.col!==r&&(r=c.col,l=vt(i,this.top+t+n,this.bottom-this.columnSizes[r].height)),c.top=l,c.left+=this.left+n,c.left=a.leftForLtr(a.x(c.left),c.width),l+=c.height+n}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){let t=this.ctx;as(t,this),this._draw(),rs(t)}}_draw(){let{options:t,columnSizes:e,lineWidths:i,ctx:n}=this,{align:o,labels:a}=t,r=ct.color,l=xe(t.rtl,this.left,this.width),c=ft(a.font),{padding:h}=a,d=c.size,u=d/2,f;this.drawTitle(),n.textAlign=l.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=c.string;let{boxWidth:m,boxHeight:b,itemHeight:v}=ya(a,d),y=function(p,g,x){if(isNaN(m)||m<=0||isNaN(b)||b<0)return;n.save();let k=Q(x.lineWidth,1);if(n.fillStyle=Q(x.fillStyle,r),n.lineCap=Q(x.lineCap,"butt"),n.lineDashOffset=Q(x.lineDashOffset,0),n.lineJoin=Q(x.lineJoin,"miter"),n.lineWidth=k,n.strokeStyle=Q(x.strokeStyle,r),n.setLineDash(Q(x.lineDash,[])),a.usePointStyle){let S={radius:b*Math.SQRT2/2,pointStyle:x.pointStyle,rotation:x.rotation,borderWidth:k},M=l.xPlus(p,m/2),R=g+u;ji(n,S,M,R,a.pointStyleWidth&&m)}else{let S=g+Math.max((d-b)/2,0),M=l.leftForLtr(p,m),R=re(x.borderRadius);n.beginPath(),Object.values(R).some(K=>K!==0)?He(n,{x:M,y:S,w:m,h:b,radius:R}):n.rect(M,S,m,b),n.fill(),k!==0&&n.stroke()}n.restore()},w=function(p,g,x){ae(n,x.text,p,g+v/2,c,{strikethrough:x.hidden,textAlign:l.textAlign(x.textAlign)})},D=this.isHorizontal(),C=this._computeTitleHeight();D?f={x:vt(o,this.left+h,this.right-i[0]),y:this.top+h+C,line:0}:f={x:this.left+h,y:vt(o,this.top+C+h,this.bottom-e[0].height),line:0},Ji(this.ctx,t.textDirection);let _=v+h;this.legendItems.forEach((p,g)=>{n.strokeStyle=p.fontColor,n.fillStyle=p.fontColor;let x=n.measureText(p.text).width,k=l.textAlign(p.textAlign||(p.textAlign=a.textAlign)),S=m+u+x,M=f.x,R=f.y;l.setWidth(this.width),D?g>0&&M+S+h>this.right&&(R=f.y+=_,f.line++,M=f.x=vt(o,this.left+h,this.right-i[f.line])):g>0&&R+_>this.bottom&&(M=f.x=M+e[f.line].width+h,f.line++,R=f.y=vt(o,this.top+C+h,this.bottom-e[f.line].height));let K=l.x(M);if(y(K,R,p),M=xo(k,M+m+u,D?M+S:this.right,t.rtl),w(l.x(M),R,p),D)f.x+=S+h;else if(typeof p.text!="string"){let B=c.lineHeight;f.y+=rr(p,B)+h}else f.y+=_}),Zi(this.ctx,t.textDirection)}drawTitle(){let t=this.options,e=t.title,i=ft(e.font),n=xt(e.padding);if(!e.display)return;let o=xe(t.rtl,this.left,this.width),a=this.ctx,r=e.position,l=i.size/2,c=n.top+l,h,d=this.left,u=this.width;if(this.isHorizontal())u=Math.max(...this.lineWidths),h=this.top+c,d=vt(t.align,d,this.right-u);else{let m=this.columnSizes.reduce((b,v)=>Math.max(b,v.height),0);h=c+vt(t.align,this.top,this.bottom-m-t.labels.padding-this._computeTitleHeight())}let f=vt(r,d,d+u);a.textAlign=o.textAlign(Ns(r)),a.textBaseline="middle",a.strokeStyle=e.color,a.fillStyle=e.color,a.font=i.string,ae(a,e.text,f,h,i)}_computeTitleHeight(){let t=this.options.title,e=ft(t.font),i=xt(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,n,o;if(Wt(t,this.left,this.right)&&Wt(e,this.top,this.bottom)){for(o=this.legendHitBoxes,i=0;is.chart.options.color,boxWidth:40,padding:10,generateLabels(s){let t=s.data.datasets,{labels:{usePointStyle:e,pointStyle:i,textAlign:n,color:o,useBorderRadius:a,borderRadius:r}}=s.legend.options;return s._getSortedDatasetMetas().map(l=>{let c=l.controller.getStyle(e?0:void 0),h=xt(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:c.borderColor,pointStyle:i||c.pointStyle,rotation:c.rotation,textAlign:n||c.textAlign,borderRadius:a&&(r||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:s=>s.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:s=>!s.startsWith("on"),labels:{_scriptable:s=>!["generateLabels","filter","sort"].includes(s)}}},xs=class extends Mt{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){let i=this.options;if(this.left=0,this.top=0,!i.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;let n=rt(i.text)?i.text.length:1;this._padding=xt(i.padding);let o=n*ft(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){let t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){let{top:e,left:i,bottom:n,right:o,options:a}=this,r=a.align,l=0,c,h,d;return this.isHorizontal()?(h=vt(r,i,o),d=e+t,c=o-i):(a.position==="left"?(h=i+t,d=vt(r,n,e),l=st*-.5):(h=o-t,d=vt(r,e,n),l=st*.5),c=n-e),{titleX:h,titleY:d,maxWidth:c,rotation:l}}draw(){let t=this.ctx,e=this.options;if(!e.display)return;let i=ft(e.font),o=i.lineHeight/2+this._padding.top,{titleX:a,titleY:r,maxWidth:l,rotation:c}=this._drawArgs(o);ae(t,e.text,0,0,i,{color:e.color,maxWidth:l,rotation:c,textAlign:Ns(e.align),textBaseline:"middle",translation:[a,r]})}};cr={id:"title",_element:xs,start(s,t,e){pd(s,e)},stop(s){let t=s.titleBlock;yt.removeBox(s,t),delete s.titleBlock},beforeUpdate(s,t,e){let i=s.titleBlock;yt.configure(s,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}},Qs=new WeakMap,hr={id:"subtitle",start(s,t,e){let i=new xs({ctx:s.ctx,options:e,chart:s});yt.configure(s,i,e),yt.addBox(s,i),Qs.set(s,i)},stop(s){yt.removeBox(s,Qs.get(s)),Qs.delete(s)},beforeUpdate(s,t,e){let i=Qs.get(s);yt.configure(s,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}},gs={average(s){if(!s.length)return!1;let t,e,i=new Set,n=0,o=0;for(t=0,e=s.length;tr+l)/i.size,y:n/o}},nearest(s,t){if(!s.length)return!1;let e=t.x,i=t.y,n=Number.POSITIVE_INFINITY,o,a,r;for(o=0,a=s.length;o0){let t=s[0],e=t.chart.data.labels,i=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex{let a={before:[],lines:[],after:[]},r=Sa(i,o);$t(a.before,Zt(Ct(r,"beforeLabel",this,o))),$t(a.lines,Ct(r,"label",this,o)),$t(a.after,Zt(Ct(r,"afterLabel",this,o))),n.push(a)}),n}getAfterBody(t,e){return Ca(Ct(e.callbacks,"afterBody",this,t))}getFooter(t,e){let{callbacks:i}=e,n=Ct(i,"beforeFooter",this,t),o=Ct(i,"footer",this,t),a=Ct(i,"afterFooter",this,t),r=[];return r=$t(r,Zt(n)),r=$t(r,Zt(o)),r=$t(r,Zt(a)),r}_createItems(t){let e=this._active,i=this.chart.data,n=[],o=[],a=[],r=[],l,c;for(l=0,c=e.length;lt.filter(h,d,u,i))),t.itemSort&&(r=r.sort((h,d)=>t.itemSort(h,d,i))),nt(r,h=>{let d=Sa(t.callbacks,h);n.push(Ct(d,"labelColor",this,h)),o.push(Ct(d,"labelPointStyle",this,h)),a.push(Ct(d,"labelTextColor",this,h))}),this.labelColors=n,this.labelPointStyles=o,this.labelTextColors=a,this.dataPoints=r,r}update(t,e){let i=this.options.setContext(this.getContext()),n=this._active,o,a=[];if(!n.length)this.opacity!==0&&(o={opacity:0});else{let r=gs[i.position].call(this,n,this._eventPosition);a=this._createItems(i),this.title=this.getTitle(a,i),this.beforeBody=this.getBeforeBody(a,i),this.body=this.getBody(a,i),this.afterBody=this.getAfterBody(a,i),this.footer=this.getFooter(a,i);let l=this._size=_a(this,i),c=Object.assign({},r,l),h=wa(this.chart,i,c),d=ka(i,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:d.x,y:d.y,width:l.width,height:l.height,caretX:r.x,caretY:r.y}}this._tooltipItems=a,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,n){let o=this.getCaretPosition(t,i,n);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,i){let{xAlign:n,yAlign:o}=this,{caretSize:a,cornerRadius:r}=i,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:d}=re(r),{x:u,y:f}=t,{width:m,height:b}=e,v,y,w,D,C,_;return o==="center"?(C=f+b/2,n==="left"?(v=u,y=v-a,D=C+a,_=C-a):(v=u+m,y=v+a,D=C-a,_=C+a),w=v):(n==="left"?y=u+Math.max(l,h)+a:n==="right"?y=u+m-Math.max(c,d)-a:y=this.caretX,o==="top"?(D=f,C=D-a,v=y-a,w=y+a):(D=f+b,C=D+a,v=y+a,w=y-a),_=D),{x1:v,x2:y,x3:w,y1:D,y2:C,y3:_}}drawTitle(t,e,i){let n=this.title,o=n.length,a,r,l;if(o){let c=xe(i.rtl,this.x,this.width);for(t.x=Js(this,i.titleAlign,i),e.textAlign=c.textAlign(i.titleAlign),e.textBaseline="middle",a=ft(i.titleFont),r=i.titleSpacing,e.fillStyle=i.titleColor,e.font=a.string,l=0;lw!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,He(t,{x:b,y:m,w:c,h:l,radius:y}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),He(t,{x:v,y:m+1,w:c-2,h:l-2,radius:y}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(b,m,c,l),t.strokeRect(b,m,c,l),t.fillStyle=a.backgroundColor,t.fillRect(v,m+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){let{body:n}=this,{bodySpacing:o,bodyAlign:a,displayColors:r,boxHeight:l,boxWidth:c,boxPadding:h}=i,d=ft(i.bodyFont),u=d.lineHeight,f=0,m=xe(i.rtl,this.x,this.width),b=function(x){e.fillText(x,m.x(t.x+f),t.y+u/2),t.y+=u+o},v=m.textAlign(a),y,w,D,C,_,p,g;for(e.textAlign=a,e.textBaseline="middle",e.font=d.string,t.x=Js(this,v,i),e.fillStyle=i.bodyColor,nt(this.beforeBody,b),f=r&&v!=="right"?a==="center"?c/2+h:c+2+h:0,C=0,p=n.length;C0&&e.stroke()}_updateAnimationTarget(t){let e=this.chart,i=this.$animations,n=i&&i.x,o=i&&i.y;if(n||o){let a=gs[t.position].call(this,this._active,this._eventPosition);if(!a)return;let r=this._size=_a(this,t),l=Object.assign({},a,this._size),c=wa(e,t,l),h=ka(t,l,c,e);(n._to!==h.x||o._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=r.width,this.height=r.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){let e=this.options.setContext(this.getContext()),i=this.opacity;if(!i)return;this._updateAnimationTarget(e);let n={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;let a=xt(e.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&r&&(t.save(),t.globalAlpha=i,this.drawBackground(o,t,n,e),Ji(t,e.textDirection),o.y+=a.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),Zi(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){let i=this._active,n=t.map(({datasetIndex:r,index:l})=>{let c=this.chart.getDatasetMeta(r);if(!c)throw new Error("Cannot find a dataset at index "+r);return{datasetIndex:r,element:c.data[l],index:l}}),o=!os(i,n),a=this._positionChanged(n,e);(o||a)&&(this._active=n,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let n=this.options,o=this._active||[],a=this._getActiveElements(t,o,e,i),r=this._positionChanged(a,t),l=e||!os(a,o)||r;return l&&(this._active=a,(n.enabled||n.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,i,n){let o=this.options;if(t.type==="mouseout")return[];if(!n)return e.filter(r=>this.chart.data.datasets[r.datasetIndex]&&this.chart.getDatasetMeta(r.datasetIndex).controller.getParsed(r.index)!==void 0);let a=this.chart.getElementsAtEventForMode(t,o.mode,o,i);return o.reverse&&a.reverse(),a}_positionChanged(t,e){let{caretX:i,caretY:n,options:o}=this,a=gs[o.position].call(this,t,e);return a!==!1&&(i!==a.x||n!==a.y)}};I(ps,"positioners",gs);ur={id:"tooltip",_element:ps,positioners:gs,afterInit(s,t,e){e&&(s.tooltip=new ps({chart:s,options:e}))},beforeUpdate(s,t,e){s.tooltip&&s.tooltip.initialize(e)},reset(s,t,e){s.tooltip&&s.tooltip.initialize(e)},afterDraw(s){let t=s.tooltip;if(t&&t._willRender()){let e={tooltip:t};if(s.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(s.ctx),s.notifyPlugins("afterTooltipDraw",e)}},afterEvent(s,t){if(s.tooltip){let e=t.replay;s.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(s,t)=>t.bodyFont.size,boxWidth:(s,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:dr},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:s=>s!=="filter"&&s!=="itemSort"&&s!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},fr=Object.freeze({__proto__:null,Colors:sr,Decimation:nr,Filler:ar,Legend:lr,SubTitle:hr,Title:cr,Tooltip:ur}),kd=(s,t,e,i)=>(typeof t=="string"?(e=s.push(t)-1,i.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);Sd=(s,t)=>s===null?null:gt(Math.round(s),0,t);Ye=class extends ge{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){let e=this._addedLabels;if(e.length){let i=this.getLabels();for(let{index:n,label:o}of e)i[n]===o&&i.splice(n,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(Z(t))return null;let i=this.getLabels();return e=isFinite(e)&&i[e]===t?e:Cd(i,t,Q(e,t),this._addedLabels),Sd(e,i.length-1)}determineDataLimits(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),{min:i,max:n}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(i=0),e||(n=this.getLabels().length-1)),this.min=i,this.max=n}buildTicks(){let t=this.min,e=this.max,i=this.options.offset,n=[],o=this.getLabels();o=t===0&&e===o.length-1?o:o.slice(t,e+1),this._valueRange=Math.max(o.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let a=t;a<=e;a++)n.push({value:a});return n}getLabelForValue(t){return Ea.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){let e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}};I(Ye,"id","category"),I(Ye,"defaults",{ticks:{callback:Ea}});qe=class extends ge{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return Z(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){let{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds(),{min:n,max:o}=this,a=l=>n=e?n:l,r=l=>o=i?o:l;if(t){let l=At(n),c=At(o);l<0&&c<0?r(0):l>0&&c>0&&a(0)}if(n===o){let l=o===0?1:Math.abs(o*.05);r(o+l),t||a(n-l)}this.min=n,this.max=o}getTickLimit(){let t=this.options.ticks,{maxTicksLimit:e,stepSize:i}=t,n;return i?(n=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),e=e||11),e&&(n=Math.min(e,n)),n}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){let t=this.options,e=t.ticks,i=this.getTickLimit();i=Math.max(2,i);let n={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,a=Ed(n,o);return t.bounds==="ticks"&&Ai(a,this,"value"),t.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){let t=this.ticks,e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){let n=(i-e)/Math.max(t.length-1,1)/2;e-=n,i+=n}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return Ve(t,this.chart.options.locale,this.options.ticks.format)}},Ke=class extends qe{determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=ht(t)?t:0,this.max=ht(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){let t=this.isHorizontal(),e=t?this.width:this.height,i=Pt(this.options.ticks.minRotation),n=(t?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/n))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}};I(Ke,"id","linear"),I(Ke,"defaults",{ticks:{callback:Ne.formatters.numeric}});ys=s=>Math.floor(qt(s)),_e=(s,t)=>Math.pow(10,ys(s)+t);Xe=class extends ge{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){let i=qe.prototype.parse.apply(this,[t,e]);if(i===0){this._zero=!0;return}return ht(i)&&i>0?i:null}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=ht(t)?Math.max(0,t):null,this.max=ht(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!ht(this._userMin)&&(this.min=t===_e(this.min,0)?_e(this.min,-1):_e(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),i=this.min,n=this.max,o=r=>i=t?i:r,a=r=>n=e?n:r;i===n&&(i<=0?(o(1),a(10)):(o(_e(i,-1)),a(_e(n,1)))),i<=0&&o(_e(n,-1)),n<=0&&a(_e(i,1)),this.min=i,this.max=n}buildTicks(){let t=this.options,e={min:this._userMin,max:this._userMax},i=Dd(e,this);return t.bounds==="ticks"&&Ai(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":Ve(t,this.chart.options.locale,this.options.ticks.format)}configure(){let t=this.min;super.configure(),this._startValue=qt(t),this._valueRange=qt(this.max)-qt(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(qt(t)-this._startValue)/this._valueRange)}getValueForPixel(t){let e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}};I(Xe,"id","logarithmic"),I(Xe,"defaults",{ticks:{callback:Ne.formatters.logarithmic,major:{enabled:!0}}});he=class extends qe{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){let t=this._padding=xt(Sn(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!1);this.min=ht(t)&&!isNaN(t)?t:0,this.max=ht(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Sn(this.options))}generateTickLabels(t){qe.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((e,i)=>{let n=ot(this.options.pointLabels.callback,[e,i],this);return n||n===0?n:""}).filter((e,i)=>this.chart.getDataVisibility(i))}fit(){let t=this.options;t.display&&t.pointLabels.display?Ld(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,n){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,n))}getIndexAngle(t){let e=lt/(this._pointLabels.length||1),i=this.options.startAngle||0;return bt(t*e+Pt(i))}getDistanceFromCenterForValue(t){if(Z(t))return NaN;let e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(Z(t))return NaN;let e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){let e=this._pointLabels||[];if(t>=0&&t{if(d!==0||d===0&&this.min<0){l=this.getDistanceFromCenterForValue(h.value);let u=this.getContext(d),f=n.setContext(u),m=o.setContext(u);Nd(this,f,l,a,m)}}),i.display){for(t.save(),r=a-1;r>=0;r--){let h=i.setContext(this.getPointLabelContext(r)),{color:d,lineWidth:u}=h;!u||!d||(t.lineWidth=u,t.strokeStyle=d,t.setLineDash(h.borderDash),t.lineDashOffset=h.borderDashOffset,l=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),c=this.getPointPosition(r,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){let t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;let n=this.getIndexAngle(0),o,a;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(n),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((r,l)=>{if(l===0&&this.min>=0&&!e.reverse)return;let c=i.setContext(this.getContext(l)),h=ft(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=h.string,a=t.measureText(r.label).width,t.fillStyle=c.backdropColor;let d=xt(c.backdropPadding);t.fillRect(-a/2-d.left,-o-h.size/2-d.top,a+d.width,h.size+d.height)}ae(t,r.label,0,-o,h,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}};I(he,"id","radialLinear"),I(he,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Ne.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),I(he,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),I(he,"descriptors",{angleLines:{_fallback:"grid"}});hi={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}},Et=Object.keys(hi);fe=class extends ge{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){let i=t.time||(t.time={}),n=this._adapter=new Va._date(t.adapters.date);n.init(e),Fe(i.displayFormats,n.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return t===void 0?null:Aa(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let t=this.options,e=this._adapter,i=t.time.unit||"day",{min:n,max:o,minDefined:a,maxDefined:r}=this.getUserBounds();function l(c){!a&&!isNaN(c.min)&&(n=Math.min(n,c.min)),!r&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!a||!r)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),n=ht(n)&&!isNaN(n)?n:+e.startOf(Date.now(),i),o=ht(o)&&!isNaN(o)?o:+e.endOf(Date.now(),i)+1,this.min=Math.min(n,o-1),this.max=Math.max(n+1,o)}_getLabelBounds(){let t=this.getLabelTimestamps(),e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){let t=this.options,e=t.time,i=t.ticks,n=i.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&n.length&&(this.min=this._userMin||n[0],this.max=this._userMax||n[n.length-1]);let o=this.min,a=this.max,r=po(n,o,a);return this._unit=e.unit||(i.autoSkip?Oa(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):Wd(this,r.length,e.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:$d(this._unit),this.initOffsets(n),t.reverse&&r.reverse(),Fa(this,r,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e=0,i=0,n,o;this.options.offset&&t.length&&(n=this.getDecimalForValue(t[0]),t.length===1?e=1-n:e=(this.getDecimalForValue(t[1])-n)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?i=o:i=(o-this.getDecimalForValue(t[t.length-2]))/2);let a=t.length<3?.5:.25;e=gt(e,0,a),i=gt(i,0,a),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){let t=this._adapter,e=this.min,i=this.max,n=this.options,o=n.time,a=o.unit||Oa(o.minUnit,e,i,this._getLabelCapacity(e)),r=Q(n.ticks.stepSize,1),l=a==="week"?o.isoWeekday:!1,c=ve(l)||l===!0,h={},d=e,u,f;if(c&&(d=+t.startOf(d,"isoWeek",l)),d=+t.startOf(d,c?"day":a),t.diff(i,e,a)>1e5*r)throw new Error(e+" and "+i+" are too far apart with stepSize of "+r+" "+a);let m=n.ticks.source==="data"&&this.getDataTimestamps();for(u=d,f=0;u+b)}getLabelForValue(t){let e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){let n=this.options.time.displayFormats,o=this._unit,a=e||n[o];return this._adapter.format(t,a)}_tickFormatFunction(t,e,i,n){let o=this.options,a=o.ticks.callback;if(a)return ot(a,[t,e,i],this);let r=o.time.displayFormats,l=this._unit,c=this._majorUnit,h=l&&r[l],d=c&&r[c],u=i[e],f=c&&d&&u&&u.major;return this._adapter.format(t,n||(f?d:h))}generateTickLabels(t){let e,i,n;for(e=0,i=t.length;e0?r:1}getDataTimestamps(){let t=this._cache.data||[],e,i;if(t.length)return t;let n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(e=0,i=n.length;e=e&&c<=i&&n.push(c);if(n.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(a=0,r=n.length;an-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;let e=this.getDataTimestamps(),i=this.getLabelTimestamps();return e.length&&i.length?t=this.normalize(e.concat(i)):t=e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(Zs(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){let e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return Zs(this._table,i*this._tableRange+this._minPos,!0)}};I(Ge,"id","timeseries"),I(Ge,"defaults",fe.defaults);pr=Object.freeze({__proto__:null,CategoryScale:Ye,LinearScale:Ke,LogarithmicScale:Xe,RadialLinearScale:he,TimeScale:fe,TimeSeriesScale:Ge}),Ud=[za,Za,fr,pr]});var Kd={};Pn(Kd,{XLSXCardView:()=>di,default:()=>ui});module.exports=Sr(Kd);var X=require("obsidian"),Dn=On(bi());var vi={defaultMode:"kanban-genre",notesColumns:["notes","note","Notes","Note","description","Description","review","Review"],statusColumn:"status",categoryColumn:"category",notesSubfolder:"Notes",columnWidths:{},selectColumns:["Category","Type","Rating","Status","rating","type","category","status","Score /5"],fileConfigs:{}},ws="xlsx-card-view";var Rn=On(bi());function Fn(s){return s.replace(/[\\/:*?"<>|#^[\]]/g,"").replace(/\s+/g," ").trim().slice(0,100)}function ks(s){var n,o;if(!s||!s.trim())return{headers:[],rows:[]};let t=Rn.default.parse(s,{header:!0,skipEmptyLines:!0}),e=((n=t.meta.fields)!=null?n:[]).map(String),i=((o=t.data)!=null?o:[]).map(a=>{let r={};return e.forEach(l=>{r[l]=a[l]!=null?String(a[l]):""}),r});return{headers:e,rows:i}}function In(s,t){if(!s)return s;let e=s.startsWith("./")||s.startsWith("../")||s==="."||s==="..";if(!e&&s.includes("/"))return s;if(!e)return t?`${t}/${s}`:s;let i=t?t.split("/").filter(Boolean):[];for(let n of s.split("/"))if(!(n===""||n===".")){if(n===".."){i.pop();continue}i.push(n)}return i.join("/")}function Tt(s){return s.split(/[\s_-]+/).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}function Bn(s,t){let e=(s!=null?s:"").trim();if(!e||e.toLowerCase()==="unrated"||e==="\u2014"||e==="-")return"";if(/[★⭐☆]/.test(e))return e;if(/^\d+$/.test(e)){let o=parseInt(e,10);if(o>=1&&o<=5)return"\u2605".repeat(o)}let n=Er(e,t);return n&&n!==e&&n!=="\u2014"?n:""}function Er(s,t){var o;let e=t.toLowerCase();if(!["rating","score","score /5"].includes(e))return s;let i=s.toLowerCase().trim();return(o={excellent:"\u2605\u2605\u2605\u2605\u2605",great:"\u2605\u2605\u2605\u2605\u2605",good:"\u2605\u2605\u2605\u2605\u2606",fair:"\u2605\u2605\u2605\u2606\u2606",poor:"\u2605\u2605\u2606\u2606\u2606",bad:"\u2605\u2606\u2606\u2606\u2606",5:"\u2605\u2605\u2605\u2605\u2605",4:"\u2605\u2605\u2605\u2605\u2606",3:"\u2605\u2605\u2605\u2606\u2606",2:"\u2605\u2605\u2606\u2606\u2606",1:"\u2605\u2606\u2606\u2606\u2606",0:"\u2606\u2606\u2606\u2606\u2606",unrated:"\u2014","":"\u2014"}[i])!=null?o:s}function Le(s,t,e,i,n){var D;document.body.querySelectorAll(".csv-select-picker").forEach(C=>C.remove());let o=document.body.createDiv({cls:"csv-select-picker"});o.style.position="fixed",o.style.zIndex="9999";let a=()=>{let C=s.getBoundingClientRect(),_=o.offsetHeight||280,p=C.bottom+4+_>window.innerHeight&&C.top-4-_>0;o.style.left=C.left+"px",o.style.top=p?C.top-4-_+"px":C.bottom+4+"px"};a();let r=C=>{!o.contains(C.target)&&C.target!==s&&c()},l=()=>c(),c=()=>{o.remove(),document.removeEventListener("mousedown",r),window.removeEventListener("scroll",l,!0),window.removeEventListener("resize",c)},h=o.createEl("input",{cls:"csv-picker-search",type:"text",placeholder:"Search or add\u2026"});h.focus();let d=o.createDiv({cls:"csv-picker-list"}),u=Array.from(new Set(e.filter(Boolean))),f=[],m=0,b=()=>{d.querySelectorAll(".csv-picker-item").forEach((C,_)=>{C.toggleClass("csv-picker-item--hover",_===m),_===m&&C.scrollIntoView({block:"nearest"})})},v=C=>{i(C.isClear?"":C.value),c()},y=C=>{d.empty(),f=[];let _=C?u.filter(p=>p.toLowerCase().includes(C.toLowerCase())):u;if(t){f.push({value:"",isClear:!0});let p=d.createDiv({cls:"csv-picker-item csv-picker-clear"});p.setText("\u2715 Clear"),p.addEventListener("mousedown",g=>{g.preventDefault(),v({value:"",isClear:!0})})}if(_.forEach(p=>{f.push({value:p});let g=d.createDiv({cls:`csv-picker-item ${p===t?"active":""}`});g.setText(p),g.addEventListener("mousedown",x=>{x.preventDefault(),v({value:p})})}),C&&!u.some(p=>p.toLowerCase()===C.toLowerCase())){f.push({value:C,isAdd:!0});let p=d.createDiv({cls:"csv-picker-item csv-picker-add"});p.setText(`+ Add "${C}"`),p.addEventListener("mousedown",g=>{g.preventDefault(),v({value:C})})}!_.length&&!C&&d.createDiv({cls:"csv-picker-empty",text:"No options yet. Type to add."}),m=Math.min(m,Math.max(f.length-1,0)),b()};y(""),a(),h.addEventListener("input",()=>{m=0,y(h.value),a()});let w=typeof window!="undefined"&&((D=window.matchMedia)==null?void 0:D.call(window,"(pointer: coarse)").matches);setTimeout(()=>{document.addEventListener("mousedown",r),w||(window.addEventListener("scroll",l,!0),window.addEventListener("resize",c))},0),h.addEventListener("keydown",C=>{if(C.key==="Escape"){c();return}if(C.key==="ArrowDown"){C.preventDefault(),f.length&&(m=(m+1)%f.length,b());return}if(C.key==="ArrowUp"){C.preventDefault(),f.length&&(m=(m-1+f.length)%f.length,b());return}if(C.key==="Enter")if(C.preventDefault(),f[m])v(f[m]);else{let _=h.value.trim();_&&(i(_),c())}})}function zn(s,t,e){return!s[t]||t===e||(s[e]||(s[e]=s[t]),delete s[t]),s}var zt=require("obsidian");var Cs=class extends zt.Modal{constructor(t,e,i,n,o,a){super(t),this.headers=e,this.isNotesCol=i,this.isSelectCol=n,this.getColumnValues=o,this.onSubmit=a}onOpen(){let{contentEl:t}=this;t.empty(),t.addClass("csv-add-modal"),t.createEl("h2",{text:"Add new entry",cls:"csv-modal-title"});let e=t.createDiv({cls:"csv-modal-form"}),i={};this.headers.forEach(l=>i[l]=""),this.headers.forEach(l=>{let c=e.createDiv({cls:"csv-modal-row"});if(c.createEl("label",{text:Tt(l),cls:"csv-modal-label"}),this.isNotesCol(l)){let h=c.createEl("textarea",{cls:"csv-modal-textarea",placeholder:"Markdown supported\u2026"});h.addEventListener("input",()=>{i[l]=h.value})}else if(this.isSelectCol(l)){let d=c.createDiv({cls:"csv-modal-select-wrap"}).createDiv({cls:"csv-select-chip empty"});d.setText("\u2014 click to select \u2014"),d.addEventListener("click",u=>{u.stopPropagation(),Le(d,i[l],this.getColumnValues(l),f=>{i[l]=f,d.setText(f||"\u2014 click to select \u2014"),d.toggleClass("empty",!f)},t)})}else{let h=c.createEl("input",{cls:"csv-modal-input",type:"text",placeholder:l});h.addEventListener("input",()=>{i[l]=h.value}),h.addEventListener("keydown",d=>{d.key==="Enter"&&r()})}});let n=t.createDiv({cls:"csv-modal-btns"});n.createEl("button",{text:"Cancel",cls:"csv-modal-cancel"}).addEventListener("click",()=>this.close()),n.createEl("button",{text:"Add entry",cls:"csv-modal-submit"}).addEventListener("click",()=>r());let r=()=>{if(!Object.values(i).some(c=>c.trim())){new zt.Notice("Fill in at least one field.");return}this.onSubmit(i),this.close()}}onClose(){this.contentEl.empty()}},Ss=class extends zt.Modal{constructor(t,e,i,n,o,a,r,l,c,h){super(t),this.row={...e},this.notesCol=i,this.headers=n,this.filePath=o,this.renderComponent=new zt.Component,this.isNotesCol=a,this.isSelectCol=r,this.getColumnValues=l,this.onSave=c,this.onDelete=h,this.modalEl.addClass("csv-note-expander-modal")}onOpen(){var w,D,C,_,p;this.renderComponent.load();let{contentEl:t}=this;t.empty(),t.addClass("csv-note-expander");let e=t.createDiv({cls:"csv-expander-header"});e.createDiv({cls:"csv-expander-title",text:(D=this.row[(w=this.headers.find(g=>["title","name","Title","Name"].includes(g)))!=null?w:this.headers[0]])!=null?D:"\u2014"});let i=e.createDiv({cls:"csv-expander-header-btns"}),n=t.createDiv({cls:"csv-expander-fields"}),o=this.headers.find(g=>["title","name","Title","Name"].includes(g)),a=this.headers.find(g=>["author","Author","director","Director","artist","Artist","creator","Creator"].includes(g));this.headers.forEach(g=>{if(this.isNotesCol(g))return;let x=n.createDiv({cls:"csv-expander-field-row"});if(x.createDiv({cls:"csv-expander-field-label",text:Tt(g)}),this.isSelectCol(g)){let k=x.createDiv({cls:`csv-select-chip ${this.row[g]?"":"empty"}`});k.setText(this.row[g]||"\u2014"),k.addEventListener("click",S=>{S.stopPropagation(),Le(k,this.row[g],this.getColumnValues(g),M=>{this.row[g]=M,k.setText(M||"\u2014"),k.toggleClass("empty",!M)},t)})}else{let k=x.createDiv({cls:"csv-expander-field-value",text:this.row[g]||"\u2014"});k.addEventListener("click",()=>{var R;k.empty();let S=k.createEl("input",{cls:"csv-inline-input",value:(R=this.row[g])!=null?R:"",type:"text"});S.focus(),S.select();let M=()=>{this.row[g]=S.value,k.empty(),k.setText(S.value||"\u2014")};S.addEventListener("blur",M),S.addEventListener("keydown",K=>{K.key==="Enter"&&S.blur(),K.key==="Escape"&&(k.empty(),k.setText(this.row[g]||"\u2014"))})})}}),t.createDiv({cls:"csv-expander-divider"}).createDiv({cls:"csv-expander-notes-label",text:this.notesCol});let l=!1,c=(C=this.row[this.notesCol])!=null?C:"",h=t.createDiv({cls:"csv-expander-rendered markdown-rendered"});h.title="Click to edit";let d=t.createDiv({cls:"csv-expander-editor"});d.style.display="none";let u=()=>{h.empty(),c.trim()?zt.MarkdownRenderer.render(this.app,c,h,this.filePath,this.renderComponent):h.createDiv({cls:"csv-notes-empty",text:"+ Add note"})};u();let f=d.createEl("textarea",{cls:"csv-expander-textarea"});f.value=c,f.addEventListener("input",()=>{c=f.value});let m=()=>{l||(l=!0,h.style.display="none",d.style.display="flex",f.value=c,f.focus())},b=()=>{l&&(l=!1,d.style.display="none",h.style.display="",c=f.value,u())};h.addEventListener("click",g=>{if(g.target.closest("a, button, input, textarea, [contenteditable]"))return;let k=window.getSelection();k&&k.toString().length>0||m()}),f.addEventListener("keydown",g=>{g.key==="Escape"&&(g.preventDefault(),f.blur())}),f.addEventListener("blur",b);let v=t.createDiv({cls:"csv-expander-footer"});if(this.onDelete){let g=String((p=this.row[(_=this.headers.find(x=>["title","name","Title","Name"].includes(x)))!=null?_:this.headers[0]])!=null?p:"").trim();v.createEl("button",{cls:"csv-expander-delete-btn",text:"Delete"}).addEventListener("click",()=>{let x=g||"this entry";window.confirm(`Delete "${x}"? This can't be undone.`)&&(this.onDelete(),this.close())})}let y=v.createDiv({cls:"csv-expander-footer-right"});y.createEl("button",{cls:"csv-modal-cancel",text:"Cancel"}).addEventListener("click",()=>this.close()),y.createEl("button",{cls:"csv-expander-save-btn",text:"Save & close"}).addEventListener("click",()=>{l&&(c=f.value),this.row[this.notesCol]=c,this.onSave(this.row),this.close()})}onClose(){this.renderComponent.unload(),this.contentEl.empty()}},Es=class extends zt.Modal{constructor(t,e,i,n,o,a){super(t),this.headers=e,this.filePath=i,this.current={...n,habitColumns:n.habitColumns?[...n.habitColumns]:void 0},this.autoDetectedHabits=o,this.onSave=a}onOpen(){var D,C;let{contentEl:t}=this;t.empty(),t.addClass("csv-add-modal"),t.createEl("h2",{text:"View settings for this file",cls:"csv-modal-title"}),t.createEl("p",{text:"These settings apply only to this file and override the global defaults.",cls:"csv-modal-desc"});let e=t.createDiv({cls:"csv-modal-form"}),i="\u2014 use global default \u2014",n=[i,...this.headers],o=(_,p,g)=>{let x=e.createDiv({cls:"csv-modal-row"});x.createEl("label",{text:_,cls:"csv-modal-label"});let k=x.createEl("select",{cls:"csv-modal-select"});n.forEach(S=>{let M=k.createEl("option",{text:S,value:S});(p!=null?p:i)===S&&(M.selected=!0)}),k.addEventListener("change",()=>g(k.value===i?void 0:k.value))};o("Category column (kanban grouping)",this.current.categoryColumn,_=>{this.current.categoryColumn=_}),o("Status column (row subgroups)",this.current.statusColumn,_=>{this.current.statusColumn=_}),o("Notes column",this.current.notesColumn,_=>{this.current.notesColumn=_});let a=e.createDiv({cls:"csv-modal-row"});a.createEl("label",{text:"Habit columns (dashboard)",cls:"csv-modal-label"});let r=a.createEl("p",{cls:"csv-modal-hint",text:"Select columns to track as habits. Auto-detected columns with binary values (0/1) are pre-selected."}),l=a.createDiv({cls:"csv-modal-checkbox-grid"}),c=new Set((D=this.current.habitColumns)!=null?D:this.autoDetectedHabits);this.headers.forEach(_=>{let p=l.createEl("label",{cls:"csv-modal-checkbox-label"}),g=p.createEl("input",{type:"checkbox"});g.checked=c.has(_),this.autoDetectedHabits.includes(_)&&!this.current.habitColumns&&p.addClass("auto-detected"),p.createSpan({text:_}),g.addEventListener("change",()=>{this.current.habitColumns||(this.current.habitColumns=[...this.autoDetectedHabits]),g.checked?this.current.habitColumns.includes(_)||this.current.habitColumns.push(_):this.current.habitColumns=this.current.habitColumns.filter(x=>x!==_)})});let h=e.createDiv({cls:"csv-modal-row"});h.createEl("label",{text:"Card fields (Library / Kanban)",cls:"csv-modal-label"}),h.createEl("p",{cls:"csv-modal-hint",text:"Columns shown under each card title. Rating renders as stars, theme/tag columns as pills. Leave all unchecked for title-only cards."});let d=h.createDiv({cls:"csv-modal-checkbox-grid"}),u=_=>this.headers.find(p=>_.some(g=>g.toLowerCase()===p.toLowerCase())),f=[u(["Author","Authors","Director","Artist","Creator","By"]),u(["Year","Date","Released"]),u(["Rating","Score","Score /5","Stars"]),u(["Theme","Tags","Tag","Mood"])].filter(_=>!!_),m=new Set((C=this.current.cardFields)!=null?C:f),b=!!this.current.cardFields;this.headers.forEach(_=>{let p=d.createEl("label",{cls:"csv-modal-checkbox-label"}),g=p.createEl("input",{type:"checkbox"});g.checked=m.has(_),f.includes(_)&&!b&&p.addClass("auto-detected"),p.createSpan({text:_}),g.addEventListener("change",()=>{this.current.cardFields||(this.current.cardFields=[...f]),g.checked?this.current.cardFields.includes(_)||this.current.cardFields.push(_):this.current.cardFields=this.current.cardFields.filter(x=>x!==_)})});let v=e.createDiv({cls:"csv-modal-row"});v.createEl("label",{text:"Default view",cls:"csv-modal-label"});let y=v.createEl("select",{cls:"csv-modal-select"});[["\u2014 use global default \u2014",""],["Dashboard","dashboard"],["By Genre","kanban-genre"],["Table","table"]].forEach(([_,p])=>{var x;let g=y.createEl("option",{text:_,value:p});((x=this.current.defaultMode)!=null?x:"")===p&&(g.selected=!0)}),y.addEventListener("change",()=>{this.current.defaultMode=y.value?y.value:void 0});let w=t.createDiv({cls:"csv-modal-btns"});w.createEl("button",{text:"Cancel",cls:"csv-modal-cancel"}).addEventListener("click",()=>this.close()),w.createEl("button",{text:"Save",cls:"csv-modal-submit"}).addEventListener("click",()=>{this.onSave(this.current),this.close()})}onClose(){this.contentEl.empty()}};var xi=`--- +`):s}function md(s,t){let{element:e,datasetIndex:i,index:n}=t,o=s.getDatasetMeta(i).controller,{label:a,value:r}=o.getLabelAndValue(n);return{chart:s,label:a,parsed:o.getParsed(n),raw:s.data.datasets[i].data[n],formattedValue:r,dataset:o.getDataset(),dataIndex:n,datasetIndex:i,element:e}}function _a(s,t){let e=s.chart.ctx,{body:i,footer:n,title:o}=s,{boxWidth:a,boxHeight:r}=t,l=ft(t.bodyFont),c=ft(t.titleFont),h=ft(t.footerFont),d=o.length,u=n.length,f=i.length,m=xt(t.padding),b=m.height,v=0,y=i.reduce((C,_)=>C+_.before.length+_.lines.length+_.after.length,0);if(y+=s.beforeBody.length+s.afterBody.length,d&&(b+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),y){let C=t.displayColors?Math.max(r,l.lineHeight):l.lineHeight;b+=f*C+(y-f)*l.lineHeight+(y-1)*t.bodySpacing}u&&(b+=t.footerMarginTop+u*h.lineHeight+(u-1)*t.footerSpacing);let w=0,D=function(C){v=Math.max(v,e.measureText(C).width+w)};return e.save(),e.font=c.string,nt(s.title,D),e.font=l.string,nt(s.beforeBody.concat(s.afterBody),D),w=t.displayColors?a+2+t.boxPadding:0,nt(i,C=>{nt(C.before,D),nt(C.lines,D),nt(C.after,D)}),w=0,e.font=h.string,nt(s.footer,D),e.restore(),v+=m.width,{width:v,height:b}}function bd(s,t){let{y:e,height:i}=t;return es.height-i/2?"bottom":"center"}function vd(s,t,e,i){let{x:n,width:o}=i,a=e.caretSize+e.caretPadding;if(s==="left"&&n+o+a>t.width||s==="right"&&n-o-a<0)return!0}function xd(s,t,e,i){let{x:n,width:o}=e,{width:a,chartArea:{left:r,right:l}}=s,c="center";return i==="center"?c=n<=(r+l)/2?"left":"right":n<=o/2?c="left":n>=a-o/2&&(c="right"),vd(c,s,t,e)&&(c="center"),c}function wa(s,t,e){let i=e.yAlign||t.yAlign||bd(s,e);return{xAlign:e.xAlign||t.xAlign||xd(s,t,e,i),yAlign:i}}function yd(s,t){let{x:e,width:i}=s;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function _d(s,t,e){let{y:i,height:n}=s;return t==="top"?i+=e:t==="bottom"?i-=n+e:i-=n/2,i}function ka(s,t,e,i){let{caretSize:n,caretPadding:o,cornerRadius:a}=s,{xAlign:r,yAlign:l}=e,c=n+o,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:f}=re(a),m=yd(t,r),b=_d(t,l,c);return l==="center"?r==="left"?m+=c:r==="right"&&(m-=c):r==="left"?m-=Math.max(h,u)+n:r==="right"&&(m+=Math.max(d,f)+n),{x:gt(m,0,i.width-t.width),y:gt(b,0,i.height-t.height)}}function Js(s,t,e){let i=xt(e.padding);return t==="center"?s.x+s.width/2:t==="right"?s.x+s.width-i.right:s.x+i.left}function Ca(s){return $t([],Zt(s))}function wd(s,t,e){return Jt(s,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Sa(s,t){let e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?s.override(e):s}function Ct(s,t,e,i){let n=s[t].call(e,i);return typeof n=="undefined"?dr[t].call(e,i):n}function Cd(s,t,e,i){let n=s.indexOf(t);if(n===-1)return kd(s,t,e,i);let o=s.lastIndexOf(t);return n!==o?e:n}function Ea(s){let t=this.getLabels();return s>=0&&sm&&(_=Pi(k*_/m/f)*f),Z(l)||(p=Math.pow(10,l),_=Math.ceil(_*p)/p),n==="ticks"?(g=Math.floor(b/_)*_,x=Math.ceil(v/_)*_):(g=b,x=v),y&&w&&o&&uo((r-a)/o,_/1e3)?(k=Math.round(Math.min((r-a)/_,h)),_=(r-a)/k,g=a,x=r):D?(g=y?a:g,x=w?r:x,k=c-1,_=(x-g)/k):(k=(x-g)/_,Be(k,Math.round(k),_/1e3)?k=Math.round(k):k=Math.ceil(k));let S=Math.max(Oi(_),Oi(g));p=Math.pow(10,Z(l)?S:l),g=Math.round(g*p)/p,x=Math.round(x*p)/p;let M=0;for(y&&(u&&g!==a?(e.push({value:a}),gr)break;e.push({value:R})}return w&&u&&x!==r?e.length&&Be(e[e.length-1].value,r,Ma(r,C,s))?e[e.length-1].value=r:e.push({value:r}):(!w||x===r)&&e.push({value:x}),e}function Ma(s,t,{horizontal:e,minRotation:i}){let n=Pt(i),o=(e?Math.sin(n):Math.cos(n))||.001,a=.75*t*(""+s).length;return Math.min(t/o,a)}function Da(s){return s/Math.pow(10,ys(s))===1}function Ta(s,t,e){let i=Math.pow(10,e),n=Math.floor(s/i);return Math.ceil(t/i)-n}function Md(s,t){let e=t-s,i=ys(e);for(;Ta(s,t,i)>10;)i++;for(;Ta(s,t,i)<10;)i--;return Math.min(i,ys(s))}function Dd(s,{min:t,max:e}){t=kt(s.min,t);let i=[],n=ys(t),o=Md(t,e),a=o<0?Math.pow(10,Math.abs(o)):1,r=Math.pow(10,o),l=n>o?Math.pow(10,n):0,c=Math.round((t-l)*a)/a,h=Math.floor((t-l)/r/10)*r*10,d=Math.floor((c-h)/Math.pow(10,o)),u=kt(s.min,Math.round((l+h+d*Math.pow(10,o))*a)/a);for(;u=10?d=d<15?15:20:d++,d>=20&&(o++,d=2,a=o>=0?1:a),u=Math.round((l+h+d*Math.pow(10,o))*a)/a;let f=kt(s.max,u);return i.push({value:f,major:Da(f),significand:d}),i}function Sn(s){let t=s.ticks;if(t.display&&s.display){let e=xt(t.backdropPadding);return Q(t.font&&t.font.size,ct.font.size)+e.height}return 0}function Td(s,t,e){return e=rt(e)?e:[e],{w:_o(s,t.string,e),h:e.length*t.lineHeight}}function La(s,t,e,i,n){return s===i||s===n?{start:t-e/2,end:t+e/2}:sn?{start:t-e,end:t}:{start:t,end:t+e}}function Ld(s){let t={l:s.left+s._padding.left,r:s.right-s._padding.right,t:s.top+s._padding.top,b:s.bottom-s._padding.bottom},e=Object.assign({},t),i=[],n=[],o=s._pointLabels.length,a=s.options.pointLabels,r=a.centerPointLabels?st/o:0;for(let l=0;lt.r&&(r=(i.end-t.r)/o,s.r=Math.max(s.r,t.r+r)),n.startt.b&&(l=(n.end-t.b)/a,s.b=Math.max(s.b,t.b+l))}function Ad(s,t,e){let i=s.drawingArea,{extra:n,additionalAngle:o,padding:a,size:r}=e,l=s.getPointPosition(t,i+n+a,o),c=Math.round(zs(bt(l.angle+ut))),h=Bd(l.y,r.h,c),d=Fd(c),u=Id(l.x,r.w,d);return{visible:!0,x:l.x,y:h,textAlign:d,left:u,top:h,right:u+r.w,bottom:h+r.h}}function Od(s,t){if(!t)return!0;let{left:e,top:i,right:n,bottom:o}=s;return!(Nt({x:e,y:i},t)||Nt({x:e,y:o},t)||Nt({x:n,y:i},t)||Nt({x:n,y:o},t))}function Rd(s,t,e){let i=[],n=s._pointLabels.length,o=s.options,{centerPointLabels:a,display:r}=o.pointLabels,l={extra:Sn(o)/2,additionalAngle:a?st/n:0},c;for(let h=0;h270||e<90)&&(s-=t),s}function zd(s,t,e){let{left:i,top:n,right:o,bottom:a}=e,{backdropColor:r}=t;if(!Z(r)){let l=re(t.borderRadius),c=xt(t.backdropPadding);s.fillStyle=r;let h=i-c.left,d=n-c.top,u=o-i+c.width,f=a-n+c.height;Object.values(l).some(m=>m!==0)?(s.beginPath(),He(s,{x:h,y:d,w:u,h:f,radius:l}),s.fill()):s.fillRect(h,d,u,f)}}function Vd(s,t){let{ctx:e,options:{pointLabels:i}}=s;for(let n=t-1;n>=0;n--){let o=s._pointLabelItems[n];if(!o.visible)continue;let a=i.setContext(s.getPointLabelContext(n));zd(e,a,o);let r=ft(a.font),{x:l,y:c,textAlign:h}=o;ae(e,s._pointLabels[n],l,c+r.lineHeight/2,r,{color:a.color,textAlign:h,textBaseline:"middle"})}}function gr(s,t,e,i){let{ctx:n}=s;if(e)n.arc(s.xCenter,s.yCenter,t,0,lt);else{let o=s.getPointPosition(0,t);n.moveTo(o.x,o.y);for(let a=1;a=Et.indexOf(e);o--){let a=Et[o];if(hi[a].common&&s._adapter.diff(n,i,a)>=t-1)return a}return Et[e?Et.indexOf(e):0]}function $d(s){for(let t=Et.indexOf(s)+1,e=Et.length;t=t?e[i]:e[n];s[o]=!0}}function jd(s,t,e,i){let n=s._adapter,o=+n.startOf(t[0].value,i),a=t[t.length-1].value,r,l;for(r=o;r<=a;r=+n.add(r,1,i))l=e[r],l>=0&&(t[l].major=!0);return t}function Fa(s,t,e){let i=[],n={},o=t.length,a,r;for(a=0;a=s[i].pos&&t<=s[n].pos&&({lo:i,hi:n}=Vt(s,"pos",t)),{pos:o,time:r}=s[i],{pos:a,time:l}=s[n]):(t>=s[i].time&&t<=s[n].time&&({lo:i,hi:n}=Vt(s,"time",t)),{time:o,pos:r}=s[i],{time:a,pos:l}=s[n]);let c=a-o;return c?r+(l-r)*(t-o)/c:r}var pn,jt,Bo,Yl,si,ms,an,Wo,ic,St,we,ke,Yt,Ce,de,je,Se,Ee,za,mn,Va,Na,Ha,yt,bs,ii,ti,Ec,qo,$a,vs,Qo,oi,Mt,$c,Jo,Zo,ge,Ue,bn,Ot,vn,na,Xa,us,_n,ch,dh,uh,ei,ca,Ut,ce,Th,Rt,Me,De,Za,kn,ua,sr,nr,ri,ar,ya,hd,li,lr,xs,cr,Qs,hr,gs,dr,ps,ur,fr,kd,Sd,Ye,qe,Ke,ys,_e,Xe,he,hi,Et,fe,Ge,pr,Ud,br=gi(()=>{Io();pn=class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,n){let o=e.listeners[n],a=e.duration;o.forEach(r=>r({chart:t,initial:e.initial,numSteps:a,currentStep:Math.min(i-e.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=Bi.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,n)=>{if(!i.running||!i.items.length)return;let o=i.items,a=o.length-1,r=!1,l;for(;a>=0;--a)l=o[a],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(t),r=!0):(o[a]=o[o.length-1],o.pop());r&&(n.draw(),this._notify(n,i,t,"progress")),o.length||(i.running=!1,this._notify(n,i,t,"complete"),i.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){let e=this._charts,i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){let e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((i,n)=>Math.max(i,n._duration),0),this._refresh())}running(t){if(!this._running)return!1;let e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){let e=this._charts.get(t);if(!e||!e.items.length)return;let i=e.items,n=i.length-1;for(;n>=0;--n)i[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}},jt=new pn,Bo="transparent",Yl={boolean(s,t,e){return e>.5?t:s},color(s,t,e){let i=Wi(s||Bo),n=i.valid&&Wi(t||Bo);return n&&n.valid?n.mix(i,e).hexString():t},number(s,t,e){return s+(t-s)*e}},si=class{constructor(t,e,i,n){let o=e[i];n=We([t.to,n,o,t.from]);let a=We([t.from,o,n]);this._active=!0,this._fn=t.fn||Yl[t.type||typeof a],this._easing=Ae[t.easing]||Ae.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=a,this._to=n,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);let n=this._target[this._prop],o=i-this._start,a=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=We([t.to,e,n,t.from]),this._from=We([t.from,n,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){let e=t-this._start,i=this._duration,n=this._prop,o=this._from,a=this._loop,r=this._to,l;if(this._active=o!==r&&(a||e1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[n]=this._fn(o,r,l)}wait(){let t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){let e=t?"res":"rej",i=this._promises||[];for(let n=0;n{let o=t[n];if(!tt(o))return;let a={};for(let r of e)a[r]=o[r];(rt(o.properties)&&o.properties||[n]).forEach(r=>{(r===n||!i.has(r))&&i.set(r,a)})})}_animateOptions(t,e){let i=e.options,n=Xl(t,i);if(!n)return[];let o=this._createAnimations(n,i);return i.$shared&&Kl(t.options.$animations,i).then(()=>{t.options=i},()=>{}),o}_createAnimations(t,e){let i=this._properties,n=[],o=t.$animations||(t.$animations={}),a=Object.keys(e),r=Date.now(),l;for(l=a.length-1;l>=0;--l){let c=a[l];if(c.charAt(0)==="$")continue;if(c==="options"){n.push(...this._animateOptions(t,e));continue}let h=e[c],d=o[c],u=i.get(c);if(d)if(u&&d.active()){d.update(u,h,r);continue}else d.cancel();if(!u||!u.duration){t[c]=h;continue}o[c]=d=new si(u,t,c,h),n.push(d)}return n}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}let i=this._createAnimations(t,e);if(i.length)return jt.add(this._chart,i),!0}};an=s=>s==="reset"||s==="none",Wo=(s,t)=>t?s:Object.assign({},s),ic=(s,t,e)=>s&&!t.hidden&&t._stacked&&{keys:Ia(e,!0),values:null},St=class{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){let t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=nn(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&ls(this._cachedMeta),this.index=t}linkScales(){let t=this.chart,e=this._cachedMeta,i=this.getDataset(),n=(d,u,f,m)=>d==="x"?u:d==="r"?m:f,o=e.xAxisID=Q(i.xAxisID,on(t,"x")),a=e.yAxisID=Q(i.yAxisID,on(t,"y")),r=e.rAxisID=Q(i.rAxisID,on(t,"r")),l=e.indexAxis,c=e.iAxisID=n(l,o,a,r),h=e.vAxisID=n(l,a,o,r);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(a),e.rScale=this.getScaleForId(r),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){let e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){let t=this._cachedMeta;this._data&&Fi(this._data,this),t._stacked&&ls(t)}_dataCheck(){let t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(tt(e)){let n=this._cachedMeta;this._data=Ql(e,n)}else if(i!==e){if(i){Fi(i,this);let n=this._cachedMeta;ls(n),n._parsed=[]}e&&Object.isExtensible(e)&&bo(e,this),this._syncList=[],this._data=e}}addElements(){let t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){let e=this._cachedMeta,i=this.getDataset(),n=!1;this._dataCheck();let o=e._stacked;e._stacked=nn(e.vScale,e),e.stack!==i.stack&&(n=!0,ls(e),e.stack=i.stack),this._resyncElements(t),(n||o!==e._stacked)&&(Ho(this,e._parsed),e._stacked=nn(e.vScale,e))}configure(){let t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){let{_cachedMeta:i,_data:n}=this,{iScale:o,_stacked:a}=i,r=o.axis,l=t===0&&e===n.length?!0:i._sorted,c=t>0&&i._parsed[t-1],h,d,u;if(this._parsing===!1)i._parsed=n,i._sorted=!0,u=n;else{rt(n[t])?u=this.parseArrayData(i,n,t,e):tt(n[t])?u=this.parseObjectData(i,n,t,e):u=this.parsePrimitiveData(i,n,t,e);let f=()=>d[r]===null||c&&d[r]b||d=0;--u)if(!m()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){let e=this._cachedMeta._parsed,i=[],n,o,a;for(n=0,o=e.length;n=0&&tthis.getContext(i,n,e),b=c.resolveNamedOptions(u,f,m,d);return b.$shared&&(b.$shared=l,o[a]=Object.freeze(Wo(b,l))),b}_resolveAnimations(t,e,i){let n=this.chart,o=this._cachedDataOpts,a=`animation-${e}`,r=o[a];if(r)return r;let l;if(n.options.animation!==!1){let h=this.chart.config,d=h.datasetAnimationScopeKeys(this._type,e),u=h.getOptionScopes(this.getDataset(),d);l=h.createResolver(u,this.getContext(t,i,e))}let c=new ms(n,l&&l.animations);return l&&l._cacheable&&(o[a]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||an(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){let i=this.resolveDataElementOptions(t,e),n=this._sharedOptions,o=this.getSharedOptions(i),a=this.includeOptions(e,o)||o!==n;return this.updateSharedOptions(o,e,i),{sharedOptions:o,includeOptions:a}}updateElement(t,e,i,n){an(n)?Object.assign(t,i):this._resolveAnimations(e,n).update(t,i)}updateSharedOptions(t,e,i){t&&!an(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,n){t.active=n;let o=this.getStyle(e,n);this._resolveAnimations(e,i,n).update(t,{options:!n&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){let e=this._data,i=this._cachedMeta.data;for(let[r,l,c]of this._syncList)this[r](l,c);this._syncList=[];let n=i.length,o=e.length,a=Math.min(o,n);a&&this.parse(0,a),o>n?this._insertElements(n,o-n,t):o{for(c.length+=e,r=c.length-1;r>=a;r--)c[r]=c[r-e]};for(l(o),r=t;rh.controller.options.grouped),o=i.options.stacked,a=[],r=this._cachedMeta.controller.getParsed(e),l=r&&r[i.axis],c=h=>{let d=h._parsed.find(f=>f[i.axis]===l),u=d&&d[h.vScale.axis];if(Z(u)||isNaN(u))return!0};for(let h of n)if(!(e!==void 0&&c(h))&&((o===!1||a.indexOf(h.stack)===-1||o===void 0&&h.stack===void 0)&&a.push(h.stack),h.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){let t=this.chart.scales,e=this.chart.options.indexAxis;return Object.keys(t).filter(i=>t[i].axis===e).shift()}_getAxis(){let t={},e=this.getFirstScaleIdForIndexAxis();for(let i of this.chart.data.datasets)t[Q(this.chart.options.indexAxis==="x"?i.xAxisID:i.yAxisID,e)]=!0;return Object.keys(t)}_getStackIndex(t,e,i){let n=this._getStacks(t,i),o=e!==void 0?n.indexOf(e):-1;return o===-1?n.length-1:o}_getRuler(){let t=this.options,e=this._cachedMeta,i=e.iScale,n=[],o,a;for(o=0,a=e.data.length;o=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:n,yScale:o}=e,a=this.getParsed(t),r=n.getLabelForValue(a.x),l=o.getLabelForValue(a.y),c=a._custom;return{label:i[t]||"",value:"("+r+", "+l+(c?", "+c:"")+")"}}update(t){let e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,n){let o=n==="reset",{iScale:a,vScale:r}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(e,n),h=a.axis,d=r.axis;for(let u=e;u+i[l];if(tt(i[t])){let{key:l="value"}=this._parsing;o=c=>+Qt(i[c],l)}let a,r;for(a=t,r=t+e;a0&&!isNaN(t)?lt*(Math.abs(t)/e):0}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=Ve(e._parsed[t],i.options.locale);return{label:n[t]||"",value:o}}getMaxBorderWidth(t){let e=0,i=this.chart,n,o,a,r,l;if(!t){for(n=0,o=i.data.datasets.length;nt!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),I(Yt,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data,{labels:{pointStyle:i,textAlign:n,color:o,useBorderRadius:a,borderRadius:r}}=t.legend.options;return e.labels.length&&e.datasets.length?e.labels.map((l,c)=>{let d=t.getDatasetMeta(0).controller.getStyle(c);return{text:l,fillStyle:d.backgroundColor,fontColor:o,hidden:!t.getDataVisibility(c),lineDash:d.borderDash,lineDashOffset:d.borderDashOffset,lineJoin:d.borderJoinStyle,lineWidth:d.borderWidth,strokeStyle:d.borderColor,textAlign:n,pointStyle:i,borderRadius:a&&(r||d.borderRadius),index:c}}):[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}});Ce=class extends St{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){let e=this._cachedMeta,{dataset:i,data:n=[],_dataset:o}=e,a=this.chart._animationsDisabled,{start:r,count:l}=Vi(e,n,a);this._drawStart=r,this._drawCount=l,Ni(e)&&(r=0,l=n.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=n;let c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(i,void 0,{animated:!a,options:c},t),this.updateElements(n,r,l,t)}updateElements(t,e,i,n){let o=n==="reset",{iScale:a,vScale:r,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:h,includeOptions:d}=this._getSharedOptions(e,n),u=a.axis,f=r.axis,{spanGaps:m,segment:b}=this.options,v=ve(m)?m:Number.POSITIVE_INFINITY,y=this.chart._animationsDisabled||o||n==="none",w=e+i,D=t.length,C=e>0&&this.getParsed(e-1);for(let _=0;_=w){g.skip=!0;continue}let x=this.getParsed(_),k=Z(x[f]),S=g[u]=a.getPixelForValue(x[u],_),M=g[f]=o||k?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,x,l):x[f],_);g.skip=isNaN(S)||isNaN(M)||k,g.stop=_>0&&Math.abs(x[u]-C[u])>v,b&&(g.parsed=x,g.raw=c.data[_]),d&&(g.options=h||this.resolveDataElementOptions(_,p.active?"active":n)),y||this.updateElement(p,_,g,n),C=x}}getMaxOverflow(){let t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,n=t.data||[];if(!n.length)return i;let o=n[0].size(this.resolveDataElementOptions(0)),a=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(i,o,a)/2}draw(){let t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}};I(Ce,"id","line"),I(Ce,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),I(Ce,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});de=class extends St{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=Ve(e._parsed[t].r,i.options.locale);return{label:n[t]||"",value:o}}parseObjectData(t,e,i,n){return Gi.bind(this)(t,e,i,n)}update(t){let e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){let t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((i,n)=>{let o=this.getParsed(n).r;!isNaN(o)&&this.chart.getDataVisibility(n)&&(oe.max&&(e.max=o))}),e}_updateRadius(){let t=this.chart,e=t.chartArea,i=t.options,n=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(n/2,0),a=Math.max(i.cutoutPercentage?o/100*i.cutoutPercentage:1,0),r=(o-a)/t.getVisibleDatasetCount();this.outerRadius=o-r*this.index,this.innerRadius=this.outerRadius-r}updateElements(t,e,i,n){let o=n==="reset",a=this.chart,l=a.options.animation,c=this._cachedMeta.rScale,h=c.xCenter,d=c.yCenter,u=c.getIndexAngle(0)-.5*st,f=u,m,b=360/this.countVisibleElements();for(m=0;m{!isNaN(this.getParsed(n).r)&&this.chart.getDataVisibility(n)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?Pt(this.resolveDataElementOptions(t,e).angle||i):0}};I(de,"id","polarArea"),I(de,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),I(de,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data;if(e.labels.length&&e.datasets.length){let{labels:{pointStyle:i,color:n}}=t.legend.options;return e.labels.map((o,a)=>{let l=t.getDatasetMeta(0).controller.getStyle(a);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:n,lineWidth:l.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}});je=class extends Yt{};I(je,"id","pie"),I(je,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});Se=class extends St{getLabelAndValue(t){let e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,n){return Gi.bind(this)(t,e,i,n)}update(t){let e=this._cachedMeta,i=e.dataset,n=e.data||[],o=e.iScale.getLabels();if(i.points=n,t!=="resize"){let a=this.resolveDatasetElementOptions(t);this.options.showLine||(a.borderWidth=0);let r={_loop:!0,_fullLoop:o.length===n.length,options:a};this.updateElement(i,void 0,r,t)}this.updateElements(n,0,n.length,t)}updateElements(t,e,i,n){let o=this._cachedMeta.rScale,a=n==="reset";for(let r=e;r0&&this.getParsed(e-1);for(let C=e;C0&&Math.abs(p[f]-D[f])>y,v&&(g.parsed=p,g.raw=c.data[C]),u&&(g.options=d||this.resolveDataElementOptions(C,_.active?"active":n)),w||this.updateElement(_,C,g,n),D=p}this.updateSharedOptions(d,n,h)}getMaxOverflow(){let t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let r=0;for(let l=e.length-1;l>=0;--l)r=Math.max(r,e[l].size(this.resolveDataElementOptions(l))/2);return r>0&&r}let i=t.dataset,n=i.options&&i.options.borderWidth||0;if(!e.length)return n;let o=e[0].size(this.resolveDataElementOptions(0)),a=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(n,o,a)/2}};I(Ee,"id","scatter"),I(Ee,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),I(Ee,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}});za=Object.freeze({__proto__:null,BarController:we,BubbleController:ke,DoughnutController:Yt,LineController:Ce,PieController:je,PolarAreaController:de,RadarController:Se,ScatterController:Ee});mn=class s{constructor(t){I(this,"options");this.options=t||{}}static override(t){Object.assign(s.prototype,t)}init(){}formats(){return ye()}parse(){return ye()}format(){return ye()}add(){return ye()}diff(){return ye()}startOf(){return ye()}endOf(){return ye()}},Va={_date:mn};Na={evaluateInteractionItems:_s,modes:{index(s,t,e,i){let n=le(t,s),o=e.axis||"x",a=e.includeInvisible||!1,r=e.intersect?ln(s,n,o,i,a):cn(s,n,o,!1,i,a),l=[];return r.length?(s.getSortedVisibleDatasetMetas().forEach(c=>{let h=r[0].index,d=c.data[h];d&&!d.skip&&l.push({element:d,datasetIndex:c.index,index:h})}),l):[]},dataset(s,t,e,i){let n=le(t,s),o=e.axis||"xy",a=e.includeInvisible||!1,r=e.intersect?ln(s,n,o,i,a):cn(s,n,o,!1,i,a);if(r.length>0){let l=r[0].datasetIndex,c=s.getDatasetMeta(l).data;r=[];for(let h=0;h{typeof b.beforeLayout=="function"&&b.beforeLayout()});let h=l.reduce((b,v)=>v.box.options&&v.box.options.display===!1?b:b+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:e,padding:n,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/h,hBoxMaxHeight:a/2}),u=Object.assign({},n);Wa(u,xt(i));let f=Object.assign({maxPadding:u,w:o,h:a,x:n.left,y:n.top},n),m=_c(l.concat(c),d);fs(r.fullSize,f,d,m),fs(l,f,d,m),fs(c,f,d,m)&&fs(l,f,d,m),Cc(f),Go(r.leftAndTop,f,d,m),f.x+=f.w,f.y+=f.h,Go(r.rightAndBottom,f,d,m),s.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},nt(r.chartArea,b=>{let v=b.box;Object.assign(v,s.chartArea),v.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}},bs=class{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,n){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,n?Math.floor(e/n):i)}}isAttached(t){return!0}updateConfig(t){}},ii=class extends bs{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}},ti="$chartjs",Ec={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},qo=s=>s===null||s==="";$a=Po?{passive:!0}:!1;vs=new Map,Qo=0;oi=class extends bs{acquireContext(t,e){let i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(Mc(t,e),i):null}releaseContext(t){let e=t.canvas;if(!e[ti])return!1;let i=e[ti].initial;["height","width"].forEach(o=>{let a=i[o];Z(a)?e.removeAttribute(o):e.setAttribute(o,a)});let n=i.style||{};return Object.keys(n).forEach(o=>{e.style[o]=n[o]}),e.width=e.width,delete e[ti],!0}addEventListener(t,e,i){this.removeEventListener(t,e);let n=t.$proxies||(t.$proxies={}),a={attach:Pc,detach:Ac,resize:Fc}[e]||Ic;n[e]=a(t,e,i)}removeEventListener(t,e){let i=t.$proxies||(t.$proxies={}),n=i[e];if(!n)return;({attach:hn,detach:hn,resize:hn}[e]||Tc)(t,e,n),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,n){return Lo(t,e,i,n)}isAttached(t){let e=t&&Ys(t);return!!(e&&e.isConnected)}};Mt=class{constructor(){I(this,"x");I(this,"y");I(this,"active",!1);I(this,"options");I(this,"$animations")}tooltipPosition(t){let{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return ve(this.x)&&ve(this.y)}getProps(t,e){let i=this.$animations;if(!e||!i)return this;let n={};return t.forEach(o=>{n[o]=i[o]&&i[o].active()?i[o]._to:this[o]}),n}};I(Mt,"defaults",{}),I(Mt,"defaultRoutes");$c=s=>s==="left"?"right":s==="right"?"left":s,Jo=(s,t,e)=>t==="top"||t==="left"?s[t]+e:s[t]-e,Zo=(s,t)=>Math.min(t||s,s);ge=class s extends Mt{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.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(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:n}=this;return t=kt(t,Number.POSITIVE_INFINITY),e=kt(e,Number.NEGATIVE_INFINITY),i=kt(i,Number.POSITIVE_INFINITY),n=kt(n,Number.NEGATIVE_INFINITY),{min:kt(t,i),max:kt(e,n),minDefined:ht(t),maxDefined:ht(e)}}getMinMax(t){let{min:e,max:i,minDefined:n,maxDefined:o}=this.getUserBounds(),a;if(n&&o)return{min:e,max:i};let r=this.getMatchingVisibleMetas();for(let l=0,c=r.length;li?i:e,i=n&&e>i?e:i,{min:kt(e,kt(i,e)),max:kt(i,kt(e,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){ot(this.options.beforeUpdate,[this])}update(t,e,i){let{beginAtZero:n,grace:o,ticks:a}=this.options,r=a.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=Co(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let l=r=o||i<=1||!this.isHorizontal()){this.labelRotation=n;return}let h=this._getLabelSizes(),d=h.widest.width,u=h.highest.height,f=gt(this.chart.width-d,0,this.maxWidth);r=t.offset?this.maxWidth/i:f/(i-1),d+6>r&&(r=f/(i-(t.offset?.5:1)),l=this.maxHeight-ds(t.grid)-e.padding-ea(t.title,this.chart.options.font),c=Math.sqrt(d*d+u*u),a=zs(Math.min(Math.asin(gt((h.highest.height+6)/r,-1,1)),Math.asin(gt(l/c,-1,1))-Math.asin(gt(u/c,-1,1)))),a=Math.max(n,Math.min(o,a))),this.labelRotation=a}afterCalculateLabelRotation(){ot(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){ot(this.options.beforeFit,[this])}fit(){let t={width:0,height:0},{chart:e,options:{ticks:i,title:n,grid:o}}=this,a=this._isVisible(),r=this.isHorizontal();if(a){let l=ea(n,e.options.font);if(r?(t.width=this.maxWidth,t.height=ds(o)+l):(t.height=this.maxHeight,t.width=ds(o)+l),i.display&&this.ticks.length){let{first:c,last:h,widest:d,highest:u}=this._getLabelSizes(),f=i.padding*2,m=Pt(this.labelRotation),b=Math.cos(m),v=Math.sin(m);if(r){let y=i.mirror?0:v*d.width+b*u.height;t.height=Math.min(this.maxHeight,t.height+y+f)}else{let y=i.mirror?0:b*d.width+v*u.height;t.width=Math.min(this.maxWidth,t.width+y+f)}this._calculatePadding(c,h,v,b)}}this._handleMargins(),r?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,n){let{ticks:{align:o,padding:a},position:r}=this.options,l=this.labelRotation!==0,c=r!=="top"&&this.axis==="x";if(this.isHorizontal()){let h=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1),u=0,f=0;l?c?(u=n*t.width,f=i*e.height):(u=i*t.height,f=n*e.width):o==="start"?f=e.width:o==="end"?u=t.width:o!=="inner"&&(u=t.width/2,f=e.width/2),this.paddingLeft=Math.max((u-h+a)*this.width/(this.width-h),0),this.paddingRight=Math.max((f-d+a)*this.width/(this.width-d),0)}else{let h=e.height/2,d=t.height/2;o==="start"?(h=0,d=t.height):o==="end"&&(h=e.height,d=0),this.paddingTop=h+a,this.paddingBottom=d+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(){ot(this.options.afterFit,[this])}isHorizontal(){let{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,i;for(e=0,i=t.length;e({width:a[k]||0,height:r[k]||0});return{first:x(0),last:x(e-1),widest:x(p),highest:x(g),widths:a,heights:r}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){let e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);let e=this._startPixel+t*this._length;return fo(this._alignToPixels?oe(this.chart,e,0):e)}getDecimalForPixel(t){let e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){let e=this.ticks||[];if(t>=0&&tr*n?r/i:l/n:l*n0}_computeGridLineItems(t){let e=this.axis,i=this.chart,n=this.options,{grid:o,position:a,border:r}=n,l=o.offset,c=this.isHorizontal(),d=this.ticks.length+(l?1:0),u=ds(o),f=[],m=r.setContext(this.getContext()),b=m.display?m.width:0,v=b/2,y=function(z){return oe(i,z,b)},w,D,C,_,p,g,x,k,S,M,R,K;if(a==="top")w=y(this.bottom),g=this.bottom-u,k=w-v,M=y(t.top)+v,K=t.bottom;else if(a==="bottom")w=y(this.top),M=t.top,K=y(t.bottom)-v,g=w+v,k=this.top+u;else if(a==="left")w=y(this.right),p=this.right-u,x=w-v,S=y(t.left)+v,R=t.right;else if(a==="right")w=y(this.left),S=t.left,R=y(t.right)-v,p=w+v,x=this.left+u;else if(e==="x"){if(a==="center")w=y((t.top+t.bottom)/2+.5);else if(tt(a)){let z=Object.keys(a)[0],O=a[z];w=y(this.chart.scales[z].getPixelForValue(O))}M=t.top,K=t.bottom,g=w+v,k=g+u}else if(e==="y"){if(a==="center")w=y((t.left+t.right)/2);else if(tt(a)){let z=Object.keys(a)[0],O=a[z];w=y(this.chart.scales[z].getPixelForValue(O))}p=w-v,x=p-u,S=t.left,R=t.right}let B=Q(n.ticks.maxTicksLimit,d),P=Math.max(1,Math.ceil(d/B));for(D=0;D0&&(T-=H/2);break}E={left:T,top:U,width:H+$.width,height:N+$.height,color:P.backdropColor}}v.push({label:C,font:k,textOffset:R,options:{rotation:b,color:O,strokeColor:G,strokeWidth:V,textAlign:j,textBaseline:K,translation:[_,p],backdrop:E}})}return v}_getXAxisLabelAlignment(){let{position:t,ticks:e}=this.options;if(-Pt(this.labelRotation))return t==="top"?"left":"right";let n="center";return e.align==="start"?n="left":e.align==="end"?n="right":e.align==="inner"&&(n="inner"),n}_getYAxisLabelAlignment(t){let{position:e,ticks:{crossAlign:i,mirror:n,padding:o}}=this.options,a=this._getLabelSizes(),r=t+o,l=a.widest.width,c,h;return e==="left"?n?(h=this.right+o,i==="near"?c="left":i==="center"?(c="center",h+=l/2):(c="right",h+=l)):(h=this.right-r,i==="near"?c="right":i==="center"?(c="center",h-=l/2):(c="left",h=this.left)):e==="right"?n?(h=this.left+o,i==="near"?c="right":i==="center"?(c="center",h-=l/2):(c="left",h-=l)):(h=this.left+r,i==="near"?c="left":i==="center"?(c="center",h+=l/2):(c="right",h=this.right)):c="right",{textAlign:c,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;let t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){let{ctx:t,options:{backgroundColor:e},left:i,top:n,width:o,height:a}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,n,o,a),t.restore())}getLineWidthForValue(t){let e=this.options.grid;if(!this._isVisible()||!e.display)return 0;let n=this.ticks.findIndex(o=>o.value===t);return n>=0?e.setContext(this.getContext(n)).lineWidth:0}drawGrid(t){let e=this.options.grid,i=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t)),o,a,r=(l,c,h)=>{!h.width||!h.color||(i.save(),i.lineWidth=h.width,i.strokeStyle=h.color,i.setLineDash(h.borderDash||[]),i.lineDashOffset=h.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(e.display)for(o=0,a=n.length;o{this.draw(o)}}]:[{z:i,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){let e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",n=[],o,a;for(o=0,a=e.length;o{let o=i||this._getRegistryForType(n);i||o.isForType(n)||o===this.plugins&&n.id?this._exec(t,o,n):nt(n,a=>{let r=i||this._getRegistryForType(a);this._exec(t,r,a)})})}_exec(t,e,i){let n=Bs(t);ot(i["before"+n],[],i),e[t](i),ot(i["after"+n],[],i)}_getRegistryForType(t){for(let e=0;eo.filter(r=>!a.some(l=>r.plugin.id===l.plugin.id));this._notify(n(e,i),t,"stop"),this._notify(n(i,e),t,"start")}};na=new Map,Xa=new Set;us=(s,t,e)=>{let i=Qt(t,e);i!==void 0&&s.add(i)},_n=class{constructor(t){this._config=lh(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Ka(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){let t=this._config;this.clearCache(),Ya(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return qs(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return qs(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return qs(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){let e=t.id,i=this.type;return qs(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){let i=this._scopeCache,n=i.get(t);return(!n||e)&&(n=new Map,i.set(t,n)),n}getOptionScopes(t,e,i){let{options:n,type:o}=this,a=this._cachedScopes(t,i),r=a.get(e);if(r)return r;let l=new Set;e.forEach(h=>{t&&(l.add(t),h.forEach(d=>us(l,t,d))),h.forEach(d=>us(l,n,d)),h.forEach(d=>us(l,ne[o]||{},d)),h.forEach(d=>us(l,ct,d)),h.forEach(d=>us(l,Hs,d))});let c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Xa.has(e)&&a.set(e,c),c}chartOptionScopes(){let{options:t,type:e}=this;return[t,ne[e]||{},ct.datasets[e]||{},{type:e},ct,Hs]}resolveNamedOptions(t,e,i,n=[""]){let o={$shared:!0},{resolver:a,subPrefixes:r}=oa(this._resolverCache,t,n),l=a;if(hh(a,e)){o.$shared=!1,i=Gt(i)?i():i;let c=this.createResolver(t,i,r);l=be(a,i,c)}for(let c of e)o[c]=l[c];return o}createResolver(t,e,i=[""],n){let{resolver:o}=oa(this._resolverCache,t,i);return tt(e)?be(o,e,void 0,n):o}};ch=s=>tt(s)&&Object.getOwnPropertyNames(s).some(t=>Gt(s[t]));dh="4.5.1",uh=["top","bottom","left","right","chartArea"];ei={},ca=s=>{let t=Ga(s);return Object.values(ei).filter(e=>e.canvas===t).pop()};Ut=class{static register(...t){Ot.add(...t),ha()}static unregister(...t){Ot.remove(...t),ha()}constructor(t,e){let i=this.config=new _n(e),n=Ga(t),o=ca(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");let a=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||Ua(n)),this.platform.updateConfig(i);let r=this.platform.acquireContext(n,a.aspectRatio),l=r&&r.canvas,c=l&&l.height,h=l&&l.width;if(this.id=ao(),this.ctx=r,this.canvas=l,this.width=h,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 vn,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=vo(d=>this.update(d),a.resizeDelay||0),this._dataChanges=[],ei[this.id]=this,!r||!l){console.error("Failed to create chart: can't acquire context from the given item");return}jt.listen(this,"complete",la),jt.listen(this,"progress",fh),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:n,_aspectRatio:o}=this;return Z(t)?e&&o?o:n?i/n:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return Ot}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():qi(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return $i(this.canvas,this.ctx),this}stop(){return jt.stop(this),this}resize(t,e){jt.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){let i=this.options,n=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(n,t,e,o),r=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,qi(this,r,!0)&&(this.notifyPlugins("resize",{size:a}),ot(i.onResize,[this,a],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){let e=this.options.scales||{};nt(e,(i,n)=>{i.id=n})}buildOrUpdateScales(){let t=this.options,e=t.scales,i=this.scales,n=Object.keys(i).reduce((a,r)=>(a[r]=!1,a),{}),o=[];e&&(o=o.concat(Object.keys(e).map(a=>{let r=e[a],l=yn(a,r),c=l==="r",h=l==="x";return{options:r,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),nt(o,a=>{let r=a.options,l=r.id,c=yn(l,r),h=Q(r.type,a.dtype);(r.position===void 0||aa(r.position,c)!==aa(a.dposition))&&(r.position=a.dposition),n[l]=!0;let d=null;if(l in i&&i[l].type===h)d=i[l];else{let u=Ot.getScale(h);d=new u({id:l,type:h,ctx:this.ctx,chart:this}),i[d.id]=d}d.init(r,t)}),nt(n,(a,r)=>{a||delete i[r]}),nt(i,a=>{yt.configure(this,a,a.options),yt.addBox(this,a)})}_updateMetasets(){let t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((n,o)=>n.index-o.index),i>e){for(let n=e;ne.length&&delete this._stacks,t.forEach((i,n)=>{e.filter(o=>o===i._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){let t=[],e=this.data.datasets,i,n;for(this._removeUnreferencedMetasets(),i=0,n=e.length;i{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){let e=this.config;e.update();let i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),n=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;let o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let c=0,h=this.data.datasets.length;c{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(ra("z","_idx"));let{_active:r,_lastEvent:l}=this;l?this._eventHandler(l,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){nt(this.scales,t=>{yt.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!Li(e,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(let{method:i,start:n,count:o}of e){let a=i==="_removeElements"?-o:o;gh(t,n,a)}}_getUniformDataChanges(){let t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];let e=this.data.datasets.length,i=o=>new Set(t.filter(a=>a[0]===o).map((a,r)=>r+","+a.splice(1).join(","))),n=i(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;yt.update(this,this.width,this.height,t);let e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],nt(this.boxes,n=>{i&&n.position==="chartArea"||(n.configure&&n.configure(),this._layers.push(...n._layers()))},this),this._layers.forEach((n,o)=>{n._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,i=this.data.datasets.length;e=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){let e=this.ctx,i={meta:t,index:t.index,cancelable:!0},n=sn(this,t);this.notifyPlugins("beforeDatasetDraw",i)!==!1&&(n&&as(e,n),t.controller.draw(),n&&rs(e),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(t){return Nt(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,n){let o=Na.modes[e];return typeof o=="function"?o(this,t,i,n):[]}getDatasetMeta(t){let e=this.data.datasets[t],i=this._metasets,n=i.filter(o=>o&&o._dataset===e).pop();return n||(n={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(n)),n}getContext(){return this.$context||(this.$context=Jt(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){let e=this.data.datasets[t];if(!e)return!1;let i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!e.hidden}setDatasetVisibility(t,e){let i=this.getDatasetMeta(t);i.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){let n=i?"show":"hide",o=this.getDatasetMeta(t),a=o.controller._resolveAnimations(void 0,n);Ie(e)?(o.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),a.update(o,{visible:i}),this.update(r=>r.datasetIndex===t?n:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){let e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),jt.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,o,a),t[o]=a},n=(o,a,r)=>{o.offsetX=a,o.offsetY=r,this._eventHandler(o)};nt(this.options.events,o=>i(o,n))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});let t=this._responsiveListeners,e=this.platform,i=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},n=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)},a,r=()=>{n("attach",r),this.attached=!0,this.resize(),i("resize",o),i("detach",a)};a=()=>{this.attached=!1,n("resize",o),this._stop(),this._resize(0,0),i("attach",r)},e.isAttached(this.canvas)?r():a()}unbindEvents(){nt(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},nt(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){let n=i?"set":"remove",o,a,r,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+n+"DatasetHoverStyle"]()),r=0,l=t.length;r{let r=this.getDatasetMeta(o);if(!r)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:r.data[a],index:a}});!os(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,i){let n=this.options.hover,o=(l,c)=>l.filter(h=>!c.some(d=>h.datasetIndex===d.datasetIndex&&h.index===d.index)),a=o(e,t),r=i?t:o(t,e);a.length&&this.updateHoverStyle(a,n.mode,!1),r.length&&n.mode&&this.updateHoverStyle(r,n.mode,!0)}_eventHandler(t,e){let i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},n=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,n)===!1)return;let o=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,n),(o||i.changed)&&this.render(),this}_handleEvent(t,e,i){let{_active:n=[],options:o}=this,a=e,r=this._getActiveElements(t,n,i,a),l=co(t),c=ph(t,this._lastEvent,i,l);i&&(this._lastEvent=null,ot(o.onHover,[t,r,this],this),l&&ot(o.onClick,[t,r,this],this));let h=!os(r,n);return(h||e)&&(this._active=r,this._updateHoverStyles(r,n,e)),this._lastEvent=c,h}_getActiveElements(t,e,i,n){if(t.type==="mouseout")return[];if(!i)return e;let o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,n)}};I(Ut,"defaults",ct),I(Ut,"instances",ei),I(Ut,"overrides",ne),I(Ut,"registry",Ot),I(Ut,"version",dh),I(Ut,"getChart",ca);ce=class extends Mt{constructor(e){super();I(this,"circumference");I(this,"endAngle");I(this,"fullCircles");I(this,"innerRadius");I(this,"outerRadius");I(this,"pixelMargin");I(this,"startAngle");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,i,n){let o=this.getProps(["x","y"],n),{angle:a,distance:r}=Ri(o,{x:e,y:i}),{startAngle:l,endAngle:c,innerRadius:h,outerRadius:d,circumference:u}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],n),f=(this.options.spacing+this.options.borderWidth)/2,m=Q(u,c-l),b=ze(a,l,c)&&l!==c,v=m>=lt||b,y=Wt(r,h+f,d+f);return v&&y}getCenterPoint(e){let{x:i,y:n,startAngle:o,endAngle:a,innerRadius:r,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:c,spacing:h}=this.options,d=(o+a)/2,u=(r+l+h+c)/2;return{x:i+Math.cos(d)*u,y:n+Math.sin(d)*u}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){let{options:i,circumference:n}=this,o=(i.offset||0)/4,a=(i.spacing||0)/2,r=i.circular;if(this.pixelMargin=i.borderAlign==="inner"?.33:0,this.fullCircles=n>lt?Math.floor(n/lt):0,n===0||this.innerRadius<0||this.outerRadius<0)return;e.save();let l=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(l)*o,Math.sin(l)*o);let c=1-Math.sin(Math.min(st,n||0)),h=o*c;e.fillStyle=i.backgroundColor,e.strokeStyle=i.borderColor,yh(e,this,h,a,r),_h(e,this,h,a,r),e.restore()}};I(ce,"id","arc"),I(ce,"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}),I(ce,"defaultRoutes",{backgroundColor:"backgroundColor"}),I(ce,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"});Th=typeof Path2D=="function";Rt=class extends Mt{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){let i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){let n=i.spanGaps?this._loop:this._fullLoop;To(this._points,i,t,n,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Fo(this,this.options.segment))}first(){let t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){let t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){let i=this.options,n=t[e],o=this.points,a=en(this,{property:e,start:n,end:n});if(!a.length)return;let r=[],l=Eh(i),c,h;for(c=0,h=a.length;ct!=="borderDash"&&t!=="fill"});Me=class extends Mt{constructor(e){super();I(this,"parsed");I(this,"skip");I(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,e&&Object.assign(this,e)}inRange(e,i,n){let o=this.options,{x:a,y:r}=this.getProps(["x","y"],n);return Math.pow(e-a,2)+Math.pow(i-r,2)s.replace("rgb(","rgba(").replace(")",", 0.5)"));sr={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(s,t,e){if(!e.enabled)return;let{data:{datasets:i},options:n}=s.config,{elements:o}=n,a=fa(i)||Nh(n)||o&&fa(o)||Hh();if(!e.forceOverride&&a)return;let r=Vh(s);i.forEach(r)}};nr={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(s,t,e)=>{if(!e.enabled){ga(s);return}let i=s.width;s.data.datasets.forEach((n,o)=>{let{_data:a,indexAxis:r}=n,l=s.getDatasetMeta(o),c=a||n.data;if(We([r,s.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;let h=s.scales[l.xAxisID];if(h.type!=="linear"&&h.type!=="time"||s.options.parsing)return;let{start:d,count:u}=jh(l,c),f=e.threshold||4*i;if(u<=f){ir(n);return}Z(a)&&(n._data=c,delete n.data,Object.defineProperty(n,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(b){this._data=b}}));let m;switch(e.algorithm){case"lttb":m=Wh(c,d,u,i,e);break;case"min-max":m=$h(c,d,u,i);break;default:throw new Error(`Unsupported decimation algorithm '${e.algorithm}'`)}n._decimated=m})},destroy(s){ga(s)}};ri=class{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){let{x:n,y:o,radius:a}=this;return e=e||{start:0,end:lt},t.arc(n,o,a,e.end,e.start,!0),!i.bounds}interpolate(t){let{x:e,y:i,radius:n}=this,o=t.angle;return{x:e+Math.cos(o)*n,y:i+Math.sin(o)*n,angle:o}}};ar={id:"filler",afterDatasetsUpdate(s,t,e){let i=(s.data.datasets||[]).length,n=[],o,a,r,l;for(a=0;a=0;--a){let r=n[a].$filler;r&&(r.line.updateControlPoints(o,r.axis),i&&r.fill&&fn(s.ctx,r,o))}},beforeDatasetsDraw(s,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;let i=s.getSortedVisibleDatasetMetas();for(let n=i.length-1;n>=0;--n){let o=i[n].$filler;ma(o)&&fn(s.ctx,o,s.chartArea)}},beforeDatasetDraw(s,t,e){let i=t.meta.$filler;!ma(i)||e.drawTime!=="beforeDatasetDraw"||fn(s.ctx,i,s.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}},ya=(s,t)=>{let{boxHeight:e=t,boxWidth:i=t}=s;return s.usePointStyle&&(e=Math.min(e,t),i=s.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:e,itemHeight:Math.max(t,e)}},hd=(s,t)=>s!==null&&t!==null&&s.datasetIndex===t.datasetIndex&&s.index===t.index,li=class extends Mt{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){let t=this.options.labels||{},e=ot(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(i=>t.filter(i,this.chart.data))),t.sort&&(e=e.sort((i,n)=>t.sort(i,n,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){let{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}let i=t.labels,n=ft(i.font),o=n.size,a=this._computeTitleHeight(),{boxWidth:r,itemHeight:l}=ya(i,o),c,h;e.font=n.string,this.isHorizontal()?(c=this.maxWidth,h=this._fitRows(a,o,r,l)+10):(h=this.maxHeight,c=this._fitCols(a,n,r,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,n){let{ctx:o,maxWidth:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],h=n+r,d=t;o.textAlign="left",o.textBaseline="middle";let u=-1,f=-h;return this.legendItems.forEach((m,b)=>{let v=i+e/2+o.measureText(m.text).width;(b===0||c[c.length-1]+v+2*r>a)&&(d+=h,c[c.length-(b>0?0:1)]=0,f+=h,u++),l[b]={left:0,top:f,row:u,width:v,height:n},c[c.length-1]+=v+r}),d}_fitCols(t,e,i,n){let{ctx:o,maxHeight:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],h=a-t,d=r,u=0,f=0,m=0,b=0;return this.legendItems.forEach((v,y)=>{let{itemWidth:w,itemHeight:D}=dd(i,e,o,v,n);y>0&&f+D+2*r>h&&(d+=u+r,c.push({width:u,height:f}),m+=u+r,b++,u=f=0),l[y]={left:m,top:f,col:b,width:w,height:D},u=Math.max(u,w),f+=D+r}),d+=u,c.push({width:u,height:f}),d}adjustHitBoxes(){if(!this.options.display)return;let t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:n},rtl:o}}=this,a=xe(o,this.left,this.width);if(this.isHorizontal()){let r=0,l=vt(i,this.left+n,this.right-this.lineWidths[r]);for(let c of e)r!==c.row&&(r=c.row,l=vt(i,this.left+n,this.right-this.lineWidths[r])),c.top+=this.top+t+n,c.left=a.leftForLtr(a.x(l),c.width),l+=c.width+n}else{let r=0,l=vt(i,this.top+t+n,this.bottom-this.columnSizes[r].height);for(let c of e)c.col!==r&&(r=c.col,l=vt(i,this.top+t+n,this.bottom-this.columnSizes[r].height)),c.top=l,c.left+=this.left+n,c.left=a.leftForLtr(a.x(c.left),c.width),l+=c.height+n}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){let t=this.ctx;as(t,this),this._draw(),rs(t)}}_draw(){let{options:t,columnSizes:e,lineWidths:i,ctx:n}=this,{align:o,labels:a}=t,r=ct.color,l=xe(t.rtl,this.left,this.width),c=ft(a.font),{padding:h}=a,d=c.size,u=d/2,f;this.drawTitle(),n.textAlign=l.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=c.string;let{boxWidth:m,boxHeight:b,itemHeight:v}=ya(a,d),y=function(p,g,x){if(isNaN(m)||m<=0||isNaN(b)||b<0)return;n.save();let k=Q(x.lineWidth,1);if(n.fillStyle=Q(x.fillStyle,r),n.lineCap=Q(x.lineCap,"butt"),n.lineDashOffset=Q(x.lineDashOffset,0),n.lineJoin=Q(x.lineJoin,"miter"),n.lineWidth=k,n.strokeStyle=Q(x.strokeStyle,r),n.setLineDash(Q(x.lineDash,[])),a.usePointStyle){let S={radius:b*Math.SQRT2/2,pointStyle:x.pointStyle,rotation:x.rotation,borderWidth:k},M=l.xPlus(p,m/2),R=g+u;ji(n,S,M,R,a.pointStyleWidth&&m)}else{let S=g+Math.max((d-b)/2,0),M=l.leftForLtr(p,m),R=re(x.borderRadius);n.beginPath(),Object.values(R).some(K=>K!==0)?He(n,{x:M,y:S,w:m,h:b,radius:R}):n.rect(M,S,m,b),n.fill(),k!==0&&n.stroke()}n.restore()},w=function(p,g,x){ae(n,x.text,p,g+v/2,c,{strikethrough:x.hidden,textAlign:l.textAlign(x.textAlign)})},D=this.isHorizontal(),C=this._computeTitleHeight();D?f={x:vt(o,this.left+h,this.right-i[0]),y:this.top+h+C,line:0}:f={x:this.left+h,y:vt(o,this.top+C+h,this.bottom-e[0].height),line:0},Ji(this.ctx,t.textDirection);let _=v+h;this.legendItems.forEach((p,g)=>{n.strokeStyle=p.fontColor,n.fillStyle=p.fontColor;let x=n.measureText(p.text).width,k=l.textAlign(p.textAlign||(p.textAlign=a.textAlign)),S=m+u+x,M=f.x,R=f.y;l.setWidth(this.width),D?g>0&&M+S+h>this.right&&(R=f.y+=_,f.line++,M=f.x=vt(o,this.left+h,this.right-i[f.line])):g>0&&R+_>this.bottom&&(M=f.x=M+e[f.line].width+h,f.line++,R=f.y=vt(o,this.top+C+h,this.bottom-e[f.line].height));let K=l.x(M);if(y(K,R,p),M=xo(k,M+m+u,D?M+S:this.right,t.rtl),w(l.x(M),R,p),D)f.x+=S+h;else if(typeof p.text!="string"){let B=c.lineHeight;f.y+=rr(p,B)+h}else f.y+=_}),Zi(this.ctx,t.textDirection)}drawTitle(){let t=this.options,e=t.title,i=ft(e.font),n=xt(e.padding);if(!e.display)return;let o=xe(t.rtl,this.left,this.width),a=this.ctx,r=e.position,l=i.size/2,c=n.top+l,h,d=this.left,u=this.width;if(this.isHorizontal())u=Math.max(...this.lineWidths),h=this.top+c,d=vt(t.align,d,this.right-u);else{let m=this.columnSizes.reduce((b,v)=>Math.max(b,v.height),0);h=c+vt(t.align,this.top,this.bottom-m-t.labels.padding-this._computeTitleHeight())}let f=vt(r,d,d+u);a.textAlign=o.textAlign(Ns(r)),a.textBaseline="middle",a.strokeStyle=e.color,a.fillStyle=e.color,a.font=i.string,ae(a,e.text,f,h,i)}_computeTitleHeight(){let t=this.options.title,e=ft(t.font),i=xt(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,n,o;if(Wt(t,this.left,this.right)&&Wt(e,this.top,this.bottom)){for(o=this.legendHitBoxes,i=0;is.chart.options.color,boxWidth:40,padding:10,generateLabels(s){let t=s.data.datasets,{labels:{usePointStyle:e,pointStyle:i,textAlign:n,color:o,useBorderRadius:a,borderRadius:r}}=s.legend.options;return s._getSortedDatasetMetas().map(l=>{let c=l.controller.getStyle(e?0:void 0),h=xt(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:c.borderColor,pointStyle:i||c.pointStyle,rotation:c.rotation,textAlign:n||c.textAlign,borderRadius:a&&(r||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:s=>s.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:s=>!s.startsWith("on"),labels:{_scriptable:s=>!["generateLabels","filter","sort"].includes(s)}}},xs=class extends Mt{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){let i=this.options;if(this.left=0,this.top=0,!i.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;let n=rt(i.text)?i.text.length:1;this._padding=xt(i.padding);let o=n*ft(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){let t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){let{top:e,left:i,bottom:n,right:o,options:a}=this,r=a.align,l=0,c,h,d;return this.isHorizontal()?(h=vt(r,i,o),d=e+t,c=o-i):(a.position==="left"?(h=i+t,d=vt(r,n,e),l=st*-.5):(h=o-t,d=vt(r,e,n),l=st*.5),c=n-e),{titleX:h,titleY:d,maxWidth:c,rotation:l}}draw(){let t=this.ctx,e=this.options;if(!e.display)return;let i=ft(e.font),o=i.lineHeight/2+this._padding.top,{titleX:a,titleY:r,maxWidth:l,rotation:c}=this._drawArgs(o);ae(t,e.text,0,0,i,{color:e.color,maxWidth:l,rotation:c,textAlign:Ns(e.align),textBaseline:"middle",translation:[a,r]})}};cr={id:"title",_element:xs,start(s,t,e){pd(s,e)},stop(s){let t=s.titleBlock;yt.removeBox(s,t),delete s.titleBlock},beforeUpdate(s,t,e){let i=s.titleBlock;yt.configure(s,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}},Qs=new WeakMap,hr={id:"subtitle",start(s,t,e){let i=new xs({ctx:s.ctx,options:e,chart:s});yt.configure(s,i,e),yt.addBox(s,i),Qs.set(s,i)},stop(s){yt.removeBox(s,Qs.get(s)),Qs.delete(s)},beforeUpdate(s,t,e){let i=Qs.get(s);yt.configure(s,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}},gs={average(s){if(!s.length)return!1;let t,e,i=new Set,n=0,o=0;for(t=0,e=s.length;tr+l)/i.size,y:n/o}},nearest(s,t){if(!s.length)return!1;let e=t.x,i=t.y,n=Number.POSITIVE_INFINITY,o,a,r;for(o=0,a=s.length;o0){let t=s[0],e=t.chart.data.labels,i=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex{let a={before:[],lines:[],after:[]},r=Sa(i,o);$t(a.before,Zt(Ct(r,"beforeLabel",this,o))),$t(a.lines,Ct(r,"label",this,o)),$t(a.after,Zt(Ct(r,"afterLabel",this,o))),n.push(a)}),n}getAfterBody(t,e){return Ca(Ct(e.callbacks,"afterBody",this,t))}getFooter(t,e){let{callbacks:i}=e,n=Ct(i,"beforeFooter",this,t),o=Ct(i,"footer",this,t),a=Ct(i,"afterFooter",this,t),r=[];return r=$t(r,Zt(n)),r=$t(r,Zt(o)),r=$t(r,Zt(a)),r}_createItems(t){let e=this._active,i=this.chart.data,n=[],o=[],a=[],r=[],l,c;for(l=0,c=e.length;lt.filter(h,d,u,i))),t.itemSort&&(r=r.sort((h,d)=>t.itemSort(h,d,i))),nt(r,h=>{let d=Sa(t.callbacks,h);n.push(Ct(d,"labelColor",this,h)),o.push(Ct(d,"labelPointStyle",this,h)),a.push(Ct(d,"labelTextColor",this,h))}),this.labelColors=n,this.labelPointStyles=o,this.labelTextColors=a,this.dataPoints=r,r}update(t,e){let i=this.options.setContext(this.getContext()),n=this._active,o,a=[];if(!n.length)this.opacity!==0&&(o={opacity:0});else{let r=gs[i.position].call(this,n,this._eventPosition);a=this._createItems(i),this.title=this.getTitle(a,i),this.beforeBody=this.getBeforeBody(a,i),this.body=this.getBody(a,i),this.afterBody=this.getAfterBody(a,i),this.footer=this.getFooter(a,i);let l=this._size=_a(this,i),c=Object.assign({},r,l),h=wa(this.chart,i,c),d=ka(i,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:d.x,y:d.y,width:l.width,height:l.height,caretX:r.x,caretY:r.y}}this._tooltipItems=a,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,n){let o=this.getCaretPosition(t,i,n);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,i){let{xAlign:n,yAlign:o}=this,{caretSize:a,cornerRadius:r}=i,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:d}=re(r),{x:u,y:f}=t,{width:m,height:b}=e,v,y,w,D,C,_;return o==="center"?(C=f+b/2,n==="left"?(v=u,y=v-a,D=C+a,_=C-a):(v=u+m,y=v+a,D=C-a,_=C+a),w=v):(n==="left"?y=u+Math.max(l,h)+a:n==="right"?y=u+m-Math.max(c,d)-a:y=this.caretX,o==="top"?(D=f,C=D-a,v=y-a,w=y+a):(D=f+b,C=D+a,v=y+a,w=y-a),_=D),{x1:v,x2:y,x3:w,y1:D,y2:C,y3:_}}drawTitle(t,e,i){let n=this.title,o=n.length,a,r,l;if(o){let c=xe(i.rtl,this.x,this.width);for(t.x=Js(this,i.titleAlign,i),e.textAlign=c.textAlign(i.titleAlign),e.textBaseline="middle",a=ft(i.titleFont),r=i.titleSpacing,e.fillStyle=i.titleColor,e.font=a.string,l=0;lw!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,He(t,{x:b,y:m,w:c,h:l,radius:y}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),He(t,{x:v,y:m+1,w:c-2,h:l-2,radius:y}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(b,m,c,l),t.strokeRect(b,m,c,l),t.fillStyle=a.backgroundColor,t.fillRect(v,m+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){let{body:n}=this,{bodySpacing:o,bodyAlign:a,displayColors:r,boxHeight:l,boxWidth:c,boxPadding:h}=i,d=ft(i.bodyFont),u=d.lineHeight,f=0,m=xe(i.rtl,this.x,this.width),b=function(x){e.fillText(x,m.x(t.x+f),t.y+u/2),t.y+=u+o},v=m.textAlign(a),y,w,D,C,_,p,g;for(e.textAlign=a,e.textBaseline="middle",e.font=d.string,t.x=Js(this,v,i),e.fillStyle=i.bodyColor,nt(this.beforeBody,b),f=r&&v!=="right"?a==="center"?c/2+h:c+2+h:0,C=0,p=n.length;C0&&e.stroke()}_updateAnimationTarget(t){let e=this.chart,i=this.$animations,n=i&&i.x,o=i&&i.y;if(n||o){let a=gs[t.position].call(this,this._active,this._eventPosition);if(!a)return;let r=this._size=_a(this,t),l=Object.assign({},a,this._size),c=wa(e,t,l),h=ka(t,l,c,e);(n._to!==h.x||o._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=r.width,this.height=r.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){let e=this.options.setContext(this.getContext()),i=this.opacity;if(!i)return;this._updateAnimationTarget(e);let n={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;let a=xt(e.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&r&&(t.save(),t.globalAlpha=i,this.drawBackground(o,t,n,e),Ji(t,e.textDirection),o.y+=a.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),Zi(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){let i=this._active,n=t.map(({datasetIndex:r,index:l})=>{let c=this.chart.getDatasetMeta(r);if(!c)throw new Error("Cannot find a dataset at index "+r);return{datasetIndex:r,element:c.data[l],index:l}}),o=!os(i,n),a=this._positionChanged(n,e);(o||a)&&(this._active=n,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let n=this.options,o=this._active||[],a=this._getActiveElements(t,o,e,i),r=this._positionChanged(a,t),l=e||!os(a,o)||r;return l&&(this._active=a,(n.enabled||n.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,i,n){let o=this.options;if(t.type==="mouseout")return[];if(!n)return e.filter(r=>this.chart.data.datasets[r.datasetIndex]&&this.chart.getDatasetMeta(r.datasetIndex).controller.getParsed(r.index)!==void 0);let a=this.chart.getElementsAtEventForMode(t,o.mode,o,i);return o.reverse&&a.reverse(),a}_positionChanged(t,e){let{caretX:i,caretY:n,options:o}=this,a=gs[o.position].call(this,t,e);return a!==!1&&(i!==a.x||n!==a.y)}};I(ps,"positioners",gs);ur={id:"tooltip",_element:ps,positioners:gs,afterInit(s,t,e){e&&(s.tooltip=new ps({chart:s,options:e}))},beforeUpdate(s,t,e){s.tooltip&&s.tooltip.initialize(e)},reset(s,t,e){s.tooltip&&s.tooltip.initialize(e)},afterDraw(s){let t=s.tooltip;if(t&&t._willRender()){let e={tooltip:t};if(s.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(s.ctx),s.notifyPlugins("afterTooltipDraw",e)}},afterEvent(s,t){if(s.tooltip){let e=t.replay;s.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(s,t)=>t.bodyFont.size,boxWidth:(s,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:dr},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:s=>s!=="filter"&&s!=="itemSort"&&s!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},fr=Object.freeze({__proto__:null,Colors:sr,Decimation:nr,Filler:ar,Legend:lr,SubTitle:hr,Title:cr,Tooltip:ur}),kd=(s,t,e,i)=>(typeof t=="string"?(e=s.push(t)-1,i.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);Sd=(s,t)=>s===null?null:gt(Math.round(s),0,t);Ye=class extends ge{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){let e=this._addedLabels;if(e.length){let i=this.getLabels();for(let{index:n,label:o}of e)i[n]===o&&i.splice(n,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(Z(t))return null;let i=this.getLabels();return e=isFinite(e)&&i[e]===t?e:Cd(i,t,Q(e,t),this._addedLabels),Sd(e,i.length-1)}determineDataLimits(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),{min:i,max:n}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(i=0),e||(n=this.getLabels().length-1)),this.min=i,this.max=n}buildTicks(){let t=this.min,e=this.max,i=this.options.offset,n=[],o=this.getLabels();o=t===0&&e===o.length-1?o:o.slice(t,e+1),this._valueRange=Math.max(o.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let a=t;a<=e;a++)n.push({value:a});return n}getLabelForValue(t){return Ea.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){let e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}};I(Ye,"id","category"),I(Ye,"defaults",{ticks:{callback:Ea}});qe=class extends ge{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return Z(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){let{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds(),{min:n,max:o}=this,a=l=>n=e?n:l,r=l=>o=i?o:l;if(t){let l=At(n),c=At(o);l<0&&c<0?r(0):l>0&&c>0&&a(0)}if(n===o){let l=o===0?1:Math.abs(o*.05);r(o+l),t||a(n-l)}this.min=n,this.max=o}getTickLimit(){let t=this.options.ticks,{maxTicksLimit:e,stepSize:i}=t,n;return i?(n=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),e=e||11),e&&(n=Math.min(e,n)),n}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){let t=this.options,e=t.ticks,i=this.getTickLimit();i=Math.max(2,i);let n={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,a=Ed(n,o);return t.bounds==="ticks"&&Ai(a,this,"value"),t.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){let t=this.ticks,e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){let n=(i-e)/Math.max(t.length-1,1)/2;e-=n,i+=n}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return Ve(t,this.chart.options.locale,this.options.ticks.format)}},Ke=class extends qe{determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=ht(t)?t:0,this.max=ht(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){let t=this.isHorizontal(),e=t?this.width:this.height,i=Pt(this.options.ticks.minRotation),n=(t?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/n))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}};I(Ke,"id","linear"),I(Ke,"defaults",{ticks:{callback:Ne.formatters.numeric}});ys=s=>Math.floor(qt(s)),_e=(s,t)=>Math.pow(10,ys(s)+t);Xe=class extends ge{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){let i=qe.prototype.parse.apply(this,[t,e]);if(i===0){this._zero=!0;return}return ht(i)&&i>0?i:null}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=ht(t)?Math.max(0,t):null,this.max=ht(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!ht(this._userMin)&&(this.min=t===_e(this.min,0)?_e(this.min,-1):_e(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),i=this.min,n=this.max,o=r=>i=t?i:r,a=r=>n=e?n:r;i===n&&(i<=0?(o(1),a(10)):(o(_e(i,-1)),a(_e(n,1)))),i<=0&&o(_e(n,-1)),n<=0&&a(_e(i,1)),this.min=i,this.max=n}buildTicks(){let t=this.options,e={min:this._userMin,max:this._userMax},i=Dd(e,this);return t.bounds==="ticks"&&Ai(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":Ve(t,this.chart.options.locale,this.options.ticks.format)}configure(){let t=this.min;super.configure(),this._startValue=qt(t),this._valueRange=qt(this.max)-qt(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(qt(t)-this._startValue)/this._valueRange)}getValueForPixel(t){let e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}};I(Xe,"id","logarithmic"),I(Xe,"defaults",{ticks:{callback:Ne.formatters.logarithmic,major:{enabled:!0}}});he=class extends qe{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){let t=this._padding=xt(Sn(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!1);this.min=ht(t)&&!isNaN(t)?t:0,this.max=ht(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Sn(this.options))}generateTickLabels(t){qe.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((e,i)=>{let n=ot(this.options.pointLabels.callback,[e,i],this);return n||n===0?n:""}).filter((e,i)=>this.chart.getDataVisibility(i))}fit(){let t=this.options;t.display&&t.pointLabels.display?Ld(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,n){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,n))}getIndexAngle(t){let e=lt/(this._pointLabels.length||1),i=this.options.startAngle||0;return bt(t*e+Pt(i))}getDistanceFromCenterForValue(t){if(Z(t))return NaN;let e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(Z(t))return NaN;let e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){let e=this._pointLabels||[];if(t>=0&&t{if(d!==0||d===0&&this.min<0){l=this.getDistanceFromCenterForValue(h.value);let u=this.getContext(d),f=n.setContext(u),m=o.setContext(u);Nd(this,f,l,a,m)}}),i.display){for(t.save(),r=a-1;r>=0;r--){let h=i.setContext(this.getPointLabelContext(r)),{color:d,lineWidth:u}=h;!u||!d||(t.lineWidth=u,t.strokeStyle=d,t.setLineDash(h.borderDash),t.lineDashOffset=h.borderDashOffset,l=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),c=this.getPointPosition(r,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){let t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;let n=this.getIndexAngle(0),o,a;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(n),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((r,l)=>{if(l===0&&this.min>=0&&!e.reverse)return;let c=i.setContext(this.getContext(l)),h=ft(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=h.string,a=t.measureText(r.label).width,t.fillStyle=c.backdropColor;let d=xt(c.backdropPadding);t.fillRect(-a/2-d.left,-o-h.size/2-d.top,a+d.width,h.size+d.height)}ae(t,r.label,0,-o,h,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}};I(he,"id","radialLinear"),I(he,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Ne.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),I(he,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),I(he,"descriptors",{angleLines:{_fallback:"grid"}});hi={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}},Et=Object.keys(hi);fe=class extends ge{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){let i=t.time||(t.time={}),n=this._adapter=new Va._date(t.adapters.date);n.init(e),Fe(i.displayFormats,n.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return t===void 0?null:Aa(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let t=this.options,e=this._adapter,i=t.time.unit||"day",{min:n,max:o,minDefined:a,maxDefined:r}=this.getUserBounds();function l(c){!a&&!isNaN(c.min)&&(n=Math.min(n,c.min)),!r&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!a||!r)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),n=ht(n)&&!isNaN(n)?n:+e.startOf(Date.now(),i),o=ht(o)&&!isNaN(o)?o:+e.endOf(Date.now(),i)+1,this.min=Math.min(n,o-1),this.max=Math.max(n+1,o)}_getLabelBounds(){let t=this.getLabelTimestamps(),e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){let t=this.options,e=t.time,i=t.ticks,n=i.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&n.length&&(this.min=this._userMin||n[0],this.max=this._userMax||n[n.length-1]);let o=this.min,a=this.max,r=po(n,o,a);return this._unit=e.unit||(i.autoSkip?Oa(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):Wd(this,r.length,e.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:$d(this._unit),this.initOffsets(n),t.reverse&&r.reverse(),Fa(this,r,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e=0,i=0,n,o;this.options.offset&&t.length&&(n=this.getDecimalForValue(t[0]),t.length===1?e=1-n:e=(this.getDecimalForValue(t[1])-n)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?i=o:i=(o-this.getDecimalForValue(t[t.length-2]))/2);let a=t.length<3?.5:.25;e=gt(e,0,a),i=gt(i,0,a),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){let t=this._adapter,e=this.min,i=this.max,n=this.options,o=n.time,a=o.unit||Oa(o.minUnit,e,i,this._getLabelCapacity(e)),r=Q(n.ticks.stepSize,1),l=a==="week"?o.isoWeekday:!1,c=ve(l)||l===!0,h={},d=e,u,f;if(c&&(d=+t.startOf(d,"isoWeek",l)),d=+t.startOf(d,c?"day":a),t.diff(i,e,a)>1e5*r)throw new Error(e+" and "+i+" are too far apart with stepSize of "+r+" "+a);let m=n.ticks.source==="data"&&this.getDataTimestamps();for(u=d,f=0;u+b)}getLabelForValue(t){let e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){let n=this.options.time.displayFormats,o=this._unit,a=e||n[o];return this._adapter.format(t,a)}_tickFormatFunction(t,e,i,n){let o=this.options,a=o.ticks.callback;if(a)return ot(a,[t,e,i],this);let r=o.time.displayFormats,l=this._unit,c=this._majorUnit,h=l&&r[l],d=c&&r[c],u=i[e],f=c&&d&&u&&u.major;return this._adapter.format(t,n||(f?d:h))}generateTickLabels(t){let e,i,n;for(e=0,i=t.length;e0?r:1}getDataTimestamps(){let t=this._cache.data||[],e,i;if(t.length)return t;let n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(e=0,i=n.length;e=e&&c<=i&&n.push(c);if(n.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(a=0,r=n.length;an-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;let e=this.getDataTimestamps(),i=this.getLabelTimestamps();return e.length&&i.length?t=this.normalize(e.concat(i)):t=e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(Zs(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){let e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return Zs(this._table,i*this._tableRange+this._minPos,!0)}};I(Ge,"id","timeseries"),I(Ge,"defaults",fe.defaults);pr=Object.freeze({__proto__:null,CategoryScale:Ye,LinearScale:Ke,LogarithmicScale:Xe,RadialLinearScale:he,TimeScale:fe,TimeSeriesScale:Ge}),Ud=[za,Za,fr,pr]});var Kd={};Pn(Kd,{CardView:()=>di,default:()=>ui});module.exports=Sr(Kd);var X=require("obsidian"),Dn=On(bi());var vi={defaultMode:"kanban-genre",notesColumns:["notes","note","Notes","Note","description","Description","review","Review"],statusColumn:"status",categoryColumn:"category",notesSubfolder:"Notes",columnWidths:{},selectColumns:["Category","Type","Rating","Status","rating","type","category","status","Score /5"],fileConfigs:{}},ws="xlsx-card-view";var Rn=On(bi());function Fn(s){return s.replace(/[\\/:*?"<>|#^[\]]/g,"").replace(/\s+/g," ").trim().slice(0,100)}function ks(s){var n,o;if(!s||!s.trim())return{headers:[],rows:[]};let t=Rn.default.parse(s,{header:!0,skipEmptyLines:!0}),e=((n=t.meta.fields)!=null?n:[]).map(String),i=((o=t.data)!=null?o:[]).map(a=>{let r={};return e.forEach(l=>{r[l]=a[l]!=null?String(a[l]):""}),r});return{headers:e,rows:i}}function In(s,t){if(!s)return s;let e=s.startsWith("./")||s.startsWith("../")||s==="."||s==="..";if(!e&&s.includes("/"))return s;if(!e)return t?`${t}/${s}`:s;let i=t?t.split("/").filter(Boolean):[];for(let n of s.split("/"))if(!(n===""||n===".")){if(n===".."){i.pop();continue}i.push(n)}return i.join("/")}function Tt(s){return s.split(/[\s_-]+/).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}function Bn(s,t){let e=(s!=null?s:"").trim();if(!e||e.toLowerCase()==="unrated"||e==="\u2014"||e==="-")return"";if(/[★⭐☆]/.test(e))return e;if(/^\d+$/.test(e)){let o=parseInt(e,10);if(o>=1&&o<=5)return"\u2605".repeat(o)}let n=Er(e,t);return n&&n!==e&&n!=="\u2014"?n:""}function Er(s,t){var o;let e=t.toLowerCase();if(!["rating","score","score /5"].includes(e))return s;let i=s.toLowerCase().trim();return(o={excellent:"\u2605\u2605\u2605\u2605\u2605",great:"\u2605\u2605\u2605\u2605\u2605",good:"\u2605\u2605\u2605\u2605\u2606",fair:"\u2605\u2605\u2605\u2606\u2606",poor:"\u2605\u2605\u2606\u2606\u2606",bad:"\u2605\u2606\u2606\u2606\u2606",5:"\u2605\u2605\u2605\u2605\u2605",4:"\u2605\u2605\u2605\u2605\u2606",3:"\u2605\u2605\u2605\u2606\u2606",2:"\u2605\u2605\u2606\u2606\u2606",1:"\u2605\u2606\u2606\u2606\u2606",0:"\u2606\u2606\u2606\u2606\u2606",unrated:"\u2014","":"\u2014"}[i])!=null?o:s}function Le(s,t,e,i,n){var D;document.body.querySelectorAll(".csv-select-picker").forEach(C=>C.remove());let o=document.body.createDiv({cls:"csv-select-picker"});o.style.position="fixed",o.style.zIndex="9999";let a=()=>{let C=s.getBoundingClientRect(),_=o.offsetHeight||280,p=C.bottom+4+_>window.innerHeight&&C.top-4-_>0;o.style.left=C.left+"px",o.style.top=p?C.top-4-_+"px":C.bottom+4+"px"};a();let r=C=>{!o.contains(C.target)&&C.target!==s&&c()},l=()=>c(),c=()=>{o.remove(),document.removeEventListener("mousedown",r),window.removeEventListener("scroll",l,!0),window.removeEventListener("resize",c)},h=o.createEl("input",{cls:"csv-picker-search",type:"text",placeholder:"Search or add\u2026"});h.focus();let d=o.createDiv({cls:"csv-picker-list"}),u=Array.from(new Set(e.filter(Boolean))),f=[],m=0,b=()=>{d.querySelectorAll(".csv-picker-item").forEach((C,_)=>{C.toggleClass("csv-picker-item--hover",_===m),_===m&&C.scrollIntoView({block:"nearest"})})},v=C=>{i(C.isClear?"":C.value),c()},y=C=>{d.empty(),f=[];let _=C?u.filter(p=>p.toLowerCase().includes(C.toLowerCase())):u;if(t){f.push({value:"",isClear:!0});let p=d.createDiv({cls:"csv-picker-item csv-picker-clear"});p.setText("\u2715 Clear"),p.addEventListener("mousedown",g=>{g.preventDefault(),v({value:"",isClear:!0})})}if(_.forEach(p=>{f.push({value:p});let g=d.createDiv({cls:`csv-picker-item ${p===t?"active":""}`});g.setText(p),g.addEventListener("mousedown",x=>{x.preventDefault(),v({value:p})})}),C&&!u.some(p=>p.toLowerCase()===C.toLowerCase())){f.push({value:C,isAdd:!0});let p=d.createDiv({cls:"csv-picker-item csv-picker-add"});p.setText(`+ Add "${C}"`),p.addEventListener("mousedown",g=>{g.preventDefault(),v({value:C})})}!_.length&&!C&&d.createDiv({cls:"csv-picker-empty",text:"No options yet. Type to add."}),m=Math.min(m,Math.max(f.length-1,0)),b()};y(""),a(),h.addEventListener("input",()=>{m=0,y(h.value),a()});let w=typeof window!="undefined"&&((D=window.matchMedia)==null?void 0:D.call(window,"(pointer: coarse)").matches);setTimeout(()=>{document.addEventListener("mousedown",r),w||(window.addEventListener("scroll",l,!0),window.addEventListener("resize",c))},0),h.addEventListener("keydown",C=>{if(C.key==="Escape"){c();return}if(C.key==="ArrowDown"){C.preventDefault(),f.length&&(m=(m+1)%f.length,b());return}if(C.key==="ArrowUp"){C.preventDefault(),f.length&&(m=(m-1+f.length)%f.length,b());return}if(C.key==="Enter")if(C.preventDefault(),f[m])v(f[m]);else{let _=h.value.trim();_&&(i(_),c())}})}function zn(s,t,e){return!s[t]||t===e||(s[e]||(s[e]=s[t]),delete s[t]),s}var zt=require("obsidian");var Cs=class extends zt.Modal{constructor(t,e,i,n,o,a){super(t),this.headers=e,this.isNotesCol=i,this.isSelectCol=n,this.getColumnValues=o,this.onSubmit=a}onOpen(){let{contentEl:t}=this;t.empty(),t.addClass("csv-add-modal"),t.createEl("h2",{text:"Add new entry",cls:"csv-modal-title"});let e=t.createDiv({cls:"csv-modal-form"}),i={};this.headers.forEach(l=>i[l]=""),this.headers.forEach(l=>{let c=e.createDiv({cls:"csv-modal-row"});if(c.createEl("label",{text:Tt(l),cls:"csv-modal-label"}),this.isNotesCol(l)){let h=c.createEl("textarea",{cls:"csv-modal-textarea",placeholder:"Markdown supported\u2026"});h.addEventListener("input",()=>{i[l]=h.value})}else if(this.isSelectCol(l)){let d=c.createDiv({cls:"csv-modal-select-wrap"}).createDiv({cls:"csv-select-chip empty"});d.setText("\u2014 click to select \u2014"),d.addEventListener("click",u=>{u.stopPropagation(),Le(d,i[l],this.getColumnValues(l),f=>{i[l]=f,d.setText(f||"\u2014 click to select \u2014"),d.toggleClass("empty",!f)},t)})}else{let h=c.createEl("input",{cls:"csv-modal-input",type:"text",placeholder:l});h.addEventListener("input",()=>{i[l]=h.value}),h.addEventListener("keydown",d=>{d.key==="Enter"&&r()})}});let n=t.createDiv({cls:"csv-modal-btns"});n.createEl("button",{text:"Cancel",cls:"csv-modal-cancel"}).addEventListener("click",()=>this.close()),n.createEl("button",{text:"Add entry",cls:"csv-modal-submit"}).addEventListener("click",()=>r());let r=()=>{if(!Object.values(i).some(c=>c.trim())){new zt.Notice("Fill in at least one field.");return}this.onSubmit(i),this.close()}}onClose(){this.contentEl.empty()}},Ss=class extends zt.Modal{constructor(t,e,i,n,o,a,r,l,c,h){super(t),this.row={...e},this.notesCol=i,this.headers=n,this.filePath=o,this.renderComponent=new zt.Component,this.isNotesCol=a,this.isSelectCol=r,this.getColumnValues=l,this.onSave=c,this.onDelete=h,this.modalEl.addClass("csv-note-expander-modal")}onOpen(){var w,D,C,_,p;this.renderComponent.load();let{contentEl:t}=this;t.empty(),t.addClass("csv-note-expander");let e=t.createDiv({cls:"csv-expander-header"});e.createDiv({cls:"csv-expander-title",text:(D=this.row[(w=this.headers.find(g=>["title","name","Title","Name"].includes(g)))!=null?w:this.headers[0]])!=null?D:"\u2014"});let i=e.createDiv({cls:"csv-expander-header-btns"}),n=t.createDiv({cls:"csv-expander-fields"}),o=this.headers.find(g=>["title","name","Title","Name"].includes(g)),a=this.headers.find(g=>["author","Author","director","Director","artist","Artist","creator","Creator"].includes(g));this.headers.forEach(g=>{if(this.isNotesCol(g))return;let x=n.createDiv({cls:"csv-expander-field-row"});if(x.createDiv({cls:"csv-expander-field-label",text:Tt(g)}),this.isSelectCol(g)){let k=x.createDiv({cls:`csv-select-chip ${this.row[g]?"":"empty"}`});k.setText(this.row[g]||"\u2014"),k.addEventListener("click",S=>{S.stopPropagation(),Le(k,this.row[g],this.getColumnValues(g),M=>{this.row[g]=M,k.setText(M||"\u2014"),k.toggleClass("empty",!M)},t)})}else{let k=x.createDiv({cls:"csv-expander-field-value",text:this.row[g]||"\u2014"});k.addEventListener("click",()=>{var R;k.empty();let S=k.createEl("input",{cls:"csv-inline-input",value:(R=this.row[g])!=null?R:"",type:"text"});S.focus(),S.select();let M=()=>{this.row[g]=S.value,k.empty(),k.setText(S.value||"\u2014")};S.addEventListener("blur",M),S.addEventListener("keydown",K=>{K.key==="Enter"&&S.blur(),K.key==="Escape"&&(k.empty(),k.setText(this.row[g]||"\u2014"))})})}}),t.createDiv({cls:"csv-expander-divider"}).createDiv({cls:"csv-expander-notes-label",text:this.notesCol});let l=!1,c=(C=this.row[this.notesCol])!=null?C:"",h=t.createDiv({cls:"csv-expander-rendered markdown-rendered"});h.title="Click to edit";let d=t.createDiv({cls:"csv-expander-editor"});d.style.display="none";let u=()=>{h.empty(),c.trim()?zt.MarkdownRenderer.render(this.app,c,h,this.filePath,this.renderComponent):h.createDiv({cls:"csv-notes-empty",text:"+ Add note"})};u();let f=d.createEl("textarea",{cls:"csv-expander-textarea"});f.value=c,f.addEventListener("input",()=>{c=f.value});let m=()=>{l||(l=!0,h.style.display="none",d.style.display="flex",f.value=c,f.focus())},b=()=>{l&&(l=!1,d.style.display="none",h.style.display="",c=f.value,u())};h.addEventListener("click",g=>{if(g.target.closest("a, button, input, textarea, [contenteditable]"))return;let k=window.getSelection();k&&k.toString().length>0||m()}),f.addEventListener("keydown",g=>{g.key==="Escape"&&(g.preventDefault(),f.blur())}),f.addEventListener("blur",b);let v=t.createDiv({cls:"csv-expander-footer"});if(this.onDelete){let g=String((p=this.row[(_=this.headers.find(x=>["title","name","Title","Name"].includes(x)))!=null?_:this.headers[0]])!=null?p:"").trim();v.createEl("button",{cls:"csv-expander-delete-btn",text:"Delete"}).addEventListener("click",()=>{let x=g||"this entry";window.confirm(`Delete "${x}"? This can't be undone.`)&&(this.onDelete(),this.close())})}let y=v.createDiv({cls:"csv-expander-footer-right"});y.createEl("button",{cls:"csv-modal-cancel",text:"Cancel"}).addEventListener("click",()=>this.close()),y.createEl("button",{cls:"csv-expander-save-btn",text:"Save & close"}).addEventListener("click",()=>{l&&(c=f.value),this.row[this.notesCol]=c,this.onSave(this.row),this.close()})}onClose(){this.renderComponent.unload(),this.contentEl.empty()}},Es=class extends zt.Modal{constructor(t,e,i,n,o,a){super(t),this.headers=e,this.filePath=i,this.current={...n,habitColumns:n.habitColumns?[...n.habitColumns]:void 0},this.autoDetectedHabits=o,this.onSave=a}onOpen(){var D,C;let{contentEl:t}=this;t.empty(),t.addClass("csv-add-modal"),t.createEl("h2",{text:"View settings for this file",cls:"csv-modal-title"}),t.createEl("p",{text:"These settings apply only to this file and override the global defaults.",cls:"csv-modal-desc"});let e=t.createDiv({cls:"csv-modal-form"}),i="\u2014 use global default \u2014",n=[i,...this.headers],o=(_,p,g)=>{let x=e.createDiv({cls:"csv-modal-row"});x.createEl("label",{text:_,cls:"csv-modal-label"});let k=x.createEl("select",{cls:"csv-modal-select"});n.forEach(S=>{let M=k.createEl("option",{text:S,value:S});(p!=null?p:i)===S&&(M.selected=!0)}),k.addEventListener("change",()=>g(k.value===i?void 0:k.value))};o("Category column (kanban grouping)",this.current.categoryColumn,_=>{this.current.categoryColumn=_}),o("Status column (row subgroups)",this.current.statusColumn,_=>{this.current.statusColumn=_}),o("Notes column",this.current.notesColumn,_=>{this.current.notesColumn=_});let a=e.createDiv({cls:"csv-modal-row"});a.createEl("label",{text:"Habit columns (dashboard)",cls:"csv-modal-label"});let r=a.createEl("p",{cls:"csv-modal-hint",text:"Select columns to track as habits. Auto-detected columns with binary values (0/1) are pre-selected."}),l=a.createDiv({cls:"csv-modal-checkbox-grid"}),c=new Set((D=this.current.habitColumns)!=null?D:this.autoDetectedHabits);this.headers.forEach(_=>{let p=l.createEl("label",{cls:"csv-modal-checkbox-label"}),g=p.createEl("input",{type:"checkbox"});g.checked=c.has(_),this.autoDetectedHabits.includes(_)&&!this.current.habitColumns&&p.addClass("auto-detected"),p.createSpan({text:_}),g.addEventListener("change",()=>{this.current.habitColumns||(this.current.habitColumns=[...this.autoDetectedHabits]),g.checked?this.current.habitColumns.includes(_)||this.current.habitColumns.push(_):this.current.habitColumns=this.current.habitColumns.filter(x=>x!==_)})});let h=e.createDiv({cls:"csv-modal-row"});h.createEl("label",{text:"Card fields (Library / Kanban)",cls:"csv-modal-label"}),h.createEl("p",{cls:"csv-modal-hint",text:"Columns shown under each card title. Rating renders as stars, theme/tag columns as pills. Leave all unchecked for title-only cards."});let d=h.createDiv({cls:"csv-modal-checkbox-grid"}),u=_=>this.headers.find(p=>_.some(g=>g.toLowerCase()===p.toLowerCase())),f=[u(["Author","Authors","Director","Artist","Creator","By"]),u(["Year","Date","Released"]),u(["Rating","Score","Score /5","Stars"]),u(["Theme","Tags","Tag","Mood"])].filter(_=>!!_),m=new Set((C=this.current.cardFields)!=null?C:f),b=!!this.current.cardFields;this.headers.forEach(_=>{let p=d.createEl("label",{cls:"csv-modal-checkbox-label"}),g=p.createEl("input",{type:"checkbox"});g.checked=m.has(_),f.includes(_)&&!b&&p.addClass("auto-detected"),p.createSpan({text:_}),g.addEventListener("change",()=>{this.current.cardFields||(this.current.cardFields=[...f]),g.checked?this.current.cardFields.includes(_)||this.current.cardFields.push(_):this.current.cardFields=this.current.cardFields.filter(x=>x!==_)})});let v=e.createDiv({cls:"csv-modal-row"});v.createEl("label",{text:"Default view",cls:"csv-modal-label"});let y=v.createEl("select",{cls:"csv-modal-select"});[["\u2014 use global default \u2014",""],["Dashboard","dashboard"],["By Genre","kanban-genre"],["Table","table"]].forEach(([_,p])=>{var x;let g=y.createEl("option",{text:_,value:p});((x=this.current.defaultMode)!=null?x:"")===p&&(g.selected=!0)}),y.addEventListener("change",()=>{this.current.defaultMode=y.value?y.value:void 0});let w=t.createDiv({cls:"csv-modal-btns"});w.createEl("button",{text:"Cancel",cls:"csv-modal-cancel"}).addEventListener("click",()=>this.close()),w.createEl("button",{text:"Save",cls:"csv-modal-submit"}).addEventListener("click",()=>{this.onSave(this.current),this.close()})}onClose(){this.contentEl.empty()}};var xi=`--- obsidianUIMode: preview obsidianEditingMode: source --- diff --git a/main.ts b/main.ts index 53aef93..d478c29 100644 --- a/main.ts +++ b/main.ts @@ -44,7 +44,7 @@ async function loadChart(): Promise { // ─── View ──────────────────────────────────────────────────────────────────── -export class XLSXCardView extends FileView { +export class CardView extends FileView { settings: CardViewSettings; headers: string[] = []; rows: CSVRow[] = []; @@ -1784,7 +1784,7 @@ export default class CardViewPlugin extends Plugin { settings: CardViewSettings = DEFAULT_SETTINGS; async onload(): Promise { await this.loadSettings(); - this.registerView(CARD_VIEW_TYPE, leaf=>new XLSXCardView(leaf, this.settings, () => this.saveSettings())); + this.registerView(CARD_VIEW_TYPE, leaf=>new CardView(leaf, this.settings, () => this.saveSettings())); this.registerExtensions(["csv"], CARD_VIEW_TYPE); this.addSettingTab(new CardViewSettingTab(this.app, this)); diff --git a/test-plugin-logic.mjs b/test-plugin-logic.mjs index 9dc27c4..337c0c2 100644 --- a/test-plugin-logic.mjs +++ b/test-plugin-logic.mjs @@ -97,7 +97,7 @@ function parseCSV(raw) { return { headers, rows }; } -// Simulates resolveCol from XLSXCardView +// Simulates resolveCol from CardView function resolveCol(headers, candidates) { for (const c of candidates) { const found = headers.find(h => h.toLowerCase() === c.toLowerCase());