← Back
Editing: backend-dashboard.js
(()=>{"use strict";var t={n:e=>{var i=e&&e.__esModule?()=>e.default:()=>e;return t.d(i,{a:i}),i},d:(e,i)=>{for(var s in i)t.o(i,s)&&!t.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:i[s]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)};const e=window.React,i=window.wp.element,s=window.wp.i18n,n=window.wp.apiFetch;var a=t.n(n);const o=(0,i.createContext)(null),r=(0,i.createContext)(null);function l(){return(0,i.useContext)(o)}function c(){return(0,i.useContext)(r)}const h="open-reset-modal",d="close-reset-modal",u="update-option-loading-status";function f(t,e){switch(e.type){case h:return{...t,isResetModalOpen:!0};case d:return{...t,isResetModalOpen:!1};case u:return{...t,isUpdatingOptions:e.isLoading};default:throw Error("Unknown action: "+e.type)}}function g(t){var e,i,s="";if("string"==typeof t||"number"==typeof t)s+=t;else if("object"==typeof t)if(Array.isArray(t)){var n=t.length;for(e=0;e<n;e++)t[e]&&(i=g(t[e]))&&(s&&(s+=" "),s+=i)}else for(i in t)t[i]&&(s&&(s+=" "),s+=i);return s}const p=function(){for(var t,e,i=0,s="",n=arguments.length;i<n;i++)(t=arguments[i])&&(e=g(t))&&(s&&(s+=" "),s+=e);return s},m=({children:t,badgeLabel:i,title:s})=>(0,e.createElement)("div",{className:"rcf7-quick-action-card rcf7-card"},(0,e.createElement)("div",{className:"rcf7-quick-action-card__header"},(0,e.createElement)("span",{className:"rcf7-badge rcf7-badge--black"},i),(0,e.createElement)("h3",{className:"rcf7-quick-action-card__title"},s)),(0,e.createElement)("div",{className:"rcf7-quick-action-card__content"},t)),b=()=>{const t=l(),[n,a]=(0,i.useState)("");return(0,e.createElement)("div",{className:"rcf7-quick-actions"},(0,e.createElement)(m,{badgeLabel:(0,s.__)("Step 1","wpcf7-redirect"),title:(0,s.__)("Select a Form","wpcf7-redirect")},(0,e.createElement)("p",{className:"rcf7-quick-action-card__description"},(0,s.__)("Choose which Contact Form 7 form you want to enhance with post-submission actions.","wpcf7-redirect")),(0,e.createElement)("div",{className:"rcf7-select-wrapper"},(0,e.createElement)("select",{id:"form-select",className:"rcf7-select",value:n,onChange:t=>a(t.target.value)},t.formShortcuts.map((({label:t,link:i})=>(0,e.createElement)("option",{key:i,value:i},t)))))),(0,e.createElement)(m,{badgeLabel:(0,s.__)("Step 2","wpcf7-redirect"),title:(0,s.__)("Add Post-Submission Actions","wpcf7-redirect")},(0,e.createElement)("p",{className:"rcf7-quick-action-card__description"},(0,s.__)("Configure what happens after a user submits your form: redirect to a thank-you page, save entries, and more.","wpcf7-redirect")),(0,e.createElement)("a",{href:n,className:p("rcf7-btn","full-width",{disabled:!Boolean(n)}),...!n&&{"aria-disabled":"true"}},(0,s.__)("Add Actions","wpcf7-redirect"))))},_=(...t)=>t.filter(((t,e,i)=>Boolean(t)&&""!==t.trim()&&i.indexOf(t)===e)).join(" ").trim();var x={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const y=(0,e.forwardRef)((({color:t="currentColor",size:i=24,strokeWidth:s=2,absoluteStrokeWidth:n,className:a="",children:o,iconNode:r,...l},c)=>(0,e.createElement)("svg",{ref:c,...x,width:i,height:i,stroke:t,strokeWidth:n?24*Number(s)/Number(i):s,className:_("lucide",a),...l},[...r.map((([t,i])=>(0,e.createElement)(t,i))),...Array.isArray(o)?o:[o]]))),v=(t,i)=>{const s=(0,e.forwardRef)((({className:s,...n},a)=>{return(0,e.createElement)(y,{ref:a,iconNode:i,className:_(`lucide-${o=t,o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,s),...n});var o}));return s.displayName=`${t}`,s},w=v("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]),k=v("ChartLine",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]]),M=v("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]),E=({icon:t,classes:i={}})=>(0,e.createElement)("span",{className:p("rcf7-highlighted-icon",i)},t),S=({icon:t,label:i,description:s,classes:n})=>(0,e.createElement)("div",{className:p("rcf7-stat","rcf7-card",n)},(0,e.createElement)(E,{icon:t}),(0,e.createElement)("span",{className:"rcf7-stat__number"},i),(0,e.createElement)("p",{className:"rcf7-stat__description"},s)),P=()=>{const t=l(),i=[{icon:(0,e.createElement)(w,null),label:t.stats.totalEntries,description:(0,s.__)("Total Entries","wpcf7-redirect"),classes:"variation-1"},{icon:(0,e.createElement)(k,null),label:t.stats.todayEntries,description:(0,s.__)("Today's Entries","wpcf7-redirect"),classes:"variation-2"},{icon:(0,e.createElement)(M,null),label:t.stats.lastEntryDisplayDate,description:(0,s.__)("Since Last Entry","wpcf7-redirect"),classes:"variation-3"}];return(0,e.createElement)("div",{className:"rcf7-stats"},i.map((t=>(0,e.createElement)(S,{key:t.description,...t}))))};function C(t){return t+.5|0}const A=(t,e,i)=>Math.max(Math.min(t,i),e);function L(t){return A(C(2.55*t),0,255)}function O(t){return A(C(255*t),0,255)}function D(t){return A(C(t/2.55)/100,0,1)}function T(t){return A(C(100*t),0,100)}const I={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},R=[..."0123456789ABCDEF"],N=t=>R[15&t],z=t=>R[(240&t)>>4]+R[15&t],F=t=>(240&t)>>4==(15&t);const B=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function H(t,e,i){const s=e*Math.min(i,1-i),n=(e,n=(e+t/30)%12)=>i-s*Math.max(Math.min(n-3,9-n,1),-1);return[n(0),n(8),n(4)]}function V(t,e,i){const s=(s,n=(s+t/60)%6)=>i-i*e*Math.max(Math.min(n,4-n,1),0);return[s(5),s(3),s(1)]}function W(t,e,i){const s=H(t,1,.5);let n;for(e+i>1&&(n=1/(e+i),e*=n,i*=n),n=0;n<3;n++)s[n]*=1-e-i,s[n]+=e;return s}function j(t){const e=t.r/255,i=t.g/255,s=t.b/255,n=Math.max(e,i,s),a=Math.min(e,i,s),o=(n+a)/2;let r,l,c;return n!==a&&(c=n-a,l=o>.5?c/(2-n-a):c/(n+a),r=function(t,e,i,s,n){return t===n?(e-i)/s+(e<i?6:0):e===n?(i-t)/s+2:(t-e)/s+4}(e,i,s,c,n),r=60*r+.5),[0|r,l||0,o]}function $(t,e,i,s){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,i,s)).map(O)}function Y(t,e,i){return $(H,t,e,i)}function U(t){return(t%360+360)%360}const q={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"},X={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"};let K;const Z=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/,G=t=>t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,Q=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function J(t,e,i){if(t){let s=j(t);s[e]=Math.max(0,Math.min(s[e]+s[e]*i,0===e?360:1)),s=Y(s),t.r=s[0],t.g=s[1],t.b=s[2]}}function tt(t,e){return t?Object.assign(e||{},t):t}function et(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=O(t[3]))):(e=tt(t,{r:0,g:0,b:0,a:1})).a=O(e.a),e}function it(t){return"r"===t.charAt(0)?function(t){const e=Z.exec(t);let i,s,n,a=255;if(e){if(e[7]!==i){const t=+e[7];a=e[8]?L(t):A(255*t,0,255)}return i=+e[1],s=+e[3],n=+e[5],i=255&(e[2]?L(i):A(i,0,255)),s=255&(e[4]?L(s):A(s,0,255)),n=255&(e[6]?L(n):A(n,0,255)),{r:i,g:s,b:n,a}}}(t):function(t){const e=B.exec(t);let i,s=255;if(!e)return;e[5]!==i&&(s=e[6]?L(+e[5]):O(+e[5]));const n=U(+e[2]),a=+e[3]/100,o=+e[4]/100;return i="hwb"===e[1]?function(t,e,i){return $(W,t,e,i)}(n,a,o):"hsv"===e[1]?function(t,e,i){return $(V,t,e,i)}(n,a,o):Y(n,a,o),{r:i[0],g:i[1],b:i[2],a:s}}(t)}class st{constructor(t){if(t instanceof st)return t;const e=typeof t;let i;var s,n,a;"object"===e?i=et(t):"string"===e&&(a=(s=t).length,"#"===s[0]&&(4===a||5===a?n={r:255&17*I[s[1]],g:255&17*I[s[2]],b:255&17*I[s[3]],a:5===a?17*I[s[4]]:255}:7!==a&&9!==a||(n={r:I[s[1]]<<4|I[s[2]],g:I[s[3]]<<4|I[s[4]],b:I[s[5]]<<4|I[s[6]],a:9===a?I[s[7]]<<4|I[s[8]]:255})),i=n||function(t){K||(K=function(){const t={},e=Object.keys(X),i=Object.keys(q);let s,n,a,o,r;for(s=0;s<e.length;s++){for(o=r=e[s],n=0;n<i.length;n++)a=i[n],r=r.replace(a,q[a]);a=parseInt(X[o],16),t[r]=[a>>16&255,a>>8&255,255&a]}return t}(),K.transparent=[0,0,0,0]);const e=K[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:4===e.length?e[3]:255}}(t)||it(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=tt(this._rgb);return t&&(t.a=D(t.a)),t}set rgb(t){this._rgb=et(t)}rgbString(){return this._valid?(t=this._rgb)&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${D(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`):void 0;var t}hexString(){return this._valid?(t=this._rgb,e=(t=>F(t.r)&&F(t.g)&&F(t.b)&&F(t.a))(t)?N:z,t?"#"+e(t.r)+e(t.g)+e(t.b)+((t,e)=>t<255?e(t):"")(t.a,e):void 0):void 0;var t,e}hslString(){return this._valid?function(t){if(!t)return;const e=j(t),i=e[0],s=T(e[1]),n=T(e[2]);return t.a<255?`hsla(${i}, ${s}%, ${n}%, ${D(t.a)})`:`hsl(${i}, ${s}%, ${n}%)`}(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,s=t.rgb;let n;const a=e===n?.5:e,o=2*a-1,r=i.a-s.a,l=((o*r==-1?o:(o+r)/(1+o*r))+1)/2;n=1-l,i.r=255&l*i.r+n*s.r+.5,i.g=255&l*i.g+n*s.g+.5,i.b=255&l*i.b+n*s.b+.5,i.a=a*i.a+(1-a)*s.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=function(t,e,i){const s=Q(D(t.r)),n=Q(D(t.g)),a=Q(D(t.b));return{r:O(G(s+i*(Q(D(e.r))-s))),g:O(G(n+i*(Q(D(e.g))-n))),b:O(G(a+i*(Q(D(e.b))-a))),a:t.a+i*(e.a-t.a)}}(this._rgb,t._rgb,e)),this}clone(){return new st(this.rgb)}alpha(t){return this._rgb.a=O(t),this}clearer(t){return this._rgb.a*=1-t,this}greyscale(){const t=this._rgb,e=C(.3*t.r+.59*t.g+.11*t.b);return t.r=t.g=t.b=e,this}opaquer(t){return this._rgb.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return J(this._rgb,2,t),this}darken(t){return J(this._rgb,2,-t),this}saturate(t){return J(this._rgb,1,t),this}desaturate(t){return J(this._rgb,1,-t),this}rotate(t){return function(t,e){var i=j(t);i[0]=U(i[0]+e),i=Y(i),t.r=i[0],t.g=i[1],t.b=i[2]}(this._rgb,t),this}}function nt(){}const at=(()=>{let t=0;return()=>t++})();function ot(t){return null==t}function rt(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return"[object"===e.slice(0,7)&&"Array]"===e.slice(-6)}function lt(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}function ct(t){return("number"==typeof t||t instanceof Number)&&isFinite(+t)}function ht(t,e){return ct(t)?t:e}function dt(t,e){return void 0===t?e:t}function ut(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function ft(t,e,i,s){let n,a,o;if(rt(t))if(a=t.length,s)for(n=a-1;n>=0;n--)e.call(i,t[n],n);else for(n=0;n<a;n++)e.call(i,t[n],n);else if(lt(t))for(o=Object.keys(t),a=o.length,n=0;n<a;n++)e.call(i,t[o[n]],o[n])}function gt(t,e){let i,s,n,a;if(!t||!e||t.length!==e.length)return!1;for(i=0,s=t.length;i<s;++i)if(n=t[i],a=e[i],n.datasetIndex!==a.datasetIndex||n.index!==a.index)return!1;return!0}function pt(t){if(rt(t))return t.map(pt);if(lt(t)){const e=Object.create(null),i=Object.keys(t),s=i.length;let n=0;for(;n<s;++n)e[i[n]]=pt(t[i[n]]);return e}return t}function mt(t){return-1===["__proto__","prototype","constructor"].indexOf(t)}function bt(t,e,i,s){if(!mt(t))return;const n=e[t],a=i[t];lt(n)&<(a)?_t(n,a,s):e[t]=pt(a)}function _t(t,e,i){const s=rt(e)?e:[e],n=s.length;if(!lt(t))return t;const a=(i=i||{}).merger||bt;let o;for(let e=0;e<n;++e){if(o=s[e],!lt(o))continue;const n=Object.keys(o);for(let e=0,s=n.length;e<s;++e)a(n[e],t,o,i)}return t}function xt(t,e){return _t(t,e,{merger:yt})}function yt(t,e,i){if(!mt(t))return;const s=e[t],n=i[t];lt(s)&<(n)?xt(s,n):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=pt(n))}const vt={"":t=>t,x:t=>t.x,y:t=>t.y};function wt(t,e){const i=vt[e]||(vt[e]=function(t){const e=function(t){const e=t.split("."),i=[];let s="";for(const t of e)s+=t,s.endsWith("\\")?s=s.slice(0,-1)+".":(i.push(s),s="");return i}(t);return t=>{for(const i of e){if(""===i)break;t=t&&t[i]}return t}}(e));return i(t)}function kt(t){return t.charAt(0).toUpperCase()+t.slice(1)}const Mt=t=>void 0!==t,Et=t=>"function"==typeof t,St=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0},Pt=Math.PI,Ct=2*Pt,At=Number.POSITIVE_INFINITY,Lt=Pt/180,Ot=Pt/2,Dt=Pt/4,Tt=2*Pt/3,It=Math.log10,Rt=Math.sign;function Nt(t,e,i){return Math.abs(t-e)<i}function zt(t){const e=Math.round(t);t=Nt(t,e,t/1e3)?e:t;const i=Math.pow(10,Math.floor(It(t))),s=t/i;return(s<=1?1:s<=2?2:s<=5?5:10)*i}function Ft(t){return!function(t){return"symbol"==typeof t||"object"==typeof t&&null!==t&&!(Symbol.toPrimitive in t||"toString"in t||"valueOf"in t)}(t)&&!isNaN(parseFloat(t))&&isFinite(t)}function Bt(t){return t*(Pt/180)}function Ht(t){if(!ct(t))return;let e=1,i=0;for(;Math.round(t*e)/e!==t;)e*=10,i++;return i}function Vt(t){return(t%Ct+Ct)%Ct}function Wt(t,e,i){return Math.max(e,Math.min(i,t))}function jt(t,e,i,s=1e-6){return t>=Math.min(e,i)-s&&t<=Math.max(e,i)+s}function $t(t,e,i){i=i||(i=>t[i]<e);let s,n=t.length-1,a=0;for(;n-a>1;)s=a+n>>1,i(s)?a=s:n=s;return{lo:a,hi:n}}const Yt=(t,e,i,s)=>$t(t,i,s?s=>{const n=t[s][e];return n<i||n===i&&t[s+1][e]===i}:s=>t[s][e]<i),Ut=(t,e,i)=>$t(t,i,(s=>t[s][e]>=i)),qt=["push","pop","shift","splice","unshift"];function Xt(t,e){const i=t._chartjs;if(!i)return;const s=i.listeners,n=s.indexOf(e);-1!==n&&s.splice(n,1),s.length>0||(qt.forEach((e=>{delete t[e]})),delete t._chartjs)}const Kt="undefined"==typeof window?function(t){return t()}:window.requestAnimationFrame;function Zt(t,e){let i=[],s=!1;return function(...n){i=n,s||(s=!0,Kt.call(window,(()=>{s=!1,t.apply(e,i)})))}}const Gt=t=>"start"===t?"left":"end"===t?"right":"center",Qt=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2,Jt=t=>0===t||1===t,te=(t,e,i)=>-Math.pow(2,10*(t-=1))*Math.sin((t-e)*Ct/i),ee=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*Ct/i)+1,ie={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>1-Math.cos(t*Ot),easeOutSine:t=>Math.sin(t*Ot),easeInOutSine:t=>-.5*(Math.cos(Pt*t)-1),easeInExpo:t=>0===t?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>1===t?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>Jt(t)?t:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(2-Math.pow(2,-10*(2*t-1))),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>Jt(t)?t:te(t,.075,.3),easeOutElastic:t=>Jt(t)?t:ee(t,.075,.3),easeInOutElastic(t){const e=.1125;return Jt(t)?t:t<.5?.5*te(2*t,e,.45):.5+.5*ee(2*t-1,e,.45)},easeInBack(t){const e=1.70158;return t*t*((e+1)*t-e)},easeOutBack(t){const e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:t=>1-ie.easeOutBounce(1-t),easeOutBounce(t){const e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375},easeInOutBounce:t=>t<.5?.5*ie.easeInBounce(2*t):.5*ie.easeOutBounce(2*t-1)+.5};function se(t){if(t&&"object"==typeof t){const e=t.toString();return"[object CanvasPattern]"===e||"[object CanvasGradient]"===e}return!1}function ne(t){return se(t)?t:new st(t)}function ae(t){return se(t)?t:new st(t).saturate(.5).darken(.1).hexString()}const oe=["x","y","borderWidth","radius","tension"],re=["color","borderColor","backgroundColor"],le=new Map;function ce(t,e,i){return function(t,e){e=e||{};const i=t+JSON.stringify(e);let s=le.get(i);return s||(s=new Intl.NumberFormat(t,e),le.set(i,s)),s}(e,i).format(t)}const he={values:t=>rt(t)?t:""+t,numeric(t,e,i){if(0===t)return"0";const s=this.chart.options.locale;let n,a=t;if(i.length>1){const e=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(e<1e-4||e>1e15)&&(n="scientific"),a=function(t,e){let i=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;return Math.abs(i)>=1&&t!==Math.floor(t)&&(i=t-Math.floor(t)),i}(t,i)}const o=It(Math.abs(a)),r=isNaN(o)?1:Math.max(Math.min(-1*Math.floor(o),20),0),l={notation:n,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(l,this.options.ticks.format),ce(t,s,l)},logarithmic(t,e,i){if(0===t)return"0";const s=i[e].significand||t/Math.pow(10,Math.floor(It(t)));return[1,2,3,5,10,15].includes(s)||e>.8*i.length?he.numeric.call(this,t,e,i):""}};var de={formatters:he};const ue=Object.create(null),fe=Object.create(null);function ge(t,e){if(!e)return t;const i=e.split(".");for(let e=0,s=i.length;e<s;++e){const s=i[e];t=t[s]||(t[s]=Object.create(null))}return t}function pe(t,e,i){return"string"==typeof e?_t(ge(t,e),i):_t(ge(t,""),e)}class me{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=t=>t.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=(t,e)=>ae(e.backgroundColor),this.hoverBorderColor=(t,e)=>ae(e.borderColor),this.hoverColor=(t,e)=>ae(e.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 pe(this,t,e)}get(t){return ge(this,t)}describe(t,e){return pe(fe,t,e)}override(t,e){return pe(ue,t,e)}route(t,e,i,s){const n=ge(this,t),a=ge(this,i),o="_"+e;Object.defineProperties(n,{[o]:{value:n[e],writable:!0},[e]:{enumerable:!0,get(){const t=this[o],e=a[s];return lt(t)?Object.assign({},e,t):dt(t,e)},set(t){this[o]=t}}})}apply(t){t.forEach((t=>t(this)))}}var be=new me({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[function(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),t.set("animations",{colors:{type:"color",properties:re},numbers:{type:"number",properties:oe}}),t.describe("animations",{_fallback:"animation"}),t.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=>0|t}}}})},function(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})},function(t){t.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:de.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t&&"dash"!==t}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t})}]);function _e(t,e,i,s,n){let a=e[n];return a||(a=e[n]=t.measureText(n).width,i.push(n)),a>s&&(s=a),s}function xe(t,e,i){const s=t.currentDevicePixelRatio,n=0!==i?Math.max(i/2,.5):0;return Math.round((e-n)*s)/s+n}function ye(t,e){(e||t)&&((e=e||t.getContext("2d")).save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore())}function ve(t,e,i,s){we(t,e,i,s,null)}function we(t,e,i,s,n){let a,o,r,l,c,h,d,u;const f=e.pointStyle,g=e.rotation,p=e.radius;let m=(g||0)*Lt;if(f&&"object"==typeof f&&(a=f.toString(),"[object HTMLImageElement]"===a||"[object HTMLCanvasElement]"===a))return t.save(),t.translate(i,s),t.rotate(m),t.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),void t.restore();if(!(isNaN(p)||p<=0)){switch(t.beginPath(),f){default:n?t.ellipse(i,s,n/2,p,0,0,Ct):t.arc(i,s,p,0,Ct),t.closePath();break;case"triangle":h=n?n/2:p,t.moveTo(i+Math.sin(m)*h,s-Math.cos(m)*p),m+=Tt,t.lineTo(i+Math.sin(m)*h,s-Math.cos(m)*p),m+=Tt,t.lineTo(i+Math.sin(m)*h,s-Math.cos(m)*p),t.closePath();break;case"rectRounded":c=.516*p,l=p-c,o=Math.cos(m+Dt)*l,d=Math.cos(m+Dt)*(n?n/2-c:l),r=Math.sin(m+Dt)*l,u=Math.sin(m+Dt)*(n?n/2-c:l),t.arc(i-d,s-r,c,m-Pt,m-Ot),t.arc(i+u,s-o,c,m-Ot,m),t.arc(i+d,s+r,c,m,m+Ot),t.arc(i-u,s+o,c,m+Ot,m+Pt),t.closePath();break;case"rect":if(!g){l=Math.SQRT1_2*p,h=n?n/2:l,t.rect(i-h,s-l,2*h,2*l);break}m+=Dt;case"rectRot":d=Math.cos(m)*(n?n/2:p),o=Math.cos(m)*p,r=Math.sin(m)*p,u=Math.sin(m)*(n?n/2:p),t.moveTo(i-d,s-r),t.lineTo(i+u,s-o),t.lineTo(i+d,s+r),t.lineTo(i-u,s+o),t.closePath();break;case"crossRot":m+=Dt;case"cross":d=Math.cos(m)*(n?n/2:p),o=Math.cos(m)*p,r=Math.sin(m)*p,u=Math.sin(m)*(n?n/2:p),t.moveTo(i-d,s-r),t.lineTo(i+d,s+r),t.moveTo(i+u,s-o),t.lineTo(i-u,s+o);break;case"star":d=Math.cos(m)*(n?n/2:p),o=Math.cos(m)*p,r=Math.sin(m)*p,u=Math.sin(m)*(n?n/2:p),t.moveTo(i-d,s-r),t.lineTo(i+d,s+r),t.moveTo(i+u,s-o),t.lineTo(i-u,s+o),m+=Dt,d=Math.cos(m)*(n?n/2:p),o=Math.cos(m)*p,r=Math.sin(m)*p,u=Math.sin(m)*(n?n/2:p),t.moveTo(i-d,s-r),t.lineTo(i+d,s+r),t.moveTo(i+u,s-o),t.lineTo(i-u,s+o);break;case"line":o=n?n/2:Math.cos(m)*p,r=Math.sin(m)*p,t.moveTo(i-o,s-r),t.lineTo(i+o,s+r);break;case"dash":t.moveTo(i,s),t.lineTo(i+Math.cos(m)*(n?n/2:p),s+Math.sin(m)*p);break;case!1:t.closePath()}t.fill(),e.borderWidth>0&&t.stroke()}}function ke(t,e,i){return i=i||.5,!e||t&&t.x>e.left-i&&t.x<e.right+i&&t.y>e.top-i&&t.y<e.bottom+i}function Me(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function Ee(t){t.restore()}function Se(t,e,i,s,n){if(n.strikethrough||n.underline){const a=t.measureText(s),o=e-a.actualBoundingBoxLeft,r=e+a.actualBoundingBoxRight,l=i-a.actualBoundingBoxAscent,c=i+a.actualBoundingBoxDescent,h=n.strikethrough?(l+c)/2:c;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=n.decorationWidth||2,t.moveTo(o,h),t.lineTo(r,h),t.stroke()}}function Pe(t,e){const i=t.fillStyle;t.fillStyle=e.color,t.fillRect(e.left,e.top,e.width,e.height),t.fillStyle=i}function Ce(t,e,i,s,n,a={}){const o=rt(e)?e:[e],r=a.strokeWidth>0&&""!==a.strokeColor;let l,c;for(t.save(),t.font=n.string,function(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]),ot(e.rotation)||t.rotate(e.rotation),e.color&&(t.fillStyle=e.color),e.textAlign&&(t.textAlign=e.textAlign),e.textBaseline&&(t.textBaseline=e.textBaseline)}(t,a),l=0;l<o.length;++l)c=o[l],a.backdrop&&Pe(t,a.backdrop),r&&(a.strokeColor&&(t.strokeStyle=a.strokeColor),ot(a.strokeWidth)||(t.lineWidth=a.strokeWidth),t.strokeText(c,i,s,a.maxWidth)),t.fillText(c,i,s,a.maxWidth),Se(t,i,s,c,a),s+=Number(n.lineHeight);t.restore()}function Ae(t,e){const{x:i,y:s,w:n,h:a,radius:o}=e;t.arc(i+o.topLeft,s+o.topLeft,o.topLeft,1.5*Pt,Pt,!0),t.lineTo(i,s+a-o.bottomLeft),t.arc(i+o.bottomLeft,s+a-o.bottomLeft,o.bottomLeft,Pt,Ot,!0),t.lineTo(i+n-o.bottomRight,s+a),t.arc(i+n-o.bottomRight,s+a-o.bottomRight,o.bottomRight,Ot,0,!0),t.lineTo(i+n,s+o.topRight),t.arc(i+n-o.topRight,s+o.topRight,o.topRight,0,-Ot,!0),t.lineTo(i+o.topLeft,s)}const Le=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Oe=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function De(t,e){const i=(""+t).match(Le);if(!i||"normal"===i[1])return 1.2*e;switch(t=+i[2],i[3]){case"px":return t;case"%":t/=100}return e*t}function Te(t,e){const i={},s=lt(e),n=s?Object.keys(e):e,a=lt(t)?s?i=>dt(t[i],t[e[i]]):e=>t[e]:()=>t;for(const t of n)i[t]=+a(t)||0;return i}function Ie(t){return Te(t,{top:"y",right:"x",bottom:"y",left:"x"})}function Re(t){return Te(t,["topLeft","topRight","bottomLeft","bottomRight"])}function Ne(t){const e=Ie(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function ze(t,e){t=t||{},e=e||be.font;let i=dt(t.size,e.size);"string"==typeof i&&(i=parseInt(i,10));let s=dt(t.style,e.style);s&&!(""+s).match(Oe)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);const n={family:dt(t.family,e.family),lineHeight:De(dt(t.lineHeight,e.lineHeight),i),size:i,style:s,weight:dt(t.weight,e.weight),string:""};return n.string=function(t){return!t||ot(t.size)||ot(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}(n),n}function Fe(t,e,i,s){let n,a,o,r=!0;for(n=0,a=t.length;n<a;++n)if(o=t[n],void 0!==o&&(void 0!==e&&"function"==typeof o&&(o=o(e),r=!1),void 0!==i&&rt(o)&&(o=o[i%o.length],r=!1),void 0!==o))return s&&!r&&(s.cacheable=!1),o}function Be(t,e){return Object.assign(Object.create(t),e)}function He(t,e=[""],i,s,n=()=>t[0]){const a=i||t;void 0===s&&(s=Ge("_fallback",t));const o={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:a,_fallback:s,_getTarget:n,override:i=>He([i,...t],e,a,s)};return new Proxy(o,{deleteProperty:(e,i)=>(delete e[i],delete e._keys,delete t[0][i],!0),get:(i,s)=>Ye(i,s,(()=>function(t,e,i,s){let n;for(const a of e)if(n=Ge(je(a,t),i),void 0!==n)return $e(t,n)?Ke(i,s,t,n):n}(s,e,t,i))),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],e),getPrototypeOf:()=>Reflect.getPrototypeOf(t[0]),has:(t,e)=>Qe(t).includes(e),ownKeys:t=>Qe(t),set(t,e,i){const s=t._storage||(t._storage=n());return t[e]=s[e]=i,delete t._keys,!0}})}function Ve(t,e,i,s){const n={_cacheable:!1,_proxy:t,_context:e,_subProxy:i,_stack:new Set,_descriptors:We(t,s),setContext:e=>Ve(t,e,i,s),override:n=>Ve(t.override(n),e,i,s)};return new Proxy(n,{deleteProperty:(e,i)=>(delete e[i],delete t[i],!0),get:(t,e,i)=>Ye(t,e,(()=>function(t,e,i){const{_proxy:s,_context:n,_subProxy:a,_descriptors:o}=t;let r=s[e];return Et(r)&&o.isScriptable(e)&&(r=function(t,e,i,s){const{_proxy:n,_context:a,_subProxy:o,_stack:r}=i;if(r.has(t))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+t);r.add(t);let l=e(a,o||s);return r.delete(t),$e(t,l)&&(l=Ke(n._scopes,n,t,l)),l}(e,r,t,i)),rt(r)&&r.length&&(r=function(t,e,i,s){const{_proxy:n,_context:a,_subProxy:o,_descriptors:r}=i;if(void 0!==a.index&&s(t))return e[a.index%e.length];if(lt(e[0])){const i=e,s=n._scopes.filter((t=>t!==i));e=[];for(const l of i){const i=Ke(s,n,t,l);e.push(Ve(i,a,o&&o[t],r))}}return e}(e,r,t,o.isIndexable)),$e(e,r)&&(r=Ve(r,n,a&&a[e],o)),r}(t,e,i))),getOwnPropertyDescriptor:(e,i)=>e._descriptors.allKeys?Reflect.has(t,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,i),getPrototypeOf:()=>Reflect.getPrototypeOf(t),has:(e,i)=>Reflect.has(t,i),ownKeys:()=>Reflect.ownKeys(t),set:(e,i,s)=>(t[i]=s,delete e[i],!0)})}function We(t,e={scriptable:!0,indexable:!0}){const{_scriptable:i=e.scriptable,_indexable:s=e.indexable,_allKeys:n=e.allKeys}=t;return{allKeys:n,scriptable:i,indexable:s,isScriptable:Et(i)?i:()=>i,isIndexable:Et(s)?s:()=>s}}const je=(t,e)=>t?t+kt(e):e,$e=(t,e)=>lt(e)&&"adapters"!==t&&(null===Object.getPrototypeOf(e)||e.constructor===Object);function Ye(t,e,i){if(Object.prototype.hasOwnProperty.call(t,e)||"constructor"===e)return t[e];const s=i();return t[e]=s,s}function Ue(t,e,i){return Et(t)?t(e,i):t}const qe=(t,e)=>!0===t?e:"string"==typeof t?wt(e,t):void 0;function Xe(t,e,i,s,n){for(const a of e){const e=qe(i,a);if(e){t.add(e);const a=Ue(e._fallback,i,n);if(void 0!==a&&a!==i&&a!==s)return a}else if(!1===e&&void 0!==s&&i!==s)return null}return!1}function Ke(t,e,i,s){const n=e._rootScopes,a=Ue(e._fallback,i,s),o=[...t,...n],r=new Set;r.add(s);let l=Ze(r,o,i,a||i,s);return null!==l&&(void 0===a||a===i||(l=Ze(r,o,a,l,s),null!==l))&&He(Array.from(r),[""],n,a,(()=>function(t,e,i){const s=t._getTarget();e in s||(s[e]={});const n=s[e];return rt(n)&<(i)?i:n||{}}(e,i,s)))}function Ze(t,e,i,s,n){for(;i;)i=Xe(t,e,i,s,n);return i}function Ge(t,e){for(const i of e){if(!i)continue;const e=i[t];if(void 0!==e)return e}}function Qe(t){let e=t._keys;return e||(e=t._keys=function(t){const e=new Set;for(const i of t)for(const t of Object.keys(i).filter((t=>!t.startsWith("_"))))e.add(t);return Array.from(e)}(t._scopes)),e}function Je(){return"undefined"!=typeof window&&"undefined"!=typeof document}function ti(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function ei(t,e,i){let s;return"string"==typeof t?(s=parseInt(t,10),-1!==t.indexOf("%")&&(s=s/100*e.parentNode[i])):s=t,s}Number.EPSILON;const ii=t=>t.ownerDocument.defaultView.getComputedStyle(t,null),si=["top","right","bottom","left"];function ni(t,e,i){const s={};i=i?"-"+i:"";for(let n=0;n<4;n++){const a=si[n];s[a]=parseFloat(t[e+"-"+a+i])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}function ai(t,e){if("native"in t)return t;const{canvas:i,currentDevicePixelRatio:s}=e,n=ii(i),a="border-box"===n.boxSizing,o=ni(n,"padding"),r=ni(n,"border","width"),{x:l,y:c,box:h}=function(t,e){const i=t.touches,s=i&&i.length?i[0]:t,{offsetX:n,offsetY:a}=s;let o,r,l=!1;if(((t,e,i)=>(t>0||e>0)&&(!i||!i.shadowRoot))(n,a,t.target))o=n,r=a;else{const t=e.getBoundingClientRect();o=s.clientX-t.left,r=s.clientY-t.top,l=!0}return{x:o,y:r,box:l}}(t,i),d=o.left+(h&&r.left),u=o.top+(h&&r.top);let{width:f,height:g}=e;return a&&(f-=o.width+r.width,g-=o.height+r.height),{x:Math.round((l-d)/f*i.width/s),y:Math.round((c-u)/g*i.height/s)}}const oi=t=>Math.round(10*t)/10;function ri(t,e,i){const s=e||1,n=Math.floor(t.height*s),a=Math.floor(t.width*s);t.height=Math.floor(t.height),t.width=Math.floor(t.width);const o=t.canvas;return o.style&&(i||!o.style.height&&!o.style.width)&&(o.style.height=`${t.height}px`,o.style.width=`${t.width}px`),(t.currentDevicePixelRatio!==s||o.height!==n||o.width!==a)&&(t.currentDevicePixelRatio=s,o.height=n,o.width=a,t.ctx.setTransform(s,0,0,s,0,0),!0)}const li=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};Je()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch(t){}return t}();function ci(t,e){const i=function(t,e){return ii(t).getPropertyValue(e)}(t,e),s=i&&i.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function hi(t,e,i){return t?function(t,e){return{x:i=>t+t+e-i,setWidth(t){e=t},textAlign:t=>"center"===t?t:"right"===t?"left":"right",xPlus:(t,e)=>t-e,leftForLtr:(t,e)=>t-e}}(e,i):{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,e)=>t+e,leftForLtr:(t,e)=>t}}function di(t,e){let i,s;"ltr"!==e&&"rtl"!==e||(i=t.canvas.style,s=[i.getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=s)}function ui(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}class fi{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){const n=e.listeners[s],a=e.duration;n.forEach((s=>s({chart:t,initial:e.initial,numSteps:a,currentStep:Math.min(i-e.start,a)})))}_refresh(){this._request||(this._running=!0,this._request=Kt.call(window,(()=>{this._update(),this._request=null,this._running&&this._refresh()})))}_update(t=Date.now()){let e=0;this._charts.forEach(((i,s)=>{if(!i.running||!i.items.length)return;const n=i.items;let a,o=n.length-1,r=!1;for(;o>=0;--o)a=n[o],a._active?(a._total>i.duration&&(i.duration=a._total),a.tick(t),r=!0):(n[o]=n[n.length-1],n.pop());r&&(s.draw(),this._notify(s,i,t,"progress")),n.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=n.length})),this._lastDate=t,0===e&&(this._running=!1)}_getAnims(t){const e=this._charts;let 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){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce(((t,e)=>Math.max(t,e._duration)),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!!(e&&e.running&&e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var gi=new fi;const pi="transparent",mi={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){const s=ne(t||pi),n=s.valid&&ne(e||pi);return n&&n.valid?n.mix(s,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class bi{constructor(t,e,i,s){const n=e[i];s=Fe([t.to,s,n,t.from]);const a=Fe([t.from,n,s]);this._active=!0,this._fn=t.fn||mi[t.type||typeof a],this._easing=ie[t.easing]||ie.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=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const s=this._target[this._prop],n=i-this._start,a=this._duration-n;this._start=i,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=n,this._loop=!!t.loop,this._to=Fe([t.to,e,s,t.from]),this._from=Fe([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,s=this._prop,n=this._from,a=this._loop,o=this._to;let r;if(this._active=n!==o&&(a||e<i),!this._active)return this._target[s]=o,void this._notify(!0);e<0?this._target[s]=n:(r=e/i%2,r=a&&r>1?2-r:r,r=this._easing(Math.min(1,Math.max(0,r))),this._target[s]=this._fn(n,o,r))}wait(){const t=this._promises||(this._promises=[]);return new Promise(((e,i)=>{t.push({res:e,rej:i})}))}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let t=0;t<i.length;t++)i[t][e]()}}class _i{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!lt(t))return;const e=Object.keys(be.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach((s=>{const n=t[s];if(!lt(n))return;const a={};for(const t of e)a[t]=n[t];(rt(n.properties)&&n.properties||[s]).forEach((t=>{t!==s&&i.has(t)||i.set(t,a)}))}))}_animateOptions(t,e){const i=e.options,s=function(t,e){if(!e)return;let i=t.options;if(i)return i.$shared&&(t.options=i=Object.assign({},i,{$shared:!1,$animations:{}})),i;t.options=e}(t,i);if(!s)return[];const n=this._createAnimations(s,i);return i.$shared&&function(t,e){const i=[],s=Object.keys(e);for(let e=0;e<s.length;e++){const n=t[s[e]];n&&n.active()&&i.push(n.wait())}return Promise.all(i)}(t.options.$animations,i).then((()=>{t.options=i}),(()=>{})),n}_createAnimations(t,e){const i=this._properties,s=[],n=t.$animations||(t.$animations={}),a=Object.keys(e),o=Date.now();let r;for(r=a.length-1;r>=0;--r){const l=a[r];if("$"===l.charAt(0))continue;if("options"===l){s.push(...this._animateOptions(t,e));continue}const c=e[l];let h=n[l];const d=i.get(l);if(h){if(d&&h.active()){h.update(d,c,o);continue}h.cancel()}d&&d.duration?(n[l]=h=new bi(d,t,l,c),s.push(h)):t[l]=c}return s}update(t,e){if(0===this._properties.size)return void Object.assign(t,e);const i=this._createAnimations(t,e);return i.length?(gi.add(this._chart,i),!0):void 0}}function xi(t,e){const i=t&&t.options||{},s=i.reverse,n=void 0===i.min?e:0,a=void 0===i.max?e:0;return{start:s?a:n,end:s?n:a}}function yi(t,e){const i=[],s=t._getSortedDatasetMetas(e);let n,a;for(n=0,a=s.length;n<a;++n)i.push(s[n].index);return i}function vi(t,e,i,s={}){const n=t.keys,a="single"===s.mode;let o,r,l,c;if(null===e)return;let h=!1;for(o=0,r=n.length;o<r;++o){if(l=+n[o],l===i){if(h=!0,s.all)continue;break}c=t.values[l],ct(c)&&(a||0===e||Rt(e)===Rt(c))&&(e+=c)}return h||s.all?e:0}function wi(t,e){const i=t&&t.options.stacked;return i||void 0===i&&void 0!==e.stack}function ki(t,e,i){const s=t[e]||(t[e]={});return s[i]||(s[i]={})}function Mi(t,e,i,s){for(const n of e.getMatchingVisibleMetas(s).reverse()){const e=t[n.index];if(i&&e>0||!i&&e<0)return n.index}return null}function Ei(t,e){const{chart:i,_cachedMeta:s}=t,n=i._stacks||(i._stacks={}),{iScale:a,vScale:o,index:r}=s,l=a.axis,c=o.axis,h=function(t,e,i){return`${t.id}.${e.id}.${i.stack||i.type}`}(a,o,s),d=e.length;let u;for(let t=0;t<d;++t){const i=e[t],{[l]:a,[c]:d}=i;u=(i._stacks||(i._stacks={}))[c]=ki(n,h,a),u[r]=d,u._top=Mi(u,o,!0,s.type),u._bottom=Mi(u,o,!1,s.type),(u._visualValues||(u._visualValues={}))[r]=d}}function Si(t,e){const i=t.scales;return Object.keys(i).filter((t=>i[t].axis===e)).shift()}function Pi(t,e){const i=t.controller.index,s=t.vScale&&t.vScale.axis;if(s){e=e||t._parsed;for(const t of e){const e=t._stacks;if(!e||void 0===e[s]||void 0===e[s][i])return;delete e[s][i],void 0!==e[s]._visualValues&&void 0!==e[s]._visualValues[i]&&delete e[s]._visualValues[i]}}}const Ci=t=>"reset"===t||"none"===t,Ai=(t,e)=>e?t:Object.assign({},t);class Li{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=wi(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&&Pi(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(t,e,i,s)=>"x"===t?e:"r"===t?s:i,n=e.xAxisID=dt(i.xAxisID,Si(t,"x")),a=e.yAxisID=dt(i.yAxisID,Si(t,"y")),o=e.rAxisID=dt(i.rAxisID,Si(t,"r")),r=e.indexAxis,l=e.iAxisID=s(r,n,a,o),c=e.vAxisID=s(r,a,n,o);e.xScale=this.getScaleForId(n),e.yScale=this.getScaleForId(a),e.rScale=this.getScaleForId(o),e.iScale=this.getScaleForId(l),e.vScale=this.getScaleForId(c)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Xt(this._data,this),t._stacked&&Pi(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(lt(e)){const t=this._cachedMeta;this._data=function(t,e){const{iScale:i,vScale:s}=e,n="x"===i.axis?"x":"y",a="x"===s.axis?"x":"y",o=Object.keys(t),r=new Array(o.length);let l,c,h;for(l=0,c=o.length;l<c;++l)h=o[l],r[l]={[n]:h,[a]:t[h]};return r}(e,t)}else if(i!==e){if(i){Xt(i,this);const t=this._cachedMeta;Pi(t),t._parsed=[]}e&&Object.isExtensible(e)&&((s=e)._chartjs?s._chartjs.listeners.push(this):(Object.defineProperty(s,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[this]}}),qt.forEach((t=>{const e="_onData"+kt(t),i=s[t];Object.defineProperty(s,t,{configurable:!0,enumerable:!1,value(...t){const n=i.apply(this,t);return s._chartjs.listeners.forEach((i=>{"function"==typeof i[e]&&i[e](...t)})),n}})})))),this._syncList=[],this._data=e}var s}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const n=e._stacked;e._stacked=wi(e.vScale,e),e.stack!==i.stack&&(s=!0,Pi(e),e.stack=i.stack),this._resyncElements(t),(s||n!==e._stacked)&&(Ei(this,e._parsed),e._stacked=wi(e.vScale,e))}configure(){const 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){const{_cachedMeta:i,_data:s}=this,{iScale:n,_stacked:a}=i,o=n.axis;let r,l,c,h=0===t&&e===s.length||i._sorted,d=t>0&&i._parsed[t-1];if(!1===this._parsing)i._parsed=s,i._sorted=!0,c=s;else{c=rt(s[t])?this.parseArrayData(i,s,t,e):lt(s[t])?this.parseObjectData(i,s,t,e):this.parsePrimitiveData(i,s,t,e);const n=()=>null===l[o]||d&&l[o]<d[o];for(r=0;r<e;++r)i._parsed[r+t]=l=c[r],h&&(n()&&(h=!1),d=l);i._sorted=h}a&&Ei(this,c)}parsePrimitiveData(t,e,i,s){const{iScale:n,vScale:a}=t,o=n.axis,r=a.axis,l=n.getLabels(),c=n===a,h=new Array(s);let d,u,f;for(d=0,u=s;d<u;++d)f=d+i,h[d]={[o]:c||n.parse(l[f],f),[r]:a.parse(e[f],f)};return h}parseArrayData(t,e,i,s){const{xScale:n,yScale:a}=t,o=new Array(s);let r,l,c,h;for(r=0,l=s;r<l;++r)c=r+i,h=e[c],o[r]={x:n.parse(h[0],c),y:a.parse(h[1],c)};return o}parseObjectData(t,e,i,s){const{xScale:n,yScale:a}=t,{xAxisKey:o="x",yAxisKey:r="y"}=this._parsing,l=new Array(s);let c,h,d,u;for(c=0,h=s;c<h;++c)d=c+i,u=e[d],l[c]={x:n.parse(wt(u,o),d),y:a.parse(wt(u,r),d)};return l}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){const s=this.chart,n=this._cachedMeta,a=e[t.axis];return vi({keys:yi(s,!0),values:e._stacks[t.axis]._visualValues},a,n.index,{mode:i})}updateRangeFromParsed(t,e,i,s){const n=i[e.axis];let a=null===n?NaN:n;const o=s&&i._stacks[e.axis];s&&o&&(s.values=o,a=vi(s,n,this._cachedMeta.index)),t.min=Math.min(t.min,a),t.max=Math.max(t.max,a)}getMinMax(t,e){const i=this._cachedMeta,s=i._parsed,n=i._sorted&&t===i.iScale,a=s.length,o=this._getOtherScale(t),r=((t,e,i)=>t&&!e.hidden&&e._stacked&&{keys:yi(i,!0),values:null})(e,i,this.chart),l={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:c,max:h}=function(t){const{min:e,max:i,minDefined:s,maxDefined:n}=t.getUserBounds();return{min:s?e:Number.NEGATIVE_INFINITY,max:n?i:Number.POSITIVE_INFINITY}}(o);let d,u;function f(){u=s[d];const e=u[o.axis];return!ct(u[t.axis])||c>e||h<e}for(d=0;d<a&&(f()||(this.updateRangeFromParsed(l,t,u,r),!n));++d);if(n)for(d=a-1;d>=0;--d)if(!f()){this.updateRangeFromParsed(l,t,u,r);break}return l}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let s,n,a;for(s=0,n=e.length;s<n;++s)a=e[s][t.axis],ct(a)&&i.push(a);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,i=e.iScale,s=e.vScale,n=this.getParsed(t);return{label:i?""+i.getLabelForValue(n[i.axis]):"",value:s?""+s.getLabelForValue(n[s.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=function(t){let e,i,s,n;return lt(t)?(e=t.top,i=t.right,s=t.bottom,n=t.left):e=i=s=n=t,{top:e,right:i,bottom:s,left:n,disabled:!1===t}}(dt(this.options.clip,function(t,e,i){if(!1===i)return!1;const s=xi(t,i),n=xi(e,i);return{top:n.end,right:s.end,bottom:n.start,left:s.start}}(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,i=this._cachedMeta,s=i.data||[],n=e.chartArea,a=[],o=this._drawStart||0,r=this._drawCount||s.length-o,l=this.options.drawActiveElementsOnTop;let c;for(i.dataset&&i.dataset.draw(t,n,o,r),c=o;c<o+r;++c){const e=s[c];e.hidden||(e.active&&l?a.push(e):e.draw(t,n))}for(c=0;c<a.length;++c)a[c].draw(t,n)}getStyle(t,e){const i=e?"active":"default";return void 0===t&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){const s=this.getDataset();let n;if(t>=0&&t<this._cachedMeta.data.length){const e=this._cachedMeta.data[t];n=e.$context||(e.$context=function(t,e,i){return Be(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:i,index:e,mode:"default",type:"data"})}(this.getContext(),t,e)),n.parsed=this.getParsed(t),n.raw=s.data[t],n.index=n.dataIndex=t}else n=this.$context||(this.$context=function(t,e){return Be(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}(this.chart.getContext(),this.index)),n.dataset=s,n.index=n.datasetIndex=this.index;return n.active=!!e,n.mode=i,n}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",i){const s="active"===e,n=this._cachedDataOpts,a=t+"-"+e,o=n[a],r=this.enableOptionSharing&&Mt(i);if(o)return Ai(o,r);const l=this.chart.config,c=l.datasetElementScopeKeys(this._type,t),h=s?[`${t}Hover`,"hover",t,""]:[t,""],d=l.getOptionScopes(this.getDataset(),c),u=Object.keys(be.elements[t]),f=l.resolveNamedOptions(d,u,(()=>this.getContext(i,s,e)),h);return f.$shared&&(f.$shared=r,n[a]=Object.freeze(Ai(f,r))),f}_resolveAnimations(t,e,i){const s=this.chart,n=this._cachedDataOpts,a=`animation-${e}`,o=n[a];if(o)return o;let r;if(!1!==s.options.animation){const s=this.chart.config,n=s.datasetAnimationScopeKeys(this._type,e),a=s.getOptionScopes(this.getDataset(),n);r=s.createResolver(a,this.getContext(t,i,e))}const l=new _i(s,r&&r.animations);return r&&r._cacheable&&(n[a]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Ci(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,n=this.getSharedOptions(i),a=this.includeOptions(e,n)||n!==s;return this.updateSharedOptions(n,e,i),{sharedOptions:n,includeOptions:a}}updateElement(t,e,i,s){Ci(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!Ci(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;const n=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(n)||n})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[t,e,i]of this._syncList)this[t](e,i);this._syncList=[];const s=i.length,n=e.length,a=Math.min(n,s);a&&this.parse(0,a),n>s?this._insertElements(s,n-s,t):n<s&&this._removeElements(n,s-n)}_insertElements(t,e,i=!0){const s=this._cachedMeta,n=s.data,a=t+e;let o;const r=t=>{for(t.length+=e,o=t.length-1;o>=a;o--)t[o]=t[o-e]};for(r(n),o=t;o<a;++o)n[o]=new this.dataElementType;this._parsing&&r(s._parsed),this.parse(t,e),i&&this.updateElements(n,t,e,"reset")}updateElements(t,e,i,s){}_removeElements(t,e){const i=this._cachedMeta;if(this._parsing){const s=i._parsed.splice(t,e);i._stacked&&Pi(i,s)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,i,s]=t;this[e](i,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function Oi(t){const e=t.iScale,i=function(t,e){if(!t._cache.$bar){const i=t.getMatchingVisibleMetas(e);let s=[];for(let e=0,n=i.length;e<n;e++)s=s.concat(i[e].controller.getAllParsedValues(t));t._cache.$bar=function(t){const e=new Set(t);return e.size===t.length?t:Array.from(e)}(s.sort(((t,e)=>t-e)))}return t._cache.$bar}(e,t.type);let s,n,a,o,r=e._length;const l=()=>{32767!==a&&-32768!==a&&(Mt(o)&&(r=Math.min(r,Math.abs(a-o)||r)),o=a)};for(s=0,n=i.length;s<n;++s)a=e.getPixelForValue(i[s]),l();for(o=void 0,s=0,n=e.ticks.length;s<n;++s)a=e.getPixelForTick(s),l();return r}function Di(t,e,i,s){return rt(t)?function(t,e,i,s){const n=i.parse(t[0],s),a=i.parse(t[1],s),o=Math.min(n,a),r=Math.max(n,a);let l=o,c=r;Math.abs(o)>Math.abs(r)&&(l=r,c=o),e[i.axis]=c,e._custom={barStart:l,barEnd:c,start:n,end:a,min:o,max:r}}(t,e,i,s):e[i.axis]=i.parse(t,s),e}function Ti(t,e,i,s){const n=t.iScale,a=t.vScale,o=n.getLabels(),r=n===a,l=[];let c,h,d,u;for(c=i,h=i+s;c<h;++c)u=e[c],d={},d[n.axis]=r||n.parse(o[c],c),l.push(Di(u,d,a,c));return l}function Ii(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}function Ri(t,e,i,s){let n=e.borderSkipped;const a={};if(!n)return void(t.borderSkipped=a);if(!0===n)return void(t.borderSkipped={top:!0,right:!0,bottom:!0,left:!0});const{start:o,end:r,reverse:l,top:c,bottom:h}=function(t){let e,i,s,n,a;return t.horizontal?(e=t.base>t.x,i="left",s="right"):(e=t.base<t.y,i="bottom",s="top"),e?(n="end",a="start"):(n="start",a="end"),{start:i,end:s,reverse:e,top:n,bottom:a}}(t);"middle"===n&&i&&(t.enableBorderRadius=!0,(i._top||0)===s?n=c:(i._bottom||0)===s?n=h:(a[Ni(h,o,r,l)]=!0,n=c)),a[Ni(n,o,r,l)]=!0,t.borderSkipped=a}function Ni(t,e,i,s){var n,a,o;return s?(o=i,t=zi(t=(n=t)===(a=e)?o:n===o?a:n,i,e)):t=zi(t,e,i),t}function zi(t,e,i){return"start"===t?e:"end"===t?i:t}function Fi(t,{inflateAmount:e},i){t.inflateAmount="auto"===e?1===i?.33:0:e}function Bi(t,e,i,s){const{controller:n,data:a,_sorted:o}=t,r=n._cachedMeta.iScale,l=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null;if(r&&e===r.axis&&"r"!==e&&o&&a.length){const o=r._reversePixels?Ut:Yt;if(!s){const s=o(a,e,i);if(l){const{vScale:e}=n._cachedMeta,{_parsed:i}=t,a=i.slice(0,s.lo+1).reverse().findIndex((t=>!ot(t[e.axis])));s.lo-=Math.max(0,a);const o=i.slice(s.hi).findIndex((t=>!ot(t[e.axis])));s.hi+=Math.max(0,o)}return s}if(n._sharedOptions){const t=a[0],s="function"==typeof t.getRange&&t.getRange(e);if(s){const t=o(a,e,i-s),n=o(a,e,i+s);return{lo:t.lo,hi:n.hi}}}}return{lo:0,hi:a.length-1}}function Hi(t,e,i,s,n){const a=t.getSortedVisibleDatasetMetas(),o=i[e];for(let t=0,i=a.length;t<i;++t){const{index:i,data:r}=a[t],{lo:l,hi:c}=Bi(a[t],e,o,n);for(let t=l;t<=c;++t){const e=r[t];e.skip||s(e,i,t)}}}function Vi(t,e,i,s,n){const a=[];return n||t.isPointInArea(e)?(Hi(t,i,e,(function(i,o,r){(n||ke(i,t.chartArea,0))&&i.inRange(e.x,e.y,s)&&a.push({element:i,datasetIndex:o,index:r})}),!0),a):a}function Wi(t,e,i,s,n,a){return a||t.isPointInArea(e)?"r"!==i||s?function(t,e,i,s,n,a){let o=[];const r=function(t){const e=-1!==t.indexOf("x"),i=-1!==t.indexOf("y");return function(t,s){const n=e?Math.abs(t.x-s.x):0,a=i?Math.abs(t.y-s.y):0;return Math.sqrt(Math.pow(n,2)+Math.pow(a,2))}}(i);let l=Number.POSITIVE_INFINITY;return Hi(t,i,e,(function(i,c,h){const d=i.inRange(e.x,e.y,n);if(s&&!d)return;const u=i.getCenterPoint(n);if(!a&&!t.isPointInArea(u)&&!d)return;const f=r(e,u);f<l?(o=[{element:i,datasetIndex:c,index:h}],l=f):f===l&&o.push({element:i,datasetIndex:c,index:h})})),o}(t,e,i,s,n,a):function(t,e,i,s){let n=[];return Hi(t,i,e,(function(t,i,a){const{startAngle:o,endAngle:r}=t.getProps(["startAngle","endAngle"],s),{angle:l}=function(t,e){const i=e.x-t.x,s=e.y-t.y,n=Math.sqrt(i*i+s*s);let a=Math.atan2(s,i);return a<-.5*Pt&&(a+=Ct),{angle:a,distance:n}}(t,{x:e.x,y:e.y});(function(t,e,i,s){const n=Vt(t),a=Vt(e),o=Vt(i),r=Vt(a-n),l=Vt(o-n),c=Vt(n-a),h=Vt(n-o);return n===a||n===o||s&&a===o||r>l&&c<h})(l,o,r)&&n.push({element:t,datasetIndex:i,index:a})})),n}(t,e,i,n):[]}function ji(t,e,i,s,n){const a=[],o="x"===i?"inXRange":"inYRange";let r=!1;return Hi(t,i,e,((t,s,l)=>{t[o]&&t[o](e[i],n)&&(a.push({element:t,datasetIndex:s,index:l}),r=r||t.inRange(e.x,e.y,n))})),s&&!r?[]:a}var $i={evaluateInteractionItems:Hi,modes:{index(t,e,i,s){const n=ai(e,t),a=i.axis||"x",o=i.includeInvisible||!1,r=i.intersect?Vi(t,n,a,s,o):Wi(t,n,a,!1,s,o),l=[];return r.length?(t.getSortedVisibleDatasetMetas().forEach((t=>{const e=r[0].index,i=t.data[e];i&&!i.skip&&l.push({element:i,datasetIndex:t.index,index:e})})),l):[]},dataset(t,e,i,s){const n=ai(e,t),a=i.axis||"xy",o=i.includeInvisible||!1;let r=i.intersect?Vi(t,n,a,s,o):Wi(t,n,a,!1,s,o);if(r.length>0){const e=r[0].datasetIndex,i=t.getDatasetMeta(e).data;r=[];for(let t=0;t<i.length;++t)r.push({element:i[t],datasetIndex:e,index:t})}return r},point:(t,e,i,s)=>Vi(t,ai(e,t),i.axis||"xy",s,i.includeInvisible||!1),nearest(t,e,i,s){const n=ai(e,t),a=i.axis||"xy",o=i.includeInvisible||!1;return Wi(t,n,a,i.intersect,s,o)},x:(t,e,i,s)=>ji(t,ai(e,t),"x",i.intersect,s),y:(t,e,i,s)=>ji(t,ai(e,t),"y",i.intersect,s)}};const Yi=["left","top","right","bottom"];function Ui(t,e){return t.filter((t=>t.pos===e))}function qi(t,e){return t.filter((t=>-1===Yi.indexOf(t.pos)&&t.box.axis===e))}function Xi(t,e){return t.sort(((t,i)=>{const s=e?i:t,n=e?t:i;return s.weight===n.weight?s.index-n.index:s.weight-n.weight}))}function Ki(t,e,i,s){return Math.max(t[i],e[i])+Math.max(t[s],e[s])}function Zi(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function Gi(t,e,i,s){const{pos:n,box:a}=i,o=t.maxPadding;if(!lt(n)){i.size&&(t[n]-=i.size);const e=s[i.stack]||{size:0,count:1};e.size=Math.max(e.size,i.horizontal?a.height:a.width),i.size=e.size/e.count,t[n]+=i.size}a.getPadding&&Zi(o,a.getPadding());const r=Math.max(0,e.outerWidth-Ki(o,t,"left","right")),l=Math.max(0,e.outerHeight-Ki(o,t,"top","bottom")),c=r!==t.w,h=l!==t.h;return t.w=r,t.h=l,i.horizontal?{same:c,other:h}:{same:h,other:c}}function Qi(t,e){const i=e.maxPadding;return function(t){const s={left:0,top:0,right:0,bottom:0};return t.forEach((t=>{s[t]=Math.max(e[t],i[t])})),s}(t?["left","right"]:["top","bottom"])}function Ji(t,e,i,s){const n=[];let a,o,r,l,c,h;for(a=0,o=t.length,c=0;a<o;++a){r=t[a],l=r.box,l.update(r.width||e.w,r.height||e.h,Qi(r.horizontal,e));const{same:o,other:d}=Gi(e,i,r,s);c|=o&&n.length,h=h||d,l.fullSize||n.push(r)}return c&&Ji(n,e,i,s)||h}function ts(t,e,i,s,n){t.top=i,t.left=e,t.right=e+s,t.bottom=i+n,t.width=s,t.height=n}function es(t,e,i,s){const n=i.padding;let{x:a,y:o}=e;for(const r of t){const t=r.box,l=s[r.stack]||{count:1,placed:0,weight:1},c=r.stackWeight/l.weight||1;if(r.horizontal){const s=e.w*c,a=l.size||t.height;Mt(l.start)&&(o=l.start),t.fullSize?ts(t,n.left,o,i.outerWidth-n.right-n.left,a):ts(t,e.left+l.placed,o,s,a),l.start=o,l.placed+=s,o=t.bottom}else{const s=e.h*c,o=l.size||t.width;Mt(l.start)&&(a=l.start),t.fullSize?ts(t,a,n.top,o,i.outerHeight-n.bottom-n.top):ts(t,a,e.top+l.placed,o,s),l.start=a,l.placed+=s,a=t.right}}e.x=a,e.y=o}var is={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},t.boxes.push(e)},removeBox(t,e){const i=t.boxes?t.boxes.indexOf(e):-1;-1!==i&&t.boxes.splice(i,1)},configure(t,e,i){e.fullSize=i.fullSize,e.position=i.position,e.weight=i.weight},update(t,e,i,s){if(!t)return;const n=Ne(t.options.layout.padding),a=Math.max(e-n.width,0),o=Math.max(i-n.height,0),r=function(t){const e=function(t){const e=[];let i,s,n,a,o,r;for(i=0,s=(t||[]).length;i<s;++i)n=t[i],({position:a,options:{stack:o,stackWeight:r=1}}=n),e.push({index:i,box:n,pos:a,horizontal:n.isHorizontal(),weight:n.weight,stack:o&&a+o,stackWeight:r});return e}(t),i=Xi(e.filter((t=>t.box.fullSize)),!0),s=Xi(Ui(e,"left"),!0),n=Xi(Ui(e,"right")),a=Xi(Ui(e,"top"),!0),o=Xi(Ui(e,"bottom")),r=qi(e,"x"),l=qi(e,"y");return{fullSize:i,leftAndTop:s.concat(a),rightAndBottom:n.concat(l).concat(o).concat(r),chartArea:Ui(e,"chartArea"),vertical:s.concat(n).concat(l),horizontal:a.concat(o).concat(r)}}(t.boxes),l=r.vertical,c=r.horizontal;ft(t.boxes,(t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()}));const h=l.reduce(((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1),0)||1,d=Object.freeze({outerWidth:e,outerHeight:i,padding:n,availableWidth:a,availableHeight:o,vBoxMaxWidth:a/2/h,hBoxMaxHeight:o/2}),u=Object.assign({},n);Zi(u,Ne(s));const f=Object.assign({maxPadding:u,w:a,h:o,x:n.left,y:n.top},n),g=function(t,e){const i=function(t){const e={};for(const i of t){const{stack:t,pos:s,stackWeight:n}=i;if(!t||!Yi.includes(s))continue;const a=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=n}return e}(t),{vBoxMaxWidth:s,hBoxMaxHeight:n}=e;let a,o,r;for(a=0,o=t.length;a<o;++a){r=t[a];const{fullSize:o}=r.box,l=i[r.stack],c=l&&r.stackWeight/l.weight;r.horizontal?(r.width=c?c*s:o&&e.availableWidth,r.height=n):(r.width=s,r.height=c?c*n:o&&e.availableHeight)}return i}(l.concat(c),d);Ji(r.fullSize,f,d,g),Ji(l,f,d,g),Ji(c,f,d,g)&&Ji(l,f,d,g),function(t){const e=t.maxPadding;function i(i){const s=Math.max(e[i]-t[i],0);return t[i]+=s,s}t.y+=i("top"),t.x+=i("left"),i("right"),i("bottom")}(f),es(r.leftAndTop,f,d,g),f.x+=f.w,f.y+=f.h,es(r.rightAndBottom,f,d,g),t.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},ft(r.chartArea,(e=>{const i=e.box;Object.assign(i,t.chartArea),i.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})}))}};class ss{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}}class ns extends ss{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const as="$chartjs",os={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},rs=t=>null===t||""===t,ls=!!li&&{passive:!0};function cs(t,e,i){t&&t.canvas&&t.canvas.removeEventListener(e,i,ls)}function hs(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function ds(t,e,i){const s=t.canvas,n=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||hs(i.addedNodes,s),e=e&&!hs(i.removedNodes,s);e&&i()}));return n.observe(document,{childList:!0,subtree:!0}),n}function us(t,e,i){const s=t.canvas,n=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||hs(i.removedNodes,s),e=e&&!hs(i.addedNodes,s);e&&i()}));return n.observe(document,{childList:!0,subtree:!0}),n}const fs=new Map;let gs=0;function ps(){const t=window.devicePixelRatio;t!==gs&&(gs=t,fs.forEach(((e,i)=>{i.currentDevicePixelRatio!==t&&e()})))}function ms(t,e,i){const s=t.canvas,n=s&&ti(s);if(!n)return;const a=Zt(((t,e)=>{const s=n.clientWidth;i(t,e),s<n.clientWidth&&i()}),window),o=new ResizeObserver((t=>{const e=t[0],i=e.contentRect.width,s=e.contentRect.height;0===i&&0===s||a(i,s)}));return o.observe(n),function(t,e){fs.size||window.addEventListener("resize",ps),fs.set(t,e)}(t,a),o}function bs(t,e,i){i&&i.disconnect(),"resize"===e&&function(t){fs.delete(t),fs.size||window.removeEventListener("resize",ps)}(t)}function _s(t,e,i){const s=t.canvas,n=Zt((e=>{null!==t.ctx&&i(function(t,e){const i=os[t.type]||t.type,{x:s,y:n}=ai(t,e);return{type:i,chart:e,native:t,x:void 0!==s?s:null,y:void 0!==n?n:null}}(e,t))}),t);return function(t,e,i){t&&t.addEventListener(e,i,ls)}(s,e,n),n}class xs extends ss{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(function(t,e){const i=t.style,s=t.getAttribute("height"),n=t.getAttribute("width");if(t[as]={initial:{height:s,width:n,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",rs(n)){const e=ci(t,"width");void 0!==e&&(t.width=e)}if(rs(s))if(""===t.style.height)t.height=t.width/(e||2);else{const e=ci(t,"height");void 0!==e&&(t.height=e)}}(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[as])return!1;const i=e[as].initial;["height","width"].forEach((t=>{const s=i[t];ot(s)?e.removeAttribute(t):e.setAttribute(t,s)}));const s=i.style||{};return Object.keys(s).forEach((t=>{e.style[t]=s[t]})),e.width=e.width,delete e[as],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),n={attach:ds,detach:us,resize:ms}[e]||_s;s[e]=n(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),s=i[e];s&&(({attach:bs,detach:bs,resize:bs}[e]||cs)(t,e,s),i[e]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return function(t,e,i,s){const n=ii(t),a=ni(n,"margin"),o=ei(n.maxWidth,t,"clientWidth")||At,r=ei(n.maxHeight,t,"clientHeight")||At,l=function(t,e,i){let s,n;if(void 0===e||void 0===i){const a=t&&ti(t);if(a){const t=a.getBoundingClientRect(),o=ii(a),r=ni(o,"border","width"),l=ni(o,"padding");e=t.width-l.width-r.width,i=t.height-l.height-r.height,s=ei(o.maxWidth,a,"clientWidth"),n=ei(o.maxHeight,a,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:s||At,maxHeight:n||At}}(t,e,i);let{width:c,height:h}=l;if("content-box"===n.boxSizing){const t=ni(n,"border","width"),e=ni(n,"padding");c-=e.width+t.width,h-=e.height+t.height}return c=Math.max(0,c-a.width),h=Math.max(0,s?c/s:h-a.height),c=oi(Math.min(c,o,l.maxWidth)),h=oi(Math.min(h,r,l.maxHeight)),c&&!h&&(h=oi(c/2)),(void 0!==e||void 0!==i)&&s&&l.height&&h>l.height&&(h=l.height,c=oi(Math.floor(h*s))),{width:c,height:h}}(t,e,i,s)}isAttached(t){const e=t&&ti(t);return!(!e||!e.isConnected)}}class ys{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return Ft(this.x)&&Ft(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const s={};return t.forEach((t=>{s[t]=i[t]&&i[t].active()?i[t]._to:this[t]})),s}}function vs(t,e,i,s,n){const a=dt(s,0),o=Math.min(dt(n,t.length),t.length);let r,l,c,h=0;for(i=Math.ceil(i),n&&(r=n-s,i=r/Math.floor(r/i)),c=a;c<0;)h++,c=Math.round(a+h*i);for(l=Math.max(a,0);l<o;l++)l===c&&(e.push(t[l]),h++,c=Math.round(a+h*i))}const ws=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i,ks=(t,e)=>Math.min(e||t,t);function Ms(t,e){const i=[],s=t.length/e,n=t.length;let a=0;for(;a<n;a+=s)i.push(t[Math.floor(a)]);return i}function Es(t,e,i){const s=t.ticks.length,n=Math.min(e,s-1),a=t._startPixel,o=t._endPixel,r=1e-6;let l,c=t.getPixelForTick(n);if(!(i&&(l=1===s?Math.max(c-a,o-c):0===e?(t.getPixelForTick(1)-c)/2:(c-t.getPixelForTick(n-1))/2,c+=n<e?l:-l,c<a-r||c>o+r)))return c}function Ss(t){return t.drawTicks?t.tickLength:0}function Ps(t,e){if(!t.display)return 0;const i=ze(t.font,e),s=Ne(t.padding);return(rt(t.text)?t.text.length:1)*i.lineHeight+s.height}function Cs(t,e,i){let s=Gt(t);return(i&&"right"!==e||!i&&"right"===e)&&(s=(t=>"left"===t?"right":"right"===t?"left":t)(s)),s}class As extends ys{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:s}=this;return t=ht(t,Number.POSITIVE_INFINITY),e=ht(e,Number.NEGATIVE_INFINITY),i=ht(i,Number.POSITIVE_INFINITY),s=ht(s,Number.NEGATIVE_INFINITY),{min:ht(t,i),max:ht(e,s),minDefined:ct(t),maxDefined:ct(e)}}getMinMax(t){let e,{min:i,max:s,minDefined:n,maxDefined:a}=this.getUserBounds();if(n&&a)return{min:i,max:s};const o=this.getMatchingVisibleMetas();for(let r=0,l=o.length;r<l;++r)e=o[r].controller.getMinMax(this,t),n||(i=Math.min(i,e.min)),a||(s=Math.max(s,e.max));return i=a&&i>s?s:i,s=n&&i>s?i:s,{min:ht(i,ht(s,i)),max:ht(s,ht(i,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){ut(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:s,grace:n,ticks:a}=this.options,o=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=function(t,e,i){const{min:s,max:n}=t,a=(l=(n-s)/2,"string"==typeof(r=e)&&r.endsWith("%")?parseFloat(r)/100*l:+r),o=(t,e)=>i&&0===t?0:t+e;var r,l;return{min:o(s,-Math.abs(a)),max:o(n,a)}}(this,n,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const r=o<this.ticks.length;this._convertTicksToLabels(r?Ms(this.ticks,o):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||"auto"===a.source)&&(this.ticks=function(t,e){const i=t.options.ticks,s=function(t){const e=t.options.offset,i=t._tickSize(),s=t._length/i+(e?0:1),n=t._maxLength/i;return Math.floor(Math.min(s,n))}(t),n=Math.min(i.maxTicksLimit||s,s),a=i.major.enabled?function(t){const e=[];let i,s;for(i=0,s=t.length;i<s;i++)t[i].major&&e.push(i);return e}(e):[],o=a.length,r=a[0],l=a[o-1],c=[];if(o>n)return function(t,e,i,s){let n,a=0,o=i[0];for(s=Math.ceil(s),n=0;n<t.length;n++)n===o&&(e.push(t[n]),a++,o=i[a*s])}(e,c,a,o/n),c;const h=function(t,e,i){const s=function(t){const e=t.length;let i,s;if(e<2)return!1;for(s=t[0],i=1;i<e;++i)if(t[i]-t[i-1]!==s)return!1;return s}(t),n=e.length/i;if(!s)return Math.max(n,1);const a=function(t){const e=[],i=Math.sqrt(t);let s;for(s=1;s<i;s++)t%s==0&&(e.push(s),e.push(t/s));return i===(0|i)&&e.push(i),e.sort(((t,e)=>t-e)).pop(),e}(s);for(let t=0,e=a.length-1;t<e;t++){const e=a[t];if(e>n)return e}return Math.max(n,1)}(a,e,n);if(o>0){let t,i;const s=o>1?Math.round((l-r)/(o-1)):null;for(vs(e,c,h,ot(s)?0:r-s,r),t=0,i=o-1;t<i;t++)vs(e,c,h,a[t],a[t+1]);return vs(e,c,h,l,ot(s)?e.length:l+s),c}return vs(e,c,h),c}(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),r&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t,e,i=this.options.reverse;this.isHorizontal()?(t=this.left,e=this.right):(t=this.top,e=this.bottom,i=!i),this._startPixel=t,this._endPixel=e,this._reversePixels=i,this._length=e-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){ut(this.options.afterUpdate,[this])}beforeSetDimensions(){ut(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){ut(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),ut(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){ut(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let i,s,n;for(i=0,s=t.length;i<s;i++)n=t[i],n.label=ut(e.callback,[n.value,i,t],this)}afterTickToLabelConversion(){ut(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){ut(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,i=ks(this.ticks.length,t.ticks.maxTicksLimit),s=e.minRotation||0,n=e.maxRotation;let a,o,r,l=s;if(!this._isVisible()||!e.display||s>=n||i<=1||!this.isHorizontal())return void(this.labelRotation=s);const c=this._getLabelSizes(),h=c.widest.width,d=c.highest.height,u=Wt(this.chart.width-h,0,this.maxWidth);a=t.offset?this.maxWidth/i:u/(i-1),h+6>a&&(a=u/(i-(t.offset?.5:1)),o=this.maxHeight-Ss(t.grid)-e.padding-Ps(t.title,this.chart.options.font),r=Math.sqrt(h*h+d*d),l=Math.min(Math.asin(Wt((c.highest.height+6)/a,-1,1)),Math.asin(Wt(o/r,-1,1))-Math.asin(Wt(d/r,-1,1)))*(180/Pt),l=Math.max(s,Math.min(n,l))),this.labelRotation=l}afterCalculateLabelRotation(){ut(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){ut(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:n}}=this,a=this._isVisible(),o=this.isHorizontal();if(a){const a=Ps(s,e.options.font);if(o?(t.width=this.maxWidth,t.height=Ss(n)+a):(t.height=this.maxHeight,t.width=Ss(n)+a),i.display&&this.ticks.length){const{first:e,last:s,widest:n,highest:a}=this._getLabelSizes(),r=2*i.padding,l=Bt(this.labelRotation),c=Math.cos(l),h=Math.sin(l);if(o){const e=i.mirror?0:h*n.width+c*a.height;t.height=Math.min(this.maxHeight,t.height+e+r)}else{const e=i.mirror?0:c*n.width+h*a.height;t.width=Math.min(this.maxWidth,t.width+e+r)}this._calculatePadding(e,s,h,c)}}this._handleMargins(),o?(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,s){const{ticks:{align:n,padding:a},position:o}=this.options,r=0!==this.labelRotation,l="top"!==o&&"x"===this.axis;if(this.isHorizontal()){const o=this.getPixelForTick(0)-this.left,c=this.right-this.getPixelForTick(this.ticks.length-1);let h=0,d=0;r?l?(h=s*t.width,d=i*e.height):(h=i*t.height,d=s*e.width):"start"===n?d=e.width:"end"===n?h=t.width:"inner"!==n&&(h=t.width/2,d=e.width/2),this.paddingLeft=Math.max((h-o+a)*this.width/(this.width-o),0),this.paddingRight=Math.max((d-c+a)*this.width/(this.width-c),0)}else{let i=e.height/2,s=t.height/2;"start"===n?(i=0,s=t.height):"end"===n&&(i=e.height,s=0),this.paddingTop=i+a,this.paddingBottom=s+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(){ut(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let e,i;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),e=0,i=t.length;e<i;e++)ot(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let i=this.ticks;e<i.length&&(i=Ms(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,i){const{ctx:s,_longestTextCache:n}=this,a=[],o=[],r=Math.floor(e/ks(e,i));let l,c,h,d,u,f,g,p,m,b,_,x=0,y=0;for(l=0;l<e;l+=r){if(d=t[l].label,u=this._resolveTickFontOptions(l),s.font=f=u.string,g=n[f]=n[f]||{data:{},gc:[]},p=u.lineHeight,m=b=0,ot(d)||rt(d)){if(rt(d))for(c=0,h=d.length;c<h;++c)_=d[c],ot(_)||rt(_)||(m=_e(s,g.data,g.gc,m,_),b+=p)}else m=_e(s,g.data,g.gc,m,d),b=p;a.push(m),o.push(b),x=Math.max(m,x),y=Math.max(b,y)}!function(t,e){ft(t,(t=>{const i=t.gc,s=i.length/2;let n;if(s>e){for(n=0;n<s;++n)delete t.data[i[n]];i.splice(0,s)}}))}(n,e);const v=a.indexOf(x),w=o.indexOf(y),k=t=>({width:a[t]||0,height:o[t]||0});return{first:k(0),last:k(e-1),widest:k(v),highest:k(w),widths:a,heights:o}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return Wt(this._alignToPixels?xe(this.chart,e,0):e,-32768,32767)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&t<e.length){const i=e[t];return i.$context||(i.$context=function(t,e,i){return Be(t,{tick:i,index:e,type:"tick"})}(this.getContext(),t,i))}return this.$context||(this.$context=Be(this.chart.getContext(),{scale:this,type:"scale"}))}_tickSize(){const t=this.options.ticks,e=Bt(this.labelRotation),i=Math.abs(Math.cos(e)),s=Math.abs(Math.sin(e)),n=this._getLabelSizes(),a=t.autoSkipPadding||0,o=n?n.widest.width+a:0,r=n?n.highest.height+a:0;return this.isHorizontal()?r*i>o*s?o/i:r/s:r*s<o*i?r/i:o/s}_isVisible(){const t=this.options.display;return"auto"!==t?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,i=this.chart,s=this.options,{grid:n,position:a,border:o}=s,r=n.offset,l=this.isHorizontal(),c=this.ticks.length+(r?1:0),h=Ss(n),d=[],u=o.setContext(this.getContext()),f=u.display?u.width:0,g=f/2,p=function(t){return xe(i,t,f)};let m,b,_,x,y,v,w,k,M,E,S,P;if("top"===a)m=p(this.bottom),v=this.bottom-h,k=m-g,E=p(t.top)+g,P=t.bottom;else if("bottom"===a)m=p(this.top),E=t.top,P=p(t.bottom)-g,v=m+g,k=this.top+h;else if("left"===a)m=p(this.right),y=this.right-h,w=m-g,M=p(t.left)+g,S=t.right;else if("right"===a)m=p(this.left),M=t.left,S=p(t.right)-g,y=m+g,w=this.left+h;else if("x"===e){if("center"===a)m=p((t.top+t.bottom)/2+.5);else if(lt(a)){const t=Object.keys(a)[0],e=a[t];m=p(this.chart.scales[t].getPixelForValue(e))}E=t.top,P=t.bottom,v=m+g,k=v+h}else if("y"===e){if("center"===a)m=p((t.left+t.right)/2);else if(lt(a)){const t=Object.keys(a)[0],e=a[t];m=p(this.chart.scales[t].getPixelForValue(e))}y=m-g,w=y-h,M=t.left,S=t.right}const C=dt(s.ticks.maxTicksLimit,c),A=Math.max(1,Math.ceil(c/C));for(b=0;b<c;b+=A){const t=this.getContext(b),e=n.setContext(t),s=o.setContext(t),a=e.lineWidth,c=e.color,h=s.dash||[],u=s.dashOffset,f=e.tickWidth,g=e.tickColor,p=e.tickBorderDash||[],m=e.tickBorderDashOffset;_=Es(this,b,r),void 0!==_&&(x=xe(i,_,a),l?y=w=M=S=x:v=k=E=P=x,d.push({tx1:y,ty1:v,tx2:w,ty2:k,x1:M,y1:E,x2:S,y2:P,width:a,color:c,borderDash:h,borderDashOffset:u,tickWidth:f,tickColor:g,tickBorderDash:p,tickBorderDashOffset:m}))}return this._ticksLength=c,this._borderValue=m,d}_computeLabelItems(t){const e=this.axis,i=this.options,{position:s,ticks:n}=i,a=this.isHorizontal(),o=this.ticks,{align:r,crossAlign:l,padding:c,mirror:h}=n,d=Ss(i.grid),u=d+c,f=h?-c:u,g=-Bt(this.labelRotation),p=[];let m,b,_,x,y,v,w,k,M,E,S,P,C="middle";if("top"===s)v=this.bottom-f,w=this._getXAxisLabelAlignment();else if("bottom"===s)v=this.top+f,w=this._getXAxisLabelAlignment();else if("left"===s){const t=this._getYAxisLabelAlignment(d);w=t.textAlign,y=t.x}else if("right"===s){const t=this._getYAxisLabelAlignment(d);w=t.textAlign,y=t.x}else if("x"===e){if("center"===s)v=(t.top+t.bottom)/2+u;else if(lt(s)){const t=Object.keys(s)[0],e=s[t];v=this.chart.scales[t].getPixelForValue(e)+u}w=this._getXAxisLabelAlignment()}else if("y"===e){if("center"===s)y=(t.left+t.right)/2-u;else if(lt(s)){const t=Object.keys(s)[0],e=s[t];y=this.chart.scales[t].getPixelForValue(e)}w=this._getYAxisLabelAlignment(d).textAlign}"y"===e&&("start"===r?C="top":"end"===r&&(C="bottom"));const A=this._getLabelSizes();for(m=0,b=o.length;m<b;++m){_=o[m],x=_.label;const t=n.setContext(this.getContext(m));k=this.getPixelForTick(m)+n.labelOffset,M=this._resolveTickFontOptions(m),E=M.lineHeight,S=rt(x)?x.length:1;const e=S/2,i=t.color,r=t.textStrokeColor,c=t.textStrokeWidth;let d,u=w;if(a?(y=k,"inner"===w&&(u=m===b-1?this.options.reverse?"left":"right":0===m?this.options.reverse?"right":"left":"center"),P="top"===s?"near"===l||0!==g?-S*E+E/2:"center"===l?-A.highest.height/2-e*E+E:-A.highest.height+E/2:"near"===l||0!==g?E/2:"center"===l?A.highest.height/2-e*E:A.highest.height-S*E,h&&(P*=-1),0===g||t.showLabelBackdrop||(y+=E/2*Math.sin(g))):(v=k,P=(1-S)*E/2),t.showLabelBackdrop){const e=Ne(t.backdropPadding),i=A.heights[m],s=A.widths[m];let n=P-e.top,a=0-e.left;switch(C){case"middle":n-=i/2;break;case"bottom":n-=i}switch(w){case"center":a-=s/2;break;case"right":a-=s;break;case"inner":m===b-1?a-=s:m>0&&(a-=s/2)}d={left:a,top:n,width:s+e.width,height:i+e.height,color:t.backdropColor}}p.push({label:x,font:M,textOffset:P,options:{rotation:g,color:i,strokeColor:r,strokeWidth:c,textAlign:u,textBaseline:C,translation:[y,v],backdrop:d}})}return p}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-Bt(this.labelRotation))return"top"===t?"left":"right";let i="center";return"start"===e.align?i="left":"end"===e.align?i="right":"inner"===e.align&&(i="inner"),i}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:s,padding:n}}=this.options,a=t+n,o=this._getLabelSizes().widest.width;let r,l;return"left"===e?s?(l=this.right+n,"near"===i?r="left":"center"===i?(r="center",l+=o/2):(r="right",l+=o)):(l=this.right-a,"near"===i?r="right":"center"===i?(r="center",l-=o/2):(r="left",l=this.left)):"right"===e?s?(l=this.left+n,"near"===i?r="right":"center"===i?(r="center",l-=o/2):(r="left",l-=o)):(l=this.left+a,"near"===i?r="left":"center"===i?(r="center",l+=o/2):(r="right",l=this.right)):r="right",{textAlign:r,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;return"left"===e||"right"===e?{top:0,left:this.left,bottom:t.height,right:this.right}:"top"===e||"bottom"===e?{top:this.top,left:0,bottom:this.bottom,right:t.width}:void 0}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:s,width:n,height:a}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,s,n,a),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const i=this.ticks.findIndex((e=>e.value===t));return i>=0?e.setContext(this.getContext(i)).lineWidth:0}drawGrid(t){const e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let n,a;const o=(t,e,s)=>{s.width&&s.color&&(i.save(),i.lineWidth=s.width,i.strokeStyle=s.color,i.setLineDash(s.borderDash||[]),i.lineDashOffset=s.borderDashOffset,i.beginPath(),i.moveTo(t.x,t.y),i.lineTo(e.x,e.y),i.stroke(),i.restore())};if(e.display)for(n=0,a=s.length;n<a;++n){const t=s[n];e.drawOnChartArea&&o({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},t),e.drawTicks&&o({x:t.tx1,y:t.ty1},{x:t.tx2,y:t.ty2},{color:t.tickColor,width:t.tickWidth,borderDash:t.tickBorderDash,borderDashOffset:t.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{border:i,grid:s}}=this,n=i.setContext(this.getContext()),a=i.display?n.width:0;if(!a)return;const o=s.setContext(this.getContext(0)).lineWidth,r=this._borderValue;let l,c,h,d;this.isHorizontal()?(l=xe(t,this.left,a)-a/2,c=xe(t,this.right,o)+o/2,h=d=r):(h=xe(t,this.top,a)-a/2,d=xe(t,this.bottom,o)+o/2,l=c=r),e.save(),e.lineWidth=n.width,e.strokeStyle=n.color,e.beginPath(),e.moveTo(l,h),e.lineTo(c,d),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const e=this.ctx,i=this._computeLabelArea();i&&Me(e,i);const s=this.getLabelItems(t);for(const t of s){const i=t.options,s=t.font;Ce(e,t.label,0,t.textOffset,s,i)}i&&Ee(e)}drawTitle(){const{ctx:t,options:{position:e,title:i,reverse:s}}=this;if(!i.display)return;const n=ze(i.font),a=Ne(i.padding),o=i.align;let r=n.lineHeight/2;"bottom"===e||"center"===e||lt(e)?(r+=a.bottom,rt(i.text)&&(r+=n.lineHeight*(i.text.length-1))):r+=a.top;const{titleX:l,titleY:c,maxWidth:h,rotation:d}=function(t,e,i,s){const{top:n,left:a,bottom:o,right:r,chart:l}=t,{chartArea:c,scales:h}=l;let d,u,f,g=0;const p=o-n,m=r-a;if(t.isHorizontal()){if(u=Qt(s,a,r),lt(i)){const t=Object.keys(i)[0],s=i[t];f=h[t].getPixelForValue(s)+p-e}else f="center"===i?(c.bottom+c.top)/2+p-e:ws(t,i,e);d=r-a}else{if(lt(i)){const t=Object.keys(i)[0],s=i[t];u=h[t].getPixelForValue(s)-m+e}else u="center"===i?(c.left+c.right)/2-m+e:ws(t,i,e);f=Qt(s,o,n),g="left"===i?-Ot:Ot}return{titleX:u,titleY:f,maxWidth:d,rotation:g}}(this,r,e,o);Ce(t,i.text,0,0,n,{color:i.color,maxWidth:h,rotation:d,textAlign:Cs(o,e,s),textBaseline:"middle",translation:[l,c]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,e=t.ticks&&t.ticks.z||0,i=dt(t.grid&&t.grid.z,-1),s=dt(t.border&&t.border.z,0);return this._isVisible()&&this.draw===As.prototype.draw?[{z:i,draw:t=>{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let n,a;for(n=0,a=e.length;n<a;++n){const a=e[n];a[i]!==this.id||t&&a.type!==t||s.push(a)}return s}_resolveTickFontOptions(t){return ze(this.options.ticks.setContext(this.getContext(t)).font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class Ls{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let i;(function(t){return"id"in t&&"defaults"in t})(e)&&(i=this.register(e));const s=this.items,n=t.id,a=this.scope+"."+n;if(!n)throw new Error("class does not have id: "+t);return n in s||(s[n]=t,function(t,e,i){const s=_t(Object.create(null),[i?be.get(i):{},be.get(e),t.defaults]);be.set(e,s),t.defaultRoutes&&function(t,e){Object.keys(e).forEach((i=>{const s=i.split("."),n=s.pop(),a=[t].concat(s).join("."),o=e[i].split("."),r=o.pop(),l=o.join(".");be.route(a,n,l,r)}))}(e,t.defaultRoutes),t.descriptors&&be.describe(e,t.descriptors)}(t,a,i),this.override&&be.override(t.id,t.overrides)),a}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,s=this.scope;i in e&&delete e[i],s&&i in be[s]&&(delete be[s][i],this.override&&delete ue[i])}}class Os{constructor(){this.controllers=new Ls(Li,"datasets",!0),this.elements=new Ls(ys,"elements"),this.plugins=new Ls(Object,"plugins"),this.scales=new Ls(As,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach((e=>{const s=i||this._getRegistryForType(e);i||s.isForType(e)||s===this.plugins&&e.id?this._exec(t,s,e):ft(e,(e=>{const s=i||this._getRegistryForType(e);this._exec(t,s,e)}))}))}_exec(t,e,i){const s=kt(t);ut(i["before"+s],[],i),e[t](i),ut(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){const s=e.get(t);if(void 0===s)throw new Error('"'+t+'" is not a registered '+i+".");return s}}var Ds=new Os;class Ts{constructor(){this._init=[]}notify(t,e,i,s){"beforeInit"===e&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const n=s?this._descriptors(t).filter(s):this._descriptors(t),a=this._notify(n,t,e,i);return"afterDestroy"===e&&(this._notify(n,t,"stop"),this._notify(this._init,t,"uninstall")),a}_notify(t,e,i,s){s=s||{};for(const n of t){const t=n.plugin;if(!1===ut(t[i],[e,s,n.options],t)&&s.cancelable)return!1}return!0}invalidate(){ot(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const i=t&&t.config,s=dt(i.options&&i.options.plugins,{}),n=function(t){const e={},i=[],s=Object.keys(Ds.plugins.items);for(let t=0;t<s.length;t++)i.push(Ds.getPlugin(s[t]));const n=t.plugins||[];for(let t=0;t<n.length;t++){const s=n[t];-1===i.indexOf(s)&&(i.push(s),e[s.id]=!0)}return{plugins:i,localIds:e}}(i);return!1!==s||e?function(t,{plugins:e,localIds:i},s,n){const a=[],o=t.getContext();for(const r of e){const e=r.id,l=Is(s[e],n);null!==l&&a.push({plugin:r,options:Rs(t.config,{plugin:r,local:i[e]},l,o)})}return a}(t,n,s,e):[]}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,s=(t,e)=>t.filter((t=>!e.some((e=>t.plugin.id===e.plugin.id))));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}}function Is(t,e){return e||!1!==t?!0===t?{}:t:null}function Rs(t,{plugin:e,local:i},s,n){const a=t.pluginScopeKeys(e),o=t.getOptionScopes(s,a);return i&&e.defaults&&o.push(e.defaults),t.createResolver(o,n,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Ns(t,e){const i=be.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function zs(t){if("x"===t||"y"===t||"r"===t)return t}function Fs(t,...e){if(zs(t))return t;for(const s of e){const e=s.axis||("top"===(i=s.position)||"bottom"===i?"x":"left"===i||"right"===i?"y":void 0)||t.length>1&&zs(t[0].toLowerCase());if(e)return e}var i;throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function Bs(t,e,i){if(i[e+"AxisID"]===t)return{axis:e}}function Hs(t){const e=t.options||(t.options={});e.plugins=dt(e.plugins,{}),e.scales=function(t,e){const i=ue[t.type]||{scales:{}},s=e.scales||{},n=Ns(t.type,e),a=Object.create(null);return Object.keys(s).forEach((e=>{const o=s[e];if(!lt(o))return console.error(`Invalid scale configuration for scale: ${e}`);if(o._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${e}`);const r=Fs(e,o,function(t,e){if(e.data&&e.data.datasets){const i=e.data.datasets.filter((e=>e.xAxisID===t||e.yAxisID===t));if(i.length)return Bs(t,"x",i[0])||Bs(t,"y",i[0])}return{}}(e,t),be.scales[o.type]),l=function(t,e){return t===e?"_index_":"_value_"}(r,n),c=i.scales||{};a[e]=xt(Object.create(null),[{axis:r},o,c[r],c[l]])})),t.data.datasets.forEach((i=>{const n=i.type||t.type,o=i.indexAxis||Ns(n,e),r=(ue[n]||{}).scales||{};Object.keys(r).forEach((t=>{const e=function(t,e){let i=t;return"_index_"===t?i=e:"_value_"===t&&(i="x"===e?"y":"x"),i}(t,o),n=i[e+"AxisID"]||e;a[n]=a[n]||Object.create(null),xt(a[n],[{axis:e},s[n],r[t]])}))})),Object.keys(a).forEach((t=>{const e=a[t];xt(e,[be.scales[e.type],be.scale])})),a}(t,e)}function Vs(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const Ws=new Map,js=new Set;function $s(t,e){let i=Ws.get(t);return i||(i=e(),Ws.set(t,i),js.add(i)),i}const Ys=(t,e,i)=>{const s=wt(e,i);void 0!==s&&t.add(s)};class Us{constructor(t){this._config=function(t){return(t=t||{}).data=Vs(t.data),Hs(t),t}(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=Vs(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),Hs(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return $s(t,(()=>[[`datasets.${t}`,""]]))}datasetAnimationScopeKeys(t,e){return $s(`${t}.transition.${e}`,(()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]]))}datasetElementScopeKeys(t,e){return $s(`${t}-${e}`,(()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]]))}pluginScopeKeys(t){const e=t.id;return $s(`${this.type}-plugin-${e}`,(()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]]))}_cachedScopes(t,e){const i=this._scopeCache;let s=i.get(t);return s&&!e||(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){const{options:s,type:n}=this,a=this._cachedScopes(t,i),o=a.get(e);if(o)return o;const r=new Set;e.forEach((e=>{t&&(r.add(t),e.forEach((e=>Ys(r,t,e)))),e.forEach((t=>Ys(r,s,t))),e.forEach((t=>Ys(r,ue[n]||{},t))),e.forEach((t=>Ys(r,be,t))),e.forEach((t=>Ys(r,fe,t)))}));const l=Array.from(r);return 0===l.length&&l.push(Object.create(null)),js.has(e)&&a.set(e,l),l}chartOptionScopes(){const{options:t,type:e}=this;return[t,ue[e]||{},be.datasets[e]||{},{type:e},be,fe]}resolveNamedOptions(t,e,i,s=[""]){const n={$shared:!0},{resolver:a,subPrefixes:o}=qs(this._resolverCache,t,s);let r=a;(function(t,e){const{isScriptable:i,isIndexable:s}=We(t);for(const n of e){const e=i(n),a=s(n),o=(a||e)&&t[n];if(e&&(Et(o)||Xs(o))||a&&rt(o))return!0}return!1})(a,e)&&(n.$shared=!1,r=Ve(a,i=Et(i)?i():i,this.createResolver(t,i,o)));for(const t of e)n[t]=r[t];return n}createResolver(t,e,i=[""],s){const{resolver:n}=qs(this._resolverCache,t,i);return lt(e)?Ve(n,e,void 0,s):n}}function qs(t,e,i){let s=t.get(e);s||(s=new Map,t.set(e,s));const n=i.join();let a=s.get(n);return a||(a={resolver:He(e,i),subPrefixes:i.filter((t=>!t.toLowerCase().includes("hover")))},s.set(n,a)),a}const Xs=t=>lt(t)&&Object.getOwnPropertyNames(t).some((e=>Et(t[e]))),Ks=["top","bottom","left","right","chartArea"];function Zs(t,e){return"top"===t||"bottom"===t||-1===Ks.indexOf(t)&&"x"===e}function Gs(t,e){return function(i,s){return i[t]===s[t]?i[e]-s[e]:i[t]-s[t]}}function Qs(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),ut(i&&i.onComplete,[t],e)}function Js(t){const e=t.chart,i=e.options.animation;ut(i&&i.onProgress,[t],e)}function tn(t){return Je()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const en={},sn=t=>{const e=tn(t);return Object.values(en).filter((t=>t.canvas===e)).pop()};function nn(t,e,i){const s=Object.keys(t);for(const n of s){const s=+n;if(s>=e){const a=t[n];delete t[n],(i>0||s>e)&&(t[s+i]=a)}}}function an(t,e,i){return t.options.clip?t[i]:e[i]}class on{static defaults=be;static instances=en;static overrides=ue;static registry=Ds;static version="4.4.8";static getChart=sn;static register(...t){Ds.add(...t),rn()}static unregister(...t){Ds.remove(...t),rn()}constructor(t,e){const i=this.config=new Us(e),s=tn(t),n=sn(s);if(n)throw new Error("Canvas is already in use. Chart with ID '"+n.id+"' must be destroyed before the canvas with ID '"+n.canvas.id+"' can be reused.");const a=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||function(t){return!Je()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?ns:xs}(s)),this.platform.updateConfig(i);const o=this.platform.acquireContext(s,a.aspectRatio),r=o&&o.canvas,l=r&&r.height,c=r&&r.width;this.id=at(),this.ctx=o,this.canvas=r,this.width=c,this.height=l,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 Ts,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=function(t,e){let i;return function(...s){return e?(clearTimeout(i),i=setTimeout(t,e,s)):t.apply(this,s),e}}((t=>this.update(t)),a.resizeDelay||0),this._dataChanges=[],en[this.id]=this,o&&r?(gi.listen(this,"complete",Qs),gi.listen(this,"progress",Js),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:s,_aspectRatio:n}=this;return ot(t)?e&&n?n:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return Ds}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():ri(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return ye(this.canvas,this.ctx),this}stop(){return gi.stop(this),this}resize(t,e){gi.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,s=this.canvas,n=i.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(s,t,e,n),o=i.devicePixelRatio||this.platform.getDevicePixelRatio(),r=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,ri(this,o,!0)&&(this.notifyPlugins("resize",{size:a}),ut(i.onResize,[this,a],this),this.attached&&this._doResize(r)&&this.render())}ensureScalesHaveIDs(){ft(this.options.scales||{},((t,e)=>{t.id=e}))}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce(((t,e)=>(t[e]=!1,t)),{});let n=[];e&&(n=n.concat(Object.keys(e).map((t=>{const i=e[t],s=Fs(t,i),n="r"===s,a="x"===s;return{options:i,dposition:n?"chartArea":a?"bottom":"left",dtype:n?"radialLinear":a?"category":"linear"}})))),ft(n,(e=>{const n=e.options,a=n.id,o=Fs(a,n),r=dt(n.type,e.dtype);void 0!==n.position&&Zs(n.position,o)===Zs(e.dposition)||(n.position=e.dposition),s[a]=!0;let l=null;a in i&&i[a].type===r?l=i[a]:(l=new(Ds.getScale(r))({id:a,type:r,ctx:this.ctx,chart:this}),i[l.id]=l),l.init(n,t)})),ft(s,((t,e)=>{t||delete i[e]})),ft(i,(t=>{is.configure(this,t,t.options),is.addBox(this,t)}))}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort(((t,e)=>t.index-e.index)),i>e){for(let t=e;t<i;++t)this._destroyDatasetMeta(t);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(Gs("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach(((t,i)=>{0===e.filter((e=>e===t._dataset)).length&&this._destroyDatasetMeta(i)}))}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i<s;i++){const s=e[i];let n=this.getDatasetMeta(i);const a=s.type||this.config.type;if(n.type&&n.type!==a&&(this._destroyDatasetMeta(i),n=this.getDatasetMeta(i)),n.type=a,n.indexAxis=s.indexAxis||Ns(a,this.options),n.order=s.order||0,n.index=i,n.label=""+s.label,n.visible=this.isDatasetVisible(i),n.controller)n.controller.updateIndex(i),n.controller.linkScales();else{const e=Ds.getController(a),{datasetElementType:s,dataElementType:o}=be.datasets[a];Object.assign(e,{dataElementType:Ds.getElement(o),datasetElementType:s&&Ds.getElement(s)}),n.controller=new e(this,i),t.push(n.controller)}}return this._updateMetasets(),t}_resetElements(){ft(this.data.datasets,((t,e)=>{this.getDatasetMeta(e).controller.reset()}),this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const n=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let t=0,e=this.data.datasets.length;t<e;t++){const{controller:e}=this.getDatasetMeta(t),i=!s&&-1===n.indexOf(e);e.buildOrUpdateElements(i),a=Math.max(+e.getMaxOverflow(),a)}a=this._minPadding=i.layout.autoPadding?a:0,this._updateLayout(a),s||ft(n,(t=>{t.reset()})),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Gs("z","_idx"));const{_active:o,_lastEvent:r}=this;r?this._eventHandler(r,!0):o.length&&this._updateHoverStyles(o,o,!0),this.render()}_updateScales(){ft(this.scales,(t=>{is.removeBox(this,t)})),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);St(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:n}of e)nn(t,s,"_removeElements"===i?-n:n)}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=e=>new Set(t.filter((t=>t[0]===e)).map(((t,e)=>e+","+t.splice(1).join(",")))),s=i(0);for(let t=1;t<e;t++)if(!St(s,i(t)))return;return Array.from(s).map((t=>t.split(","))).map((t=>({method:t[1],start:+t[2],count:+t[3]})))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;is.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],ft(this.boxes,(t=>{i&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))}),this),this._layers.forEach(((t,e)=>{t._idx=e})),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t<e;++t)this.getDatasetMeta(t).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,Et(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const i=this.getDatasetMeta(t),s={meta:i,index:t,mode:e,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",s)&&(i.controller._update(e),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(gi.has(this)?this.attached&&!gi.running(this)&&gi.start(this):(this.draw(),Qs({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:t,height:e}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(t,e)}if(this.clear(),this.width<=0||this.height<=0)return;if(!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,i=[];let s,n;for(s=0,n=e.length;s<n;++s){const n=e[s];t&&!n.visible||i.push(n)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,s=!i.disabled,n=function(t,e){const{xScale:i,yScale:s}=t;return i&&s?{left:an(i,e,"left"),right:an(i,e,"right"),top:an(s,e,"top"),bottom:an(s,e,"bottom")}:e}(t,this.chartArea),a={meta:t,index:t.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",a)&&(s&&Me(e,{left:!1===i.left?0:n.left-i.left,right:!1===i.right?this.width:n.right+i.right,top:!1===i.top?0:n.top-i.top,bottom:!1===i.bottom?this.height:n.bottom+i.bottom}),t.controller.draw(),s&&Ee(e),a.cancelable=!1,this.notifyPlugins("afterDatasetDraw",a))}isPointInArea(t){return ke(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){const n=$i.modes[e];return"function"==typeof n?n(this,t,i,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let s=i.filter((t=>t&&t._dataset===e)).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=Be(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return"boolean"==typeof i.hidden?!i.hidden:!e.hidden}setDatasetVisibility(t,e){this.getDatasetMeta(t).hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const s=i?"show":"hide",n=this.getDatasetMeta(t),a=n.controller._resolveAnimations(void 0,s);Mt(e)?(n.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),a.update(n,{visible:i}),this.update((e=>e.datasetIndex===t?s:void 0)))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),gi.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),ye(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete en[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,i=(i,s)=>{e.addEventListener(this,i,s),t[i]=s},s=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};ft(this.options.events,(t=>i(t,s)))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(i,s)=>{e.addEventListener(this,i,s),t[i]=s},s=(i,s)=>{t[i]&&(e.removeEventListener(this,i,s),delete t[i])},n=(t,e)=>{this.canvas&&this.resize(t,e)};let a;const o=()=>{s("attach",o),this.attached=!0,this.resize(),i("resize",n),i("detach",a)};a=()=>{this.attached=!1,s("resize",n),this._stop(),this._resize(0,0),i("attach",o)},e.isAttached(this.canvas)?o():a()}unbindEvents(){ft(this._listeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._listeners={},ft(this._responsiveListeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const s=i?"set":"remove";let n,a,o,r;for("dataset"===e&&(n=this.getDatasetMeta(t[0].datasetIndex),n.controller["_"+s+"DatasetHoverStyle"]()),o=0,r=t.length;o<r;++o){a=t[o];const e=a&&this.getDatasetMeta(a.datasetIndex).controller;e&&e[s+"HoverStyle"](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],i=t.map((({datasetIndex:t,index:e})=>{const i=this.getDatasetMeta(t);if(!i)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}));!gt(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 1===this._plugins._cache.filter((e=>e.plugin.id===t)).length}_updateHoverStyles(t,e,i){const s=this.options.hover,n=(t,e)=>t.filter((t=>!e.some((e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)))),a=n(e,t),o=i?t:n(t,e);a.length&&this.updateHoverStyle(a,s.mode,!1),o.length&&s.mode&&this.updateHoverStyle(o,s.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",i,s))return;const n=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(n||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:s=[],options:n}=this,a=e,o=this._getActiveElements(t,s,i,a),r=function(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}(t),l=function(t,e,i,s){return i&&"mouseout"!==t.type?s?e:t:null}(t,this._lastEvent,i,r);i&&(this._lastEvent=null,ut(n.onHover,[t,o,this],this),r&&ut(n.onClick,[t,o,this],this));const c=!gt(o,s);return(c||e)&&(this._active=o,this._updateHoverStyles(o,s,e)),this._lastEvent=l,c}_getActiveElements(t,e,i,s){if("mouseout"===t.type)return[];if(!i)return e;const n=this.options.hover;return this.getElementsAtEventForMode(t,n.mode,n,s)}}function rn(){return ft(on.instances,(t=>t._plugins.invalidate()))}function ln(t,e){const{x:i,y:s,base:n,width:a,height:o}=t.getProps(["x","y","base","width","height"],e);let r,l,c,h,d;return t.horizontal?(d=o/2,r=Math.min(i,n),l=Math.max(i,n),c=s-d,h=s+d):(d=a/2,r=i-d,l=i+d,c=Math.min(s,n),h=Math.max(s,n)),{left:r,top:c,right:l,bottom:h}}function cn(t,e,i,s){return t?0:Wt(e,i,s)}function hn(t,e,i,s){const n=null===e,a=null===i,o=t&&!(n&&a)&&ln(t,s);return o&&(n||jt(e,o.left,o.right))&&(a||jt(i,o.top,o.bottom))}function dn(t,e){t.rect(e.x,e.y,e.w,e.h)}function un(t,e,i={}){const s=t.x!==i.x?-e:0,n=t.y!==i.y?-e:0,a=(t.x+t.w!==i.x+i.w?e:0)-s,o=(t.y+t.h!==i.y+i.h?e:0)-n;return{x:t.x+s,y:t.y+n,w:t.w+a,h:t.h+o,radius:t.radius}}const fn=(t,e)=>{let{boxHeight:i=e,boxWidth:s=e}=t;return t.usePointStyle&&(i=Math.min(i,e),s=t.pointStyleWidth||Math.min(s,e)),{boxWidth:s,boxHeight:i,itemHeight:Math.max(e,i)}};class gn extends ys{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(){const t=this.options.labels||{};let e=ut(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter((e=>t.filter(e,this.chart.data)))),t.sort&&(e=e.sort(((e,i)=>t.sort(e,i,this.chart.data)))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display)return void(this.width=this.height=0);const i=t.labels,s=ze(i.font),n=s.size,a=this._computeTitleHeight(),{boxWidth:o,itemHeight:r}=fn(i,n);let l,c;e.font=s.string,this.isHorizontal()?(l=this.maxWidth,c=this._fitRows(a,n,o,r)+10):(c=this.maxHeight,l=this._fitCols(a,s,o,r)+10),this.width=Math.min(l,t.maxWidth||this.maxWidth),this.height=Math.min(c,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){const{ctx:n,maxWidth:a,options:{labels:{padding:o}}}=this,r=this.legendHitBoxes=[],l=this.lineWidths=[0],c=s+o;let h=t;n.textAlign="left",n.textBaseline="middle";let d=-1,u=-c;return this.legendItems.forEach(((t,f)=>{const g=i+e/2+n.measureText(t.text).width;(0===f||l[l.length-1]+g+2*o>a)&&(h+=c,l[l.length-(f>0?0:1)]=0,u+=c,d++),r[f]={left:0,top:u,row:d,width:g,height:s},l[l.length-1]+=g+o})),h}_fitCols(t,e,i,s){const{ctx:n,maxHeight:a,options:{labels:{padding:o}}}=this,r=this.legendHitBoxes=[],l=this.columnSizes=[],c=a-t;let h=o,d=0,u=0,f=0,g=0;return this.legendItems.forEach(((t,a)=>{const{itemWidth:p,itemHeight:m}=function(t,e,i,s,n){const a=function(t,e,i,s){let n=t.text;return n&&"string"!=typeof n&&(n=n.reduce(((t,e)=>t.length>e.length?t:e))),e+i.size/2+s.measureText(n).width}(s,t,e,i),o=function(t,e,i){let s=t;return"string"!=typeof e.text&&(s=pn(e,i)),s}(n,s,e.lineHeight);return{itemWidth:a,itemHeight:o}}(i,e,n,t,s);a>0&&u+m+2*o>c&&(h+=d+o,l.push({width:d,height:u}),f+=d+o,g++,d=u=0),r[a]={left:f,top:u,col:g,width:p,height:m},d=Math.max(d,p),u+=m+o})),h+=d,l.push({width:d,height:u}),h}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:s},rtl:n}}=this,a=hi(n,this.left,this.width);if(this.isHorizontal()){let n=0,o=Qt(i,this.left+s,this.right-this.lineWidths[n]);for(const r of e)n!==r.row&&(n=r.row,o=Qt(i,this.left+s,this.right-this.lineWidths[n])),r.top+=this.top+t+s,r.left=a.leftForLtr(a.x(o),r.width),o+=r.width+s}else{let n=0,o=Qt(i,this.top+t+s,this.bottom-this.columnSizes[n].height);for(const r of e)r.col!==n&&(n=r.col,o=Qt(i,this.top+t+s,this.bottom-this.columnSizes[n].height)),r.top=o,r.left+=this.left+s,r.left=a.leftForLtr(a.x(r.left),r.width),o+=r.height+s}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const t=this.ctx;Me(t,this),this._draw(),Ee(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:s}=this,{align:n,labels:a}=t,o=be.color,r=hi(t.rtl,this.left,this.width),l=ze(a.font),{padding:c}=a,h=l.size,d=h/2;let u;this.drawTitle(),s.textAlign=r.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=l.string;const{boxWidth:f,boxHeight:g,itemHeight:p}=fn(a,h),m=this.isHorizontal(),b=this._computeTitleHeight();u=m?{x:Qt(n,this.left+c,this.right-i[0]),y:this.top+c+b,line:0}:{x:this.left+c,y:Qt(n,this.top+b+c,this.bottom-e[0].height),line:0},di(this.ctx,t.textDirection);const _=p+c;this.legendItems.forEach(((x,y)=>{s.strokeStyle=x.fontColor,s.fillStyle=x.fontColor;const v=s.measureText(x.text).width,w=r.textAlign(x.textAlign||(x.textAlign=a.textAlign)),k=f+d+v;let M=u.x,E=u.y;if(r.setWidth(this.width),m?y>0&&M+k+c>this.right&&(E=u.y+=_,u.line++,M=u.x=Qt(n,this.left+c,this.right-i[u.line])):y>0&&E+_>this.bottom&&(M=u.x=M+e[u.line].width+c,u.line++,E=u.y=Qt(n,this.top+b+c,this.bottom-e[u.line].height)),function(t,e,i){if(isNaN(f)||f<=0||isNaN(g)||g<0)return;s.save();const n=dt(i.lineWidth,1);if(s.fillStyle=dt(i.fillStyle,o),s.lineCap=dt(i.lineCap,"butt"),s.lineDashOffset=dt(i.lineDashOffset,0),s.lineJoin=dt(i.lineJoin,"miter"),s.lineWidth=n,s.strokeStyle=dt(i.strokeStyle,o),s.setLineDash(dt(i.lineDash,[])),a.usePointStyle){const o={radius:g*Math.SQRT2/2,pointStyle:i.pointStyle,rotation:i.rotation,borderWidth:n},l=r.xPlus(t,f/2);we(s,o,l,e+d,a.pointStyleWidth&&f)}else{const a=e+Math.max((h-g)/2,0),o=r.leftForLtr(t,f),l=Re(i.borderRadius);s.beginPath(),Object.values(l).some((t=>0!==t))?Ae(s,{x:o,y:a,w:f,h:g,radius:l}):s.rect(o,a,f,g),s.fill(),0!==n&&s.stroke()}s.restore()}(r.x(M),E,x),M=((t,e,i,s)=>t===(s?"left":"right")?i:"center"===t?(e+i)/2:e)(w,M+f+d,m?M+k:this.right,t.rtl),function(t,e,i){Ce(s,i.text,t,e+p/2,l,{strikethrough:i.hidden,textAlign:r.textAlign(i.textAlign)})}(r.x(M),E,x),m)u.x+=k+c;else if("string"!=typeof x.text){const t=l.lineHeight;u.y+=pn(x,t)+c}else u.y+=_})),ui(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=ze(e.font),s=Ne(e.padding);if(!e.display)return;const n=hi(t.rtl,this.left,this.width),a=this.ctx,o=e.position,r=i.size/2,l=s.top+r;let c,h=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),c=this.top+l,h=Qt(t.align,h,this.right-d);else{const e=this.columnSizes.reduce(((t,e)=>Math.max(t,e.height)),0);c=l+Qt(t.align,this.top,this.bottom-e-t.labels.padding-this._computeTitleHeight())}const u=Qt(o,h,h+d);a.textAlign=n.textAlign(Gt(o)),a.textBaseline="middle",a.strokeStyle=e.color,a.fillStyle=e.color,a.font=i.string,Ce(a,e.text,u,c,i)}_computeTitleHeight(){const t=this.options.title,e=ze(t.font),i=Ne(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,n;if(jt(t,this.left,this.right)&&jt(e,this.top,this.bottom))for(n=this.legendHitBoxes,i=0;i<n.length;++i)if(s=n[i],jt(t,s.left,s.left+s.width)&&jt(e,s.top,s.top+s.height))return this.legendItems[i];return null}handleEvent(t){const e=this.options;if(!function(t,e){return!("mousemove"!==t&&"mouseout"!==t||!e.onHover&&!e.onLeave)||!(!e.onClick||"click"!==t&&"mouseup"!==t)}(t.type,e))return;const i=this._getLegendItemAt(t.x,t.y);if("mousemove"===t.type||"mouseout"===t.type){const a=this._hoveredItem,o=(n=i,null!==(s=a)&&null!==n&&s.datasetIndex===n.datasetIndex&&s.index===n.index);a&&!o&&ut(e.onLeave,[t,a,this],this),this._hoveredItem=i,i&&!o&&ut(e.onHover,[t,i,this],this)}else i&&ut(e.onClick,[t,i,this],this);var s,n}}function pn(t,e){return e*(t.text?t.text.length:0)}var mn={id:"legend",_element:gn,start(t,e,i){const s=t.legend=new gn({ctx:t.ctx,options:i,chart:t});is.configure(t,s,i),is.addBox(t,s)},stop(t){is.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,i){const s=t.legend;is.configure(t,s,i),s.options=i},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,i){const s=e.datasetIndex,n=i.chart;n.isDatasetVisible(s)?(n.hide(s),e.hidden=!0):(n.show(s),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:i,pointStyle:s,textAlign:n,color:a,useBorderRadius:o,borderRadius:r}}=t.legend.options;return t._getSortedDatasetMetas().map((t=>{const l=t.controller.getStyle(i?0:void 0),c=Ne(l.borderWidth);return{text:e[t.index].label,fillStyle:l.backgroundColor,fontColor:a,hidden:!t.visible,lineCap:l.borderCapStyle,lineDash:l.borderDash,lineDashOffset:l.borderDashOffset,lineJoin:l.borderJoinStyle,lineWidth:(c.width+c.height)/4,strokeStyle:l.borderColor,pointStyle:s||l.pointStyle,rotation:l.rotation,textAlign:n||l.textAlign,borderRadius:o&&(r||l.borderRadius),datasetIndex:t.index}}),this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};new WeakMap;const bn={average(t){if(!t.length)return!1;let e,i,s=new Set,n=0,a=0;for(e=0,i=t.length;e<i;++e){const i=t[e].element;if(i&&i.hasValue()){const t=i.tooltipPosition();s.add(t.x),n+=t.y,++a}}return 0!==a&&0!==s.size&&{x:[...s].reduce(((t,e)=>t+e))/s.size,y:n/a}},nearest(t,e){if(!t.length)return!1;let i,s,n,a=e.x,o=e.y,r=Number.POSITIVE_INFINITY;for(i=0,s=t.length;i<s;++i){const s=t[i].element;if(s&&s.hasValue()){const t=(l=e,c=s.getCenterPoint(),Math.sqrt(Math.pow(c.x-l.x,2)+Math.pow(c.y-l.y,2)));t<r&&(r=t,n=s)}}var l,c;if(n){const t=n.tooltipPosition();a=t.x,o=t.y}return{x:a,y:o}}};function xn(t,e){return e&&(rt(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function yn(t){return("string"==typeof t||t instanceof String)&&t.indexOf("\n")>-1?t.split("\n"):t}function vn(t,e){const{element:i,datasetIndex:s,index:n}=e,a=t.getDatasetMeta(s).controller,{label:o,value:r}=a.getLabelAndValue(n);return{chart:t,label:o,parsed:a.getParsed(n),raw:t.data.datasets[s].data[n],formattedValue:r,dataset:a.getDataset(),dataIndex:n,datasetIndex:s,element:i}}function wn(t,e){const i=t.chart.ctx,{body:s,footer:n,title:a}=t,{boxWidth:o,boxHeight:r}=e,l=ze(e.bodyFont),c=ze(e.titleFont),h=ze(e.footerFont),d=a.length,u=n.length,f=s.length,g=Ne(e.padding);let p=g.height,m=0,b=s.reduce(((t,e)=>t+e.before.length+e.lines.length+e.after.length),0);b+=t.beforeBody.length+t.afterBody.length,d&&(p+=d*c.lineHeight+(d-1)*e.titleSpacing+e.titleMarginBottom),b&&(p+=f*(e.displayColors?Math.max(r,l.lineHeight):l.lineHeight)+(b-f)*l.lineHeight+(b-1)*e.bodySpacing),u&&(p+=e.footerMarginTop+u*h.lineHeight+(u-1)*e.footerSpacing);let _=0;const x=function(t){m=Math.max(m,i.measureText(t).width+_)};return i.save(),i.font=c.string,ft(t.title,x),i.font=l.string,ft(t.beforeBody.concat(t.afterBody),x),_=e.displayColors?o+2+e.boxPadding:0,ft(s,(t=>{ft(t.before,x),ft(t.lines,x),ft(t.after,x)})),_=0,i.font=h.string,ft(t.footer,x),i.restore(),m+=g.width,{width:m,height:p}}function kn(t,e,i,s){const{x:n,width:a}=i,{width:o,chartArea:{left:r,right:l}}=t;let c="center";return"center"===s?c=n<=(r+l)/2?"left":"right":n<=a/2?c="left":n>=o-a/2&&(c="right"),function(t,e,i,s){const{x:n,width:a}=s,o=i.caretSize+i.caretPadding;return"left"===t&&n+a+o>e.width||"right"===t&&n-a-o<0||void 0}(c,t,e,i)&&(c="center"),c}function Mn(t,e,i){const s=i.yAlign||e.yAlign||function(t,e){const{y:i,height:s}=e;return i<s/2?"top":i>t.height-s/2?"bottom":"center"}(t,i);return{xAlign:i.xAlign||e.xAlign||kn(t,e,i,s),yAlign:s}}function En(t,e,i,s){const{caretSize:n,caretPadding:a,cornerRadius:o}=t,{xAlign:r,yAlign:l}=i,c=n+a,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:f}=Re(o);let g=function(t,e){let{x:i,width:s}=t;return"right"===e?i-=s:"center"===e&&(i-=s/2),i}(e,r);const p=function(t,e,i){let{y:s,height:n}=t;return"top"===e?s+=i:s-="bottom"===e?n+i:n/2,s}(e,l,c);return"center"===l?"left"===r?g+=c:"right"===r&&(g-=c):"left"===r?g-=Math.max(h,u)+n:"right"===r&&(g+=Math.max(d,f)+n),{x:Wt(g,0,s.width-e.width),y:Wt(p,0,s.height-e.height)}}function Sn(t,e,i){const s=Ne(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-s.right:t.x+s.left}function Pn(t){return xn([],yn(t))}function Cn(t,e){const i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}const An={beforeTitle:nt,title(t){if(t.length>0){const e=t[0],i=e.chart.data.labels,s=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(s>0&&e.dataIndex<s)return i[e.dataIndex]}return""},afterTitle:nt,beforeBody:nt,beforeLabel:nt,label(t){if(this&&this.options&&"dataset"===this.options.mode)return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const i=t.formattedValue;return ot(i)||(e+=i),e},labelColor(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:nt,afterBody:nt,beforeFooter:nt,footer:nt,afterFooter:nt};function Ln(t,e,i,s){const n=t[e].call(i,s);return void 0===n?An[e].call(i,s):n}class On extends ys{static positioners=bn;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,n=new _i(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(n)),n}getContext(){return this.$context||(this.$context=Be(this.chart.getContext(),{tooltip:this,tooltipItems:this._tooltipItems,type:"tooltip"}))}getTitle(t,e){const{callbacks:i}=e,s=Ln(i,"beforeTitle",this,t),n=Ln(i,"title",this,t),a=Ln(i,"afterTitle",this,t);let o=[];return o=xn(o,yn(s)),o=xn(o,yn(n)),o=xn(o,yn(a)),o}getBeforeBody(t,e){return Pn(Ln(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:i}=e,s=[];return ft(t,(t=>{const e={before:[],lines:[],after:[]},n=Cn(i,t);xn(e.before,yn(Ln(n,"beforeLabel",this,t))),xn(e.lines,Ln(n,"label",this,t)),xn(e.after,yn(Ln(n,"afterLabel",this,t))),s.push(e)})),s}getAfterBody(t,e){return Pn(Ln(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:i}=e,s=Ln(i,"beforeFooter",this,t),n=Ln(i,"footer",this,t),a=Ln(i,"afterFooter",this,t);let o=[];return o=xn(o,yn(s)),o=xn(o,yn(n)),o=xn(o,yn(a)),o}_createItems(t){const e=this._active,i=this.chart.data,s=[],n=[],a=[];let o,r,l=[];for(o=0,r=e.length;o<r;++o)l.push(vn(this.chart,e[o]));return t.filter&&(l=l.filter(((e,s,n)=>t.filter(e,s,n,i)))),t.itemSort&&(l=l.sort(((e,s)=>t.itemSort(e,s,i)))),ft(l,(e=>{const i=Cn(t.callbacks,e);s.push(Ln(i,"labelColor",this,e)),n.push(Ln(i,"labelPointStyle",this,e)),a.push(Ln(i,"labelTextColor",this,e))})),this.labelColors=s,this.labelPointStyles=n,this.labelTextColors=a,this.dataPoints=l,l}update(t,e){const i=this.options.setContext(this.getContext()),s=this._active;let n,a=[];if(s.length){const t=bn[i.position].call(this,s,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);const e=this._size=wn(this,i),o=Object.assign({},t,e),r=Mn(this.chart,i,o),l=En(i,o,r,this.chart);this.xAlign=r.xAlign,this.yAlign=r.yAlign,n={opacity:1,x:l.x,y:l.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(n={opacity:0});this._tooltipItems=a,this.$context=void 0,n&&this._resolveAnimations().update(this,n),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){const n=this.getCaretPosition(t,i,s);e.lineTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.lineTo(n.x3,n.y3)}getCaretPosition(t,e,i){const{xAlign:s,yAlign:n}=this,{caretSize:a,cornerRadius:o}=i,{topLeft:r,topRight:l,bottomLeft:c,bottomRight:h}=Re(o),{x:d,y:u}=t,{width:f,height:g}=e;let p,m,b,_,x,y;return"center"===n?(x=u+g/2,"left"===s?(p=d,m=p-a,_=x+a,y=x-a):(p=d+f,m=p+a,_=x-a,y=x+a),b=p):(m="left"===s?d+Math.max(r,c)+a:"right"===s?d+f-Math.max(l,h)-a:this.caretX,"top"===n?(_=u,x=_-a,p=m-a,b=m+a):(_=u+g,x=_+a,p=m+a,b=m-a),y=_),{x1:p,x2:m,x3:b,y1:_,y2:x,y3:y}}drawTitle(t,e,i){const s=this.title,n=s.length;let a,o,r;if(n){const l=hi(i.rtl,this.x,this.width);for(t.x=Sn(this,i.titleAlign,i),e.textAlign=l.textAlign(i.titleAlign),e.textBaseline="middle",a=ze(i.titleFont),o=i.titleSpacing,e.fillStyle=i.titleColor,e.font=a.string,r=0;r<n;++r)e.fillText(s[r],l.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+o,r+1===n&&(t.y+=i.titleMarginBottom-o)}}_drawColorBox(t,e,i,s,n){const a=this.labelColors[i],o=this.labelPointStyles[i],{boxHeight:r,boxWidth:l}=n,c=ze(n.bodyFont),h=Sn(this,"left",n),d=s.x(h),u=r<c.lineHeight?(c.lineHeight-r)/2:0,f=e.y+u;if(n.usePointStyle){const e={radius:Math.min(l,r)/2,pointStyle:o.pointStyle,rotation:o.rotation,borderWidth:1},i=s.leftForLtr(d,l)+l/2,c=f+r/2;t.strokeStyle=n.multiKeyBackground,t.fillStyle=n.multiKeyBackground,ve(t,e,i,c),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,ve(t,e,i,c)}else{t.lineWidth=lt(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,t.strokeStyle=a.borderColor,t.setLineDash(a.borderDash||[]),t.lineDashOffset=a.borderDashOffset||0;const e=s.leftForLtr(d,l),i=s.leftForLtr(s.xPlus(d,1),l-2),o=Re(a.borderRadius);Object.values(o).some((t=>0!==t))?(t.beginPath(),t.fillStyle=n.multiKeyBackground,Ae(t,{x:e,y:f,w:l,h:r,radius:o}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),Ae(t,{x:i,y:f+1,w:l-2,h:r-2,radius:o}),t.fill()):(t.fillStyle=n.multiKeyBackground,t.fillRect(e,f,l,r),t.strokeRect(e,f,l,r),t.fillStyle=a.backgroundColor,t.fillRect(i,f+1,l-2,r-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:s}=this,{bodySpacing:n,bodyAlign:a,displayColors:o,boxHeight:r,boxWidth:l,boxPadding:c}=i,h=ze(i.bodyFont);let d=h.lineHeight,u=0;const f=hi(i.rtl,this.x,this.width),g=function(i){e.fillText(i,f.x(t.x+u),t.y+d/2),t.y+=d+n},p=f.textAlign(a);let m,b,_,x,y,v,w;for(e.textAlign=a,e.textBaseline="middle",e.font=h.string,t.x=Sn(this,p,i),e.fillStyle=i.bodyColor,ft(this.beforeBody,g),u=o&&"right"!==p?"center"===a?l/2+c:l+2+c:0,x=0,v=s.length;x<v;++x){for(m=s[x],b=this.labelTextColors[x],e.fillStyle=b,ft(m.before,g),_=m.lines,o&&_.length&&(this._drawColorBox(e,t,x,f,i),d=Math.max(h.lineHeight,r)),y=0,w=_.length;y<w;++y)g(_[y]),d=h.lineHeight;ft(m.after,g)}u=0,d=h.lineHeight,ft(this.afterBody,g),t.y-=n}drawFooter(t,e,i){const s=this.footer,n=s.length;let a,o;if(n){const r=hi(i.rtl,this.x,this.width);for(t.x=Sn(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=r.textAlign(i.footerAlign),e.textBaseline="middle",a=ze(i.footerFont),e.fillStyle=i.footerColor,e.font=a.string,o=0;o<n;++o)e.fillText(s[o],r.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+i.footerSpacing}}drawBackground(t,e,i,s){const{xAlign:n,yAlign:a}=this,{x:o,y:r}=t,{width:l,height:c}=i,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:f}=Re(s.cornerRadius);e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.beginPath(),e.moveTo(o+h,r),"top"===a&&this.drawCaret(t,e,i,s),e.lineTo(o+l-d,r),e.quadraticCurveTo(o+l,r,o+l,r+d),"center"===a&&"right"===n&&this.drawCaret(t,e,i,s),e.lineTo(o+l,r+c-f),e.quadraticCurveTo(o+l,r+c,o+l-f,r+c),"bottom"===a&&this.drawCaret(t,e,i,s),e.lineTo(o+u,r+c),e.quadraticCurveTo(o,r+c,o,r+c-u),"center"===a&&"left"===n&&this.drawCaret(t,e,i,s),e.lineTo(o,r+h),e.quadraticCurveTo(o,r,o+h,r),e.closePath(),e.fill(),s.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,n=i&&i.y;if(s||n){const i=bn[t.position].call(this,this._active,this._eventPosition);if(!i)return;const a=this._size=wn(this,t),o=Object.assign({},i,this._size),r=Mn(e,t,o),l=En(t,o,r,e);s._to===l.x&&n._to===l.y||(this.xAlign=r.xAlign,this.yAlign=r.yAlign,this.width=a.width,this.height=a.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,l))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},n={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const a=Ne(e.padding),o=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&o&&(t.save(),t.globalAlpha=i,this.drawBackground(n,t,s,e),di(t,e.textDirection),n.y+=a.top,this.drawTitle(n,t,e),this.drawBody(n,t,e),this.drawFooter(n,t,e),ui(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,s=t.map((({datasetIndex:t,index:e})=>{const i=this.chart.getDatasetMeta(t);if(!i)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:i.data[e],index:e}})),n=!gt(i,s),a=this._positionChanged(s,e);(n||a)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,n=this._active||[],a=this._getActiveElements(t,n,e,i),o=this._positionChanged(a,t),r=e||!gt(a,n)||o;return r&&(this._active=a,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),r}_getActiveElements(t,e,i,s){const n=this.options;if("mouseout"===t.type)return[];if(!s)return e.filter((t=>this.chart.data.datasets[t.datasetIndex]&&void 0!==this.chart.getDatasetMeta(t.datasetIndex).controller.getParsed(t.index)));const a=this.chart.getElementsAtEventForMode(t,n.mode,n,i);return n.reverse&&a.reverse(),a}_positionChanged(t,e){const{caretX:i,caretY:s,options:n}=this,a=bn[n.position].call(this,t,e);return!1!==a&&(i!==a.x||s!==a.y)}}var Dn={id:"tooltip",_element:On,positioners:bn,afterInit(t,e,i){i&&(t.tooltip=new On({chart:t,options:i}))},beforeUpdate(t,e,i){t.tooltip&&t.tooltip.initialize(i)},reset(t,e,i){t.tooltip&&t.tooltip.initialize(i)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const i={tooltip:e};if(!1===t.notifyPlugins("beforeTooltipDraw",{...i,cancelable:!0}))return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i)}},afterEvent(t,e){if(t.tooltip){const i=e.replay;t.tooltip.handleEvent(e.event,i,e.inChartArea)&&(e.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:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.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:An},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};function Tn(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}function In(t,e,{horizontal:i,minRotation:s}){const n=Bt(s),a=(i?Math.sin(n):Math.cos(n))||.001,o=.75*e*(""+t).length;return Math.min(e/a,o)}class Rn extends As{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 ot(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:s,max:n}=this;const a=t=>s=e?s:t,o=t=>n=i?n:t;if(t){const t=Rt(s),e=Rt(n);t<0&&e<0?o(0):t>0&&e>0&&a(0)}if(s===n){let e=0===n?1:Math.abs(.05*n);o(n+e),t||a(s-e)}this.min=s,this.max=n}getTickLimit(){const t=this.options.ticks;let e,{maxTicksLimit:i,stepSize:s}=t;return s?(e=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,e>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${e} ticks. Limiting to 1000.`),e=1e3)):(e=this.computeTickLimit(),i=i||11),i&&(e=Math.min(i,e)),e}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s=function(t,e){const i=[],{bounds:s,step:n,min:a,max:o,precision:r,count:l,maxTicks:c,maxDigits:h,includeBounds:d}=t,u=n||1,f=c-1,{min:g,max:p}=e,m=!ot(a),b=!ot(o),_=!ot(l),x=(p-g)/(h+1);let y,v,w,k,M=zt((p-g)/f/u)*u;if(M<1e-14&&!m&&!b)return[{value:g},{value:p}];k=Math.ceil(p/M)-Math.floor(g/M),k>f&&(M=zt(k*M/f/u)*u),ot(r)||(y=Math.pow(10,r),M=Math.ceil(M*y)/y),"ticks"===s?(v=Math.floor(g/M)*M,w=Math.ceil(p/M)*M):(v=g,w=p),m&&b&&n&&function(t,e){const i=Math.round(t);return i-e<=t&&i+e>=t}((o-a)/n,M/1e3)?(k=Math.round(Math.min((o-a)/M,c)),M=(o-a)/k,v=a,w=o):_?(v=m?a:v,w=b?o:w,k=l-1,M=(w-v)/k):(k=(w-v)/M,k=Nt(k,Math.round(k),M/1e3)?Math.round(k):Math.ceil(k));const E=Math.max(Ht(M),Ht(v));y=Math.pow(10,ot(r)?E:r),v=Math.round(v*y)/y,w=Math.round(w*y)/y;let S=0;for(m&&(d&&v!==a?(i.push({value:a}),v<a&&S++,Nt(Math.round((v+S*M)*y)/y,a,In(a,x,t))&&S++):v<a&&S++);S<k;++S){const t=Math.round((v+S*M)*y)/y;if(b&&t>o)break;i.push({value:t})}return b&&d&&w!==o?i.length&&Nt(i[i.length-1].value,o,In(o,x,t))?i[i.length-1].value=o:i.push({value:o}):b&&w!==o||i.push({value:w}),i}({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:!1!==e.includeBounds},this._range||this);return"ticks"===t.bounds&&function(t,e,i){let s,n,a;for(s=0,n=t.length;s<n;s++)a=t[s][i],isNaN(a)||(e.min=Math.min(e.min,a),e.max=Math.max(e.max,a))}(s,this,"value"),t.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return ce(t,this.chart.options.locale,this.options.ticks.format)}}class Nn extends Rn{static id="linear";static defaults={ticks:{callback:de.formatters.numeric}};determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=ct(t)?t:0,this.max=ct(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=Bt(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,n=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,n.lineHeight/s))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}de.formatters.logarithmic,de.formatters.numeric,on.register(class extends Li{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,e,i,s){return Ti(t,e,i,s)}parseArrayData(t,e,i,s){return Ti(t,e,i,s)}parseObjectData(t,e,i,s){const{iScale:n,vScale:a}=t,{xAxisKey:o="x",yAxisKey:r="y"}=this._parsing,l="x"===n.axis?o:r,c="x"===a.axis?o:r,h=[];let d,u,f,g;for(d=i,u=i+s;d<u;++d)g=e[d],f={},f[n.axis]=n.parse(wt(g,l),d),h.push(Di(wt(g,c),f,a,d));return h}updateRangeFromParsed(t,e,i,s){super.updateRangeFromParsed(t,e,i,s);const n=i._custom;n&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,n.min),t.max=Math.max(t.max,n.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:i,vScale:s}=e,n=this.getParsed(t),a=n._custom,o=Ii(a)?"["+a.start+", "+a.end+"]":""+s.getLabelForValue(n[s.axis]);return{label:""+i.getLabelForValue(n[i.axis]),value:o}}initialize(){this.enableOptionSharing=!0,super.initialize(),this._cachedMeta.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,s){const n="reset"===s,{index:a,_cachedMeta:{vScale:o}}=this,r=o.getBasePixel(),l=o.isHorizontal(),c=this._getRuler(),{sharedOptions:h,includeOptions:d}=this._getSharedOptions(e,s);for(let u=e;u<e+i;u++){const e=this.getParsed(u),i=n||ot(e[o.axis])?{base:r,head:r}:this._calculateBarValuePixels(u),f=this._calculateBarIndexPixels(u,c),g=(e._stacks||{})[o.axis],p={horizontal:l,base:i.base,enableBorderRadius:!g||Ii(e._custom)||a===g._top||a===g._bottom,x:l?i.head:f.center,y:l?f.center:i.head,height:l?f.size:Math.abs(i.size),width:l?Math.abs(i.size):f.size};d&&(p.options=h||this.resolveDataElementOptions(u,t[u].active?"active":s));const m=p.options||t[u].options;Ri(p,m,g,a),Fi(p,m,c.ratio),this.updateElement(t[u],u,p,s)}}_getStacks(t,e){const{iScale:i}=this._cachedMeta,s=i.getMatchingVisibleMetas(this._type).filter((t=>t.controller.options.grouped)),n=i.options.stacked,a=[],o=this._cachedMeta.controller.getParsed(e),r=o&&o[i.axis],l=t=>{const e=t._parsed.find((t=>t[i.axis]===r)),s=e&&e[t.vScale.axis];if(ot(s)||isNaN(s))return!0};for(const i of s)if((void 0===e||!l(i))&&((!1===n||-1===a.indexOf(i.stack)||void 0===n&&void 0===i.stack)&&a.push(i.stack),i.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const s=this._getStacks(t,i),n=void 0!==e?s.indexOf(e):-1;return-1===n?s.length-1:n}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,s=[];let n,a;for(n=0,a=e.data.length;n<a;++n)s.push(i.getPixelForValue(this.getParsed(n)[i.axis],n));const o=t.barThickness;return{min:o||Oi(e),pixels:s,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:o?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:i,index:s},options:{base:n,minBarLength:a}}=this,o=n||0,r=this.getParsed(t),l=r._custom,c=Ii(l);let h,d,u=r[e.axis],f=0,g=i?this.applyStack(e,r,i):u;g!==u&&(f=g-u,g=u),c&&(u=l.barStart,g=l.barEnd-l.barStart,0!==u&&Rt(u)!==Rt(l.barEnd)&&(f=0),f+=u);const p=ot(n)||c?f:n;let m=e.getPixelForValue(p);if(h=this.chart.getDataVisibility(t)?e.getPixelForValue(f+g):m,d=h-m,Math.abs(d)<a){d=function(t,e,i){return 0!==t?Rt(t):(e.isHorizontal()?1:-1)*(e.min>=i?1:-1)}(d,e,o)*a,u===o&&(m-=d/2);const t=e.getPixelForDecimal(0),n=e.getPixelForDecimal(1),l=Math.min(t,n),f=Math.max(t,n);m=Math.max(Math.min(m,f),l),h=m+d,i&&!c&&(r._stacks[e.axis]._visualValues[s]=e.getValueForPixel(h)-e.getValueForPixel(m))}if(m===e.getPixelForValue(o)){const t=Rt(d)*e.getLineWidthForValue(o)/2;m+=t,d-=t}return{size:d,base:m,head:h,center:h+d/2}}_calculateBarIndexPixels(t,e){const i=e.scale,s=this.options,n=s.skipNull,a=dt(s.maxBarThickness,1/0);let o,r;if(e.grouped){const i=n?this._getStackCount(t):e.stackCount,l="flex"===s.barThickness?function(t,e,i,s){const n=e.pixels,a=n[t];let o=t>0?n[t-1]:null,r=t<n.length-1?n[t+1]:null;const l=i.categoryPercentage;null===o&&(o=a-(null===r?e.end-e.start:r-a)),null===r&&(r=a+a-o);const c=a-(a-Math.min(o,r))/2*l;return{chunk:Math.abs(r-o)/2*l/s,ratio:i.barPercentage,start:c}}(t,e,s,i):function(t,e,i,s){const n=i.barThickness;let a,o;return ot(n)?(a=e.min*i.categoryPercentage,o=i.barPercentage):(a=n*s,o=1),{chunk:a/s,ratio:o,start:e.pixels[t]-a/2}}(t,e,s,i),c=this._getStackIndex(this.index,this._cachedMeta.stack,n?t:void 0);o=l.start+l.chunk*c+l.chunk/2,r=Math.min(a,l.chunk*l.ratio)}else o=i.getPixelForValue(this.getParsed(t)[i.axis],t),r=Math.min(a,e.min*e.ratio);return{base:o-r/2,head:o+r/2,center:o,size:r}}draw(){const t=this._cachedMeta,e=t.vScale,i=t.data,s=i.length;let n=0;for(;n<s;++n)null===this.getParsed(n)[e.axis]||i[n].hidden||i[n].draw(this._ctx)}},class extends As{static id="category";static defaults={ticks:{callback:Tn}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const t=this.getLabels();for(const{index:i,label:s}of e)t[i]===s&&t.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(ot(t))return null;const i=this.getLabels();return((t,e)=>null===t?null:Wt(Math.round(t),0,e))(e=isFinite(e)&&i[e]===t?e:function(t,e,i,s){const n=t.indexOf(e);return-1===n?((t,e,i,s)=>("string"==typeof e?(i=t.push(e)-1,s.unshift({index:i,label:e})):isNaN(e)&&(i=null),i))(t,e,i,s):n!==t.lastIndexOf(e)?i:n}(i,t,dt(e,t),this._addedLabels),i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,s=[];let n=this.getLabels();n=0===t&&e===n.length-1?n:n.slice(t,e+1),this._valueRange=Math.max(n.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let i=t;i<=e;i++)s.push({value:i});return s}getLabelForValue(t){return Tn.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return"number"!=typeof t&&(t=this.parse(t)),null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const 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}},Nn,class extends ys{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:e,options:{borderColor:i,backgroundColor:s}}=this,{inner:n,outer:a}=function(t){const e=ln(t),i=e.right-e.left,s=e.bottom-e.top,n=function(t,e,i){const s=t.options.borderWidth,n=t.borderSkipped,a=Ie(s);return{t:cn(n.top,a.top,0,i),r:cn(n.right,a.right,0,e),b:cn(n.bottom,a.bottom,0,i),l:cn(n.left,a.left,0,e)}}(t,i/2,s/2),a=function(t,e,i){const{enableBorderRadius:s}=t.getProps(["enableBorderRadius"]),n=t.options.borderRadius,a=Re(n),o=Math.min(e,i),r=t.borderSkipped,l=s||lt(n);return{topLeft:cn(!l||r.top||r.left,a.topLeft,0,o),topRight:cn(!l||r.top||r.right,a.topRight,0,o),bottomLeft:cn(!l||r.bottom||r.left,a.bottomLeft,0,o),bottomRight:cn(!l||r.bottom||r.right,a.bottomRight,0,o)}}(t,i/2,s/2);return{outer:{x:e.left,y:e.top,w:i,h:s,radius:a},inner:{x:e.left+n.l,y:e.top+n.t,w:i-n.l-n.r,h:s-n.t-n.b,radius:{topLeft:Math.max(0,a.topLeft-Math.max(n.t,n.l)),topRight:Math.max(0,a.topRight-Math.max(n.t,n.r)),bottomLeft:Math.max(0,a.bottomLeft-Math.max(n.b,n.l)),bottomRight:Math.max(0,a.bottomRight-Math.max(n.b,n.r))}}}}(this),o=(r=a.radius).topLeft||r.topRight||r.bottomLeft||r.bottomRight?Ae:dn;var r;t.save(),a.w===n.w&&a.h===n.h||(t.beginPath(),o(t,un(a,e,n)),t.clip(),o(t,un(n,-e,a)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),o(t,un(n,e)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,e,i){return hn(this,t,e,i)}inXRange(t,e){return hn(this,t,null,e)}inYRange(t,e){return hn(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,base:s,horizontal:n}=this.getProps(["x","y","base","horizontal"],t);return{x:n?(e+s)/2:e,y:n?i:(i+s)/2}}getRange(t){return"x"===t?this.width/2:this.height/2}},Dn,mn);const zn=()=>{const t=(0,i.useRef)(null),n=l(),[a,o]=(0,i.useState)(null),[r,c]=(0,i.useState)(90);return(0,i.useEffect)((()=>{if(a&&a.destroy(),t.current){const e=t.current.getContext("2d"),i=n.chart.labels.slice(-r),s=n.chart.data.slice(-r),a=new on(e,{type:"bar",data:{labels:i,datasets:[{label:n.chart.legend.label,data:s,backgroundColor:"rgba(54, 162, 235, 0.6)",borderColor:"rgba(54, 162, 235, 1)",borderWidth:1}]},options:{responsive:!0,scales:{x:{ticks:{maxTicksLimit:15}}}}});o(a)}return()=>{a&&a.destroy()}}),[r]),(0,e.createElement)("div",{className:"rcf7-chart"},(0,e.createElement)("div",{className:"rcf7-chart__controls"},(0,e.createElement)("label",{htmlFor:"date-range-select"},(0,s.__)("Show data for","wpcf7-redirect")),(0,e.createElement)("select",{id:"date-range-select",value:r,onChange:t=>{c(Number(t.target.value))}},(0,e.createElement)("option",{value:15},(0,s.__)("Last 15 days","wpcf7-redirect")),(0,e.createElement)("option",{value:30},(0,s.__)("Last 30 days","wpcf7-redirect")),(0,e.createElement)("option",{value:90},(0,s.__)("Last 90 days","wpcf7-redirect")))),(0,e.createElement)("div",{className:"rcf7-chart__render"},(0,e.createElement)("canvas",{ref:t})))},Fn=()=>{const t=l();return(0,e.createElement)("div",{className:"rcf7-table"},t.submissionTable.length>0?(0,e.createElement)("table",null,(0,e.createElement)("thead",null,(0,e.createElement)("tr",null,(0,e.createElement)("th",null,(0,s.__)("ID","wpcf7-redirect")),(0,e.createElement)("th",null,(0,s.__)("Submission Title","wpcf7-redirect")),(0,e.createElement)("th",null,(0,s.__)("Form","wpcf7-redirect")),(0,e.createElement)("th",null,(0,s.__)("Date","wpcf7-redirect")),(0,e.createElement)("th",null,(0,s.__)("Actions","wpcf7-redirect")))),(0,e.createElement)("tbody",null,t.submissionTable.map((t=>{var i,n;return(0,e.createElement)("tr",{key:t.id},(0,e.createElement)("td",null,t.id),(0,e.createElement)("td",{className:"rcf7-table__title"},t.title),(0,e.createElement)("td",null,(0,e.createElement)("a",{target:"_blank",href:t.formLink},null!==(i=t.formLabel)&&void 0!==i?i:"-")),(0,e.createElement)("td",null,(n=t.date)?new Date(n).toLocaleString():"-"),(0,e.createElement)("td",{className:"rcf7-table__actions"},(0,e.createElement)("a",{className:"rcf7-btn",href:t.actions.view,target:"_blank",title:(0,s.__)("View details","wpcf7-redirect")},(0,s.__)("View","wpcf7-redirect"))))})))):(0,e.createElement)("div",{className:"rcf7-table__no-entries"},(0,e.createElement)("p",null,(0,s.__)("No form submissions found.","wpcf7-redirect")),(0,e.createElement)("p",null,(0,s.__)("Add a Save Entry action to your contact forms to capture the submitted data.","wpcf7-redirect"))))},Bn=()=>{const t=l();return(0,e.createElement)("div",{className:"rcf7-form-entries"},t.submissionTable.length>0&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"rcf7-form-entries__section no-padding"},(0,e.createElement)(P,null)),(0,e.createElement)("div",{className:"rcf7-form-entries__section rcf7-card"},(0,e.createElement)(zn,null))),(0,e.createElement)("h3",null,(0,s.__)("Latest Entries","wpcf7-redirect")),(0,e.createElement)("div",{className:"rcf7-form-entries__section no-padding"},(0,e.createElement)(Fn,null)))},Hn=({id:t,checked:i,onChange:s,label:n,description:a,disabled:o=!1})=>(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"rcf7-checkbox__input"},(0,e.createElement)("input",{type:"checkbox",id:t,checked:i,onChange:s,disabled:o}),(0,e.createElement)("label",{htmlFor:t,className:"rcf7-checkbox__label"},n)),a&&(0,e.createElement)("p",{className:"rcf7-checkbox__description"},a)),Vn=({classes:t})=>(0,e.createElement)("span",{className:p("rcf7-loader",t)}),Wn=()=>{const t=l(),n=c(),[o,r]=(0,i.useState)(Boolean(t.debugMode)),[d,f]=(0,i.useState)(""),g=(0,i.useCallback)((()=>{const e=new AbortController,i=setTimeout((()=>e.abort()),5e3);a()({path:t.endpoints.toggleDebugMode,method:"POST",signal:e.signal}).then((t=>{clearTimeout(i),f(""),n({type:u,isLoading:!1}),r(Boolean(t.data?.debugMode))})).catch((t=>{f(t.message),n({type:u,isLoading:!1})}))}),[t]);return(0,e.createElement)("div",{className:"rcf7-adv-settings"},(0,e.createElement)("h2",null,(0,s.__)("Advanced Settings","wpcf7-redirect")),(0,e.createElement)("div",{className:"rcf7-adv-settings__container rcf7-card"},(0,e.createElement)(Hn,{id:"debug",checked:o,onChange:t=>{n({type:u,isLoading:!0}),r(t.target.checked),g()},label:(0,s.__)("Enable Debug Mode","wpcf7-redirect"),description:(0,s.__)("This will open the actions post type and display debug feature.","wpcf7-redirect"),disabled:t.isUpdatingOptions}),o&&!t.isUpdatingOptions&&(0,e.createElement)("button",{disabled:t.isUpdatingOptions,className:p("rcf7-btn","rcf7-btn--red",{disabled:t.isUpdatingOptions}),onClick:()=>{n({type:h})}},(0,s.__)("Reset Settings","wpcf7-redirect")),t.isUpdatingOptions&&(0,e.createElement)("div",{className:"rcf7-adv-settings__updates"},(0,e.createElement)(Vn,{classes:"rcf7-loader--blue"}),(0,s.__)("Updating option","wpcf7-redirect")),d&&(0,e.createElement)("div",{className:"rcf7-adv-settings__error"},(0,s.__)("Error","wpcf7-redirect"),":",d)))},jn=({upgradeLink:t})=>(0,e.createElement)("div",{className:"rcf7-unlock-banner"},(0,e.createElement)("div",{className:"rcf7-unlock-banner__content"},(0,e.createElement)("h3",{className:"rcf7-unlock-banner__title"},(0,s.__)("Unlock Advanced Features","wpcf7-redirect")),(0,e.createElement)("p",{className:"rcf7-unlock-banner__description"},(0,s.__)("Get conditional redirects, CRM integrations, and more with premium add-ons.","wpcf7-redirect"))),(0,e.createElement)("a",{href:t,target:"_blank",className:"rcf7-btn"},(0,s.__)("Explore Premium","wpcf7-redirect"))),$n=v("BookA",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"m8 13 4-7 4 7",key:"4rari8"}],["path",{d:"M9.1 11h5.7",key:"1gkovt"}]]),Yn=v("BookOpenText",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M16 12h2",key:"7q9ll5"}],["path",{d:"M16 8h2",key:"msurwy"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}],["path",{d:"M6 12h2",key:"32wvfc"}],["path",{d:"M6 8h2",key:"30oboj"}]]),Un=v("MessageCircleQuestion",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),qn=v("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),Xn=({icon:t,title:i,description:s,href:n,...a})=>(0,e.createElement)("a",{href:n,target:"_blank",rel:"noreferrer noopener",className:"rcf7-resource rcf7-card",...a},(0,e.createElement)("span",null,t),(0,e.createElement)("span",{className:"rcf7-resource__title"},i),(0,e.createElement)("span",{className:"rcf7-resource__description"},s)),Kn=()=>{const t=l();return(0,e.createElement)("div",{className:"rcf7-resources"},(0,e.createElement)(Xn,{icon:(0,e.createElement)($n,null),title:(0,s.__)("Documentation","wpcf7-redirect"),description:(0,s.__)("Browse our guides","wpcf7-redirect"),href:t.links.docs}),(0,e.createElement)(Xn,{icon:(0,e.createElement)(Yn,null),title:(0,s.__)("Tutorials","wpcf7-redirect"),description:(0,s.__)("Step-by-step guides","wpcf7-redirect"),href:t.links.tutorial}),(0,e.createElement)(Xn,{icon:(0,e.createElement)(Un,null),title:(0,s.__)("Support","wpcf7-redirect"),description:(0,s.__)("Get help from our team","wpcf7-redirect"),href:t.links.support,"data-ti-support":"dashboard-resources"}),(0,e.createElement)(Xn,{icon:(0,e.createElement)(qn,null),title:(0,s.__)("Premium Features","wpcf7-redirect"),description:(0,s.__)("Explore add-ons","wpcf7-redirect"),href:t.links.upgrade}))},Zn=()=>{const t=l();return(0,e.createElement)("div",{className:"rcf7-settings-tab"},(0,e.createElement)("div",{className:"rcf7-dashboard__section"},(0,e.createElement)("h2",null,(0,s.__)("Quick Setup Guide","wpcf7-redirect")),(0,e.createElement)(b,null)),(0,e.createElement)("div",{className:"rcf7-dashboard__section"},(0,e.createElement)("h2",null,(0,s.__)("Form Analytics","wpcf7-redirect")),(0,e.createElement)(Bn,null)),(0,e.createElement)("div",{className:"rcf7-dashboard__section"},(0,e.createElement)("h2",null,(0,s.__)("Resources","wpcf7-redirect")),(0,e.createElement)(Kn,null)),(0,e.createElement)("div",{className:"rcf7-dashboard__section"},(0,e.createElement)(Wn,null)),(0,e.createElement)("div",{className:"rcf7-dashboard__section"},(0,e.createElement)(jn,{upgradeLink:t.links.upgrade})))},Gn=v("GalleryVertical",[["path",{d:"M3 2h18",key:"15qxfx"}],["rect",{width:"18",height:"12",x:"3",y:"6",rx:"2",key:"1439r6"}],["path",{d:"M3 22h18",key:"8prr45"}]]),Qn=v("FileDown",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]),Jn=v("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]),ta=v("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]),ea=v("Pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]),ia=v("Webhook",[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]]),sa=v("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]),na=v("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]),aa=v("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]),oa=v("PhoneForwarded",[["polyline",{points:"18 2 22 6 18 10",key:"6vjanh"}],["line",{x1:"14",x2:"22",y1:"6",y2:"6",key:"1jsywh"}],["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]),ra=v("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]),la=v("ChartNoAxesCombined",[["path",{d:"M12 16v5",key:"zza2cw"}],["path",{d:"M16 14v7",key:"1g90b9"}],["path",{d:"M20 10v11",key:"1iqoj0"}],["path",{d:"m22 3-8.646 8.646a.5.5 0 0 1-.708 0L9.354 8.354a.5.5 0 0 0-.707 0L2 15",key:"1fw8x9"}],["path",{d:"M4 18v3",key:"1yp0dc"}],["path",{d:"M8 14v7",key:"n3cwzv"}]]),ca=({title:t,description:i,details:n,features:a,isPremium:o,learnMoreLink:r,badgeLabel:l})=>(0,e.createElement)("div",{className:"rcf7-card rcf7-featured"},(0,e.createElement)("div",{className:"rcf7-featured__header"},(0,e.createElement)("div",{className:"rcf7-featured__header-meta"},(0,e.createElement)("h3",null,t),(0,e.createElement)("p",null,i)),o&&(0,e.createElement)("span",{className:"rcf7-badge rcf7-badge--blue"},l)),(0,e.createElement)("div",{className:"rcf7-featured__body"},(0,e.createElement)("p",{className:"rcf7-featured__description"},n),(0,e.createElement)("ul",{className:"rcf7-featured__list"},a.map(((t,i)=>(0,e.createElement)("li",{key:i,className:"rcf7-featured__list-item"},(0,e.createElement)("span",null,t)))))),(0,e.createElement)("div",{className:"rcf7-featured__footer"},(0,e.createElement)("a",{href:r,target:"_blank",className:"rcf7-btn full-width"},(0,s.__)("Learn More","wpcf7-redirect")))),ha=({icon:t,title:i,isPremium:n,description:a,badgeLabel:o,learnMoreLink:r})=>(0,e.createElement)("div",{className:"rcf7-addon rcf7-card"},(0,e.createElement)("div",{className:"rcf7-addon__icon"},t),(0,e.createElement)("div",{className:"rcf7-addon__container"},(0,e.createElement)("div",{className:"rcf7-addon__header"},(0,e.createElement)("h3",null,i),n&&(0,e.createElement)("span",{className:"rcf7-badge rcf7-badge--blue"},o)),(0,e.createElement)("p",{className:"rcf7-addon__description"},a),r&&(0,e.createElement)("a",{className:"rcf7-addon__learn-more",href:r,target:"_blank"},(0,s.__)("Learn more","wpcf7-redirect")))),da=({benefit:t})=>(0,e.createElement)("div",{className:"rcf7-card"},(0,e.createElement)("div",{className:"rcf7-benefit"},(0,e.createElement)(E,{icon:t.icon,classes:t.iconClass}),(0,e.createElement)("h3",{className:"rcf7-benefit__title"},t.title),(0,e.createElement)("p",{className:"rcf7-benefit__description"},t.description))),ua=({title:t=(0,s.__)("Ready to Enhance Your Forms?","wpcf7-redirect"),description:i=(0,s.__)("Unlock all premium features and take your Contact Form 7 to the next level with our powerful add-ons.","wpcf7-redirect"),buttonLabel:n=(0,s.__)("Get Premium Now","wpcf7-redirect"),buttonHref:a="#"})=>(0,e.createElement)("div",{className:"rcf7-cta"},(0,e.createElement)("h2",{className:"rcf7-cta__title"},t),(0,e.createElement)("p",{className:"rcf7-cta__description"},i),(0,e.createElement)("a",{href:a,target:"_blank",className:"rcf7-btn rcf7-btn--blue"},n)),fa=()=>{const t=l(),i=25,n=[{id:"webhook-integration",title:(0,s.__)("Webhook Integration","wpcf7-redirect"),description:(0,s.__)("Connect to any external service","wpcf7-redirect"),details:(0,s.__)("Send form data to any external service or API using webhooks. Perfect for integrating with custom systems or third-party services.","wpcf7-redirect"),features:[(0,s.__)("POST, GET, PUT, DELETE methods","wpcf7-redirect"),(0,s.__)("Custom headers and authentication","wpcf7-redirect"),(0,s.__)("Dynamic data mapping from form fields","wpcf7-redirect"),(0,s.__)("Webhook testing and validation","wpcf7-redirect")],isPremium:!0,badgeLabel:(0,s.__)("Available in the Business plan","wpcf7-redirect"),learnMoreLink:t.links.addonDocs["using-contact-form-7-to-api-pardot-integration"]},{id:"conditional-logic",title:(0,s.__)("Conditional Logic","wpcf7-redirect"),description:(0,s.__)("Dynamic post-submission actions","wpcf7-redirect"),details:(0,s.__)("Create powerful conditional flows based on form inputs. Redirect users to different pages, send different emails, or trigger specific actions based on what they submit.","wpcf7-redirect"),features:[(0,s.__)("Multiple conditions with AND/OR logic","wpcf7-redirect"),(0,s.__)("Compare form field values with operators","wpcf7-redirect"),(0,s.__)("Conditionally enable/disable any action","wpcf7-redirect"),(0,s.__)("Nested conditions for complex scenarios","wpcf7-redirect")],isPremium:!0,badgeLabel:(0,s.__)("Available in the Starter plan","wpcf7-redirect"),learnMoreLink:t.links.addonDocs["using-conditional-logic-redirect-for-contact-form-7"]}],a=[{id:"popup",title:(0,s.__)("Thank You Popup","wpcf7-redirect"),description:(0,s.__)("Display a customizable Thank You popup after each submission.","wpcf7-redirect"),isPremium:!0,icon:(0,e.createElement)(Gn,{size:i}),badgeLabel:(0,s.__)("Available in the Starter plan","wpcf7-redirect"),learnMoreLink:t.links.addonDocs["using-contact-form-7-thank-you-popup"]},{id:"pdf-generation",title:(0,s.__)("PDF Generation","wpcf7-redirect"),description:(0,s.__)("Create branded PDF documents, receipts, and certificates from submissions.","wpcf7-redirect"),isPremium:!0,icon:(0,e.createElement)(Qn,{size:i}),badgeLabel:(0,s.__)("Available in the Starter plan","wpcf7-redirect"),learnMoreLink:t.links.addonDocs["how-to-create-pdf-from-form-submissions"]},{id:"conditional-logic",title:(0,s.__)("Conditional Logic","wpcf7-redirect"),description:(0,s.__)("Create intelligent workflows with if/then rules based on user input.","wpcf7-redirect"),isPremium:!0,icon:(0,e.createElement)(Jn,{size:i}),badgeLabel:(0,s.__)("Available in the Business plan","wpcf7-redirect"),learnMoreLink:t.links.addonDocs["using-conditional-logic-redirect-for-contact-form-7"]},{id:"firescript",title:(0,s.__)("Fire JavaScript code","wpcf7-redirect"),description:(0,s.__)("Run custom JavaScript code on form submission.","wpcf7-redirect"),isPremium:!0,icon:(0,e.createElement)(ta,{size:i}),badgeLabel:(0,s.__)("Available in the Starter plan","wpcf7-redirect")},{id:"create-wordpress-posts",title:(0,s.__)("Create WordPress Posts","wpcf7-redirect"),description:(0,s.__)("Turn form submissions into custom post types with full field mapping.","wpcf7-redirect"),isPremium:!0,icon:(0,e.createElement)(ea,{size:i}),badgeLabel:(0,s.__)("Available in the Starter plan","wpcf7-redirect"),learnMoreLink:t.links.addonDocs["how-to-create-posts-from-contact-form-submissions"]},{id:"webhook-integration",title:(0,s.__)("Webhook Integration","wpcf7-redirect"),description:(0,s.__)("Trigger automations from Contact Form 7 to Zapier, Make, and more using simple webhooks.","wpcf7-redirect"),isPremium:!0,icon:(0,e.createElement)(ia,{size:i}),badgeLabel:(0,s.__)("Available in the Business plan","wpcf7-redirect"),learnMoreLink:t.links.addonDocs["using-contact-form-7-to-api-pardot-integration"]},{id:"mailchimp-integration",title:(0,s.__)("Mailchimp Integration","wpcf7-redirect"),description:(0,s.__)("Grow your email list by syncing form submissions directly to Mailchimp.","wpcf7-redirect"),isPremium:!0,icon:(0,e.createElement)(w,{size:i}),badgeLabel:(0,s.__)("Available in the Business plan","wpcf7-redirect"),learnMoreLink:t.links.addonDocs["using-contact-form-7-to-mailchimp-integration"]},{id:"paypal-integration",title:(0,s.__)("PayPal Integration","wpcf7-redirect"),description:(0,s.__)("Accept secure payments and donations directly through your forms.","wpcf7-redirect"),isPremium:!0,icon:(0,e.createElement)(sa,{size:i}),badgeLabel:(0,s.__)("Available in the Business plan","wpcf7-redirect")},{id:"stripe-integration",title:(0,s.__)("Stripe Integration","wpcf7-redirect"),description:(0,s.__)("Process credit card payments seamlessly with complete checkout flow.","wpcf7-redirect"),isPremium:!0,icon:(0,e.createElement)(sa,{size:i}),badgeLabel:(0,s.__)("Available in the Business plan","wpcf7-redirect")},{id:"salesforce-integration",title:(0,s.__)("Salesforce Integration","wpcf7-redirect"),description:(0,s.__)("Create leads, contacts, and custom objects in Salesforce automatically.","wpcf7-redirect"),isPremium:!0,icon:(0,e.createElement)(na,{size:i}),badgeLabel:(0,s.__)("Available in the Enterprise plan","wpcf7-redirect"),learnMoreLink:t.links.addonDocs["using-salesforce-integration-integrate-contact-form-7-to-salesforces"]},{id:"hubspot-integration",title:(0,s.__)("HubSpot Integration","wpcf7-redirect"),description:(0,s.__)("Sync contacts, deals, and custom properties with your HubSpot CRM.","wpcf7-redirect"),isPremium:!0,icon:(0,e.createElement)(aa,{size:i}),badgeLabel:(0,s.__)("Available in the Enterprise plan","wpcf7-redirect"),learnMoreLink:t.links.addonDocs["hubspot-integration"]},{id:"twilio-sms",title:(0,s.__)("Twilio SMS Notifications","wpcf7-redirect"),description:(0,s.__)("Send instant text notifications to admins or users when forms are submitted.","wpcf7-redirect"),isPremium:!0,icon:(0,e.createElement)(oa,{size:i}),badgeLabel:(0,s.__)("Available in the Enterprise plan","wpcf7-redirect"),learnMoreLink:t.links.addonDocs["using-twilio-addon-integrate-twilio-addon-to-send-sms-with-contact-form"]}],o=[{title:(0,s.__)("Enhanced Functionality","wpcf7-redirect"),description:(0,s.__)("Transform Contact Form 7 into a powerful lead generation and business automation tool with integrations to your favorite services.","wpcf7-redirect"),icon:(0,e.createElement)(qn,null),iconClass:"variation-1"},{title:(0,s.__)("Priority Support","wpcf7-redirect"),description:(0,s.__)("Get fast, professional support from our team of experts who can help you implement even the most complex form workflows.","wpcf7-redirect"),icon:(0,e.createElement)(ra,null),iconClass:"variation-2"},{title:(0,s.__)("Better Conversions","wpcf7-redirect"),description:(0,s.__)("Create seamless user experiences that guide visitors through your sales funnel with conditional logic and integrations.","wpcf7-redirect"),icon:(0,e.createElement)(la,null),iconClass:"variation-3"}];return(0,e.createElement)("div",{className:"rcf7-addons-tab"},(0,e.createElement)("div",null,(0,e.createElement)("h2",{className:"rcf7-addon-section__title"},(0,s.__)("Premium Features & Add-ons","wpcf7-redirect")),(0,e.createElement)("p",{className:"rcf7-addon-section__subtitle"},(0,s.__)("Extend your forms with our premium features to collect leads, accept payments, and integrate with external services.","wpcf7-redirect"))),(0,e.createElement)("div",{className:"rcf7-addon-section__spacing"},(0,e.createElement)("div",{className:"rcf7-featured-addons-grid"},n.map((t=>(0,e.createElement)(ca,{key:t.id,...t}))))),(0,e.createElement)("div",{className:"rcf7-addon-section__divider"}),(0,e.createElement)("div",{className:"rcf7-addon-section__spacing"},(0,e.createElement)("h2",{className:"rcf7-addon-section__title"},(0,s.__)("All Premium Add-ons","wpcf7-redirect")),(0,e.createElement)("div",{className:"rcf7-addons"},a.map((t=>(0,e.createElement)(ha,{key:t.id,...t}))))),(0,e.createElement)("div",{className:"rcf7-addon-section__divider"}),(0,e.createElement)("div",{className:"rcf7-addon-section__spacing"},(0,e.createElement)("h2",{className:"rcf7-addon-section__title"},(0,s.__)("Why Upgrade to Premium?","wpcf7-redirect")),(0,e.createElement)("div",{className:"rcf7-benefits-grid"},o.map(((t,i)=>(0,e.createElement)(da,{key:i,benefit:t}))))),(0,e.createElement)("div",{className:"rcf7-card"},(0,e.createElement)(ua,{buttonHref:t.links.upgrade})))},ga=({status:t,message:i})=>(0,e.createElement)("div",{className:p("rcf7-badge",{"rcf7-badge--green":"valid"===t,"rcf7-badge--red":"valid"!==t&&"inactive"!==t,"rcf7-badge--gray":"inactive"===t})},i),pa=({status:t})=>(0,e.createElement)("div",{className:p("rcf7-status-dot",{"rcf7-dot-success":"valid"===t,"rcf7-dot-danger":"valid"!==t&&"inactive"!==t,"rcf7-dot-warning":"inactive"===t})}),ma=({slug:t,label:n,status:o,description:r,statusLabel:l,inputPlaceholder:c,endpointURL:h})=>{const[d,u]=(0,i.useState)(!1),[f,g]=(0,i.useState)(""),[m,b]=(0,i.useState)(""),[_,x]=(0,i.useState)(!1),[y,v]=(0,i.useState)({status:o,statusLabel:l,inputPlaceholder:c}),w=(0,i.useCallback)((t=>{const e=new AbortController,i=setTimeout((()=>e.abort()),8e3);a()({path:h,data:t,method:"POST",signal:e.signal}).then((t=>{clearTimeout(i),t.success?(v({status:t.data?.status,statusLabel:t.data?.statusLabel,inputPlaceholder:t.data?.licenseMask}),b("")):(v({status:t.data?.status,statusLabel:t.data?.statusLabel}),t.data.message&&b(t.data?.message)),x(!1)})).catch((t=>{b(t.message||(0,s.__)("An error occurred while updating the license","wpcf7-redirect")),x(!1)}))}),[h]);return(0,e.createElement)("div",{className:"rcf7-license-config rcf7-card"},(0,e.createElement)("div",{className:"rcf7-license-config__header"},(0,e.createElement)("h4",null,n),(0,e.createElement)(pa,{status:y.status})),(0,e.createElement)("div",{className:"rcf7-license-config__body"},(0,e.createElement)("p",{className:"rcf7-license-config__description"},r),(0,e.createElement)("div",{className:"rcf7-license-config__actions"},(0,e.createElement)("button",{onClick:()=>u(!d),className:p("rcf7-btn rcf7-btn--compact",{disabled:"inactive"===o}),disabled:"inactive"===o},(0,s.__)("Configure","wpcf7-redirect")),(0,e.createElement)(ga,{status:y.status,message:y.statusLabel})),d&&(0,e.createElement)("div",{className:"rcf7-license-config__fields"},(0,e.createElement)("div",{className:"rcf7-license-field"},(0,e.createElement)("input",{type:"text",id:"license-key",placeholder:y.inputPlaceholder||(0,s.__)("Enter your license key","wpcf7-redirect"),value:f,onChange:t=>{g(t.currentTarget.value)},className:"rcf7-license-input",disabled:_||"valid"===y.status}),(0,e.createElement)("button",{onClick:()=>{x(!0),w({slug:t,key:f,action:"valid"===y.status?"deactivate":"activate"})},className:p("rcf7-btn","compact","valid"===y.status?"rcf7-btn--red":"rcf7-btn--purple"),disabled:_},_?(0,e.createElement)(Vn,null):"valid"===y.status?(0,s.__)("Deactivate","wpcf7-redirect"):(0,s.__)("Save","wpcf7-redirect")))),m&&(0,e.createElement)("p",{className:"rcf7-license-config__error"},m)))},ba=()=>{const t=l();return(0,e.createElement)("div",{className:"rcf7-licenses-tab"},t.plugins.map(((i,s)=>(0,e.createElement)(ma,{key:s,slug:i.slug,label:i.label,status:i.status,description:i.description,statusLabel:i.statusLabel,inputPlaceholder:i.licenseMask,endpointURL:t.endpoints.updateLicense}))))},_a=({isOpen:t,title:s,children:n,onConfirm:a,onClose:o,confirmText:r="Confirm",cancelText:l="Cancel",showFooter:c=!0})=>{const h=(0,i.useRef)(null);return(0,i.useEffect)((()=>{const e=t=>{h.current&&!h.current.contains(t.target)&&o()},i=t=>{"Escape"===t.key&&o()};return t&&(document.addEventListener("mousedown",e),document.addEventListener("keydown",i),document.body.style.overflow="hidden"),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",i),document.body.style.overflow="auto"}}),[t,o]),t?(0,e.createElement)("div",{className:"rcf7-modal__overlay"},(0,e.createElement)("div",{className:"rcf7-modal__container",ref:h},(0,e.createElement)("div",{className:"rcf7-modal__header"},(0,e.createElement)("h3",null,s)),(0,e.createElement)("div",{className:"rcf7-modal__content"},n),c&&(0,e.createElement)("div",{className:"rcf7-modal__footer"},(0,e.createElement)("button",{className:"rcf7-btn rcf7-btn--red",onClick:o},l),(0,e.createElement)("button",{className:"rcf7-btn rcf7-btn--blue",onClick:a},r)))):null},xa=document.getElementById("redirect-dashboard");(0,i.createRoot)(xa).render((0,e.createElement)((function({children:t}){var s;const[n,a]=(0,i.useReducer)(f,{...null!==(s=window?.wpcf7rDash)&&void 0!==s?s:{},isResetModalOpen:!1,isUpdatingOptions:!1});return(0,e.createElement)(o.Provider,{value:n},(0,e.createElement)(r.Provider,{value:a},t))}),null,(0,e.createElement)((()=>{const t=l(),n=c(),[o,r]=(0,i.useState)("settings"),h=t.plugins.some((t=>t.installed));(0,i.useEffect)((()=>{const t=window.location.hash;if(!t)return;const e=t.substring(1);"settings"!==e&&"addons"!==e&&"licenses"!==e||r(e),window.tsdk_reposition_notice&&window.tsdk_reposition_notice()}),[]),(0,i.useEffect)((()=>{window.location.hash=o}),[o]);const f=(0,i.useCallback)((()=>{const e=new AbortController,i=setTimeout((()=>e.abort()),5e3);a()({path:t.endpoints.resetSettings,method:"POST",data:{}}).then((t=>{clearTimeout(i),n({type:u,isLoading:!1}),window.location.reload()})).catch((t=>{clearTimeout(i),console.error(t.message),n({type:u,isLoading:!1})}))}),[t]),g=[{slug:"settings",label:(0,s.__)("Settings","wpcf7-redirect"),isVisible:!0},{slug:"licenses",label:(0,s.__)("Licenses","wpcf7-redirect"),isVisible:h},{slug:"addons",label:(0,s.__)("Premium Features","wpcf7-redirect"),isVisible:!0}];return(0,e.createElement)("div",{className:"rcf7-dashboard"},(0,e.createElement)("h1",null,(0,e.createElement)("img",{src:window.wpcf7rDash.assets.logo}),(0,s.__)("Redirection for Contact Form 7","wpcf7-redirect")),(0,e.createElement)("div",{className:"rcf7-dashboard__content"},(0,e.createElement)("div",{className:"rcf7-dashboard__tabs"},g.map((t=>t.isVisible&&(0,e.createElement)("button",{key:t.slug,className:"rcf7-dashboard__tab "+(o===t.slug?"is-active":""),onClick:()=>r(t.slug)},t.label)))),(0,e.createElement)("div",{id:"tsdk_banner"}),(0,e.createElement)("div",{className:"rcf7-dashboard__tab-content"},"settings"===o&&(0,e.createElement)(Zn,null),"licenses"===o&&(0,e.createElement)(ba,null),"addons"===o&&(0,e.createElement)(fa,null))),(0,e.createElement)(_a,{isOpen:t.isResetModalOpen,title:(0,s.__)("Reset Settings","wpcf7-redirect"),onClose:()=>n({type:d}),onConfirm:()=>{n({type:u,isLoading:!0}),n({type:d}),f()}},(0,e.createElement)("p",null,(0,s.__)("You are about to reset all Redirection for Contact Form 7 settings. ","wpcf7-redirect"))))}),null)))})();
Save File
Cancel