web_plsql 0.18.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -4
- package/package.json +15 -5
- package/src/admin/client/charts.ts +299 -0
- package/src/admin/client/main.js +3 -0
- package/src/admin/client/tailwind.css +41 -0
- package/src/admin/favicon.svg +3 -0
- package/src/admin/index.html +315 -0
- package/src/admin/js/api.ts +95 -0
- package/src/admin/js/app.ts +306 -0
- package/src/admin/js/eslint.config.js +74 -0
- package/src/admin/js/schemas.ts +153 -0
- package/src/admin/js/templates/config.ts +146 -0
- package/src/admin/js/templates/errorRow.ts +18 -0
- package/src/admin/js/templates/index.ts +3 -0
- package/src/admin/js/templates/poolCard.ts +61 -0
- package/src/admin/js/tsconfig.json +24 -0
- package/src/admin/js/types.ts +223 -0
- package/src/admin/js/ui/theme.ts +93 -0
- package/src/admin/js/ui/views.ts +164 -0
- package/src/admin/js/util/format.ts +27 -0
- package/src/admin/lib/assets/main-zpdhQ1gD.css +1 -0
- package/src/admin/lib/chart.bundle.js +139 -0
- package/src/admin/style.css +1321 -0
- package/src/bin/load-test.js +202 -0
- package/src/handler/handlerAdmin.js +198 -0
- package/src/handler/plsql/cgi.js +1 -1
- package/src/handler/plsql/errorPage.js +35 -6
- package/src/handler/plsql/handlerPlSql.js +32 -6
- package/src/handler/plsql/parsePage.js +7 -3
- package/src/handler/plsql/procedure.js +57 -11
- package/src/handler/plsql/procedureNamed.js +18 -47
- package/src/handler/plsql/procedureSanitize.js +96 -45
- package/src/handler/plsql/procedureVariable.js +2 -2
- package/src/handler/plsql/request.js +8 -3
- package/src/handler/plsql/sendResponse.js +2 -2
- package/src/server/config.js +1 -0
- package/src/server/server.js +108 -2
- package/src/types.js +6 -0
- package/src/util/cache.js +123 -0
- package/src/util/jsonLogger.js +47 -0
- package/src/util/shutdown.js +6 -2
- package/src/util/trace.js +5 -5
- package/src/version.js +1 -1
- package/types/handler/handlerAdmin.d.ts +9 -0
- package/types/handler/plsql/errorPage.d.ts +1 -0
- package/types/handler/plsql/handlerPlSql.d.ts +6 -1
- package/types/handler/plsql/procedure.d.ts +3 -1
- package/types/handler/plsql/procedureNamed.d.ts +2 -5
- package/types/handler/plsql/procedureSanitize.d.ts +2 -5
- package/types/handler/plsql/procedureVariable.d.ts +1 -1
- package/types/handler/plsql/request.d.ts +3 -1
- package/types/handler/plsql/sendResponse.d.ts +1 -1
- package/types/server/server.d.ts +22 -0
- package/types/types.d.ts +18 -0
- package/types/util/cache.d.ts +69 -0
- package/types/util/jsonLogger.d.ts +45 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
function v(e,t,n){function i(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:r,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);const l=r.prototype,h=Object.keys(l);for(let u=0;u<h.length;u++){const d=h[u];d in a||(a[d]=l[d].bind(a))}}const s=n?.Parent??Object;class o extends s{}Object.defineProperty(o,"name",{value:e});function r(a){var c;const l=n?.Parent?new o:this;i(l,a),(c=l._zod).deferred??(c.deferred=[]);for(const h of l._zod.deferred)h();return l}return Object.defineProperty(r,"init",{value:i}),Object.defineProperty(r,Symbol.hasInstance,{value:a=>n?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(r,"name",{value:e}),r}class de extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Wo extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Ho={};function te(e){return Ho}function Uo(e){const t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,s])=>t.indexOf(+i)===-1).map(([i,s])=>s)}function ei(e,t){return typeof t=="bigint"?t.toString():t}function mi(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function bi(e){return e==null}function _i(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Oa(e,t){const n=(e.toString().split(".")[1]||"").length,i=t.toString();let s=(i.split(".")[1]||"").length;if(s===0&&/\d?e-\d?/.test(i)){const c=i.match(/\d?e-(\d?)/);c?.[1]&&(s=Number.parseInt(c[1]))}const o=n>s?n:s,r=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return r%a/10**o}const Vi=Symbol("evaluating");function F(e,t,n){let i;Object.defineProperty(e,t,{get(){if(i!==Vi)return i===void 0&&(i=Vi,i=n()),i},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}function se(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Bt(...e){const t={};for(const n of e){const i=Object.getOwnPropertyDescriptors(n);Object.assign(t,i)}return Object.defineProperties({},t)}function Zi(e){return JSON.stringify(e)}function za(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Yo="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function fn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Ta=mi(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Ie(e){if(fn(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(fn(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function qo(e){return Ie(e)?{...e}:Array.isArray(e)?[...e]:e}const Aa=new Set(["string","number","symbol"]);function Pn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function jt(e,t,n){const i=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(i._zod.parent=e),i}function C(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Da(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Ea={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Ia(e,t){const n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const o=Bt(e._zod.def,{get shape(){const r={};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(r[a]=n.shape[a])}return se(this,"shape",r),r},checks:[]});return jt(e,o)}function Ra(e,t){const n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const o=Bt(e._zod.def,{get shape(){const r={...e._zod.def.shape};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete r[a]}return se(this,"shape",r),r},checks:[]});return jt(e,o)}function La(e,t){if(!Ie(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const o=e._zod.def.shape;for(const r in t)if(Object.getOwnPropertyDescriptor(o,r)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const s=Bt(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t};return se(this,"shape",o),o}});return jt(e,s)}function $a(e,t){if(!Ie(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Bt(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return se(this,"shape",i),i}});return jt(e,n)}function Fa(e,t){const n=Bt(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t._zod.def.shape};return se(this,"shape",i),i},get catchall(){return t._zod.def.catchall},checks:[]});return jt(e,n)}function Na(e,t,n){const s=t._zod.def.checks;if(s&&s.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const r=Bt(t._zod.def,{get shape(){const a=t._zod.def.shape,c={...a};if(n)for(const l in n){if(!(l in a))throw new Error(`Unrecognized key: "${l}"`);n[l]&&(c[l]=e?new e({type:"optional",innerType:a[l]}):a[l])}else for(const l in a)c[l]=e?new e({type:"optional",innerType:a[l]}):a[l];return se(this,"shape",c),c},checks:[]});return jt(t,r)}function Ba(e,t,n){const i=Bt(t._zod.def,{get shape(){const s=t._zod.def.shape,o={...s};if(n)for(const r in n){if(!(r in o))throw new Error(`Unrecognized key: "${r}"`);n[r]&&(o[r]=new e({type:"nonoptional",innerType:s[r]}))}else for(const r in s)o[r]=new e({type:"nonoptional",innerType:s[r]});return se(this,"shape",o),o}});return jt(t,i)}function ue(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Xo(e,t){return t.map(n=>{var i;return(i=n).path??(i.path=[]),n.path.unshift(e),n})}function Ue(e){return typeof e=="string"?e:e?.message}function ee(e,t,n){const i={...e,path:e.path??[]};if(!e.message){const s=Ue(e.inst?._zod.def?.error?.(e))??Ue(t?.error?.(e))??Ue(n.customError?.(e))??Ue(n.localeError?.(e))??"Invalid input";i.message=s}return delete i.inst,delete i.continue,t?.reportInput||delete i.input,i}function yi(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Re(...e){const[t,n,i]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:i}:{...t}}const Jo=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ei,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ko=v("$ZodError",Jo),Go=v("$ZodError",Jo,{Parent:Error});function ja(e,t=n=>n.message){const n={},i=[];for(const s of e.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(t(s))):i.push(t(s));return{formErrors:i,fieldErrors:n}}function Va(e,t=n=>n.message){const n={_errors:[]},i=s=>{for(const o of s.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(r=>i({issues:r}));else if(o.code==="invalid_key")i({issues:o.issues});else if(o.code==="invalid_element")i({issues:o.issues});else if(o.path.length===0)n._errors.push(t(o));else{let r=n,a=0;for(;a<o.path.length;){const c=o.path[a];a===o.path.length-1?(r[c]=r[c]||{_errors:[]},r[c]._errors.push(t(o))):r[c]=r[c]||{_errors:[]},r=r[c],a++}}};return i(e),n}const xi=e=>(t,n,i,s)=>{const o=i?Object.assign(i,{async:!1}):{async:!1},r=t._zod.run({value:n,issues:[]},o);if(r instanceof Promise)throw new de;if(r.issues.length){const a=new(s?.Err??e)(r.issues.map(c=>ee(c,o,te())));throw Yo(a,s?.callee),a}return r.value},vi=e=>async(t,n,i,s)=>{const o=i?Object.assign(i,{async:!0}):{async:!0};let r=t._zod.run({value:n,issues:[]},o);if(r instanceof Promise&&(r=await r),r.issues.length){const a=new(s?.Err??e)(r.issues.map(c=>ee(c,o,te())));throw Yo(a,s?.callee),a}return r.value},Cn=e=>(t,n,i)=>{const s=i?{...i,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},s);if(o instanceof Promise)throw new de;return o.issues.length?{success:!1,error:new(e??Ko)(o.issues.map(r=>ee(r,s,te())))}:{success:!0,data:o.value}},Za=Cn(Go),On=e=>async(t,n,i)=>{const s=i?Object.assign(i,{async:!0}):{async:!0};let o=t._zod.run({value:n,issues:[]},s);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(r=>ee(r,s,te())))}:{success:!0,data:o.value}},Wa=On(Go),Ha=e=>(t,n,i)=>{const s=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return xi(e)(t,n,s)},Ua=e=>(t,n,i)=>xi(e)(t,n,i),Ya=e=>async(t,n,i)=>{const s=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return vi(e)(t,n,s)},qa=e=>async(t,n,i)=>vi(e)(t,n,i),Xa=e=>(t,n,i)=>{const s=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Cn(e)(t,n,s)},Ja=e=>(t,n,i)=>Cn(e)(t,n,i),Ka=e=>async(t,n,i)=>{const s=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return On(e)(t,n,s)},Ga=e=>async(t,n,i)=>On(e)(t,n,i),Qa=/^[cC][^\s-]{8,}$/,tc=/^[0-9a-z]+$/,ec=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,nc=/^[0-9a-vA-V]{20}$/,ic=/^[A-Za-z0-9]{27}$/,sc=/^[a-zA-Z0-9_-]{21}$/,oc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,rc=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Wi=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,ac=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,cc="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function lc(){return new RegExp(cc,"u")}const hc=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,uc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,dc=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,fc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,pc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Qo=/^[A-Za-z0-9_-]*$/,gc=/^\+[1-9]\d{6,14}$/,tr="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",mc=new RegExp(`^${tr}$`);function er(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function bc(e){return new RegExp(`^${er(e)}$`)}function _c(e){const t=er({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const i=`${t}(?:${n.join("|")})`;return new RegExp(`^${tr}T(?:${i})$`)}const yc=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},xc=/^-?\d+$/,vc=/^-?\d+(?:\.\d+)?$/,wc=/^[^A-Z]*$/,kc=/^[^a-z]*$/,ft=v("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),nr={number:"number",bigint:"bigint",object:"date"},ir=v("$ZodCheckLessThan",(e,t)=>{ft.init(e,t);const n=nr[typeof t.value];e._zod.onattach.push(i=>{const s=i._zod.bag,o=(t.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?s.maximum=t.value:s.exclusiveMaximum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value<=t.value:i.value<t.value)||i.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),sr=v("$ZodCheckGreaterThan",(e,t)=>{ft.init(e,t);const n=nr[typeof t.value];e._zod.onattach.push(i=>{const s=i._zod.bag,o=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?s.minimum=t.value:s.exclusiveMinimum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Sc=v("$ZodCheckMultipleOf",(e,t)=>{ft.init(e,t),e._zod.onattach.push(n=>{var i;(i=n._zod.bag).multipleOf??(i.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):Oa(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Mc=v("$ZodCheckNumberFormat",(e,t)=>{ft.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),i=n?"int":"number",[s,o]=Ea[t.format];e._zod.onattach.push(r=>{const a=r._zod.bag;a.format=t.format,a.minimum=s,a.maximum=o,n&&(a.pattern=xc)}),e._zod.check=r=>{const a=r.value;if(n){if(!Number.isInteger(a)){r.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?r.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort}):r.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort});return}}a<s&&r.issues.push({origin:"number",input:a,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),a>o&&r.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),Pc=v("$ZodCheckMaxLength",(e,t)=>{var n;ft.init(e,t),(n=e._zod.def).when??(n.when=i=>{const s=i.value;return!bi(s)&&s.length!==void 0}),e._zod.onattach.push(i=>{const s=i._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<s&&(i._zod.bag.maximum=t.maximum)}),e._zod.check=i=>{const s=i.value;if(s.length<=t.maximum)return;const r=yi(s);i.issues.push({origin:r,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Cc=v("$ZodCheckMinLength",(e,t)=>{var n;ft.init(e,t),(n=e._zod.def).when??(n.when=i=>{const s=i.value;return!bi(s)&&s.length!==void 0}),e._zod.onattach.push(i=>{const s=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(i._zod.bag.minimum=t.minimum)}),e._zod.check=i=>{const s=i.value;if(s.length>=t.minimum)return;const r=yi(s);i.issues.push({origin:r,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Oc=v("$ZodCheckLengthEquals",(e,t)=>{var n;ft.init(e,t),(n=e._zod.def).when??(n.when=i=>{const s=i.value;return!bi(s)&&s.length!==void 0}),e._zod.onattach.push(i=>{const s=i._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=i=>{const s=i.value,o=s.length;if(o===t.length)return;const r=yi(s),a=o>t.length;i.issues.push({origin:r,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),zn=v("$ZodCheckStringFormat",(e,t)=>{var n,i;ft.init(e,t),e._zod.onattach.push(s=>{const o=s._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),zc=v("$ZodCheckRegex",(e,t)=>{zn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Tc=v("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=wc),zn.init(e,t)}),Ac=v("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=kc),zn.init(e,t)}),Dc=v("$ZodCheckIncludes",(e,t)=>{ft.init(e,t);const n=Pn(t.includes),i=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=i,e._zod.onattach.push(s=>{const o=s._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(i)}),e._zod.check=s=>{s.value.includes(t.includes,t.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),Ec=v("$ZodCheckStartsWith",(e,t)=>{ft.init(e,t);const n=new RegExp(`^${Pn(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(i=>{const s=i._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=i=>{i.value.startsWith(t.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:i.value,inst:e,continue:!t.abort})}}),Ic=v("$ZodCheckEndsWith",(e,t)=>{ft.init(e,t);const n=new RegExp(`.*${Pn(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(i=>{const s=i._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=i=>{i.value.endsWith(t.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:i.value,inst:e,continue:!t.abort})}}),Rc=v("$ZodCheckOverwrite",(e,t)=>{ft.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Lc{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const i=t.split(`
|
|
2
|
+
`).filter(r=>r),s=Math.min(...i.map(r=>r.length-r.trimStart().length)),o=i.map(r=>r.slice(s)).map(r=>" ".repeat(this.indent*2)+r);for(const r of o)this.content.push(r)}compile(){const t=Function,n=this?.args,s=[...(this?.content??[""]).map(o=>` ${o}`)];return new t(...n,s.join(`
|
|
3
|
+
`))}}const $c={major:4,minor:3,patch:6},K=v("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=$c;const i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(const s of i)for(const o of s._zod.onattach)o(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const s=(r,a,c)=>{let l=ue(r),h;for(const u of a){if(u._zod.def.when){if(!u._zod.def.when(r))continue}else if(l)continue;const d=r.issues.length,f=u._zod.check(r);if(f instanceof Promise&&c?.async===!1)throw new de;if(h||f instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await f,r.issues.length!==d&&(l||(l=ue(r,d)))});else{if(r.issues.length===d)continue;l||(l=ue(r,d))}}return h?h.then(()=>r):r},o=(r,a,c)=>{if(ue(r))return r.aborted=!0,r;const l=s(a,i,c);if(l instanceof Promise){if(c.async===!1)throw new de;return l.then(h=>e._zod.parse(h,c))}return e._zod.parse(l,c)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction==="backward"){const l=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return l instanceof Promise?l.then(h=>o(h,r,a)):o(l,r,a)}const c=e._zod.parse(r,a);if(c instanceof Promise){if(a.async===!1)throw new de;return c.then(l=>s(l,i,a))}return s(c,i,a)}}F(e,"~standard",()=>({validate:s=>{try{const o=Za(e,s);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return Wa(e,s).then(r=>r.success?{value:r.data}:{issues:r.error?.issues})}},vendor:"zod",version:1}))}),wi=v("$ZodString",(e,t)=>{K.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??yc(e._zod.bag),e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),H=v("$ZodStringFormat",(e,t)=>{zn.init(e,t),wi.init(e,t)}),Fc=v("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=rc),H.init(e,t)}),Nc=v("$ZodUUID",(e,t)=>{if(t.version){const i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(i===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Wi(i))}else t.pattern??(t.pattern=Wi());H.init(e,t)}),Bc=v("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ac),H.init(e,t)}),jc=v("$ZodURL",(e,t)=>{H.init(e,t),e._zod.check=n=>{try{const i=n.value.trim(),s=new URL(i);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=s.href:n.value=i;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Vc=v("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=lc()),H.init(e,t)}),Zc=v("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=sc),H.init(e,t)}),Wc=v("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Qa),H.init(e,t)}),Hc=v("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=tc),H.init(e,t)}),Uc=v("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ec),H.init(e,t)}),Yc=v("$ZodXID",(e,t)=>{t.pattern??(t.pattern=nc),H.init(e,t)}),qc=v("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ic),H.init(e,t)}),Xc=v("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=_c(t)),H.init(e,t)}),Jc=v("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=mc),H.init(e,t)}),Kc=v("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=bc(t)),H.init(e,t)}),Gc=v("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=oc),H.init(e,t)}),Qc=v("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=hc),H.init(e,t),e._zod.bag.format="ipv4"}),tl=v("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=uc),H.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),el=v("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=dc),H.init(e,t)}),nl=v("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=fc),H.init(e,t),e._zod.check=n=>{const i=n.value.split("/");try{if(i.length!==2)throw new Error;const[s,o]=i;if(!o)throw new Error;const r=Number(o);if(`${r}`!==o)throw new Error;if(r<0||r>128)throw new Error;new URL(`http://[${s}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function or(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const il=v("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=pc),H.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{or(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function sl(e){if(!Qo.test(e))return!1;const t=e.replace(/[-_]/g,i=>i==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return or(n)}const ol=v("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Qo),H.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{sl(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),rl=v("$ZodE164",(e,t)=>{t.pattern??(t.pattern=gc),H.init(e,t)});function al(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[i]=n;if(!i)return!1;const s=JSON.parse(atob(i));return!("typ"in s&&s?.typ!=="JWT"||!s.alg||t&&(!("alg"in s)||s.alg!==t))}catch{return!1}}const cl=v("$ZodJWT",(e,t)=>{H.init(e,t),e._zod.check=n=>{al(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),rr=v("$ZodNumber",(e,t)=>{K.init(e,t),e._zod.pattern=e._zod.bag.pattern??vc,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const s=n.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return n;const o=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...o?{received:o}:{}}),n}}),ll=v("$ZodNumberFormat",(e,t)=>{Mc.init(e,t),rr.init(e,t)}),hl=v("$ZodUnknown",(e,t)=>{K.init(e,t),e._zod.parse=n=>n}),ul=v("$ZodNever",(e,t)=>{K.init(e,t),e._zod.parse=(n,i)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Hi(e,t,n){e.issues.length&&t.issues.push(...Xo(n,e.issues)),t.value[n]=e.value}const dl=v("$ZodArray",(e,t)=>{K.init(e,t),e._zod.parse=(n,i)=>{const s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=Array(s.length);const o=[];for(let r=0;r<s.length;r++){const a=s[r],c=t.element._zod.run({value:a,issues:[]},i);c instanceof Promise?o.push(c.then(l=>Hi(l,n,r))):Hi(c,n,r)}return o.length?Promise.all(o).then(()=>n):n}});function pn(e,t,n,i,s){if(e.issues.length){if(s&&!(n in i))return;t.issues.push(...Xo(n,e.issues))}e.value===void 0?n in i&&(t.value[n]=void 0):t.value[n]=e.value}function ar(e){const t=Object.keys(e.shape);for(const i of t)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);const n=Da(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function cr(e,t,n,i,s,o){const r=[],a=s.keySet,c=s.catchall._zod,l=c.def.type,h=c.optout==="optional";for(const u in t){if(a.has(u))continue;if(l==="never"){r.push(u);continue}const d=c.run({value:t[u],issues:[]},i);d instanceof Promise?e.push(d.then(f=>pn(f,n,u,t,h))):pn(d,n,u,t,h)}return r.length&&n.issues.push({code:"unrecognized_keys",keys:r,input:t,inst:o}),e.length?Promise.all(e).then(()=>n):n}const fl=v("$ZodObject",(e,t)=>{if(K.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}const i=mi(()=>ar(t));F(e._zod,"propValues",()=>{const a=t.shape,c={};for(const l in a){const h=a[l]._zod;if(h.values){c[l]??(c[l]=new Set);for(const u of h.values)c[l].add(u)}}return c});const s=fn,o=t.catchall;let r;e._zod.parse=(a,c)=>{r??(r=i.value);const l=a.value;if(!s(l))return a.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),a;a.value={};const h=[],u=r.shape;for(const d of r.keys){const f=u[d],p=f._zod.optout==="optional",g=f._zod.run({value:l[d],issues:[]},c);g instanceof Promise?h.push(g.then(m=>pn(m,a,d,l,p))):pn(g,a,d,l,p)}return o?cr(h,l,a,c,i.value,e):h.length?Promise.all(h).then(()=>a):a}}),pl=v("$ZodObjectJIT",(e,t)=>{fl.init(e,t);const n=e._zod.parse,i=mi(()=>ar(t)),s=d=>{const f=new Lc(["shape","payload","ctx"]),p=i.value,g=w=>{const x=Zi(w);return`shape[${x}]._zod.run({ value: input[${x}], issues: [] }, ctx)`};f.write("const input = payload.value;");const m=Object.create(null);let b=0;for(const w of p.keys)m[w]=`key_${b++}`;f.write("const newResult = {};");for(const w of p.keys){const x=m[w],y=Zi(w),S=d[w]?._zod?.optout==="optional";f.write(`const ${x} = ${g(w)};`),S?f.write(`
|
|
4
|
+
if (${x}.issues.length) {
|
|
5
|
+
if (${y} in input) {
|
|
6
|
+
payload.issues = payload.issues.concat(${x}.issues.map(iss => ({
|
|
7
|
+
...iss,
|
|
8
|
+
path: iss.path ? [${y}, ...iss.path] : [${y}]
|
|
9
|
+
})));
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (${x}.value === undefined) {
|
|
14
|
+
if (${y} in input) {
|
|
15
|
+
newResult[${y}] = undefined;
|
|
16
|
+
}
|
|
17
|
+
} else {
|
|
18
|
+
newResult[${y}] = ${x}.value;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
`):f.write(`
|
|
22
|
+
if (${x}.issues.length) {
|
|
23
|
+
payload.issues = payload.issues.concat(${x}.issues.map(iss => ({
|
|
24
|
+
...iss,
|
|
25
|
+
path: iss.path ? [${y}, ...iss.path] : [${y}]
|
|
26
|
+
})));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (${x}.value === undefined) {
|
|
30
|
+
if (${y} in input) {
|
|
31
|
+
newResult[${y}] = undefined;
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
newResult[${y}] = ${x}.value;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
`)}f.write("payload.value = newResult;"),f.write("return payload;");const _=f.compile();return(w,x)=>_(d,w,x)};let o;const r=fn,a=!Ho.jitless,l=a&&Ta.value,h=t.catchall;let u;e._zod.parse=(d,f)=>{u??(u=i.value);const p=d.value;return r(p)?a&&l&&f?.async===!1&&f.jitless!==!0?(o||(o=s(t.shape)),d=o(d,f),h?cr([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),d)}});function Ui(e,t,n,i){for(const o of e)if(o.issues.length===0)return t.value=o.value,t;const s=e.filter(o=>!ue(o));return s.length===1?(t.value=s[0].value,s[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(o=>o.issues.map(r=>ee(r,i,te())))}),t)}const gl=v("$ZodUnion",(e,t)=>{K.init(e,t),F(e._zod,"optin",()=>t.options.some(s=>s._zod.optin==="optional")?"optional":void 0),F(e._zod,"optout",()=>t.options.some(s=>s._zod.optout==="optional")?"optional":void 0),F(e._zod,"values",()=>{if(t.options.every(s=>s._zod.values))return new Set(t.options.flatMap(s=>Array.from(s._zod.values)))}),F(e._zod,"pattern",()=>{if(t.options.every(s=>s._zod.pattern)){const s=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${s.map(o=>_i(o.source)).join("|")})$`)}});const n=t.options.length===1,i=t.options[0]._zod.run;e._zod.parse=(s,o)=>{if(n)return i(s,o);let r=!1;const a=[];for(const c of t.options){const l=c._zod.run({value:s.value,issues:[]},o);if(l instanceof Promise)a.push(l),r=!0;else{if(l.issues.length===0)return l;a.push(l)}}return r?Promise.all(a).then(c=>Ui(c,s,e,o)):Ui(a,s,e,o)}}),ml=v("$ZodIntersection",(e,t)=>{K.init(e,t),e._zod.parse=(n,i)=>{const s=n.value,o=t.left._zod.run({value:s,issues:[]},i),r=t.right._zod.run({value:s,issues:[]},i);return o instanceof Promise||r instanceof Promise?Promise.all([o,r]).then(([c,l])=>Yi(n,c,l)):Yi(n,o,r)}});function ni(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ie(e)&&Ie(t)){const n=Object.keys(t),i=Object.keys(e).filter(o=>n.indexOf(o)!==-1),s={...e,...t};for(const o of i){const r=ni(e[o],t[o]);if(!r.valid)return{valid:!1,mergeErrorPath:[o,...r.mergeErrorPath]};s[o]=r.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let i=0;i<e.length;i++){const s=e[i],o=t[i],r=ni(s,o);if(!r.valid)return{valid:!1,mergeErrorPath:[i,...r.mergeErrorPath]};n.push(r.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Yi(e,t,n){const i=new Map;let s;for(const a of t.issues)if(a.code==="unrecognized_keys"){s??(s=a);for(const c of a.keys)i.has(c)||i.set(c,{}),i.get(c).l=!0}else e.issues.push(a);for(const a of n.issues)if(a.code==="unrecognized_keys")for(const c of a.keys)i.has(c)||i.set(c,{}),i.get(c).r=!0;else e.issues.push(a);const o=[...i].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(o.length&&s&&e.issues.push({...s,keys:o}),ue(e))return e;const r=ni(t.value,n.value);if(!r.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}const bl=v("$ZodEnum",(e,t)=>{K.init(e,t);const n=Uo(t.entries),i=new Set(n);e._zod.values=i,e._zod.pattern=new RegExp(`^(${n.filter(s=>Aa.has(typeof s)).map(s=>typeof s=="string"?Pn(s):s.toString()).join("|")})$`),e._zod.parse=(s,o)=>{const r=s.value;return i.has(r)||s.issues.push({code:"invalid_value",values:n,input:r,inst:e}),s}}),_l=v("$ZodTransform",(e,t)=>{K.init(e,t),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new Wo(e.constructor.name);const s=t.transform(n.value,n);if(i.async)return(s instanceof Promise?s:Promise.resolve(s)).then(r=>(n.value=r,n));if(s instanceof Promise)throw new de;return n.value=s,n}});function qi(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const lr=v("$ZodOptional",(e,t)=>{K.init(e,t),e._zod.optin="optional",e._zod.optout="optional",F(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),F(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${_i(n.source)})?$`):void 0}),e._zod.parse=(n,i)=>{if(t.innerType._zod.optin==="optional"){const s=t.innerType._zod.run(n,i);return s instanceof Promise?s.then(o=>qi(o,n.value)):qi(s,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,i)}}),yl=v("$ZodExactOptional",(e,t)=>{lr.init(e,t),F(e._zod,"values",()=>t.innerType._zod.values),F(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,i)=>t.innerType._zod.run(n,i)}),xl=v("$ZodNullable",(e,t)=>{K.init(e,t),F(e._zod,"optin",()=>t.innerType._zod.optin),F(e._zod,"optout",()=>t.innerType._zod.optout),F(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${_i(n.source)}|null)$`):void 0}),F(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,i)=>n.value===null?n:t.innerType._zod.run(n,i)}),vl=v("$ZodDefault",(e,t)=>{K.init(e,t),e._zod.optin="optional",F(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);if(n.value===void 0)return n.value=t.defaultValue,n;const s=t.innerType._zod.run(n,i);return s instanceof Promise?s.then(o=>Xi(o,t)):Xi(s,t)}});function Xi(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const wl=v("$ZodPrefault",(e,t)=>{K.init(e,t),e._zod.optin="optional",F(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>(i.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,i))}),kl=v("$ZodNonOptional",(e,t)=>{K.init(e,t),F(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(i=>i!==void 0)):void 0}),e._zod.parse=(n,i)=>{const s=t.innerType._zod.run(n,i);return s instanceof Promise?s.then(o=>Ji(o,e)):Ji(s,e)}});function Ji(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Sl=v("$ZodCatch",(e,t)=>{K.init(e,t),F(e._zod,"optin",()=>t.innerType._zod.optin),F(e._zod,"optout",()=>t.innerType._zod.optout),F(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);const s=t.innerType._zod.run(n,i);return s instanceof Promise?s.then(o=>(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(r=>ee(r,i,te()))},input:n.value}),n.issues=[]),n)):(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(o=>ee(o,i,te()))},input:n.value}),n.issues=[]),n)}}),Ml=v("$ZodPipe",(e,t)=>{K.init(e,t),F(e._zod,"values",()=>t.in._zod.values),F(e._zod,"optin",()=>t.in._zod.optin),F(e._zod,"optout",()=>t.out._zod.optout),F(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,i)=>{if(i.direction==="backward"){const o=t.out._zod.run(n,i);return o instanceof Promise?o.then(r=>Ye(r,t.in,i)):Ye(o,t.in,i)}const s=t.in._zod.run(n,i);return s instanceof Promise?s.then(o=>Ye(o,t.out,i)):Ye(s,t.out,i)}});function Ye(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Pl=v("$ZodReadonly",(e,t)=>{K.init(e,t),F(e._zod,"propValues",()=>t.innerType._zod.propValues),F(e._zod,"values",()=>t.innerType._zod.values),F(e._zod,"optin",()=>t.innerType?._zod?.optin),F(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);const s=t.innerType._zod.run(n,i);return s instanceof Promise?s.then(Ki):Ki(s)}});function Ki(e){return e.value=Object.freeze(e.value),e}const Cl=v("$ZodCustom",(e,t)=>{ft.init(e,t),K.init(e,t),e._zod.parse=(n,i)=>n,e._zod.check=n=>{const i=n.value,s=t.fn(i);if(s instanceof Promise)return s.then(o=>Gi(o,n,i,e));Gi(s,n,i,e)}});function Gi(e,t,n,i){if(!e){const s={code:"custom",input:n,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(s.params=i._zod.def.params),t.issues.push(Re(s))}}var Qi;class Ol{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const i=n[0];return this._map.set(t,i),i&&typeof i=="object"&&"id"in i&&this._idmap.set(i.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const i={...this.get(n)??{}};delete i.id;const s={...i,...this._map.get(t)};return Object.keys(s).length?s:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function zl(){return new Ol}(Qi=globalThis).__zod_globalRegistry??(Qi.__zod_globalRegistry=zl());const Me=globalThis.__zod_globalRegistry;function Tl(e,t){return new e({type:"string",...C(t)})}function Al(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...C(t)})}function ts(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...C(t)})}function Dl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...C(t)})}function El(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...C(t)})}function Il(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...C(t)})}function Rl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...C(t)})}function Ll(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...C(t)})}function $l(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...C(t)})}function Fl(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...C(t)})}function Nl(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...C(t)})}function Bl(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...C(t)})}function jl(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...C(t)})}function Vl(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...C(t)})}function Zl(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...C(t)})}function Wl(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...C(t)})}function Hl(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...C(t)})}function Ul(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...C(t)})}function Yl(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...C(t)})}function ql(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...C(t)})}function Xl(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...C(t)})}function Jl(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...C(t)})}function Kl(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...C(t)})}function Gl(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...C(t)})}function Ql(e,t){return new e({type:"string",format:"date",check:"string_format",...C(t)})}function th(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...C(t)})}function eh(e,t){return new e({type:"string",format:"duration",check:"string_format",...C(t)})}function nh(e,t){return new e({type:"number",checks:[],...C(t)})}function ih(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...C(t)})}function sh(e){return new e({type:"unknown"})}function oh(e,t){return new e({type:"never",...C(t)})}function es(e,t){return new ir({check:"less_than",...C(t),value:e,inclusive:!1})}function Fn(e,t){return new ir({check:"less_than",...C(t),value:e,inclusive:!0})}function ns(e,t){return new sr({check:"greater_than",...C(t),value:e,inclusive:!1})}function Nn(e,t){return new sr({check:"greater_than",...C(t),value:e,inclusive:!0})}function is(e,t){return new Sc({check:"multiple_of",...C(t),value:e})}function hr(e,t){return new Pc({check:"max_length",...C(t),maximum:e})}function gn(e,t){return new Cc({check:"min_length",...C(t),minimum:e})}function ur(e,t){return new Oc({check:"length_equals",...C(t),length:e})}function rh(e,t){return new zc({check:"string_format",format:"regex",...C(t),pattern:e})}function ah(e){return new Tc({check:"string_format",format:"lowercase",...C(e)})}function ch(e){return new Ac({check:"string_format",format:"uppercase",...C(e)})}function lh(e,t){return new Dc({check:"string_format",format:"includes",...C(t),includes:e})}function hh(e,t){return new Ec({check:"string_format",format:"starts_with",...C(t),prefix:e})}function uh(e,t){return new Ic({check:"string_format",format:"ends_with",...C(t),suffix:e})}function be(e){return new Rc({check:"overwrite",tx:e})}function dh(e){return be(t=>t.normalize(e))}function fh(){return be(e=>e.trim())}function ph(){return be(e=>e.toLowerCase())}function gh(){return be(e=>e.toUpperCase())}function mh(){return be(e=>za(e))}function bh(e,t,n){return new e({type:"array",element:t,...C(n)})}function _h(e,t,n){return new e({type:"custom",check:"custom",fn:t,...C(n)})}function yh(e){const t=xh(n=>(n.addIssue=i=>{if(typeof i=="string")n.issues.push(Re(i,n.value,t._zod.def));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=t),s.continue??(s.continue=!t._zod.def.abort),n.issues.push(Re(s))}},e(n.value,n)));return t}function xh(e,t){const n=new ft({check:"custom",...C(t)});return n._zod.check=e,n}function dr(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Me,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function it(e,t,n={path:[],schemaPath:[]}){var i;const s=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;const r={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,r);const a=e._zod.toJSONSchema?.();if(a)r.schema=a;else{const h={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,r.schema,h);else{const d=r.schema,f=t.processors[s.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);f(e,t,d,h)}const u=e._zod.parent;u&&(r.ref||(r.ref=u),it(u,t,h),t.seen.get(u).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(r.schema,c),t.io==="input"&&ht(e)&&(delete r.schema.examples,delete r.schema.default),t.io==="input"&&r.schema._prefault&&((i=r.schema).default??(i.default=r.schema._prefault)),delete r.schema._prefault,t.seen.get(e).schema}function fr(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=new Map;for(const r of e.seen.entries()){const a=e.metadataRegistry.get(r[0])?.id;if(a){const c=i.get(a);if(c&&c!==r[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(a,r[0])}}const s=r=>{const a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const u=e.external.registry.get(r[0])?.id,d=e.external.uri??(p=>p);if(u)return{ref:d(u)};const f=r[1].defId??r[1].schema.id??`schema${e.counter++}`;return r[1].defId=f,{defId:f,ref:`${d("__shared")}#/${a}/${f}`}}if(r[1]===n)return{ref:"#"};const l=`#/${a}/`,h=r[1].schema.id??`__schema${e.counter++}`;return{defId:h,ref:l+h}},o=r=>{if(r[1].schema.$ref)return;const a=r[1],{ref:c,defId:l}=s(r);a.def={...a.schema},l&&(a.defId=l);const h=a.schema;for(const u in h)delete h[u];h.$ref=c};if(e.cycles==="throw")for(const r of e.seen.entries()){const a=r[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
38
|
+
|
|
39
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const r of e.seen.entries()){const a=r[1];if(t===r[0]){o(r);continue}if(e.external){const l=e.external.registry.get(r[0])?.id;if(t!==r[0]&&l){o(r);continue}}if(e.metadataRegistry.get(r[0])?.id){o(r);continue}if(a.cycle){o(r);continue}if(a.count>1&&e.reused==="ref"){o(r);continue}}}function pr(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=r=>{const a=e.seen.get(r);if(a.ref===null)return;const c=a.def??a.schema,l={...c},h=a.ref;if(a.ref=null,h){i(h);const d=e.seen.get(h),f=d.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(f)):Object.assign(c,f),Object.assign(c,l),r._zod.parent===h)for(const g in c)g==="$ref"||g==="allOf"||g in l||delete c[g];if(f.$ref&&d.def)for(const g in c)g==="$ref"||g==="allOf"||g in d.def&&JSON.stringify(c[g])===JSON.stringify(d.def[g])&&delete c[g]}const u=r._zod.parent;if(u&&u!==h){i(u);const d=e.seen.get(u);if(d?.schema.$ref&&(c.$ref=d.schema.$ref,d.def))for(const f in c)f==="$ref"||f==="allOf"||f in d.def&&JSON.stringify(c[f])===JSON.stringify(d.def[f])&&delete c[f]}e.override({zodSchema:r,jsonSchema:c,path:a.path??[]})};for(const r of[...e.seen.entries()].reverse())i(r[0]);const s={};if(e.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const r=e.external.registry.get(t)?.id;if(!r)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(r)}Object.assign(s,n.def??n.schema);const o=e.external?.defs??{};for(const r of e.seen.entries()){const a=r[1];a.def&&a.defId&&(o[a.defId]=a.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?s.$defs=o:s.definitions=o);try{const r=JSON.parse(JSON.stringify(s));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:mn(t,"input",e.processors),output:mn(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch{throw new Error("Error converting schema to JSON.")}}function ht(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return ht(i.element,n);if(i.type==="set")return ht(i.valueType,n);if(i.type==="lazy")return ht(i.getter(),n);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault")return ht(i.innerType,n);if(i.type==="intersection")return ht(i.left,n)||ht(i.right,n);if(i.type==="record"||i.type==="map")return ht(i.keyType,n)||ht(i.valueType,n);if(i.type==="pipe")return ht(i.in,n)||ht(i.out,n);if(i.type==="object"){for(const s in i.shape)if(ht(i.shape[s],n))return!0;return!1}if(i.type==="union"){for(const s of i.options)if(ht(s,n))return!0;return!1}if(i.type==="tuple"){for(const s of i.items)if(ht(s,n))return!0;return!!(i.rest&&ht(i.rest,n))}return!1}const vh=(e,t={})=>n=>{const i=dr({...n,processors:t});return it(e,i),fr(i,e),pr(i,e)},mn=(e,t,n={})=>i=>{const{libraryOptions:s,target:o}=i??{},r=dr({...s??{},target:o,io:t,processors:n});return it(e,r),fr(r,e),pr(r,e)},wh={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},kh=(e,t,n,i)=>{const s=n;s.type="string";const{minimum:o,maximum:r,format:a,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof o=="number"&&(s.minLength=o),typeof r=="number"&&(s.maxLength=r),a&&(s.format=wh[a]??a,s.format===""&&delete s.format,a==="time"&&delete s.format),l&&(s.contentEncoding=l),c&&c.size>0){const h=[...c];h.length===1?s.pattern=h[0].source:h.length>1&&(s.allOf=[...h.map(u=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:u.source}))])}},Sh=(e,t,n,i)=>{const s=n,{minimum:o,maximum:r,format:a,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:h}=e._zod.bag;typeof a=="string"&&a.includes("int")?s.type="integer":s.type="number",typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.minimum=h,s.exclusiveMinimum=!0):s.exclusiveMinimum=h),typeof o=="number"&&(s.minimum=o,typeof h=="number"&&t.target!=="draft-04"&&(h>=o?delete s.minimum:delete s.exclusiveMinimum)),typeof l=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.maximum=l,s.exclusiveMaximum=!0):s.exclusiveMaximum=l),typeof r=="number"&&(s.maximum=r,typeof l=="number"&&t.target!=="draft-04"&&(l<=r?delete s.maximum:delete s.exclusiveMaximum)),typeof c=="number"&&(s.multipleOf=c)},Mh=(e,t,n,i)=>{n.not={}},Ph=(e,t,n,i)=>{},Ch=(e,t,n,i)=>{const s=e._zod.def,o=Uo(s.entries);o.every(r=>typeof r=="number")&&(n.type="number"),o.every(r=>typeof r=="string")&&(n.type="string"),n.enum=o},Oh=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},zh=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Th=(e,t,n,i)=>{const s=n,o=e._zod.def,{minimum:r,maximum:a}=e._zod.bag;typeof r=="number"&&(s.minItems=r),typeof a=="number"&&(s.maxItems=a),s.type="array",s.items=it(o.element,t,{...i,path:[...i.path,"items"]})},Ah=(e,t,n,i)=>{const s=n,o=e._zod.def;s.type="object",s.properties={};const r=o.shape;for(const l in r)s.properties[l]=it(r[l],t,{...i,path:[...i.path,"properties",l]});const a=new Set(Object.keys(r)),c=new Set([...a].filter(l=>{const h=o.shape[l]._zod;return t.io==="input"?h.optin===void 0:h.optout===void 0}));c.size>0&&(s.required=Array.from(c)),o.catchall?._zod.def.type==="never"?s.additionalProperties=!1:o.catchall?o.catchall&&(s.additionalProperties=it(o.catchall,t,{...i,path:[...i.path,"additionalProperties"]})):t.io==="output"&&(s.additionalProperties=!1)},Dh=(e,t,n,i)=>{const s=e._zod.def,o=s.inclusive===!1,r=s.options.map((a,c)=>it(a,t,{...i,path:[...i.path,o?"oneOf":"anyOf",c]}));o?n.oneOf=r:n.anyOf=r},Eh=(e,t,n,i)=>{const s=e._zod.def,o=it(s.left,t,{...i,path:[...i.path,"allOf",0]}),r=it(s.right,t,{...i,path:[...i.path,"allOf",1]}),a=l=>"allOf"in l&&Object.keys(l).length===1,c=[...a(o)?o.allOf:[o],...a(r)?r.allOf:[r]];n.allOf=c},Ih=(e,t,n,i)=>{const s=e._zod.def,o=it(s.innerType,t,i),r=t.seen.get(e);t.target==="openapi-3.0"?(r.ref=s.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]},Rh=(e,t,n,i)=>{const s=e._zod.def;it(s.innerType,t,i);const o=t.seen.get(e);o.ref=s.innerType},Lh=(e,t,n,i)=>{const s=e._zod.def;it(s.innerType,t,i);const o=t.seen.get(e);o.ref=s.innerType,n.default=JSON.parse(JSON.stringify(s.defaultValue))},$h=(e,t,n,i)=>{const s=e._zod.def;it(s.innerType,t,i);const o=t.seen.get(e);o.ref=s.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(s.defaultValue)))},Fh=(e,t,n,i)=>{const s=e._zod.def;it(s.innerType,t,i);const o=t.seen.get(e);o.ref=s.innerType;let r;try{r=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=r},Nh=(e,t,n,i)=>{const s=e._zod.def,o=t.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;it(o,t,i);const r=t.seen.get(e);r.ref=o},Bh=(e,t,n,i)=>{const s=e._zod.def;it(s.innerType,t,i);const o=t.seen.get(e);o.ref=s.innerType,n.readOnly=!0},gr=(e,t,n,i)=>{const s=e._zod.def;it(s.innerType,t,i);const o=t.seen.get(e);o.ref=s.innerType},jh=v("ZodISODateTime",(e,t)=>{Xc.init(e,t),U.init(e,t)});function Vh(e){return Gl(jh,e)}const Zh=v("ZodISODate",(e,t)=>{Jc.init(e,t),U.init(e,t)});function Wh(e){return Ql(Zh,e)}const Hh=v("ZodISOTime",(e,t)=>{Kc.init(e,t),U.init(e,t)});function Uh(e){return th(Hh,e)}const Yh=v("ZodISODuration",(e,t)=>{Gc.init(e,t),U.init(e,t)});function qh(e){return eh(Yh,e)}const Xh=(e,t)=>{Ko.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Va(e,n)},flatten:{value:n=>ja(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,ei,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,ei,2)}},isEmpty:{get(){return e.issues.length===0}}})},bt=v("ZodError",Xh,{Parent:Error}),Jh=xi(bt),Kh=vi(bt),Gh=Cn(bt),Qh=On(bt),tu=Ha(bt),eu=Ua(bt),nu=Ya(bt),iu=qa(bt),su=Xa(bt),ou=Ja(bt),ru=Ka(bt),au=Ga(bt),G=v("ZodType",(e,t)=>(K.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:mn(e,"input"),output:mn(e,"output")}}),e.toJSONSchema=vh(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Bt(t,{checks:[...t.checks??[],...n.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0}),e.with=e.check,e.clone=(n,i)=>jt(e,n,i),e.brand=()=>e,e.register=((n,i)=>(n.add(e,i),e)),e.parse=(n,i)=>Jh(e,n,i,{callee:e.parse}),e.safeParse=(n,i)=>Gh(e,n,i),e.parseAsync=async(n,i)=>Kh(e,n,i,{callee:e.parseAsync}),e.safeParseAsync=async(n,i)=>Qh(e,n,i),e.spa=e.safeParseAsync,e.encode=(n,i)=>tu(e,n,i),e.decode=(n,i)=>eu(e,n,i),e.encodeAsync=async(n,i)=>nu(e,n,i),e.decodeAsync=async(n,i)=>iu(e,n,i),e.safeEncode=(n,i)=>su(e,n,i),e.safeDecode=(n,i)=>ou(e,n,i),e.safeEncodeAsync=async(n,i)=>ru(e,n,i),e.safeDecodeAsync=async(n,i)=>au(e,n,i),e.refine=(n,i)=>e.check(Ku(n,i)),e.superRefine=n=>e.check(Gu(n)),e.overwrite=n=>e.check(be(n)),e.optional=()=>rs(e),e.exactOptional=()=>Fu(e),e.nullable=()=>as(e),e.nullish=()=>rs(as(e)),e.nonoptional=n=>Wu(e,n),e.array=()=>Lt(e),e.or=n=>_r([e,n]),e.and=n=>Iu(e,n),e.transform=n=>cs(e,Lu(n)),e.default=n=>ju(e,n),e.prefault=n=>Zu(e,n),e.catch=n=>Uu(e,n),e.pipe=n=>cs(e,n),e.readonly=()=>Xu(e),e.describe=n=>{const i=e.clone();return Me.add(i,{description:n}),i},Object.defineProperty(e,"description",{get(){return Me.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Me.get(e);const i=e.clone();return Me.add(i,n[0]),i},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),mr=v("_ZodString",(e,t)=>{wi.init(e,t),G.init(e,t),e._zod.processJSONSchema=(i,s,o)=>kh(e,i,s);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...i)=>e.check(rh(...i)),e.includes=(...i)=>e.check(lh(...i)),e.startsWith=(...i)=>e.check(hh(...i)),e.endsWith=(...i)=>e.check(uh(...i)),e.min=(...i)=>e.check(gn(...i)),e.max=(...i)=>e.check(hr(...i)),e.length=(...i)=>e.check(ur(...i)),e.nonempty=(...i)=>e.check(gn(1,...i)),e.lowercase=i=>e.check(ah(i)),e.uppercase=i=>e.check(ch(i)),e.trim=()=>e.check(fh()),e.normalize=(...i)=>e.check(dh(...i)),e.toLowerCase=()=>e.check(ph()),e.toUpperCase=()=>e.check(gh()),e.slugify=()=>e.check(mh())}),cu=v("ZodString",(e,t)=>{wi.init(e,t),mr.init(e,t),e.email=n=>e.check(Al(lu,n)),e.url=n=>e.check(Ll(hu,n)),e.jwt=n=>e.check(Kl(Mu,n)),e.emoji=n=>e.check($l(uu,n)),e.guid=n=>e.check(ts(ss,n)),e.uuid=n=>e.check(Dl(qe,n)),e.uuidv4=n=>e.check(El(qe,n)),e.uuidv6=n=>e.check(Il(qe,n)),e.uuidv7=n=>e.check(Rl(qe,n)),e.nanoid=n=>e.check(Fl(du,n)),e.guid=n=>e.check(ts(ss,n)),e.cuid=n=>e.check(Nl(fu,n)),e.cuid2=n=>e.check(Bl(pu,n)),e.ulid=n=>e.check(jl(gu,n)),e.base64=n=>e.check(ql(wu,n)),e.base64url=n=>e.check(Xl(ku,n)),e.xid=n=>e.check(Vl(mu,n)),e.ksuid=n=>e.check(Zl(bu,n)),e.ipv4=n=>e.check(Wl(_u,n)),e.ipv6=n=>e.check(Hl(yu,n)),e.cidrv4=n=>e.check(Ul(xu,n)),e.cidrv6=n=>e.check(Yl(vu,n)),e.e164=n=>e.check(Jl(Su,n)),e.datetime=n=>e.check(Vh(n)),e.date=n=>e.check(Wh(n)),e.time=n=>e.check(Uh(n)),e.duration=n=>e.check(qh(n))});function L(e){return Tl(cu,e)}const U=v("ZodStringFormat",(e,t)=>{H.init(e,t),mr.init(e,t)}),lu=v("ZodEmail",(e,t)=>{Bc.init(e,t),U.init(e,t)}),ss=v("ZodGUID",(e,t)=>{Fc.init(e,t),U.init(e,t)}),qe=v("ZodUUID",(e,t)=>{Nc.init(e,t),U.init(e,t)}),hu=v("ZodURL",(e,t)=>{jc.init(e,t),U.init(e,t)}),uu=v("ZodEmoji",(e,t)=>{Vc.init(e,t),U.init(e,t)}),du=v("ZodNanoID",(e,t)=>{Zc.init(e,t),U.init(e,t)}),fu=v("ZodCUID",(e,t)=>{Wc.init(e,t),U.init(e,t)}),pu=v("ZodCUID2",(e,t)=>{Hc.init(e,t),U.init(e,t)}),gu=v("ZodULID",(e,t)=>{Uc.init(e,t),U.init(e,t)}),mu=v("ZodXID",(e,t)=>{Yc.init(e,t),U.init(e,t)}),bu=v("ZodKSUID",(e,t)=>{qc.init(e,t),U.init(e,t)}),_u=v("ZodIPv4",(e,t)=>{Qc.init(e,t),U.init(e,t)}),yu=v("ZodIPv6",(e,t)=>{tl.init(e,t),U.init(e,t)}),xu=v("ZodCIDRv4",(e,t)=>{el.init(e,t),U.init(e,t)}),vu=v("ZodCIDRv6",(e,t)=>{nl.init(e,t),U.init(e,t)}),wu=v("ZodBase64",(e,t)=>{il.init(e,t),U.init(e,t)}),ku=v("ZodBase64URL",(e,t)=>{ol.init(e,t),U.init(e,t)}),Su=v("ZodE164",(e,t)=>{rl.init(e,t),U.init(e,t)}),Mu=v("ZodJWT",(e,t)=>{cl.init(e,t),U.init(e,t)}),br=v("ZodNumber",(e,t)=>{rr.init(e,t),G.init(e,t),e._zod.processJSONSchema=(i,s,o)=>Sh(e,i,s),e.gt=(i,s)=>e.check(ns(i,s)),e.gte=(i,s)=>e.check(Nn(i,s)),e.min=(i,s)=>e.check(Nn(i,s)),e.lt=(i,s)=>e.check(es(i,s)),e.lte=(i,s)=>e.check(Fn(i,s)),e.max=(i,s)=>e.check(Fn(i,s)),e.int=i=>e.check(os(i)),e.safe=i=>e.check(os(i)),e.positive=i=>e.check(ns(0,i)),e.nonnegative=i=>e.check(Nn(0,i)),e.negative=i=>e.check(es(0,i)),e.nonpositive=i=>e.check(Fn(0,i)),e.multipleOf=(i,s)=>e.check(is(i,s)),e.step=(i,s)=>e.check(is(i,s)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Y(e){return nh(br,e)}const Pu=v("ZodNumberFormat",(e,t)=>{ll.init(e,t),br.init(e,t)});function os(e){return ih(Pu,e)}const Cu=v("ZodUnknown",(e,t)=>{hl.init(e,t),G.init(e,t),e._zod.processJSONSchema=(n,i,s)=>Ph()});function ii(){return sh(Cu)}const Ou=v("ZodNever",(e,t)=>{ul.init(e,t),G.init(e,t),e._zod.processJSONSchema=(n,i,s)=>Mh(e,n,i)});function zu(e){return oh(Ou,e)}const Tu=v("ZodArray",(e,t)=>{dl.init(e,t),G.init(e,t),e._zod.processJSONSchema=(n,i,s)=>Th(e,n,i,s),e.element=t.element,e.min=(n,i)=>e.check(gn(n,i)),e.nonempty=n=>e.check(gn(1,n)),e.max=(n,i)=>e.check(hr(n,i)),e.length=(n,i)=>e.check(ur(n,i)),e.unwrap=()=>e.element});function Lt(e,t){return bh(Tu,e,t)}const Au=v("ZodObject",(e,t)=>{pl.init(e,t),G.init(e,t),e._zod.processJSONSchema=(n,i,s)=>Ah(e,n,i,s),F(e,"shape",()=>t.shape),e.keyof=()=>yr(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ii()}),e.loose=()=>e.clone({...e._zod.def,catchall:ii()}),e.strict=()=>e.clone({...e._zod.def,catchall:zu()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>La(e,n),e.safeExtend=n=>$a(e,n),e.merge=n=>Fa(e,n),e.pick=n=>Ia(e,n),e.omit=n=>Ra(e,n),e.partial=(...n)=>Na(xr,e,n[0]),e.required=(...n)=>Ba(vr,e,n[0])});function ct(e,t){const n={type:"object",shape:e??{},...C(t)};return new Au(n)}const Du=v("ZodUnion",(e,t)=>{gl.init(e,t),G.init(e,t),e._zod.processJSONSchema=(n,i,s)=>Dh(e,n,i,s),e.options=t.options});function _r(e,t){return new Du({type:"union",options:e,...C(t)})}const Eu=v("ZodIntersection",(e,t)=>{ml.init(e,t),G.init(e,t),e._zod.processJSONSchema=(n,i,s)=>Eh(e,n,i,s)});function Iu(e,t){return new Eu({type:"intersection",left:e,right:t})}const si=v("ZodEnum",(e,t)=>{bl.init(e,t),G.init(e,t),e._zod.processJSONSchema=(i,s,o)=>Ch(e,i,s),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(i,s)=>{const o={};for(const r of i)if(n.has(r))o[r]=t.entries[r];else throw new Error(`Key ${r} not found in enum`);return new si({...t,checks:[],...C(s),entries:o})},e.exclude=(i,s)=>{const o={...t.entries};for(const r of i)if(n.has(r))delete o[r];else throw new Error(`Key ${r} not found in enum`);return new si({...t,checks:[],...C(s),entries:o})}});function yr(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new si({type:"enum",entries:n,...C(t)})}const Ru=v("ZodTransform",(e,t)=>{_l.init(e,t),G.init(e,t),e._zod.processJSONSchema=(n,i,s)=>zh(e,n),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new Wo(e.constructor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(Re(o,n.value,t));else{const r=o;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=n.value),r.inst??(r.inst=e),n.issues.push(Re(r))}};const s=t.transform(n.value,n);return s instanceof Promise?s.then(o=>(n.value=o,n)):(n.value=s,n)}});function Lu(e){return new Ru({type:"transform",transform:e})}const xr=v("ZodOptional",(e,t)=>{lr.init(e,t),G.init(e,t),e._zod.processJSONSchema=(n,i,s)=>gr(e,n,i,s),e.unwrap=()=>e._zod.def.innerType});function rs(e){return new xr({type:"optional",innerType:e})}const $u=v("ZodExactOptional",(e,t)=>{yl.init(e,t),G.init(e,t),e._zod.processJSONSchema=(n,i,s)=>gr(e,n,i,s),e.unwrap=()=>e._zod.def.innerType});function Fu(e){return new $u({type:"optional",innerType:e})}const Nu=v("ZodNullable",(e,t)=>{xl.init(e,t),G.init(e,t),e._zod.processJSONSchema=(n,i,s)=>Ih(e,n,i,s),e.unwrap=()=>e._zod.def.innerType});function as(e){return new Nu({type:"nullable",innerType:e})}const Bu=v("ZodDefault",(e,t)=>{vl.init(e,t),G.init(e,t),e._zod.processJSONSchema=(n,i,s)=>Lh(e,n,i,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ju(e,t){return new Bu({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():qo(t)}})}const Vu=v("ZodPrefault",(e,t)=>{wl.init(e,t),G.init(e,t),e._zod.processJSONSchema=(n,i,s)=>$h(e,n,i,s),e.unwrap=()=>e._zod.def.innerType});function Zu(e,t){return new Vu({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():qo(t)}})}const vr=v("ZodNonOptional",(e,t)=>{kl.init(e,t),G.init(e,t),e._zod.processJSONSchema=(n,i,s)=>Rh(e,n,i,s),e.unwrap=()=>e._zod.def.innerType});function Wu(e,t){return new vr({type:"nonoptional",innerType:e,...C(t)})}const Hu=v("ZodCatch",(e,t)=>{Sl.init(e,t),G.init(e,t),e._zod.processJSONSchema=(n,i,s)=>Fh(e,n,i,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Uu(e,t){return new Hu({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Yu=v("ZodPipe",(e,t)=>{Ml.init(e,t),G.init(e,t),e._zod.processJSONSchema=(n,i,s)=>Nh(e,n,i,s),e.in=t.in,e.out=t.out});function cs(e,t){return new Yu({type:"pipe",in:e,out:t})}const qu=v("ZodReadonly",(e,t)=>{Pl.init(e,t),G.init(e,t),e._zod.processJSONSchema=(n,i,s)=>Bh(e,n,i,s),e.unwrap=()=>e._zod.def.innerType});function Xu(e){return new qu({type:"readonly",innerType:e})}const Ju=v("ZodCustom",(e,t)=>{Cl.init(e,t),G.init(e,t),e._zod.processJSONSchema=(n,i,s)=>Oh(e,n)});function Ku(e,t={}){return _h(Ju,e,t)}function Gu(e){return yh(e)}const Qu=ct({hits:Y(),misses:Y()}),ls=ct({size:Y(),stats:Qu}),td=ct({poolName:L(),procedureNameCache:ls,argumentCache:ls}),ed=ct({totalRequests:Y(),totalTimeouts:Y(),totalRequestsEnqueued:Y().optional(),totalRequestsDequeued:Y().optional(),totalRequestsFailed:Y().optional()}),nd=ct({name:L(),connectionsInUse:Y(),connectionsOpen:Y(),stats:ed.nullable()}),id=ct({requestCount:Y(),errorCount:Y(),avgResponseTime:Y()}),hs=ct({route:L(),user:L().optional(),password:L().optional(),connectString:L().optional(),defaultPage:L().optional(),pathAlias:L().optional(),pathAliasProcedure:L().optional(),documentTable:L().optional(),exclusionList:Lt(L()).optional(),requestValidationFunction:L().optional(),transactionMode:ii().optional(),errorStyle:L().optional(),directoryPath:L().optional()}),sd=ct({port:Y(),adminRoute:L().optional(),adminUser:L().optional(),adminPassword:L().optional(),loggerFilename:L(),uploadFileSizeLimit:Y().optional(),routePlSql:Lt(hs),routeStatic:Lt(hs)}),od=ct({nodeVersion:L(),platform:L(),arch:L(),memory:ct({rss:Y(),heapTotal:Y(),heapUsed:Y(),external:Y()}),cpu:ct({user:Y(),system:Y()})}),rd=ct({version:L(),status:yr(["running","paused","stopped"]),uptime:Y(),startTime:L(),metrics:id,pools:Lt(nd),system:od,config:sd.partial()}),ad=ct({timestamp:L(),req:ct({method:L().optional(),url:L().optional()}).optional(),message:L(),details:ct({fullMessage:L().optional()}).optional()}),cd=_r([Lt(L()),ct({message:L()})]);function Xe(e,t,n){const i=t.safeParse(e);if(!i.success)throw new Error(`Validation failed for ${n}: ${i.error.message}`);return i.data}const $t={async getStatus(){const e=await fetch("api/status");if(!e.ok)throw new Error(`GET api/status failed: ${e.statusText}`);const t=await e.json();return Xe(t,rd,"api/status")},async getCache(){const e=await fetch("api/cache");if(!e.ok)throw new Error(`GET api/cache failed: ${e.statusText}`);const t=await e.json();return Xe(t,Lt(td),"api/cache")},async getErrorLogs(){const e=await fetch("api/logs/error");if(!e.ok)throw new Error(`GET api/logs/error failed: ${e.statusText}`);const t=await e.json();return Xe(t,Lt(ad),"api/logs/error")},async getAccessLogs(){const e=await fetch("api/logs/access");if(!e.ok)throw new Error(`GET api/logs/access failed: ${e.statusText}`);const t=await e.json();return Xe(t,cd,"api/logs/access")},async post(e,t={}){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(`POST ${e} failed: ${n.statusText}`)}};function Ze(e){return e+.5|0}const At=(e,t,n)=>Math.max(Math.min(e,n),t);function Pe(e){return At(Ze(e*2.55),0,255)}function Rt(e){return At(Ze(e*255),0,255)}function Pt(e){return At(Ze(e/2.55)/100,0,1)}function us(e){return At(Ze(e*100),0,100)}const mt={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},oi=[..."0123456789ABCDEF"],ld=e=>oi[e&15],hd=e=>oi[(e&240)>>4]+oi[e&15],Je=e=>(e&240)>>4===(e&15),ud=e=>Je(e.r)&&Je(e.g)&&Je(e.b)&&Je(e.a);function dd(e){var t=e.length,n;return e[0]==="#"&&(t===4||t===5?n={r:255&mt[e[1]]*17,g:255&mt[e[2]]*17,b:255&mt[e[3]]*17,a:t===5?mt[e[4]]*17:255}:(t===7||t===9)&&(n={r:mt[e[1]]<<4|mt[e[2]],g:mt[e[3]]<<4|mt[e[4]],b:mt[e[5]]<<4|mt[e[6]],a:t===9?mt[e[7]]<<4|mt[e[8]]:255})),n}const fd=(e,t)=>e<255?t(e):"";function pd(e){var t=ud(e)?ld:hd;return e?"#"+t(e.r)+t(e.g)+t(e.b)+fd(e.a,t):void 0}const gd=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function wr(e,t,n){const i=t*Math.min(n,1-n),s=(o,r=(o+e/30)%12)=>n-i*Math.max(Math.min(r-3,9-r,1),-1);return[s(0),s(8),s(4)]}function md(e,t,n){const i=(s,o=(s+e/60)%6)=>n-n*t*Math.max(Math.min(o,4-o,1),0);return[i(5),i(3),i(1)]}function bd(e,t,n){const i=wr(e,1,.5);let s;for(t+n>1&&(s=1/(t+n),t*=s,n*=s),s=0;s<3;s++)i[s]*=1-t-n,i[s]+=t;return i}function _d(e,t,n,i,s){return e===s?(t-n)/i+(t<n?6:0):t===s?(n-e)/i+2:(e-t)/i+4}function ki(e){const n=e.r/255,i=e.g/255,s=e.b/255,o=Math.max(n,i,s),r=Math.min(n,i,s),a=(o+r)/2;let c,l,h;return o!==r&&(h=o-r,l=a>.5?h/(2-o-r):h/(o+r),c=_d(n,i,s,h,o),c=c*60+.5),[c|0,l||0,a]}function Si(e,t,n,i){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,n,i)).map(Rt)}function Mi(e,t,n){return Si(wr,e,t,n)}function yd(e,t,n){return Si(bd,e,t,n)}function xd(e,t,n){return Si(md,e,t,n)}function kr(e){return(e%360+360)%360}function vd(e){const t=gd.exec(e);let n=255,i;if(!t)return;t[5]!==i&&(n=t[6]?Pe(+t[5]):Rt(+t[5]));const s=kr(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?i=yd(s,o,r):t[1]==="hsv"?i=xd(s,o,r):i=Mi(s,o,r),{r:i[0],g:i[1],b:i[2],a:n}}function wd(e,t){var n=ki(e);n[0]=kr(n[0]+t),n=Mi(n),e.r=n[0],e.g=n[1],e.b=n[2]}function kd(e){if(!e)return;const t=ki(e),n=t[0],i=us(t[1]),s=us(t[2]);return e.a<255?`hsla(${n}, ${i}%, ${s}%, ${Pt(e.a)})`:`hsl(${n}, ${i}%, ${s}%)`}const ds={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"},fs={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function Sd(){const e={},t=Object.keys(fs),n=Object.keys(ds);let i,s,o,r,a;for(i=0;i<t.length;i++){for(r=a=t[i],s=0;s<n.length;s++)o=n[s],a=a.replace(o,ds[o]);o=parseInt(fs[r],16),e[a]=[o>>16&255,o>>8&255,o&255]}return e}let Ke;function Md(e){Ke||(Ke=Sd(),Ke.transparent=[0,0,0,0]);const t=Ke[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const Pd=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function Cd(e){const t=Pd.exec(e);let n=255,i,s,o;if(t){if(t[7]!==i){const r=+t[7];n=t[8]?Pe(r):At(r*255,0,255)}return i=+t[1],s=+t[3],o=+t[5],i=255&(t[2]?Pe(i):At(i,0,255)),s=255&(t[4]?Pe(s):At(s,0,255)),o=255&(t[6]?Pe(o):At(o,0,255)),{r:i,g:s,b:o,a:n}}}function Od(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${Pt(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}const Bn=e=>e<=.0031308?e*12.92:Math.pow(e,1/2.4)*1.055-.055,le=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);function zd(e,t,n){const i=le(Pt(e.r)),s=le(Pt(e.g)),o=le(Pt(e.b));return{r:Rt(Bn(i+n*(le(Pt(t.r))-i))),g:Rt(Bn(s+n*(le(Pt(t.g))-s))),b:Rt(Bn(o+n*(le(Pt(t.b))-o))),a:e.a+n*(t.a-e.a)}}function Ge(e,t,n){if(e){let i=ki(e);i[t]=Math.max(0,Math.min(i[t]+i[t]*n,t===0?360:1)),i=Mi(i),e.r=i[0],e.g=i[1],e.b=i[2]}}function Sr(e,t){return e&&Object.assign(t||{},e)}function ps(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=Rt(e[3]))):(t=Sr(e,{r:0,g:0,b:0,a:1}),t.a=Rt(t.a)),t}function Td(e){return e.charAt(0)==="r"?Cd(e):vd(e)}class Le{constructor(t){if(t instanceof Le)return t;const n=typeof t;let i;n==="object"?i=ps(t):n==="string"&&(i=dd(t)||Md(t)||Td(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=Sr(this._rgb);return t&&(t.a=Pt(t.a)),t}set rgb(t){this._rgb=ps(t)}rgbString(){return this._valid?Od(this._rgb):void 0}hexString(){return this._valid?pd(this._rgb):void 0}hslString(){return this._valid?kd(this._rgb):void 0}mix(t,n){if(t){const i=this.rgb,s=t.rgb;let o;const r=n===o?.5:n,a=2*r-1,c=i.a-s.a,l=((a*c===-1?a:(a+c)/(1+a*c))+1)/2;o=1-l,i.r=255&l*i.r+o*s.r+.5,i.g=255&l*i.g+o*s.g+.5,i.b=255&l*i.b+o*s.b+.5,i.a=r*i.a+(1-r)*s.a,this.rgb=i}return this}interpolate(t,n){return t&&(this._rgb=zd(this._rgb,t._rgb,n)),this}clone(){return new Le(this.rgb)}alpha(t){return this._rgb.a=Rt(t),this}clearer(t){const n=this._rgb;return n.a*=1-t,this}greyscale(){const t=this._rgb,n=Ze(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=n,this}opaquer(t){const n=this._rgb;return n.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 Ge(this._rgb,2,t),this}darken(t){return Ge(this._rgb,2,-t),this}saturate(t){return Ge(this._rgb,1,t),this}desaturate(t){return Ge(this._rgb,1,-t),this}rotate(t){return wd(this._rgb,t),this}}function kt(){}const Ad=(()=>{let e=0;return()=>e++})();function A(e){return e==null}function Z(e){if(Array.isArray&&Array.isArray(e))return!0;const t=Object.prototype.toString.call(e);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function D(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function q(e){return(typeof e=="number"||e instanceof Number)&&isFinite(+e)}function gt(e,t){return q(e)?e:t}function z(e,t){return typeof e>"u"?t:e}const Dd=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100:+e/t,Mr=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100*t:+e;function B(e,t,n){if(e&&typeof e.call=="function")return e.apply(n,t)}function $(e,t,n,i){let s,o,r;if(Z(e))for(o=e.length,s=0;s<o;s++)t.call(n,e[s],s);else if(D(e))for(r=Object.keys(e),o=r.length,s=0;s<o;s++)t.call(n,e[r[s]],r[s])}function bn(e,t){let n,i,s,o;if(!e||!t||e.length!==t.length)return!1;for(n=0,i=e.length;n<i;++n)if(s=e[n],o=t[n],s.datasetIndex!==o.datasetIndex||s.index!==o.index)return!1;return!0}function _n(e){if(Z(e))return e.map(_n);if(D(e)){const t=Object.create(null),n=Object.keys(e),i=n.length;let s=0;for(;s<i;++s)t[n[s]]=_n(e[n[s]]);return t}return e}function Pr(e){return["__proto__","prototype","constructor"].indexOf(e)===-1}function Ed(e,t,n,i){if(!Pr(e))return;const s=t[e],o=n[e];D(s)&&D(o)?$e(s,o,i):t[e]=_n(o)}function $e(e,t,n){const i=Z(t)?t:[t],s=i.length;if(!D(e))return e;n=n||{};const o=n.merger||Ed;let r;for(let a=0;a<s;++a){if(r=i[a],!D(r))continue;const c=Object.keys(r);for(let l=0,h=c.length;l<h;++l)o(c[l],e,r,n)}return e}function Te(e,t){return $e(e,t,{merger:Id})}function Id(e,t,n){if(!Pr(e))return;const i=t[e],s=n[e];D(i)&&D(s)?Te(i,s):Object.prototype.hasOwnProperty.call(t,e)||(t[e]=_n(s))}const gs={"":e=>e,x:e=>e.x,y:e=>e.y};function Rd(e){const t=e.split("."),n=[];let i="";for(const s of t)i+=s,i.endsWith("\\")?i=i.slice(0,-1)+".":(n.push(i),i="");return n}function Ld(e){const t=Rd(e);return n=>{for(const i of t){if(i==="")break;n=n&&n[i]}return n}}function Ft(e,t){return(gs[t]||(gs[t]=Ld(t)))(e)}function Pi(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Fe=e=>typeof e<"u",Nt=e=>typeof e=="function",ms=(e,t)=>{if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0};function $d(e){return e.type==="mouseup"||e.type==="click"||e.type==="contextmenu"}const I=Math.PI,j=2*I,Fd=j+I,yn=Number.POSITIVE_INFINITY,Nd=I/180,J=I/2,Ut=I/4,bs=I*2/3,Dt=Math.log10,wt=Math.sign;function Ae(e,t,n){return Math.abs(e-t)<n}function _s(e){const t=Math.round(e);e=Ae(e,t,e/1e3)?t:e;const n=Math.pow(10,Math.floor(Dt(e))),i=e/n;return(i<=1?1:i<=2?2:i<=5?5:10)*n}function Bd(e){const t=[],n=Math.sqrt(e);let i;for(i=1;i<n;i++)e%i===0&&(t.push(i),t.push(e/i));return n===(n|0)&&t.push(n),t.sort((s,o)=>s-o).pop(),t}function jd(e){return typeof e=="symbol"||typeof e=="object"&&e!==null&&!(Symbol.toPrimitive in e||"toString"in e||"valueOf"in e)}function pe(e){return!jd(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function Vd(e,t){const n=Math.round(e);return n-t<=e&&n+t>=e}function Cr(e,t,n){let i,s,o;for(i=0,s=e.length;i<s;i++)o=e[i][n],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function yt(e){return e*(I/180)}function Ci(e){return e*(180/I)}function ys(e){if(!q(e))return;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n++;return n}function Or(e,t){const n=t.x-e.x,i=t.y-e.y,s=Math.sqrt(n*n+i*i);let o=Math.atan2(i,n);return o<-.5*I&&(o+=j),{angle:o,distance:s}}function ri(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Zd(e,t){return(e-t+Fd)%j-I}function rt(e){return(e%j+j)%j}function Ne(e,t,n,i){const s=rt(e),o=rt(t),r=rt(n),a=rt(o-s),c=rt(r-s),l=rt(s-o),h=rt(s-r);return s===o||s===r||i&&o===r||a>c&&l<h}function et(e,t,n){return Math.max(t,Math.min(n,e))}function Wd(e){return et(e,-32768,32767)}function Ct(e,t,n,i=1e-6){return e>=Math.min(t,n)-i&&e<=Math.max(t,n)+i}function Oi(e,t,n){n=n||(r=>e[r]<t);let i=e.length-1,s=0,o;for(;i-s>1;)o=s+i>>1,n(o)?s=o:i=o;return{lo:s,hi:i}}const Ot=(e,t,n,i)=>Oi(e,n,i?s=>{const o=e[s][t];return o<n||o===n&&e[s+1][t]===n}:s=>e[s][t]<n),Hd=(e,t,n)=>Oi(e,n,i=>e[i][t]>=n);function Ud(e,t,n){let i=0,s=e.length;for(;i<s&&e[i]<t;)i++;for(;s>i&&e[s-1]>n;)s--;return i>0||s<e.length?e.slice(i,s):e}const zr=["push","pop","shift","splice","unshift"];function Yd(e,t){if(e._chartjs){e._chartjs.listeners.push(t);return}Object.defineProperty(e,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),zr.forEach(n=>{const i="_onData"+Pi(n),s=e[n];Object.defineProperty(e,n,{configurable:!0,enumerable:!1,value(...o){const r=s.apply(this,o);return e._chartjs.listeners.forEach(a=>{typeof a[i]=="function"&&a[i](...o)}),r}})})}function xs(e,t){const n=e._chartjs;if(!n)return;const i=n.listeners,s=i.indexOf(t);s!==-1&&i.splice(s,1),!(i.length>0)&&(zr.forEach(o=>{delete e[o]}),delete e._chartjs)}function Tr(e){const t=new Set(e);return t.size===e.length?e:Array.from(t)}const Ar=(function(){return typeof window>"u"?function(e){return e()}:window.requestAnimationFrame})();function Dr(e,t){let n=[],i=!1;return function(...s){n=s,i||(i=!0,Ar.call(window,()=>{i=!1,e.apply(t,n)}))}}function qd(e,t){let n;return function(...i){return t?(clearTimeout(n),n=setTimeout(e,t,i)):e.apply(this,i),t}}const zi=e=>e==="start"?"left":e==="end"?"right":"center",ot=(e,t,n)=>e==="start"?t:e==="end"?n:(t+n)/2,Xd=(e,t,n,i)=>e===(i?"left":"right")?n:e==="center"?(t+n)/2:t;function Er(e,t,n){const i=t.length;let s=0,o=i;if(e._sorted){const{iScale:r,vScale:a,_parsed:c}=e,l=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null,h=r.axis,{min:u,max:d,minDefined:f,maxDefined:p}=r.getUserBounds();if(f){if(s=Math.min(Ot(c,h,u).lo,n?i:Ot(t,h,r.getPixelForValue(u)).lo),l){const g=c.slice(0,s+1).reverse().findIndex(m=>!A(m[a.axis]));s-=Math.max(0,g)}s=et(s,0,i-1)}if(p){let g=Math.max(Ot(c,r.axis,d,!0).hi+1,n?0:Ot(t,h,r.getPixelForValue(d),!0).hi+1);if(l){const m=c.slice(g-1).findIndex(b=>!A(b[a.axis]));g+=Math.max(0,m)}o=et(g,s,i)-s}else o=i-s}return{start:s,count:o}}function Ir(e){const{xScale:t,yScale:n,_scaleRanges:i}=e,s={xmin:t.min,xmax:t.max,ymin:n.min,ymax:n.max};if(!i)return e._scaleRanges=s,!0;const o=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==n.min||i.ymax!==n.max;return Object.assign(i,s),o}const Qe=e=>e===0||e===1,vs=(e,t,n)=>-(Math.pow(2,10*(e-=1))*Math.sin((e-t)*j/n)),ws=(e,t,n)=>Math.pow(2,-10*e)*Math.sin((e-t)*j/n)+1,De={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>(e-=1)*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-((e-=1)*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>(e-=1)*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*J)+1,easeOutSine:e=>Math.sin(e*J),easeInOutSine:e=>-.5*(Math.cos(I*e)-1),easeInExpo:e=>e===0?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>e===1?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>Qe(e)?e:e<.5?.5*Math.pow(2,10*(e*2-1)):.5*(-Math.pow(2,-10*(e*2-1))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-(e-=1)*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>Qe(e)?e:vs(e,.075,.3),easeOutElastic:e=>Qe(e)?e:ws(e,.075,.3),easeInOutElastic(e){return Qe(e)?e:e<.5?.5*vs(e*2,.1125,.45):.5+.5*ws(e*2-1,.1125,.45)},easeInBack(e){return e*e*((1.70158+1)*e-1.70158)},easeOutBack(e){return(e-=1)*e*((1.70158+1)*e+1.70158)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-De.easeOutBounce(1-e),easeOutBounce(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},easeInOutBounce:e=>e<.5?De.easeInBounce(e*2)*.5:De.easeOutBounce(e*2-1)*.5+.5};function Ti(e){if(e&&typeof e=="object"){const t=e.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function ks(e){return Ti(e)?e:new Le(e)}function jn(e){return Ti(e)?e:new Le(e).saturate(.5).darken(.1).hexString()}const Jd=["x","y","borderWidth","radius","tension"],Kd=["color","borderColor","backgroundColor"];function Gd(e){e.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),e.set("animations",{colors:{type:"color",properties:Kd},numbers:{type:"number",properties:Jd}}),e.describe("animations",{_fallback:"animation"}),e.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function Qd(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const Ss=new Map;function tf(e,t){t=t||{};const n=e+JSON.stringify(t);let i=Ss.get(n);return i||(i=new Intl.NumberFormat(e,t),Ss.set(n,i)),i}function We(e,t,n){return tf(t,n).format(e)}const Rr={values(e){return Z(e)?e:""+e},numeric(e,t,n){if(e===0)return"0";const i=this.chart.options.locale;let s,o=e;if(n.length>1){const l=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(l<1e-4||l>1e15)&&(s="scientific"),o=ef(e,n)}const r=Dt(Math.abs(o)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),c={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(c,this.options.ticks.format),We(e,i,c)},logarithmic(e,t,n){if(e===0)return"0";const i=n[t].significand||e/Math.pow(10,Math.floor(Dt(e)));return[1,2,3,5,10,15].includes(i)||t>.8*n.length?Rr.numeric.call(this,e,t,n):""}};function ef(e,t){let n=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(n)>=1&&e!==Math.floor(e)&&(n=e-Math.floor(e)),n}var Tn={formatters:Rr};function nf(e){e.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,n)=>n.lineWidth,tickColor:(t,n)=>n.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:Tn.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),e.route("scale.ticks","color","","color"),e.route("scale.grid","color","","borderColor"),e.route("scale.border","color","","borderColor"),e.route("scale.title","color","","color"),e.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),e.describe("scales",{_fallback:"scale"}),e.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const ne=Object.create(null),ai=Object.create(null);function Ee(e,t){if(!t)return e;const n=t.split(".");for(let i=0,s=n.length;i<s;++i){const o=n[i];e=e[o]||(e[o]=Object.create(null))}return e}function Vn(e,t,n){return typeof t=="string"?$e(Ee(e,t),n):$e(Ee(e,""),t)}class sf{constructor(t,n){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=i=>i.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(i,s)=>jn(s.backgroundColor),this.hoverBorderColor=(i,s)=>jn(s.borderColor),this.hoverColor=(i,s)=>jn(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(n)}set(t,n){return Vn(this,t,n)}get(t){return Ee(this,t)}describe(t,n){return Vn(ai,t,n)}override(t,n){return Vn(ne,t,n)}route(t,n,i,s){const o=Ee(this,t),r=Ee(this,i),a="_"+n;Object.defineProperties(o,{[a]:{value:o[n],writable:!0},[n]:{enumerable:!0,get(){const c=this[a],l=r[s];return D(c)?Object.assign({},l,c):z(c,l)},set(c){this[a]=c}}})}apply(t){t.forEach(n=>n(this))}}var W=new sf({_scriptable:e=>!e.startsWith("on"),_indexable:e=>e!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Gd,Qd,nf]);function of(e){return!e||A(e.size)||A(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}function xn(e,t,n,i,s){let o=t[s];return o||(o=t[s]=e.measureText(s).width,n.push(s)),o>i&&(i=o),i}function rf(e,t,n,i){i=i||{};let s=i.data=i.data||{},o=i.garbageCollect=i.garbageCollect||[];i.font!==t&&(s=i.data={},o=i.garbageCollect=[],i.font=t),e.save(),e.font=t;let r=0;const a=n.length;let c,l,h,u,d;for(c=0;c<a;c++)if(u=n[c],u!=null&&!Z(u))r=xn(e,s,o,r,u);else if(Z(u))for(l=0,h=u.length;l<h;l++)d=u[l],d!=null&&!Z(d)&&(r=xn(e,s,o,r,d));e.restore();const f=o.length/2;if(f>n.length){for(c=0;c<f;c++)delete s[o[c]];o.splice(0,f)}return r}function Yt(e,t,n){const i=e.currentDevicePixelRatio,s=n!==0?Math.max(n/2,.5):0;return Math.round((t-s)*i)/i+s}function Ms(e,t){!t&&!e||(t=t||e.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function ci(e,t,n,i){Lr(e,t,n,i,null)}function Lr(e,t,n,i,s){let o,r,a,c,l,h,u,d;const f=t.pointStyle,p=t.rotation,g=t.radius;let m=(p||0)*Nd;if(f&&typeof f=="object"&&(o=f.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){e.save(),e.translate(n,i),e.rotate(m),e.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),e.restore();return}if(!(isNaN(g)||g<=0)){switch(e.beginPath(),f){default:s?e.ellipse(n,i,s/2,g,0,0,j):e.arc(n,i,g,0,j),e.closePath();break;case"triangle":h=s?s/2:g,e.moveTo(n+Math.sin(m)*h,i-Math.cos(m)*g),m+=bs,e.lineTo(n+Math.sin(m)*h,i-Math.cos(m)*g),m+=bs,e.lineTo(n+Math.sin(m)*h,i-Math.cos(m)*g),e.closePath();break;case"rectRounded":l=g*.516,c=g-l,r=Math.cos(m+Ut)*c,u=Math.cos(m+Ut)*(s?s/2-l:c),a=Math.sin(m+Ut)*c,d=Math.sin(m+Ut)*(s?s/2-l:c),e.arc(n-u,i-a,l,m-I,m-J),e.arc(n+d,i-r,l,m-J,m),e.arc(n+u,i+a,l,m,m+J),e.arc(n-d,i+r,l,m+J,m+I),e.closePath();break;case"rect":if(!p){c=Math.SQRT1_2*g,h=s?s/2:c,e.rect(n-h,i-c,2*h,2*c);break}m+=Ut;case"rectRot":u=Math.cos(m)*(s?s/2:g),r=Math.cos(m)*g,a=Math.sin(m)*g,d=Math.sin(m)*(s?s/2:g),e.moveTo(n-u,i-a),e.lineTo(n+d,i-r),e.lineTo(n+u,i+a),e.lineTo(n-d,i+r),e.closePath();break;case"crossRot":m+=Ut;case"cross":u=Math.cos(m)*(s?s/2:g),r=Math.cos(m)*g,a=Math.sin(m)*g,d=Math.sin(m)*(s?s/2:g),e.moveTo(n-u,i-a),e.lineTo(n+u,i+a),e.moveTo(n+d,i-r),e.lineTo(n-d,i+r);break;case"star":u=Math.cos(m)*(s?s/2:g),r=Math.cos(m)*g,a=Math.sin(m)*g,d=Math.sin(m)*(s?s/2:g),e.moveTo(n-u,i-a),e.lineTo(n+u,i+a),e.moveTo(n+d,i-r),e.lineTo(n-d,i+r),m+=Ut,u=Math.cos(m)*(s?s/2:g),r=Math.cos(m)*g,a=Math.sin(m)*g,d=Math.sin(m)*(s?s/2:g),e.moveTo(n-u,i-a),e.lineTo(n+u,i+a),e.moveTo(n+d,i-r),e.lineTo(n-d,i+r);break;case"line":r=s?s/2:Math.cos(m)*g,a=Math.sin(m)*g,e.moveTo(n-r,i-a),e.lineTo(n+r,i+a);break;case"dash":e.moveTo(n,i),e.lineTo(n+Math.cos(m)*(s?s/2:g),i+Math.sin(m)*g);break;case!1:e.closePath();break}e.fill(),t.borderWidth>0&&e.stroke()}}function zt(e,t,n){return n=n||.5,!t||e&&e.x>t.left-n&&e.x<t.right+n&&e.y>t.top-n&&e.y<t.bottom+n}function An(e,t){e.save(),e.beginPath(),e.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),e.clip()}function Dn(e){e.restore()}function af(e,t,n,i,s){if(!t)return e.lineTo(n.x,n.y);if(s==="middle"){const o=(t.x+n.x)/2;e.lineTo(o,t.y),e.lineTo(o,n.y)}else s==="after"!=!!i?e.lineTo(t.x,n.y):e.lineTo(n.x,t.y);e.lineTo(n.x,n.y)}function cf(e,t,n,i){if(!t)return e.lineTo(n.x,n.y);e.bezierCurveTo(i?t.cp1x:t.cp2x,i?t.cp1y:t.cp2y,i?n.cp2x:n.cp1x,i?n.cp2y:n.cp1y,n.x,n.y)}function lf(e,t){t.translation&&e.translate(t.translation[0],t.translation[1]),A(t.rotation)||e.rotate(t.rotation),t.color&&(e.fillStyle=t.color),t.textAlign&&(e.textAlign=t.textAlign),t.textBaseline&&(e.textBaseline=t.textBaseline)}function hf(e,t,n,i,s){if(s.strikethrough||s.underline){const o=e.measureText(i),r=t-o.actualBoundingBoxLeft,a=t+o.actualBoundingBoxRight,c=n-o.actualBoundingBoxAscent,l=n+o.actualBoundingBoxDescent,h=s.strikethrough?(c+l)/2:l;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=s.decorationWidth||2,e.moveTo(r,h),e.lineTo(a,h),e.stroke()}}function uf(e,t){const n=e.fillStyle;e.fillStyle=t.color,e.fillRect(t.left,t.top,t.width,t.height),e.fillStyle=n}function ie(e,t,n,i,s,o={}){const r=Z(t)?t:[t],a=o.strokeWidth>0&&o.strokeColor!=="";let c,l;for(e.save(),e.font=s.string,lf(e,o),c=0;c<r.length;++c)l=r[c],o.backdrop&&uf(e,o.backdrop),a&&(o.strokeColor&&(e.strokeStyle=o.strokeColor),A(o.strokeWidth)||(e.lineWidth=o.strokeWidth),e.strokeText(l,n,i,o.maxWidth)),e.fillText(l,n,i,o.maxWidth),hf(e,n,i,l,o),i+=Number(s.lineHeight);e.restore()}function Be(e,t){const{x:n,y:i,w:s,h:o,radius:r}=t;e.arc(n+r.topLeft,i+r.topLeft,r.topLeft,1.5*I,I,!0),e.lineTo(n,i+o-r.bottomLeft),e.arc(n+r.bottomLeft,i+o-r.bottomLeft,r.bottomLeft,I,J,!0),e.lineTo(n+s-r.bottomRight,i+o),e.arc(n+s-r.bottomRight,i+o-r.bottomRight,r.bottomRight,J,0,!0),e.lineTo(n+s,i+r.topRight),e.arc(n+s-r.topRight,i+r.topRight,r.topRight,0,-J,!0),e.lineTo(n+r.topLeft,i)}const df=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,ff=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function pf(e,t){const n=(""+e).match(df);if(!n||n[1]==="normal")return t*1.2;switch(e=+n[2],n[3]){case"px":return e;case"%":e/=100;break}return t*e}const gf=e=>+e||0;function Ai(e,t){const n={},i=D(t),s=i?Object.keys(t):t,o=D(e)?i?r=>z(e[r],e[t[r]]):r=>e[r]:()=>e;for(const r of s)n[r]=gf(o(r));return n}function $r(e){return Ai(e,{top:"y",right:"x",bottom:"y",left:"x"})}function Gt(e){return Ai(e,["topLeft","topRight","bottomLeft","bottomRight"])}function lt(e){const t=$r(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function tt(e,t){e=e||{},t=t||W.font;let n=z(e.size,t.size);typeof n=="string"&&(n=parseInt(n,10));let i=z(e.style,t.style);i&&!(""+i).match(ff)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const s={family:z(e.family,t.family),lineHeight:pf(z(e.lineHeight,t.lineHeight),n),size:n,style:i,weight:z(e.weight,t.weight),string:""};return s.string=of(s),s}function Ce(e,t,n,i){let s,o,r;for(s=0,o=e.length;s<o;++s)if(r=e[s],r!==void 0&&r!==void 0)return r}function mf(e,t,n){const{min:i,max:s}=e,o=Mr(t,(s-i)/2),r=(a,c)=>n&&a===0?0:a+c;return{min:r(i,-Math.abs(o)),max:r(s,o)}}function Vt(e,t){return Object.assign(Object.create(e),t)}function Di(e,t=[""],n,i,s=()=>e[0]){const o=n||e;typeof i>"u"&&(i=jr("_fallback",e));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:o,_fallback:i,_getTarget:s,override:a=>Di([a,...e],t,o,i)};return new Proxy(r,{deleteProperty(a,c){return delete a[c],delete a._keys,delete e[0][c],!0},get(a,c){return Nr(a,c,()=>Sf(c,t,e,a))},getOwnPropertyDescriptor(a,c){return Reflect.getOwnPropertyDescriptor(a._scopes[0],c)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(a,c){return Cs(a).includes(c)},ownKeys(a){return Cs(a)},set(a,c,l){const h=a._storage||(a._storage=s());return a[c]=h[c]=l,delete a._keys,!0}})}function ge(e,t,n,i){const s={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:Fr(e,i),setContext:o=>ge(e,o,n,i),override:o=>ge(e.override(o),t,n,i)};return new Proxy(s,{deleteProperty(o,r){return delete o[r],delete e[r],!0},get(o,r,a){return Nr(o,r,()=>_f(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(e,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,r)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(o,r){return Reflect.has(e,r)},ownKeys(){return Reflect.ownKeys(e)},set(o,r,a){return e[r]=a,delete o[r],!0}})}function Fr(e,t={scriptable:!0,indexable:!0}){const{_scriptable:n=t.scriptable,_indexable:i=t.indexable,_allKeys:s=t.allKeys}=e;return{allKeys:s,scriptable:n,indexable:i,isScriptable:Nt(n)?n:()=>n,isIndexable:Nt(i)?i:()=>i}}const bf=(e,t)=>e?e+Pi(t):t,Ei=(e,t)=>D(t)&&e!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function Nr(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||t==="constructor")return e[t];const i=n();return e[t]=i,i}function _f(e,t,n){const{_proxy:i,_context:s,_subProxy:o,_descriptors:r}=e;let a=i[t];return Nt(a)&&r.isScriptable(t)&&(a=yf(t,a,e,n)),Z(a)&&a.length&&(a=xf(t,a,e,r.isIndexable)),Ei(t,a)&&(a=ge(a,s,o&&o[t],r)),a}function yf(e,t,n,i){const{_proxy:s,_context:o,_subProxy:r,_stack:a}=n;if(a.has(e))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+e);a.add(e);let c=t(o,r||i);return a.delete(e),Ei(e,c)&&(c=Ii(s._scopes,s,e,c)),c}function xf(e,t,n,i){const{_proxy:s,_context:o,_subProxy:r,_descriptors:a}=n;if(typeof o.index<"u"&&i(e))return t[o.index%t.length];if(D(t[0])){const c=t,l=s._scopes.filter(h=>h!==c);t=[];for(const h of c){const u=Ii(l,s,e,h);t.push(ge(u,o,r&&r[e],a))}}return t}function Br(e,t,n){return Nt(e)?e(t,n):e}const vf=(e,t)=>e===!0?t:typeof e=="string"?Ft(t,e):void 0;function wf(e,t,n,i,s){for(const o of t){const r=vf(n,o);if(r){e.add(r);const a=Br(r._fallback,n,s);if(typeof a<"u"&&a!==n&&a!==i)return a}else if(r===!1&&typeof i<"u"&&n!==i)return null}return!1}function Ii(e,t,n,i){const s=t._rootScopes,o=Br(t._fallback,n,i),r=[...e,...s],a=new Set;a.add(i);let c=Ps(a,r,n,o||n,i);return c===null||typeof o<"u"&&o!==n&&(c=Ps(a,r,o,c,i),c===null)?!1:Di(Array.from(a),[""],s,o,()=>kf(t,n,i))}function Ps(e,t,n,i,s){for(;n;)n=wf(e,t,n,i,s);return n}function kf(e,t,n){const i=e._getTarget();t in i||(i[t]={});const s=i[t];return Z(s)&&D(n)?n:s||{}}function Sf(e,t,n,i){let s;for(const o of t)if(s=jr(bf(o,e),n),typeof s<"u")return Ei(e,s)?Ii(n,i,e,s):s}function jr(e,t){for(const n of t){if(!n)continue;const i=n[e];if(typeof i<"u")return i}}function Cs(e){let t=e._keys;return t||(t=e._keys=Mf(e._scopes)),t}function Mf(e){const t=new Set;for(const n of e)for(const i of Object.keys(n).filter(s=>!s.startsWith("_")))t.add(i);return Array.from(t)}function Vr(e,t,n,i){const{iScale:s}=e,{key:o="r"}=this._parsing,r=new Array(i);let a,c,l,h;for(a=0,c=i;a<c;++a)l=a+n,h=t[l],r[a]={r:s.parse(Ft(h,o),l)};return r}const Pf=Number.EPSILON||1e-14,me=(e,t)=>t<e.length&&!e[t].skip&&e[t],Zr=e=>e==="x"?"y":"x";function Cf(e,t,n,i){const s=e.skip?t:e,o=t,r=n.skip?t:n,a=ri(o,s),c=ri(r,o);let l=a/(a+c),h=c/(a+c);l=isNaN(l)?0:l,h=isNaN(h)?0:h;const u=i*l,d=i*h;return{previous:{x:o.x-u*(r.x-s.x),y:o.y-u*(r.y-s.y)},next:{x:o.x+d*(r.x-s.x),y:o.y+d*(r.y-s.y)}}}function Of(e,t,n){const i=e.length;let s,o,r,a,c,l=me(e,0);for(let h=0;h<i-1;++h)if(c=l,l=me(e,h+1),!(!c||!l)){if(Ae(t[h],0,Pf)){n[h]=n[h+1]=0;continue}s=n[h]/t[h],o=n[h+1]/t[h],a=Math.pow(s,2)+Math.pow(o,2),!(a<=9)&&(r=3/Math.sqrt(a),n[h]=s*r*t[h],n[h+1]=o*r*t[h])}}function zf(e,t,n="x"){const i=Zr(n),s=e.length;let o,r,a,c=me(e,0);for(let l=0;l<s;++l){if(r=a,a=c,c=me(e,l+1),!a)continue;const h=a[n],u=a[i];r&&(o=(h-r[n])/3,a[`cp1${n}`]=h-o,a[`cp1${i}`]=u-o*t[l]),c&&(o=(c[n]-h)/3,a[`cp2${n}`]=h+o,a[`cp2${i}`]=u+o*t[l])}}function Tf(e,t="x"){const n=Zr(t),i=e.length,s=Array(i).fill(0),o=Array(i);let r,a,c,l=me(e,0);for(r=0;r<i;++r)if(a=c,c=l,l=me(e,r+1),!!c){if(l){const h=l[t]-c[t];s[r]=h!==0?(l[n]-c[n])/h:0}o[r]=a?l?wt(s[r-1])!==wt(s[r])?0:(s[r-1]+s[r])/2:s[r-1]:s[r]}Of(e,s,o),zf(e,o,t)}function tn(e,t,n){return Math.max(Math.min(e,n),t)}function Af(e,t){let n,i,s,o,r,a=zt(e[0],t);for(n=0,i=e.length;n<i;++n)r=o,o=a,a=n<i-1&&zt(e[n+1],t),o&&(s=e[n],r&&(s.cp1x=tn(s.cp1x,t.left,t.right),s.cp1y=tn(s.cp1y,t.top,t.bottom)),a&&(s.cp2x=tn(s.cp2x,t.left,t.right),s.cp2y=tn(s.cp2y,t.top,t.bottom)))}function Df(e,t,n,i,s){let o,r,a,c;if(t.spanGaps&&(e=e.filter(l=>!l.skip)),t.cubicInterpolationMode==="monotone")Tf(e,s);else{let l=i?e[e.length-1]:e[0];for(o=0,r=e.length;o<r;++o)a=e[o],c=Cf(l,a,e[Math.min(o+1,r-(i?0:1))%r],t.tension),a.cp1x=c.previous.x,a.cp1y=c.previous.y,a.cp2x=c.next.x,a.cp2y=c.next.y,l=a}t.capBezierPoints&&Af(e,n)}function Ri(){return typeof window<"u"&&typeof document<"u"}function Li(e){let t=e.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function vn(e,t,n){let i;return typeof e=="string"?(i=parseInt(e,10),e.indexOf("%")!==-1&&(i=i/100*t.parentNode[n])):i=e,i}const En=e=>e.ownerDocument.defaultView.getComputedStyle(e,null);function Ef(e,t){return En(e).getPropertyValue(t)}const If=["top","right","bottom","left"];function Qt(e,t,n){const i={};n=n?"-"+n:"";for(let s=0;s<4;s++){const o=If[s];i[o]=parseFloat(e[t+"-"+o+n])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const Rf=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function Lf(e,t){const n=e.touches,i=n&&n.length?n[0]:e,{offsetX:s,offsetY:o}=i;let r=!1,a,c;if(Rf(s,o,e.target))a=s,c=o;else{const l=t.getBoundingClientRect();a=i.clientX-l.left,c=i.clientY-l.top,r=!0}return{x:a,y:c,box:r}}function Jt(e,t){if("native"in e)return e;const{canvas:n,currentDevicePixelRatio:i}=t,s=En(n),o=s.boxSizing==="border-box",r=Qt(s,"padding"),a=Qt(s,"border","width"),{x:c,y:l,box:h}=Lf(e,n),u=r.left+(h&&a.left),d=r.top+(h&&a.top);let{width:f,height:p}=t;return o&&(f-=r.width+a.width,p-=r.height+a.height),{x:Math.round((c-u)/f*n.width/i),y:Math.round((l-d)/p*n.height/i)}}function $f(e,t,n){let i,s;if(t===void 0||n===void 0){const o=e&&Li(e);if(!o)t=e.clientWidth,n=e.clientHeight;else{const r=o.getBoundingClientRect(),a=En(o),c=Qt(a,"border","width"),l=Qt(a,"padding");t=r.width-l.width-c.width,n=r.height-l.height-c.height,i=vn(a.maxWidth,o,"clientWidth"),s=vn(a.maxHeight,o,"clientHeight")}}return{width:t,height:n,maxWidth:i||yn,maxHeight:s||yn}}const Et=e=>Math.round(e*10)/10;function Ff(e,t,n,i){const s=En(e),o=Qt(s,"margin"),r=vn(s.maxWidth,e,"clientWidth")||yn,a=vn(s.maxHeight,e,"clientHeight")||yn,c=$f(e,t,n);let{width:l,height:h}=c;if(s.boxSizing==="content-box"){const d=Qt(s,"border","width"),f=Qt(s,"padding");l-=f.width+d.width,h-=f.height+d.height}return l=Math.max(0,l-o.width),h=Math.max(0,i?l/i:h-o.height),l=Et(Math.min(l,r,c.maxWidth)),h=Et(Math.min(h,a,c.maxHeight)),l&&!h&&(h=Et(l/2)),(t!==void 0||n!==void 0)&&i&&c.height&&h>c.height&&(h=c.height,l=Et(Math.floor(h*i))),{width:l,height:h}}function Os(e,t,n){const i=t||1,s=Et(e.height*i),o=Et(e.width*i);e.height=Et(e.height),e.width=Et(e.width);const r=e.canvas;return r.style&&(n||!r.style.height&&!r.style.width)&&(r.style.height=`${e.height}px`,r.style.width=`${e.width}px`),e.currentDevicePixelRatio!==i||r.height!==s||r.width!==o?(e.currentDevicePixelRatio=i,r.height=s,r.width=o,e.ctx.setTransform(i,0,0,i,0,0),!0):!1}const Nf=(function(){let e=!1;try{const t={get passive(){return e=!0,!1}};Ri()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return e})();function zs(e,t){const n=Ef(e,t),i=n&&n.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function Kt(e,t,n,i){return{x:e.x+n*(t.x-e.x),y:e.y+n*(t.y-e.y)}}function Bf(e,t,n,i){return{x:e.x+n*(t.x-e.x),y:i==="middle"?n<.5?e.y:t.y:i==="after"?n<1?e.y:t.y:n>0?t.y:e.y}}function jf(e,t,n,i){const s={x:e.cp2x,y:e.cp2y},o={x:t.cp1x,y:t.cp1y},r=Kt(e,s,n),a=Kt(s,o,n),c=Kt(o,t,n),l=Kt(r,a,n),h=Kt(a,c,n);return Kt(l,h,n)}const Vf=function(e,t){return{x(n){return e+e+t-n},setWidth(n){t=n},textAlign(n){return n==="center"?n:n==="right"?"left":"right"},xPlus(n,i){return n-i},leftForLtr(n,i){return n-i}}},Zf=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function fe(e,t,n){return e?Vf(t,n):Zf()}function Wr(e,t){let n,i;(t==="ltr"||t==="rtl")&&(n=e.canvas.style,i=[n.getPropertyValue("direction"),n.getPropertyPriority("direction")],n.setProperty("direction",t,"important"),e.prevTextDirection=i)}function Hr(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty("direction",t[0],t[1]))}function Ur(e){return e==="angle"?{between:Ne,compare:Zd,normalize:rt}:{between:Ct,compare:(t,n)=>t-n,normalize:t=>t}}function Ts({start:e,end:t,count:n,loop:i,style:s}){return{start:e%n,end:t%n,loop:i&&(t-e+1)%n===0,style:s}}function Wf(e,t,n){const{property:i,start:s,end:o}=n,{between:r,normalize:a}=Ur(i),c=t.length;let{start:l,end:h,loop:u}=e,d,f;if(u){for(l+=c,h+=c,d=0,f=c;d<f&&r(a(t[l%c][i]),s,o);++d)l--,h--;l%=c,h%=c}return h<l&&(h+=c),{start:l,end:h,loop:u,style:e.style}}function Yr(e,t,n){if(!n)return[e];const{property:i,start:s,end:o}=n,r=t.length,{compare:a,between:c,normalize:l}=Ur(i),{start:h,end:u,loop:d,style:f}=Wf(e,t,n),p=[];let g=!1,m=null,b,_,w;const x=()=>c(s,w,b)&&a(s,w)!==0,y=()=>a(o,b)===0||c(o,w,b),k=()=>g||x(),S=()=>!g||y();for(let M=h,P=h;M<=u;++M)_=t[M%r],!_.skip&&(b=l(_[i]),b!==w&&(g=c(b,s,o),m===null&&k()&&(m=a(b,s)===0?M:P),m!==null&&S()&&(p.push(Ts({start:m,end:M,loop:d,count:r,style:f})),m=null),P=M,w=b));return m!==null&&p.push(Ts({start:m,end:u,loop:d,count:r,style:f})),p}function qr(e,t){const n=[],i=e.segments;for(let s=0;s<i.length;s++){const o=Yr(i[s],e.points,t);o.length&&n.push(...o)}return n}function Hf(e,t,n,i){let s=0,o=t-1;if(n&&!i)for(;s<t&&!e[s].skip;)s++;for(;s<t&&e[s].skip;)s++;for(s%=t,n&&(o+=s);o>s&&e[o%t].skip;)o--;return o%=t,{start:s,end:o}}function Uf(e,t,n,i){const s=e.length,o=[];let r=t,a=e[t],c;for(c=t+1;c<=n;++c){const l=e[c%s];l.skip||l.stop?a.skip||(i=!1,o.push({start:t%s,end:(c-1)%s,loop:i}),t=r=l.stop?c:null):(r=c,a.skip&&(t=c)),a=l}return r!==null&&o.push({start:t%s,end:r%s,loop:i}),o}function Yf(e,t){const n=e.points,i=e.options.spanGaps,s=n.length;if(!s)return[];const o=!!e._loop,{start:r,end:a}=Hf(n,s,o,i);if(i===!0)return As(e,[{start:r,end:a,loop:o}],n,t);const c=a<r?a+s:a,l=!!e._fullLoop&&r===0&&a===s-1;return As(e,Uf(n,r,c,l),n,t)}function As(e,t,n,i){return!i||!i.setContext||!n?t:qf(e,t,n,i)}function qf(e,t,n,i){const s=e._chart.getContext(),o=Ds(e.options),{_datasetIndex:r,options:{spanGaps:a}}=e,c=n.length,l=[];let h=o,u=t[0].start,d=u;function f(p,g,m,b){const _=a?-1:1;if(p!==g){for(p+=c;n[p%c].skip;)p-=_;for(;n[g%c].skip;)g+=_;p%c!==g%c&&(l.push({start:p%c,end:g%c,loop:m,style:b}),h=b,u=g%c)}}for(const p of t){u=a?u:p.start;let g=n[u%c],m;for(d=u+1;d<=p.end;d++){const b=n[d%c];m=Ds(i.setContext(Vt(s,{type:"segment",p0:g,p1:b,p0DataIndex:(d-1)%c,p1DataIndex:d%c,datasetIndex:r}))),Xf(m,h)&&f(u,d-1,p.loop,h),g=b,h=m}u<d-1&&f(u,d-1,p.loop,h)}return l}function Ds(e){return{backgroundColor:e.backgroundColor,borderCapStyle:e.borderCapStyle,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderJoinStyle:e.borderJoinStyle,borderWidth:e.borderWidth,borderColor:e.borderColor}}function Xf(e,t){if(!t)return!1;const n=[],i=function(s,o){return Ti(o)?(n.includes(o)||n.push(o),n.indexOf(o)):o};return JSON.stringify(e,i)!==JSON.stringify(t,i)}function en(e,t,n){return e.options.clip?e[n]:t[n]}function Jf(e,t){const{xScale:n,yScale:i}=e;return n&&i?{left:en(n,t,"left"),right:en(n,t,"right"),top:en(i,t,"top"),bottom:en(i,t,"bottom")}:t}function Xr(e,t){const n=t._clip;if(n.disabled)return!1;const i=Jf(t,e.chartArea);return{left:n.left===!1?0:i.left-(n.left===!0?0:n.left),right:n.right===!1?e.width:i.right+(n.right===!0?0:n.right),top:n.top===!1?0:i.top-(n.top===!0?0:n.top),bottom:n.bottom===!1?e.height:i.bottom+(n.bottom===!0?0:n.bottom)}}class Kf{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,n,i,s){const o=n.listeners[s],r=n.duration;o.forEach(a=>a({chart:t,initial:n.initial,numSteps:r,currentStep:Math.min(i-n.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=Ar.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let n=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const o=i.items;let r=o.length-1,a=!1,c;for(;r>=0;--r)c=o[r],c._active?(c._total>i.duration&&(i.duration=c._total),c.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(s.draw(),this._notify(s,i,t,"progress")),o.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),n+=o.length}),this._lastDate=t,n===0&&(this._running=!1)}_getAnims(t){const n=this._charts;let i=n.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(t,i)),i}listen(t,n,i){this._getAnims(t).listeners[n].push(i)}add(t,n){!n||!n.length||this._getAnims(t).items.push(...n)}has(t){return this._getAnims(t).items.length>0}start(t){const n=this._charts.get(t);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const n=this._charts.get(t);return!(!n||!n.running||!n.items.length)}stop(t){const n=this._charts.get(t);if(!n||!n.items.length)return;const i=n.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();n.items=[],this._notify(t,n,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var St=new Kf;const Es="transparent",Gf={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const i=ks(e||Es),s=i.valid&&ks(t||Es);return s&&s.valid?s.mix(i,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class Qf{constructor(t,n,i,s){const o=n[i];s=Ce([t.to,s,o,t.from]);const r=Ce([t.from,o,s]);this._active=!0,this._fn=t.fn||Gf[t.type||typeof r],this._easing=De[t.easing]||De.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=n,this._prop=i,this._from=r,this._to=s,this._promises=void 0}active(){return this._active}update(t,n,i){if(this._active){this._notify(!1);const s=this._target[this._prop],o=i-this._start,r=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=Ce([t.to,n,s,t.from]),this._from=Ce([t.from,s,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const n=t-this._start,i=this._duration,s=this._prop,o=this._from,r=this._loop,a=this._to;let c;if(this._active=o!==a&&(r||n<i),!this._active){this._target[s]=a,this._notify(!0);return}if(n<0){this._target[s]=o;return}c=n/i%2,c=r&&c>1?2-c:c,c=this._easing(Math.min(1,Math.max(0,c))),this._target[s]=this._fn(o,a,c)}wait(){const t=this._promises||(this._promises=[]);return new Promise((n,i)=>{t.push({res:n,rej:i})})}_notify(t){const n=t?"res":"rej",i=this._promises||[];for(let s=0;s<i.length;s++)i[s][n]()}}class Jr{constructor(t,n){this._chart=t,this._properties=new Map,this.configure(n)}configure(t){if(!D(t))return;const n=Object.keys(W.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{const o=t[s];if(!D(o))return;const r={};for(const a of n)r[a]=o[a];(Z(o.properties)&&o.properties||[s]).forEach(a=>{(a===s||!i.has(a))&&i.set(a,r)})})}_animateOptions(t,n){const i=n.options,s=ep(t,i);if(!s)return[];const o=this._createAnimations(s,i);return i.$shared&&tp(t.options.$animations,i).then(()=>{t.options=i},()=>{}),o}_createAnimations(t,n){const i=this._properties,s=[],o=t.$animations||(t.$animations={}),r=Object.keys(n),a=Date.now();let c;for(c=r.length-1;c>=0;--c){const l=r[c];if(l.charAt(0)==="$")continue;if(l==="options"){s.push(...this._animateOptions(t,n));continue}const h=n[l];let u=o[l];const d=i.get(l);if(u)if(d&&u.active()){u.update(d,h,a);continue}else u.cancel();if(!d||!d.duration){t[l]=h;continue}o[l]=u=new Qf(d,t,l,h),s.push(u)}return s}update(t,n){if(this._properties.size===0){Object.assign(t,n);return}const i=this._createAnimations(t,n);if(i.length)return St.add(this._chart,i),!0}}function tp(e,t){const n=[],i=Object.keys(t);for(let s=0;s<i.length;s++){const o=e[i[s]];o&&o.active()&&n.push(o.wait())}return Promise.all(n)}function ep(e,t){if(!t)return;let n=e.options;if(!n){e.options=t;return}return n.$shared&&(e.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function Is(e,t){const n=e&&e.options||{},i=n.reverse,s=n.min===void 0?t:0,o=n.max===void 0?t:0;return{start:i?o:s,end:i?s:o}}function np(e,t,n){if(n===!1)return!1;const i=Is(e,n),s=Is(t,n);return{top:s.end,right:i.end,bottom:s.start,left:i.start}}function ip(e){let t,n,i,s;return D(e)?(t=e.top,n=e.right,i=e.bottom,s=e.left):t=n=i=s=e,{top:t,right:n,bottom:i,left:s,disabled:e===!1}}function Kr(e,t){const n=[],i=e._getSortedDatasetMetas(t);let s,o;for(s=0,o=i.length;s<o;++s)n.push(i[s].index);return n}function Rs(e,t,n,i={}){const s=e.keys,o=i.mode==="single";let r,a,c,l;if(t===null)return;let h=!1;for(r=0,a=s.length;r<a;++r){if(c=+s[r],c===n){if(h=!0,i.all)continue;break}l=e.values[c],q(l)&&(o||t===0||wt(t)===wt(l))&&(t+=l)}return!h&&!i.all?0:t}function sp(e,t){const{iScale:n,vScale:i}=t,s=n.axis==="x"?"x":"y",o=i.axis==="x"?"x":"y",r=Object.keys(e),a=new Array(r.length);let c,l,h;for(c=0,l=r.length;c<l;++c)h=r[c],a[c]={[s]:h,[o]:e[h]};return a}function Zn(e,t){const n=e&&e.options.stacked;return n||n===void 0&&t.stack!==void 0}function op(e,t,n){return`${e.id}.${t.id}.${n.stack||n.type}`}function rp(e){const{min:t,max:n,minDefined:i,maxDefined:s}=e.getUserBounds();return{min:i?t:Number.NEGATIVE_INFINITY,max:s?n:Number.POSITIVE_INFINITY}}function ap(e,t,n){const i=e[t]||(e[t]={});return i[n]||(i[n]={})}function Ls(e,t,n,i){for(const s of t.getMatchingVisibleMetas(i).reverse()){const o=e[s.index];if(n&&o>0||!n&&o<0)return s.index}return null}function $s(e,t){const{chart:n,_cachedMeta:i}=e,s=n._stacks||(n._stacks={}),{iScale:o,vScale:r,index:a}=i,c=o.axis,l=r.axis,h=op(o,r,i),u=t.length;let d;for(let f=0;f<u;++f){const p=t[f],{[c]:g,[l]:m}=p,b=p._stacks||(p._stacks={});d=b[l]=ap(s,h,g),d[a]=m,d._top=Ls(d,r,!0,i.type),d._bottom=Ls(d,r,!1,i.type);const _=d._visualValues||(d._visualValues={});_[a]=m}}function Wn(e,t){const n=e.scales;return Object.keys(n).filter(i=>n[i].axis===t).shift()}function cp(e,t){return Vt(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function lp(e,t,n){return Vt(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function xe(e,t){const n=e.controller.index,i=e.vScale&&e.vScale.axis;if(i){t=t||e._parsed;for(const s of t){const o=s._stacks;if(!o||o[i]===void 0||o[i][n]===void 0)return;delete o[i][n],o[i]._visualValues!==void 0&&o[i]._visualValues[n]!==void 0&&delete o[i]._visualValues[n]}}}const Hn=e=>e==="reset"||e==="none",Fs=(e,t)=>t?e:Object.assign({},e),hp=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:Kr(n,!0),values:null};class Zt{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,n){this.chart=t,this._ctx=t.ctx,this.index=n,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=Zn(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&&xe(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,n=this._cachedMeta,i=this.getDataset(),s=(u,d,f,p)=>u==="x"?d:u==="r"?p:f,o=n.xAxisID=z(i.xAxisID,Wn(t,"x")),r=n.yAxisID=z(i.yAxisID,Wn(t,"y")),a=n.rAxisID=z(i.rAxisID,Wn(t,"r")),c=n.indexAxis,l=n.iAxisID=s(c,o,r,a),h=n.vAxisID=s(c,r,o,a);n.xScale=this.getScaleForId(o),n.yScale=this.getScaleForId(r),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(l),n.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const n=this._cachedMeta;return t===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&xs(this._data,this),t._stacked&&xe(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),i=this._data;if(D(n)){const s=this._cachedMeta;this._data=sp(n,s)}else if(i!==n){if(i){xs(i,this);const s=this._cachedMeta;xe(s),s._parsed=[]}n&&Object.isExtensible(n)&&Yd(n,this),this._syncList=[],this._data=n}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const n=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const o=n._stacked;n._stacked=Zn(n.vScale,n),n.stack!==i.stack&&(s=!0,xe(n),n.stack=i.stack),this._resyncElements(t),(s||o!==n._stacked)&&($s(this,n._parsed),n._stacked=Zn(n.vScale,n))}configure(){const t=this.chart.config,n=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),n,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,n){const{_cachedMeta:i,_data:s}=this,{iScale:o,_stacked:r}=i,a=o.axis;let c=t===0&&n===s.length?!0:i._sorted,l=t>0&&i._parsed[t-1],h,u,d;if(this._parsing===!1)i._parsed=s,i._sorted=!0,d=s;else{Z(s[t])?d=this.parseArrayData(i,s,t,n):D(s[t])?d=this.parseObjectData(i,s,t,n):d=this.parsePrimitiveData(i,s,t,n);const f=()=>u[a]===null||l&&u[a]<l[a];for(h=0;h<n;++h)i._parsed[h+t]=u=d[h],c&&(f()&&(c=!1),l=u);i._sorted=c}r&&$s(this,d)}parsePrimitiveData(t,n,i,s){const{iScale:o,vScale:r}=t,a=o.axis,c=r.axis,l=o.getLabels(),h=o===r,u=new Array(s);let d,f,p;for(d=0,f=s;d<f;++d)p=d+i,u[d]={[a]:h||o.parse(l[p],p),[c]:r.parse(n[p],p)};return u}parseArrayData(t,n,i,s){const{xScale:o,yScale:r}=t,a=new Array(s);let c,l,h,u;for(c=0,l=s;c<l;++c)h=c+i,u=n[h],a[c]={x:o.parse(u[0],h),y:r.parse(u[1],h)};return a}parseObjectData(t,n,i,s){const{xScale:o,yScale:r}=t,{xAxisKey:a="x",yAxisKey:c="y"}=this._parsing,l=new Array(s);let h,u,d,f;for(h=0,u=s;h<u;++h)d=h+i,f=n[d],l[h]={x:o.parse(Ft(f,a),d),y:r.parse(Ft(f,c),d)};return l}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,n,i){const s=this.chart,o=this._cachedMeta,r=n[t.axis],a={keys:Kr(s,!0),values:n._stacks[t.axis]._visualValues};return Rs(a,r,o.index,{mode:i})}updateRangeFromParsed(t,n,i,s){const o=i[n.axis];let r=o===null?NaN:o;const a=s&&i._stacks[n.axis];s&&a&&(s.values=a,r=Rs(s,o,this._cachedMeta.index)),t.min=Math.min(t.min,r),t.max=Math.max(t.max,r)}getMinMax(t,n){const i=this._cachedMeta,s=i._parsed,o=i._sorted&&t===i.iScale,r=s.length,a=this._getOtherScale(t),c=hp(n,i,this.chart),l={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:h,max:u}=rp(a);let d,f;function p(){f=s[d];const g=f[a.axis];return!q(f[t.axis])||h>g||u<g}for(d=0;d<r&&!(!p()&&(this.updateRangeFromParsed(l,t,f,c),o));++d);if(o){for(d=r-1;d>=0;--d)if(!p()){this.updateRangeFromParsed(l,t,f,c);break}}return l}getAllParsedValues(t){const n=this._cachedMeta._parsed,i=[];let s,o,r;for(s=0,o=n.length;s<o;++s)r=n[s][t.axis],q(r)&&i.push(r);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const n=this._cachedMeta,i=n.iScale,s=n.vScale,o=this.getParsed(t);return{label:i?""+i.getLabelForValue(o[i.axis]):"",value:s?""+s.getLabelForValue(o[s.axis]):""}}_update(t){const n=this._cachedMeta;this.update(t||"default"),n._clip=ip(z(this.options.clip,np(n.xScale,n.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,n=this.chart,i=this._cachedMeta,s=i.data||[],o=n.chartArea,r=[],a=this._drawStart||0,c=this._drawCount||s.length-a,l=this.options.drawActiveElementsOnTop;let h;for(i.dataset&&i.dataset.draw(t,o,a,c),h=a;h<a+c;++h){const u=s[h];u.hidden||(u.active&&l?r.push(u):u.draw(t,o))}for(h=0;h<r.length;++h)r[h].draw(t,o)}getStyle(t,n){const i=n?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,n,i){const s=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const r=this._cachedMeta.data[t];o=r.$context||(r.$context=lp(this.getContext(),t,r)),o.parsed=this.getParsed(t),o.raw=s.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=cp(this.chart.getContext(),this.index)),o.dataset=s,o.index=o.datasetIndex=this.index;return o.active=!!n,o.mode=i,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,n){return this._resolveElementOptions(this.dataElementType.id,n,t)}_resolveElementOptions(t,n="default",i){const s=n==="active",o=this._cachedDataOpts,r=t+"-"+n,a=o[r],c=this.enableOptionSharing&&Fe(i);if(a)return Fs(a,c);const l=this.chart.config,h=l.datasetElementScopeKeys(this._type,t),u=s?[`${t}Hover`,"hover",t,""]:[t,""],d=l.getOptionScopes(this.getDataset(),h),f=Object.keys(W.elements[t]),p=()=>this.getContext(i,s,n),g=l.resolveNamedOptions(d,f,p,u);return g.$shared&&(g.$shared=c,o[r]=Object.freeze(Fs(g,c))),g}_resolveAnimations(t,n,i){const s=this.chart,o=this._cachedDataOpts,r=`animation-${n}`,a=o[r];if(a)return a;let c;if(s.options.animation!==!1){const h=this.chart.config,u=h.datasetAnimationScopeKeys(this._type,n),d=h.getOptionScopes(this.getDataset(),u);c=h.createResolver(d,this.getContext(t,i,n))}const l=new Jr(s,c&&c.animations);return c&&c._cacheable&&(o[r]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||Hn(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){const i=this.resolveDataElementOptions(t,n),s=this._sharedOptions,o=this.getSharedOptions(i),r=this.includeOptions(n,o)||o!==s;return this.updateSharedOptions(o,n,i),{sharedOptions:o,includeOptions:r}}updateElement(t,n,i,s){Hn(s)?Object.assign(t,i):this._resolveAnimations(n,s).update(t,i)}updateSharedOptions(t,n,i){t&&!Hn(n)&&this._resolveAnimations(void 0,n).update(t,i)}_setStyle(t,n,i,s){t.active=s;const o=this.getStyle(n,s);this._resolveAnimations(n,i,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,n,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,n,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 n=this._data,i=this._cachedMeta.data;for(const[a,c,l]of this._syncList)this[a](c,l);this._syncList=[];const s=i.length,o=n.length,r=Math.min(o,s);r&&this.parse(0,r),o>s?this._insertElements(s,o-s,t):o<s&&this._removeElements(o,s-o)}_insertElements(t,n,i=!0){const s=this._cachedMeta,o=s.data,r=t+n;let a;const c=l=>{for(l.length+=n,a=l.length-1;a>=r;a--)l[a]=l[a-n]};for(c(o),a=t;a<r;++a)o[a]=new this.dataElementType;this._parsing&&c(s._parsed),this.parse(t,n),i&&this.updateElements(o,t,n,"reset")}updateElements(t,n,i,s){}_removeElements(t,n){const i=this._cachedMeta;if(this._parsing){const s=i._parsed.splice(t,n);i._stacked&&xe(i,s)}i.data.splice(t,n)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[n,i,s]=t;this[n](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,n){n&&this._sync(["_removeElements",t,n]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function up(e,t){if(!e._cache.$bar){const n=e.getMatchingVisibleMetas(t);let i=[];for(let s=0,o=n.length;s<o;s++)i=i.concat(n[s].controller.getAllParsedValues(e));e._cache.$bar=Tr(i.sort((s,o)=>s-o))}return e._cache.$bar}function dp(e){const t=e.iScale,n=up(t,e.type);let i=t._length,s,o,r,a;const c=()=>{r===32767||r===-32768||(Fe(a)&&(i=Math.min(i,Math.abs(r-a)||i)),a=r)};for(s=0,o=n.length;s<o;++s)r=t.getPixelForValue(n[s]),c();for(a=void 0,s=0,o=t.ticks.length;s<o;++s)r=t.getPixelForTick(s),c();return i}function fp(e,t,n,i){const s=n.barThickness;let o,r;return A(s)?(o=t.min*n.categoryPercentage,r=n.barPercentage):(o=s*i,r=1),{chunk:o/i,ratio:r,start:t.pixels[e]-o/2}}function pp(e,t,n,i){const s=t.pixels,o=s[e];let r=e>0?s[e-1]:null,a=e<s.length-1?s[e+1]:null;const c=n.categoryPercentage;r===null&&(r=o-(a===null?t.end-t.start:a-o)),a===null&&(a=o+o-r);const l=o-(o-Math.min(r,a))/2*c;return{chunk:Math.abs(a-r)/2*c/i,ratio:n.barPercentage,start:l}}function gp(e,t,n,i){const s=n.parse(e[0],i),o=n.parse(e[1],i),r=Math.min(s,o),a=Math.max(s,o);let c=r,l=a;Math.abs(r)>Math.abs(a)&&(c=a,l=r),t[n.axis]=l,t._custom={barStart:c,barEnd:l,start:s,end:o,min:r,max:a}}function Gr(e,t,n,i){return Z(e)?gp(e,t,n,i):t[n.axis]=n.parse(e,i),t}function Ns(e,t,n,i){const s=e.iScale,o=e.vScale,r=s.getLabels(),a=s===o,c=[];let l,h,u,d;for(l=n,h=n+i;l<h;++l)d=t[l],u={},u[s.axis]=a||s.parse(r[l],l),c.push(Gr(d,u,o,l));return c}function Un(e){return e&&e.barStart!==void 0&&e.barEnd!==void 0}function mp(e,t,n){return e!==0?wt(e):(t.isHorizontal()?1:-1)*(t.min>=n?1:-1)}function bp(e){let t,n,i,s,o;return e.horizontal?(t=e.base>e.x,n="left",i="right"):(t=e.base<e.y,n="bottom",i="top"),t?(s="end",o="start"):(s="start",o="end"),{start:n,end:i,reverse:t,top:s,bottom:o}}function _p(e,t,n,i){let s=t.borderSkipped;const o={};if(!s){e.borderSkipped=o;return}if(s===!0){e.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:r,end:a,reverse:c,top:l,bottom:h}=bp(e);s==="middle"&&n&&(e.enableBorderRadius=!0,(n._top||0)===i?s=l:(n._bottom||0)===i?s=h:(o[Bs(h,r,a,c)]=!0,s=l)),o[Bs(s,r,a,c)]=!0,e.borderSkipped=o}function Bs(e,t,n,i){return i?(e=yp(e,t,n),e=js(e,n,t)):e=js(e,t,n),e}function yp(e,t,n){return e===t?n:e===n?t:e}function js(e,t,n){return e==="start"?t:e==="end"?n:e}function xp(e,{inflateAmount:t},n){e.inflateAmount=t==="auto"?n===1?.33:0:t}class vp extends Zt{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,n,i,s){return Ns(t,n,i,s)}parseArrayData(t,n,i,s){return Ns(t,n,i,s)}parseObjectData(t,n,i,s){const{iScale:o,vScale:r}=t,{xAxisKey:a="x",yAxisKey:c="y"}=this._parsing,l=o.axis==="x"?a:c,h=r.axis==="x"?a:c,u=[];let d,f,p,g;for(d=i,f=i+s;d<f;++d)g=n[d],p={},p[o.axis]=o.parse(Ft(g,l),d),u.push(Gr(Ft(g,h),p,r,d));return u}updateRangeFromParsed(t,n,i,s){super.updateRangeFromParsed(t,n,i,s);const o=i._custom;o&&n===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const n=this._cachedMeta,{iScale:i,vScale:s}=n,o=this.getParsed(t),r=o._custom,a=Un(r)?"["+r.start+", "+r.end+"]":""+s.getLabelForValue(o[s.axis]);return{label:""+i.getLabelForValue(o[i.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();const t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){const n=this._cachedMeta;this.updateElements(n.data,0,n.data.length,t)}updateElements(t,n,i,s){const o=s==="reset",{index:r,_cachedMeta:{vScale:a}}=this,c=a.getBasePixel(),l=a.isHorizontal(),h=this._getRuler(),{sharedOptions:u,includeOptions:d}=this._getSharedOptions(n,s);for(let f=n;f<n+i;f++){const p=this.getParsed(f),g=o||A(p[a.axis])?{base:c,head:c}:this._calculateBarValuePixels(f),m=this._calculateBarIndexPixels(f,h),b=(p._stacks||{})[a.axis],_={horizontal:l,base:g.base,enableBorderRadius:!b||Un(p._custom)||r===b._top||r===b._bottom,x:l?g.head:m.center,y:l?m.center:g.head,height:l?m.size:Math.abs(g.size),width:l?Math.abs(g.size):m.size};d&&(_.options=u||this.resolveDataElementOptions(f,t[f].active?"active":s));const w=_.options||t[f].options;_p(_,w,b,r),xp(_,w,h.ratio),this.updateElement(t[f],f,_,s)}}_getStacks(t,n){const{iScale:i}=this._cachedMeta,s=i.getMatchingVisibleMetas(this._type).filter(h=>h.controller.options.grouped),o=i.options.stacked,r=[],a=this._cachedMeta.controller.getParsed(n),c=a&&a[i.axis],l=h=>{const u=h._parsed.find(f=>f[i.axis]===c),d=u&&u[h.vScale.axis];if(A(d)||isNaN(d))return!0};for(const h of s)if(!(n!==void 0&&l(h))&&((o===!1||r.indexOf(h.stack)===-1||o===void 0&&h.stack===void 0)&&r.push(h.stack),h.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const t=this.chart.scales,n=this.chart.options.indexAxis;return Object.keys(t).filter(i=>t[i].axis===n).shift()}_getAxis(){const t={},n=this.getFirstScaleIdForIndexAxis();for(const i of this.chart.data.datasets)t[z(this.chart.options.indexAxis==="x"?i.xAxisID:i.yAxisID,n)]=!0;return Object.keys(t)}_getStackIndex(t,n,i){const s=this._getStacks(t,i),o=n!==void 0?s.indexOf(n):-1;return o===-1?s.length-1:o}_getRuler(){const t=this.options,n=this._cachedMeta,i=n.iScale,s=[];let o,r;for(o=0,r=n.data.length;o<r;++o)s.push(i.getPixelForValue(this.getParsed(o)[i.axis],o));const a=t.barThickness;return{min:a||dp(n),pixels:s,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:a?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:n,_stacked:i,index:s},options:{base:o,minBarLength:r}}=this,a=o||0,c=this.getParsed(t),l=c._custom,h=Un(l);let u=c[n.axis],d=0,f=i?this.applyStack(n,c,i):u,p,g;f!==u&&(d=f-u,f=u),h&&(u=l.barStart,f=l.barEnd-l.barStart,u!==0&&wt(u)!==wt(l.barEnd)&&(d=0),d+=u);const m=!A(o)&&!h?o:d;let b=n.getPixelForValue(m);if(this.chart.getDataVisibility(t)?p=n.getPixelForValue(d+f):p=b,g=p-b,Math.abs(g)<r){g=mp(g,n,a)*r,u===a&&(b-=g/2);const _=n.getPixelForDecimal(0),w=n.getPixelForDecimal(1),x=Math.min(_,w),y=Math.max(_,w);b=Math.max(Math.min(b,y),x),p=b+g,i&&!h&&(c._stacks[n.axis]._visualValues[s]=n.getValueForPixel(p)-n.getValueForPixel(b))}if(b===n.getPixelForValue(a)){const _=wt(g)*n.getLineWidthForValue(a)/2;b+=_,g-=_}return{size:g,base:b,head:p,center:p+g/2}}_calculateBarIndexPixels(t,n){const i=n.scale,s=this.options,o=s.skipNull,r=z(s.maxBarThickness,1/0);let a,c;const l=this._getAxisCount();if(n.grouped){const h=o?this._getStackCount(t):n.stackCount,u=s.barThickness==="flex"?pp(t,n,s,h*l):fp(t,n,s,h*l),d=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,f=this._getAxis().indexOf(z(d,this.getFirstScaleIdForIndexAxis())),p=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0)+f;a=u.start+u.chunk*p+u.chunk/2,c=Math.min(r,u.chunk*u.ratio)}else a=i.getPixelForValue(this.getParsed(t)[i.axis],t),c=Math.min(r,n.min*n.ratio);return{base:a-c/2,head:a+c/2,center:a,size:c}}draw(){const t=this._cachedMeta,n=t.vScale,i=t.data,s=i.length;let o=0;for(;o<s;++o)this.getParsed(o)[n.axis]!==null&&!i[o].hidden&&i[o].draw(this._ctx)}}class wp extends Zt{static id="bubble";static defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,n,i,s){const o=super.parsePrimitiveData(t,n,i,s);for(let r=0;r<o.length;r++)o[r]._custom=this.resolveDataElementOptions(r+i).radius;return o}parseArrayData(t,n,i,s){const o=super.parseArrayData(t,n,i,s);for(let r=0;r<o.length;r++){const a=n[i+r];o[r]._custom=z(a[2],this.resolveDataElementOptions(r+i).radius)}return o}parseObjectData(t,n,i,s){const o=super.parseObjectData(t,n,i,s);for(let r=0;r<o.length;r++){const a=n[i+r];o[r]._custom=z(a&&a.r&&+a.r,this.resolveDataElementOptions(r+i).radius)}return o}getMaxOverflow(){const t=this._cachedMeta.data;let n=0;for(let i=t.length-1;i>=0;--i)n=Math.max(n,t[i].size(this.resolveDataElementOptions(i))/2);return n>0&&n}getLabelAndValue(t){const n=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:o}=n,r=this.getParsed(t),a=s.getLabelForValue(r.x),c=o.getLabelForValue(r.y),l=r._custom;return{label:i[t]||"",value:"("+a+", "+c+(l?", "+l:"")+")"}}update(t){const n=this._cachedMeta.data;this.updateElements(n,0,n.length,t)}updateElements(t,n,i,s){const o=s==="reset",{iScale:r,vScale:a}=this._cachedMeta,{sharedOptions:c,includeOptions:l}=this._getSharedOptions(n,s),h=r.axis,u=a.axis;for(let d=n;d<n+i;d++){const f=t[d],p=!o&&this.getParsed(d),g={},m=g[h]=o?r.getPixelForDecimal(.5):r.getPixelForValue(p[h]),b=g[u]=o?a.getBasePixel():a.getPixelForValue(p[u]);g.skip=isNaN(m)||isNaN(b),l&&(g.options=c||this.resolveDataElementOptions(d,f.active?"active":s),o&&(g.options.radius=0)),this.updateElement(f,d,g,s)}}resolveDataElementOptions(t,n){const i=this.getParsed(t);let s=super.resolveDataElementOptions(t,n);s.$shared&&(s=Object.assign({},s,{$shared:!1}));const o=s.radius;return n!=="active"&&(s.radius=0),s.radius+=z(i&&i._custom,o),s}}function kp(e,t,n){let i=1,s=1,o=0,r=0;if(t<j){const a=e,c=a+t,l=Math.cos(a),h=Math.sin(a),u=Math.cos(c),d=Math.sin(c),f=(w,x,y)=>Ne(w,a,c,!0)?1:Math.max(x,x*n,y,y*n),p=(w,x,y)=>Ne(w,a,c,!0)?-1:Math.min(x,x*n,y,y*n),g=f(0,l,u),m=f(J,h,d),b=p(I,l,u),_=p(I+J,h,d);i=(g-b)/2,s=(m-_)/2,o=-(g+b)/2,r=-(m+_)/2}return{ratioX:i,ratioY:s,offsetX:o,offsetY:r}}class $i extends Zt{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const n=t.data,{labels:{pointStyle:i,textAlign:s,color:o,useBorderRadius:r,borderRadius:a}}=t.legend.options;return n.labels.length&&n.datasets.length?n.labels.map((c,l)=>{const u=t.getDatasetMeta(0).controller.getStyle(l);return{text:c,fillStyle:u.backgroundColor,fontColor:o,hidden:!t.getDataVisibility(l),lineDash:u.borderDash,lineDashOffset:u.borderDashOffset,lineJoin:u.borderJoinStyle,lineWidth:u.borderWidth,strokeStyle:u.borderColor,textAlign:s,pointStyle:i,borderRadius:r&&(a||u.borderRadius),index:l}}):[]}},onClick(t,n,i){i.chart.toggleDataVisibility(n.index),i.chart.update()}}}};constructor(t,n){super(t,n),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,n){const i=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=i;else{let o=c=>+i[c];if(D(i[t])){const{key:c="value"}=this._parsing;o=l=>+Ft(i[l],c)}let r,a;for(r=t,a=t+n;r<a;++r)s._parsed[r]=o(r)}}_getRotation(){return yt(this.options.rotation-90)}_getCircumference(){return yt(this.options.circumference)}_getRotationExtents(){let t=j,n=-j;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)&&this.chart.getDatasetMeta(i).type===this._type){const s=this.chart.getDatasetMeta(i).controller,o=s._getRotation(),r=s._getCircumference();t=Math.min(t,o),n=Math.max(n,o+r)}return{rotation:t,circumference:n-t}}update(t){const n=this.chart,{chartArea:i}=n,s=this._cachedMeta,o=s.data,r=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,a=Math.max((Math.min(i.width,i.height)-r)/2,0),c=Math.min(Dd(this.options.cutout,a),1),l=this._getRingWeight(this.index),{circumference:h,rotation:u}=this._getRotationExtents(),{ratioX:d,ratioY:f,offsetX:p,offsetY:g}=kp(u,h,c),m=(i.width-r)/d,b=(i.height-r)/f,_=Math.max(Math.min(m,b)/2,0),w=Mr(this.options.radius,_),x=Math.max(w*c,0),y=(w-x)/this._getVisibleDatasetWeightTotal();this.offsetX=p*w,this.offsetY=g*w,s.total=this.calculateTotal(),this.outerRadius=w-y*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-y*l,0),this.updateElements(o,0,o.length,t)}_circumference(t,n){const i=this.options,s=this._cachedMeta,o=this._getCircumference();return n&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||s._parsed[t]===null||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*o/j)}updateElements(t,n,i,s){const o=s==="reset",r=this.chart,a=r.chartArea,l=r.options.animation,h=(a.left+a.right)/2,u=(a.top+a.bottom)/2,d=o&&l.animateScale,f=d?0:this.innerRadius,p=d?0:this.outerRadius,{sharedOptions:g,includeOptions:m}=this._getSharedOptions(n,s);let b=this._getRotation(),_;for(_=0;_<n;++_)b+=this._circumference(_,o);for(_=n;_<n+i;++_){const w=this._circumference(_,o),x=t[_],y={x:h+this.offsetX,y:u+this.offsetY,startAngle:b,endAngle:b+w,circumference:w,outerRadius:p,innerRadius:f};m&&(y.options=g||this.resolveDataElementOptions(_,x.active?"active":s)),b+=w,this.updateElement(x,_,y,s)}}calculateTotal(){const t=this._cachedMeta,n=t.data;let i=0,s;for(s=0;s<n.length;s++){const o=t._parsed[s];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(s)&&!n[s].hidden&&(i+=Math.abs(o))}return i}calculateCircumference(t){const n=this._cachedMeta.total;return n>0&&!isNaN(t)?j*(Math.abs(t)/n):0}getLabelAndValue(t){const n=this._cachedMeta,i=this.chart,s=i.data.labels||[],o=We(n._parsed[t],i.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let n=0;const i=this.chart;let s,o,r,a,c;if(!t){for(s=0,o=i.data.datasets.length;s<o;++s)if(i.isDatasetVisible(s)){r=i.getDatasetMeta(s),t=r.data,a=r.controller;break}}if(!t)return 0;for(s=0,o=t.length;s<o;++s)c=a.resolveDataElementOptions(s),c.borderAlign!=="inner"&&(n=Math.max(n,c.borderWidth||0,c.hoverBorderWidth||0));return n}getMaxOffset(t){let n=0;for(let i=0,s=t.length;i<s;++i){const o=this.resolveDataElementOptions(i);n=Math.max(n,o.offset||0,o.hoverOffset||0)}return n}_getRingWeightOffset(t){let n=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(n+=this._getRingWeight(i));return n}_getRingWeight(t){return Math.max(z(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}class Sp extends Zt{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const n=this._cachedMeta,{dataset:i,data:s=[],_dataset:o}=n,r=this.chart._animationsDisabled;let{start:a,count:c}=Er(n,s,r);this._drawStart=a,this._drawCount=c,Ir(n)&&(a=0,c=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=s;const l=this.resolveDatasetElementOptions(t);this.options.showLine||(l.borderWidth=0),l.segment=this.options.segment,this.updateElement(i,void 0,{animated:!r,options:l},t),this.updateElements(s,a,c,t)}updateElements(t,n,i,s){const o=s==="reset",{iScale:r,vScale:a,_stacked:c,_dataset:l}=this._cachedMeta,{sharedOptions:h,includeOptions:u}=this._getSharedOptions(n,s),d=r.axis,f=a.axis,{spanGaps:p,segment:g}=this.options,m=pe(p)?p:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||o||s==="none",_=n+i,w=t.length;let x=n>0&&this.getParsed(n-1);for(let y=0;y<w;++y){const k=t[y],S=b?k:{};if(y<n||y>=_){S.skip=!0;continue}const M=this.getParsed(y),P=A(M[f]),O=S[d]=r.getPixelForValue(M[d],y),T=S[f]=o||P?a.getBasePixel():a.getPixelForValue(c?this.applyStack(a,M,c):M[f],y);S.skip=isNaN(O)||isNaN(T)||P,S.stop=y>0&&Math.abs(M[d]-x[d])>m,g&&(S.parsed=M,S.raw=l.data[y]),u&&(S.options=h||this.resolveDataElementOptions(y,k.active?"active":s)),b||this.updateElement(k,y,S,s),x=M}}getMaxOverflow(){const t=this._cachedMeta,n=t.dataset,i=n.options&&n.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const o=s[0].size(this.resolveDataElementOptions(0)),r=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,o,r)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}class Qr extends Zt{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const n=t.data;if(n.labels.length&&n.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return n.labels.map((o,r)=>{const c=t.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:c.backgroundColor,strokeStyle:c.borderColor,fontColor:s,lineWidth:c.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(r),index:r}})}return[]}},onClick(t,n,i){i.chart.toggleDataVisibility(n.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,n){super(t,n),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const n=this._cachedMeta,i=this.chart,s=i.data.labels||[],o=We(n._parsed[t].r,i.options.locale);return{label:s[t]||"",value:o}}parseObjectData(t,n,i,s){return Vr.bind(this)(t,n,i,s)}update(t){const n=this._cachedMeta.data;this._updateRadius(),this.updateElements(n,0,n.length,t)}getMinMax(){const t=this._cachedMeta,n={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((i,s)=>{const o=this.getParsed(s).r;!isNaN(o)&&this.chart.getDataVisibility(s)&&(o<n.min&&(n.min=o),o>n.max&&(n.max=o))}),n}_updateRadius(){const t=this.chart,n=t.chartArea,i=t.options,s=Math.min(n.right-n.left,n.bottom-n.top),o=Math.max(s/2,0),r=Math.max(i.cutoutPercentage?o/100*i.cutoutPercentage:1,0),a=(o-r)/t.getVisibleDatasetCount();this.outerRadius=o-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(t,n,i,s){const o=s==="reset",r=this.chart,c=r.options.animation,l=this._cachedMeta.rScale,h=l.xCenter,u=l.yCenter,d=l.getIndexAngle(0)-.5*I;let f=d,p;const g=360/this.countVisibleElements();for(p=0;p<n;++p)f+=this._computeAngle(p,s,g);for(p=n;p<n+i;p++){const m=t[p];let b=f,_=f+this._computeAngle(p,s,g),w=r.getDataVisibility(p)?l.getDistanceFromCenterForValue(this.getParsed(p).r):0;f=_,o&&(c.animateScale&&(w=0),c.animateRotate&&(b=_=d));const x={x:h,y:u,innerRadius:0,outerRadius:w,startAngle:b,endAngle:_,options:this.resolveDataElementOptions(p,m.active?"active":s)};this.updateElement(m,p,x,s)}}countVisibleElements(){const t=this._cachedMeta;let n=0;return t.data.forEach((i,s)=>{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&n++}),n}_computeAngle(t,n,i){return this.chart.getDataVisibility(t)?yt(this.resolveDataElementOptions(t,n).angle||i):0}}class Mp extends $i{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}}class Pp extends Zt{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){const n=this._cachedMeta.vScale,i=this.getParsed(t);return{label:n.getLabels()[t],value:""+n.getLabelForValue(i[n.axis])}}parseObjectData(t,n,i,s){return Vr.bind(this)(t,n,i,s)}update(t){const n=this._cachedMeta,i=n.dataset,s=n.data||[],o=n.iScale.getLabels();if(i.points=s,t!=="resize"){const r=this.resolveDatasetElementOptions(t);this.options.showLine||(r.borderWidth=0);const a={_loop:!0,_fullLoop:o.length===s.length,options:r};this.updateElement(i,void 0,a,t)}this.updateElements(s,0,s.length,t)}updateElements(t,n,i,s){const o=this._cachedMeta.rScale,r=s==="reset";for(let a=n;a<n+i;a++){const c=t[a],l=this.resolveDataElementOptions(a,c.active?"active":s),h=o.getPointPositionForValue(a,this.getParsed(a).r),u=r?o.xCenter:h.x,d=r?o.yCenter:h.y,f={x:u,y:d,angle:h.angle,skip:isNaN(u)||isNaN(d),options:l};this.updateElement(c,a,f,s)}}}class Cp extends Zt{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(t){const n=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:o}=n,r=this.getParsed(t),a=s.getLabelForValue(r.x),c=o.getLabelForValue(r.y);return{label:i[t]||"",value:"("+a+", "+c+")"}}update(t){const n=this._cachedMeta,{data:i=[]}=n,s=this.chart._animationsDisabled;let{start:o,count:r}=Er(n,i,s);if(this._drawStart=o,this._drawCount=r,Ir(n)&&(o=0,r=i.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:a,_dataset:c}=n;a._chart=this.chart,a._datasetIndex=this.index,a._decimated=!!c._decimated,a.points=i;const l=this.resolveDatasetElementOptions(t);l.segment=this.options.segment,this.updateElement(a,void 0,{animated:!s,options:l},t)}else this.datasetElementType&&(delete n.dataset,this.datasetElementType=!1);this.updateElements(i,o,r,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,n,i,s){const o=s==="reset",{iScale:r,vScale:a,_stacked:c,_dataset:l}=this._cachedMeta,h=this.resolveDataElementOptions(n,s),u=this.getSharedOptions(h),d=this.includeOptions(s,u),f=r.axis,p=a.axis,{spanGaps:g,segment:m}=this.options,b=pe(g)?g:Number.POSITIVE_INFINITY,_=this.chart._animationsDisabled||o||s==="none";let w=n>0&&this.getParsed(n-1);for(let x=n;x<n+i;++x){const y=t[x],k=this.getParsed(x),S=_?y:{},M=A(k[p]),P=S[f]=r.getPixelForValue(k[f],x),O=S[p]=o||M?a.getBasePixel():a.getPixelForValue(c?this.applyStack(a,k,c):k[p],x);S.skip=isNaN(P)||isNaN(O)||M,S.stop=x>0&&Math.abs(k[f]-w[f])>b,m&&(S.parsed=k,S.raw=l.data[x]),d&&(S.options=u||this.resolveDataElementOptions(x,y.active?"active":s)),_||this.updateElement(y,x,S,s),w=k}this.updateSharedOptions(u,s,h)}getMaxOverflow(){const t=this._cachedMeta,n=t.data||[];if(!this.options.showLine){let a=0;for(let c=n.length-1;c>=0;--c)a=Math.max(a,n[c].size(this.resolveDataElementOptions(c))/2);return a>0&&a}const i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!n.length)return s;const o=n[0].size(this.resolveDataElementOptions(0)),r=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(s,o,r)/2}}var Op=Object.freeze({__proto__:null,BarController:vp,BubbleController:wp,DoughnutController:$i,LineController:Sp,PieController:Mp,PolarAreaController:Qr,RadarController:Pp,ScatterController:Cp});function qt(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Fi{static override(t){Object.assign(Fi.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return qt()}parse(){return qt()}format(){return qt()}add(){return qt()}diff(){return qt()}startOf(){return qt()}endOf(){return qt()}}var zp={_date:Fi};function Tp(e,t,n,i){const{controller:s,data:o,_sorted:r}=e,a=s._cachedMeta.iScale,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(a&&t===a.axis&&t!=="r"&&r&&o.length){const l=a._reversePixels?Hd:Ot;if(i){if(s._sharedOptions){const h=o[0],u=typeof h.getRange=="function"&&h.getRange(t);if(u){const d=l(o,t,n-u),f=l(o,t,n+u);return{lo:d.lo,hi:f.hi}}}}else{const h=l(o,t,n);if(c){const{vScale:u}=s._cachedMeta,{_parsed:d}=e,f=d.slice(0,h.lo+1).reverse().findIndex(g=>!A(g[u.axis]));h.lo-=Math.max(0,f);const p=d.slice(h.hi).findIndex(g=>!A(g[u.axis]));h.hi+=Math.max(0,p)}return h}}return{lo:0,hi:o.length-1}}function In(e,t,n,i,s){const o=e.getSortedVisibleDatasetMetas(),r=n[t];for(let a=0,c=o.length;a<c;++a){const{index:l,data:h}=o[a],{lo:u,hi:d}=Tp(o[a],t,r,s);for(let f=u;f<=d;++f){const p=h[f];p.skip||i(p,l,f)}}}function Ap(e){const t=e.indexOf("x")!==-1,n=e.indexOf("y")!==-1;return function(i,s){const o=t?Math.abs(i.x-s.x):0,r=n?Math.abs(i.y-s.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(r,2))}}function Yn(e,t,n,i,s){const o=[];return!s&&!e.isPointInArea(t)||In(e,n,t,function(a,c,l){!s&&!zt(a,e.chartArea,0)||a.inRange(t.x,t.y,i)&&o.push({element:a,datasetIndex:c,index:l})},!0),o}function Dp(e,t,n,i){let s=[];function o(r,a,c){const{startAngle:l,endAngle:h}=r.getProps(["startAngle","endAngle"],i),{angle:u}=Or(r,{x:t.x,y:t.y});Ne(u,l,h)&&s.push({element:r,datasetIndex:a,index:c})}return In(e,n,t,o),s}function Ep(e,t,n,i,s,o){let r=[];const a=Ap(n);let c=Number.POSITIVE_INFINITY;function l(h,u,d){const f=h.inRange(t.x,t.y,s);if(i&&!f)return;const p=h.getCenterPoint(s);if(!(!!o||e.isPointInArea(p))&&!f)return;const m=a(t,p);m<c?(r=[{element:h,datasetIndex:u,index:d}],c=m):m===c&&r.push({element:h,datasetIndex:u,index:d})}return In(e,n,t,l),r}function qn(e,t,n,i,s,o){return!o&&!e.isPointInArea(t)?[]:n==="r"&&!i?Dp(e,t,n,s):Ep(e,t,n,i,s,o)}function Vs(e,t,n,i,s){const o=[],r=n==="x"?"inXRange":"inYRange";let a=!1;return In(e,n,t,(c,l,h)=>{c[r]&&c[r](t[n],s)&&(o.push({element:c,datasetIndex:l,index:h}),a=a||c.inRange(t.x,t.y,s))}),i&&!a?[]:o}var Ip={modes:{index(e,t,n,i){const s=Jt(t,e),o=n.axis||"x",r=n.includeInvisible||!1,a=n.intersect?Yn(e,s,o,i,r):qn(e,s,o,!1,i,r),c=[];return a.length?(e.getSortedVisibleDatasetMetas().forEach(l=>{const h=a[0].index,u=l.data[h];u&&!u.skip&&c.push({element:u,datasetIndex:l.index,index:h})}),c):[]},dataset(e,t,n,i){const s=Jt(t,e),o=n.axis||"xy",r=n.includeInvisible||!1;let a=n.intersect?Yn(e,s,o,i,r):qn(e,s,o,!1,i,r);if(a.length>0){const c=a[0].datasetIndex,l=e.getDatasetMeta(c).data;a=[];for(let h=0;h<l.length;++h)a.push({element:l[h],datasetIndex:c,index:h})}return a},point(e,t,n,i){const s=Jt(t,e),o=n.axis||"xy",r=n.includeInvisible||!1;return Yn(e,s,o,i,r)},nearest(e,t,n,i){const s=Jt(t,e),o=n.axis||"xy",r=n.includeInvisible||!1;return qn(e,s,o,n.intersect,i,r)},x(e,t,n,i){const s=Jt(t,e);return Vs(e,s,"x",n.intersect,i)},y(e,t,n,i){const s=Jt(t,e);return Vs(e,s,"y",n.intersect,i)}}};const ta=["left","top","right","bottom"];function ve(e,t){return e.filter(n=>n.pos===t)}function Zs(e,t){return e.filter(n=>ta.indexOf(n.pos)===-1&&n.box.axis===t)}function we(e,t){return e.sort((n,i)=>{const s=t?i:n,o=t?n:i;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function Rp(e){const t=[];let n,i,s,o,r,a;for(n=0,i=(e||[]).length;n<i;++n)s=e[n],{position:o,options:{stack:r,stackWeight:a=1}}=s,t.push({index:n,box:s,pos:o,horizontal:s.isHorizontal(),weight:s.weight,stack:r&&o+r,stackWeight:a});return t}function Lp(e){const t={};for(const n of e){const{stack:i,pos:s,stackWeight:o}=n;if(!i||!ta.includes(s))continue;const r=t[i]||(t[i]={count:0,placed:0,weight:0,size:0});r.count++,r.weight+=o}return t}function $p(e,t){const n=Lp(e),{vBoxMaxWidth:i,hBoxMaxHeight:s}=t;let o,r,a;for(o=0,r=e.length;o<r;++o){a=e[o];const{fullSize:c}=a.box,l=n[a.stack],h=l&&a.stackWeight/l.weight;a.horizontal?(a.width=h?h*i:c&&t.availableWidth,a.height=s):(a.width=i,a.height=h?h*s:c&&t.availableHeight)}return n}function Fp(e){const t=Rp(e),n=we(t.filter(l=>l.box.fullSize),!0),i=we(ve(t,"left"),!0),s=we(ve(t,"right")),o=we(ve(t,"top"),!0),r=we(ve(t,"bottom")),a=Zs(t,"x"),c=Zs(t,"y");return{fullSize:n,leftAndTop:i.concat(o),rightAndBottom:s.concat(c).concat(r).concat(a),chartArea:ve(t,"chartArea"),vertical:i.concat(s).concat(c),horizontal:o.concat(r).concat(a)}}function Ws(e,t,n,i){return Math.max(e[n],t[n])+Math.max(e[i],t[i])}function ea(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function Np(e,t,n,i){const{pos:s,box:o}=n,r=e.maxPadding;if(!D(s)){n.size&&(e[s]-=n.size);const u=i[n.stack]||{size:0,count:1};u.size=Math.max(u.size,n.horizontal?o.height:o.width),n.size=u.size/u.count,e[s]+=n.size}o.getPadding&&ea(r,o.getPadding());const a=Math.max(0,t.outerWidth-Ws(r,e,"left","right")),c=Math.max(0,t.outerHeight-Ws(r,e,"top","bottom")),l=a!==e.w,h=c!==e.h;return e.w=a,e.h=c,n.horizontal?{same:l,other:h}:{same:h,other:l}}function Bp(e){const t=e.maxPadding;function n(i){const s=Math.max(t[i]-e[i],0);return e[i]+=s,s}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}function jp(e,t){const n=t.maxPadding;function i(s){const o={left:0,top:0,right:0,bottom:0};return s.forEach(r=>{o[r]=Math.max(t[r],n[r])}),o}return i(e?["left","right"]:["top","bottom"])}function Oe(e,t,n,i){const s=[];let o,r,a,c,l,h;for(o=0,r=e.length,l=0;o<r;++o){a=e[o],c=a.box,c.update(a.width||t.w,a.height||t.h,jp(a.horizontal,t));const{same:u,other:d}=Np(t,n,a,i);l|=u&&s.length,h=h||d,c.fullSize||s.push(a)}return l&&Oe(s,t,n,i)||h}function nn(e,t,n,i,s){e.top=n,e.left=t,e.right=t+i,e.bottom=n+s,e.width=i,e.height=s}function Hs(e,t,n,i){const s=n.padding;let{x:o,y:r}=t;for(const a of e){const c=a.box,l=i[a.stack]||{placed:0,weight:1},h=a.stackWeight/l.weight||1;if(a.horizontal){const u=t.w*h,d=l.size||c.height;Fe(l.start)&&(r=l.start),c.fullSize?nn(c,s.left,r,n.outerWidth-s.right-s.left,d):nn(c,t.left+l.placed,r,u,d),l.start=r,l.placed+=u,r=c.bottom}else{const u=t.h*h,d=l.size||c.width;Fe(l.start)&&(o=l.start),c.fullSize?nn(c,o,s.top,d,n.outerHeight-s.bottom-s.top):nn(c,o,t.top+l.placed,d,u),l.start=o,l.placed+=u,o=c.right}}t.x=o,t.y=r}var at={addBox(e,t){e.boxes||(e.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(n){t.draw(n)}}]},e.boxes.push(t)},removeBox(e,t){const n=e.boxes?e.boxes.indexOf(t):-1;n!==-1&&e.boxes.splice(n,1)},configure(e,t,n){t.fullSize=n.fullSize,t.position=n.position,t.weight=n.weight},update(e,t,n,i){if(!e)return;const s=lt(e.options.layout.padding),o=Math.max(t-s.width,0),r=Math.max(n-s.height,0),a=Fp(e.boxes),c=a.vertical,l=a.horizontal;$(e.boxes,g=>{typeof g.beforeLayout=="function"&&g.beforeLayout()});const h=c.reduce((g,m)=>m.box.options&&m.box.options.display===!1?g:g+1,0)||1,u=Object.freeze({outerWidth:t,outerHeight:n,padding:s,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/h,hBoxMaxHeight:r/2}),d=Object.assign({},s);ea(d,lt(i));const f=Object.assign({maxPadding:d,w:o,h:r,x:s.left,y:s.top},s),p=$p(c.concat(l),u);Oe(a.fullSize,f,u,p),Oe(c,f,u,p),Oe(l,f,u,p)&&Oe(c,f,u,p),Bp(f),Hs(a.leftAndTop,f,u,p),f.x+=f.w,f.y+=f.h,Hs(a.rightAndBottom,f,u,p),e.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},$(a.chartArea,g=>{const m=g.box;Object.assign(m,e.chartArea),m.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class na{acquireContext(t,n){}releaseContext(t){return!1}addEventListener(t,n,i){}removeEventListener(t,n,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,n,i,s){return n=Math.max(0,n||t.width),i=i||t.height,{width:n,height:Math.max(0,s?Math.floor(n/s):i)}}isAttached(t){return!0}updateConfig(t){}}class Vp extends na{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const un="$chartjs",Zp={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Us=e=>e===null||e==="";function Wp(e,t){const n=e.style,i=e.getAttribute("height"),s=e.getAttribute("width");if(e[un]={initial:{height:i,width:s,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",Us(s)){const o=zs(e,"width");o!==void 0&&(e.width=o)}if(Us(i))if(e.style.height==="")e.height=e.width/(t||2);else{const o=zs(e,"height");o!==void 0&&(e.height=o)}return e}const ia=Nf?{passive:!0}:!1;function Hp(e,t,n){e&&e.addEventListener(t,n,ia)}function Up(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,ia)}function Yp(e,t){const n=Zp[e.type]||e.type,{x:i,y:s}=Jt(e,t);return{type:n,chart:t,native:e,x:i!==void 0?i:null,y:s!==void 0?s:null}}function wn(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function qp(e,t,n){const i=e.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||wn(a.addedNodes,i),r=r&&!wn(a.removedNodes,i);r&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}function Xp(e,t,n){const i=e.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||wn(a.removedNodes,i),r=r&&!wn(a.addedNodes,i);r&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}const je=new Map;let Ys=0;function sa(){const e=window.devicePixelRatio;e!==Ys&&(Ys=e,je.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function Jp(e,t){je.size||window.addEventListener("resize",sa),je.set(e,t)}function Kp(e){je.delete(e),je.size||window.removeEventListener("resize",sa)}function Gp(e,t,n){const i=e.canvas,s=i&&Li(i);if(!s)return;const o=Dr((a,c)=>{const l=s.clientWidth;n(a,c),l<s.clientWidth&&n()},window),r=new ResizeObserver(a=>{const c=a[0],l=c.contentRect.width,h=c.contentRect.height;l===0&&h===0||o(l,h)});return r.observe(s),Jp(e,o),r}function Xn(e,t,n){n&&n.disconnect(),t==="resize"&&Kp(e)}function Qp(e,t,n){const i=e.canvas,s=Dr(o=>{e.ctx!==null&&n(Yp(o,e))},e);return Hp(i,t,s),s}class tg extends na{acquireContext(t,n){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(Wp(t,n),i):null}releaseContext(t){const n=t.canvas;if(!n[un])return!1;const i=n[un].initial;["height","width"].forEach(o=>{const r=i[o];A(r)?n.removeAttribute(o):n.setAttribute(o,r)});const s=i.style||{};return Object.keys(s).forEach(o=>{n.style[o]=s[o]}),n.width=n.width,delete n[un],!0}addEventListener(t,n,i){this.removeEventListener(t,n);const s=t.$proxies||(t.$proxies={}),r={attach:qp,detach:Xp,resize:Gp}[n]||Qp;s[n]=r(t,n,i)}removeEventListener(t,n){const i=t.$proxies||(t.$proxies={}),s=i[n];if(!s)return;({attach:Xn,detach:Xn,resize:Xn}[n]||Up)(t,n,s),i[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,i,s){return Ff(t,n,i,s)}isAttached(t){const n=t&&Li(t);return!!(n&&n.isConnected)}}function eg(e){return!Ri()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?Vp:tg}class Tt{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:n,y:i}=this.getProps(["x","y"],t);return{x:n,y:i}}hasValue(){return pe(this.x)&&pe(this.y)}getProps(t,n){const i=this.$animations;if(!n||!i)return this;const s={};return t.forEach(o=>{s[o]=i[o]&&i[o].active()?i[o]._to:this[o]}),s}}function ng(e,t){const n=e.options.ticks,i=ig(e),s=Math.min(n.maxTicksLimit||i,i),o=n.major.enabled?og(t):[],r=o.length,a=o[0],c=o[r-1],l=[];if(r>s)return rg(t,l,o,r/s),l;const h=sg(o,t,s);if(r>0){let u,d;const f=r>1?Math.round((c-a)/(r-1)):null;for(sn(t,l,h,A(f)?0:a-f,a),u=0,d=r-1;u<d;u++)sn(t,l,h,o[u],o[u+1]);return sn(t,l,h,c,A(f)?t.length:c+f),l}return sn(t,l,h),l}function ig(e){const t=e.options.offset,n=e._tickSize(),i=e._length/n+(t?0:1),s=e._maxLength/n;return Math.floor(Math.min(i,s))}function sg(e,t,n){const i=ag(e),s=t.length/n;if(!i)return Math.max(s,1);const o=Bd(i);for(let r=0,a=o.length-1;r<a;r++){const c=o[r];if(c>s)return c}return Math.max(s,1)}function og(e){const t=[];let n,i;for(n=0,i=e.length;n<i;n++)e[n].major&&t.push(n);return t}function rg(e,t,n,i){let s=0,o=n[0],r;for(i=Math.ceil(i),r=0;r<e.length;r++)r===o&&(t.push(e[r]),s++,o=n[s*i])}function sn(e,t,n,i,s){const o=z(i,0),r=Math.min(z(s,e.length),e.length);let a=0,c,l,h;for(n=Math.ceil(n),s&&(c=s-i,n=c/Math.floor(c/n)),h=o;h<0;)a++,h=Math.round(o+a*n);for(l=Math.max(o,0);l<r;l++)l===h&&(t.push(e[l]),a++,h=Math.round(o+a*n))}function ag(e){const t=e.length;let n,i;if(t<2)return!1;for(i=e[0],n=1;n<t;++n)if(e[n]-e[n-1]!==i)return!1;return i}const cg=e=>e==="left"?"right":e==="right"?"left":e,qs=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,Xs=(e,t)=>Math.min(t||e,e);function Js(e,t){const n=[],i=e.length/t,s=e.length;let o=0;for(;o<s;o+=i)n.push(e[Math.floor(o)]);return n}function lg(e,t,n){const i=e.ticks.length,s=Math.min(t,i-1),o=e._startPixel,r=e._endPixel,a=1e-6;let c=e.getPixelForTick(s),l;if(!(n&&(i===1?l=Math.max(c-o,r-c):t===0?l=(e.getPixelForTick(1)-c)/2:l=(c-e.getPixelForTick(s-1))/2,c+=s<t?l:-l,c<o-a||c>r+a)))return c}function hg(e,t){$(e,n=>{const i=n.gc,s=i.length/2;let o;if(s>t){for(o=0;o<s;++o)delete n.data[i[o]];i.splice(0,s)}})}function ke(e){return e.drawTicks?e.tickLength:0}function Ks(e,t){if(!e.display)return 0;const n=tt(e.font,t),i=lt(e.padding);return(Z(e.text)?e.text.length:1)*n.lineHeight+i.height}function ug(e,t){return Vt(e,{scale:t,type:"scale"})}function dg(e,t,n){return Vt(e,{tick:n,index:t,type:"tick"})}function fg(e,t,n){let i=zi(e);return(n&&t!=="right"||!n&&t==="right")&&(i=cg(i)),i}function pg(e,t,n,i){const{top:s,left:o,bottom:r,right:a,chart:c}=e,{chartArea:l,scales:h}=c;let u=0,d,f,p;const g=r-s,m=a-o;if(e.isHorizontal()){if(f=ot(i,o,a),D(n)){const b=Object.keys(n)[0],_=n[b];p=h[b].getPixelForValue(_)+g-t}else n==="center"?p=(l.bottom+l.top)/2+g-t:p=qs(e,n,t);d=a-o}else{if(D(n)){const b=Object.keys(n)[0],_=n[b];f=h[b].getPixelForValue(_)-m+t}else n==="center"?f=(l.left+l.right)/2-m+t:f=qs(e,n,t);p=ot(i,r,s),u=n==="left"?-J:J}return{titleX:f,titleY:p,maxWidth:d,rotation:u}}class oe extends Tt{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,n){return t}getUserBounds(){let{_userMin:t,_userMax:n,_suggestedMin:i,_suggestedMax:s}=this;return t=gt(t,Number.POSITIVE_INFINITY),n=gt(n,Number.NEGATIVE_INFINITY),i=gt(i,Number.POSITIVE_INFINITY),s=gt(s,Number.NEGATIVE_INFINITY),{min:gt(t,i),max:gt(n,s),minDefined:q(t),maxDefined:q(n)}}getMinMax(t){let{min:n,max:i,minDefined:s,maxDefined:o}=this.getUserBounds(),r;if(s&&o)return{min:n,max:i};const a=this.getMatchingVisibleMetas();for(let c=0,l=a.length;c<l;++c)r=a[c].controller.getMinMax(this,t),s||(n=Math.min(n,r.min)),o||(i=Math.max(i,r.max));return n=o&&n>i?i:n,i=s&&n>i?n:i,{min:gt(n,gt(i,n)),max:gt(i,gt(n,i))}}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(){B(this.options.beforeUpdate,[this])}update(t,n,i){const{beginAtZero:s,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=n,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=mf(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const c=a<this.ticks.length;this._convertTicksToLabels(c?Js(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),r.display&&(r.autoSkip||r.source==="auto")&&(this.ticks=ng(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),c&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,n,i;this.isHorizontal()?(n=this.left,i=this.right):(n=this.top,i=this.bottom,t=!t),this._startPixel=n,this._endPixel=i,this._reversePixels=t,this._length=i-n,this._alignToPixels=this.options.alignToPixels}afterUpdate(){B(this.options.afterUpdate,[this])}beforeSetDimensions(){B(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(){B(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),B(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){B(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const n=this.options.ticks;let i,s,o;for(i=0,s=t.length;i<s;i++)o=t[i],o.label=B(n.callback,[o.value,i,t],this)}afterTickToLabelConversion(){B(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){B(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,n=t.ticks,i=Xs(this.ticks.length,t.ticks.maxTicksLimit),s=n.minRotation||0,o=n.maxRotation;let r=s,a,c,l;if(!this._isVisible()||!n.display||s>=o||i<=1||!this.isHorizontal()){this.labelRotation=s;return}const h=this._getLabelSizes(),u=h.widest.width,d=h.highest.height,f=et(this.chart.width-u,0,this.maxWidth);a=t.offset?this.maxWidth/i:f/(i-1),u+6>a&&(a=f/(i-(t.offset?.5:1)),c=this.maxHeight-ke(t.grid)-n.padding-Ks(t.title,this.chart.options.font),l=Math.sqrt(u*u+d*d),r=Ci(Math.min(Math.asin(et((h.highest.height+6)/a,-1,1)),Math.asin(et(c/l,-1,1))-Math.asin(et(d/l,-1,1)))),r=Math.max(s,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){B(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){B(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:n,options:{ticks:i,title:s,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){const c=Ks(s,n.options.font);if(a?(t.width=this.maxWidth,t.height=ke(o)+c):(t.height=this.maxHeight,t.width=ke(o)+c),i.display&&this.ticks.length){const{first:l,last:h,widest:u,highest:d}=this._getLabelSizes(),f=i.padding*2,p=yt(this.labelRotation),g=Math.cos(p),m=Math.sin(p);if(a){const b=i.mirror?0:m*u.width+g*d.height;t.height=Math.min(this.maxHeight,t.height+b+f)}else{const b=i.mirror?0:g*u.width+m*d.height;t.width=Math.min(this.maxWidth,t.width+b+f)}this._calculatePadding(l,h,m,g)}}this._handleMargins(),a?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,n,i,s){const{ticks:{align:o,padding:r},position:a}=this.options,c=this.labelRotation!==0,l=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,u=this.right-this.getPixelForTick(this.ticks.length-1);let d=0,f=0;c?l?(d=s*t.width,f=i*n.height):(d=i*t.height,f=s*n.width):o==="start"?f=n.width:o==="end"?d=t.width:o!=="inner"&&(d=t.width/2,f=n.width/2),this.paddingLeft=Math.max((d-h+r)*this.width/(this.width-h),0),this.paddingRight=Math.max((f-u+r)*this.width/(this.width-u),0)}else{let h=n.height/2,u=t.height/2;o==="start"?(h=0,u=t.height):o==="end"&&(h=n.height,u=0),this.paddingTop=h+r,this.paddingBottom=u+r}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){B(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:n}=this.options;return n==="top"||n==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let n,i;for(n=0,i=t.length;n<i;n++)A(t[n].label)&&(t.splice(n,1),i--,n--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const n=this.options.ticks.sampleSize;let i=this.ticks;n<i.length&&(i=Js(i,n)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,n,i){const{ctx:s,_longestTextCache:o}=this,r=[],a=[],c=Math.floor(n/Xs(n,i));let l=0,h=0,u,d,f,p,g,m,b,_,w,x,y;for(u=0;u<n;u+=c){if(p=t[u].label,g=this._resolveTickFontOptions(u),s.font=m=g.string,b=o[m]=o[m]||{data:{},gc:[]},_=g.lineHeight,w=x=0,!A(p)&&!Z(p))w=xn(s,b.data,b.gc,w,p),x=_;else if(Z(p))for(d=0,f=p.length;d<f;++d)y=p[d],!A(y)&&!Z(y)&&(w=xn(s,b.data,b.gc,w,y),x+=_);r.push(w),a.push(x),l=Math.max(w,l),h=Math.max(x,h)}hg(o,n);const k=r.indexOf(l),S=a.indexOf(h),M=P=>({width:r[P]||0,height:a[P]||0});return{first:M(0),last:M(n-1),widest:M(k),highest:M(S),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,n){return NaN}getValueForPixel(t){}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const n=this._startPixel+t*this._length;return Wd(this._alignToPixels?Yt(this.chart,n,0):n)}getDecimalForPixel(t){const n=(t-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:n}=this;return t<0&&n<0?n:t>0&&n>0?t:0}getContext(t){const n=this.ticks||[];if(t>=0&&t<n.length){const i=n[t];return i.$context||(i.$context=dg(this.getContext(),t,i))}return this.$context||(this.$context=ug(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,n=yt(this.labelRotation),i=Math.abs(Math.cos(n)),s=Math.abs(Math.sin(n)),o=this._getLabelSizes(),r=t.autoSkipPadding||0,a=o?o.widest.width+r:0,c=o?o.highest.height+r:0;return this.isHorizontal()?c*i>a*s?a/i:c/s:c*s<a*i?c/i:a/s}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const n=this.axis,i=this.chart,s=this.options,{grid:o,position:r,border:a}=s,c=o.offset,l=this.isHorizontal(),u=this.ticks.length+(c?1:0),d=ke(o),f=[],p=a.setContext(this.getContext()),g=p.display?p.width:0,m=g/2,b=function(V){return Yt(i,V,g)};let _,w,x,y,k,S,M,P,O,T,E,nt;if(r==="top")_=b(this.bottom),S=this.bottom-d,P=_-m,T=b(t.top)+m,nt=t.bottom;else if(r==="bottom")_=b(this.top),T=t.top,nt=b(t.bottom)-m,S=_+m,P=this.top+d;else if(r==="left")_=b(this.right),k=this.right-d,M=_-m,O=b(t.left)+m,E=t.right;else if(r==="right")_=b(this.left),O=t.left,E=b(t.right)-m,k=_+m,M=this.left+d;else if(n==="x"){if(r==="center")_=b((t.top+t.bottom)/2+.5);else if(D(r)){const V=Object.keys(r)[0],X=r[V];_=b(this.chart.scales[V].getPixelForValue(X))}T=t.top,nt=t.bottom,S=_+m,P=S+d}else if(n==="y"){if(r==="center")_=b((t.left+t.right)/2);else if(D(r)){const V=Object.keys(r)[0],X=r[V];_=b(this.chart.scales[V].getPixelForValue(X))}k=_-m,M=k-d,O=t.left,E=t.right}const pt=z(s.ticks.maxTicksLimit,u),N=Math.max(1,Math.ceil(u/pt));for(w=0;w<u;w+=N){const V=this.getContext(w),X=o.setContext(V),_t=a.setContext(V),st=X.lineWidth,ae=X.color,He=_t.dash||[],ce=_t.dashOffset,_e=X.tickWidth,Wt=X.tickColor,ye=X.tickBorderDash||[],Ht=X.tickBorderDashOffset;x=lg(this,w,c),x!==void 0&&(y=Yt(i,x,st),l?k=M=O=E=y:S=P=T=nt=y,f.push({tx1:k,ty1:S,tx2:M,ty2:P,x1:O,y1:T,x2:E,y2:nt,width:st,color:ae,borderDash:He,borderDashOffset:ce,tickWidth:_e,tickColor:Wt,tickBorderDash:ye,tickBorderDashOffset:Ht}))}return this._ticksLength=u,this._borderValue=_,f}_computeLabelItems(t){const n=this.axis,i=this.options,{position:s,ticks:o}=i,r=this.isHorizontal(),a=this.ticks,{align:c,crossAlign:l,padding:h,mirror:u}=o,d=ke(i.grid),f=d+h,p=u?-h:f,g=-yt(this.labelRotation),m=[];let b,_,w,x,y,k,S,M,P,O,T,E,nt="middle";if(s==="top")k=this.bottom-p,S=this._getXAxisLabelAlignment();else if(s==="bottom")k=this.top+p,S=this._getXAxisLabelAlignment();else if(s==="left"){const N=this._getYAxisLabelAlignment(d);S=N.textAlign,y=N.x}else if(s==="right"){const N=this._getYAxisLabelAlignment(d);S=N.textAlign,y=N.x}else if(n==="x"){if(s==="center")k=(t.top+t.bottom)/2+f;else if(D(s)){const N=Object.keys(s)[0],V=s[N];k=this.chart.scales[N].getPixelForValue(V)+f}S=this._getXAxisLabelAlignment()}else if(n==="y"){if(s==="center")y=(t.left+t.right)/2-f;else if(D(s)){const N=Object.keys(s)[0],V=s[N];y=this.chart.scales[N].getPixelForValue(V)}S=this._getYAxisLabelAlignment(d).textAlign}n==="y"&&(c==="start"?nt="top":c==="end"&&(nt="bottom"));const pt=this._getLabelSizes();for(b=0,_=a.length;b<_;++b){w=a[b],x=w.label;const N=o.setContext(this.getContext(b));M=this.getPixelForTick(b)+o.labelOffset,P=this._resolveTickFontOptions(b),O=P.lineHeight,T=Z(x)?x.length:1;const V=T/2,X=N.color,_t=N.textStrokeColor,st=N.textStrokeWidth;let ae=S;r?(y=M,S==="inner"&&(b===_-1?ae=this.options.reverse?"left":"right":b===0?ae=this.options.reverse?"right":"left":ae="center"),s==="top"?l==="near"||g!==0?E=-T*O+O/2:l==="center"?E=-pt.highest.height/2-V*O+O:E=-pt.highest.height+O/2:l==="near"||g!==0?E=O/2:l==="center"?E=pt.highest.height/2-V*O:E=pt.highest.height-T*O,u&&(E*=-1),g!==0&&!N.showLabelBackdrop&&(y+=O/2*Math.sin(g))):(k=M,E=(1-T)*O/2);let He;if(N.showLabelBackdrop){const ce=lt(N.backdropPadding),_e=pt.heights[b],Wt=pt.widths[b];let ye=E-ce.top,Ht=0-ce.left;switch(nt){case"middle":ye-=_e/2;break;case"bottom":ye-=_e;break}switch(S){case"center":Ht-=Wt/2;break;case"right":Ht-=Wt;break;case"inner":b===_-1?Ht-=Wt:b>0&&(Ht-=Wt/2);break}He={left:Ht,top:ye,width:Wt+ce.width,height:_e+ce.height,color:N.backdropColor}}m.push({label:x,font:P,textOffset:E,options:{rotation:g,color:X,strokeColor:_t,strokeWidth:st,textAlign:ae,textBaseline:nt,translation:[y,k],backdrop:He}})}return m}_getXAxisLabelAlignment(){const{position:t,ticks:n}=this.options;if(-yt(this.labelRotation))return t==="top"?"left":"right";let s="center";return n.align==="start"?s="left":n.align==="end"?s="right":n.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){const{position:n,ticks:{crossAlign:i,mirror:s,padding:o}}=this.options,r=this._getLabelSizes(),a=t+o,c=r.widest.width;let l,h;return n==="left"?s?(h=this.right+o,i==="near"?l="left":i==="center"?(l="center",h+=c/2):(l="right",h+=c)):(h=this.right-a,i==="near"?l="right":i==="center"?(l="center",h-=c/2):(l="left",h=this.left)):n==="right"?s?(h=this.left+o,i==="near"?l="right":i==="center"?(l="center",h-=c/2):(l="left",h-=c)):(h=this.left+a,i==="near"?l="left":i==="center"?(l="center",h+=c/2):(l="right",h=this.right)):l="right",{textAlign:l,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:n},left:i,top:s,width:o,height:r}=this;n&&(t.save(),t.fillStyle=n,t.fillRect(i,s,o,r),t.restore())}getLineWidthForValue(t){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const s=this.ticks.findIndex(o=>o.value===t);return s>=0?n.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const n=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,r;const a=(c,l,h)=>{!h.width||!h.color||(i.save(),i.lineWidth=h.width,i.strokeStyle=h.color,i.setLineDash(h.borderDash||[]),i.lineDashOffset=h.borderDashOffset,i.beginPath(),i.moveTo(c.x,c.y),i.lineTo(l.x,l.y),i.stroke(),i.restore())};if(n.display)for(o=0,r=s.length;o<r;++o){const c=s[o];n.drawOnChartArea&&a({x:c.x1,y:c.y1},{x:c.x2,y:c.y2},c),n.drawTicks&&a({x:c.tx1,y:c.ty1},{x:c.tx2,y:c.ty2},{color:c.tickColor,width:c.tickWidth,borderDash:c.tickBorderDash,borderDashOffset:c.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:n,options:{border:i,grid:s}}=this,o=i.setContext(this.getContext()),r=i.display?o.width:0;if(!r)return;const a=s.setContext(this.getContext(0)).lineWidth,c=this._borderValue;let l,h,u,d;this.isHorizontal()?(l=Yt(t,this.left,r)-r/2,h=Yt(t,this.right,a)+a/2,u=d=c):(u=Yt(t,this.top,r)-r/2,d=Yt(t,this.bottom,a)+a/2,l=h=c),n.save(),n.lineWidth=o.width,n.strokeStyle=o.color,n.beginPath(),n.moveTo(l,u),n.lineTo(h,d),n.stroke(),n.restore()}drawLabels(t){if(!this.options.ticks.display)return;const i=this.ctx,s=this._computeLabelArea();s&&An(i,s);const o=this.getLabelItems(t);for(const r of o){const a=r.options,c=r.font,l=r.label,h=r.textOffset;ie(i,l,0,h,c,a)}s&&Dn(i)}drawTitle(){const{ctx:t,options:{position:n,title:i,reverse:s}}=this;if(!i.display)return;const o=tt(i.font),r=lt(i.padding),a=i.align;let c=o.lineHeight/2;n==="bottom"||n==="center"||D(n)?(c+=r.bottom,Z(i.text)&&(c+=o.lineHeight*(i.text.length-1))):c+=r.top;const{titleX:l,titleY:h,maxWidth:u,rotation:d}=pg(this,c,n,a);ie(t,i.text,0,0,o,{color:i.color,maxWidth:u,rotation:d,textAlign:fg(a,n,s),textBaseline:"middle",translation:[l,h]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,n=t.ticks&&t.ticks.z||0,i=z(t.grid&&t.grid.z,-1),s=z(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==oe.prototype.draw?[{z:n,draw:o=>{this.draw(o)}}]:[{z:i,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:n,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const n=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let o,r;for(o=0,r=n.length;o<r;++o){const a=n[o];a[i]===this.id&&(!t||a.type===t)&&s.push(a)}return s}_resolveTickFontOptions(t){const n=this.options.ticks.setContext(this.getContext(t));return tt(n.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class on{constructor(t,n,i){this.type=t,this.scope=n,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const n=Object.getPrototypeOf(t);let i;bg(n)&&(i=this.register(n));const s=this.items,o=t.id,r=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in s||(s[o]=t,gg(t,r,i),this.override&&W.override(t.id,t.overrides)),r}get(t){return this.items[t]}unregister(t){const n=this.items,i=t.id,s=this.scope;i in n&&delete n[i],s&&i in W[s]&&(delete W[s][i],this.override&&delete ne[i])}}function gg(e,t,n){const i=$e(Object.create(null),[n?W.get(n):{},W.get(t),e.defaults]);W.set(t,i),e.defaultRoutes&&mg(t,e.defaultRoutes),e.descriptors&&W.describe(t,e.descriptors)}function mg(e,t){Object.keys(t).forEach(n=>{const i=n.split("."),s=i.pop(),o=[e].concat(i).join("."),r=t[n].split("."),a=r.pop(),c=r.join(".");W.route(o,s,c,a)})}function bg(e){return"id"in e&&"defaults"in e}class _g{constructor(){this.controllers=new on(Zt,"datasets",!0),this.elements=new on(Tt,"elements"),this.plugins=new on(Object,"plugins"),this.scales=new on(oe,"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,n,i){[...n].forEach(s=>{const o=i||this._getRegistryForType(s);i||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):$(s,r=>{const a=i||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,n,i){const s=Pi(t);B(i["before"+s],[],i),n[t](i),B(i["after"+s],[],i)}_getRegistryForType(t){for(let n=0;n<this._typedRegistries.length;n++){const i=this._typedRegistries[n];if(i.isForType(t))return i}return this.plugins}_get(t,n,i){const s=n.get(t);if(s===void 0)throw new Error('"'+t+'" is not a registered '+i+".");return s}}var vt=new _g;class yg{constructor(){this._init=void 0}notify(t,n,i,s){if(n==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install")),this._init===void 0)return;const o=s?this._descriptors(t).filter(s):this._descriptors(t),r=this._notify(o,t,n,i);return n==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall"),this._init=void 0),r}_notify(t,n,i,s){s=s||{};for(const o of t){const r=o.plugin,a=r[i],c=[n,s,o.options];if(B(a,c,r)===!1&&s.cancelable)return!1}return!0}invalidate(){A(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const n=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),n}_createDescriptors(t,n){const i=t&&t.config,s=z(i.options&&i.options.plugins,{}),o=xg(i);return s===!1&&!n?[]:wg(t,o,s,n)}_notifyStateChanges(t){const n=this._oldCache||[],i=this._cache,s=(o,r)=>o.filter(a=>!r.some(c=>a.plugin.id===c.plugin.id));this._notify(s(n,i),t,"stop"),this._notify(s(i,n),t,"start")}}function xg(e){const t={},n=[],i=Object.keys(vt.plugins.items);for(let o=0;o<i.length;o++)n.push(vt.getPlugin(i[o]));const s=e.plugins||[];for(let o=0;o<s.length;o++){const r=s[o];n.indexOf(r)===-1&&(n.push(r),t[r.id]=!0)}return{plugins:n,localIds:t}}function vg(e,t){return!t&&e===!1?null:e===!0?{}:e}function wg(e,{plugins:t,localIds:n},i,s){const o=[],r=e.getContext();for(const a of t){const c=a.id,l=vg(i[c],s);l!==null&&o.push({plugin:a,options:kg(e.config,{plugin:a,local:n[c]},l,r)})}return o}function kg(e,{plugin:t,local:n},i,s){const o=e.pluginScopeKeys(t),r=e.getOptionScopes(i,o);return n&&t.defaults&&r.push(t.defaults),e.createResolver(r,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function li(e,t){const n=W.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||"x"}function Sg(e,t){let n=e;return e==="_index_"?n=t:e==="_value_"&&(n=t==="x"?"y":"x"),n}function Mg(e,t){return e===t?"_index_":"_value_"}function Gs(e){if(e==="x"||e==="y"||e==="r")return e}function Pg(e){if(e==="top"||e==="bottom")return"x";if(e==="left"||e==="right")return"y"}function hi(e,...t){if(Gs(e))return e;for(const n of t){const i=n.axis||Pg(n.position)||e.length>1&&Gs(e[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function Qs(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function Cg(e,t){if(t.data&&t.data.datasets){const n=t.data.datasets.filter(i=>i.xAxisID===e||i.yAxisID===e);if(n.length)return Qs(e,"x",n[0])||Qs(e,"y",n[0])}return{}}function Og(e,t){const n=ne[e.type]||{scales:{}},i=t.scales||{},s=li(e.type,t),o=Object.create(null);return Object.keys(i).forEach(r=>{const a=i[r];if(!D(a))return console.error(`Invalid scale configuration for scale: ${r}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);const c=hi(r,a,Cg(r,e),W.scales[a.type]),l=Mg(c,s),h=n.scales||{};o[r]=Te(Object.create(null),[{axis:c},a,h[c],h[l]])}),e.data.datasets.forEach(r=>{const a=r.type||e.type,c=r.indexAxis||li(a,t),h=(ne[a]||{}).scales||{};Object.keys(h).forEach(u=>{const d=Sg(u,c),f=r[d+"AxisID"]||d;o[f]=o[f]||Object.create(null),Te(o[f],[{axis:d},i[f],h[u]])})}),Object.keys(o).forEach(r=>{const a=o[r];Te(a,[W.scales[a.type],W.scale])}),o}function oa(e){const t=e.options||(e.options={});t.plugins=z(t.plugins,{}),t.scales=Og(e,t)}function ra(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function zg(e){return e=e||{},e.data=ra(e.data),oa(e),e}const to=new Map,aa=new Set;function rn(e,t){let n=to.get(e);return n||(n=t(),to.set(e,n),aa.add(n)),n}const Se=(e,t,n)=>{const i=Ft(t,n);i!==void 0&&e.add(i)};class Tg{constructor(t){this._config=zg(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=ra(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(),oa(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return rn(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,n){return rn(`${t}.transition.${n}`,()=>[[`datasets.${t}.transitions.${n}`,`transitions.${n}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,n){return rn(`${t}-${n}`,()=>[[`datasets.${t}.elements.${n}`,`datasets.${t}`,`elements.${n}`,""]])}pluginScopeKeys(t){const n=t.id,i=this.type;return rn(`${i}-plugin-${n}`,()=>[[`plugins.${n}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,n){const i=this._scopeCache;let s=i.get(t);return(!s||n)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,n,i){const{options:s,type:o}=this,r=this._cachedScopes(t,i),a=r.get(n);if(a)return a;const c=new Set;n.forEach(h=>{t&&(c.add(t),h.forEach(u=>Se(c,t,u))),h.forEach(u=>Se(c,s,u)),h.forEach(u=>Se(c,ne[o]||{},u)),h.forEach(u=>Se(c,W,u)),h.forEach(u=>Se(c,ai,u))});const l=Array.from(c);return l.length===0&&l.push(Object.create(null)),aa.has(n)&&r.set(n,l),l}chartOptionScopes(){const{options:t,type:n}=this;return[t,ne[n]||{},W.datasets[n]||{},{type:n},W,ai]}resolveNamedOptions(t,n,i,s=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=eo(this._resolverCache,t,s);let c=r;if(Dg(r,n)){o.$shared=!1,i=Nt(i)?i():i;const l=this.createResolver(t,i,a);c=ge(r,i,l)}for(const l of n)o[l]=c[l];return o}createResolver(t,n,i=[""],s){const{resolver:o}=eo(this._resolverCache,t,i);return D(n)?ge(o,n,void 0,s):o}}function eo(e,t,n){let i=e.get(t);i||(i=new Map,e.set(t,i));const s=n.join();let o=i.get(s);return o||(o={resolver:Di(t,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},i.set(s,o)),o}const Ag=e=>D(e)&&Object.getOwnPropertyNames(e).some(t=>Nt(e[t]));function Dg(e,t){const{isScriptable:n,isIndexable:i}=Fr(e);for(const s of t){const o=n(s),r=i(s),a=(r||o)&&e[s];if(o&&(Nt(a)||Ag(a))||r&&Z(a))return!0}return!1}var Eg="4.5.1";const Ig=["top","bottom","left","right","chartArea"];function no(e,t){return e==="top"||e==="bottom"||Ig.indexOf(e)===-1&&t==="x"}function io(e,t){return function(n,i){return n[e]===i[e]?n[t]-i[t]:n[e]-i[e]}}function so(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),B(n&&n.onComplete,[e],t)}function Rg(e){const t=e.chart,n=t.options.animation;B(n&&n.onProgress,[e],t)}function ca(e){return Ri()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const dn={},oo=e=>{const t=ca(e);return Object.values(dn).filter(n=>n.canvas===t).pop()};function Lg(e,t,n){const i=Object.keys(e);for(const s of i){const o=+s;if(o>=t){const r=e[s];delete e[s],(n>0||o>t)&&(e[o+n]=r)}}}function $g(e,t,n,i){return!n||e.type==="mouseout"?null:i?t:e}class kn{static defaults=W;static instances=dn;static overrides=ne;static registry=vt;static version=Eg;static getChart=oo;static register(...t){vt.add(...t),ro()}static unregister(...t){vt.remove(...t),ro()}constructor(t,n){const i=this.config=new Tg(n),s=ca(t),o=oo(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const r=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||eg(s)),this.platform.updateConfig(i);const a=this.platform.acquireContext(s,r.aspectRatio),c=a&&a.canvas,l=c&&c.height,h=c&&c.width;if(this.id=Ad(),this.ctx=a,this.canvas=c,this.width=h,this.height=l,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new yg,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=qd(u=>this.update(u),r.resizeDelay||0),this._dataChanges=[],dn[this.id]=this,!a||!c){console.error("Failed to create chart: can't acquire context from the given item");return}St.listen(this,"complete",so),St.listen(this,"progress",Rg),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:i,height:s,_aspectRatio:o}=this;return A(t)?n&&o?o: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 vt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Os(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Ms(this.canvas,this.ctx),this}stop(){return St.stop(this),this}resize(t,n){St.running(this)?this._resizeBeforeDraw={width:t,height:n}:this._resize(t,n)}_resize(t,n){const i=this.options,s=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(s,t,n,o),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),c=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,Os(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),B(i.onResize,[this,r],this),this.attached&&this._doResize(c)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};$(n,(i,s)=>{i.id=s})}buildOrUpdateScales(){const t=this.options,n=t.scales,i=this.scales,s=Object.keys(i).reduce((r,a)=>(r[a]=!1,r),{});let o=[];n&&(o=o.concat(Object.keys(n).map(r=>{const a=n[r],c=hi(r,a),l=c==="r",h=c==="x";return{options:a,dposition:l?"chartArea":h?"bottom":"left",dtype:l?"radialLinear":h?"category":"linear"}}))),$(o,r=>{const a=r.options,c=a.id,l=hi(c,a),h=z(a.type,r.dtype);(a.position===void 0||no(a.position,l)!==no(r.dposition))&&(a.position=r.dposition),s[c]=!0;let u=null;if(c in i&&i[c].type===h)u=i[c];else{const d=vt.getScale(h);u=new d({id:c,type:h,ctx:this.ctx,chart:this}),i[u.id]=u}u.init(a,t)}),$(s,(r,a)=>{r||delete i[a]}),$(i,r=>{at.configure(this,r,r.options),at.addBox(this,r)})}_updateMetasets(){const t=this._metasets,n=this.data.datasets.length,i=t.length;if(t.sort((s,o)=>s.index-o.index),i>n){for(let s=n;s<i;++s)this._destroyDatasetMeta(s);t.splice(n,i-n)}this._sortedMetasets=t.slice(0).sort(io("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:n}}=this;t.length>n.length&&delete this._stacks,t.forEach((i,s)=>{n.filter(o=>o===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],n=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=n.length;i<s;i++){const o=n[i];let r=this.getDatasetMeta(i);const a=o.type||this.config.type;if(r.type&&r.type!==a&&(this._destroyDatasetMeta(i),r=this.getDatasetMeta(i)),r.type=a,r.indexAxis=o.indexAxis||li(a,this.options),r.order=o.order||0,r.index=i,r.label=""+o.label,r.visible=this.isDatasetVisible(i),r.controller)r.controller.updateIndex(i),r.controller.linkScales();else{const c=vt.getController(a),{datasetElementType:l,dataElementType:h}=W.datasets[a];Object.assign(c,{dataElementType:vt.getElement(h),datasetElementType:l&&vt.getElement(l)}),r.controller=new c(this,i),t.push(r.controller)}}return this._updateMetasets(),t}_resetElements(){$(this.data.datasets,(t,n)=>{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const n=this.config;n.update();const i=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let l=0,h=this.data.datasets.length;l<h;l++){const{controller:u}=this.getDatasetMeta(l),d=!s&&o.indexOf(u)===-1;u.buildOrUpdateElements(d),r=Math.max(+u.getMaxOverflow(),r)}r=this._minPadding=i.layout.autoPadding?r:0,this._updateLayout(r),s||$(o,l=>{l.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(io("z","_idx"));const{_active:a,_lastEvent:c}=this;c?this._eventHandler(c,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){$(this.scales,t=>{at.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!ms(n,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,n=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:o}of n){const r=i==="_removeElements"?-o:o;Lg(t,s,r)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const n=this.data.datasets.length,i=o=>new Set(t.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),s=i(0);for(let o=1;o<n;o++)if(!ms(s,i(o)))return;return Array.from(s).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;at.update(this,this.width,this.height,t);const n=this.chartArea,i=n.width<=0||n.height<=0;this._layers=[],$(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let n=0,i=this.data.datasets.length;n<i;++n)this.getDatasetMeta(n).controller.configure();for(let n=0,i=this.data.datasets.length;n<i;++n)this._updateDataset(n,Nt(t)?t({datasetIndex:n}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,n){const i=this.getDatasetMeta(t),s={meta:i,index:t,mode:n,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(i.controller._update(n),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(St.has(this)?this.attached&&!St.running(this)&&St.start(this):(this.draw(),so({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:i,height:s}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(i,s)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const n=this._layers;for(t=0;t<n.length&&n[t].z<=0;++t)n[t].draw(this.chartArea);for(this._drawDatasets();t<n.length;++t)n[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const n=this._sortedMetasets,i=[];let s,o;for(s=0,o=n.length;s<o;++s){const r=n[s];(!t||r.visible)&&i.push(r)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let n=t.length-1;n>=0;--n)this._drawDataset(t[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const n=this.ctx,i={meta:t,index:t.index,cancelable:!0},s=Xr(this,t);this.notifyPlugins("beforeDatasetDraw",i)!==!1&&(s&&An(n,s),t.controller.draw(),s&&Dn(n),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(t){return zt(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,i,s){const o=Ip.modes[n];return typeof o=="function"?o(this,t,i,s):[]}getDatasetMeta(t){const n=this.data.datasets[t],i=this._metasets;let s=i.filter(o=>o&&o._dataset===n).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:t,_dataset:n,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=Vt(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const n=this.data.datasets[t];if(!n)return!1;const i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!n.hidden}setDatasetVisibility(t,n){const i=this.getDatasetMeta(t);i.hidden=!n}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,n,i){const s=i?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,s);Fe(n)?(o.data[n].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),r.update(o,{visible:i}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,n){this._updateVisibility(t,n,!1)}show(t,n){this._updateVisibility(t,n,!0)}_destroyDatasetMeta(t){const n=this._metasets[t];n&&n.controller&&n.controller._destroy(),delete this._metasets[t]}_stop(){let t,n;for(this.stop(),St.remove(this),t=0,n=this.data.datasets.length;t<n;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:n}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),Ms(t,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete dn[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,n=this.platform,i=(o,r)=>{n.addEventListener(this,o,r),t[o]=r},s=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};$(this.options.events,o=>i(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,n=this.platform,i=(c,l)=>{n.addEventListener(this,c,l),t[c]=l},s=(c,l)=>{t[c]&&(n.removeEventListener(this,c,l),delete t[c])},o=(c,l)=>{this.canvas&&this.resize(c,l)};let r;const a=()=>{s("attach",a),this.attached=!0,this.resize(),i("resize",o),i("detach",r)};r=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),i("attach",a)},n.isAttached(this.canvas)?a():r()}unbindEvents(){$(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},$(this._responsiveListeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,n,i){const s=i?"set":"remove";let o,r,a,c;for(n==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),a=0,c=t.length;a<c;++a){r=t[a];const l=r&&this.getDatasetMeta(r.datasetIndex).controller;l&&l[s+"HoverStyle"](r.element,r.datasetIndex,r.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const n=this._active||[],i=t.map(({datasetIndex:o,index:r})=>{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[r],index:r}});!bn(i,n)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,n))}notifyPlugins(t,n,i){return this._plugins.notify(this,t,n,i)}isPluginEnabled(t){return this._plugins._cache.filter(n=>n.plugin.id===t).length===1}_updateHoverStyles(t,n,i){const s=this.options.hover,o=(c,l)=>c.filter(h=>!l.some(u=>h.datasetIndex===u.datasetIndex&&h.index===u.index)),r=o(n,t),a=i?t:o(t,n);r.length&&this.updateHoverStyle(r,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,n){const i={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},s=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;const o=this._handleEvent(t,n,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(o||i.changed)&&this.render(),this}_handleEvent(t,n,i){const{_active:s=[],options:o}=this,r=n,a=this._getActiveElements(t,s,i,r),c=$d(t),l=$g(t,this._lastEvent,i,c);i&&(this._lastEvent=null,B(o.onHover,[t,a,this],this),c&&B(o.onClick,[t,a,this],this));const h=!bn(a,s);return(h||n)&&(this._active=a,this._updateHoverStyles(a,s,n)),this._lastEvent=l,h}_getActiveElements(t,n,i,s){if(t.type==="mouseout")return[];if(!i)return n;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}}function ro(){return $(kn.instances,e=>e._plugins.invalidate())}function Fg(e,t,n){const{startAngle:i,x:s,y:o,outerRadius:r,innerRadius:a,options:c}=t,{borderWidth:l,borderJoinStyle:h}=c,u=Math.min(l/r,rt(i-n));if(e.beginPath(),e.arc(s,o,r-l/2,i+u/2,n-u/2),a>0){const d=Math.min(l/a,rt(i-n));e.arc(s,o,a+l/2,n-d/2,i+d/2,!0)}else{const d=Math.min(l/2,r*rt(i-n));if(h==="round")e.arc(s,o,d,n-I/2,i+I/2,!0);else if(h==="bevel"){const f=2*d*d,p=-f*Math.cos(n+I/2)+s,g=-f*Math.sin(n+I/2)+o,m=f*Math.cos(i+I/2)+s,b=f*Math.sin(i+I/2)+o;e.lineTo(p,g),e.lineTo(m,b)}}e.closePath(),e.moveTo(0,0),e.rect(0,0,e.canvas.width,e.canvas.height),e.clip("evenodd")}function Ng(e,t,n){const{startAngle:i,pixelMargin:s,x:o,y:r,outerRadius:a,innerRadius:c}=t;let l=s/a;e.beginPath(),e.arc(o,r,a,i-l,n+l),c>s?(l=s/c,e.arc(o,r,c,n+l,i-l,!0)):e.arc(o,r,s,n+J,i-J),e.closePath(),e.clip()}function Bg(e){return Ai(e,["outerStart","outerEnd","innerStart","innerEnd"])}function jg(e,t,n,i){const s=Bg(e.options.borderRadius),o=(n-t)/2,r=Math.min(o,i*t/2),a=c=>{const l=(n-Math.min(o,c))*i/2;return et(c,0,Math.min(o,l))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:et(s.innerStart,0,r),innerEnd:et(s.innerEnd,0,r)}}function he(e,t,n,i){return{x:n+e*Math.cos(t),y:i+e*Math.sin(t)}}function Sn(e,t,n,i,s,o){const{x:r,y:a,startAngle:c,pixelMargin:l,innerRadius:h}=t,u=Math.max(t.outerRadius+i+n-l,0),d=h>0?h+i+n+l:0;let f=0;const p=s-c;if(i){const N=h>0?h-i:0,V=u>0?u-i:0,X=(N+V)/2,_t=X!==0?p*X/(X+i):p;f=(p-_t)/2}const g=Math.max(.001,p*u-n/I)/u,m=(p-g)/2,b=c+m+f,_=s-m-f,{outerStart:w,outerEnd:x,innerStart:y,innerEnd:k}=jg(t,d,u,_-b),S=u-w,M=u-x,P=b+w/S,O=_-x/M,T=d+y,E=d+k,nt=b+y/T,pt=_-k/E;if(e.beginPath(),o){const N=(P+O)/2;if(e.arc(r,a,u,P,N),e.arc(r,a,u,N,O),x>0){const st=he(M,O,r,a);e.arc(st.x,st.y,x,O,_+J)}const V=he(E,_,r,a);if(e.lineTo(V.x,V.y),k>0){const st=he(E,pt,r,a);e.arc(st.x,st.y,k,_+J,pt+Math.PI)}const X=(_-k/d+(b+y/d))/2;if(e.arc(r,a,d,_-k/d,X,!0),e.arc(r,a,d,X,b+y/d,!0),y>0){const st=he(T,nt,r,a);e.arc(st.x,st.y,y,nt+Math.PI,b-J)}const _t=he(S,b,r,a);if(e.lineTo(_t.x,_t.y),w>0){const st=he(S,P,r,a);e.arc(st.x,st.y,w,b-J,P)}}else{e.moveTo(r,a);const N=Math.cos(P)*u+r,V=Math.sin(P)*u+a;e.lineTo(N,V);const X=Math.cos(O)*u+r,_t=Math.sin(O)*u+a;e.lineTo(X,_t)}e.closePath()}function Vg(e,t,n,i,s){const{fullCircles:o,startAngle:r,circumference:a}=t;let c=t.endAngle;if(o){Sn(e,t,n,i,c,s);for(let l=0;l<o;++l)e.fill();isNaN(a)||(c=r+(a%j||j))}return Sn(e,t,n,i,c,s),e.fill(),c}function Zg(e,t,n,i,s){const{fullCircles:o,startAngle:r,circumference:a,options:c}=t,{borderWidth:l,borderJoinStyle:h,borderDash:u,borderDashOffset:d,borderRadius:f}=c,p=c.borderAlign==="inner";if(!l)return;e.setLineDash(u||[]),e.lineDashOffset=d,p?(e.lineWidth=l*2,e.lineJoin=h||"round"):(e.lineWidth=l,e.lineJoin=h||"bevel");let g=t.endAngle;if(o){Sn(e,t,n,i,g,s);for(let m=0;m<o;++m)e.stroke();isNaN(a)||(g=r+(a%j||j))}p&&Ng(e,t,g),c.selfJoin&&g-r>=I&&f===0&&h!=="miter"&&Fg(e,t,g),o||(Sn(e,t,n,i,g,s),e.stroke())}class Wg extends Tt{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,n,i){const s=this.getProps(["x","y"],i),{angle:o,distance:r}=Or(s,{x:t,y:n}),{startAngle:a,endAngle:c,innerRadius:l,outerRadius:h,circumference:u}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),d=(this.options.spacing+this.options.borderWidth)/2,f=z(u,c-a),p=Ne(o,a,c)&&a!==c,g=f>=j||p,m=Ct(r,l+d,h+d);return g&&m}getCenterPoint(t){const{x:n,y:i,startAngle:s,endAngle:o,innerRadius:r,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:c,spacing:l}=this.options,h=(s+o)/2,u=(r+a+l+c)/2;return{x:n+Math.cos(h)*u,y:i+Math.sin(h)*u}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:n,circumference:i}=this,s=(n.offset||0)/4,o=(n.spacing||0)/2,r=n.circular;if(this.pixelMargin=n.borderAlign==="inner"?.33:0,this.fullCircles=i>j?Math.floor(i/j):0,i===0||this.innerRadius<0||this.outerRadius<0)return;t.save();const a=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(a)*s,Math.sin(a)*s);const c=1-Math.sin(Math.min(I,i||0)),l=s*c;t.fillStyle=n.backgroundColor,t.strokeStyle=n.borderColor,Vg(t,this,l,o,r),Zg(t,this,l,o,r),t.restore()}}function la(e,t,n=t){e.lineCap=z(n.borderCapStyle,t.borderCapStyle),e.setLineDash(z(n.borderDash,t.borderDash)),e.lineDashOffset=z(n.borderDashOffset,t.borderDashOffset),e.lineJoin=z(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=z(n.borderWidth,t.borderWidth),e.strokeStyle=z(n.borderColor,t.borderColor)}function Hg(e,t,n){e.lineTo(n.x,n.y)}function Ug(e){return e.stepped?af:e.tension||e.cubicInterpolationMode==="monotone"?cf:Hg}function ha(e,t,n={}){const i=e.length,{start:s=0,end:o=i-1}=n,{start:r,end:a}=t,c=Math.max(s,r),l=Math.min(o,a),h=s<r&&o<r||s>a&&o>a;return{count:i,start:c,loop:t.loop,ilen:l<c&&!h?i+l-c:l-c}}function Yg(e,t,n,i){const{points:s,options:o}=t,{count:r,start:a,loop:c,ilen:l}=ha(s,n,i),h=Ug(o);let{move:u=!0,reverse:d}=i||{},f,p,g;for(f=0;f<=l;++f)p=s[(a+(d?l-f:f))%r],!p.skip&&(u?(e.moveTo(p.x,p.y),u=!1):h(e,g,p,d,o.stepped),g=p);return c&&(p=s[(a+(d?l:0))%r],h(e,g,p,d,o.stepped)),!!c}function qg(e,t,n,i){const s=t.points,{count:o,start:r,ilen:a}=ha(s,n,i),{move:c=!0,reverse:l}=i||{};let h=0,u=0,d,f,p,g,m,b;const _=x=>(r+(l?a-x:x))%o,w=()=>{g!==m&&(e.lineTo(h,m),e.lineTo(h,g),e.lineTo(h,b))};for(c&&(f=s[_(0)],e.moveTo(f.x,f.y)),d=0;d<=a;++d){if(f=s[_(d)],f.skip)continue;const x=f.x,y=f.y,k=x|0;k===p?(y<g?g=y:y>m&&(m=y),h=(u*h+x)/++u):(w(),e.lineTo(x,y),p=k,u=0,g=m=y),b=y}w()}function ui(e){const t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!n?qg:Yg}function Xg(e){return e.stepped?Bf:e.tension||e.cubicInterpolationMode==="monotone"?jf:Kt}function Jg(e,t,n,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,n,i)&&s.closePath()),la(e,t.options),e.stroke(s)}function Kg(e,t,n,i){const{segments:s,options:o}=t,r=ui(t);for(const a of s)la(e,o,a.style),e.beginPath(),r(e,t,a,{start:n,end:n+i-1})&&e.closePath(),e.stroke()}const Gg=typeof Path2D=="function";function Qg(e,t,n,i){Gg&&!t.options.segment?Jg(e,t,n,i):Kg(e,t,n,i)}class Rn extends Tt{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,n){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;Df(this._points,i,t,s,n),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Yf(this,this.options.segment))}first(){const t=this.segments,n=this.points;return t.length&&n[t[0].start]}last(){const t=this.segments,n=this.points,i=t.length;return i&&n[t[i-1].end]}interpolate(t,n){const i=this.options,s=t[n],o=this.points,r=qr(this,{property:n,start:s,end:s});if(!r.length)return;const a=[],c=Xg(i);let l,h;for(l=0,h=r.length;l<h;++l){const{start:u,end:d}=r[l],f=o[u],p=o[d];if(f===p){a.push(f);continue}const g=Math.abs((s-f[n])/(p[n]-f[n])),m=c(f,p,g,i.stepped);m[n]=t[n],a.push(m)}return a.length===1?a[0]:a}pathSegment(t,n,i){return ui(this)(t,this,n,i)}path(t,n,i){const s=this.segments,o=ui(this);let r=this._loop;n=n||0,i=i||this.points.length-n;for(const a of s)r&=o(t,this,a,{start:n,end:n+i-1});return!!r}draw(t,n,i,s){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),Qg(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function ao(e,t,n,i){const s=e.options,{[n]:o}=e.getProps([n],i);return Math.abs(t-o)<s.radius+s.hitRadius}class tm extends Tt{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,n,i){const s=this.options,{x:o,y:r}=this.getProps(["x","y"],i);return Math.pow(t-o,2)+Math.pow(n-r,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(t,n){return ao(this,t,"x",n)}inYRange(t,n){return ao(this,t,"y",n)}getCenterPoint(t){const{x:n,y:i}=this.getProps(["x","y"],t);return{x:n,y:i}}size(t){t=t||this.options||{};let n=t.radius||0;n=Math.max(n,n&&t.hoverRadius||0);const i=n&&t.borderWidth||0;return(n+i)*2}draw(t,n){const i=this.options;this.skip||i.radius<.1||!zt(this,n,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,ci(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}function ua(e,t){const{x:n,y:i,base:s,width:o,height:r}=e.getProps(["x","y","base","width","height"],t);let a,c,l,h,u;return e.horizontal?(u=r/2,a=Math.min(n,s),c=Math.max(n,s),l=i-u,h=i+u):(u=o/2,a=n-u,c=n+u,l=Math.min(i,s),h=Math.max(i,s)),{left:a,top:l,right:c,bottom:h}}function It(e,t,n,i){return e?0:et(t,n,i)}function em(e,t,n){const i=e.options.borderWidth,s=e.borderSkipped,o=$r(i);return{t:It(s.top,o.top,0,n),r:It(s.right,o.right,0,t),b:It(s.bottom,o.bottom,0,n),l:It(s.left,o.left,0,t)}}function nm(e,t,n){const{enableBorderRadius:i}=e.getProps(["enableBorderRadius"]),s=e.options.borderRadius,o=Gt(s),r=Math.min(t,n),a=e.borderSkipped,c=i||D(s);return{topLeft:It(!c||a.top||a.left,o.topLeft,0,r),topRight:It(!c||a.top||a.right,o.topRight,0,r),bottomLeft:It(!c||a.bottom||a.left,o.bottomLeft,0,r),bottomRight:It(!c||a.bottom||a.right,o.bottomRight,0,r)}}function im(e){const t=ua(e),n=t.right-t.left,i=t.bottom-t.top,s=em(e,n/2,i/2),o=nm(e,n/2,i/2);return{outer:{x:t.left,y:t.top,w:n,h:i,radius:o},inner:{x:t.left+s.l,y:t.top+s.t,w:n-s.l-s.r,h:i-s.t-s.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(s.t,s.l)),topRight:Math.max(0,o.topRight-Math.max(s.t,s.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(s.b,s.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(s.b,s.r))}}}}function Jn(e,t,n,i){const s=t===null,o=n===null,a=e&&!(s&&o)&&ua(e,i);return a&&(s||Ct(t,a.left,a.right))&&(o||Ct(n,a.top,a.bottom))}function sm(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}function om(e,t){e.rect(t.x,t.y,t.w,t.h)}function Kn(e,t,n={}){const i=e.x!==n.x?-t:0,s=e.y!==n.y?-t:0,o=(e.x+e.w!==n.x+n.w?t:0)-i,r=(e.y+e.h!==n.y+n.h?t:0)-s;return{x:e.x+i,y:e.y+s,w:e.w+o,h:e.h+r,radius:e.radius}}class rm extends Tt{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:n,options:{borderColor:i,backgroundColor:s}}=this,{inner:o,outer:r}=im(this),a=sm(r.radius)?Be:om;t.save(),(r.w!==o.w||r.h!==o.h)&&(t.beginPath(),a(t,Kn(r,n,o)),t.clip(),a(t,Kn(o,-n,r)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),a(t,Kn(o,n)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,n,i){return Jn(this,t,n,i)}inXRange(t,n){return Jn(this,t,null,n)}inYRange(t,n){return Jn(this,null,t,n)}getCenterPoint(t){const{x:n,y:i,base:s,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(n+s)/2:n,y:o?i:(i+s)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}var am=Object.freeze({__proto__:null,ArcElement:Wg,BarElement:rm,LineElement:Rn,PointElement:tm});const di=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],co=di.map(e=>e.replace("rgb(","rgba(").replace(")",", 0.5)"));function da(e){return di[e%di.length]}function fa(e){return co[e%co.length]}function cm(e,t){return e.borderColor=da(t),e.backgroundColor=fa(t),++t}function lm(e,t){return e.backgroundColor=e.data.map(()=>da(t++)),t}function hm(e,t){return e.backgroundColor=e.data.map(()=>fa(t++)),t}function um(e){let t=0;return(n,i)=>{const s=e.getDatasetMeta(i).controller;s instanceof $i?t=lm(n,t):s instanceof Qr?t=hm(n,t):s&&(t=cm(n,t))}}function lo(e){let t;for(t in e)if(e[t].borderColor||e[t].backgroundColor)return!0;return!1}function dm(e){return e&&(e.borderColor||e.backgroundColor)}function fm(){return W.borderColor!=="rgba(0,0,0,0.1)"||W.backgroundColor!=="rgba(0,0,0,0.1)"}var pm={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(e,t,n){if(!n.enabled)return;const{data:{datasets:i},options:s}=e.config,{elements:o}=s,r=lo(i)||dm(s)||o&&lo(o)||fm();if(!n.forceOverride&&r)return;const a=um(e);i.forEach(a)}};function gm(e,t,n,i,s){const o=s.samples||i;if(o>=n)return e.slice(t,t+n);const r=[],a=(n-2)/(o-2);let c=0;const l=t+n-1;let h=t,u,d,f,p,g;for(r[c++]=e[h],u=0;u<o-2;u++){let m=0,b=0,_;const w=Math.floor((u+1)*a)+1+t,x=Math.min(Math.floor((u+2)*a)+1,n)+t,y=x-w;for(_=w;_<x;_++)m+=e[_].x,b+=e[_].y;m/=y,b/=y;const k=Math.floor(u*a)+1+t,S=Math.min(Math.floor((u+1)*a)+1,n)+t,{x:M,y:P}=e[h];for(f=p=-1,_=k;_<S;_++)p=.5*Math.abs((M-m)*(e[_].y-P)-(M-e[_].x)*(b-P)),p>f&&(f=p,d=e[_],g=_);r[c++]=d,h=g}return r[c++]=e[l],r}function mm(e,t,n,i){let s=0,o=0,r,a,c,l,h,u,d,f,p,g;const m=[],b=t+n-1,_=e[t].x,x=e[b].x-_;for(r=t;r<t+n;++r){a=e[r],c=(a.x-_)/x*i,l=a.y;const y=c|0;if(y===h)l<p?(p=l,u=r):l>g&&(g=l,d=r),s=(o*s+a.x)/++o;else{const k=r-1;if(!A(u)&&!A(d)){const S=Math.min(u,d),M=Math.max(u,d);S!==f&&S!==k&&m.push({...e[S],x:s}),M!==f&&M!==k&&m.push({...e[M],x:s})}r>0&&k!==f&&m.push(e[k]),m.push(a),h=y,o=0,p=g=l,u=d=f=r}}return m}function pa(e){if(e._decimated){const t=e._data;delete e._decimated,delete e._data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function ho(e){e.data.datasets.forEach(t=>{pa(t)})}function bm(e,t){const n=t.length;let i=0,s;const{iScale:o}=e,{min:r,max:a,minDefined:c,maxDefined:l}=o.getUserBounds();return c&&(i=et(Ot(t,o.axis,r).lo,0,n-1)),l?s=et(Ot(t,o.axis,a).hi+1,i,n)-i:s=n-i,{start:i,count:s}}var _m={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(e,t,n)=>{if(!n.enabled){ho(e);return}const i=e.width;e.data.datasets.forEach((s,o)=>{const{_data:r,indexAxis:a}=s,c=e.getDatasetMeta(o),l=r||s.data;if(Ce([a,e.options.indexAxis])==="y"||!c.controller.supportsDecimation)return;const h=e.scales[c.xAxisID];if(h.type!=="linear"&&h.type!=="time"||e.options.parsing)return;let{start:u,count:d}=bm(c,l);const f=n.threshold||4*i;if(d<=f){pa(s);return}A(r)&&(s._data=l,delete s.data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(g){this._data=g}}));let p;switch(n.algorithm){case"lttb":p=gm(l,u,d,i,n);break;case"min-max":p=mm(l,u,d,i);break;default:throw new Error(`Unsupported decimation algorithm '${n.algorithm}'`)}s._decimated=p})},destroy(e){ho(e)}};function ym(e,t,n){const i=e.segments,s=e.points,o=t.points,r=[];for(const a of i){let{start:c,end:l}=a;l=Ln(c,l,s);const h=fi(n,s[c],s[l],a.loop);if(!t.segments){r.push({source:a,target:h,start:s[c],end:s[l]});continue}const u=qr(t,h);for(const d of u){const f=fi(n,o[d.start],o[d.end],d.loop),p=Yr(a,s,f);for(const g of p)r.push({source:g,target:d,start:{[n]:uo(h,f,"start",Math.max)},end:{[n]:uo(h,f,"end",Math.min)}})}}return r}function fi(e,t,n,i){if(i)return;let s=t[e],o=n[e];return e==="angle"&&(s=rt(s),o=rt(o)),{property:e,start:s,end:o}}function xm(e,t){const{x:n=null,y:i=null}=e||{},s=t.points,o=[];return t.segments.forEach(({start:r,end:a})=>{a=Ln(r,a,s);const c=s[r],l=s[a];i!==null?(o.push({x:c.x,y:i}),o.push({x:l.x,y:i})):n!==null&&(o.push({x:n,y:c.y}),o.push({x:n,y:l.y}))}),o}function Ln(e,t,n){for(;t>e;t--){const i=n[t];if(!isNaN(i.x)&&!isNaN(i.y))break}return t}function uo(e,t,n,i){return e&&t?i(e[n],t[n]):e?e[n]:t?t[n]:0}function ga(e,t){let n=[],i=!1;return Z(e)?(i=!0,n=e):n=xm(e,t),n.length?new Rn({points:n,options:{tension:0},_loop:i,_fullLoop:i}):null}function fo(e){return e&&e.fill!==!1}function vm(e,t,n){let s=e[t].fill;const o=[t];let r;if(!n)return s;for(;s!==!1&&o.indexOf(s)===-1;){if(!q(s))return s;if(r=e[s],!r)return!1;if(r.visible)return s;o.push(s),s=r.fill}return!1}function wm(e,t,n){const i=Pm(e);if(D(i))return isNaN(i.value)?!1:i;let s=parseFloat(i);return q(s)&&Math.floor(s)===s?km(i[0],t,s,n):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function km(e,t,n,i){return(e==="-"||e==="+")&&(n=t+n),n===t||n<0||n>=i?!1:n}function Sm(e,t){let n=null;return e==="start"?n=t.bottom:e==="end"?n=t.top:D(e)?n=t.getPixelForValue(e.value):t.getBasePixel&&(n=t.getBasePixel()),n}function Mm(e,t,n){let i;return e==="start"?i=n:e==="end"?i=t.options.reverse?t.min:t.max:D(e)?i=e.value:i=t.getBaseValue(),i}function Pm(e){const t=e.options,n=t.fill;let i=z(n&&n.target,n);return i===void 0&&(i=!!t.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function Cm(e){const{scale:t,index:n,line:i}=e,s=[],o=i.segments,r=i.points,a=Om(t,n);a.push(ga({x:null,y:t.bottom},i));for(let c=0;c<o.length;c++){const l=o[c];for(let h=l.start;h<=l.end;h++)zm(s,r[h],a)}return new Rn({points:s,options:{}})}function Om(e,t){const n=[],i=e.getMatchingVisibleMetas("line");for(let s=0;s<i.length;s++){const o=i[s];if(o.index===t)break;o.hidden||n.unshift(o.dataset)}return n}function zm(e,t,n){const i=[];for(let s=0;s<n.length;s++){const o=n[s],{first:r,last:a,point:c}=Tm(o,t,"x");if(!(!c||r&&a)){if(r)i.unshift(c);else if(e.push(c),!a)break}}e.push(...i)}function Tm(e,t,n){const i=e.interpolate(t,n);if(!i)return{};const s=i[n],o=e.segments,r=e.points;let a=!1,c=!1;for(let l=0;l<o.length;l++){const h=o[l],u=r[h.start][n],d=r[h.end][n];if(Ct(s,u,d)){a=s===u,c=s===d;break}}return{first:a,last:c,point:i}}class ma{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,n,i){const{x:s,y:o,radius:r}=this;return n=n||{start:0,end:j},t.arc(s,o,r,n.end,n.start,!0),!i.bounds}interpolate(t){const{x:n,y:i,radius:s}=this,o=t.angle;return{x:n+Math.cos(o)*s,y:i+Math.sin(o)*s,angle:o}}}function Am(e){const{chart:t,fill:n,line:i}=e;if(q(n))return Dm(t,n);if(n==="stack")return Cm(e);if(n==="shape")return!0;const s=Em(e);return s instanceof ma?s:ga(s,i)}function Dm(e,t){const n=e.getDatasetMeta(t);return n&&e.isDatasetVisible(t)?n.dataset:null}function Em(e){return(e.scale||{}).getPointPositionForValue?Rm(e):Im(e)}function Im(e){const{scale:t={},fill:n}=e,i=Sm(n,t);if(q(i)){const s=t.isHorizontal();return{x:s?i:null,y:s?null:i}}return null}function Rm(e){const{scale:t,fill:n}=e,i=t.options,s=t.getLabels().length,o=i.reverse?t.max:t.min,r=Mm(n,t,o),a=[];if(i.grid.circular){const c=t.getPointPositionForValue(0,o);return new ma({x:c.x,y:c.y,radius:t.getDistanceFromCenterForValue(r)})}for(let c=0;c<s;++c)a.push(t.getPointPositionForValue(c,r));return a}function Gn(e,t,n){const i=Am(t),{chart:s,index:o,line:r,scale:a,axis:c}=t,l=r.options,h=l.fill,u=l.backgroundColor,{above:d=u,below:f=u}=h||{},p=s.getDatasetMeta(o),g=Xr(s,p);i&&r.points.length&&(An(e,n),Lm(e,{line:r,target:i,above:d,below:f,area:n,scale:a,axis:c,clip:g}),Dn(e))}function Lm(e,t){const{line:n,target:i,above:s,below:o,area:r,scale:a,clip:c}=t,l=n._loop?"angle":t.axis;e.save();let h=o;o!==s&&(l==="x"?(po(e,i,r.top),Qn(e,{line:n,target:i,color:s,scale:a,property:l,clip:c}),e.restore(),e.save(),po(e,i,r.bottom)):l==="y"&&(go(e,i,r.left),Qn(e,{line:n,target:i,color:o,scale:a,property:l,clip:c}),e.restore(),e.save(),go(e,i,r.right),h=s)),Qn(e,{line:n,target:i,color:h,scale:a,property:l,clip:c}),e.restore()}function po(e,t,n){const{segments:i,points:s}=t;let o=!0,r=!1;e.beginPath();for(const a of i){const{start:c,end:l}=a,h=s[c],u=s[Ln(c,l,s)];o?(e.moveTo(h.x,h.y),o=!1):(e.lineTo(h.x,n),e.lineTo(h.x,h.y)),r=!!t.pathSegment(e,a,{move:r}),r?e.closePath():e.lineTo(u.x,n)}e.lineTo(t.first().x,n),e.closePath(),e.clip()}function go(e,t,n){const{segments:i,points:s}=t;let o=!0,r=!1;e.beginPath();for(const a of i){const{start:c,end:l}=a,h=s[c],u=s[Ln(c,l,s)];o?(e.moveTo(h.x,h.y),o=!1):(e.lineTo(n,h.y),e.lineTo(h.x,h.y)),r=!!t.pathSegment(e,a,{move:r}),r?e.closePath():e.lineTo(n,u.y)}e.lineTo(n,t.first().y),e.closePath(),e.clip()}function Qn(e,t){const{line:n,target:i,property:s,color:o,scale:r,clip:a}=t,c=ym(n,i,s);for(const{source:l,target:h,start:u,end:d}of c){const{style:{backgroundColor:f=o}={}}=l,p=i!==!0;e.save(),e.fillStyle=f,$m(e,r,a,p&&fi(s,u,d)),e.beginPath();const g=!!n.pathSegment(e,l);let m;if(p){g?e.closePath():mo(e,i,d,s);const b=!!i.pathSegment(e,h,{move:g,reverse:!0});m=g&&b,m||mo(e,i,u,s)}e.closePath(),e.fill(m?"evenodd":"nonzero"),e.restore()}}function $m(e,t,n,i){const s=t.chart.chartArea,{property:o,start:r,end:a}=i||{};if(o==="x"||o==="y"){let c,l,h,u;o==="x"?(c=r,l=s.top,h=a,u=s.bottom):(c=s.left,l=r,h=s.right,u=a),e.beginPath(),n&&(c=Math.max(c,n.left),h=Math.min(h,n.right),l=Math.max(l,n.top),u=Math.min(u,n.bottom)),e.rect(c,l,h-c,u-l),e.clip()}}function mo(e,t,n,i){const s=t.interpolate(n,i);s&&e.lineTo(s.x,s.y)}var Fm={id:"filler",afterDatasetsUpdate(e,t,n){const i=(e.data.datasets||[]).length,s=[];let o,r,a,c;for(r=0;r<i;++r)o=e.getDatasetMeta(r),a=o.dataset,c=null,a&&a.options&&a instanceof Rn&&(c={visible:e.isDatasetVisible(r),index:r,fill:wm(a,r,i),chart:e,axis:o.controller.options.indexAxis,scale:o.vScale,line:a}),o.$filler=c,s.push(c);for(r=0;r<i;++r)c=s[r],!(!c||c.fill===!1)&&(c.fill=vm(s,r,n.propagate))},beforeDraw(e,t,n){const i=n.drawTime==="beforeDraw",s=e.getSortedVisibleDatasetMetas(),o=e.chartArea;for(let r=s.length-1;r>=0;--r){const a=s[r].$filler;a&&(a.line.updateControlPoints(o,a.axis),i&&a.fill&&Gn(e.ctx,a,o))}},beforeDatasetsDraw(e,t,n){if(n.drawTime!=="beforeDatasetsDraw")return;const i=e.getSortedVisibleDatasetMetas();for(let s=i.length-1;s>=0;--s){const o=i[s].$filler;fo(o)&&Gn(e.ctx,o,e.chartArea)}},beforeDatasetDraw(e,t,n){const i=t.meta.$filler;!fo(i)||n.drawTime!=="beforeDatasetDraw"||Gn(e.ctx,i,e.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const bo=(e,t)=>{let{boxHeight:n=t,boxWidth:i=t}=e;return e.usePointStyle&&(n=Math.min(n,t),i=e.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:n,itemHeight:Math.max(t,n)}},Nm=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class _o extends Tt{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,n,i){this.maxWidth=t,this.maxHeight=n,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 n=B(t.generateLabels,[this.chart],this)||[];t.filter&&(n=n.filter(i=>t.filter(i,this.chart.data))),t.sort&&(n=n.sort((i,s)=>t.sort(i,s,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:t,ctx:n}=this;if(!t.display){this.width=this.height=0;return}const i=t.labels,s=tt(i.font),o=s.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:c}=bo(i,o);let l,h;n.font=s.string,this.isHorizontal()?(l=this.maxWidth,h=this._fitRows(r,o,a,c)+10):(h=this.maxHeight,l=this._fitCols(r,s,a,c)+10),this.width=Math.min(l,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,n,i,s){const{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,c=this.legendHitBoxes=[],l=this.lineWidths=[0],h=s+a;let u=t;o.textAlign="left",o.textBaseline="middle";let d=-1,f=-h;return this.legendItems.forEach((p,g)=>{const m=i+n/2+o.measureText(p.text).width;(g===0||l[l.length-1]+m+2*a>r)&&(u+=h,l[l.length-(g>0?0:1)]=0,f+=h,d++),c[g]={left:0,top:f,row:d,width:m,height:s},l[l.length-1]+=m+a}),u}_fitCols(t,n,i,s){const{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,c=this.legendHitBoxes=[],l=this.columnSizes=[],h=r-t;let u=a,d=0,f=0,p=0,g=0;return this.legendItems.forEach((m,b)=>{const{itemWidth:_,itemHeight:w}=Bm(i,n,o,m,s);b>0&&f+w+2*a>h&&(u+=d+a,l.push({width:d,height:f}),p+=d+a,g++,d=f=0),c[b]={left:p,top:f,col:g,width:_,height:w},d=Math.max(d,_),f+=w+a}),u+=d,l.push({width:d,height:f}),u}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:i,labels:{padding:s},rtl:o}}=this,r=fe(o,this.left,this.width);if(this.isHorizontal()){let a=0,c=ot(i,this.left+s,this.right-this.lineWidths[a]);for(const l of n)a!==l.row&&(a=l.row,c=ot(i,this.left+s,this.right-this.lineWidths[a])),l.top+=this.top+t+s,l.left=r.leftForLtr(r.x(c),l.width),c+=l.width+s}else{let a=0,c=ot(i,this.top+t+s,this.bottom-this.columnSizes[a].height);for(const l of n)l.col!==a&&(a=l.col,c=ot(i,this.top+t+s,this.bottom-this.columnSizes[a].height)),l.top=c,l.left+=this.left+s,l.left=r.leftForLtr(r.x(l.left),l.width),c+=l.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;An(t,this),this._draw(),Dn(t)}}_draw(){const{options:t,columnSizes:n,lineWidths:i,ctx:s}=this,{align:o,labels:r}=t,a=W.color,c=fe(t.rtl,this.left,this.width),l=tt(r.font),{padding:h}=r,u=l.size,d=u/2;let f;this.drawTitle(),s.textAlign=c.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=l.string;const{boxWidth:p,boxHeight:g,itemHeight:m}=bo(r,u),b=function(k,S,M){if(isNaN(p)||p<=0||isNaN(g)||g<0)return;s.save();const P=z(M.lineWidth,1);if(s.fillStyle=z(M.fillStyle,a),s.lineCap=z(M.lineCap,"butt"),s.lineDashOffset=z(M.lineDashOffset,0),s.lineJoin=z(M.lineJoin,"miter"),s.lineWidth=P,s.strokeStyle=z(M.strokeStyle,a),s.setLineDash(z(M.lineDash,[])),r.usePointStyle){const O={radius:g*Math.SQRT2/2,pointStyle:M.pointStyle,rotation:M.rotation,borderWidth:P},T=c.xPlus(k,p/2),E=S+d;Lr(s,O,T,E,r.pointStyleWidth&&p)}else{const O=S+Math.max((u-g)/2,0),T=c.leftForLtr(k,p),E=Gt(M.borderRadius);s.beginPath(),Object.values(E).some(nt=>nt!==0)?Be(s,{x:T,y:O,w:p,h:g,radius:E}):s.rect(T,O,p,g),s.fill(),P!==0&&s.stroke()}s.restore()},_=function(k,S,M){ie(s,M.text,k,S+m/2,l,{strikethrough:M.hidden,textAlign:c.textAlign(M.textAlign)})},w=this.isHorizontal(),x=this._computeTitleHeight();w?f={x:ot(o,this.left+h,this.right-i[0]),y:this.top+h+x,line:0}:f={x:this.left+h,y:ot(o,this.top+x+h,this.bottom-n[0].height),line:0},Wr(this.ctx,t.textDirection);const y=m+h;this.legendItems.forEach((k,S)=>{s.strokeStyle=k.fontColor,s.fillStyle=k.fontColor;const M=s.measureText(k.text).width,P=c.textAlign(k.textAlign||(k.textAlign=r.textAlign)),O=p+d+M;let T=f.x,E=f.y;c.setWidth(this.width),w?S>0&&T+O+h>this.right&&(E=f.y+=y,f.line++,T=f.x=ot(o,this.left+h,this.right-i[f.line])):S>0&&E+y>this.bottom&&(T=f.x=T+n[f.line].width+h,f.line++,E=f.y=ot(o,this.top+x+h,this.bottom-n[f.line].height));const nt=c.x(T);if(b(nt,E,k),T=Xd(P,T+p+d,w?T+O:this.right,t.rtl),_(c.x(T),E,k),w)f.x+=O+h;else if(typeof k.text!="string"){const pt=l.lineHeight;f.y+=ba(k,pt)+h}else f.y+=y}),Hr(this.ctx,t.textDirection)}drawTitle(){const t=this.options,n=t.title,i=tt(n.font),s=lt(n.padding);if(!n.display)return;const o=fe(t.rtl,this.left,this.width),r=this.ctx,a=n.position,c=i.size/2,l=s.top+c;let h,u=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),h=this.top+l,u=ot(t.align,u,this.right-d);else{const p=this.columnSizes.reduce((g,m)=>Math.max(g,m.height),0);h=l+ot(t.align,this.top,this.bottom-p-t.labels.padding-this._computeTitleHeight())}const f=ot(a,u,u+d);r.textAlign=o.textAlign(zi(a)),r.textBaseline="middle",r.strokeStyle=n.color,r.fillStyle=n.color,r.font=i.string,ie(r,n.text,f,h,i)}_computeTitleHeight(){const t=this.options.title,n=tt(t.font),i=lt(t.padding);return t.display?n.lineHeight+i.height:0}_getLegendItemAt(t,n){let i,s,o;if(Ct(t,this.left,this.right)&&Ct(n,this.top,this.bottom)){for(o=this.legendHitBoxes,i=0;i<o.length;++i)if(s=o[i],Ct(t,s.left,s.left+s.width)&&Ct(n,s.top,s.top+s.height))return this.legendItems[i]}return null}handleEvent(t){const n=this.options;if(!Zm(t.type,n))return;const i=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const s=this._hoveredItem,o=Nm(s,i);s&&!o&&B(n.onLeave,[t,s,this],this),this._hoveredItem=i,i&&!o&&B(n.onHover,[t,i,this],this)}else i&&B(n.onClick,[t,i,this],this)}}function Bm(e,t,n,i,s){const o=jm(i,e,t,n),r=Vm(s,i,t.lineHeight);return{itemWidth:o,itemHeight:r}}function jm(e,t,n,i){let s=e.text;return s&&typeof s!="string"&&(s=s.reduce((o,r)=>o.length>r.length?o:r)),t+n.size/2+i.measureText(s).width}function Vm(e,t,n){let i=e;return typeof t.text!="string"&&(i=ba(t,n)),i}function ba(e,t){const n=e.text?e.text.length:0;return t*n}function Zm(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var Wm={id:"legend",_element:_o,start(e,t,n){const i=e.legend=new _o({ctx:e.ctx,options:n,chart:e});at.configure(e,i,n),at.addBox(e,i)},stop(e){at.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const i=e.legend;at.configure(e,i,n),i.options=n},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){const i=t.datasetIndex,s=n.chart;s.isDatasetVisible(i)?(s.hide(i),t.hidden=!0):(s.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:i,textAlign:s,color:o,useBorderRadius:r,borderRadius:a}}=e.legend.options;return e._getSortedDatasetMetas().map(c=>{const l=c.controller.getStyle(n?0:void 0),h=lt(l.borderWidth);return{text:t[c.index].label,fillStyle:l.backgroundColor,fontColor:o,hidden:!c.visible,lineCap:l.borderCapStyle,lineDash:l.borderDash,lineDashOffset:l.borderDashOffset,lineJoin:l.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:l.borderColor,pointStyle:i||l.pointStyle,rotation:l.rotation,textAlign:s||l.textAlign,borderRadius:r&&(a||l.borderRadius),datasetIndex:c.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};class Ni extends Tt{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n){const i=this.options;if(this.left=0,this.top=0,!i.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=n;const s=Z(i.text)?i.text.length:1;this._padding=lt(i.padding);const o=s*tt(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:n,left:i,bottom:s,right:o,options:r}=this,a=r.align;let c=0,l,h,u;return this.isHorizontal()?(h=ot(a,i,o),u=n+t,l=o-i):(r.position==="left"?(h=i+t,u=ot(a,s,n),c=I*-.5):(h=o-t,u=ot(a,n,s),c=I*.5),l=s-n),{titleX:h,titleY:u,maxWidth:l,rotation:c}}draw(){const t=this.ctx,n=this.options;if(!n.display)return;const i=tt(n.font),o=i.lineHeight/2+this._padding.top,{titleX:r,titleY:a,maxWidth:c,rotation:l}=this._drawArgs(o);ie(t,n.text,0,0,i,{color:n.color,maxWidth:c,rotation:l,textAlign:zi(n.align),textBaseline:"middle",translation:[r,a]})}}function Hm(e,t){const n=new Ni({ctx:e.ctx,options:t,chart:e});at.configure(e,n,t),at.addBox(e,n),e.titleBlock=n}var Um={id:"title",_element:Ni,start(e,t,n){Hm(e,n)},stop(e){const t=e.titleBlock;at.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,n){const i=e.titleBlock;at.configure(e,i,n),i.options=n},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const an=new WeakMap;var Ym={id:"subtitle",start(e,t,n){const i=new Ni({ctx:e.ctx,options:n,chart:e});at.configure(e,i,n),at.addBox(e,i),an.set(e,i)},stop(e){at.removeBox(e,an.get(e)),an.delete(e)},beforeUpdate(e,t,n){const i=an.get(e);at.configure(e,i,n),i.options=n},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const ze={average(e){if(!e.length)return!1;let t,n,i=new Set,s=0,o=0;for(t=0,n=e.length;t<n;++t){const a=e[t].element;if(a&&a.hasValue()){const c=a.tooltipPosition();i.add(c.x),s+=c.y,++o}}return o===0||i.size===0?!1:{x:[...i].reduce((a,c)=>a+c)/i.size,y:s/o}},nearest(e,t){if(!e.length)return!1;let n=t.x,i=t.y,s=Number.POSITIVE_INFINITY,o,r,a;for(o=0,r=e.length;o<r;++o){const c=e[o].element;if(c&&c.hasValue()){const l=c.getCenterPoint(),h=ri(t,l);h<s&&(s=h,a=c)}}if(a){const c=a.tooltipPosition();n=c.x,i=c.y}return{x:n,y:i}}};function xt(e,t){return t&&(Z(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function Mt(e){return(typeof e=="string"||e instanceof String)&&e.indexOf(`
|
|
40
|
+
`)>-1?e.split(`
|
|
41
|
+
`):e}function qm(e,t){const{element:n,datasetIndex:i,index:s}=t,o=e.getDatasetMeta(i).controller,{label:r,value:a}=o.getLabelAndValue(s);return{chart:e,label:r,parsed:o.getParsed(s),raw:e.data.datasets[i].data[s],formattedValue:a,dataset:o.getDataset(),dataIndex:s,datasetIndex:i,element:n}}function yo(e,t){const n=e.chart.ctx,{body:i,footer:s,title:o}=e,{boxWidth:r,boxHeight:a}=t,c=tt(t.bodyFont),l=tt(t.titleFont),h=tt(t.footerFont),u=o.length,d=s.length,f=i.length,p=lt(t.padding);let g=p.height,m=0,b=i.reduce((x,y)=>x+y.before.length+y.lines.length+y.after.length,0);if(b+=e.beforeBody.length+e.afterBody.length,u&&(g+=u*l.lineHeight+(u-1)*t.titleSpacing+t.titleMarginBottom),b){const x=t.displayColors?Math.max(a,c.lineHeight):c.lineHeight;g+=f*x+(b-f)*c.lineHeight+(b-1)*t.bodySpacing}d&&(g+=t.footerMarginTop+d*h.lineHeight+(d-1)*t.footerSpacing);let _=0;const w=function(x){m=Math.max(m,n.measureText(x).width+_)};return n.save(),n.font=l.string,$(e.title,w),n.font=c.string,$(e.beforeBody.concat(e.afterBody),w),_=t.displayColors?r+2+t.boxPadding:0,$(i,x=>{$(x.before,w),$(x.lines,w),$(x.after,w)}),_=0,n.font=h.string,$(e.footer,w),n.restore(),m+=p.width,{width:m,height:g}}function Xm(e,t){const{y:n,height:i}=t;return n<i/2?"top":n>e.height-i/2?"bottom":"center"}function Jm(e,t,n,i){const{x:s,width:o}=i,r=n.caretSize+n.caretPadding;if(e==="left"&&s+o+r>t.width||e==="right"&&s-o-r<0)return!0}function Km(e,t,n,i){const{x:s,width:o}=n,{width:r,chartArea:{left:a,right:c}}=e;let l="center";return i==="center"?l=s<=(a+c)/2?"left":"right":s<=o/2?l="left":s>=r-o/2&&(l="right"),Jm(l,e,t,n)&&(l="center"),l}function xo(e,t,n){const i=n.yAlign||t.yAlign||Xm(e,n);return{xAlign:n.xAlign||t.xAlign||Km(e,t,n,i),yAlign:i}}function Gm(e,t){let{x:n,width:i}=e;return t==="right"?n-=i:t==="center"&&(n-=i/2),n}function Qm(e,t,n){let{y:i,height:s}=e;return t==="top"?i+=n:t==="bottom"?i-=s+n:i-=s/2,i}function vo(e,t,n,i){const{caretSize:s,caretPadding:o,cornerRadius:r}=e,{xAlign:a,yAlign:c}=n,l=s+o,{topLeft:h,topRight:u,bottomLeft:d,bottomRight:f}=Gt(r);let p=Gm(t,a);const g=Qm(t,c,l);return c==="center"?a==="left"?p+=l:a==="right"&&(p-=l):a==="left"?p-=Math.max(h,d)+s:a==="right"&&(p+=Math.max(u,f)+s),{x:et(p,0,i.width-t.width),y:et(g,0,i.height-t.height)}}function cn(e,t,n){const i=lt(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-i.right:e.x+i.left}function wo(e){return xt([],Mt(e))}function tb(e,t,n){return Vt(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function ko(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const _a={beforeTitle:kt,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,i=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex<i)return n[t.dataIndex]}return""},afterTitle:kt,beforeBody:kt,beforeLabel:kt,label(e){if(this&&this.options&&this.options.mode==="dataset")return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");const n=e.formattedValue;return A(n)||(t+=n),t},labelColor(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:n.borderColor,backgroundColor:n.backgroundColor,borderWidth:n.borderWidth,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:kt,afterBody:kt,beforeFooter:kt,footer:kt,afterFooter:kt};function ut(e,t,n,i){const s=e[t].call(n,i);return typeof s>"u"?_a[t].call(n,i):s}class So extends Tt{static positioners=ze;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 n=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&n.options.animation&&i.animations,o=new Jr(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=tb(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:i}=n,s=ut(i,"beforeTitle",this,t),o=ut(i,"title",this,t),r=ut(i,"afterTitle",this,t);let a=[];return a=xt(a,Mt(s)),a=xt(a,Mt(o)),a=xt(a,Mt(r)),a}getBeforeBody(t,n){return wo(ut(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:i}=n,s=[];return $(t,o=>{const r={before:[],lines:[],after:[]},a=ko(i,o);xt(r.before,Mt(ut(a,"beforeLabel",this,o))),xt(r.lines,ut(a,"label",this,o)),xt(r.after,Mt(ut(a,"afterLabel",this,o))),s.push(r)}),s}getAfterBody(t,n){return wo(ut(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:i}=n,s=ut(i,"beforeFooter",this,t),o=ut(i,"footer",this,t),r=ut(i,"afterFooter",this,t);let a=[];return a=xt(a,Mt(s)),a=xt(a,Mt(o)),a=xt(a,Mt(r)),a}_createItems(t){const n=this._active,i=this.chart.data,s=[],o=[],r=[];let a=[],c,l;for(c=0,l=n.length;c<l;++c)a.push(qm(this.chart,n[c]));return t.filter&&(a=a.filter((h,u,d)=>t.filter(h,u,d,i))),t.itemSort&&(a=a.sort((h,u)=>t.itemSort(h,u,i))),$(a,h=>{const u=ko(t.callbacks,h);s.push(ut(u,"labelColor",this,h)),o.push(ut(u,"labelPointStyle",this,h)),r.push(ut(u,"labelTextColor",this,h))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(t,n){const i=this.options.setContext(this.getContext()),s=this._active;let o,r=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const a=ze[i.position].call(this,s,this._eventPosition);r=this._createItems(i),this.title=this.getTitle(r,i),this.beforeBody=this.getBeforeBody(r,i),this.body=this.getBody(r,i),this.afterBody=this.getAfterBody(r,i),this.footer=this.getFooter(r,i);const c=this._size=yo(this,i),l=Object.assign({},a,c),h=xo(this.chart,i,l),u=vo(i,l,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:u.x,y:u.y,width:c.width,height:c.height,caretX:a.x,caretY:a.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,i,s){const o=this.getCaretPosition(t,i,s);n.lineTo(o.x1,o.y1),n.lineTo(o.x2,o.y2),n.lineTo(o.x3,o.y3)}getCaretPosition(t,n,i){const{xAlign:s,yAlign:o}=this,{caretSize:r,cornerRadius:a}=i,{topLeft:c,topRight:l,bottomLeft:h,bottomRight:u}=Gt(a),{x:d,y:f}=t,{width:p,height:g}=n;let m,b,_,w,x,y;return o==="center"?(x=f+g/2,s==="left"?(m=d,b=m-r,w=x+r,y=x-r):(m=d+p,b=m+r,w=x-r,y=x+r),_=m):(s==="left"?b=d+Math.max(c,h)+r:s==="right"?b=d+p-Math.max(l,u)-r:b=this.caretX,o==="top"?(w=f,x=w-r,m=b-r,_=b+r):(w=f+g,x=w+r,m=b+r,_=b-r),y=w),{x1:m,x2:b,x3:_,y1:w,y2:x,y3:y}}drawTitle(t,n,i){const s=this.title,o=s.length;let r,a,c;if(o){const l=fe(i.rtl,this.x,this.width);for(t.x=cn(this,i.titleAlign,i),n.textAlign=l.textAlign(i.titleAlign),n.textBaseline="middle",r=tt(i.titleFont),a=i.titleSpacing,n.fillStyle=i.titleColor,n.font=r.string,c=0;c<o;++c)n.fillText(s[c],l.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+a,c+1===o&&(t.y+=i.titleMarginBottom-a)}}_drawColorBox(t,n,i,s,o){const r=this.labelColors[i],a=this.labelPointStyles[i],{boxHeight:c,boxWidth:l}=o,h=tt(o.bodyFont),u=cn(this,"left",o),d=s.x(u),f=c<h.lineHeight?(h.lineHeight-c)/2:0,p=n.y+f;if(o.usePointStyle){const g={radius:Math.min(l,c)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},m=s.leftForLtr(d,l)+l/2,b=p+c/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,ci(t,g,m,b),t.strokeStyle=r.borderColor,t.fillStyle=r.backgroundColor,ci(t,g,m,b)}else{t.lineWidth=D(r.borderWidth)?Math.max(...Object.values(r.borderWidth)):r.borderWidth||1,t.strokeStyle=r.borderColor,t.setLineDash(r.borderDash||[]),t.lineDashOffset=r.borderDashOffset||0;const g=s.leftForLtr(d,l),m=s.leftForLtr(s.xPlus(d,1),l-2),b=Gt(r.borderRadius);Object.values(b).some(_=>_!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Be(t,{x:g,y:p,w:l,h:c,radius:b}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),Be(t,{x:m,y:p+1,w:l-2,h:c-2,radius:b}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(g,p,l,c),t.strokeRect(g,p,l,c),t.fillStyle=r.backgroundColor,t.fillRect(m,p+1,l-2,c-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,n,i){const{body:s}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:c,boxWidth:l,boxPadding:h}=i,u=tt(i.bodyFont);let d=u.lineHeight,f=0;const p=fe(i.rtl,this.x,this.width),g=function(M){n.fillText(M,p.x(t.x+f),t.y+d/2),t.y+=d+o},m=p.textAlign(r);let b,_,w,x,y,k,S;for(n.textAlign=r,n.textBaseline="middle",n.font=u.string,t.x=cn(this,m,i),n.fillStyle=i.bodyColor,$(this.beforeBody,g),f=a&&m!=="right"?r==="center"?l/2+h:l+2+h:0,x=0,k=s.length;x<k;++x){for(b=s[x],_=this.labelTextColors[x],n.fillStyle=_,$(b.before,g),w=b.lines,a&&w.length&&(this._drawColorBox(n,t,x,p,i),d=Math.max(u.lineHeight,c)),y=0,S=w.length;y<S;++y)g(w[y]),d=u.lineHeight;$(b.after,g)}f=0,d=u.lineHeight,$(this.afterBody,g),t.y-=o}drawFooter(t,n,i){const s=this.footer,o=s.length;let r,a;if(o){const c=fe(i.rtl,this.x,this.width);for(t.x=cn(this,i.footerAlign,i),t.y+=i.footerMarginTop,n.textAlign=c.textAlign(i.footerAlign),n.textBaseline="middle",r=tt(i.footerFont),n.fillStyle=i.footerColor,n.font=r.string,a=0;a<o;++a)n.fillText(s[a],c.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+i.footerSpacing}}drawBackground(t,n,i,s){const{xAlign:o,yAlign:r}=this,{x:a,y:c}=t,{width:l,height:h}=i,{topLeft:u,topRight:d,bottomLeft:f,bottomRight:p}=Gt(s.cornerRadius);n.fillStyle=s.backgroundColor,n.strokeStyle=s.borderColor,n.lineWidth=s.borderWidth,n.beginPath(),n.moveTo(a+u,c),r==="top"&&this.drawCaret(t,n,i,s),n.lineTo(a+l-d,c),n.quadraticCurveTo(a+l,c,a+l,c+d),r==="center"&&o==="right"&&this.drawCaret(t,n,i,s),n.lineTo(a+l,c+h-p),n.quadraticCurveTo(a+l,c+h,a+l-p,c+h),r==="bottom"&&this.drawCaret(t,n,i,s),n.lineTo(a+f,c+h),n.quadraticCurveTo(a,c+h,a,c+h-f),r==="center"&&o==="left"&&this.drawCaret(t,n,i,s),n.lineTo(a,c+u),n.quadraticCurveTo(a,c,a+u,c),n.closePath(),n.fill(),s.borderWidth>0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,i=this.$animations,s=i&&i.x,o=i&&i.y;if(s||o){const r=ze[t.position].call(this,this._active,this._eventPosition);if(!r)return;const a=this._size=yo(this,t),c=Object.assign({},r,this._size),l=xo(n,t,c),h=vo(t,c,l,n);(s._to!==h.x||o._to!==h.y)&&(this.xAlign=l.xAlign,this.yAlign=l.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){const n=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(n);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const r=lt(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(o,t,s,n),Wr(t,n.textDirection),o.y+=r.top,this.drawTitle(o,t,n),this.drawBody(o,t,n),this.drawFooter(o,t,n),Hr(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const i=this._active,s=t.map(({datasetIndex:a,index:c})=>{const l=this.chart.getDatasetMeta(a);if(!l)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:l.data[c],index:c}}),o=!bn(i,s),r=this._positionChanged(s,n);(o||r)&&(this._active=s,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,i=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],r=this._getActiveElements(t,o,n,i),a=this._positionChanged(r,t),c=n||!bn(r,o)||a;return c&&(this._active=r,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),c}_getActiveElements(t,n,i,s){const o=this.options;if(t.type==="mouseout")return[];if(!s)return n.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const r=this.chart.getElementsAtEventForMode(t,o.mode,o,i);return o.reverse&&r.reverse(),r}_positionChanged(t,n){const{caretX:i,caretY:s,options:o}=this,r=ze[o.position].call(this,t,n);return r!==!1&&(i!==r.x||s!==r.y)}}var eb={id:"tooltip",_element:So,positioners:ze,afterInit(e,t,n){n&&(e.tooltip=new So({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:_a},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},nb=Object.freeze({__proto__:null,Colors:pm,Decimation:_m,Filler:Fm,Legend:Wm,SubTitle:Ym,Title:Um,Tooltip:eb});const ib=(e,t,n,i)=>(typeof t=="string"?(n=e.push(t)-1,i.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function sb(e,t,n,i){const s=e.indexOf(t);if(s===-1)return ib(e,t,n,i);const o=e.lastIndexOf(t);return s!==o?n:s}const ob=(e,t)=>e===null?null:et(Math.round(e),0,t);function Mo(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class rb extends oe{static id="category";static defaults={ticks:{callback:Mo}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const n=this._addedLabels;if(n.length){const i=this.getLabels();for(const{index:s,label:o}of n)i[s]===o&&i.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,n){if(A(t))return null;const i=this.getLabels();return n=isFinite(n)&&i[n]===t?n:sb(i,t,z(n,t),this._addedLabels),ob(n,i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(i=0),n||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,n=this.max,i=this.options.offset,s=[];let o=this.getLabels();o=t===0&&n===o.length-1?o:o.slice(t,n+1),this._valueRange=Math.max(o.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let r=t;r<=n;r++)s.push({value:r});return s}getLabelForValue(t){return Mo.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}function ab(e,t){const n=[],{bounds:s,step:o,min:r,max:a,precision:c,count:l,maxTicks:h,maxDigits:u,includeBounds:d}=e,f=o||1,p=h-1,{min:g,max:m}=t,b=!A(r),_=!A(a),w=!A(l),x=(m-g)/(u+1);let y=_s((m-g)/p/f)*f,k,S,M,P;if(y<1e-14&&!b&&!_)return[{value:g},{value:m}];P=Math.ceil(m/y)-Math.floor(g/y),P>p&&(y=_s(P*y/p/f)*f),A(c)||(k=Math.pow(10,c),y=Math.ceil(y*k)/k),s==="ticks"?(S=Math.floor(g/y)*y,M=Math.ceil(m/y)*y):(S=g,M=m),b&&_&&o&&Vd((a-r)/o,y/1e3)?(P=Math.round(Math.min((a-r)/y,h)),y=(a-r)/P,S=r,M=a):w?(S=b?r:S,M=_?a:M,P=l-1,y=(M-S)/P):(P=(M-S)/y,Ae(P,Math.round(P),y/1e3)?P=Math.round(P):P=Math.ceil(P));const O=Math.max(ys(y),ys(S));k=Math.pow(10,A(c)?O:c),S=Math.round(S*k)/k,M=Math.round(M*k)/k;let T=0;for(b&&(d&&S!==r?(n.push({value:r}),S<r&&T++,Ae(Math.round((S+T*y)*k)/k,r,Po(r,x,e))&&T++):S<r&&T++);T<P;++T){const E=Math.round((S+T*y)*k)/k;if(_&&E>a)break;n.push({value:E})}return _&&d&&M!==a?n.length&&Ae(n[n.length-1].value,a,Po(a,x,e))?n[n.length-1].value=a:n.push({value:a}):(!_||M===a)&&n.push({value:M}),n}function Po(e,t,{horizontal:n,minRotation:i}){const s=yt(i),o=(n?Math.sin(s):Math.cos(s))||.001,r=.75*t*(""+e).length;return Math.min(t/o,r)}class Mn extends oe{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,n){return A(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:i}=this.getUserBounds();let{min:s,max:o}=this;const r=c=>s=n?s:c,a=c=>o=i?o:c;if(t){const c=wt(s),l=wt(o);c<0&&l<0?a(0):c>0&&l>0&&r(0)}if(s===o){let c=o===0?1:Math.abs(o*.05);a(o+c),t||r(s-c)}this.min=s,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:i}=t,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),n=n||11),n&&(s=Math.min(n,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},o=this._range||this,r=ab(s,o);return t.bounds==="ticks"&&Cr(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const t=this.ticks;let n=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-n)/Math.max(t.length-1,1)/2;n-=s,i+=s}this._startValue=n,this._endValue=i,this._valueRange=i-n}getLabelForValue(t){return We(t,this.chart.options.locale,this.options.ticks.format)}}class cb extends Mn{static id="linear";static defaults={ticks:{callback:Tn.formatters.numeric}};determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=q(t)?t:0,this.max=q(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,i=yt(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const Ve=e=>Math.floor(Dt(e)),Xt=(e,t)=>Math.pow(10,Ve(e)+t);function Co(e){return e/Math.pow(10,Ve(e))===1}function Oo(e,t,n){const i=Math.pow(10,n),s=Math.floor(e/i);return Math.ceil(t/i)-s}function lb(e,t){const n=t-e;let i=Ve(n);for(;Oo(e,t,i)>10;)i++;for(;Oo(e,t,i)<10;)i--;return Math.min(i,Ve(e))}function hb(e,{min:t,max:n}){t=gt(e.min,t);const i=[],s=Ve(t);let o=lb(t,n),r=o<0?Math.pow(10,Math.abs(o)):1;const a=Math.pow(10,o),c=s>o?Math.pow(10,s):0,l=Math.round((t-c)*r)/r,h=Math.floor((t-c)/a/10)*a*10;let u=Math.floor((l-h)/Math.pow(10,o)),d=gt(e.min,Math.round((c+h+u*Math.pow(10,o))*r)/r);for(;d<n;)i.push({value:d,major:Co(d),significand:u}),u>=10?u=u<15?15:20:u++,u>=20&&(o++,u=2,r=o>=0?1:r),d=Math.round((c+h+u*Math.pow(10,o))*r)/r;const f=gt(e.max,d);return i.push({value:f,major:Co(f),significand:u}),i}class ub extends oe{static id="logarithmic";static defaults={ticks:{callback:Tn.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,n){const i=Mn.prototype.parse.apply(this,[t,n]);if(i===0){this._zero=!0;return}return q(i)&&i>0?i:null}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=q(t)?Math.max(0,t):null,this.max=q(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!q(this._userMin)&&(this.min=t===Xt(this.min,0)?Xt(this.min,-1):Xt(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let i=this.min,s=this.max;const o=a=>i=t?i:a,r=a=>s=n?s:a;i===s&&(i<=0?(o(1),r(10)):(o(Xt(i,-1)),r(Xt(s,1)))),i<=0&&o(Xt(s,-1)),s<=0&&r(Xt(i,1)),this.min=i,this.max=s}buildTicks(){const t=this.options,n={min:this._userMin,max:this._userMax},i=hb(n,this);return t.bounds==="ticks"&&Cr(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":We(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=Dt(t),this._valueRange=Dt(this.max)-Dt(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Dt(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const n=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+n*this._valueRange)}}function pi(e){const t=e.ticks;if(t.display&&e.display){const n=lt(t.backdropPadding);return z(t.font&&t.font.size,W.font.size)+n.height}return 0}function db(e,t,n){return n=Z(n)?n:[n],{w:rf(e,t.string,n),h:n.length*t.lineHeight}}function zo(e,t,n,i,s){return e===i||e===s?{start:t-n/2,end:t+n/2}:e<i||e>s?{start:t-n,end:t}:{start:t,end:t+n}}function fb(e){const t={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},n=Object.assign({},t),i=[],s=[],o=e._pointLabels.length,r=e.options.pointLabels,a=r.centerPointLabels?I/o:0;for(let c=0;c<o;c++){const l=r.setContext(e.getPointLabelContext(c));s[c]=l.padding;const h=e.getPointPosition(c,e.drawingArea+s[c],a),u=tt(l.font),d=db(e.ctx,u,e._pointLabels[c]);i[c]=d;const f=rt(e.getIndexAngle(c)+a),p=Math.round(Ci(f)),g=zo(p,h.x,d.w,0,180),m=zo(p,h.y,d.h,90,270);pb(n,t,f,g,m)}e.setCenterPoint(t.l-n.l,n.r-t.r,t.t-n.t,n.b-t.b),e._pointLabelItems=bb(e,i,s)}function pb(e,t,n,i,s){const o=Math.abs(Math.sin(n)),r=Math.abs(Math.cos(n));let a=0,c=0;i.start<t.l?(a=(t.l-i.start)/o,e.l=Math.min(e.l,t.l-a)):i.end>t.r&&(a=(i.end-t.r)/o,e.r=Math.max(e.r,t.r+a)),s.start<t.t?(c=(t.t-s.start)/r,e.t=Math.min(e.t,t.t-c)):s.end>t.b&&(c=(s.end-t.b)/r,e.b=Math.max(e.b,t.b+c))}function gb(e,t,n){const i=e.drawingArea,{extra:s,additionalAngle:o,padding:r,size:a}=n,c=e.getPointPosition(t,i+s+r,o),l=Math.round(Ci(rt(c.angle+J))),h=xb(c.y,a.h,l),u=_b(l),d=yb(c.x,a.w,u);return{visible:!0,x:c.x,y:h,textAlign:u,left:d,top:h,right:d+a.w,bottom:h+a.h}}function mb(e,t){if(!t)return!0;const{left:n,top:i,right:s,bottom:o}=e;return!(zt({x:n,y:i},t)||zt({x:n,y:o},t)||zt({x:s,y:i},t)||zt({x:s,y:o},t))}function bb(e,t,n){const i=[],s=e._pointLabels.length,o=e.options,{centerPointLabels:r,display:a}=o.pointLabels,c={extra:pi(o)/2,additionalAngle:r?I/s:0};let l;for(let h=0;h<s;h++){c.padding=n[h],c.size=t[h];const u=gb(e,h,c);i.push(u),a==="auto"&&(u.visible=mb(u,l),u.visible&&(l=u))}return i}function _b(e){return e===0||e===180?"center":e<180?"left":"right"}function yb(e,t,n){return n==="right"?e-=t:n==="center"&&(e-=t/2),e}function xb(e,t,n){return n===90||n===270?e-=t/2:(n>270||n<90)&&(e-=t),e}function vb(e,t,n){const{left:i,top:s,right:o,bottom:r}=n,{backdropColor:a}=t;if(!A(a)){const c=Gt(t.borderRadius),l=lt(t.backdropPadding);e.fillStyle=a;const h=i-l.left,u=s-l.top,d=o-i+l.width,f=r-s+l.height;Object.values(c).some(p=>p!==0)?(e.beginPath(),Be(e,{x:h,y:u,w:d,h:f,radius:c}),e.fill()):e.fillRect(h,u,d,f)}}function wb(e,t){const{ctx:n,options:{pointLabels:i}}=e;for(let s=t-1;s>=0;s--){const o=e._pointLabelItems[s];if(!o.visible)continue;const r=i.setContext(e.getPointLabelContext(s));vb(n,r,o);const a=tt(r.font),{x:c,y:l,textAlign:h}=o;ie(n,e._pointLabels[s],c,l+a.lineHeight/2,a,{color:r.color,textAlign:h,textBaseline:"middle"})}}function ya(e,t,n,i){const{ctx:s}=e;if(n)s.arc(e.xCenter,e.yCenter,t,0,j);else{let o=e.getPointPosition(0,t);s.moveTo(o.x,o.y);for(let r=1;r<i;r++)o=e.getPointPosition(r,t),s.lineTo(o.x,o.y)}}function kb(e,t,n,i,s){const o=e.ctx,r=t.circular,{color:a,lineWidth:c}=t;!r&&!i||!a||!c||n<0||(o.save(),o.strokeStyle=a,o.lineWidth=c,o.setLineDash(s.dash||[]),o.lineDashOffset=s.dashOffset,o.beginPath(),ya(e,n,r,i),o.closePath(),o.stroke(),o.restore())}function Sb(e,t,n){return Vt(e,{label:n,index:t,type:"pointLabel"})}class Mb extends Mn{static id="radialLinear";static defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Tn.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=lt(pi(this.options)/2),n=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+n/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(n,i)/2)}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!1);this.min=q(t)&&!isNaN(t)?t:0,this.max=q(n)&&!isNaN(n)?n:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/pi(this.options))}generateTickLabels(t){Mn.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((n,i)=>{const s=B(this.options.pointLabels.callback,[n,i],this);return s||s===0?s:""}).filter((n,i)=>this.chart.getDataVisibility(i))}fit(){const t=this.options;t.display&&t.pointLabels.display?fb(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,n,i,s){this.xCenter+=Math.floor((t-n)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,n,i,s))}getIndexAngle(t){const n=j/(this._pointLabels.length||1),i=this.options.startAngle||0;return rt(t*n+yt(i))}getDistanceFromCenterForValue(t){if(A(t))return NaN;const n=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*n:(t-this.min)*n}getValueForDistanceFromCenter(t){if(A(t))return NaN;const n=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-n:this.min+n}getPointLabelContext(t){const n=this._pointLabels||[];if(t>=0&&t<n.length){const i=n[t];return Sb(this.getContext(),t,i)}}getPointPosition(t,n,i=0){const s=this.getIndexAngle(t)-J+i;return{x:Math.cos(s)*n+this.xCenter,y:Math.sin(s)*n+this.yCenter,angle:s}}getPointPositionForValue(t,n){return this.getPointPosition(t,this.getDistanceFromCenterForValue(n))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:n,top:i,right:s,bottom:o}=this._pointLabelItems[t];return{left:n,top:i,right:s,bottom:o}}drawBackground(){const{backgroundColor:t,grid:{circular:n}}=this.options;if(t){const i=this.ctx;i.save(),i.beginPath(),ya(this,this.getDistanceFromCenterForValue(this._endValue),n,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){const t=this.ctx,n=this.options,{angleLines:i,grid:s,border:o}=n,r=this._pointLabels.length;let a,c,l;if(n.pointLabels.display&&wb(this,r),s.display&&this.ticks.forEach((h,u)=>{if(u!==0||u===0&&this.min<0){c=this.getDistanceFromCenterForValue(h.value);const d=this.getContext(u),f=s.setContext(d),p=o.setContext(d);kb(this,f,c,r,p)}}),i.display){for(t.save(),a=r-1;a>=0;a--){const h=i.setContext(this.getPointLabelContext(a)),{color:u,lineWidth:d}=h;!d||!u||(t.lineWidth=d,t.strokeStyle=u,t.setLineDash(h.borderDash),t.lineDashOffset=h.borderDashOffset,c=this.getDistanceFromCenterForValue(n.reverse?this.min:this.max),l=this.getPointPosition(a,c),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,n=this.options,i=n.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let o,r;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,c)=>{if(c===0&&this.min>=0&&!n.reverse)return;const l=i.setContext(this.getContext(c)),h=tt(l.font);if(o=this.getDistanceFromCenterForValue(this.ticks[c].value),l.showLabelBackdrop){t.font=h.string,r=t.measureText(a.label).width,t.fillStyle=l.backdropColor;const u=lt(l.backdropPadding);t.fillRect(-r/2-u.left,-o-h.size/2-u.top,r+u.width,h.size+u.height)}ie(t,a.label,0,-o,h,{color:l.color,strokeColor:l.textStrokeColor,strokeWidth:l.textStrokeWidth})}),t.restore()}drawTitle(){}}const $n={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},dt=Object.keys($n);function To(e,t){return e-t}function Ao(e,t){if(A(t))return null;const n=e._adapter,{parser:i,round:s,isoWeekday:o}=e._parseOpts;let r=t;return typeof i=="function"&&(r=i(r)),q(r)||(r=typeof i=="string"?n.parse(r,i):n.parse(r)),r===null?null:(s&&(r=s==="week"&&(pe(o)||o===!0)?n.startOf(r,"isoWeek",o):n.startOf(r,s)),+r)}function Do(e,t,n,i){const s=dt.length;for(let o=dt.indexOf(e);o<s-1;++o){const r=$n[dt[o]],a=r.steps?r.steps:Number.MAX_SAFE_INTEGER;if(r.common&&Math.ceil((n-t)/(a*r.size))<=i)return dt[o]}return dt[s-1]}function Pb(e,t,n,i,s){for(let o=dt.length-1;o>=dt.indexOf(n);o--){const r=dt[o];if($n[r].common&&e._adapter.diff(s,i,r)>=t-1)return r}return dt[n?dt.indexOf(n):0]}function Cb(e){for(let t=dt.indexOf(e)+1,n=dt.length;t<n;++t)if($n[dt[t]].common)return dt[t]}function Eo(e,t,n){if(!n)e[t]=!0;else if(n.length){const{lo:i,hi:s}=Oi(n,t),o=n[i]>=t?n[i]:n[s];e[o]=!0}}function Ob(e,t,n,i){const s=e._adapter,o=+s.startOf(t[0].value,i),r=t[t.length-1].value;let a,c;for(a=o;a<=r;a=+s.add(a,1,i))c=n[a],c>=0&&(t[c].major=!0);return t}function Io(e,t,n){const i=[],s={},o=t.length;let r,a;for(r=0;r<o;++r)a=t[r],s[a]=r,i.push({value:a,major:!1});return o===0||!n?i:Ob(e,i,s,n)}class gi extends oe{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,n={}){const i=t.time||(t.time={}),s=this._adapter=new zp._date(t.adapters.date);s.init(n),Te(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=n.normalized}parse(t,n){return t===void 0?null:Ao(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,n=this._adapter,i=t.time.unit||"day";let{min:s,max:o,minDefined:r,maxDefined:a}=this.getUserBounds();function c(l){!r&&!isNaN(l.min)&&(s=Math.min(s,l.min)),!a&&!isNaN(l.max)&&(o=Math.max(o,l.max))}(!r||!a)&&(c(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&c(this.getMinMax(!1))),s=q(s)&&!isNaN(s)?s:+n.startOf(Date.now(),i),o=q(o)&&!isNaN(o)?o:+n.endOf(Date.now(),i)+1,this.min=Math.min(s,o-1),this.max=Math.max(s+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(n=t[0],i=t[t.length-1]),{min:n,max:i}}buildTicks(){const t=this.options,n=t.time,i=t.ticks,s=i.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const o=this.min,r=this.max,a=Ud(s,o,r);return this._unit=n.unit||(i.autoSkip?Do(n.minUnit,this.min,this.max,this._getLabelCapacity(o)):Pb(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:Cb(this._unit),this.initOffsets(s),t.reverse&&a.reverse(),Io(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let n=0,i=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?n=1-s:n=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?i=o:i=(o-this.getDecimalForValue(t[t.length-2]))/2);const r=t.length<3?.5:.25;n=et(n,0,r),i=et(i,0,r),this._offsets={start:n,end:i,factor:1/(n+1+i)}}_generate(){const t=this._adapter,n=this.min,i=this.max,s=this.options,o=s.time,r=o.unit||Do(o.minUnit,n,i,this._getLabelCapacity(n)),a=z(s.ticks.stepSize,1),c=r==="week"?o.isoWeekday:!1,l=pe(c)||c===!0,h={};let u=n,d,f;if(l&&(u=+t.startOf(u,"isoWeek",c)),u=+t.startOf(u,l?"day":r),t.diff(i,n,r)>1e5*a)throw new Error(n+" and "+i+" are too far apart with stepSize of "+a+" "+r);const p=s.ticks.source==="data"&&this.getDataTimestamps();for(d=u,f=0;d<i;d=+t.add(d,a,r),f++)Eo(h,d,p);return(d===i||s.bounds==="ticks"||f===1)&&Eo(h,d,p),Object.keys(h).sort(To).map(g=>+g)}getLabelForValue(t){const n=this._adapter,i=this.options.time;return i.tooltipFormat?n.format(t,i.tooltipFormat):n.format(t,i.displayFormats.datetime)}format(t,n){const s=this.options.time.displayFormats,o=this._unit,r=n||s[o];return this._adapter.format(t,r)}_tickFormatFunction(t,n,i,s){const o=this.options,r=o.ticks.callback;if(r)return B(r,[t,n,i],this);const a=o.time.displayFormats,c=this._unit,l=this._majorUnit,h=c&&a[c],u=l&&a[l],d=i[n],f=l&&u&&d&&d.major;return this._adapter.format(t,s||(f?u:h))}generateTickLabels(t){let n,i,s;for(n=0,i=t.length;n<i;++n)s=t[n],s.label=this._tickFormatFunction(s.value,n,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const n=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((n.start+i)*n.factor)}getValueForPixel(t){const n=this._offsets,i=this.getDecimalForPixel(t)/n.factor-n.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const n=this.options.ticks,i=this.ctx.measureText(t).width,s=yt(this.isHorizontal()?n.maxRotation:n.minRotation),o=Math.cos(s),r=Math.sin(s),a=this._resolveTickFontOptions(0).size;return{w:i*o+a*r,h:i*r+a*o}}_getLabelCapacity(t){const n=this.options.time,i=n.displayFormats,s=i[n.unit]||i.millisecond,o=this._tickFormatFunction(t,0,Io(this,[t],this._majorUnit),s),r=this._getLabelSize(o),a=Math.floor(this.isHorizontal()?this.width/r.w:this.height/r.h)-1;return a>0?a:1}getDataTimestamps(){let t=this._cache.data||[],n,i;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(n=0,i=s.length;n<i;++n)t=t.concat(s[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let n,i;if(t.length)return t;const s=this.getLabels();for(n=0,i=s.length;n<i;++n)t.push(Ao(this,s[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return Tr(t.sort(To))}}function ln(e,t,n){let i=0,s=e.length-1,o,r,a,c;n?(t>=e[i].pos&&t<=e[s].pos&&({lo:i,hi:s}=Ot(e,"pos",t)),{pos:o,time:a}=e[i],{pos:r,time:c}=e[s]):(t>=e[i].time&&t<=e[s].time&&({lo:i,hi:s}=Ot(e,"time",t)),{time:o,pos:a}=e[i],{time:r,pos:c}=e[s]);const l=r-o;return l?a+(c-a)*(t-o)/l:a}class zb extends gi{static id="timeseries";static defaults=gi.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=ln(n,this.min),this._tableRange=ln(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:i}=this,s=[],o=[];let r,a,c,l,h;for(r=0,a=t.length;r<a;++r)l=t[r],l>=n&&l<=i&&s.push(l);if(s.length<2)return[{time:n,pos:0},{time:i,pos:1}];for(r=0,a=s.length;r<a;++r)h=s[r+1],c=s[r-1],l=s[r],Math.round((h+c)/2)!==l&&o.push({time:l,pos:r/(a-1)});return o}_generate(){const t=this.min,n=this.max;let i=super.getDataTimestamps();return(!i.includes(t)||!i.length)&&i.splice(0,0,t),(!i.includes(n)||i.length===1)&&i.push(n),i.sort((s,o)=>s-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),i=this.getLabelTimestamps();return n.length&&i.length?t=this.normalize(n.concat(i)):t=n.length?n:i,t=this._cache.all=t,t}getDecimalForValue(t){return(ln(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,i=this.getDecimalForPixel(t)/n.factor-n.end;return ln(this._table,i*this._tableRange+this._minPos,!0)}}var Tb=Object.freeze({__proto__:null,CategoryScale:rb,LinearScale:cb,LogarithmicScale:ub,RadialLinearScale:Mb,TimeScale:gi,TimeSeriesScale:zb});const Ab=[Op,am,nb,Tb];kn.register(...Ab);function Db(e){return{gridColor:e?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",textColor:e?"#94a3b8":"#475569"}}function Eb(e){const t=document.body.classList.contains("dark"),n=Db(t),i=document.getElementById("traffic-chart");if(i){const o={labels:[],datasets:[{label:"Requests/s",data:[],borderColor:"#3b82f6",backgroundColor:"rgba(59, 130, 246, 0.1)",fill:!0,tension:.4,yAxisID:"y"},{label:"Avg Response Time (ms)",data:[],borderColor:"#10b981",backgroundColor:"rgba(16, 185, 129, 0.1)",fill:!0,tension:.4,yAxisID:"y1"}]},r={responsive:!0,maintainAspectRatio:!1,scales:{x:{grid:{color:n.gridColor},ticks:{color:n.textColor,maxRotation:0,autoSkip:!0,maxTicksLimit:10},title:{display:!0,text:"Time",color:n.textColor}},y:{type:"linear",display:!0,position:"left",grid:{color:n.gridColor},ticks:{color:n.textColor},beginAtZero:!0,title:{display:!0,text:"Requests/s",color:n.textColor}},y1:{type:"linear",display:!0,position:"right",grid:{drawOnChartArea:!1,color:n.gridColor},ticks:{color:"#10b981"},beginAtZero:!0,title:{display:!0,text:"Avg Response Time (ms)",color:"#10b981"}}},plugins:{legend:{labels:{color:n.textColor}}}},a=new kn(i,{type:"line",data:o,options:r});e.charts.traffic={data:o,options:r,update:()=>a.update()}}const s=document.getElementById("pool-chart");if(s){const o={labels:[],datasets:[]},r={responsive:!0,maintainAspectRatio:!1,scales:{x:{grid:{color:n.gridColor},ticks:{color:n.textColor,maxRotation:0,autoSkip:!0,maxTicksLimit:10},title:{display:!0,text:"Time",color:n.textColor}},y:{grid:{color:n.gridColor},ticks:{color:n.textColor},beginAtZero:!0,title:{display:!0,text:"Connections",color:n.textColor}}},plugins:{legend:{labels:{color:n.textColor}}}},a=new kn(s,{type:"line",data:o,options:r});e.charts.pool={data:o,options:r,update:()=>a.update()}}}function Ib(e,t,n,i,s){const o=e.maxHistoryPoints;e.history.labels.push(t),e.history.requests.push(n),e.history.avgResponseTimes.push(i),e.history.labels.length>o&&(e.history.labels.shift(),e.history.requests.shift(),e.history.avgResponseTimes.shift());const r=e.charts.traffic;r?.data.datasets[0]&&r.data.datasets[1]&&(r.data.labels=e.history.labels,r.data.datasets[0].data=e.history.requests,r.data.datasets[1].data=e.history.avgResponseTimes,r.update());const a=e.charts.pool;a&&(a.data.labels=e.history.labels,s.forEach((c,l)=>{const h=c.name,u=e.history;let d=u.poolUsage[h];if(!d){d=[],u.poolUsage[h]=d;const f=["#10b981","#f59e0b","#3b82f6","#8b5cf6","#ec4899"],p=f[l%f.length];p&&a.data.datasets.push({label:h,data:d,borderColor:p,backgroundColor:void 0,fill:void 0,tension:.4})}d.push(c.connectionsInUse),d.length>o&&d.shift()}),a.update())}function xa(e){const t=Math.floor(e/86400),n=Math.floor(e%(3600*24)/3600),i=Math.floor(e%3600/60),s=Math.floor(e%60),o=[];return t>0&&o.push(`${t}d`),n>0&&o.push(`${n}h`),i>0&&o.push(`${i}m`),o.push(`${s}s`),o.join(" ")}function va(e){return e?new Date(e).toLocaleString():"-"}function Rb(e){return{gridColor:e?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",textColor:e?"#94a3b8":"#475569"}}function Lb(e,t){if(!e.options.scales)return;const n=e.options.scales;n.x&&(n.x.grid&&(n.x.grid.color=t.gridColor),n.x.ticks&&(n.x.ticks.color=t.textColor)),n.y?.grid&&(n.y.grid.color=t.gridColor),n.y?.ticks&&(n.y.ticks.color=t.textColor),n.y1?.grid&&(n.y1.grid.color=t.gridColor),n.y1?.ticks&&(n.y1.ticks.color=t.textColor),n.y?.title&&(n.y.title.color=t.textColor),n.y1?.title&&(n.y1.title.color=t.textColor),e.options.plugins?.legend?.labels&&(e.options.plugins.legend.labels.color=t.textColor),e.update()}function $b(e){const t=localStorage.getItem("theme")??"dark",n=document.getElementById("theme-toggle-btn");n&&(document.body.className=t,n.onclick=()=>{const s=document.body.classList.contains("dark")?"light":"dark";document.body.className=s,localStorage.setItem("theme",s);const o=Rb(s==="dark");Object.values(e.charts).forEach(r=>{const a=r;a?.options&&Lb(a,o)})})}function Fb(e){return`
|
|
42
|
+
<tr>
|
|
43
|
+
<td>${new Date(e.timestamp).toLocaleString()}</td>
|
|
44
|
+
<td><code>${e.req?.method??"-"}</code></td>
|
|
45
|
+
<td>${e.req?.url??"-"}</td>
|
|
46
|
+
<td title="${e.details?.fullMessage??""}">${e.message}</td>
|
|
47
|
+
</tr>
|
|
48
|
+
`}function Nb(e){const t=e.connectionsOpen>0?Math.round(e.connectionsInUse/e.connectionsOpen*100):0,n=t>90?"var(--danger)":t>70?"var(--warning)":"var(--success)",i=e.stats??void 0;return`
|
|
49
|
+
<div class="card card-clickable transition-all duration-200">
|
|
50
|
+
<div class="card-header">
|
|
51
|
+
<span class="material-symbols-rounded">database</span>
|
|
52
|
+
<h3 class="text-lg font-bold text-bright">${e.name}</h3>
|
|
53
|
+
</div>
|
|
54
|
+
<div class="mb-6">
|
|
55
|
+
<div class="flex justify-between items-baseline mb-2">
|
|
56
|
+
<span class="text-3xl font-bold text-bright">${t}%</span>
|
|
57
|
+
<span class="text-main font-mono">${e.connectionsInUse} / ${e.connectionsOpen}</span>
|
|
58
|
+
</div>
|
|
59
|
+
<div class="progress-bar">
|
|
60
|
+
<div class="progress-bar-fill transition-all duration-300" style="width: ${t}%; background: ${n}"></div>
|
|
61
|
+
</div>
|
|
62
|
+
<small class="description mt-2 block opacity-75">Pool Utilization (Active / Open)</small>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<div class="stat-row text-sm">
|
|
66
|
+
<span class="text-xs uppercase font-bold opacity-75">Connections Open</span>
|
|
67
|
+
<span class="font-mono text-accent font-bold">${e.connectionsOpen}</span>
|
|
68
|
+
</div>
|
|
69
|
+
<div class="stat-row text-sm">
|
|
70
|
+
<span class="text-xs uppercase font-bold opacity-75">Connections In Use</span>
|
|
71
|
+
<span class="font-mono text-accent font-bold">${e.connectionsInUse}</span>
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
${i?`
|
|
75
|
+
<div class="mt-4 pt-4 border-t">
|
|
76
|
+
<div class="stat-row text-sm">
|
|
77
|
+
<span>Total Requests</span>
|
|
78
|
+
<span class="font-mono text-accent font-bold">${i.totalRequests.toLocaleString()}</span>
|
|
79
|
+
</div>
|
|
80
|
+
<div class="stat-row text-sm">
|
|
81
|
+
<span>Total Timeouts</span>
|
|
82
|
+
<span class="font-mono ${i.totalTimeouts>0?"text-danger":"text-accent"} font-bold">${i.totalTimeouts.toLocaleString()}</span>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
`:""}
|
|
86
|
+
</div>
|
|
87
|
+
`}function Q(e,t,n=!0,i="text-accent"){const s=`${n?"font-mono":""} ${i} font-bold break-all`.trim();return`
|
|
88
|
+
<div class="stat-row text-sm">
|
|
89
|
+
<span>${e}</span>
|
|
90
|
+
<span class="${s}">${t}</span>
|
|
91
|
+
</div>
|
|
92
|
+
`}function Ro(e,t){return`
|
|
93
|
+
<div class="card-header mt-6 mb-2">
|
|
94
|
+
<span class="material-symbols-rounded icon-sm">${t}</span>
|
|
95
|
+
<h3 class="text-xs uppercase tracking-wider font-bold text-accent">${e}</h3>
|
|
96
|
+
</div>
|
|
97
|
+
`}function Bb(e,t){const n=e.exclusionList?.length?e.exclusionList.join(", "):"(None)",i=typeof e.transactionMode=="string"?e.transactionMode:e.transactionMode?"Custom":"commit";return`
|
|
98
|
+
<div class="card mb-6">
|
|
99
|
+
<div class="flex justify-between items-center mb-4">
|
|
100
|
+
<div class="flex items-center gap-3">
|
|
101
|
+
<span class="badge badge-info">PL/SQL Route #${t+1}</span>
|
|
102
|
+
<code class="text-lg font-bold text-bright">${e.route}</code>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
|
|
106
|
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
107
|
+
<div>
|
|
108
|
+
<h4 class="text-xs font-bold text-main uppercase mb-3 opacity-75">Database Connection</h4>
|
|
109
|
+
${Q("Oracle User",e.user??"(Not set)")}
|
|
110
|
+
${Q("Connect String",e.connectString??"(Not set)")}
|
|
111
|
+
${Q("Password",e.password??"(None)")}
|
|
112
|
+
</div>
|
|
113
|
+
<div>
|
|
114
|
+
<h4 class="text-xs font-bold text-main uppercase mb-3 opacity-75">Request Handler</h4>
|
|
115
|
+
${Q("Default Page",e.defaultPage??"index")}
|
|
116
|
+
${Q("Document Table",e.documentTable??"(None)")}
|
|
117
|
+
${Q("Error Style",e.errorStyle??"table")}
|
|
118
|
+
${Q("Transaction Mode",i)}
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
|
|
122
|
+
<div class="mt-4 pt-4 border-t">
|
|
123
|
+
<h4 class="text-xs font-bold text-main uppercase mb-3 opacity-75">Path & Validation</h4>
|
|
124
|
+
${Q("Path Alias",e.pathAlias??"(None)")}
|
|
125
|
+
${Q("Path Alias Proc",e.pathAliasProcedure??"(None)")}
|
|
126
|
+
${Q("Exclusion List",n)}
|
|
127
|
+
${Q("Validation Func",e.requestValidationFunction??"(None)")}
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
`}function jb(e,t){return`
|
|
131
|
+
<div class="card mb-4">
|
|
132
|
+
<div class="flex items-center gap-3 mb-4">
|
|
133
|
+
<span class="badge badge-success">Static Route #${t+1}</span>
|
|
134
|
+
<code class="text-lg font-bold text-bright">${e.route}</code>
|
|
135
|
+
</div>
|
|
136
|
+
${Q("Directory Path",e.directoryPath??"(Not set)")}
|
|
137
|
+
</div>
|
|
138
|
+
`}function Vb(e){let t='<div class="config-view-content">';if(t+='<div class="card mb-8">',t+='<div class="card-header"><span class="material-symbols-rounded">dns</span><h3>Server Settings</h3></div>',typeof e.port=="number"&&(t+=Q("Port",e.port)),t+=Q("Admin Route",e.adminRoute??"/admin"),t+=Q("Admin User",e.adminUser??"(Not authenticated)"),t+=Q("Admin Password",e.adminPassword??"(None)"),t+=Q("Logger Filename",e.loggerFilename??"(Logging disabled)"),typeof e.uploadFileSizeLimit=="number"){const n=e.uploadFileSizeLimit,i=(n/(1024*1024)).toFixed(2);t+=Q("Upload Size Limit",`${i} MB (${n.toLocaleString()} bytes)`)}else t+=Q("Upload Size Limit","No limit");return t+="</div>",t+=Ro("PL/SQL Routes","database"),e.routePlSql?.length?t+=e.routePlSql.map((n,i)=>Bb(n,i)).join(""):t+='<div class="empty-state">No PL/SQL routes configured</div>',t+=Ro("Static Routes","folder_shared"),e.routeStatic?.length?t+=e.routeStatic.map((n,i)=>jb(n,i)).join(""):t+='<div class="empty-state">No static routes configured</div>',t+="</div>",t}async function wa(){const e=await $t.getErrorLogs(),t=document.querySelector("#errors-table tbody");t&&(t.innerHTML=e.map(n=>Fb(n)).join(""))}async function ka(){const e=await $t.getAccessLogs(),t=document.getElementById("access-log-view");t&&(Array.isArray(e)?t.textContent=e.join(`
|
|
139
|
+
`):e&&typeof e=="object"&&"message"in e?t.textContent=e.message:t.textContent="No logs available",t.parentElement&&(t.parentElement.scrollTop=t.parentElement.scrollHeight))}function Sa(e){const t=document.getElementById("pools-container");!t||!e.pools||(t.innerHTML=e.pools.map(n=>Nb(n)).join(""))}function Ma(e){const t=e.status.config;if(!t)return;const n=document.getElementById("config-view");n&&(n.innerHTML=Vb(t))}function hn(e){if(e===0)return"0 B";const t=1024,n=["B","KB","MB","GB"],i=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,i)).toFixed(2))} ${n[i]}`}function Lo(e){return`${(e/1e3).toFixed(2)} ms`}function Bi(e){const t=document.getElementById("middleware-version");t&&e.version&&(t.textContent=e.version);const n=document.getElementById("node-version");n&&e.system&&(n.textContent=e.system.nodeVersion);const i=document.getElementById("platform-info");i&&e.system&&(i.textContent=`${e.system.platform} (${e.system.arch})`);const s=document.getElementById("system-uptime");s&&e.uptime&&(s.textContent=xa(e.uptime));const o=document.getElementById("system-start-time");o&&e.startTime&&(o.textContent=va(e.startTime));const r=document.getElementById("system-status-text");r&&(r.textContent=e.status?.toUpperCase()??"-");const a=document.getElementById("total-requests");a&&e.metrics&&(a.textContent=e.metrics.requestCount.toLocaleString());const c=document.getElementById("total-errors");c&&e.metrics&&(c.textContent=e.metrics.errorCount.toLocaleString());const l=document.getElementById("active-pools");if(l&&e.pools&&(l.textContent=e.pools.length.toString()),e.system?.memory){const f=document.getElementById("memory-heap-used");f&&(f.textContent=hn(e.system.memory.heapUsed));const p=document.getElementById("memory-heap-total");p&&(p.textContent=hn(e.system.memory.heapTotal));const g=document.getElementById("memory-rss");g&&(g.textContent=hn(e.system.memory.rss));const m=document.getElementById("memory-external");m&&(m.textContent=hn(e.system.memory.external))}if(e.system?.cpu){const f=document.getElementById("cpu-user");f&&(f.textContent=Lo(e.system.cpu.user));const p=document.getElementById("cpu-system");p&&(p.textContent=Lo(e.system.cpu.system))}const h=document.getElementById("system-refresh-status"),u=document.getElementById("auto-refresh-toggle"),d=document.getElementById("refresh-interval");if(h&&u&&d)if(u.checked){const f=parseInt(d.value)/1e3;h.textContent=`Active (${f}s)`,h.classList.add("text-success"),h.classList.remove("text-accent")}else h.textContent="Paused",h.classList.remove("text-success"),h.classList.add("text-accent")}const Zb={overview:"dashboard",errors:"error",access:"list_alt",cache:"cached",pools:"database",config:"settings",system:"terminal"},R={currentView:"overview",status:{},maxHistoryPoints:30,lastRequestCount:0,lastErrorCount:0,lastUpdateTime:Date.now(),refreshTimer:null,history:{labels:[],requests:[],avgResponseTimes:[],poolUsage:{}},charts:{}};async function re(){const e=Date.now(),t=await $t.getStatus();if(R.status=t,!t.metrics||!t.pools)return;const n=(e-R.lastUpdateTime)/1e3,i=t.metrics.requestCount-R.lastRequestCount,s=n>0?i/n:0,o=t.metrics.avgResponseTime;R.lastRequestCount=t.metrics.requestCount,R.lastErrorCount=t.metrics.errorCount,R.lastUpdateTime=e;const r=new Date().toLocaleTimeString();Ib(R,r,s,o,t.pools);const a=document.getElementById("sidebar-version");a&&(a.textContent=`v${t.version}`);const c=document.getElementById("uptime-val");c&&(c.textContent=xa(t.uptime));const l=document.getElementById("start-time-val");l&&(l.textContent=`Started: ${va(t.startTime)}`);const h=document.getElementById("req-count");h&&(h.textContent=t.metrics.requestCount.toLocaleString());const u=document.getElementById("req-per-sec");u&&(u.textContent=`${s.toFixed(2)} req/s`);const d=document.getElementById("avg-resp-time");d&&(d.textContent=`Avg: ${o.toFixed(1)}ms`);const f=document.getElementById("err-count");f&&(f.textContent=t.metrics.errorCount.toLocaleString());const p=await $t.getCache();let g=0,m=0;p.forEach(O=>{g+=O.procedureNameCache.stats.hits+O.argumentCache.stats.hits,m+=O.procedureNameCache.stats.misses+O.argumentCache.stats.misses});const b=g+m,_=b>0?Math.round(g/b*100):0,w=document.getElementById("cache-hit-rate-val");w&&(w.textContent=`${_}%`,w.style.color=_>80?"var(--success)":_>50?"var(--warning)":"var(--danger)");const x=document.getElementById("cache-hits-val");x&&(x.textContent=g.toLocaleString());const y=document.getElementById("cache-misses-val");y&&(y.textContent=m.toLocaleString());const k=document.getElementById("server-status-dot"),S=document.getElementById("server-status-text");k&&(k.className="dot "+t.status),S&&(S.textContent=t.status.toUpperCase());const M=document.getElementById("btn-pause");M&&(M.style.display=t.status==="running"?"flex":"none");const P=document.getElementById("btn-resume");P&&(P.style.display=t.status==="paused"?"flex":"none"),R.currentView==="errors"&&await wa(),R.currentView==="access"&&await ka(),R.currentView==="pools"&&Sa(t),R.currentView==="config"&&Ma(R),R.currentView==="system"&&Bi(t)}function ji(){Pa();const e=document.getElementById("auto-refresh-toggle"),t=document.getElementById("refresh-interval");if(e?.checked&&t){const n=parseInt(t.value);R.refreshTimer=setInterval(()=>{re()},n)}}function Pa(){R.refreshTimer&&(clearInterval(R.refreshTimer),R.refreshTimer=null)}function Ca(){const e=document.getElementById("refresh-interval"),t=document.getElementById("chart-history-points");if(!e||!t)return;const n=parseInt(e.value);[30,60,120].forEach((s,o)=>{const r=t.options[o];if(!r)return;const a=s*n/1e3;let c="";if(a<60)c=`${a}s`;else if(a<3600)c=`${Math.round(a/60)} min`;else{const l=a/3600;c=l===Math.round(l)?`${l} hours`:`${l.toFixed(1)} hours`}r.textContent=`Last ${c}`})}document.querySelectorAll("nav button").forEach(e=>{const t=e;t.onclick=async()=>{const n=t.dataset.view;if(!n)return;R.currentView=n,document.querySelectorAll(".view").forEach(o=>{const r=o;r.style.display="none"});const i=document.getElementById("view-"+n);i&&(i.style.display="block"),document.querySelectorAll("nav button").forEach(o=>o.classList.remove("active")),t.classList.add("active");const s=document.getElementById("view-title");if(s){const r=Array.from(t.childNodes).filter(c=>c.nodeType===Node.TEXT_NODE).map(c=>c.textContent?.trim()).join(""),a=Zb[n]||"chevron_right";s.innerHTML=`<span class="material-symbols-rounded">${a}</span>${r}`}n==="errors"&&await wa(),n==="access"&&await ka(),n==="pools"&&Sa(R.status),n==="config"&&Ma(R),n==="system"&&Bi(R.status)}});const $o=document.getElementById("auto-refresh-toggle");$o&&($o.onchange=e=>{e.target.checked?ji():Pa()});const Fo=document.getElementById("refresh-interval");Fo&&(Fo.onchange=()=>{ji(),Ca(),Bi(R.status)});const ti=document.getElementById("chart-history-points");ti&&(ti.onchange=()=>{for(R.maxHistoryPoints=parseInt(ti.value);R.history.labels.length>R.maxHistoryPoints;)R.history.labels.shift(),R.history.requests.shift(),R.history.avgResponseTimes.shift(),Object.values(R.history.poolUsage).forEach(e=>e.shift());re()});const No=document.getElementById("manual-refresh");No&&(No.onclick=()=>{re()});const Bo=document.getElementById("btn-pause");Bo&&(Bo.onclick=()=>{$t.post("api/server/pause").then(()=>{re()})});const jo=document.getElementById("btn-resume");jo&&(jo.onclick=()=>{$t.post("api/server/resume").then(()=>{re()})});const Vo=document.getElementById("btn-stop");Vo&&(Vo.onclick=()=>{confirm("Stop the server?")&&$t.post("api/server/stop")});const Zo=document.getElementById("btn-clear-all-cache");Zo&&(Zo.onclick=async()=>{confirm("Are you sure you want to clear all caches in all pools? This action cannot be undone.")&&(await $t.post("api/cache/clear",{}),await re())});$b(R);Eb(R);Ca();re().then(()=>{ji()}).catch(console.error);
|