vite-plugin-kiru 0.29.3 → 0.29.4
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/dist/index.js +170 -35
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2256,6 +2256,9 @@ var defaultSSGOptions = {
|
|
|
2256
2256
|
maxConcurrentRenders: 100
|
|
2257
2257
|
}
|
|
2258
2258
|
};
|
|
2259
|
+
var manualChunks = {
|
|
2260
|
+
kiru: ["kiru", "kiru/router", "kiru/router/client"]
|
|
2261
|
+
};
|
|
2259
2262
|
function createPluginState(opts = {}) {
|
|
2260
2263
|
let fileLinkFormatter = (path8, line) => `vscode://file/${path8}:${line}`;
|
|
2261
2264
|
let dtClientPathname = "/__devtools__";
|
|
@@ -2321,6 +2324,13 @@ function createViteConfig(config, opts) {
|
|
|
2321
2324
|
esbuild: {
|
|
2322
2325
|
...defaultEsBuildOptions,
|
|
2323
2326
|
...config.esbuild
|
|
2327
|
+
},
|
|
2328
|
+
build: {
|
|
2329
|
+
rollupOptions: {
|
|
2330
|
+
output: {
|
|
2331
|
+
manualChunks
|
|
2332
|
+
}
|
|
2333
|
+
}
|
|
2324
2334
|
}
|
|
2325
2335
|
};
|
|
2326
2336
|
}
|
|
@@ -2348,6 +2358,9 @@ function createViteConfig(config, opts) {
|
|
|
2348
2358
|
outDir: desiredOutDir,
|
|
2349
2359
|
rollupOptions: {
|
|
2350
2360
|
...rollup,
|
|
2361
|
+
output: {
|
|
2362
|
+
manualChunks
|
|
2363
|
+
},
|
|
2351
2364
|
input
|
|
2352
2365
|
}
|
|
2353
2366
|
}
|
|
@@ -2394,35 +2407,35 @@ var dist_default = `<!DOCTYPE html>
|
|
|
2394
2407
|
<link rel="icon" type="image/svg+xml" href="./favicon.svg" />
|
|
2395
2408
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
2396
2409
|
<title>Kiru Devtools</title>
|
|
2397
|
-
<script type="module" crossorigin>(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();const Lc="production",he=Lc==="development",wa=Symbol.for("kiru.signal"),Rc=Symbol.for("kiru.context"),Oi=Symbol.for("kiru.contextProvider"),$e=Symbol.for("kiru.fragment"),Sa=Symbol.for("kiru.error"),ka=Symbol.for("kiru.memo"),Ys=Symbol.for("kiru.errorBoundary"),Nc=50,ne=2,St=4,Pi=8,re=16,Ta=32,as=64,Ye=128,zc=/^on:?/,Ma=new Set(["animateTransform","circle","clipPath","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","path","polygon","polyline","radialGradient","rect","stop","svg","switch","symbol","text","textPath","title","tspan","use"]),Fc=new Set(["allowfullscreen","autofocus","autoplay","async","checked","compact","controls","contenteditable","declare","default","defer","disabled","download","hidden","inert","ismap","multiple","nohref","noresize","noshade","novalidate","nowrap","open","popover","readonly","required","sandbox","scoped","selected","sortable","spellcheck","translate","wrap"]),Hc=new Map([["acceptCharset","accept-charset"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["httpEquiv","http-equiv"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]);function Bc(e){return typeof e=="string"||typeof e=="number"||typeof e=="bigint"||typeof e=="boolean"||e===void 0||e===null}const De={current:null},Ea={current:0},Xt={current:"window"in globalThis?"dom":"string"};var Ca;class Xe extends Error{constructor(t){const n=typeof t=="string"?t:t.message;super(n),this[Ca]=!0,typeof t!="string"&&(this.fatal=t?.fatal)}static isKiruError(t){return t instanceof Error&&t[Sa]===!0}}Ca=Sa;const qe={parentStack:[],childIdxStack:[],eventDeferrals:new Map,parent:function(){return this.parentStack[this.parentStack.length-1]},clear:function(){this.parentStack.length=0,this.childIdxStack.length=0},pop:function(){this.parentStack.pop(),this.childIdxStack.pop()},push:function(e){this.parentStack.push(e),this.childIdxStack.push(0)},currentChild:function(){return this.parentStack[this.parentStack.length-1].childNodes[this.childIdxStack[this.childIdxStack.length-1]]},nextChild:function(){return this.parentStack[this.parentStack.length-1].childNodes[this.childIdxStack[this.childIdxStack.length-1]++]},bumpChildIndex:function(){this.childIdxStack[this.childIdxStack.length-1]++},captureEvents:function(e){Ho(e,!0),this.eventDeferrals.set(e,[])},resetEvents:function(e){this.eventDeferrals.delete(e)},releaseEvents:function(e){Ho(e,!1);const t=this.eventDeferrals.get(e);for(;t?.length;)t.shift()()}},Vc=e=>{const t=e.target;!e.isTrusted||!t||qe.eventDeferrals.get(t)?.push(()=>t.dispatchEvent(e))},Ho=(e,t)=>{for(const n in e)if(n.startsWith("on")){const i=n.substring(2);e[t?"addEventListener":"removeEventListener"](i,Vc,{passive:!0})}};let Xs=!1,ls=!1;const Oa=e=>{e.preventDefault(),e.stopPropagation(),ls=!0};let Te=null;function Wc(){Xs=!0,Te=document.activeElement,Te&&Te!==document.body&&Te.addEventListener("blur",Oa)}function jc(){ls&&(Te.removeEventListener("blur",Oa),Te.isConnected&&Te.focus(),ls=!1),Xs=!1}function cs(e,t){if(typeof e=="function"){e(t);return}if(W.isSignal(e)){e.sneak(t),e.notify({filter:n=>typeof n=="function"});return}e.current=t}function Uc(e){const t=e.type;return t=="#text"?Pa(e):Ma.has(t)?document.createElementNS("http://www.w3.org/2000/svg",t):document.createElement(t)}function Pa(e){const{nodeValue:t}=e.props;if(!W.isSignal(t))return document.createTextNode(t);const n=t.peek()??"",i=document.createTextNode(n);return hs(e,i,t),i}function $c(e,t,n){const i=us.get(e)??{},s=i[t]=o=>{if(Xs){o.preventDefault(),o.stopPropagation();return}n(o)};return us.set(e,i),s}const us=new WeakMap;function Da(e){const t=e.dom,n=e.prev?.props??{},i=e.props??{},s=new Set([...Object.keys(n),...Object.keys(i)]),o=Xt.current==="hydrate";s.forEach(r=>{const a=n[r],l=i[r];if(gi.internalProps.includes(r)&&r!=="innerHTML"){r==="ref"&&a!==l&&(a&&cs(a,null),l&&cs(l,t));return}if(gi.isEvent(r)){if(a!==l||Xt.current==="hydrate"){const c=r.replace(zc,""),u=c==="focus"||c==="blur";r in n&&t.removeEventListener(c,u?us.get(e)?.[c]:a),r in i&&t.addEventListener(c,u?$c(e,c,l):l)}return}if(!(t instanceof Text)){if(a===l||o&&t.getAttribute(r)===l)return;if(W.isSignal(a)&&e.cleanups){const c=e.cleanups[r];c&&(c(),delete e.cleanups[r])}if(W.isSignal(l))return Gc(e,t,r,l,a);ui(t,r,l,a);return}W.isSignal(l)||t.nodeValue!==l&&(t.nodeValue=l)})}function Yc(e){return e.multiple?Array.from(e.selectedOptions).map(t=>t.value):e.value}function Aa(e,t){if(!e.multiple||t===void 0||t===null||t===""){e.value=t;return}Array.from(e.options).forEach(n=>{n.selected=t.indexOf(n.value)>-1})}const Xc={value:"input",checked:"change",open:"toggle",volume:"volumechange",playbackRate:"ratechange",currentTime:"timeupdate"},qc=["progress","meter","number","range"];function Gc(e,t,n,i,s){const o=e.cleanups??(e.cleanups={}),[r,a]=n.split(":");if(r!=="bind")return o[n]=i.subscribe((y,v)=>{ui(t,n,y,v)}),ui(t,n,i.peek(),Ke(s));const l=Xc[a];if(!l)return;const c=t instanceof HTMLSelectElement,u=c?y=>Aa(t,y):y=>t[a]=y,f=y=>{u(y)},p=y=>{i.sneak(y),i.notify({filter:v=>v!==f})};let g;if(a==="value"){const y=qc.indexOf(t.type)!==-1;g=()=>{let v=t.value;c?v=Yc(t):typeof i.peek()=="number"&&y&&(v=t.valueAsNumber),p(v)}}else g=y=>{const v=y.target[a];a==="currentTime"&&i.peek()===v||p(v)};t.addEventListener(l,g);const x=i.subscribe(f);return o[n]=()=>{t.removeEventListener(l,g),x()},ui(t,a,i.peek(),Ke(s))}function hs(e,t,n){(e.cleanups??(e.cleanups={})).nodeValue=n.subscribe((i,s)=>{i!==s&&(t.nodeValue=i)})}function Kc(e){if(e.type!=="#text"||!W.isSignal(e.props.nodeValue))return;const t=Ke(e.props.nodeValue);if(!Bc(t))return;const n=Pa(e),i=qe.parent();return i&&i.appendChild(n),n}function Zc(e){const t=qe.nextChild()??Kc(e);if(!t)throw new Xe({message:"Hydration mismatch - no node found",vNode:e});let n=t.nodeName;if(Ma.has(n)||(n=n.toLowerCase()),e.type!==n)throw new Xe({message:\`Hydration mismatch - expected node of type \${e.type.toString()} but received \${n}\`,vNode:e});if(e.dom=t,e.type!=="#text"&&!(e.flags&re)){Da(e);return}W.isSignal(e.props.nodeValue)&&hs(e,t,e.props.nodeValue);let i=e,s=e.sibling;for(;s&&s.type==="#text";){const o=s;qe.bumpChildIndex();const r=String(Ke(i.props.nodeValue)??""),a=i.dom.splitText(r.length);o.dom=a,W.isSignal(o.props.nodeValue)&&hs(o,a,o.props.nodeValue),i=s,s=s.sibling}}function Ia(e,t,n,i=!1){if(n===null)return e.removeAttribute(t),!0;switch(typeof n){case"undefined":case"function":case"symbol":return e.removeAttribute(t),!0;case"boolean":if(i&&!n)return e.removeAttribute(t),!0}return!1}function Qc(e,t,n){const i=Fc.has(t);Ia(e,t,n,i)||e.setAttribute(t,i&&typeof n=="boolean"?"":String(n))}const Jc=["INPUT","TEXTAREA"],tu=e=>Jc.indexOf(e.nodeName)>-1;function ui(e,t,n,i){if(n!==i)switch(t){case"style":return iu(e,n,i);case"className":return nu(e,n);case"innerHTML":return eu(e,n);case"muted":e.muted=!!n;return;case"value":if(e.nodeName==="SELECT")return Aa(e,n);const s=n==null?"":String(n);if(tu(e)){e.value=s;return}e.setAttribute("value",s);return;case"checked":if(e.nodeName==="INPUT"){e.checked=!!n;return}e.setAttribute("checked",String(n));return;default:return Qc(e,Tu(t),n)}}function eu(e,t){if(t==null||typeof t=="boolean"){e.innerHTML="";return}e.innerHTML=String(t)}function nu(e,t){const n=Ke(t);if(!n)return e.removeAttribute("class");e.setAttribute("class",n)}function iu(e,t,n){if(Ia(e,"style",t))return;if(typeof t=="string"){e.setAttribute("style",t);return}let i={};typeof n=="string"?e.setAttribute("style",""):typeof n=="object"&&n&&(i=n);const s=t;new Set([...Object.keys(i),...Object.keys(s)]).forEach(r=>{const a=i[r],l=s[r];if(a!==l){if(l===void 0){e.style[r]="";return}e.style[r]=l}})}function su(e){let t=e.parent,n=t?.dom;for(;t&&!n;)t=t.parent,n=t?.dom;if(!n||!t){if(!e.parent&&e.dom)return e;throw new Xe({message:"No DOM parent found while attempting to place node.",vNode:e})}return t}function ou(e,t){const{node:n,lastChild:i}=t,s=e.dom;if(i){i.after(s);return}const o=La(e,n);if(o){n.dom.insertBefore(s,o);return}n.dom.appendChild(s)}function La(e,t){let n=e;for(;n;){let i=n.sibling;for(;i;){if(!(i.flags&(St|re))){const s=ru(i);if(s?.isConnected)return s}i=i.sibling}if(n=n.parent,!n||n.flags&re||n===t)return}}function ru(e){let t=e;for(;t;){if(t.dom)return t.dom;if(t.flags&re)return;t=t.child}}function au(e){if(Xt.current==="hydrate")return Ii(e,mi);const t={node:e.dom?e:su(e)};fs(e,t,(e.flags&St)>0),e.dom&&!(e.flags&re)&&Ra(e,t,!1),mi(e)}function fs(e,t,n){let i=e.child;for(;i;){if(i.flags&as){i.flags&St&&cu(i,t),mi(i),i=i.sibling;continue}i.dom?(fs(i,{node:i},!1),i.flags&re||Ra(i,t,n)):fs(i,t,(i.flags&St)>0||n),mi(i),i=i.sibling}}function Ra(e,t,n){(n||!e.dom.isConnected||e.flags&St)&&ou(e,t),(!e.prev||e.flags&ne)&&Da(e),t.lastChild=e.dom}function lu(e){e===e.parent?.child&&(e.parent.child=e.sibling),Ii(e,t=>{const{hooks:n,subs:i,cleanups:s,dom:o,props:{ref:r}}=t;for(i?.forEach(a=>a()),s&&Object.values(s).forEach(a=>a());n?.length;)n.pop().cleanup?.();o&&(r&&cs(r,null),o.isConnected&&!(t.flags&re)&&o.remove(),delete t.dom)}),e.parent=null}function cu(e,t){if(!e.child)return;const n=[];if(Na(e.child,n),n.length===0)return;const{node:i,lastChild:s}=t;if(s)s.after(...n);else{const o=La(e,i),r=i.dom;o?o.before(...n):r.append(...n)}t.lastChild=n[n.length-1]}function Na(e,t){let n=e;for(;n;)n.dom?t.push(n.dom):n.child&&Na(n.child,t),n=n.sibling}function uu(e){return typeof e=="function"&&typeof e[ka]?.arePropsEqual=="function"}function m(e,t=null,...n){if(e===kt)return kt({children:n,...t});const i={type:e,flags:0,index:0,depth:0,props:{},parent:null,sibling:null,child:null,prev:null,deletions:null};if(uu(e)&&(i.flags|=Ta,i.arePropsEqual=e[ka].arePropsEqual),t!==null){const{key:o,ref:r,...a}=t;Iu(o)&&(i.props.key=o.toString()),Lu(r)&&(i.props.ref=r),Object.assign(i.props,a)}const s=n.length===1?n[0]:n.length>1?n:null;return s!==null&&(i.props.children=s),i}function kt({children:e,key:t}){return m($e,t?{key:t}:null,e)}function qs(e,t){return Array.isArray(t)?fu(e,t):hu(e,t)}function hu(e,t){const n=e.child;if(n===null)return Ha(e,t);const i=n.sibling,s=za(e,n,t);if(s!==null)return n&&n!==s&&!s.prev?ds(e,n):i&&ds(e,i),s;{const o=Wa(n),r=Ba(o,e,0,t);if(r!==null){const a=r.prev;if(a!==null){const l=a.props.key;o.delete(l===void 0?a.index:l)}hi(r,0,0)}return o.forEach(a=>pi(e,a)),r}}function fu(e,t){let n=null,i=null,s=e.child,o=null,r=0,a=0;for(;s!==null&&a<t.length;a++){s.index>a?(o=s,s=null):o=s.sibling;const c=za(e,s,t[a]);if(c===null){s===null&&(s=o);break}s&&!c.prev&&pi(e,s),r=hi(c,r,a),i===null?n=c:i.sibling=c,i=c,s=o}if(a===t.length)return ds(e,s),n;if(s===null){for(;a<t.length;a++){const c=Ha(e,t[a]);c!==null&&(r=hi(c,r,a),i===null?n=c:i.sibling=c,i=c)}return n}const l=Wa(s);for(;a<t.length;a++){const c=Ba(l,e,a,t[a]);if(c!==null){const u=c.prev;if(u!==null){const f=u.props.key;l.delete(f===void 0?u.index:f)}r=hi(c,r,a),i===null?n=c:i.sibling=c,i=c}}return l.forEach(c=>pi(e,c)),n}function za(e,t,n){const i=t?.props.key;return Ks(n)?i!==void 0||t?.type==="#text"&&W.isSignal(t.props.nodeValue)?null:Bo(e,t,""+n):W.isSignal(n)?t&&t.props.nodeValue!==n?null:Bo(e,t,n):Gs(n)?n.props.key!==i?null:du(e,t,n):Array.isArray(n)?i!==void 0?null:Fa(e,t,n):null}function Bo(e,t,n){if(t===null||t.type!=="#text"){const s=m("#text",{nodeValue:n});return Nt(s,e),s}return t.props.nodeValue!==n&&(t.props.nodeValue=n,t.flags|=ne),t.sibling=null,t}function du(e,t,n){let{type:i,props:s}=n;if(i===$e)return Fa(e,t,s.children||[],s);if(t?.type===i)return t.index=0,t.sibling=null,typeof i=="string"?Va(t.props,s)&&(t.flags|=ne):t.flags|=ne,t.props=s,t.memoizedProps=n.memoizedProps,t;const o=m(i,s);return Nt(o,e),o}function Fa(e,t,n,i={}){if(t===null||t.type!==$e){const s=m($e,{children:n,...i});return Nt(s,e),s}return t.props={...t.props,...i,children:n},t.flags|=ne,t.sibling=null,t}function Ha(e,t){if(Ks(t)){const n=m("#text",{nodeValue:""+t});return Nt(n,e),n}if(W.isSignal(t)){const n=m("#text",{nodeValue:t});return Nt(n,e),n}if(Gs(t)){const n=m(t.type,t.props);return Nt(n,e),n.flags|=St,n}if(Array.isArray(t)){const n=kt({children:t});return Nt(n,e),n}return null}function hi(e,t,n){e.index=n;const i=e.prev;if(i!==null){const s=i.index;return s<t?(e.flags|=St,t):s}else return e.flags|=St,t}function Ba(e,t,n,i){if(W.isSignal(i)||Ks(i)){const o=e.get(n);if(o){if(o.props.nodeValue===i)return o;o.type==="#text"&&W.isSignal(o.props.nodeValue)&&o.cleanups?.nodeValue?.()}const r=m("#text",{nodeValue:i});return Nt(r,t),r.flags|=St,r.index=n,r}if(Gs(i)){const{type:o,props:r}=i,a=r.key,l=e.get(a===void 0?n:a);if(l?.type===o)return typeof o=="string"?Va(l.props,r)&&(l.flags|=ne):l.flags|=ne,l.props=r,l.sibling=null,l.index=n,l;const c=m(i.type,i.props);return Nt(c,t),c.flags|=St,c.index=n,c}if(Array.isArray(i)){const o=e.get(n);if(o)return o.flags|=ne,o.props.children=i,o;const r=kt({children:i});return Nt(r,t),r.flags|=St,r.index=n,r}return null}function Va(e,t){const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!0;for(let s of n)if(!(s==="children"||s==="key")&&e[s]!==t[s])return!0;return!1}function Nt(e,t){e.parent=t,e.depth=t.depth+1}function Wa(e){const t=new Map;for(;e;){const n=e.props.key;t.set(n===void 0?e.index:n,e),e=e.sibling}return t}function pi(e,t){e.deletions===null?e.deletions=[t]:e.deletions.push(t)}function ds(e,t){for(;t;)pi(e,t),t=t.sibling}let Yt=[],Ge=!1,ps=[],gs=[],ms=!1,bs=!1,ys=!1,xs=0,ja=[],vs=[],Ua=-1;function pu(e){if(Ge){ps.push(e);return}e()}function $a(){Ge&&(window.cancelAnimationFrame(Ua),Ya())}function Vo(e){e.flags|=Ye,Yt.push(e),Ge=!0,$a()}function Di(e){if(Xt.current==="hydrate")return pu(()=>_s(e));_s(e)}function gu(){Ge||(Ge=!0,Ua=window.requestAnimationFrame(Ya))}function mu(){for(Ge=!1;ps.length;)ps.shift()()}function _s(e){if(ms&&(bs=!0),De.current===e){ys=!0;return}if(!(e.flags&(Ye|Pi))){if(e.flags|=Ye,!Yt.length)return Yt.push(e),gu();Yt.push(e)}}function bu(e){Ii(e,t=>t.flags|=Pi),gs.push(e)}const yu=(e,t)=>t.depth-e.depth;let Jt=null;function Ya(){let e=1;for(Wc();Yt.length;){Yt.length>e&&Yt.sort(yu),Jt=Yt.shift(),e=Yt.length;const t=Jt.flags;if(!(t&Pi)&&t&Ye){let n=Jt;for(;n=xu(n););for(;gs.length;)lu(gs.pop());au(Jt),Jt.flags&=~Ye}}if(jc(),ms=!0,qi(ja),ms=!1,bs)return Su(),qi(vs),bs=!1,xs++,$a();xs=0,mu(),qi(vs)}function xu(e){let t=!0;try{typeof e.type=="string"?wu(e):Eu(e.type)?vu(e):t=_u(e)}catch(i){const s=Au(e);if(s){const o=s.error=i instanceof Error?i:new Error(String(i));return s.props.onError?.(o),s.depth<Jt.depth&&(Jt=s),s}if(Xe.isKiruError(i)){if(i.customNodeStack&&setTimeout(()=>{throw new Error(i.customNodeStack)}),i.fatal)throw i;console.error(i);return}setTimeout(()=>{throw i})}if(e.deletions!==null&&(e.deletions.forEach(bu),e.deletions=null),t&&e.child)return e.child;let n=e;for(;n;){if(n.immediateEffects&&(ja.push(...n.immediateEffects),n.immediateEffects=void 0),n.effects&&(vs.push(...n.effects),n.effects=void 0),n===Jt)return;if(n.sibling)return n.sibling;n=n.parent,Xt.current==="hydrate"&&n?.dom&&qe.pop()}}function vu(e){const{props:t,type:n}=e;let i=t.children;if(n===Oi){const{props:{dependents:s,value:o},prev:r}=e;s.size&&r&&r.props.value!==o&&s.forEach(_s)}else if(n===Ys){const s=e,{error:o}=s;o&&(i=typeof t.fallback=="function"?t.fallback(o):t.fallback,delete s.error)}e.child=qs(e,i)}function _u(e){const{type:t,props:n,subs:i,prev:s,flags:o}=e;if(o&Ta){if(e.memoizedProps=n,s?.memoizedProps&&e.arePropsEqual(s.memoizedProps,n)&&!e.hmrUpdated)return e.flags|=as,!1;e.flags&=~as}try{De.current=e;let r,a=0;do e.flags&=~Ye,ys=!1,Ea.current=0,i&&(i.forEach(l=>l()),i.clear()),r=t(n);while(ys);return e.child=qs(e,r),!0}finally{De.current=null}}function wu(e){const{props:t,type:n}=e;e.dom||(Xt.current==="hydrate"?Zc(e):e.dom=Uc(e)),n!=="#text"&&(e.child=qs(e,t.children),e.child&&Xt.current==="hydrate"&&qe.push(e.dom))}function Su(){if(xs>Nc)throw new Xe("Maximum update depth exceeded. This can happen when a component repeatedly calls setState during render or in useLayoutEffect. Kiru limits the number of nested updates to prevent infinite loops.")}function qi(e){for(let t=0;t<e.length;t++)e[t]();e.length=0}var Wo;(function(e){e.Start="start",e.End="end"})(Wo||(Wo={}));const fe=()=>{const e=De.current;return e||Xa("useRequestUpdate"),()=>Di(e)};function Ft(e,t,n){const i=De.current;i||Xa(e);const s=(a,l)=>{if(l?.immediate){(i.immediateEffects??(i.immediateEffects=[])).push(a);return}(i.effects??(i.effects=[])).push(a)},o=Ea.current++;let r=i.hooks?.at(o);try{const a=r??(typeof t=="function"?t():{...t});return i.hooks??(i.hooks=[]),i.hooks[o]=a,n({hook:a,isInit:!r,update:()=>Di(i),queueEffect:s,vNode:i,index:o})}catch(a){throw a}}function Xa(e){throw new Xe(\`Hook "\${e}" must be used at the top level of a component or inside another composite hook.\`)}function Ai(e){e.cleanup&&(e.cleanup(),e.cleanup=void 0)}function nn(e,t){return e===void 0||t===void 0||e.length!==t.length||e.length>0&&t.some((n,i)=>!Object.is(n,e[i]))}const ws={stack:new Array,current:function(){return this.stack[this.stack.length-1]}},Ve=new Map;var qa;class W{constructor(t,n){this[qa]=!0,this.$id=Nu(),this.$value=t,n&&(this.displayName=n),this.$subs=new Set}get value(){return this.onBeforeRead?.(),W.entangle(this),this.$value}set value(t){Object.is(this.$value,t)||(this.$prevValue=this.$value,this.$value=t,this.notify())}peek(){return this.onBeforeRead?.(),this.$value}sneak(t){this.$prevValue=this.$value,this.$value=t}toString(){return this.onBeforeRead?.(),W.entangle(this),\`\${this.$value}\`}subscribe(t){return this.$subs.add(t),()=>this.$subs.delete(t)}notify(t){this.$subs.forEach(n=>{if(!(t?.filter&&!t.filter(n)))return n(this.$value,this.$prevValue)})}static isSignal(t){return typeof t=="object"&&!!t&&wa in t}static subscribers(t){return t.$subs}static makeReadonly(t){const n=Object.getOwnPropertyDescriptor(t,"value");return n&&!n.writable?t:Object.defineProperty(t,"value",{get:function(){return W.entangle(this),this.$value},configurable:!0})}static makeWritable(t){const n=Object.getOwnPropertyDescriptor(t,"value");return n&&n.writable?t:Object.defineProperty(t,"value",{get:function(){return W.entangle(this),this.$value},set:function(i){this.$value=i,this.notify()},configurable:!0})}static entangle(t){const n=De.current,i=ws.current();if(i){(!n||n&&Tt())&&i.set(t.$id,t);return}if(!n||!Tt())return;const s=t.subscribe(()=>Di(n));(n.subs??(n.subs=new Set)).add(s)}static configure(t,n){t.onBeforeRead=n}static dispose(t){t.$isDisposed=!0,t.$subs.clear()}}qa=wa;const ht=(e,t)=>new W(e,t),J=(e,t)=>Ft("useSignal",{signal:null},({hook:n,isInit:i,isHMR:s})=>(i&&(n.cleanup=()=>W.dispose(n.signal),n.signal=new W(e,t)),n.signal));function Ke(e,t=!1){return W.isSignal(e)?t?e.value:e.peek():e}const ku=()=>{Ve.forEach(e=>e()),Ve.clear()},gi={internalProps:["children","ref","key","innerHTML"],isEvent:e=>e.startsWith("on"),isProperty:e=>!gi.internalProps.includes(e)&&!gi.isEvent(e)};function Tu(e){switch(e){case"className":return"class";case"htmlFor":return"for";case"tabIndex":case"formAction":case"formMethod":case"formEncType":case"contentEditable":case"spellCheck":case"allowFullScreen":case"autoPlay":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"noModule":case"noValidate":case"popoverTarget":case"popoverTargetAction":case"playsInline":case"readOnly":case"itemscope":case"rowSpan":case"crossOrigin":return e.toLowerCase();default:return e.indexOf("-")>-1?e:e.startsWith("aria")?"aria-"+e.substring(4).toLowerCase():Hc.get(e)||e}}function Tt(){return Xt.current==="dom"||Xt.current==="hydrate"}function Mu(e){return(e.flags&Pi)!==0}function Gs(e){return typeof e=="object"&&e!==null&&"type"in e}function Ks(e){return typeof e=="string"&&e!==""||typeof e=="number"||typeof e=="bigint"}function Eu(e){return e===$e||e===Oi||e===Ys}function Cu(e){return e.type===$e}function Ou(e){return typeof e.type=="function"&&"displayName"in e.type&&e.type.displayName==="Kiru.lazy"}function Pu(e){return typeof e.type=="function"&&"displayName"in e.type&&e.type.displayName==="Kiru.memo"}function mi(e){const{props:{children:t,...n},memoizedProps:i,index:s}=e;e.prev={props:n,memoizedProps:i,index:s},e.flags&=-15}function Ii(e,t){t(e);let n=e.child;for(;n;)t(n),n.child&&Ii(n,t),n=n.sibling}function Du(e,t){let n=e.parent;for(;n;){if(t(n))return n;n=n.parent}return null}function Au(e){return Du(e,t=>t.type===Ys)}function Iu(e){return typeof e=="string"||typeof e=="number"}function Lu(e){return typeof e=="function"||typeof e=="object"&&!!e&&"current"in e||W.isSignal(e)}const Ru="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz-";function Nu(e=10,t=Ru){let n="";for(let i=0;i<e;i++)n+=t[Math.random()*t.length|0];return n}const jo=Object.freeze(()=>{});function zu(){const e=new Set,t=new Map;function n(r,a,l){t.get(r)?.forEach(c=>c(a,l))}function i(r,a){t.has(r)||t.set(r,new Set),t.get(r).add(a)}function s(r,a){t.get(r)?.delete(a)}const o={get apps(){return Array.from(e)},emit:n,on:i,off:s};return i("mount",r=>e.add(r)),i("unmount",r=>e.delete(r)),o}function Fu(e){const{id:t,subs:n,fn:i,deps:s=[],onDepChanged:o}=e;let r;Ve.delete(t);const a=!!De.current&&!Tt();a||(r=new Map,ws.stack.push(r));const l=i(...s.map(c=>c.value));if(!a){for(const[u,f]of n)r.has(u)||(f(),n.delete(u));const c=()=>{Ve.size||queueMicrotask(ku),Ve.set(t,o)};for(const[u,f]of r){if(n.has(u))continue;const p=f.subscribe(c);n.set(u,p)}ws.stack.pop()}return l}class Be extends W{constructor(t,n){super(void 0,n),this.$getter=t,this.$unsubs=new Map,this.$isDirty=!0,W.configure(this,()=>{this.$isDirty&&Be.run(this)})}get value(){return super.value}set value(t){}subscribe(t){return this.$isDirty&&Be.run(this),super.subscribe(t)}static dispose(t){Be.stop(t),W.dispose(t)}static stop(t){const{$id:n,$unsubs:i}=t;Ve.delete(n),i.forEach(s=>s()),i.clear(),t.$isDirty=!0}static run(t){const n=t,{$id:i,$getter:s,$unsubs:o}=n,r=Fu({id:i,subs:o,fn:()=>s(n.$value),onDepChanged:()=>{n.$isDirty=!0,t.$subs.size&&(Be.run(n),!Object.is(n.$value,n.$prevValue)&&n.notify())}});n.sneak(r),n.$isDirty=!1}}const Ga=(e,t)=>new Be(e,t);let Hu=0;function Bu(e,t,n){const i=m(t.nodeName.toLowerCase(),{});i.dom=t,i.flags|=re;const s=Hu++,o=\`App-\${s}\`,r={id:s,name:o,rootNode:i,render:a,unmount:l};function a(c){i.props.children=c,Vo(i)}function l(){i.props.children=null,Vo(i),window.__kiru.emit("unmount",r)}return a(e),window.__kiru.emit("mount",r),r}function de(e){return Tt()?Ft("useState",{state:void 0,dispatch:jo},({hook:t,isInit:n,update:i,isHMR:s})=>(n&&(t.state=typeof e=="function"?e():e,t.dispatch=o=>{const r=typeof o=="function"?o(t.state):o;Object.is(t.state,r)||(t.state=r,i())}),[t.state,t.dispatch])):[typeof e=="function"?e():e,jo]}function Vu(e){const t={[Rc]:!0,Provider:({value:n,children:i})=>{const[s]=de(()=>new Set);return m(Oi,{value:n,ctx:t,dependents:s},typeof i=="function"?i(n):i)},default:()=>e,set displayName(n){this.Provider.displayName=n},get displayName(){return this.Provider.displayName||"Anonymous Context"}};return t}function We(e,t){return Tt()?Ft("useCallback",{callback:e,deps:t},({hook:n,isHMR:i})=>(nn(t,n.deps)&&(n.deps=t,n.callback=e),n.callback)):e}function Wu(e,t=!0){return Ft("useContext",{context:e,warnIfNotFound:t},ju)}const ju=({hook:e,isInit:t,vNode:n})=>{if(t){let i=n.parent;for(;i;){if(i.type===Oi){const s=i,{ctx:o,value:r,dependents:a}=s.props;if(o===e.context)return a.add(n),e.cleanup=()=>a.delete(n),e.provider=s,r}i=i.parent}}return e.provider?e.provider.props.value:e.context.default()};function ut(e,t){if(Tt())return Ft("useEffect",{deps:t},({hook:n,isInit:i,isHMR:s,queueEffect:o})=>{(i||nn(t,n.deps))&&(n.deps=t,Ai(n),o(()=>{const r=e();typeof r=="function"&&(n.cleanup=r)}))})}function Zs(e,t){if(Tt())return Ft("useLayoutEffect",{deps:t},({hook:n,isInit:i,isHMR:s,queueEffect:o})=>{(i||nn(t,n.deps))&&(n.deps=t,Ai(n),o(()=>{const r=e();typeof r=="function"&&(n.cleanup=r)},{immediate:!0}))})}function bi(e,t){return Tt()?Ft("useMemo",{deps:t,value:void 0},({hook:n,isInit:i,isHMR:s})=>((i||nn(t,n.deps))&&(n.deps=t,n.value=e()),n.value)):e()}function Ze(e){return Tt()?Ft("useRef",{ref:{current:e}},({hook:t,isInit:n,isHMR:i})=>t.ref):{current:e}}"window"in globalThis&&(window.__KIRU_LAZY_CACHE??(window.__KIRU_LAZY_CACHE=new Map));var Uo;"window"in globalThis&&!globalThis.__KIRU_DEVTOOLS__&&((Uo=globalThis.window).__kiru??(Uo.__kiru=zu()));function Ss(...e){return e.filter(Boolean).join(" ")}function Qs(e,t,n){let i=e;for(let s=0;s<t.length;s++){const o=t[s];s===t.length-1?i[o]=n:i=i[o]}}function Ka(e){return e.type.displayName??(e.type.name||"Anonymous Function")}const Uu=e=>e.__devtoolsFileLink??null;function Pn(e){return e.name==="kiru.devtools"}function Za(e){return Array.from(e.entries())}function $u(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e},m("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),m("path",{d:"M12 9v11"}),m("path",{d:"M2 9h13a2 2 0 0 1 2 2v9"}))}function ae(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1rem",height:"1rem",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m("path",{d:"m9 18 6-6-6-6"}))}function Yu(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),m("circle",{cx:"12",cy:"12",r:"3"}))}function Xu(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m("path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6"}),m("path",{d:"m21 3-9 9"}),m("path",{d:"M15 3h6v6"}))}function qu(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m("path",{d:"m12 14 4-4"}),m("path",{d:"M3.34 19a10 10 0 1 1 17.32 0"}))}function Gu(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m("circle",{cx:"12",cy:"12",r:"10"}),m("path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}),m("path",{d:"M2 12h20"}))}function Ku(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m("path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}),m("path",{d:"M21 3v5h-5"}),m("path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}),m("path",{d:"M8 16H3v5"}))}function Zu(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e},m("path",{d:"M22 8.35V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8.35A2 2 0 0 1 3.26 6.5l8-3.2a2 2 0 0 1 1.48 0l8 3.2A2 2 0 0 1 22 8.35Z"}),m("path",{d:"M6 18h12"}),m("path",{d:"M6 14h12"}),m("rect",{width:"12",height:"12",x:"6",y:"10"}))}function Qa(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}),m("path",{d:"M12 9v4"}),m("path",{d:"M12 17h.01"}))}function Ja({title:e,children:t,className:n,disabled:i,...s}){const[o,r]=de(!0);ut(()=>{!o&&i&&r(!0)},[i]);const a=We(l=>{l.preventDefault(),l.stopImmediatePropagation(),r(c=>!c)},[]);return m("div",{className:"flex flex-col"},m("button",{onclick:a,disabled:i,className:\`\${i?"opacity-50 cursor-default":"cursor-pointer"}\`},m("span",{className:"flex items-center gap-2 font-medium"},m(ae,{className:\`transition \${o?"":"rotate-90"}\`}),e)),o?null:m("div",{className:\`p-2 \${n||""}\`,...s},t))}const Js={arrayChunkSize:10,objectKeysChunkSize:100};function tl(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;const n=new Set([...Object.keys(e),...Object.keys(t)]);for(const i in n)if(typeof t[i]!=typeof e[i]||typeof e[i]=="object"&&!tl(e[i],t[i]))return!1;return!0}function el(e,t,n){for(const i in t)typeof e[i]>"u"&&(e[i]=structuredClone(t[i]));for(const i in e)typeof e[i]=="object"?el(e[i],t[i],n):n(e,i,e[i])}let nl={...Js};const $o=localStorage.getItem("kiru.devtools.userSettings");if($o)try{const e=JSON.parse($o);tl(Js,e)&&(nl=e)}catch(e){console.error("kiru.devtools.userSettings error",e)}const il=Vu({userSettings:null,saveUserSettings:()=>{}}),Li=()=>Wu(il);function Qu({children:e}){const[t,n]=de(nl),i=s=>{localStorage.setItem("kiru.devtools.userSettings",JSON.stringify(s)),n(s)};return m(il.Provider,{value:{userSettings:t,saveUserSettings:i}},e)}function Ju(){const{userSettings:e,saveUserSettings:t}=Li();return m("div",{className:"rounded bg-neutral-400 bg-opacity-5 border border-white border-opacity-10 overflow-hidden"},m(Ie,{border:!1,data:e,onChange:(n,i)=>{const s={...e};Qs(s,n,i),el(s,Js,(o,r,a)=>{o[r]=a<1?1:a}),t(s)},mutable:!0,objectRefAcc:[]}))}const th=Object.freeze(()=>{});function Ie({data:e,onChange:t,mutable:n,objectRefAcc:i,keys:s=[],className:o,border:r=!0}){const{userSettings:{objectKeysChunkSize:a}}=Li(),[l,c]=de(0),u=bi(()=>Object.keys(e).slice(0,(l+1)*a),[l,a,e]),f=()=>{u.forEach(g=>{typeof e[g]=="object"&&i.splice(i.indexOf(e[g]),1)}),c(l+1)},p=u.length<Object.keys(e).length;return m(kt,null,m("div",{className:Ss("flex flex-col items-start w-full",r&&"border border-neutral-700",Ke(o))},u.map(g=>{const x=s.concat(g),y=x.join(".");return m("div",{key:y,"data-key":y,className:"flex flex-col items-start w-full gap-2 pl-2 py-1 pr-1 border-b border-neutral-700 last:border-b-0"},m(to,{value:e[g],onChange:t,keys:x,path:y,label:g,mutable:n,objectRefAcc:i}))})),p&&m("button",{onclick:f,title:"Show more",className:"p-1 border font-bold border-neutral-700 hover:bg-neutral-700"},m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1rem",height:"1rem",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},m("circle",{cx:"12",cy:"12",r:"1"}),m("circle",{cx:"19",cy:"12",r:"1"}),m("circle",{cx:"5",cy:"12",r:"1"}))))}function yi(e,t){Array.isArray(e)?(t(e),e.forEach(n=>yi(n,t))):typeof e=="object"&&e!==null&&(t(e),Object.values(e).forEach(n=>yi(n,t)))}function to({value:e,onChange:t,keys:n,path:i,mutable:s,objectRefAcc:o,label:r}){const{userSettings:{arrayChunkSize:a}}=Li(),[l,c]=de(!0),u=r!==void 0&&m("label",{htmlFor:i,className:"text-xs truncate",title:i,children:r});if(e===null)return m(mt,null,u,m(Zt,null,"null"));if(e===void 0)return m(mt,null,u,m(Zt,null,"undefined"));const f=window.opener?window.opener.Node:Node;if(e instanceof f)return m(mt,null,u,m(Zt,null,"<",m("span",{style:{color:"#f0a05e"}},e.nodeName),"/>"));const p=window.opener?window.opener.Error:Error;if(e instanceof p)return m(mt,null,u,"cause"in e&&e.cause?m(Zt,null,e.message," (",String(e.cause),")"):m(Zt,null,e.message));const g=x=>t(n,x);switch(typeof e){case"string":return m(mt,null,u,m(Gi,{disabled:!s,id:i,type:"text",value:e,onchange:x=>g(x.target.value)}));case"number":return m(mt,null,u,m(Gi,{disabled:!s,id:i,type:"number",value:e,placeholder:"NaN",onchange:x=>g(Number(x.target.value))}));case"bigint":return m(mt,null,u,m(Gi,{disabled:!s,id:i,type:"number",value:e.toString(),onchange:x=>g(BigInt(x.target.value))}));case"boolean":return m(mt,null,u,m("input",{disabled:!s,id:i,type:"checkbox",checked:e,onchange:x=>g(x.target.checked),className:"accent-red-500"}));case"function":return m(mt,null,u,m(Zt,null,\`\u0192 \${e.name||"anonymous"}()\`));default:return Array.isArray(e)?m(mt,null,m("button",{className:"text-xs flex items-center gap-1 cursor-pointer w-full",title:i,onclick:()=>{yi(e,x=>o.splice(o.indexOf(x),1)),c(x=>!x)}},r,m(ae,{width:10,height:10,className:\`transition \${l?"":"rotate-90"}\`})),l?m(Zt,null,"Array(",e.length,")"):e.length>a?m(eh,{array:e,objectRefAcc:o}):m("div",{className:"flex flex-col items-start gap-1 w-full"},e.map((x,y)=>m(to,{value:x,onChange:t,keys:[...n,y.toString()],path:i.concat(".",y.toString()),label:y.toString(),mutable:s,objectRefAcc:o})))):o.includes(e)?m(mt,null,u,m(Zt,null,"Object(circular reference)")):(o.push(e),m(mt,null,m("button",{className:"text-xs flex items-center gap-1 cursor-pointer w-full",title:i,onclick:()=>{yi(e,x=>o.splice(o.indexOf(x),1)),c(x=>!x)}},r,m(ae,{width:10,height:10,className:\`transition \${l?"":"rotate-90"}\`})),l?null:m(Ie,{data:e,onChange:t,keys:n,mutable:s,objectRefAcc:o})))}}function mt({children:e}){return m("div",{className:"flex flex-col items-start gap-1 w-full"},e)}function Gi(e){return m("input",{className:"flex-grow text-xs px-2 py-1 text-neutral-300 w-full",...e})}function Zt({children:e}){return m("small",{className:"text-neutral-300"},m("i",null,e))}function eh({array:e,objectRefAcc:t}){const{userSettings:{arrayChunkSize:n}}=Li(),i=e.length,s=Math.ceil(i/n);return m("div",{className:"flex flex-col items-start gap-1 w-full"},Array.from({length:s}).map((o,r)=>m(nh,{array:e,range:{start:r*n,end:(r+1)*n},objectRefAcc:t})))}function nh({array:e,range:t,objectRefAcc:n}){const[i,s]=de(!0);let o;return i?o=void 0:o=e.slice(t.start,t.end),m("div",{className:"flex flex-col items-start gap-1 w-full"},m("button",{className:"text-xs flex items-center gap-1 cursor-pointer w-full",onclick:()=>{n.splice(n.indexOf(e),1),s(r=>!r)}},"[",t.start,"..",(t.end<e.length?t.end:e.length)-1,"]",m(ae,{width:10,height:10,className:\`transition \${i?"":"rotate-90"}\`})),o&&m("div",{className:"flex flex-col items-start gap-1 w-full"},o.map((r,a)=>m(to,{value:r,onChange:th,label:(t.start+a).toString(),keys:[a.toString()],path:a.toString(),mutable:!1,objectRefAcc:n}))))}const ih="kiru-devtools";"window"in globalThis&&(window.__devtoolsSelection??=null);class sh extends BroadcastChannel{send(t){super.postMessage(t)}removeEventListener(t){return super.removeEventListener("message",t)}addEventListener(t){return super.addEventListener("message",t)}}const Qe=new sh(ih);function eo({fn:e,onclick:t}){const n=bi(()=>Uu(e),[e]);return n?m("a",{className:"flex items-center gap-1 text-[10px] opacity-50 hover:opacity-100 transition-opacity",href:n,onclick:i=>{i.preventDefault(),Qe.send({type:"open-editor",fileLink:n}),t?.(i)},title:"Open in editor"},"Open in editor",m(Xu,{width:"0.65rem",height:"0.65rem"})):null}function oh({selectedApp:e,selectedNode:t,setSelectedNode:n,kiruGlobal:i}){const s=fe();ut(()=>{const l=c=>{c===e&&(Mu(t)?n(null):s())};return i?.on("update",l),()=>i?.off("update",l)},[]);const o=()=>{t&&Di(t)},r={...t.props};delete r.children;const a=lh(t);return m("div",{className:"flex-grow p-2 sticky top-0"},m("h2",{className:"flex justify-between items-center font-bold mb-2 pb-2 border-b-2 border-neutral-800"},m("div",{className:"flex gap-2 items-center"},"<"+Ka(t)+">",m(eo,{fn:t.type})),m("button",{onclick:o},m(Ku,{className:"w-5 h-5"}))),m(Ja,{title:"props",disabled:Object.keys(r).length===0},m(Ie,{data:r,onChange:()=>{},mutable:!1,objectRefAcc:[]})),m(sl,{node:a,selectedApp:e}))}function rh(e){return e.name==="devtools:useHookDebugGroup"}function ah(e){return ks in e}const ks=Symbol.for("devtools.hookGroup");function lh(e){const t={parent:null,name:"hooks",children:[],[ks]:!0};if(e.hooks?.length){let n=t;for(let i=0;i<e.hooks.length;i++){const s=e.hooks[i];if(rh(s)){switch(s.action){case"start":const o={parent:n,name:s.displayName,children:[],[ks]:!0};n.children.push(o),n=o;break;case"end":if(n.name!==s.displayName||n.parent===null)throw new Error("useHookDebugGroup:end called with no start");n=n.parent;break}continue}n.children.push(s)}}return t}function sl({node:e,selectedApp:t,depth:n=0}){if(ah(e))return m(Ja,{title:e.name,className:"bg-[#ffffff04] border border-[#fff1] flex flex-col gap-2 pl-6",disabled:e.children.length===0},e.children.map(u=>m(sl,{node:u,selectedApp:t,depth:n+1})));const{name:i,dev:s,cleanup:o,...r}=e,a=s?.devtools,l=typeof a?.get=="function"?a.get():r;return m("div",null,m("i",{className:"text-neutral-300 text-sm"},i||"anonymous hook"),m("div",{className:"p-2"},m(Ie,{data:l,onChange:(u,f)=>{if(!t||!a?.set||!a?.get)return;const p=a.get();Qs(p,u,f),a.set(p)},mutable:!!a?.set,objectRefAcc:[]})))}const Ce=(e,t,n={})=>{ut(()=>{let i=window;const s=n?.ref?.();return s?i=s:n.ref&&console.warn("useEventListener ref failed, using window"),i.addEventListener(e,t,n),()=>{i.removeEventListener(e,t,n)}},[t])},ch=()=>{const e=J({x:0,y:0}),t=J({x:0,y:0}),n=J({x:0,y:0});return Ce("mousemove",i=>{e.value={x:i.x,y:i.y},t.value={x:i.movementX,y:i.movementY},n.value={x:i.clientX,y:i.clientY}}),{mouse:e,delta:t,client:n}},Xn="window"in globalThis&&"ResizeObserver"in globalThis.window,uh=(e,t,n=void 0)=>Tt()?Xn?Ft("useResizeObserver",{resizeObserver:null,deps:[e.current]},({isInit:i,hook:s,queueEffect:o})=>(i&&(s.resizeObserver=new ResizeObserver(t),s.cleanup=()=>{s.resizeObserver?.disconnect?.(),s.resizeObserver=null}),o(()=>{nn([e.current],s.deps)&&(s.deps=[e.current],s.resizeObserver?.disconnect?.(),e.current&&s.resizeObserver?.observe(e.current,n))}),{isSupported:Xn,start:()=>{s.resizeObserver==null&&(s.resizeObserver=new ResizeObserver(t),e.current&&s.resizeObserver.observe(e.current,n),s.cleanup=()=>{s.resizeObserver?.disconnect?.(),s.resizeObserver=null})},stop:()=>{Ai(s)}})):{isSupported:Xn,start:()=>{},stop:()=>{}}:{isSupported:Xn,start:()=>{},stop:()=>{}},qn="window"in globalThis&&"MutationObserver"in globalThis.window,hh=(e,t,n=void 0)=>Tt()?qn?Ft("useMutationObserver",{mutationObserver:null,deps:[e.current]},({isInit:i,hook:s,queueEffect:o})=>(i?(o(()=>{s.deps=[e.current],s.mutationObserver=new MutationObserver(t),e.current&&s.mutationObserver.observe(e.current,n)}),s.cleanup=()=>{s.mutationObserver?.disconnect?.(),s.mutationObserver=null}):nn([e.current],s.deps)&&(s.deps=[e.current],s.mutationObserver?.disconnect?.(),e.current&&s.mutationObserver?.observe(e.current,n)),{isSupported:qn,start:()=>{s.mutationObserver==null&&(s.mutationObserver=new MutationObserver(t),e.current&&s.mutationObserver.observe(e.current,n),s.cleanup=()=>{s.mutationObserver?.disconnect?.(),s.mutationObserver=null})},stop:()=>{Ai(s)}})):{isSupported:qn,start:()=>{},stop:()=>{}}:{isSupported:qn,start:()=>{},stop:()=>{}},fh=(e,t={windowScroll:!0,windowResize:!0})=>{const n=t?.windowScroll??!0,i=t?.windowResize??!0,s=t.immediate??!0,o=J(0),r=J(0),a=J(0),l=J(0),c=J(0),u=J(0),f=J(0),p=J(0),g=()=>{const x=e.current;if(!x){o.value=0,r.value=0,a.value=0,l.value=0,c.value=0,u.value=0,f.value=0,p.value=0;return}const y=x.getBoundingClientRect();o.value=y.width,r.value=y.height,a.value=y.top,l.value=y.right,c.value=y.bottom,u.value=y.left,f.value=y.x,p.value=y.y};return uh(e,g),hh(e,g,{attributeFilter:["style","class"]}),Ce("scroll",()=>{n&&g()},{capture:!0,passive:!0}),Ce("resize",()=>{i&&g()},{passive:!0}),Zs(()=>{s&&g()},[]),{width:o,height:r,top:a,right:l,bottom:c,left:u,x:f,y:p,update:g}};function dh(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}const Yo=(e,t,n={})=>{const{ref:i,eventName:s="keydown",passive:o=!1}=n,r=dh(e);return Ce(s,l=>{l.repeat&&!n.repeat||r(l)&&t(l)},{ref:i,passive:o})};function ol({value:e,className:t,...n}){return m("div",{className:Ss("w-full p-2 z-10","bg-[#1d1d1d] border border-white border-opacity-10 rounded",t?.toString()),...n},m("input",{className:Ss("px-2 py-1 w-full rounded focus:outline focus:outline-primary","bg-[#212121] border border-white border-opacity-10 rounded"),placeholder:"Filter...",type:"text","bind:value":e}))}let $;"window"in globalThis&&window.opener&&($=window.opener.__kiru);const je=ht(!1);Qe.addEventListener(e=>{e.data.type==="set-inspect-enabled"&&(je.value=e.data.value)});const rl=($?.apps??[]).filter(e=>!Pn(e)),ie=ht(rl);ht(null);const Lt=ht(rl[0]??null),se=ht(null);$?.on("mount",e=>{Pn(e)||(ie.value=[...ie.peek(),e],Lt.peek()===null&&(Lt.value=e))});$?.on("unmount",e=>{ie.value=ie.peek().filter(t=>t!==e),Lt.peek()===e&&(Lt.value=ie.peek()[0]??null)});const Ts=ht(new Map),Rt=ht(null),no=ht("");function ph(e){return e.type.displayName??(e.type.name||"Anonymous Function")}function gh(e,t){const n=t.toLowerCase();return e.every(i=>n.includes(i))}function Ms(e){return typeof e.type=="function"&&!Cu(e)&&!Ou(e)&&!Pu(e)}function mh(e){let t=[e];for(;t.length;){const n=t.pop();if(Ms(n))return!0;n.child&&t.push(n.child),n.sibling&&t.push(n.sibling)}return!1}const bh=(e,t)=>{const n=[t.parent];for(;n.length;){const i=n.pop();if(e===i)return!0;i?.parent&&n.push(i.parent)}return!1};function Es(e,t){if(!e)return null;const n=t(e),i=Es(e.sibling,t),s=Es(e.child,t);return n?{ref:e,sibling:i??null,child:s??null}:i||s||null}function xi({node:e,traverseSiblings:t=!0}){const[n,i]=de(!0),o=se.value===e,r=bi(()=>crypto.randomUUID(),[]),a=bi(()=>Rt.value==null?null:bh(e,Rt.value),[Rt.value,e]);ut(()=>{a&&i(!1)},[a]),ut(()=>{if(!(!e||!Ms(e)))return Ts.peek().set(r,{vNode:e,setCollapsed:i}),()=>{Ts.peek().delete(r)}});const l=no.value;if(!e)return null;if(!Ms(e)||l.length>0&&!gh(l.toLowerCase().split(" "),e.type.name))return m(kt,null,e.child&&m(xi,{node:e.child}),t&&m(Xo,{node:e}));const c=e.child&&mh(e.child);return m(kt,null,m("div",{className:"pl-4 mb-1"},m("h2",{onclick:()=>{Rt.value=null,se.value=o?null:e},className:\`flex gap-2 items-center cursor-pointer mb-1 scroll-m-12 \${o?"font-medium bg-primary selected-vnode":""}\`,"data-id":r},c&&m(ae,{className:\`cursor-pointer transition \${n?"":"rotate-90"}\`,onclick:u=>{u.preventDefault(),u.stopImmediatePropagation(),Rt.value=null,i(f=>!f)}}),m("div",{className:c?"":"ml-6"},m("span",{className:o?"":"text-neutral-400"},"<"),m("span",{className:o?"":"text-primary"},ph(e)),m("span",{className:o?"":"text-neutral-400"},">"))),!n&&e.child||a!=null&&a&&e.child?m(xi,{node:e.child}):null),t&&m(Xo,{node:e}))}function Xo({node:e}){if(!e)return null;let t=[],n=e.sibling;for(;n;)t.push(n),n=n.sibling;return m(kt,null,t.map(i=>m(xi,{node:i,traverseSiblings:!1})))}const yh=()=>{const e=Ze(null),t=r=>{if(!r)return null;const a=r.getAttribute("data-id");if(a!=null)return Ts.peek().get(a)},n=r=>{if(!r)return;const a=t(r);a!=null&&(r.scrollIntoView({behavior:"smooth"}),se.value=a.vNode)},i=r=>{if(!r||r===document.body)return null;const a=r.parentElement,l=a?.nextElementSibling?.querySelector("h2[data-id]");return l||i(a)},s=()=>{const r=document.querySelector("h2[data-id]");n(r)},o=()=>{const r=document.querySelectorAll("h2[data-id]"),a=r.item(r.length-1);a&&n(a)};return Yo(["ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],r=>{if(Rt.value&&(Rt.value=null),document.activeElement&&document.activeElement instanceof HTMLInputElement&&document.activeElement!=e.current)return;r.preventDefault();const a=document.querySelector(".selected-vnode");if(a===null){r.key==="ArrowDown"?s():r.key==="ArrowUp"&&o();return}if(r.key==="ArrowRight"){const l=t(a);l&&l.setCollapsed(!1);return}else if(r.key==="ArrowLeft"){const l=t(a);l&&l.setCollapsed(!0);return}if(r.key==="ArrowDown"){const l=a?.nextElementSibling?.querySelector("h2[data-id]");if(l)return n(l);const c=a.parentElement?.nextElementSibling?.querySelector("h2[data-id]");if(c)return n(c);const u=i(a);return u?n(u):s()}else if(r.key==="ArrowUp"){const l=a.parentElement?.previousElementSibling;if(l?.matches("h2[data-id]"))return n(l);const c=l?.querySelectorAll("h2[data-id]");return c?.length!=null&&c?.length>=1?n(c?.item?.(c.length-1)):o()}}),Yo("l",r=>{r.ctrlKey&&(r.preventDefault(),e.current?.focus({preventScroll:!1}))}),{searchRef:e}},xh=e=>{no.value=e.target.value,Rt.value&&(Rt.value=null)};function vh(){const{searchRef:e}=yh(),t=Lt.value;return m("div",{className:"flex-grow p-2 sticky top-0"},m("div",{className:"flex gap-4 pb-2 border-b-2 border-neutral-800 mb-2 items-center"},m("input",{ref:e,className:"bg-[#171616] px-1 py-2 w-full focus:outline focus:outline-primary",placeholder:"Search for component",type:"text",value:no,oninput:xh})),t?.rootNode&&m(xi,{node:t.rootNode}))}const _h=e=>{const{mouse:t}=ch(),n=J(null),i=J(0),s=J(0),o=Ze(null),r=fh(o),a=Ze(null),[l,c]=Array.isArray(e.children)?e.children:[];return Zs(()=>{a.current&&(s.value=a.current.clientWidth/2)},[a.current]),Ce("mouseup",We(()=>n.value=null,[])),Ce("mousemove",We(u=>{if(n.value==null||a.current==null)return;const f=Math.max(i.value+u.x-n.value.x,250);s.value=Math.min(f,a.current.clientWidth-250)},[])),Ce("resize",We(()=>{a.current!=null&&a.current.clientWidth-250<s.value&&(s.value=Math.max(a.current.clientWidth-250,250))},[])),m("div",{onmousemove:u=>{u.x},ref:a,className:"flex-grow grid gap-2 items-start w-full relative",style:{gridTemplateColumns:\`\${s}px 1fr\`}},m("div",{ref:o,className:"firstContainer w-full h-full"},l),r.width.value!=0&&m("div",{className:"w-8 flex justify-center h-full absolute top-0 -translate-x-1/2 cursor-col-resize z-[9999]",style:{left:\`\${r.width}px\`},onmousedown:u=>{u.preventDefault(),n.value={...t.value},i.value=s.value}},m("div",{className:"dividerLine w-[5px] bg-neutral-800 h-full"})),m("div",{className:"secondContainer h-full"},c))},wh=()=>m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-square-mouse-pointer"},m("path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z"}),m("path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"})),Sh=()=>{je.value=!je.value,Qe.send({type:"set-inspect-enabled",value:je.value})};function kh(){const e=Lt.value,t=se.value,n=fe();return ut(()=>{const i=s=>{s===e&&n()};return $?.on("update",i),()=>$?.off("update",i)},[Lt]),ut(()=>{const i=s=>{if(s.data.type!=="select-node")return;if(!window.__devtoolsSelection){console.error("no selection ptr");return}const{app:o,node:r}=window.__devtoolsSelection;window.__devtoolsSelection=null,Lt.value=o,se.value=r,Rt.value=r,je.value=!1};return Qe.addEventListener(i),()=>Qe.removeEventListener(i)},[Lt]),m(kt,null,m("div",{className:"flex items-center justify-between gap-4 p-2 bg-neutral-400 bg-opacity-5 border border-white border-opacity-10 rounded"},m("div",{className:"flex items-center gap-4"},m("select",{className:"px-2 py-1 bg-neutral-800 text-neutral-100 rounded border border-white border-opacity-10",value:e?.name??"",onchange:i=>Lt.value=ie.peek().find(s=>s.name===i.currentTarget.value)??null},m("option",{value:"",disabled:!0},"Select App"),ie.value.map(i=>m("option",{key:i.id,value:i.name},i.name))),m("button",{title:"Toggle Component Inspection",onclick:Sh,className:\`p-1 rounded \${je.value?"bg-neutral-900":""}\`},m(wh,null)))),m(_h,null,e&&m(vh,null),t&&e&&m(oh,{selectedApp:e,selectedNode:t,setSelectedNode:i=>se.value=i,kiruGlobal:$})))}const Cs=ht({}),ke=ht([]);$?.stores?.subscribe(e=>{Cs.value=e,ke.value=ke.value.filter(t=>Object.values(Cs.value).includes(t))});const al=ht(""),Th=Ga(()=>al.value.toLowerCase().split(" ").filter(e=>e.length>0));function Mh(e){return Th.value.every(t=>e.toLowerCase().includes(t))}function Eh(){const e=Object.entries(Cs.value);return e.length===0?m("div",{className:"flex flex-col items-center justify-center h-full text-neutral-400"},m(Qa,null),m("h2",{className:"text-lg italic"},"No stores detected")):m("div",{className:"flex flex-col gap-2 items-start"},m(ol,{value:al,className:"sticky top-0"}),m("div",{className:"flex flex-col gap-2 w-full"},e.filter(([t])=>Mh(t)).map(([t,n])=>m(Ch,{key:t,name:t,store:n}))))}function Ch({name:e,store:t}){const n=ke.value.includes(t),i=fe(),{value:s}=ll(t);Zs(()=>{const r=t.subscribe(()=>i());return()=>r()},[]);const o=We(()=>{n?ke.value=ke.value.filter(r=>r!==t):ke.value=[...ke.value,t]},[n]);return m("div",{className:"flex flex-col"},m("button",{onclick:o,className:"flex items-center gap-2 justify-between p-2 border border-white border-opacity-10 cursor-pointer"+(n?" bg-white bg-opacity-5 text-neutral-100 rounded-t":" hover:bg-white hover:bg-opacity-10 text-neutral-400 rounded")},e,m("div",{className:"flex gap-2"},m(eo,{fn:t,onclick:r=>r.stopPropagation()}),m(ae,{className:"transition-all"+(n?" rotate-90":"")}))),n&&m("div",{className:"flex flex-col gap-2 p-2 border border-white border-opacity-10"},m(Ie,{data:{value:s},mutable:!0,objectRefAcc:[],onChange:(r,a)=>{const l=structuredClone({value:s});Qs(l,r,a),t.setState(l.value)}}),m(Oh,{store:t})))}function Oh({store:e}){const t=ie.value;return t.length===0?null:m(kt,null,t.map(n=>m(Ph,{store:e,app:n})))}const qo=Symbol.for("kiru.hmrAccept"),ll=e=>{if(qo in e)return e[qo].provide().current;throw new Error("Unable to get store subscribers")};function Ph({store:e,app:t}){const n=fe(),{subscribers:i,nodeStateMap:s}=ll(e),o=t.rootNode.child;if(ut(()=>{const a=l=>{l===t&&n()};return $?.on("update",a),()=>$?.off("update",a)},[]),!o)return null;const r=Es(o,a=>i.has(a));return m("div",{className:"flex flex-col gap-2 p-2 rounded-b border border-white border-opacity-10"},m("b",null,t.name),r&&m("ul",{className:"pl-8"},m(Os,{node:r,nodeStateMap:s})))}function Os({node:e,nodeStateMap:t}){const[n,i]=de(!1),o=t.get(e.ref)?.slices??[];return m(kt,null,m("li",{className:"flex flex-col gap-2"},m("div",{className:"flex flex-col border border-white border-opacity-10 rounded"+(n?" bg-white bg-opacity-5 text-neutral-100":" hover:bg-white hover:bg-opacity-10 text-neutral-400")},m("button",{onclick:()=>i(!n),className:"flex gap-2 p-2 justify-between cursor-pointer"},m("span",null,"<"+Ka(e.ref)+" />"),m("div",{className:"flex gap-2 items-center"},m(eo,{fn:e.ref.type,onclick:r=>r.stopPropagation()}),m(ae,{className:"transition-all"+(n?" rotate-90":"")}))),n&&m("div",{className:"flex flex-col gap-2 p-2 bg-[#1a1a1a]"},o.length===0&&m("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},m("h5",{className:"border-b border-white border-opacity-10"},"No slices")),o.map(r=>m("div",{className:"flex flex-col gap-2"},m("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},m("h5",{className:"border-b border-white border-opacity-10"},"Slice:"),m("pre",{className:"text-neutral-400"},m(Ie,{data:{value:r.value},mutable:!1,objectRefAcc:[],onChange:()=>{}}))),m("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},m("h5",{className:"border-b border-white border-opacity-10"},"SliceFn:"),m("pre",{className:"text-neutral-400"},r.sliceFn?r.sliceFn.toString():"null")),r.eq&&m("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},m("h5",{className:"border-b border-white border-opacity-10"},"eq:"),m("pre",{className:"text-neutral-400"},r.eq.toString())))))),e.child&&m("ul",{className:"pl-8 flex flex-col gap-2"},m(Os,{node:e.child,nodeStateMap:t}))),e.sibling&&m(Os,{node:e.sibling,nodeStateMap:t}))}/*!
|
|
2410
|
+
<script type="module" crossorigin>(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();const Lc="production",he=Lc==="development",wa=Symbol.for("kiru.signal"),Rc=Symbol.for("kiru.context"),Oi=Symbol.for("kiru.contextProvider"),Ue=Symbol.for("kiru.fragment"),Sa=Symbol.for("kiru.error"),ka=Symbol.for("kiru.memo"),Ys=Symbol.for("kiru.errorBoundary"),Nc=50,ne=2,St=4,Pi=8,re=16,Ta=32,as=64,$e=128,zc=/^on:?/,Ma=new Set(["animateTransform","circle","clipPath","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","path","polygon","polyline","radialGradient","rect","stop","svg","switch","symbol","text","textPath","title","tspan","use"]),Fc=new Set(["allowfullscreen","autofocus","autoplay","async","checked","compact","controls","contenteditable","declare","default","defer","disabled","download","hidden","inert","ismap","multiple","nohref","noresize","noshade","novalidate","nowrap","open","popover","readonly","required","sandbox","scoped","selected","sortable","spellcheck","translate","wrap"]),Hc=new Map([["acceptCharset","accept-charset"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["httpEquiv","http-equiv"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]);function Vc(e){return typeof e=="string"||typeof e=="number"||typeof e=="bigint"||typeof e=="boolean"||e===void 0||e===null}const Ye={current:null},Ea={current:0},Xt={current:"window"in globalThis?"dom":"string"};var Ca;class Xe extends Error{constructor(t){const n=typeof t=="string"?t:t.message;super(n),this[Ca]=!0,typeof t!="string"&&(this.fatal=t?.fatal)}static isKiruError(t){return t instanceof Error&&t[Sa]===!0}}Ca=Sa;const qe={parentStack:[],childIdxStack:[],eventDeferrals:new Map,parent:function(){return this.parentStack[this.parentStack.length-1]},clear:function(){this.parentStack.length=0,this.childIdxStack.length=0},pop:function(){this.parentStack.pop(),this.childIdxStack.pop()},push:function(e){this.parentStack.push(e),this.childIdxStack.push(0)},currentChild:function(){return this.parentStack[this.parentStack.length-1].childNodes[this.childIdxStack[this.childIdxStack.length-1]]},nextChild:function(){return this.parentStack[this.parentStack.length-1].childNodes[this.childIdxStack[this.childIdxStack.length-1]++]},bumpChildIndex:function(){this.childIdxStack[this.childIdxStack.length-1]++},captureEvents:function(e){Ho(e,!0),this.eventDeferrals.set(e,[])},resetEvents:function(e){this.eventDeferrals.delete(e)},releaseEvents:function(e){Ho(e,!1);const t=this.eventDeferrals.get(e);for(;t?.length;)t.shift()()}},Bc=e=>{const t=e.target;!e.isTrusted||!t||qe.eventDeferrals.get(t)?.push(()=>t.dispatchEvent(e))},Ho=(e,t)=>{for(const n in e)if(n.startsWith("on")){const i=n.substring(2);e[t?"addEventListener":"removeEventListener"](i,Bc,{passive:!0})}};let Xs=!1,ls=!1;const Oa=e=>{e.preventDefault(),e.stopPropagation(),ls=!0};let Te=null;function Wc(){Xs=!0,Te=document.activeElement,Te&&Te!==document.body&&Te.addEventListener("blur",Oa)}function jc(){ls&&(Te.removeEventListener("blur",Oa),Te.isConnected&&Te.focus(),ls=!1),Xs=!1}function cs(e,t){if(typeof e=="function"){e(t);return}if(W.isSignal(e)){e.sneak(t),e.notify({filter:n=>typeof n=="function"});return}e.current=t}function Uc(e){const t=e.type;return t=="#text"?Pa(e):Ma.has(t)?document.createElementNS("http://www.w3.org/2000/svg",t):document.createElement(t)}function Pa(e){const{nodeValue:t}=e.props;if(!W.isSignal(t))return document.createTextNode(t);const n=t.peek()??"",i=document.createTextNode(n);return hs(e,i,t),i}function $c(e,t,n){const i=us.get(e)??{},s=i[t]=o=>{if(Xs){o.preventDefault(),o.stopPropagation();return}n(o)};return us.set(e,i),s}const us=new WeakMap;function Da(e){const t=e.dom,n=e.prev?.props??{},i=e.props??{},s=new Set([...Object.keys(n),...Object.keys(i)]),o=Xt.current==="hydrate";s.forEach(r=>{const a=n[r],l=i[r];if(gi.internalProps.includes(r)&&r!=="innerHTML"){r==="ref"&&a!==l&&(a&&cs(a,null),l&&cs(l,t));return}if(gi.isEvent(r)){if(a!==l||Xt.current==="hydrate"){const c=r.replace(zc,""),u=c==="focus"||c==="blur";r in n&&t.removeEventListener(c,u?us.get(e)?.[c]:a),r in i&&t.addEventListener(c,u?$c(e,c,l):l)}return}if(!(t instanceof Text)){if(a===l||o&&t.getAttribute(r)===l)return;if(W.isSignal(a)&&e.cleanups){const c=e.cleanups[r];c&&(c(),delete e.cleanups[r])}if(W.isSignal(l))return Gc(e,t,r,l,a);ui(t,r,l,a);return}W.isSignal(l)||t.nodeValue!==l&&(t.nodeValue=l)})}function Yc(e){return e.multiple?Array.from(e.selectedOptions).map(t=>t.value):e.value}function Aa(e,t){if(!e.multiple||t===void 0||t===null||t===""){e.value=t;return}Array.from(e.options).forEach(n=>{n.selected=t.indexOf(n.value)>-1})}const Xc={value:"input",checked:"change",open:"toggle",volume:"volumechange",playbackRate:"ratechange",currentTime:"timeupdate"},qc=["progress","meter","number","range"];function Gc(e,t,n,i,s){const o=e.cleanups??(e.cleanups={}),[r,a]=n.split(":");if(r!=="bind")return o[n]=i.subscribe((y,v)=>{ui(t,n,y,v)}),ui(t,n,i.peek(),Ke(s));const l=Xc[a];if(!l)return;const c=t instanceof HTMLSelectElement,u=c?y=>Aa(t,y):y=>t[a]=y,f=y=>{u(y)},p=y=>{i.sneak(y),i.notify({filter:v=>v!==f})};let g;if(a==="value"){const y=qc.indexOf(t.type)!==-1;g=()=>{let v=t.value;c?v=Yc(t):typeof i.peek()=="number"&&y&&(v=t.valueAsNumber),p(v)}}else g=y=>{const v=y.target[a];a==="currentTime"&&i.peek()===v||p(v)};t.addEventListener(l,g);const x=i.subscribe(f);return o[n]=()=>{t.removeEventListener(l,g),x()},ui(t,a,i.peek(),Ke(s))}function hs(e,t,n){(e.cleanups??(e.cleanups={})).nodeValue=n.subscribe((i,s)=>{i!==s&&(t.nodeValue=i)})}function Kc(e){if(e.type!=="#text"||!W.isSignal(e.props.nodeValue))return;const t=Ke(e.props.nodeValue);if(!Vc(t))return;const n=Pa(e),i=qe.parent();return i&&i.appendChild(n),n}function Zc(e){const t=qe.nextChild()??Kc(e);if(!t)throw new Xe({message:"Hydration mismatch - no node found",vNode:e});let n=t.nodeName;if(Ma.has(n)||(n=n.toLowerCase()),e.type!==n)throw new Xe({message:\`Hydration mismatch - expected node of type \${e.type.toString()} but received \${n}\`,vNode:e});if(e.dom=t,e.type!=="#text"&&!(e.flags&re)){Da(e);return}W.isSignal(e.props.nodeValue)&&hs(e,t,e.props.nodeValue);let i=e,s=e.sibling;for(;s&&s.type==="#text";){const o=s;qe.bumpChildIndex();const r=String(Ke(i.props.nodeValue)??""),a=i.dom.splitText(r.length);o.dom=a,W.isSignal(o.props.nodeValue)&&hs(o,a,o.props.nodeValue),i=s,s=s.sibling}}function Ia(e,t,n,i=!1){if(n===null)return e.removeAttribute(t),!0;switch(typeof n){case"undefined":case"function":case"symbol":return e.removeAttribute(t),!0;case"boolean":if(i&&!n)return e.removeAttribute(t),!0}return!1}function Qc(e,t,n){const i=Fc.has(t);Ia(e,t,n,i)||e.setAttribute(t,i&&typeof n=="boolean"?"":String(n))}const Jc=["INPUT","TEXTAREA"],tu=e=>Jc.indexOf(e.nodeName)>-1;function ui(e,t,n,i){if(n!==i)switch(t){case"style":return iu(e,n,i);case"className":return nu(e,n);case"innerHTML":return eu(e,n);case"muted":e.muted=!!n;return;case"value":if(e.nodeName==="SELECT")return Aa(e,n);const s=n==null?"":String(n);if(tu(e)){e.value=s;return}e.setAttribute("value",s);return;case"checked":if(e.nodeName==="INPUT"){e.checked=!!n;return}e.setAttribute("checked",String(n));return;default:return Qc(e,Tu(t),n)}}function eu(e,t){if(t==null||typeof t=="boolean"){e.innerHTML="";return}e.innerHTML=String(t)}function nu(e,t){const n=Ke(t);if(!n)return e.removeAttribute("class");e.setAttribute("class",n)}function iu(e,t,n){if(Ia(e,"style",t))return;if(typeof t=="string"){e.setAttribute("style",t);return}let i={};typeof n=="string"?e.setAttribute("style",""):typeof n=="object"&&n&&(i=n);const s=t;new Set([...Object.keys(i),...Object.keys(s)]).forEach(r=>{const a=i[r],l=s[r];if(a!==l){if(l===void 0){e.style[r]="";return}e.style[r]=l}})}function su(e){let t=e.parent,n=t?.dom;for(;t&&!n;)t=t.parent,n=t?.dom;if(!n||!t){if(!e.parent&&e.dom)return e;throw new Xe({message:"No DOM parent found while attempting to place node.",vNode:e})}return t}function ou(e,t){const{node:n,lastChild:i}=t,s=e.dom;if(i){i.after(s);return}const o=La(e,n);if(o){n.dom.insertBefore(s,o);return}n.dom.appendChild(s)}function La(e,t){let n=e;for(;n;){let i=n.sibling;for(;i;){if(!(i.flags&(St|re))){const s=ru(i);if(s?.isConnected)return s}i=i.sibling}if(n=n.parent,!n||n.flags&re||n===t)return}}function ru(e){let t=e;for(;t;){if(t.dom)return t.dom;if(t.flags&re)return;t=t.child}}function au(e){if(Xt.current==="hydrate")return Ii(e,mi);const t={node:e.dom?e:su(e)};fs(e,t,(e.flags&St)>0),e.dom&&!(e.flags&re)&&Ra(e,t,!1),mi(e)}function fs(e,t,n){let i=e.child;for(;i;){if(i.flags&as){i.flags&St&&cu(i,t),mi(i),i=i.sibling;continue}i.dom?(fs(i,{node:i},!1),i.flags&re||Ra(i,t,n)):fs(i,t,(i.flags&St)>0||n),mi(i),i=i.sibling}}function Ra(e,t,n){(n||!e.dom.isConnected||e.flags&St)&&ou(e,t),(!e.prev||e.flags&ne)&&Da(e),t.lastChild=e.dom}function lu(e){e===e.parent?.child&&(e.parent.child=e.sibling),Ii(e,t=>{const{hooks:n,subs:i,cleanups:s,dom:o,props:{ref:r}}=t;for(i?.forEach(a=>a()),s&&Object.values(s).forEach(a=>a());n?.length;)n.pop().cleanup?.();o&&(r&&cs(r,null),o.isConnected&&!(t.flags&re)&&o.remove(),delete t.dom)}),e.parent=null}function cu(e,t){if(!e.child)return;const n=[];if(Na(e.child,n),n.length===0)return;const{node:i,lastChild:s}=t;if(s)s.after(...n);else{const o=La(e,i),r=i.dom;o?o.before(...n):r.append(...n)}t.lastChild=n[n.length-1]}function Na(e,t){let n=e;for(;n;)n.dom?t.push(n.dom):n.child&&Na(n.child,t),n=n.sibling}function uu(e){return typeof e=="function"&&typeof e[ka]?.arePropsEqual=="function"}function m(e,t=null,...n){if(e===kt)return kt({children:n,...t});const i={type:e,flags:0,index:0,depth:0,props:{},parent:null,sibling:null,child:null,prev:null,deletions:null};if(uu(e)&&(i.flags|=Ta,i.arePropsEqual=e[ka].arePropsEqual),t!==null){const{key:o,ref:r,...a}=t;Iu(o)&&(i.props.key=o.toString()),Lu(r)&&(i.props.ref=r),Object.assign(i.props,a)}const s=n.length===1?n[0]:n.length>1?n:null;return s!==null&&(i.props.children=s),i}function kt({children:e,key:t}){return m(Ue,t?{key:t}:null,e)}function qs(e,t){return Array.isArray(t)?fu(e,t):hu(e,t)}function hu(e,t){const n=e.child;if(n===null)return Ha(e,t);const i=n.sibling,s=za(e,n,t);if(s!==null)return n&&n!==s&&!s.prev?ds(e,n):i&&ds(e,i),s;{const o=Wa(n),r=Va(o,e,0,t);if(r!==null){const a=r.prev;if(a!==null){const l=a.props.key;o.delete(l===void 0?a.index:l)}hi(r,0,0)}return o.forEach(a=>pi(e,a)),r}}function fu(e,t){let n=null,i=null,s=e.child,o=null,r=0,a=0;for(;s!==null&&a<t.length;a++){s.index>a?(o=s,s=null):o=s.sibling;const c=za(e,s,t[a]);if(c===null){s===null&&(s=o);break}s&&!c.prev&&pi(e,s),r=hi(c,r,a),i===null?n=c:i.sibling=c,i=c,s=o}if(a===t.length)return ds(e,s),n;if(s===null){for(;a<t.length;a++){const c=Ha(e,t[a]);c!==null&&(r=hi(c,r,a),i===null?n=c:i.sibling=c,i=c)}return n}const l=Wa(s);for(;a<t.length;a++){const c=Va(l,e,a,t[a]);if(c!==null){const u=c.prev;if(u!==null){const f=u.props.key;l.delete(f===void 0?u.index:f)}r=hi(c,r,a),i===null?n=c:i.sibling=c,i=c}}return l.forEach(c=>pi(e,c)),n}function za(e,t,n){const i=t?.props.key;return Ks(n)?i!==void 0||t?.type==="#text"&&W.isSignal(t.props.nodeValue)?null:Vo(e,t,""+n):W.isSignal(n)?t&&t.props.nodeValue!==n?null:Vo(e,t,n):Gs(n)?n.props.key!==i?null:du(e,t,n):Array.isArray(n)?i!==void 0?null:Fa(e,t,n):null}function Vo(e,t,n){if(t===null||t.type!=="#text"){const s=m("#text",{nodeValue:n});return Nt(s,e),s}return t.props.nodeValue!==n&&(t.props.nodeValue=n,t.flags|=ne),t.sibling=null,t}function du(e,t,n){let{type:i,props:s}=n;if(i===Ue)return Fa(e,t,s.children||[],s);if(t?.type===i)return t.index=0,t.sibling=null,typeof i=="string"?Ba(t.props,s)&&(t.flags|=ne):t.flags|=ne,t.props=s,t.memoizedProps=n.memoizedProps,t;const o=m(i,s);return Nt(o,e),o}function Fa(e,t,n,i={}){if(t===null||t.type!==Ue){const s=m(Ue,{children:n,...i});return Nt(s,e),s}return t.props={...t.props,...i,children:n},t.flags|=ne,t.sibling=null,t}function Ha(e,t){if(Ks(t)){const n=m("#text",{nodeValue:""+t});return Nt(n,e),n}if(W.isSignal(t)){const n=m("#text",{nodeValue:t});return Nt(n,e),n}if(Gs(t)){const n=m(t.type,t.props);return Nt(n,e),n.flags|=St,n}if(Array.isArray(t)){const n=kt({children:t});return Nt(n,e),n}return null}function hi(e,t,n){e.index=n;const i=e.prev;if(i!==null){const s=i.index;return s<t?(e.flags|=St,t):s}else return e.flags|=St,t}function Va(e,t,n,i){if(W.isSignal(i)||Ks(i)){const o=e.get(n);if(o){if(o.props.nodeValue===i)return o;o.type==="#text"&&W.isSignal(o.props.nodeValue)&&o.cleanups?.nodeValue?.()}const r=m("#text",{nodeValue:i});return Nt(r,t),r.flags|=St,r.index=n,r}if(Gs(i)){const{type:o,props:r}=i,a=r.key,l=e.get(a===void 0?n:a);if(l?.type===o)return typeof o=="string"?Ba(l.props,r)&&(l.flags|=ne):l.flags|=ne,l.props=r,l.sibling=null,l.index=n,l;const c=m(i.type,i.props);return Nt(c,t),c.flags|=St,c.index=n,c}if(Array.isArray(i)){const o=e.get(n);if(o)return o.flags|=ne,o.props.children=i,o;const r=kt({children:i});return Nt(r,t),r.flags|=St,r.index=n,r}return null}function Ba(e,t){const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!0;for(let s of n)if(!(s==="children"||s==="key")&&e[s]!==t[s])return!0;return!1}function Nt(e,t){e.parent=t,e.depth=t.depth+1}function Wa(e){const t=new Map;for(;e;){const n=e.props.key;t.set(n===void 0?e.index:n,e),e=e.sibling}return t}function pi(e,t){e.deletions===null?e.deletions=[t]:e.deletions.push(t)}function ds(e,t){for(;t;)pi(e,t),t=t.sibling}let Yt=[],Ge=!1,ps=[],gs=[],ms=!1,bs=!1,ys=!1,xs=0,ja=[],vs=[],Ua=-1;function pu(e){if(Ge){ps.push(e);return}e()}function $a(){Ge&&(window.cancelAnimationFrame(Ua),Ya())}function Bo(e){e.flags|=$e,Yt.push(e),Ge=!0,$a()}function Di(e){if(Xt.current==="hydrate")return pu(()=>_s(e));_s(e)}function gu(){Ge||(Ge=!0,Ua=window.requestAnimationFrame(Ya))}function mu(){for(Ge=!1;ps.length;)ps.shift()()}function _s(e){if(ms&&(bs=!0),Ye.current===e){ys=!0;return}if(!(e.flags&($e|Pi))){if(e.flags|=$e,!Yt.length)return Yt.push(e),gu();Yt.push(e)}}function bu(e){Ii(e,t=>t.flags|=Pi),gs.push(e)}const yu=(e,t)=>t.depth-e.depth;let Jt=null;function Ya(){let e=1;for(Wc();Yt.length;){Yt.length>e&&Yt.sort(yu),Jt=Yt.shift(),e=Yt.length;const t=Jt.flags;if(!(t&Pi)&&t&$e){let n=Jt;for(;n=xu(n););for(;gs.length;)lu(gs.pop());au(Jt),Jt.flags&=~$e}}if(jc(),ms=!0,qi(ja),ms=!1,bs)return Su(),qi(vs),bs=!1,xs++,$a();xs=0,mu(),qi(vs)}function xu(e){let t=!0;try{typeof e.type=="string"?wu(e):Eu(e.type)?vu(e):t=_u(e)}catch(i){const s=Au(e);if(s){const o=s.error=i instanceof Error?i:new Error(String(i));return s.props.onError?.(o),s.depth<Jt.depth&&(Jt=s),s}if(Xe.isKiruError(i)){if(i.customNodeStack&&setTimeout(()=>{throw new Error(i.customNodeStack)}),i.fatal)throw i;console.error(i);return}setTimeout(()=>{throw i})}if(e.deletions!==null&&(e.deletions.forEach(bu),e.deletions=null),t&&e.child)return e.child;let n=e;for(;n;){if(n.immediateEffects&&(ja.push(...n.immediateEffects),n.immediateEffects=void 0),n.effects&&(vs.push(...n.effects),n.effects=void 0),n===Jt)return;if(n.sibling)return n.sibling;n=n.parent,Xt.current==="hydrate"&&n?.dom&&qe.pop()}}function vu(e){const{props:t,type:n}=e;let i=t.children;if(n===Oi){const{props:{dependents:s,value:o},prev:r}=e;s.size&&r&&r.props.value!==o&&s.forEach(_s)}else if(n===Ys){const s=e,{error:o}=s;o&&(i=typeof t.fallback=="function"?t.fallback(o):t.fallback,delete s.error)}e.child=qs(e,i)}function _u(e){const{type:t,props:n,subs:i,prev:s,flags:o}=e;if(o&Ta){if(e.memoizedProps=n,s?.memoizedProps&&e.arePropsEqual(s.memoizedProps,n)&&!e.hmrUpdated)return e.flags|=as,!1;e.flags&=~as}try{Ye.current=e;let r,a=0;do e.flags&=~$e,ys=!1,Ea.current=0,i&&(i.forEach(l=>l()),i.clear()),r=t(n);while(ys);return e.child=qs(e,r),!0}finally{Ye.current=null}}function wu(e){const{props:t,type:n}=e;e.dom||(Xt.current==="hydrate"?Zc(e):e.dom=Uc(e)),n!=="#text"&&(e.child=qs(e,t.children),e.child&&Xt.current==="hydrate"&&qe.push(e.dom))}function Su(){if(xs>Nc)throw new Xe("Maximum update depth exceeded. This can happen when a component repeatedly calls setState during render or in useLayoutEffect. Kiru limits the number of nested updates to prevent infinite loops.")}function qi(e){for(let t=0;t<e.length;t++)e[t]();e.length=0}var Wo;(function(e){e.Start="start",e.End="end"})(Wo||(Wo={}));const fe=()=>{const e=Xa("useRequestUpdate");return()=>Di(e)};function Ft(e,t,n){const i=Xa(e),s=(a,l)=>{if(l?.immediate){(i.immediateEffects??(i.immediateEffects=[])).push(a);return}(i.effects??(i.effects=[])).push(a)},o=Ea.current++;let r=i.hooks?.at(o);try{const a=r??(typeof t=="function"?t():{...t});return i.hooks??(i.hooks=[]),i.hooks[o]=a,n({hook:a,isInit:!r,update:()=>Di(i),queueEffect:s,vNode:i,index:o})}catch(a){throw a}}function Xa(e){const t=Ye.current;if(!t)throw new Xe(\`Hook "\${e}" must be used at the top level of a component or inside another composite hook.\`);return t}function Ai(e){e.cleanup&&(e.cleanup(),e.cleanup=void 0)}function nn(e,t){return e===void 0||t===void 0||e.length!==t.length||e.length>0&&t.some((n,i)=>!Object.is(n,e[i]))}const ws={stack:new Array,current:function(){return this.stack[this.stack.length-1]}},Ve=new Map;var qa;class W{constructor(t,n){this[qa]=!0,this.$id=Nu(),this.$value=t,n&&(this.displayName=n),this.$subs=new Set}get value(){return this.onBeforeRead?.(),W.entangle(this),this.$value}set value(t){Object.is(this.$value,t)||(this.$prevValue=this.$value,this.$value=t,this.notify())}peek(){return this.onBeforeRead?.(),this.$value}sneak(t){this.$prevValue=this.$value,this.$value=t}toString(){return this.onBeforeRead?.(),W.entangle(this),\`\${this.$value}\`}subscribe(t){return this.$subs.add(t),()=>this.$subs.delete(t)}notify(t){this.$subs.forEach(n=>{if(!(t?.filter&&!t.filter(n)))return n(this.$value,this.$prevValue)})}static isSignal(t){return typeof t=="object"&&!!t&&wa in t}static subscribers(t){return t.$subs}static makeReadonly(t){const n=Object.getOwnPropertyDescriptor(t,"value");return n&&!n.writable?t:Object.defineProperty(t,"value",{get:function(){return W.entangle(this),this.$value},configurable:!0})}static makeWritable(t){const n=Object.getOwnPropertyDescriptor(t,"value");return n&&n.writable?t:Object.defineProperty(t,"value",{get:function(){return W.entangle(this),this.$value},set:function(i){this.$value=i,this.notify()},configurable:!0})}static entangle(t){const n=Ye.current,i=ws.current();if(i){(!n||n&&Tt())&&i.set(t.$id,t);return}if(!n||!Tt())return;const s=t.subscribe(()=>Di(n));(n.subs??(n.subs=new Set)).add(s)}static configure(t,n){t.onBeforeRead=n}static dispose(t){t.$isDisposed=!0,t.$subs.clear()}}qa=wa;const ht=(e,t)=>new W(e,t),J=(e,t)=>Ft("useSignal",{signal:null},({hook:n,isInit:i,isHMR:s})=>(i&&(n.cleanup=()=>W.dispose(n.signal),n.signal=new W(e,t)),n.signal));function Ke(e,t=!1){return W.isSignal(e)?t?e.value:e.peek():e}const ku=()=>{Ve.forEach(e=>e()),Ve.clear()},gi={internalProps:["children","ref","key","innerHTML"],isEvent:e=>e.startsWith("on"),isProperty:e=>!gi.internalProps.includes(e)&&!gi.isEvent(e)};function Tu(e){switch(e){case"className":return"class";case"htmlFor":return"for";case"tabIndex":case"formAction":case"formMethod":case"formEncType":case"contentEditable":case"spellCheck":case"allowFullScreen":case"autoPlay":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"noModule":case"noValidate":case"popoverTarget":case"popoverTargetAction":case"playsInline":case"readOnly":case"itemscope":case"rowSpan":case"crossOrigin":return e.toLowerCase();default:return e.indexOf("-")>-1?e:e.startsWith("aria")?"aria-"+e.substring(4).toLowerCase():Hc.get(e)||e}}function Tt(){return Xt.current==="dom"||Xt.current==="hydrate"}function Mu(e){return(e.flags&Pi)!==0}function Gs(e){return typeof e=="object"&&e!==null&&"type"in e}function Ks(e){return typeof e=="string"&&e!==""||typeof e=="number"||typeof e=="bigint"}function Eu(e){return e===Ue||e===Oi||e===Ys}function Cu(e){return e.type===Ue}function Ou(e){return typeof e.type=="function"&&"displayName"in e.type&&e.type.displayName==="Kiru.lazy"}function Pu(e){return typeof e.type=="function"&&"displayName"in e.type&&e.type.displayName==="Kiru.memo"}function mi(e){const{props:{children:t,...n},memoizedProps:i,index:s}=e;e.prev={props:n,memoizedProps:i,index:s},e.flags&=-15}function Ii(e,t){t(e);let n=e.child;for(;n;)t(n),n.child&&Ii(n,t),n=n.sibling}function Du(e,t){let n=e.parent;for(;n;){if(t(n))return n;n=n.parent}return null}function Au(e){return Du(e,t=>t.type===Ys)}function Iu(e){return typeof e=="string"||typeof e=="number"}function Lu(e){return typeof e=="function"||typeof e=="object"&&!!e&&"current"in e||W.isSignal(e)}const Ru="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz-";function Nu(e=10,t=Ru){let n="";for(let i=0;i<e;i++)n+=t[Math.random()*t.length|0];return n}const jo=Object.freeze(()=>{});function zu(){const e=new Set,t=new Map;function n(r,a,l){t.get(r)?.forEach(c=>c(a,l))}function i(r,a){t.has(r)||t.set(r,new Set),t.get(r).add(a)}function s(r,a){t.get(r)?.delete(a)}const o={get apps(){return Array.from(e)},emit:n,on:i,off:s};return i("mount",r=>e.add(r)),i("unmount",r=>e.delete(r)),o}function Fu(e){const{id:t,subs:n,fn:i,deps:s=[],onDepChanged:o}=e;let r;Ve.delete(t);const a=!!Ye.current&&!Tt();a||(r=new Map,ws.stack.push(r));const l=i(...s.map(c=>c.value));if(!a){for(const[u,f]of n)r.has(u)||(f(),n.delete(u));const c=()=>{Ve.size||queueMicrotask(ku),Ve.set(t,o)};for(const[u,f]of r){if(n.has(u))continue;const p=f.subscribe(c);n.set(u,p)}ws.stack.pop()}return l}class He extends W{constructor(t,n){super(void 0,n),this.$getter=t,this.$unsubs=new Map,this.$isDirty=!0,W.configure(this,()=>{this.$isDirty&&He.run(this)})}get value(){return super.value}set value(t){}subscribe(t){return this.$isDirty&&He.run(this),super.subscribe(t)}static dispose(t){He.stop(t),W.dispose(t)}static stop(t){const{$id:n,$unsubs:i}=t;Ve.delete(n),i.forEach(s=>s()),i.clear(),t.$isDirty=!0}static run(t){const n=t,{$id:i,$getter:s,$unsubs:o}=n,r=Fu({id:i,subs:o,fn:()=>s(n.$value),onDepChanged:()=>{n.$isDirty=!0,t.$subs.size&&(He.run(n),!Object.is(n.$value,n.$prevValue)&&n.notify())}});n.sneak(r),n.$isDirty=!1}}const Ga=(e,t)=>new He(e,t);let Hu=0;function Vu(e,t,n){const i=m(t.nodeName.toLowerCase(),{});i.dom=t,i.flags|=re;const s=Hu++,o=\`App-\${s}\`,r={id:s,name:o,rootNode:i,render:a,unmount:l};function a(c){i.props.children=c,Bo(i)}function l(){i.props.children=null,Bo(i),window.__kiru.emit("unmount",r)}return a(e),window.__kiru.emit("mount",r),r}function de(e){return Tt()?Ft("useState",{state:void 0,dispatch:jo},({hook:t,isInit:n,update:i,isHMR:s})=>(n&&(t.state=typeof e=="function"?e():e,t.dispatch=o=>{const r=typeof o=="function"?o(t.state):o;Object.is(t.state,r)||(t.state=r,i())}),[t.state,t.dispatch])):[typeof e=="function"?e():e,jo]}function Bu(e){const t={[Rc]:!0,Provider:({value:n,children:i})=>{const[s]=de(()=>new Set);return m(Oi,{value:n,ctx:t,dependents:s},typeof i=="function"?i(n):i)},default:()=>e,set displayName(n){this.Provider.displayName=n},get displayName(){return this.Provider.displayName||"Anonymous Context"}};return t}function Be(e,t){return Tt()?Ft("useCallback",{callback:e,deps:t},({hook:n,isHMR:i})=>(nn(t,n.deps)&&(n.deps=t,n.callback=e),n.callback)):e}function Wu(e,t=!0){return Ft("useContext",{context:e,warnIfNotFound:t},ju)}const ju=({hook:e,isInit:t,vNode:n})=>{if(t){let i=n.parent;for(;i;){if(i.type===Oi){const s=i,{ctx:o,value:r,dependents:a}=s.props;if(o===e.context)return a.add(n),e.cleanup=()=>a.delete(n),e.provider=s,r}i=i.parent}}return e.provider?e.provider.props.value:e.context.default()};function ut(e,t){if(Tt())return Ft("useEffect",{deps:t},({hook:n,isInit:i,isHMR:s,queueEffect:o})=>{(i||nn(t,n.deps))&&(n.deps=t,Ai(n),o(()=>{const r=e();typeof r=="function"&&(n.cleanup=r)}))})}function Zs(e,t){if(Tt())return Ft("useLayoutEffect",{deps:t},({hook:n,isInit:i,isHMR:s,queueEffect:o})=>{(i||nn(t,n.deps))&&(n.deps=t,Ai(n),o(()=>{const r=e();typeof r=="function"&&(n.cleanup=r)},{immediate:!0}))})}function bi(e,t){return Tt()?Ft("useMemo",{deps:t,value:void 0},({hook:n,isInit:i,isHMR:s})=>((i||nn(t,n.deps))&&(n.deps=t,n.value=e()),n.value)):e()}function Ze(e){return Tt()?Ft("useRef",{ref:{current:e}},({hook:t,isInit:n,isHMR:i})=>t.ref):{current:e}}"window"in globalThis&&(window.__KIRU_LAZY_CACHE??(window.__KIRU_LAZY_CACHE=new Map));var Uo;"window"in globalThis&&!globalThis.__KIRU_DEVTOOLS__&&((Uo=globalThis.window).__kiru??(Uo.__kiru=zu()));function Ss(...e){return e.filter(Boolean).join(" ")}function Qs(e,t,n){let i=e;for(let s=0;s<t.length;s++){const o=t[s];s===t.length-1?i[o]=n:i=i[o]}}function Ka(e){return e.type.displayName??(e.type.name||"Anonymous Function")}const Uu=e=>e.__devtoolsFileLink??null;function Pn(e){return e.name==="kiru.devtools"}function Za(e){return Array.from(e.entries())}function $u(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e},m("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),m("path",{d:"M12 9v11"}),m("path",{d:"M2 9h13a2 2 0 0 1 2 2v9"}))}function ae(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1rem",height:"1rem",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m("path",{d:"m9 18 6-6-6-6"}))}function Yu(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),m("circle",{cx:"12",cy:"12",r:"3"}))}function Xu(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m("path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6"}),m("path",{d:"m21 3-9 9"}),m("path",{d:"M15 3h6v6"}))}function qu(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m("path",{d:"m12 14 4-4"}),m("path",{d:"M3.34 19a10 10 0 1 1 17.32 0"}))}function Gu(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m("circle",{cx:"12",cy:"12",r:"10"}),m("path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}),m("path",{d:"M2 12h20"}))}function Ku(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m("path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}),m("path",{d:"M21 3v5h-5"}),m("path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}),m("path",{d:"M8 16H3v5"}))}function Zu(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e},m("path",{d:"M22 8.35V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8.35A2 2 0 0 1 3.26 6.5l8-3.2a2 2 0 0 1 1.48 0l8 3.2A2 2 0 0 1 22 8.35Z"}),m("path",{d:"M6 18h12"}),m("path",{d:"M6 14h12"}),m("rect",{width:"12",height:"12",x:"6",y:"10"}))}function Qa(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}),m("path",{d:"M12 9v4"}),m("path",{d:"M12 17h.01"}))}function Ja({title:e,children:t,className:n,disabled:i,...s}){const[o,r]=de(!0);ut(()=>{!o&&i&&r(!0)},[i]);const a=Be(l=>{l.preventDefault(),l.stopImmediatePropagation(),r(c=>!c)},[]);return m("div",{className:"flex flex-col"},m("button",{onclick:a,disabled:i,className:\`\${i?"opacity-50 cursor-default":"cursor-pointer"}\`},m("span",{className:"flex items-center gap-2 font-medium"},m(ae,{className:\`transition \${o?"":"rotate-90"}\`}),e)),o?null:m("div",{className:\`p-2 \${n||""}\`,...s},t))}const Js={arrayChunkSize:10,objectKeysChunkSize:100};function tl(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;const n=new Set([...Object.keys(e),...Object.keys(t)]);for(const i in n)if(typeof t[i]!=typeof e[i]||typeof e[i]=="object"&&!tl(e[i],t[i]))return!1;return!0}function el(e,t,n){for(const i in t)typeof e[i]>"u"&&(e[i]=structuredClone(t[i]));for(const i in e)typeof e[i]=="object"?el(e[i],t[i],n):n(e,i,e[i])}let nl={...Js};const $o=localStorage.getItem("kiru.devtools.userSettings");if($o)try{const e=JSON.parse($o);tl(Js,e)&&(nl=e)}catch(e){console.error("kiru.devtools.userSettings error",e)}const il=Bu({userSettings:null,saveUserSettings:()=>{}}),Li=()=>Wu(il);function Qu({children:e}){const[t,n]=de(nl),i=s=>{localStorage.setItem("kiru.devtools.userSettings",JSON.stringify(s)),n(s)};return m(il.Provider,{value:{userSettings:t,saveUserSettings:i}},e)}function Ju(){const{userSettings:e,saveUserSettings:t}=Li();return m("div",{className:"rounded bg-neutral-400 bg-opacity-5 border border-white border-opacity-10 overflow-hidden"},m(Ae,{border:!1,data:e,onChange:(n,i)=>{const s={...e};Qs(s,n,i),el(s,Js,(o,r,a)=>{o[r]=a<1?1:a}),t(s)},mutable:!0,objectRefAcc:[]}))}const th=Object.freeze(()=>{});function Ae({data:e,onChange:t,mutable:n,objectRefAcc:i,keys:s=[],className:o,border:r=!0}){const{userSettings:{objectKeysChunkSize:a}}=Li(),[l,c]=de(0),u=bi(()=>Object.keys(e).slice(0,(l+1)*a),[l,a,e]),f=()=>{u.forEach(g=>{typeof e[g]=="object"&&i.splice(i.indexOf(e[g]),1)}),c(l+1)},p=u.length<Object.keys(e).length;return m(kt,null,m("div",{className:Ss("flex flex-col items-start w-full",r&&"border border-neutral-700",Ke(o))},u.map(g=>{const x=s.concat(g),y=x.join(".");return m("div",{key:y,"data-key":y,className:"flex flex-col items-start w-full gap-2 pl-2 py-1 pr-1 border-b border-neutral-700 last:border-b-0"},m(to,{value:e[g],onChange:t,keys:x,path:y,label:g,mutable:n,objectRefAcc:i}))})),p&&m("button",{onclick:f,title:"Show more",className:"p-1 border font-bold border-neutral-700 hover:bg-neutral-700"},m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1rem",height:"1rem",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},m("circle",{cx:"12",cy:"12",r:"1"}),m("circle",{cx:"19",cy:"12",r:"1"}),m("circle",{cx:"5",cy:"12",r:"1"}))))}function yi(e,t){Array.isArray(e)?(t(e),e.forEach(n=>yi(n,t))):typeof e=="object"&&e!==null&&(t(e),Object.values(e).forEach(n=>yi(n,t)))}function to({value:e,onChange:t,keys:n,path:i,mutable:s,objectRefAcc:o,label:r}){const{userSettings:{arrayChunkSize:a}}=Li(),[l,c]=de(!0),u=r!==void 0&&m("label",{htmlFor:i,className:"text-xs truncate",title:i,children:r});if(e===null)return m(mt,null,u,m(Zt,null,"null"));if(e===void 0)return m(mt,null,u,m(Zt,null,"undefined"));const f=window.opener?window.opener.Node:Node;if(e instanceof f)return m(mt,null,u,m(Zt,null,"<",m("span",{style:{color:"#f0a05e"}},e.nodeName),"/>"));const p=window.opener?window.opener.Error:Error;if(e instanceof p)return m(mt,null,u,"cause"in e&&e.cause?m(Zt,null,e.message," (",String(e.cause),")"):m(Zt,null,e.message));const g=x=>t(n,x);switch(typeof e){case"string":return m(mt,null,u,m(Gi,{disabled:!s,id:i,type:"text",value:e,onchange:x=>g(x.target.value)}));case"number":return m(mt,null,u,m(Gi,{disabled:!s,id:i,type:"number",value:e,placeholder:"NaN",onchange:x=>g(Number(x.target.value))}));case"bigint":return m(mt,null,u,m(Gi,{disabled:!s,id:i,type:"number",value:e.toString(),onchange:x=>g(BigInt(x.target.value))}));case"boolean":return m(mt,null,u,m("input",{disabled:!s,id:i,type:"checkbox",checked:e,onchange:x=>g(x.target.checked),className:"accent-red-500"}));case"function":return m(mt,null,u,m(Zt,null,\`\u0192 \${e.name||"anonymous"}()\`));default:return Array.isArray(e)?m(mt,null,m("button",{className:"text-xs flex items-center gap-1 cursor-pointer w-full",title:i,onclick:()=>{yi(e,x=>o.splice(o.indexOf(x),1)),c(x=>!x)}},r,m(ae,{width:10,height:10,className:\`transition \${l?"":"rotate-90"}\`})),l?m(Zt,null,"Array(",e.length,")"):e.length>a?m(eh,{array:e,objectRefAcc:o}):m("div",{className:"flex flex-col items-start gap-1 w-full"},e.map((x,y)=>m(to,{value:x,onChange:t,keys:[...n,y.toString()],path:i.concat(".",y.toString()),label:y.toString(),mutable:s,objectRefAcc:o})))):o.includes(e)?m(mt,null,u,m(Zt,null,"Object(circular reference)")):(o.push(e),m(mt,null,m("button",{className:"text-xs flex items-center gap-1 cursor-pointer w-full",title:i,onclick:()=>{yi(e,x=>o.splice(o.indexOf(x),1)),c(x=>!x)}},r,m(ae,{width:10,height:10,className:\`transition \${l?"":"rotate-90"}\`})),l?null:m(Ae,{data:e,onChange:t,keys:n,mutable:s,objectRefAcc:o})))}}function mt({children:e}){return m("div",{className:"flex flex-col items-start gap-1 w-full"},e)}function Gi(e){return m("input",{className:"flex-grow text-xs px-2 py-1 text-neutral-300 w-full",...e})}function Zt({children:e}){return m("small",{className:"text-neutral-300"},m("i",null,e))}function eh({array:e,objectRefAcc:t}){const{userSettings:{arrayChunkSize:n}}=Li(),i=e.length,s=Math.ceil(i/n);return m("div",{className:"flex flex-col items-start gap-1 w-full"},Array.from({length:s}).map((o,r)=>m(nh,{array:e,range:{start:r*n,end:(r+1)*n},objectRefAcc:t})))}function nh({array:e,range:t,objectRefAcc:n}){const[i,s]=de(!0);let o;return i?o=void 0:o=e.slice(t.start,t.end),m("div",{className:"flex flex-col items-start gap-1 w-full"},m("button",{className:"text-xs flex items-center gap-1 cursor-pointer w-full",onclick:()=>{n.splice(n.indexOf(e),1),s(r=>!r)}},"[",t.start,"..",(t.end<e.length?t.end:e.length)-1,"]",m(ae,{width:10,height:10,className:\`transition \${i?"":"rotate-90"}\`})),o&&m("div",{className:"flex flex-col items-start gap-1 w-full"},o.map((r,a)=>m(to,{value:r,onChange:th,label:(t.start+a).toString(),keys:[a.toString()],path:a.toString(),mutable:!1,objectRefAcc:n}))))}const ih="kiru-devtools";"window"in globalThis&&(window.__devtoolsSelection??=null);class sh extends BroadcastChannel{send(t){super.postMessage(t)}removeEventListener(t){return super.removeEventListener("message",t)}addEventListener(t){return super.addEventListener("message",t)}}const Qe=new sh(ih);function eo({fn:e,onclick:t}){const n=bi(()=>Uu(e),[e]);return n?m("a",{className:"flex items-center gap-1 text-[10px] opacity-50 hover:opacity-100 transition-opacity",href:n,onclick:i=>{i.preventDefault(),Qe.send({type:"open-editor",fileLink:n}),t?.(i)},title:"Open in editor"},"Open in editor",m(Xu,{width:"0.65rem",height:"0.65rem"})):null}function oh({selectedApp:e,selectedNode:t,setSelectedNode:n,kiruGlobal:i}){const s=fe();ut(()=>{const l=c=>{c===e&&(Mu(t)?n(null):s())};return i?.on("update",l),()=>i?.off("update",l)},[]);const o=()=>{t&&Di(t)},r={...t.props};delete r.children;const a=lh(t);return m("div",{className:"flex-grow p-2 sticky top-0"},m("h2",{className:"flex justify-between items-center font-bold mb-2 pb-2 border-b-2 border-neutral-800"},m("div",{className:"flex gap-2 items-center"},"<"+Ka(t)+">",m(eo,{fn:t.type})),m("button",{onclick:o},m(Ku,{className:"w-5 h-5"}))),m(Ja,{title:"props",disabled:Object.keys(r).length===0},m(Ae,{data:r,onChange:()=>{},mutable:!1,objectRefAcc:[]})),m(sl,{node:a,selectedApp:e}))}function rh(e){return e.name==="devtools:useHookDebugGroup"}function ah(e){return ks in e}const ks=Symbol.for("devtools.hookGroup");function lh(e){const t={parent:null,name:"hooks",children:[],[ks]:!0};if(e.hooks?.length){let n=t;for(let i=0;i<e.hooks.length;i++){const s=e.hooks[i];if(rh(s)){switch(s.action){case"start":const o={parent:n,name:s.displayName,children:[],[ks]:!0};n.children.push(o),n=o;break;case"end":if(n.name!==s.displayName||n.parent===null)throw new Error("useHookDebugGroup:end called with no start");n=n.parent;break}continue}n.children.push(s)}}return t}function sl({node:e,selectedApp:t,depth:n=0}){if(ah(e))return m(Ja,{title:e.name,className:"bg-[#ffffff04] border border-[#fff1] flex flex-col gap-2 pl-6",disabled:e.children.length===0},e.children.map(u=>m(sl,{node:u,selectedApp:t,depth:n+1})));const{name:i,dev:s,cleanup:o,...r}=e,a=s?.devtools,l=typeof a?.get=="function"?a.get():r;return m("div",null,m("i",{className:"text-neutral-300 text-sm"},i||"anonymous hook"),m("div",{className:"p-2"},m(Ae,{data:l,onChange:(u,f)=>{if(!t||!a?.set||!a?.get)return;const p=a.get();Qs(p,u,f),a.set(p)},mutable:!!a?.set,objectRefAcc:[]})))}const Ce=(e,t,n={})=>{ut(()=>{let i=window;const s=n?.ref?.();return s?i=s:n.ref&&console.warn("useEventListener ref failed, using window"),i.addEventListener(e,t,n),()=>{i.removeEventListener(e,t,n)}},[t])},ch=()=>{const e=J({x:0,y:0}),t=J({x:0,y:0}),n=J({x:0,y:0});return Ce("mousemove",i=>{e.value={x:i.x,y:i.y},t.value={x:i.movementX,y:i.movementY},n.value={x:i.clientX,y:i.clientY}}),{mouse:e,delta:t,client:n}},Xn="window"in globalThis&&"ResizeObserver"in globalThis.window,uh=(e,t,n=void 0)=>Tt()?Xn?Ft("useResizeObserver",{resizeObserver:null,deps:[e.current]},({isInit:i,hook:s,queueEffect:o})=>(i&&(s.resizeObserver=new ResizeObserver(t),s.cleanup=()=>{s.resizeObserver?.disconnect?.(),s.resizeObserver=null}),o(()=>{nn([e.current],s.deps)&&(s.deps=[e.current],s.resizeObserver?.disconnect?.(),e.current&&s.resizeObserver?.observe(e.current,n))}),{isSupported:Xn,start:()=>{s.resizeObserver==null&&(s.resizeObserver=new ResizeObserver(t),e.current&&s.resizeObserver.observe(e.current,n),s.cleanup=()=>{s.resizeObserver?.disconnect?.(),s.resizeObserver=null})},stop:()=>{Ai(s)}})):{isSupported:Xn,start:()=>{},stop:()=>{}}:{isSupported:Xn,start:()=>{},stop:()=>{}},qn="window"in globalThis&&"MutationObserver"in globalThis.window,hh=(e,t,n=void 0)=>Tt()?qn?Ft("useMutationObserver",{mutationObserver:null,deps:[e.current]},({isInit:i,hook:s,queueEffect:o})=>(i?(o(()=>{s.deps=[e.current],s.mutationObserver=new MutationObserver(t),e.current&&s.mutationObserver.observe(e.current,n)}),s.cleanup=()=>{s.mutationObserver?.disconnect?.(),s.mutationObserver=null}):nn([e.current],s.deps)&&(s.deps=[e.current],s.mutationObserver?.disconnect?.(),e.current&&s.mutationObserver?.observe(e.current,n)),{isSupported:qn,start:()=>{s.mutationObserver==null&&(s.mutationObserver=new MutationObserver(t),e.current&&s.mutationObserver.observe(e.current,n),s.cleanup=()=>{s.mutationObserver?.disconnect?.(),s.mutationObserver=null})},stop:()=>{Ai(s)}})):{isSupported:qn,start:()=>{},stop:()=>{}}:{isSupported:qn,start:()=>{},stop:()=>{}},fh=(e,t={windowScroll:!0,windowResize:!0})=>{const n=t?.windowScroll??!0,i=t?.windowResize??!0,s=t.immediate??!0,o=J(0),r=J(0),a=J(0),l=J(0),c=J(0),u=J(0),f=J(0),p=J(0),g=()=>{const x=e.current;if(!x){o.value=0,r.value=0,a.value=0,l.value=0,c.value=0,u.value=0,f.value=0,p.value=0;return}const y=x.getBoundingClientRect();o.value=y.width,r.value=y.height,a.value=y.top,l.value=y.right,c.value=y.bottom,u.value=y.left,f.value=y.x,p.value=y.y};return uh(e,g),hh(e,g,{attributeFilter:["style","class"]}),Ce("scroll",()=>{n&&g()},{capture:!0,passive:!0}),Ce("resize",()=>{i&&g()},{passive:!0}),Zs(()=>{s&&g()},[]),{width:o,height:r,top:a,right:l,bottom:c,left:u,x:f,y:p,update:g}};function dh(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}const Yo=(e,t,n={})=>{const{ref:i,eventName:s="keydown",passive:o=!1}=n,r=dh(e);return Ce(s,l=>{l.repeat&&!n.repeat||r(l)&&t(l)},{ref:i,passive:o})};function ol({value:e,className:t,...n}){return m("div",{className:Ss("w-full p-2 z-10","bg-[#1d1d1d] border border-white border-opacity-10 rounded",t?.toString()),...n},m("input",{className:Ss("px-2 py-1 w-full rounded focus:outline focus:outline-primary","bg-[#212121] border border-white border-opacity-10 rounded"),placeholder:"Filter...",type:"text","bind:value":e}))}let $;"window"in globalThis&&window.opener&&($=window.opener.__kiru);const We=ht(!1);Qe.addEventListener(e=>{e.data.type==="set-inspect-enabled"&&(We.value=e.data.value)});const rl=($?.apps??[]).filter(e=>!Pn(e)),ie=ht(rl);ht(null);const Lt=ht(rl[0]??null),se=ht(null);$?.on("mount",e=>{Pn(e)||(ie.value=[...ie.peek(),e],Lt.peek()===null&&(Lt.value=e))});$?.on("unmount",e=>{ie.value=ie.peek().filter(t=>t!==e),Lt.peek()===e&&(Lt.value=ie.peek()[0]??null)});const Ts=ht(new Map),Rt=ht(null),no=ht("");function ph(e){return e.type.displayName??(e.type.name||"Anonymous Function")}function gh(e,t){const n=t.toLowerCase();return e.every(i=>n.includes(i))}function Ms(e){return typeof e.type=="function"&&!Cu(e)&&!Ou(e)&&!Pu(e)}function mh(e){let t=[e];for(;t.length;){const n=t.pop();if(Ms(n))return!0;n.child&&t.push(n.child),n.sibling&&t.push(n.sibling)}return!1}const bh=(e,t)=>{const n=[t.parent];for(;n.length;){const i=n.pop();if(e===i)return!0;i?.parent&&n.push(i.parent)}return!1};function Es(e,t){if(!e)return null;const n=t(e),i=Es(e.sibling,t),s=Es(e.child,t);return n?{ref:e,sibling:i??null,child:s??null}:i||s||null}function xi({node:e,traverseSiblings:t=!0}){const[n,i]=de(!0),o=se.value===e,r=bi(()=>crypto.randomUUID(),[]),a=bi(()=>Rt.value==null?null:bh(e,Rt.value),[Rt.value,e]);ut(()=>{a&&i(!1)},[a]),ut(()=>{if(!(!e||!Ms(e)))return Ts.peek().set(r,{vNode:e,setCollapsed:i}),()=>{Ts.peek().delete(r)}});const l=no.value;if(!e)return null;if(!Ms(e)||l.length>0&&!gh(l.toLowerCase().split(" "),e.type.name))return m(kt,null,e.child&&m(xi,{node:e.child}),t&&m(Xo,{node:e}));const c=e.child&&mh(e.child);return m(kt,null,m("div",{className:"pl-4 mb-1"},m("h2",{onclick:()=>{Rt.value=null,se.value=o?null:e},className:\`flex gap-2 items-center cursor-pointer mb-1 scroll-m-12 \${o?"font-medium bg-primary selected-vnode":""}\`,"data-id":r},c&&m(ae,{className:\`cursor-pointer transition \${n?"":"rotate-90"}\`,onclick:u=>{u.preventDefault(),u.stopImmediatePropagation(),Rt.value=null,i(f=>!f)}}),m("div",{className:c?"":"ml-6"},m("span",{className:o?"":"text-neutral-400"},"<"),m("span",{className:o?"":"text-primary"},ph(e)),m("span",{className:o?"":"text-neutral-400"},">"))),!n&&e.child||a!=null&&a&&e.child?m(xi,{node:e.child}):null),t&&m(Xo,{node:e}))}function Xo({node:e}){if(!e)return null;let t=[],n=e.sibling;for(;n;)t.push(n),n=n.sibling;return m(kt,null,t.map(i=>m(xi,{node:i,traverseSiblings:!1})))}const yh=()=>{const e=Ze(null),t=r=>{if(!r)return null;const a=r.getAttribute("data-id");if(a!=null)return Ts.peek().get(a)},n=r=>{if(!r)return;const a=t(r);a!=null&&(r.scrollIntoView({behavior:"smooth"}),se.value=a.vNode)},i=r=>{if(!r||r===document.body)return null;const a=r.parentElement,l=a?.nextElementSibling?.querySelector("h2[data-id]");return l||i(a)},s=()=>{const r=document.querySelector("h2[data-id]");n(r)},o=()=>{const r=document.querySelectorAll("h2[data-id]"),a=r.item(r.length-1);a&&n(a)};return Yo(["ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],r=>{if(Rt.value&&(Rt.value=null),document.activeElement&&document.activeElement instanceof HTMLInputElement&&document.activeElement!=e.current)return;r.preventDefault();const a=document.querySelector(".selected-vnode");if(a===null){r.key==="ArrowDown"?s():r.key==="ArrowUp"&&o();return}if(r.key==="ArrowRight"){const l=t(a);l&&l.setCollapsed(!1);return}else if(r.key==="ArrowLeft"){const l=t(a);l&&l.setCollapsed(!0);return}if(r.key==="ArrowDown"){const l=a?.nextElementSibling?.querySelector("h2[data-id]");if(l)return n(l);const c=a.parentElement?.nextElementSibling?.querySelector("h2[data-id]");if(c)return n(c);const u=i(a);return u?n(u):s()}else if(r.key==="ArrowUp"){const l=a.parentElement?.previousElementSibling;if(l?.matches("h2[data-id]"))return n(l);const c=l?.querySelectorAll("h2[data-id]");return c?.length!=null&&c?.length>=1?n(c?.item?.(c.length-1)):o()}}),Yo("l",r=>{r.ctrlKey&&(r.preventDefault(),e.current?.focus({preventScroll:!1}))}),{searchRef:e}},xh=e=>{no.value=e.target.value,Rt.value&&(Rt.value=null)};function vh(){const{searchRef:e}=yh(),t=Lt.value;return m("div",{className:"flex-grow p-2 sticky top-0"},m("div",{className:"flex gap-4 pb-2 border-b-2 border-neutral-800 mb-2 items-center"},m("input",{ref:e,className:"bg-[#171616] px-1 py-2 w-full focus:outline focus:outline-primary",placeholder:"Search for component",type:"text",value:no,oninput:xh})),t?.rootNode&&m(xi,{node:t.rootNode}))}const _h=e=>{const{mouse:t}=ch(),n=J(null),i=J(0),s=J(0),o=Ze(null),r=fh(o),a=Ze(null),[l,c]=Array.isArray(e.children)?e.children:[];return Zs(()=>{a.current&&(s.value=a.current.clientWidth/2)},[a.current]),Ce("mouseup",Be(()=>n.value=null,[])),Ce("mousemove",Be(u=>{if(n.value==null||a.current==null)return;const f=Math.max(i.value+u.x-n.value.x,250);s.value=Math.min(f,a.current.clientWidth-250)},[])),Ce("resize",Be(()=>{a.current!=null&&a.current.clientWidth-250<s.value&&(s.value=Math.max(a.current.clientWidth-250,250))},[])),m("div",{onmousemove:u=>{u.x},ref:a,className:"flex-grow grid gap-2 items-start w-full relative",style:{gridTemplateColumns:\`\${s}px 1fr\`}},m("div",{ref:o,className:"firstContainer w-full h-full"},l),r.width.value!=0&&m("div",{className:"w-8 flex justify-center h-full absolute top-0 -translate-x-1/2 cursor-col-resize z-[9999]",style:{left:\`\${r.width}px\`},onmousedown:u=>{u.preventDefault(),n.value={...t.value},i.value=s.value}},m("div",{className:"dividerLine w-[5px] bg-neutral-800 h-full"})),m("div",{className:"secondContainer h-full"},c))},wh=()=>m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-square-mouse-pointer"},m("path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z"}),m("path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"})),Sh=()=>{We.value=!We.value,Qe.send({type:"set-inspect-enabled",value:We.value})};function kh(){const e=Lt.value,t=se.value,n=fe();return ut(()=>{const i=s=>{s===e&&n()};return $?.on("update",i),()=>$?.off("update",i)},[Lt]),ut(()=>{const i=s=>{if(s.data.type!=="select-node")return;if(!window.__devtoolsSelection){console.error("no selection ptr");return}const{app:o,node:r}=window.__devtoolsSelection;window.__devtoolsSelection=null,Lt.value=o,se.value=r,Rt.value=r,We.value=!1};return Qe.addEventListener(i),()=>Qe.removeEventListener(i)},[Lt]),m(kt,null,m("div",{className:"flex items-center justify-between gap-4 p-2 bg-neutral-400 bg-opacity-5 border border-white border-opacity-10 rounded"},m("div",{className:"flex items-center gap-4"},m("select",{className:"px-2 py-1 bg-neutral-800 text-neutral-100 rounded border border-white border-opacity-10",value:e?.name??"",onchange:i=>Lt.value=ie.peek().find(s=>s.name===i.currentTarget.value)??null},m("option",{value:"",disabled:!0},"Select App"),ie.value.map(i=>m("option",{key:i.id,value:i.name},i.name))),m("button",{title:"Toggle Component Inspection",onclick:Sh,className:\`p-1 rounded \${We.value?"bg-neutral-900":""}\`},m(wh,null)))),m(_h,null,e&&m(vh,null),t&&e&&m(oh,{selectedApp:e,selectedNode:t,setSelectedNode:i=>se.value=i,kiruGlobal:$})))}const Cs=ht({}),ke=ht([]);$?.stores?.subscribe(e=>{Cs.value=e,ke.value=ke.value.filter(t=>Object.values(Cs.value).includes(t))});const al=ht(""),Th=Ga(()=>al.value.toLowerCase().split(" ").filter(e=>e.length>0));function Mh(e){return Th.value.every(t=>e.toLowerCase().includes(t))}function Eh(){const e=Object.entries(Cs.value);return e.length===0?m("div",{className:"flex flex-col items-center justify-center h-full text-neutral-400"},m(Qa,null),m("h2",{className:"text-lg italic"},"No stores detected")):m("div",{className:"flex flex-col gap-2 items-start"},m(ol,{value:al,className:"sticky top-0"}),m("div",{className:"flex flex-col gap-2 w-full"},e.filter(([t])=>Mh(t)).map(([t,n])=>m(Ch,{key:t,name:t,store:n}))))}function Ch({name:e,store:t}){const n=ke.value.includes(t),i=fe(),{value:s}=ll(t);Zs(()=>{const r=t.subscribe(()=>i());return()=>r()},[]);const o=Be(()=>{n?ke.value=ke.value.filter(r=>r!==t):ke.value=[...ke.value,t]},[n]);return m("div",{className:"flex flex-col"},m("button",{onclick:o,className:"flex items-center gap-2 justify-between p-2 border border-white border-opacity-10 cursor-pointer"+(n?" bg-white bg-opacity-5 text-neutral-100 rounded-t":" hover:bg-white hover:bg-opacity-10 text-neutral-400 rounded")},e,m("div",{className:"flex gap-2"},m(eo,{fn:t,onclick:r=>r.stopPropagation()}),m(ae,{className:"transition-all"+(n?" rotate-90":"")}))),n&&m("div",{className:"flex flex-col gap-2 p-2 border border-white border-opacity-10"},m(Ae,{data:{value:s},mutable:!0,objectRefAcc:[],onChange:(r,a)=>{const l=structuredClone({value:s});Qs(l,r,a),t.setState(l.value)}}),m(Oh,{store:t})))}function Oh({store:e}){const t=ie.value;return t.length===0?null:m(kt,null,t.map(n=>m(Ph,{store:e,app:n})))}const qo=Symbol.for("kiru.hmrAccept"),ll=e=>{if(qo in e)return e[qo].provide().current;throw new Error("Unable to get store subscribers")};function Ph({store:e,app:t}){const n=fe(),{subscribers:i,nodeStateMap:s}=ll(e),o=t.rootNode.child;if(ut(()=>{const a=l=>{l===t&&n()};return $?.on("update",a),()=>$?.off("update",a)},[]),!o)return null;const r=Es(o,a=>i.has(a));return m("div",{className:"flex flex-col gap-2 p-2 rounded-b border border-white border-opacity-10"},m("b",null,t.name),r&&m("ul",{className:"pl-8"},m(Os,{node:r,nodeStateMap:s})))}function Os({node:e,nodeStateMap:t}){const[n,i]=de(!1),o=t.get(e.ref)?.slices??[];return m(kt,null,m("li",{className:"flex flex-col gap-2"},m("div",{className:"flex flex-col border border-white border-opacity-10 rounded"+(n?" bg-white bg-opacity-5 text-neutral-100":" hover:bg-white hover:bg-opacity-10 text-neutral-400")},m("button",{onclick:()=>i(!n),className:"flex gap-2 p-2 justify-between cursor-pointer"},m("span",null,"<"+Ka(e.ref)+" />"),m("div",{className:"flex gap-2 items-center"},m(eo,{fn:e.ref.type,onclick:r=>r.stopPropagation()}),m(ae,{className:"transition-all"+(n?" rotate-90":"")}))),n&&m("div",{className:"flex flex-col gap-2 p-2 bg-[#1a1a1a]"},o.length===0&&m("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},m("h5",{className:"border-b border-white border-opacity-10"},"No slices")),o.map(r=>m("div",{className:"flex flex-col gap-2"},m("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},m("h5",{className:"border-b border-white border-opacity-10"},"Slice:"),m("pre",{className:"text-neutral-400"},m(Ae,{data:{value:r.value},mutable:!1,objectRefAcc:[],onChange:()=>{}}))),m("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},m("h5",{className:"border-b border-white border-opacity-10"},"SliceFn:"),m("pre",{className:"text-neutral-400"},r.sliceFn?r.sliceFn.toString():"null")),r.eq&&m("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},m("h5",{className:"border-b border-white border-opacity-10"},"eq:"),m("pre",{className:"text-neutral-400"},r.eq.toString())))))),e.child&&m("ul",{className:"pl-8 flex flex-col gap-2"},m(Os,{node:e.child,nodeStateMap:t}))),e.sibling&&m(Os,{node:e.sibling,nodeStateMap:t}))}/*!
|
|
2398
2411
|
* @kurkle/color v0.3.4
|
|
2399
2412
|
* https://github.com/kurkle/color#readme
|
|
2400
2413
|
* (c) 2024 Jukka Kurkela
|
|
2401
2414
|
* Released under the MIT License
|
|
2402
|
-
*/function Nn(e){return e+.5|0}const te=(e,t,n)=>Math.max(Math.min(e,n),t);function vn(e){return te(Nn(e*2.55),0,255)}function oe(e){return te(Nn(e*255),0,255)}function $t(e){return te(Nn(e/2.55)/100,0,1)}function Go(e){return te(Nn(e*100),0,100)}const bt={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},Ps=[..."0123456789ABCDEF"],Dh=e=>Ps[e&15],Ah=e=>Ps[(e&240)>>4]+Ps[e&15],Gn=e=>(e&240)>>4===(e&15),Ih=e=>Gn(e.r)&&Gn(e.g)&&Gn(e.b)&&Gn(e.a);function Lh(e){var t=e.length,n;return e[0]==="#"&&(t===4||t===5?n={r:255&bt[e[1]]*17,g:255&bt[e[2]]*17,b:255&bt[e[3]]*17,a:t===5?bt[e[4]]*17:255}:(t===7||t===9)&&(n={r:bt[e[1]]<<4|bt[e[2]],g:bt[e[3]]<<4|bt[e[4]],b:bt[e[5]]<<4|bt[e[6]],a:t===9?bt[e[7]]<<4|bt[e[8]]:255})),n}const Rh=(e,t)=>e<255?t(e):"";function Nh(e){var t=Ih(e)?Dh:Ah;return e?"#"+t(e.r)+t(e.g)+t(e.b)+Rh(e.a,t):void 0}const zh=/^(hsla?|hwb|hsv)\\(\\s*([-+.e\\d]+)(?:deg)?[\\s,]+([-+.e\\d]+)%[\\s,]+([-+.e\\d]+)%(?:[\\s,]+([-+.e\\d]+)(%)?)?\\s*\\)$/;function cl(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 Fh(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 Hh(e,t,n){const i=cl(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
|
|
2415
|
+
*/function Nn(e){return e+.5|0}const te=(e,t,n)=>Math.max(Math.min(e,n),t);function vn(e){return te(Nn(e*2.55),0,255)}function oe(e){return te(Nn(e*255),0,255)}function $t(e){return te(Nn(e/2.55)/100,0,1)}function Go(e){return te(Nn(e*100),0,100)}const bt={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},Ps=[..."0123456789ABCDEF"],Dh=e=>Ps[e&15],Ah=e=>Ps[(e&240)>>4]+Ps[e&15],Gn=e=>(e&240)>>4===(e&15),Ih=e=>Gn(e.r)&&Gn(e.g)&&Gn(e.b)&&Gn(e.a);function Lh(e){var t=e.length,n;return e[0]==="#"&&(t===4||t===5?n={r:255&bt[e[1]]*17,g:255&bt[e[2]]*17,b:255&bt[e[3]]*17,a:t===5?bt[e[4]]*17:255}:(t===7||t===9)&&(n={r:bt[e[1]]<<4|bt[e[2]],g:bt[e[3]]<<4|bt[e[4]],b:bt[e[5]]<<4|bt[e[6]],a:t===9?bt[e[7]]<<4|bt[e[8]]:255})),n}const Rh=(e,t)=>e<255?t(e):"";function Nh(e){var t=Ih(e)?Dh:Ah;return e?"#"+t(e.r)+t(e.g)+t(e.b)+Rh(e.a,t):void 0}const zh=/^(hsla?|hwb|hsv)\\(\\s*([-+.e\\d]+)(?:deg)?[\\s,]+([-+.e\\d]+)%[\\s,]+([-+.e\\d]+)%(?:[\\s,]+([-+.e\\d]+)(%)?)?\\s*\\)$/;function cl(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 Fh(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 Hh(e,t,n){const i=cl(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 Vh(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 io(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 l,c,u;return o!==r&&(u=o-r,c=a>.5?u/(2-o-r):u/(o+r),l=Vh(n,i,s,u,o),l=l*60+.5),[l|0,c||0,a]}function so(e,t,n,i){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,n,i)).map(oe)}function oo(e,t,n){return so(cl,e,t,n)}function Bh(e,t,n){return so(Hh,e,t,n)}function Wh(e,t,n){return so(Fh,e,t,n)}function ul(e){return(e%360+360)%360}function jh(e){const t=zh.exec(e);let n=255,i;if(!t)return;t[5]!==i&&(n=t[6]?vn(+t[5]):oe(+t[5]));const s=ul(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?i=Bh(s,o,r):t[1]==="hsv"?i=Wh(s,o,r):i=oo(s,o,r),{r:i[0],g:i[1],b:i[2],a:n}}function Uh(e,t){var n=io(e);n[0]=ul(n[0]+t),n=oo(n),e.r=n[0],e.g=n[1],e.b=n[2]}function $h(e){if(!e)return;const t=io(e),n=t[0],i=Go(t[1]),s=Go(t[2]);return e.a<255?\`hsla(\${n}, \${i}%, \${s}%, \${$t(e.a)})\`:\`hsl(\${n}, \${i}%, \${s}%)\`}const Ko={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"},Zo={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 Yh(){const e={},t=Object.keys(Zo),n=Object.keys(Ko);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,Ko[o]);o=parseInt(Zo[r],16),e[a]=[o>>16&255,o>>8&255,o&255]}return e}let Kn;function Xh(e){Kn||(Kn=Yh(),Kn.transparent=[0,0,0,0]);const t=Kn[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const qh=/^rgba?\\(\\s*([-+.\\d]+)(%)?[\\s,]+([-+.e\\d]+)(%)?[\\s,]+([-+.e\\d]+)(%)?(?:[\\s,/]+([-+.e\\d]+)(%)?)?\\s*\\)$/;function Gh(e){const t=qh.exec(e);let n=255,i,s,o;if(t){if(t[7]!==i){const r=+t[7];n=t[8]?vn(r):te(r*255,0,255)}return i=+t[1],s=+t[3],o=+t[5],i=255&(t[2]?vn(i):te(i,0,255)),s=255&(t[4]?vn(s):te(s,0,255)),o=255&(t[6]?vn(o):te(o,0,255)),{r:i,g:s,b:o,a:n}}}function Kh(e){return e&&(e.a<255?\`rgba(\${e.r}, \${e.g}, \${e.b}, \${$t(e.a)})\`:\`rgb(\${e.r}, \${e.g}, \${e.b})\`)}const Ki=e=>e<=.0031308?e*12.92:Math.pow(e,1/2.4)*1.055-.055,Fe=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);function Zh(e,t,n){const i=Fe($t(e.r)),s=Fe($t(e.g)),o=Fe($t(e.b));return{r:oe(Ki(i+n*(Fe($t(t.r))-i))),g:oe(Ki(s+n*(Fe($t(t.g))-s))),b:oe(Ki(o+n*(Fe($t(t.b))-o))),a:e.a+n*(t.a-e.a)}}function Zn(e,t,n){if(e){let i=io(e);i[t]=Math.max(0,Math.min(i[t]+i[t]*n,t===0?360:1)),i=oo(i),e.r=i[0],e.g=i[1],e.b=i[2]}}function hl(e,t){return e&&Object.assign(t||{},e)}function Qo(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=oe(e[3]))):(t=hl(e,{r:0,g:0,b:0,a:1}),t.a=oe(t.a)),t}function Qh(e){return e.charAt(0)==="r"?Gh(e):jh(e)}class Dn{constructor(t){if(t instanceof Dn)return t;const n=typeof t;let i;n==="object"?i=Qo(t):n==="string"&&(i=Lh(t)||Xh(t)||Qh(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=hl(this._rgb);return t&&(t.a=$t(t.a)),t}set rgb(t){this._rgb=Qo(t)}rgbString(){return this._valid?Kh(this._rgb):void 0}hexString(){return this._valid?Nh(this._rgb):void 0}hslString(){return this._valid?$h(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,l=i.a-s.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-c,i.r=255&c*i.r+o*s.r+.5,i.g=255&c*i.g+o*s.g+.5,i.b=255&c*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=Zh(this._rgb,t._rgb,n)),this}clone(){return new Dn(this.rgb)}alpha(t){return this._rgb.a=oe(t),this}clearer(t){const n=this._rgb;return n.a*=1-t,this}greyscale(){const t=this._rgb,n=Nn(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 Zn(this._rgb,2,t),this}darken(t){return Zn(this._rgb,2,-t),this}saturate(t){return Zn(this._rgb,1,t),this}desaturate(t){return Zn(this._rgb,1,-t),this}rotate(t){return Uh(this._rgb,t),this}}/*!
|
|
2403
2416
|
* Chart.js v4.5.0
|
|
2404
2417
|
* https://www.chartjs.org
|
|
2405
2418
|
* (c) 2025 Chart.js Contributors
|
|
2406
2419
|
* Released under the MIT License
|
|
2407
|
-
*/function Wt(){}const Jh=(()=>{let e=0;return()=>e++})();function V(e){return e==null}function Q(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 B(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function xt(e){return(typeof e=="number"||e instanceof Number)&&isFinite(+e)}function Pt(e,t){return xt(e)?e:t}function R(e,t){return typeof e>"u"?t:e}const tf=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100*t:+e;function I(e,t,n){if(e&&typeof e.call=="function")return e.apply(n,t)}function z(e,t,n,i){let s,o,r;if(Q(e))for(o=e.length,s=0;s<o;s++)t.call(n,e[s],s);else if(B(e))for(r=Object.keys(e),o=r.length,s=0;s<o;s++)t.call(n,e[r[s]],r[s])}function vi(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 _i(e){if(Q(e))return e.map(_i);if(B(e)){const t=Object.create(null),n=Object.keys(e),i=n.length;let s=0;for(;s<i;++s)t[n[s]]=_i(e[n[s]]);return t}return e}function fl(e){return["__proto__","prototype","constructor"].indexOf(e)===-1}function ef(e,t,n,i){if(!fl(e))return;const s=t[e],o=n[e];B(s)&&B(o)?An(s,o,i):t[e]=_i(o)}function An(e,t,n){const i=Q(t)?t:[t],s=i.length;if(!B(e))return e;n=n||{};const o=n.merger||ef;let r;for(let a=0;a<s;++a){if(r=i[a],!B(r))continue;const l=Object.keys(r);for(let c=0,u=l.length;c<u;++c)o(l[c],e,r,n)}return e}function kn(e,t){return An(e,t,{merger:nf})}function nf(e,t,n){if(!fl(e))return;const i=t[e],s=n[e];B(i)&&B(s)?kn(i,s):Object.prototype.hasOwnProperty.call(t,e)||(t[e]=_i(s))}const Jo={"":e=>e,x:e=>e.x,y:e=>e.y};function sf(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 of(e){const t=sf(e);return n=>{for(const i of t){if(i==="")break;n=n&&n[i]}return n}}function wi(e,t){return(Jo[t]||(Jo[t]=of(t)))(e)}function ro(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Si=e=>typeof e<"u",le=e=>typeof e=="function",tr=(e,t)=>{if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0};function rf(e){return e.type==="mouseup"||e.type==="click"||e.type==="contextmenu"}const tt=Math.PI,zt=2*tt,af=zt+tt,ki=Number.POSITIVE_INFINITY,lf=tt/180,wt=tt/2,ve=tt/4,er=tt*2/3,dl=Math.log10,ce=Math.sign;function Oe(e,t,n){return Math.abs(e-t)<n}function nr(e){const t=Math.round(e);e=Oe(e,t,e/1e3)?t:e;const n=Math.pow(10,Math.floor(dl(e))),i=e/n;return(i<=1?1:i<=2?2:i<=5?5:10)*n}function cf(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 uf(e){return typeof e=="symbol"||typeof e=="object"&&e!==null&&!(Symbol.toPrimitive in e||"toString"in e||"valueOf"in e)}function In(e){return!uf(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function hf(e,t){const n=Math.round(e);return n-t<=e&&n+t>=e}function ff(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 Me(e){return e*(tt/180)}function df(e){return e*(180/tt)}function ir(e){if(!xt(e))return;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n++;return n}function pf(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*tt&&(o+=zt),{angle:o,distance:s}}function Ds(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function gf(e,t){return(e-t+af)%zt-tt}function Qt(e){return(e%zt+zt)%zt}function pl(e,t,n,i){const s=Qt(e),o=Qt(t),r=Qt(n),a=Qt(o-s),l=Qt(r-s),c=Qt(s-o),u=Qt(s-r);return s===o||s===r||i&&o===r||a>l&&c<u}function yt(e,t,n){return Math.max(t,Math.min(n,e))}function mf(e){return yt(e,-32768,32767)}function _n(e,t,n,i=1e-6){return e>=Math.min(t,n)-i&&e<=Math.max(t,n)+i}function ao(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 Ee=(e,t,n,i)=>ao(e,n,i?s=>{const o=e[s][t];return o<n||o===n&&e[s+1][t]===n}:s=>e[s][t]<n),bf=(e,t,n)=>ao(e,n,i=>e[i][t]>=n);function yf(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 gl=["push","pop","shift","splice","unshift"];function xf(e,t){if(e._chartjs){e._chartjs.listeners.push(t);return}Object.defineProperty(e,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),gl.forEach(n=>{const i="_onData"+ro(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 sr(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)&&(gl.forEach(o=>{delete e[o]}),delete e._chartjs)}function vf(e){const t=new Set(e);return t.size===e.length?e:Array.from(t)}const ml=(function(){return typeof window>"u"?function(e){return e()}:window.requestAnimationFrame})();function bl(e,t){let n=[],i=!1;return function(...s){n=s,i||(i=!0,ml.call(window,()=>{i=!1,e.apply(t,n)}))}}function _f(e,t){let n;return function(...i){return t?(clearTimeout(n),n=setTimeout(e,t,i)):e.apply(this,i),t}}const yl=e=>e==="start"?"left":e==="end"?"right":"center",ft=(e,t,n)=>e==="start"?t:e==="end"?n:(t+n)/2,wf=(e,t,n,i)=>e===(i?"left":"right")?n:e==="center"?(t+n)/2:t;function Sf(e,t,n){const i=t.length;let s=0,o=i;if(e._sorted){const{iScale:r,vScale:a,_parsed:l}=e,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null,u=r.axis,{min:f,max:p,minDefined:g,maxDefined:x}=r.getUserBounds();if(g){if(s=Math.min(Ee(l,u,f).lo,n?i:Ee(t,u,r.getPixelForValue(f)).lo),c){const y=l.slice(0,s+1).reverse().findIndex(v=>!V(v[a.axis]));s-=Math.max(0,y)}s=yt(s,0,i-1)}if(x){let y=Math.max(Ee(l,r.axis,p,!0).hi+1,n?0:Ee(t,u,r.getPixelForValue(p),!0).hi+1);if(c){const v=l.slice(y-1).findIndex(w=>!V(w[a.axis]));y+=Math.max(0,v)}o=yt(y,s,i)-s}else o=i-s}return{start:s,count:o}}function kf(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 Qn=e=>e===0||e===1,or=(e,t,n)=>-(Math.pow(2,10*(e-=1))*Math.sin((e-t)*zt/n)),rr=(e,t,n)=>Math.pow(2,-10*e)*Math.sin((e-t)*zt/n)+1,Tn={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*wt)+1,easeOutSine:e=>Math.sin(e*wt),easeInOutSine:e=>-.5*(Math.cos(tt*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=>Qn(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=>Qn(e)?e:or(e,.075,.3),easeOutElastic:e=>Qn(e)?e:rr(e,.075,.3),easeInOutElastic(e){return Qn(e)?e:e<.5?.5*or(e*2,.1125,.45):.5+.5*rr(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-Tn.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?Tn.easeInBounce(e*2)*.5:Tn.easeOutBounce(e*2-1)*.5+.5};function lo(e){if(e&&typeof e=="object"){const t=e.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function ar(e){return lo(e)?e:new Dn(e)}function Zi(e){return lo(e)?e:new Dn(e).saturate(.5).darken(.1).hexString()}const Tf=["x","y","borderWidth","radius","tension"],Mf=["color","borderColor","backgroundColor"];function Ef(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:Mf},numbers:{type:"number",properties:Tf}}),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 Cf(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const lr=new Map;function Of(e,t){t=t||{};const n=e+JSON.stringify(t);let i=lr.get(n);return i||(i=new Intl.NumberFormat(e,t),lr.set(n,i)),i}function xl(e,t,n){return Of(t,n).format(e)}const Pf={values(e){return Q(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 c=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),o=Df(e,n)}const r=dl(Math.abs(o)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),xl(e,i,l)}};function Df(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 vl={formatters:Pf};function Af(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:vl.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 Ae=Object.create(null),As=Object.create(null);function Mn(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 Qi(e,t,n){return typeof t=="string"?An(Mn(e,t),n):An(Mn(e,""),t)}class If{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)=>Zi(s.backgroundColor),this.hoverBorderColor=(i,s)=>Zi(s.borderColor),this.hoverColor=(i,s)=>Zi(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 Qi(this,t,n)}get(t){return Mn(this,t)}describe(t,n){return Qi(As,t,n)}override(t,n){return Qi(Ae,t,n)}route(t,n,i,s){const o=Mn(this,t),r=Mn(this,i),a="_"+n;Object.defineProperties(o,{[a]:{value:o[n],writable:!0},[n]:{enumerable:!0,get(){const l=this[a],c=r[s];return B(l)?Object.assign({},c,l):R(l,c)},set(l){this[a]=l}}})}apply(t){t.forEach(n=>n(this))}}var Y=new If({_scriptable:e=>!e.startsWith("on"),_indexable:e=>e!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Ef,Cf,Af]);function Lf(e){return!e||V(e.size)||V(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}function cr(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 _e(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 ur(e,t){!t&&!e||(t=t||e.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function Is(e,t,n,i){_l(e,t,n,i,null)}function _l(e,t,n,i,s){let o,r,a,l,c,u,f,p;const g=t.pointStyle,x=t.rotation,y=t.radius;let v=(x||0)*lf;if(g&&typeof g=="object"&&(o=g.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){e.save(),e.translate(n,i),e.rotate(v),e.drawImage(g,-g.width/2,-g.height/2,g.width,g.height),e.restore();return}if(!(isNaN(y)||y<=0)){switch(e.beginPath(),g){default:s?e.ellipse(n,i,s/2,y,0,0,zt):e.arc(n,i,y,0,zt),e.closePath();break;case"triangle":u=s?s/2:y,e.moveTo(n+Math.sin(v)*u,i-Math.cos(v)*y),v+=er,e.lineTo(n+Math.sin(v)*u,i-Math.cos(v)*y),v+=er,e.lineTo(n+Math.sin(v)*u,i-Math.cos(v)*y),e.closePath();break;case"rectRounded":c=y*.516,l=y-c,r=Math.cos(v+ve)*l,f=Math.cos(v+ve)*(s?s/2-c:l),a=Math.sin(v+ve)*l,p=Math.sin(v+ve)*(s?s/2-c:l),e.arc(n-f,i-a,c,v-tt,v-wt),e.arc(n+p,i-r,c,v-wt,v),e.arc(n+f,i+a,c,v,v+wt),e.arc(n-p,i+r,c,v+wt,v+tt),e.closePath();break;case"rect":if(!x){l=Math.SQRT1_2*y,u=s?s/2:l,e.rect(n-u,i-l,2*u,2*l);break}v+=ve;case"rectRot":f=Math.cos(v)*(s?s/2:y),r=Math.cos(v)*y,a=Math.sin(v)*y,p=Math.sin(v)*(s?s/2:y),e.moveTo(n-f,i-a),e.lineTo(n+p,i-r),e.lineTo(n+f,i+a),e.lineTo(n-p,i+r),e.closePath();break;case"crossRot":v+=ve;case"cross":f=Math.cos(v)*(s?s/2:y),r=Math.cos(v)*y,a=Math.sin(v)*y,p=Math.sin(v)*(s?s/2:y),e.moveTo(n-f,i-a),e.lineTo(n+f,i+a),e.moveTo(n+p,i-r),e.lineTo(n-p,i+r);break;case"star":f=Math.cos(v)*(s?s/2:y),r=Math.cos(v)*y,a=Math.sin(v)*y,p=Math.sin(v)*(s?s/2:y),e.moveTo(n-f,i-a),e.lineTo(n+f,i+a),e.moveTo(n+p,i-r),e.lineTo(n-p,i+r),v+=ve,f=Math.cos(v)*(s?s/2:y),r=Math.cos(v)*y,a=Math.sin(v)*y,p=Math.sin(v)*(s?s/2:y),e.moveTo(n-f,i-a),e.lineTo(n+f,i+a),e.moveTo(n+p,i-r),e.lineTo(n-p,i+r);break;case"line":r=s?s/2:Math.cos(v)*y,a=Math.sin(v)*y,e.moveTo(n-r,i-a),e.lineTo(n+r,i+a);break;case"dash":e.moveTo(n,i),e.lineTo(n+Math.cos(v)*(s?s/2:y),i+Math.sin(v)*y);break;case!1:e.closePath();break}e.fill(),t.borderWidth>0&&e.stroke()}}function Je(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 co(e,t){e.save(),e.beginPath(),e.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),e.clip()}function uo(e){e.restore()}function Rf(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 Nf(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 zf(e,t){t.translation&&e.translate(t.translation[0],t.translation[1]),V(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 Ff(e,t,n,i,s){if(s.strikethrough||s.underline){const o=e.measureText(i),r=t-o.actualBoundingBoxLeft,a=t+o.actualBoundingBoxRight,l=n-o.actualBoundingBoxAscent,c=n+o.actualBoundingBoxDescent,u=s.strikethrough?(l+c)/2:c;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=s.decorationWidth||2,e.moveTo(r,u),e.lineTo(a,u),e.stroke()}}function Hf(e,t){const n=e.fillStyle;e.fillStyle=t.color,e.fillRect(t.left,t.top,t.width,t.height),e.fillStyle=n}function Ti(e,t,n,i,s,o={}){const r=Q(t)?t:[t],a=o.strokeWidth>0&&o.strokeColor!=="";let l,c;for(e.save(),e.font=s.string,zf(e,o),l=0;l<r.length;++l)c=r[l],o.backdrop&&Hf(e,o.backdrop),a&&(o.strokeColor&&(e.strokeStyle=o.strokeColor),V(o.strokeWidth)||(e.lineWidth=o.strokeWidth),e.strokeText(c,n,i,o.maxWidth)),e.fillText(c,n,i,o.maxWidth),Ff(e,n,i,c,o),i+=Number(s.lineHeight);e.restore()}function Ls(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*tt,tt,!0),e.lineTo(n,i+o-r.bottomLeft),e.arc(n+r.bottomLeft,i+o-r.bottomLeft,r.bottomLeft,tt,wt,!0),e.lineTo(n+s-r.bottomRight,i+o),e.arc(n+s-r.bottomRight,i+o-r.bottomRight,r.bottomRight,wt,0,!0),e.lineTo(n+s,i+r.topRight),e.arc(n+s-r.topRight,i+r.topRight,r.topRight,0,-wt,!0),e.lineTo(n+r.topLeft,i)}const Bf=/^(normal|(\\d+(?:\\.\\d+)?)(px|em|%)?)$/,Vf=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Wf(e,t){const n=(""+e).match(Bf);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 jf=e=>+e||0;function wl(e,t){const n={},i=B(t),s=i?Object.keys(t):t,o=B(e)?i?r=>R(e[r],e[t[r]]):r=>e[r]:()=>e;for(const r of s)n[r]=jf(o(r));return n}function Uf(e){return wl(e,{top:"y",right:"x",bottom:"y",left:"x"})}function En(e){return wl(e,["topLeft","topRight","bottomLeft","bottomRight"])}function Mt(e){const t=Uf(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function ct(e,t){e=e||{},t=t||Y.font;let n=R(e.size,t.size);typeof n=="string"&&(n=parseInt(n,10));let i=R(e.style,t.style);i&&!(""+i).match(Vf)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const s={family:R(e.family,t.family),lineHeight:Wf(R(e.lineHeight,t.lineHeight),n),size:n,style:i,weight:R(e.weight,t.weight),string:""};return s.string=Lf(s),s}function Jn(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 $f(e,t,n){const{min:i,max:s}=e,o=tf(t,(s-i)/2),r=(a,l)=>n&&a===0?0:a+l;return{min:r(i,-Math.abs(o)),max:r(s,o)}}function Le(e,t){return Object.assign(Object.create(e),t)}function ho(e,t=[""],n,i,s=()=>e[0]){const o=n||e;typeof i>"u"&&(i=Ml("_fallback",e));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:o,_fallback:i,_getTarget:s,override:a=>ho([a,...e],t,o,i)};return new Proxy(r,{deleteProperty(a,l){return delete a[l],delete a._keys,delete e[0][l],!0},get(a,l){return kl(a,l,()=>Jf(l,t,e,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(a,l){return fr(a).includes(l)},ownKeys(a){return fr(a)},set(a,l,c){const u=a._storage||(a._storage=s());return a[l]=u[l]=c,delete a._keys,!0}})}function tn(e,t,n,i){const s={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:Sl(e,i),setContext:o=>tn(e,o,n,i),override:o=>tn(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 kl(o,r,()=>Xf(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 Sl(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:le(n)?n:()=>n,isIndexable:le(i)?i:()=>i}}const Yf=(e,t)=>e?e+ro(t):t,fo=(e,t)=>B(t)&&e!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function kl(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||t==="constructor")return e[t];const i=n();return e[t]=i,i}function Xf(e,t,n){const{_proxy:i,_context:s,_subProxy:o,_descriptors:r}=e;let a=i[t];return le(a)&&r.isScriptable(t)&&(a=qf(t,a,e,n)),Q(a)&&a.length&&(a=Gf(t,a,e,r.isIndexable)),fo(t,a)&&(a=tn(a,s,o&&o[t],r)),a}function qf(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 l=t(o,r||i);return a.delete(e),fo(e,l)&&(l=po(s._scopes,s,e,l)),l}function Gf(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(B(t[0])){const l=t,c=s._scopes.filter(u=>u!==l);t=[];for(const u of l){const f=po(c,s,e,u);t.push(tn(f,o,r&&r[e],a))}}return t}function Tl(e,t,n){return le(e)?e(t,n):e}const Kf=(e,t)=>e===!0?t:typeof e=="string"?wi(t,e):void 0;function Zf(e,t,n,i,s){for(const o of t){const r=Kf(n,o);if(r){e.add(r);const a=Tl(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 po(e,t,n,i){const s=t._rootScopes,o=Tl(t._fallback,n,i),r=[...e,...s],a=new Set;a.add(i);let l=hr(a,r,n,o||n,i);return l===null||typeof o<"u"&&o!==n&&(l=hr(a,r,o,l,i),l===null)?!1:ho(Array.from(a),[""],s,o,()=>Qf(t,n,i))}function hr(e,t,n,i,s){for(;n;)n=Zf(e,t,n,i,s);return n}function Qf(e,t,n){const i=e._getTarget();t in i||(i[t]={});const s=i[t];return Q(s)&&B(n)?n:s||{}}function Jf(e,t,n,i){let s;for(const o of t)if(s=Ml(Yf(o,e),n),typeof s<"u")return fo(e,s)?po(n,i,e,s):s}function Ml(e,t){for(const n of t){if(!n)continue;const i=n[e];if(typeof i<"u")return i}}function fr(e){let t=e._keys;return t||(t=e._keys=td(e._scopes)),t}function td(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)}const ed=Number.EPSILON||1e-14,en=(e,t)=>t<e.length&&!e[t].skip&&e[t],El=e=>e==="x"?"y":"x";function nd(e,t,n,i){const s=e.skip?t:e,o=t,r=n.skip?t:n,a=Ds(o,s),l=Ds(r,o);let c=a/(a+l),u=l/(a+l);c=isNaN(c)?0:c,u=isNaN(u)?0:u;const f=i*c,p=i*u;return{previous:{x:o.x-f*(r.x-s.x),y:o.y-f*(r.y-s.y)},next:{x:o.x+p*(r.x-s.x),y:o.y+p*(r.y-s.y)}}}function id(e,t,n){const i=e.length;let s,o,r,a,l,c=en(e,0);for(let u=0;u<i-1;++u)if(l=c,c=en(e,u+1),!(!l||!c)){if(Oe(t[u],0,ed)){n[u]=n[u+1]=0;continue}s=n[u]/t[u],o=n[u+1]/t[u],a=Math.pow(s,2)+Math.pow(o,2),!(a<=9)&&(r=3/Math.sqrt(a),n[u]=s*r*t[u],n[u+1]=o*r*t[u])}}function sd(e,t,n="x"){const i=El(n),s=e.length;let o,r,a,l=en(e,0);for(let c=0;c<s;++c){if(r=a,a=l,l=en(e,c+1),!a)continue;const u=a[n],f=a[i];r&&(o=(u-r[n])/3,a[\`cp1\${n}\`]=u-o,a[\`cp1\${i}\`]=f-o*t[c]),l&&(o=(l[n]-u)/3,a[\`cp2\${n}\`]=u+o,a[\`cp2\${i}\`]=f+o*t[c])}}function od(e,t="x"){const n=El(t),i=e.length,s=Array(i).fill(0),o=Array(i);let r,a,l,c=en(e,0);for(r=0;r<i;++r)if(a=l,l=c,c=en(e,r+1),!!l){if(c){const u=c[t]-l[t];s[r]=u!==0?(c[n]-l[n])/u:0}o[r]=a?c?ce(s[r-1])!==ce(s[r])?0:(s[r-1]+s[r])/2:s[r-1]:s[r]}id(e,s,o),sd(e,o,t)}function ti(e,t,n){return Math.max(Math.min(e,n),t)}function rd(e,t){let n,i,s,o,r,a=Je(e[0],t);for(n=0,i=e.length;n<i;++n)r=o,o=a,a=n<i-1&&Je(e[n+1],t),o&&(s=e[n],r&&(s.cp1x=ti(s.cp1x,t.left,t.right),s.cp1y=ti(s.cp1y,t.top,t.bottom)),a&&(s.cp2x=ti(s.cp2x,t.left,t.right),s.cp2y=ti(s.cp2y,t.top,t.bottom)))}function ad(e,t,n,i,s){let o,r,a,l;if(t.spanGaps&&(e=e.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")od(e,s);else{let c=i?e[e.length-1]:e[0];for(o=0,r=e.length;o<r;++o)a=e[o],l=nd(c,a,e[Math.min(o+1,r-(i?0:1))%r],t.tension),a.cp1x=l.previous.x,a.cp1y=l.previous.y,a.cp2x=l.next.x,a.cp2y=l.next.y,c=a}t.capBezierPoints&&rd(e,n)}function go(){return typeof window<"u"&&typeof document<"u"}function mo(e){let t=e.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function Mi(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 Ri=e=>e.ownerDocument.defaultView.getComputedStyle(e,null);function ld(e,t){return Ri(e).getPropertyValue(t)}const cd=["top","right","bottom","left"];function Pe(e,t,n){const i={};n=n?"-"+n:"";for(let s=0;s<4;s++){const o=cd[s];i[o]=parseFloat(e[t+"-"+o+n])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const ud=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function hd(e,t){const n=e.touches,i=n&&n.length?n[0]:e,{offsetX:s,offsetY:o}=i;let r=!1,a,l;if(ud(s,o,e.target))a=s,l=o;else{const c=t.getBoundingClientRect();a=i.clientX-c.left,l=i.clientY-c.top,r=!0}return{x:a,y:l,box:r}}function It(e,t){if("native"in e)return e;const{canvas:n,currentDevicePixelRatio:i}=t,s=Ri(n),o=s.boxSizing==="border-box",r=Pe(s,"padding"),a=Pe(s,"border","width"),{x:l,y:c,box:u}=hd(e,n),f=r.left+(u&&a.left),p=r.top+(u&&a.top);let{width:g,height:x}=t;return o&&(g-=r.width+a.width,x-=r.height+a.height),{x:Math.round((l-f)/g*n.width/i),y:Math.round((c-p)/x*n.height/i)}}function fd(e,t,n){let i,s;if(t===void 0||n===void 0){const o=e&&mo(e);if(!o)t=e.clientWidth,n=e.clientHeight;else{const r=o.getBoundingClientRect(),a=Ri(o),l=Pe(a,"border","width"),c=Pe(a,"padding");t=r.width-c.width-l.width,n=r.height-c.height-l.height,i=Mi(a.maxWidth,o,"clientWidth"),s=Mi(a.maxHeight,o,"clientHeight")}}return{width:t,height:n,maxWidth:i||ki,maxHeight:s||ki}}const ei=e=>Math.round(e*10)/10;function dd(e,t,n,i){const s=Ri(e),o=Pe(s,"margin"),r=Mi(s.maxWidth,e,"clientWidth")||ki,a=Mi(s.maxHeight,e,"clientHeight")||ki,l=fd(e,t,n);let{width:c,height:u}=l;if(s.boxSizing==="content-box"){const p=Pe(s,"border","width"),g=Pe(s,"padding");c-=g.width+p.width,u-=g.height+p.height}return c=Math.max(0,c-o.width),u=Math.max(0,i?c/i:u-o.height),c=ei(Math.min(c,r,l.maxWidth)),u=ei(Math.min(u,a,l.maxHeight)),c&&!u&&(u=ei(c/2)),(t!==void 0||n!==void 0)&&i&&l.height&&u>l.height&&(u=l.height,c=ei(Math.floor(u*i))),{width:c,height:u}}function dr(e,t,n){const i=t||1,s=Math.floor(e.height*i),o=Math.floor(e.width*i);e.height=Math.floor(e.height),e.width=Math.floor(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 pd=(function(){let e=!1;try{const t={get passive(){return e=!0,!1}};go()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return e})();function pr(e,t){const n=ld(e,t),i=n&&n.match(/^(\\d+)(\\.\\d+)?px$/);return i?+i[1]:void 0}function Se(e,t,n,i){return{x:e.x+n*(t.x-e.x),y:e.y+n*(t.y-e.y)}}function gd(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 md(e,t,n,i){const s={x:e.cp2x,y:e.cp2y},o={x:t.cp1x,y:t.cp1y},r=Se(e,s,n),a=Se(s,o,n),l=Se(o,t,n),c=Se(r,a,n),u=Se(a,l,n);return Se(c,u,n)}const bd=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}}},yd=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function Ue(e,t,n){return e?bd(t,n):yd()}function Cl(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 Ol(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty("direction",t[0],t[1]))}function Pl(e){return e==="angle"?{between:pl,compare:gf,normalize:Qt}:{between:_n,compare:(t,n)=>t-n,normalize:t=>t}}function gr({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 xd(e,t,n){const{property:i,start:s,end:o}=n,{between:r,normalize:a}=Pl(i),l=t.length;let{start:c,end:u,loop:f}=e,p,g;if(f){for(c+=l,u+=l,p=0,g=l;p<g&&r(a(t[c%l][i]),s,o);++p)c--,u--;c%=l,u%=l}return u<c&&(u+=l),{start:c,end:u,loop:f,style:e.style}}function vd(e,t,n){if(!n)return[e];const{property:i,start:s,end:o}=n,r=t.length,{compare:a,between:l,normalize:c}=Pl(i),{start:u,end:f,loop:p,style:g}=xd(e,t,n),x=[];let y=!1,v=null,w,k,C;const O=()=>l(s,C,w)&&a(s,C)!==0,T=()=>a(o,w)===0||l(o,C,w),D=()=>y||O(),P=()=>!y||T();for(let E=u,A=u;E<=f;++E)k=t[E%r],!k.skip&&(w=c(k[i]),w!==C&&(y=l(w,s,o),v===null&&D()&&(v=a(w,s)===0?E:A),v!==null&&P()&&(x.push(gr({start:v,end:E,loop:p,count:r,style:g})),v=null),A=E,C=w));return v!==null&&x.push(gr({start:v,end:f,loop:p,count:r,style:g})),x}function _d(e,t){const n=[],i=e.segments;for(let s=0;s<i.length;s++){const o=vd(i[s],e.points,t);o.length&&n.push(...o)}return n}function wd(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 Sd(e,t,n,i){const s=e.length,o=[];let r=t,a=e[t],l;for(l=t+1;l<=n;++l){const c=e[l%s];c.skip||c.stop?a.skip||(i=!1,o.push({start:t%s,end:(l-1)%s,loop:i}),t=r=c.stop?l:null):(r=l,a.skip&&(t=l)),a=c}return r!==null&&o.push({start:t%s,end:r%s,loop:i}),o}function kd(e,t){const n=e.points,i=e.options.spanGaps,s=n.length;if(!s)return[];const o=!!e._loop,{start:r,end:a}=wd(n,s,o,i);if(i===!0)return mr(e,[{start:r,end:a,loop:o}],n,t);const l=a<r?a+s:a,c=!!e._fullLoop&&r===0&&a===s-1;return mr(e,Sd(n,r,l,c),n,t)}function mr(e,t,n,i){return!i||!i.setContext||!n?t:Td(e,t,n,i)}function Td(e,t,n,i){const s=e._chart.getContext(),o=br(e.options),{_datasetIndex:r,options:{spanGaps:a}}=e,l=n.length,c=[];let u=o,f=t[0].start,p=f;function g(x,y,v,w){const k=a?-1:1;if(x!==y){for(x+=l;n[x%l].skip;)x-=k;for(;n[y%l].skip;)y+=k;x%l!==y%l&&(c.push({start:x%l,end:y%l,loop:v,style:w}),u=w,f=y%l)}}for(const x of t){f=a?f:x.start;let y=n[f%l],v;for(p=f+1;p<=x.end;p++){const w=n[p%l];v=br(i.setContext(Le(s,{type:"segment",p0:y,p1:w,p0DataIndex:(p-1)%l,p1DataIndex:p%l,datasetIndex:r}))),Md(v,u)&&g(f,p-1,x.loop,u),y=w,u=v}f<p-1&&g(f,p-1,x.loop,u)}return c}function br(e){return{backgroundColor:e.backgroundColor,borderCapStyle:e.borderCapStyle,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderJoinStyle:e.borderJoinStyle,borderWidth:e.borderWidth,borderColor:e.borderColor}}function Md(e,t){if(!t)return!1;const n=[],i=function(s,o){return lo(o)?(n.includes(o)||n.push(o),n.indexOf(o)):o};return JSON.stringify(e,i)!==JSON.stringify(t,i)}function ni(e,t,n){return e.options.clip?e[n]:t[n]}function Ed(e,t){const{xScale:n,yScale:i}=e;return n&&i?{left:ni(n,t,"left"),right:ni(n,t,"right"),top:ni(i,t,"top"),bottom:ni(i,t,"bottom")}:t}function Cd(e,t){const n=t._clip;if(n.disabled)return!1;const i=Ed(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)}}/*!
|
|
2420
|
+
*/function Wt(){}const Jh=(()=>{let e=0;return()=>e++})();function B(e){return e==null}function Q(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 V(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function xt(e){return(typeof e=="number"||e instanceof Number)&&isFinite(+e)}function Pt(e,t){return xt(e)?e:t}function R(e,t){return typeof e>"u"?t:e}const tf=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100*t:+e;function I(e,t,n){if(e&&typeof e.call=="function")return e.apply(n,t)}function z(e,t,n,i){let s,o,r;if(Q(e))for(o=e.length,s=0;s<o;s++)t.call(n,e[s],s);else if(V(e))for(r=Object.keys(e),o=r.length,s=0;s<o;s++)t.call(n,e[r[s]],r[s])}function vi(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 _i(e){if(Q(e))return e.map(_i);if(V(e)){const t=Object.create(null),n=Object.keys(e),i=n.length;let s=0;for(;s<i;++s)t[n[s]]=_i(e[n[s]]);return t}return e}function fl(e){return["__proto__","prototype","constructor"].indexOf(e)===-1}function ef(e,t,n,i){if(!fl(e))return;const s=t[e],o=n[e];V(s)&&V(o)?An(s,o,i):t[e]=_i(o)}function An(e,t,n){const i=Q(t)?t:[t],s=i.length;if(!V(e))return e;n=n||{};const o=n.merger||ef;let r;for(let a=0;a<s;++a){if(r=i[a],!V(r))continue;const l=Object.keys(r);for(let c=0,u=l.length;c<u;++c)o(l[c],e,r,n)}return e}function kn(e,t){return An(e,t,{merger:nf})}function nf(e,t,n){if(!fl(e))return;const i=t[e],s=n[e];V(i)&&V(s)?kn(i,s):Object.prototype.hasOwnProperty.call(t,e)||(t[e]=_i(s))}const Jo={"":e=>e,x:e=>e.x,y:e=>e.y};function sf(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 of(e){const t=sf(e);return n=>{for(const i of t){if(i==="")break;n=n&&n[i]}return n}}function wi(e,t){return(Jo[t]||(Jo[t]=of(t)))(e)}function ro(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Si=e=>typeof e<"u",le=e=>typeof e=="function",tr=(e,t)=>{if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0};function rf(e){return e.type==="mouseup"||e.type==="click"||e.type==="contextmenu"}const tt=Math.PI,zt=2*tt,af=zt+tt,ki=Number.POSITIVE_INFINITY,lf=tt/180,wt=tt/2,ve=tt/4,er=tt*2/3,dl=Math.log10,ce=Math.sign;function Oe(e,t,n){return Math.abs(e-t)<n}function nr(e){const t=Math.round(e);e=Oe(e,t,e/1e3)?t:e;const n=Math.pow(10,Math.floor(dl(e))),i=e/n;return(i<=1?1:i<=2?2:i<=5?5:10)*n}function cf(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 uf(e){return typeof e=="symbol"||typeof e=="object"&&e!==null&&!(Symbol.toPrimitive in e||"toString"in e||"valueOf"in e)}function In(e){return!uf(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function hf(e,t){const n=Math.round(e);return n-t<=e&&n+t>=e}function ff(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 Me(e){return e*(tt/180)}function df(e){return e*(180/tt)}function ir(e){if(!xt(e))return;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n++;return n}function pf(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*tt&&(o+=zt),{angle:o,distance:s}}function Ds(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function gf(e,t){return(e-t+af)%zt-tt}function Qt(e){return(e%zt+zt)%zt}function pl(e,t,n,i){const s=Qt(e),o=Qt(t),r=Qt(n),a=Qt(o-s),l=Qt(r-s),c=Qt(s-o),u=Qt(s-r);return s===o||s===r||i&&o===r||a>l&&c<u}function yt(e,t,n){return Math.max(t,Math.min(n,e))}function mf(e){return yt(e,-32768,32767)}function _n(e,t,n,i=1e-6){return e>=Math.min(t,n)-i&&e<=Math.max(t,n)+i}function ao(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 Ee=(e,t,n,i)=>ao(e,n,i?s=>{const o=e[s][t];return o<n||o===n&&e[s+1][t]===n}:s=>e[s][t]<n),bf=(e,t,n)=>ao(e,n,i=>e[i][t]>=n);function yf(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 gl=["push","pop","shift","splice","unshift"];function xf(e,t){if(e._chartjs){e._chartjs.listeners.push(t);return}Object.defineProperty(e,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),gl.forEach(n=>{const i="_onData"+ro(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 sr(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)&&(gl.forEach(o=>{delete e[o]}),delete e._chartjs)}function vf(e){const t=new Set(e);return t.size===e.length?e:Array.from(t)}const ml=(function(){return typeof window>"u"?function(e){return e()}:window.requestAnimationFrame})();function bl(e,t){let n=[],i=!1;return function(...s){n=s,i||(i=!0,ml.call(window,()=>{i=!1,e.apply(t,n)}))}}function _f(e,t){let n;return function(...i){return t?(clearTimeout(n),n=setTimeout(e,t,i)):e.apply(this,i),t}}const yl=e=>e==="start"?"left":e==="end"?"right":"center",ft=(e,t,n)=>e==="start"?t:e==="end"?n:(t+n)/2,wf=(e,t,n,i)=>e===(i?"left":"right")?n:e==="center"?(t+n)/2:t;function Sf(e,t,n){const i=t.length;let s=0,o=i;if(e._sorted){const{iScale:r,vScale:a,_parsed:l}=e,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null,u=r.axis,{min:f,max:p,minDefined:g,maxDefined:x}=r.getUserBounds();if(g){if(s=Math.min(Ee(l,u,f).lo,n?i:Ee(t,u,r.getPixelForValue(f)).lo),c){const y=l.slice(0,s+1).reverse().findIndex(v=>!B(v[a.axis]));s-=Math.max(0,y)}s=yt(s,0,i-1)}if(x){let y=Math.max(Ee(l,r.axis,p,!0).hi+1,n?0:Ee(t,u,r.getPixelForValue(p),!0).hi+1);if(c){const v=l.slice(y-1).findIndex(w=>!B(w[a.axis]));y+=Math.max(0,v)}o=yt(y,s,i)-s}else o=i-s}return{start:s,count:o}}function kf(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 Qn=e=>e===0||e===1,or=(e,t,n)=>-(Math.pow(2,10*(e-=1))*Math.sin((e-t)*zt/n)),rr=(e,t,n)=>Math.pow(2,-10*e)*Math.sin((e-t)*zt/n)+1,Tn={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*wt)+1,easeOutSine:e=>Math.sin(e*wt),easeInOutSine:e=>-.5*(Math.cos(tt*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=>Qn(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=>Qn(e)?e:or(e,.075,.3),easeOutElastic:e=>Qn(e)?e:rr(e,.075,.3),easeInOutElastic(e){return Qn(e)?e:e<.5?.5*or(e*2,.1125,.45):.5+.5*rr(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-Tn.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?Tn.easeInBounce(e*2)*.5:Tn.easeOutBounce(e*2-1)*.5+.5};function lo(e){if(e&&typeof e=="object"){const t=e.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function ar(e){return lo(e)?e:new Dn(e)}function Zi(e){return lo(e)?e:new Dn(e).saturate(.5).darken(.1).hexString()}const Tf=["x","y","borderWidth","radius","tension"],Mf=["color","borderColor","backgroundColor"];function Ef(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:Mf},numbers:{type:"number",properties:Tf}}),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 Cf(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const lr=new Map;function Of(e,t){t=t||{};const n=e+JSON.stringify(t);let i=lr.get(n);return i||(i=new Intl.NumberFormat(e,t),lr.set(n,i)),i}function xl(e,t,n){return Of(t,n).format(e)}const Pf={values(e){return Q(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 c=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),o=Df(e,n)}const r=dl(Math.abs(o)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),xl(e,i,l)}};function Df(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 vl={formatters:Pf};function Af(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:vl.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 De=Object.create(null),As=Object.create(null);function Mn(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 Qi(e,t,n){return typeof t=="string"?An(Mn(e,t),n):An(Mn(e,""),t)}class If{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)=>Zi(s.backgroundColor),this.hoverBorderColor=(i,s)=>Zi(s.borderColor),this.hoverColor=(i,s)=>Zi(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 Qi(this,t,n)}get(t){return Mn(this,t)}describe(t,n){return Qi(As,t,n)}override(t,n){return Qi(De,t,n)}route(t,n,i,s){const o=Mn(this,t),r=Mn(this,i),a="_"+n;Object.defineProperties(o,{[a]:{value:o[n],writable:!0},[n]:{enumerable:!0,get(){const l=this[a],c=r[s];return V(l)?Object.assign({},c,l):R(l,c)},set(l){this[a]=l}}})}apply(t){t.forEach(n=>n(this))}}var Y=new If({_scriptable:e=>!e.startsWith("on"),_indexable:e=>e!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Ef,Cf,Af]);function Lf(e){return!e||B(e.size)||B(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}function cr(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 _e(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 ur(e,t){!t&&!e||(t=t||e.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function Is(e,t,n,i){_l(e,t,n,i,null)}function _l(e,t,n,i,s){let o,r,a,l,c,u,f,p;const g=t.pointStyle,x=t.rotation,y=t.radius;let v=(x||0)*lf;if(g&&typeof g=="object"&&(o=g.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){e.save(),e.translate(n,i),e.rotate(v),e.drawImage(g,-g.width/2,-g.height/2,g.width,g.height),e.restore();return}if(!(isNaN(y)||y<=0)){switch(e.beginPath(),g){default:s?e.ellipse(n,i,s/2,y,0,0,zt):e.arc(n,i,y,0,zt),e.closePath();break;case"triangle":u=s?s/2:y,e.moveTo(n+Math.sin(v)*u,i-Math.cos(v)*y),v+=er,e.lineTo(n+Math.sin(v)*u,i-Math.cos(v)*y),v+=er,e.lineTo(n+Math.sin(v)*u,i-Math.cos(v)*y),e.closePath();break;case"rectRounded":c=y*.516,l=y-c,r=Math.cos(v+ve)*l,f=Math.cos(v+ve)*(s?s/2-c:l),a=Math.sin(v+ve)*l,p=Math.sin(v+ve)*(s?s/2-c:l),e.arc(n-f,i-a,c,v-tt,v-wt),e.arc(n+p,i-r,c,v-wt,v),e.arc(n+f,i+a,c,v,v+wt),e.arc(n-p,i+r,c,v+wt,v+tt),e.closePath();break;case"rect":if(!x){l=Math.SQRT1_2*y,u=s?s/2:l,e.rect(n-u,i-l,2*u,2*l);break}v+=ve;case"rectRot":f=Math.cos(v)*(s?s/2:y),r=Math.cos(v)*y,a=Math.sin(v)*y,p=Math.sin(v)*(s?s/2:y),e.moveTo(n-f,i-a),e.lineTo(n+p,i-r),e.lineTo(n+f,i+a),e.lineTo(n-p,i+r),e.closePath();break;case"crossRot":v+=ve;case"cross":f=Math.cos(v)*(s?s/2:y),r=Math.cos(v)*y,a=Math.sin(v)*y,p=Math.sin(v)*(s?s/2:y),e.moveTo(n-f,i-a),e.lineTo(n+f,i+a),e.moveTo(n+p,i-r),e.lineTo(n-p,i+r);break;case"star":f=Math.cos(v)*(s?s/2:y),r=Math.cos(v)*y,a=Math.sin(v)*y,p=Math.sin(v)*(s?s/2:y),e.moveTo(n-f,i-a),e.lineTo(n+f,i+a),e.moveTo(n+p,i-r),e.lineTo(n-p,i+r),v+=ve,f=Math.cos(v)*(s?s/2:y),r=Math.cos(v)*y,a=Math.sin(v)*y,p=Math.sin(v)*(s?s/2:y),e.moveTo(n-f,i-a),e.lineTo(n+f,i+a),e.moveTo(n+p,i-r),e.lineTo(n-p,i+r);break;case"line":r=s?s/2:Math.cos(v)*y,a=Math.sin(v)*y,e.moveTo(n-r,i-a),e.lineTo(n+r,i+a);break;case"dash":e.moveTo(n,i),e.lineTo(n+Math.cos(v)*(s?s/2:y),i+Math.sin(v)*y);break;case!1:e.closePath();break}e.fill(),t.borderWidth>0&&e.stroke()}}function Je(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 co(e,t){e.save(),e.beginPath(),e.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),e.clip()}function uo(e){e.restore()}function Rf(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 Nf(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 zf(e,t){t.translation&&e.translate(t.translation[0],t.translation[1]),B(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 Ff(e,t,n,i,s){if(s.strikethrough||s.underline){const o=e.measureText(i),r=t-o.actualBoundingBoxLeft,a=t+o.actualBoundingBoxRight,l=n-o.actualBoundingBoxAscent,c=n+o.actualBoundingBoxDescent,u=s.strikethrough?(l+c)/2:c;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=s.decorationWidth||2,e.moveTo(r,u),e.lineTo(a,u),e.stroke()}}function Hf(e,t){const n=e.fillStyle;e.fillStyle=t.color,e.fillRect(t.left,t.top,t.width,t.height),e.fillStyle=n}function Ti(e,t,n,i,s,o={}){const r=Q(t)?t:[t],a=o.strokeWidth>0&&o.strokeColor!=="";let l,c;for(e.save(),e.font=s.string,zf(e,o),l=0;l<r.length;++l)c=r[l],o.backdrop&&Hf(e,o.backdrop),a&&(o.strokeColor&&(e.strokeStyle=o.strokeColor),B(o.strokeWidth)||(e.lineWidth=o.strokeWidth),e.strokeText(c,n,i,o.maxWidth)),e.fillText(c,n,i,o.maxWidth),Ff(e,n,i,c,o),i+=Number(s.lineHeight);e.restore()}function Ls(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*tt,tt,!0),e.lineTo(n,i+o-r.bottomLeft),e.arc(n+r.bottomLeft,i+o-r.bottomLeft,r.bottomLeft,tt,wt,!0),e.lineTo(n+s-r.bottomRight,i+o),e.arc(n+s-r.bottomRight,i+o-r.bottomRight,r.bottomRight,wt,0,!0),e.lineTo(n+s,i+r.topRight),e.arc(n+s-r.topRight,i+r.topRight,r.topRight,0,-wt,!0),e.lineTo(n+r.topLeft,i)}const Vf=/^(normal|(\\d+(?:\\.\\d+)?)(px|em|%)?)$/,Bf=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Wf(e,t){const n=(""+e).match(Vf);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 jf=e=>+e||0;function wl(e,t){const n={},i=V(t),s=i?Object.keys(t):t,o=V(e)?i?r=>R(e[r],e[t[r]]):r=>e[r]:()=>e;for(const r of s)n[r]=jf(o(r));return n}function Uf(e){return wl(e,{top:"y",right:"x",bottom:"y",left:"x"})}function En(e){return wl(e,["topLeft","topRight","bottomLeft","bottomRight"])}function Mt(e){const t=Uf(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function ct(e,t){e=e||{},t=t||Y.font;let n=R(e.size,t.size);typeof n=="string"&&(n=parseInt(n,10));let i=R(e.style,t.style);i&&!(""+i).match(Bf)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const s={family:R(e.family,t.family),lineHeight:Wf(R(e.lineHeight,t.lineHeight),n),size:n,style:i,weight:R(e.weight,t.weight),string:""};return s.string=Lf(s),s}function Jn(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 $f(e,t,n){const{min:i,max:s}=e,o=tf(t,(s-i)/2),r=(a,l)=>n&&a===0?0:a+l;return{min:r(i,-Math.abs(o)),max:r(s,o)}}function Ie(e,t){return Object.assign(Object.create(e),t)}function ho(e,t=[""],n,i,s=()=>e[0]){const o=n||e;typeof i>"u"&&(i=Ml("_fallback",e));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:o,_fallback:i,_getTarget:s,override:a=>ho([a,...e],t,o,i)};return new Proxy(r,{deleteProperty(a,l){return delete a[l],delete a._keys,delete e[0][l],!0},get(a,l){return kl(a,l,()=>Jf(l,t,e,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(a,l){return fr(a).includes(l)},ownKeys(a){return fr(a)},set(a,l,c){const u=a._storage||(a._storage=s());return a[l]=u[l]=c,delete a._keys,!0}})}function tn(e,t,n,i){const s={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:Sl(e,i),setContext:o=>tn(e,o,n,i),override:o=>tn(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 kl(o,r,()=>Xf(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 Sl(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:le(n)?n:()=>n,isIndexable:le(i)?i:()=>i}}const Yf=(e,t)=>e?e+ro(t):t,fo=(e,t)=>V(t)&&e!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function kl(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||t==="constructor")return e[t];const i=n();return e[t]=i,i}function Xf(e,t,n){const{_proxy:i,_context:s,_subProxy:o,_descriptors:r}=e;let a=i[t];return le(a)&&r.isScriptable(t)&&(a=qf(t,a,e,n)),Q(a)&&a.length&&(a=Gf(t,a,e,r.isIndexable)),fo(t,a)&&(a=tn(a,s,o&&o[t],r)),a}function qf(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 l=t(o,r||i);return a.delete(e),fo(e,l)&&(l=po(s._scopes,s,e,l)),l}function Gf(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(V(t[0])){const l=t,c=s._scopes.filter(u=>u!==l);t=[];for(const u of l){const f=po(c,s,e,u);t.push(tn(f,o,r&&r[e],a))}}return t}function Tl(e,t,n){return le(e)?e(t,n):e}const Kf=(e,t)=>e===!0?t:typeof e=="string"?wi(t,e):void 0;function Zf(e,t,n,i,s){for(const o of t){const r=Kf(n,o);if(r){e.add(r);const a=Tl(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 po(e,t,n,i){const s=t._rootScopes,o=Tl(t._fallback,n,i),r=[...e,...s],a=new Set;a.add(i);let l=hr(a,r,n,o||n,i);return l===null||typeof o<"u"&&o!==n&&(l=hr(a,r,o,l,i),l===null)?!1:ho(Array.from(a),[""],s,o,()=>Qf(t,n,i))}function hr(e,t,n,i,s){for(;n;)n=Zf(e,t,n,i,s);return n}function Qf(e,t,n){const i=e._getTarget();t in i||(i[t]={});const s=i[t];return Q(s)&&V(n)?n:s||{}}function Jf(e,t,n,i){let s;for(const o of t)if(s=Ml(Yf(o,e),n),typeof s<"u")return fo(e,s)?po(n,i,e,s):s}function Ml(e,t){for(const n of t){if(!n)continue;const i=n[e];if(typeof i<"u")return i}}function fr(e){let t=e._keys;return t||(t=e._keys=td(e._scopes)),t}function td(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)}const ed=Number.EPSILON||1e-14,en=(e,t)=>t<e.length&&!e[t].skip&&e[t],El=e=>e==="x"?"y":"x";function nd(e,t,n,i){const s=e.skip?t:e,o=t,r=n.skip?t:n,a=Ds(o,s),l=Ds(r,o);let c=a/(a+l),u=l/(a+l);c=isNaN(c)?0:c,u=isNaN(u)?0:u;const f=i*c,p=i*u;return{previous:{x:o.x-f*(r.x-s.x),y:o.y-f*(r.y-s.y)},next:{x:o.x+p*(r.x-s.x),y:o.y+p*(r.y-s.y)}}}function id(e,t,n){const i=e.length;let s,o,r,a,l,c=en(e,0);for(let u=0;u<i-1;++u)if(l=c,c=en(e,u+1),!(!l||!c)){if(Oe(t[u],0,ed)){n[u]=n[u+1]=0;continue}s=n[u]/t[u],o=n[u+1]/t[u],a=Math.pow(s,2)+Math.pow(o,2),!(a<=9)&&(r=3/Math.sqrt(a),n[u]=s*r*t[u],n[u+1]=o*r*t[u])}}function sd(e,t,n="x"){const i=El(n),s=e.length;let o,r,a,l=en(e,0);for(let c=0;c<s;++c){if(r=a,a=l,l=en(e,c+1),!a)continue;const u=a[n],f=a[i];r&&(o=(u-r[n])/3,a[\`cp1\${n}\`]=u-o,a[\`cp1\${i}\`]=f-o*t[c]),l&&(o=(l[n]-u)/3,a[\`cp2\${n}\`]=u+o,a[\`cp2\${i}\`]=f+o*t[c])}}function od(e,t="x"){const n=El(t),i=e.length,s=Array(i).fill(0),o=Array(i);let r,a,l,c=en(e,0);for(r=0;r<i;++r)if(a=l,l=c,c=en(e,r+1),!!l){if(c){const u=c[t]-l[t];s[r]=u!==0?(c[n]-l[n])/u:0}o[r]=a?c?ce(s[r-1])!==ce(s[r])?0:(s[r-1]+s[r])/2:s[r-1]:s[r]}id(e,s,o),sd(e,o,t)}function ti(e,t,n){return Math.max(Math.min(e,n),t)}function rd(e,t){let n,i,s,o,r,a=Je(e[0],t);for(n=0,i=e.length;n<i;++n)r=o,o=a,a=n<i-1&&Je(e[n+1],t),o&&(s=e[n],r&&(s.cp1x=ti(s.cp1x,t.left,t.right),s.cp1y=ti(s.cp1y,t.top,t.bottom)),a&&(s.cp2x=ti(s.cp2x,t.left,t.right),s.cp2y=ti(s.cp2y,t.top,t.bottom)))}function ad(e,t,n,i,s){let o,r,a,l;if(t.spanGaps&&(e=e.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")od(e,s);else{let c=i?e[e.length-1]:e[0];for(o=0,r=e.length;o<r;++o)a=e[o],l=nd(c,a,e[Math.min(o+1,r-(i?0:1))%r],t.tension),a.cp1x=l.previous.x,a.cp1y=l.previous.y,a.cp2x=l.next.x,a.cp2y=l.next.y,c=a}t.capBezierPoints&&rd(e,n)}function go(){return typeof window<"u"&&typeof document<"u"}function mo(e){let t=e.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function Mi(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 Ri=e=>e.ownerDocument.defaultView.getComputedStyle(e,null);function ld(e,t){return Ri(e).getPropertyValue(t)}const cd=["top","right","bottom","left"];function Pe(e,t,n){const i={};n=n?"-"+n:"";for(let s=0;s<4;s++){const o=cd[s];i[o]=parseFloat(e[t+"-"+o+n])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const ud=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function hd(e,t){const n=e.touches,i=n&&n.length?n[0]:e,{offsetX:s,offsetY:o}=i;let r=!1,a,l;if(ud(s,o,e.target))a=s,l=o;else{const c=t.getBoundingClientRect();a=i.clientX-c.left,l=i.clientY-c.top,r=!0}return{x:a,y:l,box:r}}function It(e,t){if("native"in e)return e;const{canvas:n,currentDevicePixelRatio:i}=t,s=Ri(n),o=s.boxSizing==="border-box",r=Pe(s,"padding"),a=Pe(s,"border","width"),{x:l,y:c,box:u}=hd(e,n),f=r.left+(u&&a.left),p=r.top+(u&&a.top);let{width:g,height:x}=t;return o&&(g-=r.width+a.width,x-=r.height+a.height),{x:Math.round((l-f)/g*n.width/i),y:Math.round((c-p)/x*n.height/i)}}function fd(e,t,n){let i,s;if(t===void 0||n===void 0){const o=e&&mo(e);if(!o)t=e.clientWidth,n=e.clientHeight;else{const r=o.getBoundingClientRect(),a=Ri(o),l=Pe(a,"border","width"),c=Pe(a,"padding");t=r.width-c.width-l.width,n=r.height-c.height-l.height,i=Mi(a.maxWidth,o,"clientWidth"),s=Mi(a.maxHeight,o,"clientHeight")}}return{width:t,height:n,maxWidth:i||ki,maxHeight:s||ki}}const ei=e=>Math.round(e*10)/10;function dd(e,t,n,i){const s=Ri(e),o=Pe(s,"margin"),r=Mi(s.maxWidth,e,"clientWidth")||ki,a=Mi(s.maxHeight,e,"clientHeight")||ki,l=fd(e,t,n);let{width:c,height:u}=l;if(s.boxSizing==="content-box"){const p=Pe(s,"border","width"),g=Pe(s,"padding");c-=g.width+p.width,u-=g.height+p.height}return c=Math.max(0,c-o.width),u=Math.max(0,i?c/i:u-o.height),c=ei(Math.min(c,r,l.maxWidth)),u=ei(Math.min(u,a,l.maxHeight)),c&&!u&&(u=ei(c/2)),(t!==void 0||n!==void 0)&&i&&l.height&&u>l.height&&(u=l.height,c=ei(Math.floor(u*i))),{width:c,height:u}}function dr(e,t,n){const i=t||1,s=Math.floor(e.height*i),o=Math.floor(e.width*i);e.height=Math.floor(e.height),e.width=Math.floor(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 pd=(function(){let e=!1;try{const t={get passive(){return e=!0,!1}};go()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return e})();function pr(e,t){const n=ld(e,t),i=n&&n.match(/^(\\d+)(\\.\\d+)?px$/);return i?+i[1]:void 0}function Se(e,t,n,i){return{x:e.x+n*(t.x-e.x),y:e.y+n*(t.y-e.y)}}function gd(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 md(e,t,n,i){const s={x:e.cp2x,y:e.cp2y},o={x:t.cp1x,y:t.cp1y},r=Se(e,s,n),a=Se(s,o,n),l=Se(o,t,n),c=Se(r,a,n),u=Se(a,l,n);return Se(c,u,n)}const bd=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}}},yd=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function je(e,t,n){return e?bd(t,n):yd()}function Cl(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 Ol(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty("direction",t[0],t[1]))}function Pl(e){return e==="angle"?{between:pl,compare:gf,normalize:Qt}:{between:_n,compare:(t,n)=>t-n,normalize:t=>t}}function gr({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 xd(e,t,n){const{property:i,start:s,end:o}=n,{between:r,normalize:a}=Pl(i),l=t.length;let{start:c,end:u,loop:f}=e,p,g;if(f){for(c+=l,u+=l,p=0,g=l;p<g&&r(a(t[c%l][i]),s,o);++p)c--,u--;c%=l,u%=l}return u<c&&(u+=l),{start:c,end:u,loop:f,style:e.style}}function vd(e,t,n){if(!n)return[e];const{property:i,start:s,end:o}=n,r=t.length,{compare:a,between:l,normalize:c}=Pl(i),{start:u,end:f,loop:p,style:g}=xd(e,t,n),x=[];let y=!1,v=null,w,k,C;const O=()=>l(s,C,w)&&a(s,C)!==0,T=()=>a(o,w)===0||l(o,C,w),D=()=>y||O(),P=()=>!y||T();for(let E=u,A=u;E<=f;++E)k=t[E%r],!k.skip&&(w=c(k[i]),w!==C&&(y=l(w,s,o),v===null&&D()&&(v=a(w,s)===0?E:A),v!==null&&P()&&(x.push(gr({start:v,end:E,loop:p,count:r,style:g})),v=null),A=E,C=w));return v!==null&&x.push(gr({start:v,end:f,loop:p,count:r,style:g})),x}function _d(e,t){const n=[],i=e.segments;for(let s=0;s<i.length;s++){const o=vd(i[s],e.points,t);o.length&&n.push(...o)}return n}function wd(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 Sd(e,t,n,i){const s=e.length,o=[];let r=t,a=e[t],l;for(l=t+1;l<=n;++l){const c=e[l%s];c.skip||c.stop?a.skip||(i=!1,o.push({start:t%s,end:(l-1)%s,loop:i}),t=r=c.stop?l:null):(r=l,a.skip&&(t=l)),a=c}return r!==null&&o.push({start:t%s,end:r%s,loop:i}),o}function kd(e,t){const n=e.points,i=e.options.spanGaps,s=n.length;if(!s)return[];const o=!!e._loop,{start:r,end:a}=wd(n,s,o,i);if(i===!0)return mr(e,[{start:r,end:a,loop:o}],n,t);const l=a<r?a+s:a,c=!!e._fullLoop&&r===0&&a===s-1;return mr(e,Sd(n,r,l,c),n,t)}function mr(e,t,n,i){return!i||!i.setContext||!n?t:Td(e,t,n,i)}function Td(e,t,n,i){const s=e._chart.getContext(),o=br(e.options),{_datasetIndex:r,options:{spanGaps:a}}=e,l=n.length,c=[];let u=o,f=t[0].start,p=f;function g(x,y,v,w){const k=a?-1:1;if(x!==y){for(x+=l;n[x%l].skip;)x-=k;for(;n[y%l].skip;)y+=k;x%l!==y%l&&(c.push({start:x%l,end:y%l,loop:v,style:w}),u=w,f=y%l)}}for(const x of t){f=a?f:x.start;let y=n[f%l],v;for(p=f+1;p<=x.end;p++){const w=n[p%l];v=br(i.setContext(Ie(s,{type:"segment",p0:y,p1:w,p0DataIndex:(p-1)%l,p1DataIndex:p%l,datasetIndex:r}))),Md(v,u)&&g(f,p-1,x.loop,u),y=w,u=v}f<p-1&&g(f,p-1,x.loop,u)}return c}function br(e){return{backgroundColor:e.backgroundColor,borderCapStyle:e.borderCapStyle,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderJoinStyle:e.borderJoinStyle,borderWidth:e.borderWidth,borderColor:e.borderColor}}function Md(e,t){if(!t)return!1;const n=[],i=function(s,o){return lo(o)?(n.includes(o)||n.push(o),n.indexOf(o)):o};return JSON.stringify(e,i)!==JSON.stringify(t,i)}function ni(e,t,n){return e.options.clip?e[n]:t[n]}function Ed(e,t){const{xScale:n,yScale:i}=e;return n&&i?{left:ni(n,t,"left"),right:ni(n,t,"right"),top:ni(i,t,"top"),bottom:ni(i,t,"bottom")}:t}function Cd(e,t){const n=t._clip;if(n.disabled)return!1;const i=Ed(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)}}/*!
|
|
2408
2421
|
* Chart.js v4.5.0
|
|
2409
2422
|
* https://www.chartjs.org
|
|
2410
2423
|
* (c) 2025 Chart.js Contributors
|
|
2411
2424
|
* Released under the MIT License
|
|
2412
|
-
*/class Od{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=ml.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,l;for(;r>=0;--r)l=o[r],l._active?(l._total>i.duration&&(i.duration=l._total),l.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 jt=new Od;const yr="transparent",Pd={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const i=ar(e||yr),s=i.valid&&ar(t||yr);return s&&s.valid?s.mix(i,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class Dd{constructor(t,n,i,s){const o=n[i];s=Jn([t.to,s,o,t.from]);const r=Jn([t.from,o,s]);this._active=!0,this._fn=t.fn||Pd[t.type||typeof r],this._easing=Tn[t.easing]||Tn.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=Jn([t.to,n,s,t.from]),this._from=Jn([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 l;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}l=n/i%2,l=r&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((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 Dl{constructor(t,n){this._chart=t,this._properties=new Map,this.configure(n)}configure(t){if(!B(t))return;const n=Object.keys(Y.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{const o=t[s];if(!B(o))return;const r={};for(const a of n)r[a]=o[a];(Q(o.properties)&&o.properties||[s]).forEach(a=>{(a===s||!i.has(a))&&i.set(a,r)})})}_animateOptions(t,n){const i=n.options,s=Id(t,i);if(!s)return[];const o=this._createAnimations(s,i);return i.$shared&&Ad(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 l;for(l=r.length-1;l>=0;--l){const c=r[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,n));continue}const u=n[c];let f=o[c];const p=i.get(c);if(f)if(p&&f.active()){f.update(p,u,a);continue}else f.cancel();if(!p||!p.duration){t[c]=u;continue}o[c]=f=new Dd(p,t,c,u),s.push(f)}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 jt.add(this._chart,i),!0}}function Ad(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 Id(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 xr(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 Ld(e,t,n){if(n===!1)return!1;const i=xr(e,n),s=xr(t,n);return{top:s.end,right:i.end,bottom:s.start,left:i.start}}function Rd(e){let t,n,i,s;return B(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 Al(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 vr(e,t,n,i={}){const s=e.keys,o=i.mode==="single";let r,a,l,c;if(t===null)return;let u=!1;for(r=0,a=s.length;r<a;++r){if(l=+s[r],l===n){if(u=!0,i.all)continue;break}c=e.values[l],xt(c)&&(o||t===0||ce(t)===ce(c))&&(t+=c)}return!u&&!i.all?0:t}function Nd(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 l,c,u;for(l=0,c=r.length;l<c;++l)u=r[l],a[l]={[s]:u,[o]:e[u]};return a}function Ji(e,t){const n=e&&e.options.stacked;return n||n===void 0&&t.stack!==void 0}function zd(e,t,n){return\`\${e.id}.\${t.id}.\${n.stack||n.type}\`}function Fd(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 Hd(e,t,n){const i=e[t]||(e[t]={});return i[n]||(i[n]={})}function _r(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 wr(e,t){const{chart:n,_cachedMeta:i}=e,s=n._stacks||(n._stacks={}),{iScale:o,vScale:r,index:a}=i,l=o.axis,c=r.axis,u=zd(o,r,i),f=t.length;let p;for(let g=0;g<f;++g){const x=t[g],{[l]:y,[c]:v}=x,w=x._stacks||(x._stacks={});p=w[c]=Hd(s,u,y),p[a]=v,p._top=_r(p,r,!0,i.type),p._bottom=_r(p,r,!1,i.type);const k=p._visualValues||(p._visualValues={});k[a]=v}}function ts(e,t){const n=e.scales;return Object.keys(n).filter(i=>n[i].axis===t).shift()}function Bd(e,t){return Le(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Vd(e,t,n){return Le(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function pn(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 es=e=>e==="reset"||e==="none",Sr=(e,t)=>t?e:Object.assign({},e),Wd=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:Al(n,!0),values:null};class Il{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=Ji(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&&pn(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,n=this._cachedMeta,i=this.getDataset(),s=(f,p,g,x)=>f==="x"?p:f==="r"?x:g,o=n.xAxisID=R(i.xAxisID,ts(t,"x")),r=n.yAxisID=R(i.yAxisID,ts(t,"y")),a=n.rAxisID=R(i.rAxisID,ts(t,"r")),l=n.indexAxis,c=n.iAxisID=s(l,o,r,a),u=n.vAxisID=s(l,r,o,a);n.xScale=this.getScaleForId(o),n.yScale=this.getScaleForId(r),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(c),n.vScale=this.getScaleForId(u)}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&&sr(this._data,this),t._stacked&&pn(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),i=this._data;if(B(n)){const s=this._cachedMeta;this._data=Nd(n,s)}else if(i!==n){if(i){sr(i,this);const s=this._cachedMeta;pn(s),s._parsed=[]}n&&Object.isExtensible(n)&&xf(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=Ji(n.vScale,n),n.stack!==i.stack&&(s=!0,pn(n),n.stack=i.stack),this._resyncElements(t),(s||o!==n._stacked)&&(wr(this,n._parsed),n._stacked=Ji(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 l=t===0&&n===s.length?!0:i._sorted,c=t>0&&i._parsed[t-1],u,f,p;if(this._parsing===!1)i._parsed=s,i._sorted=!0,p=s;else{Q(s[t])?p=this.parseArrayData(i,s,t,n):B(s[t])?p=this.parseObjectData(i,s,t,n):p=this.parsePrimitiveData(i,s,t,n);const g=()=>f[a]===null||c&&f[a]<c[a];for(u=0;u<n;++u)i._parsed[u+t]=f=p[u],l&&(g()&&(l=!1),c=f);i._sorted=l}r&&wr(this,p)}parsePrimitiveData(t,n,i,s){const{iScale:o,vScale:r}=t,a=o.axis,l=r.axis,c=o.getLabels(),u=o===r,f=new Array(s);let p,g,x;for(p=0,g=s;p<g;++p)x=p+i,f[p]={[a]:u||o.parse(c[x],x),[l]:r.parse(n[x],x)};return f}parseArrayData(t,n,i,s){const{xScale:o,yScale:r}=t,a=new Array(s);let l,c,u,f;for(l=0,c=s;l<c;++l)u=l+i,f=n[u],a[l]={x:o.parse(f[0],u),y:r.parse(f[1],u)};return a}parseObjectData(t,n,i,s){const{xScale:o,yScale:r}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=new Array(s);let u,f,p,g;for(u=0,f=s;u<f;++u)p=u+i,g=n[p],c[u]={x:o.parse(wi(g,a),p),y:r.parse(wi(g,l),p)};return c}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:Al(s,!0),values:n._stacks[t.axis]._visualValues};return vr(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=vr(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),l=Wd(n,i,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:f}=Fd(a);let p,g;function x(){g=s[p];const y=g[a.axis];return!xt(g[t.axis])||u>y||f<y}for(p=0;p<r&&!(!x()&&(this.updateRangeFromParsed(c,t,g,l),o));++p);if(o){for(p=r-1;p>=0;--p)if(!x()){this.updateRangeFromParsed(c,t,g,l);break}}return c}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],xt(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=Rd(R(this.options.clip,Ld(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,l=this._drawCount||s.length-a,c=this.options.drawActiveElementsOnTop;let u;for(i.dataset&&i.dataset.draw(t,o,a,l),u=a;u<a+l;++u){const f=s[u];f.hidden||(f.active&&c?r.push(f):f.draw(t,o))}for(u=0;u<r.length;++u)r[u].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=Vd(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=Bd(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],l=this.enableOptionSharing&&Si(i);if(a)return Sr(a,l);const c=this.chart.config,u=c.datasetElementScopeKeys(this._type,t),f=s?[\`\${t}Hover\`,"hover",t,""]:[t,""],p=c.getOptionScopes(this.getDataset(),u),g=Object.keys(Y.elements[t]),x=()=>this.getContext(i,s,n),y=c.resolveNamedOptions(p,g,x,f);return y.$shared&&(y.$shared=l,o[r]=Object.freeze(Sr(y,l))),y}_resolveAnimations(t,n,i){const s=this.chart,o=this._cachedDataOpts,r=\`animation-\${n}\`,a=o[r];if(a)return a;let l;if(s.options.animation!==!1){const u=this.chart.config,f=u.datasetAnimationScopeKeys(this._type,n),p=u.getOptionScopes(this.getDataset(),f);l=u.createResolver(p,this.getContext(t,i,n))}const c=new Dl(s,l&&l.animations);return l&&l._cacheable&&(o[r]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||es(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){es(s)?Object.assign(t,i):this._resolveAnimations(n,s).update(t,i)}updateSharedOptions(t,n,i){t&&!es(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,l,c]of this._syncList)this[a](l,c);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 l=c=>{for(c.length+=n,a=c.length-1;a>=r;a--)c[a]=c[a-n]};for(l(o),a=t;a<r;++a)o[a]=new this.dataElementType;this._parsing&&l(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&&pn(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])}}class jd extends Il{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:l}=Sf(n,s,r);this._drawStart=a,this._drawCount=l,kf(n)&&(a=0,l=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=s;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(i,void 0,{animated:!r,options:c},t),this.updateElements(s,a,l,t)}updateElements(t,n,i,s){const o=s==="reset",{iScale:r,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:u,includeOptions:f}=this._getSharedOptions(n,s),p=r.axis,g=a.axis,{spanGaps:x,segment:y}=this.options,v=In(x)?x:Number.POSITIVE_INFINITY,w=this.chart._animationsDisabled||o||s==="none",k=n+i,C=t.length;let O=n>0&&this.getParsed(n-1);for(let T=0;T<C;++T){const D=t[T],P=w?D:{};if(T<n||T>=k){P.skip=!0;continue}const E=this.getParsed(T),A=V(E[g]),F=P[p]=r.getPixelForValue(E[p],T),L=P[g]=o||A?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,E,l):E[g],T);P.skip=isNaN(F)||isNaN(L)||A,P.stop=T>0&&Math.abs(E[p]-O[p])>v,y&&(P.parsed=E,P.raw=c.data[T]),f&&(P.options=u||this.resolveDataElementOptions(T,D.active?"active":s)),w||this.updateElement(D,T,P,s),O=E}}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()}}function we(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class bo{static override(t){Object.assign(bo.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return we()}parse(){return we()}format(){return we()}add(){return we()}diff(){return we()}startOf(){return we()}endOf(){return we()}}var Ud={_date:bo};function $d(e,t,n,i){const{controller:s,data:o,_sorted:r}=e,a=s._cachedMeta.iScale,l=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(a&&t===a.axis&&t!=="r"&&r&&o.length){const c=a._reversePixels?bf:Ee;if(i){if(s._sharedOptions){const u=o[0],f=typeof u.getRange=="function"&&u.getRange(t);if(f){const p=c(o,t,n-f),g=c(o,t,n+f);return{lo:p.lo,hi:g.hi}}}}else{const u=c(o,t,n);if(l){const{vScale:f}=s._cachedMeta,{_parsed:p}=e,g=p.slice(0,u.lo+1).reverse().findIndex(y=>!V(y[f.axis]));u.lo-=Math.max(0,g);const x=p.slice(u.hi).findIndex(y=>!V(y[f.axis]));u.hi+=Math.max(0,x)}return u}}return{lo:0,hi:o.length-1}}function Ni(e,t,n,i,s){const o=e.getSortedVisibleDatasetMetas(),r=n[t];for(let a=0,l=o.length;a<l;++a){const{index:c,data:u}=o[a],{lo:f,hi:p}=$d(o[a],t,r,s);for(let g=f;g<=p;++g){const x=u[g];x.skip||i(x,c,g)}}}function Yd(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 ns(e,t,n,i,s){const o=[];return!s&&!e.isPointInArea(t)||Ni(e,n,t,function(a,l,c){!s&&!Je(a,e.chartArea,0)||a.inRange(t.x,t.y,i)&&o.push({element:a,datasetIndex:l,index:c})},!0),o}function Xd(e,t,n,i){let s=[];function o(r,a,l){const{startAngle:c,endAngle:u}=r.getProps(["startAngle","endAngle"],i),{angle:f}=pf(r,{x:t.x,y:t.y});pl(f,c,u)&&s.push({element:r,datasetIndex:a,index:l})}return Ni(e,n,t,o),s}function qd(e,t,n,i,s,o){let r=[];const a=Yd(n);let l=Number.POSITIVE_INFINITY;function c(u,f,p){const g=u.inRange(t.x,t.y,s);if(i&&!g)return;const x=u.getCenterPoint(s);if(!(!!o||e.isPointInArea(x))&&!g)return;const v=a(t,x);v<l?(r=[{element:u,datasetIndex:f,index:p}],l=v):v===l&&r.push({element:u,datasetIndex:f,index:p})}return Ni(e,n,t,c),r}function is(e,t,n,i,s,o){return!o&&!e.isPointInArea(t)?[]:n==="r"&&!i?Xd(e,t,n,s):qd(e,t,n,i,s,o)}function kr(e,t,n,i,s){const o=[],r=n==="x"?"inXRange":"inYRange";let a=!1;return Ni(e,n,t,(l,c,u)=>{l[r]&&l[r](t[n],s)&&(o.push({element:l,datasetIndex:c,index:u}),a=a||l.inRange(t.x,t.y,s))}),i&&!a?[]:o}var Gd={modes:{index(e,t,n,i){const s=It(t,e),o=n.axis||"x",r=n.includeInvisible||!1,a=n.intersect?ns(e,s,o,i,r):is(e,s,o,!1,i,r),l=[];return a.length?(e.getSortedVisibleDatasetMetas().forEach(c=>{const u=a[0].index,f=c.data[u];f&&!f.skip&&l.push({element:f,datasetIndex:c.index,index:u})}),l):[]},dataset(e,t,n,i){const s=It(t,e),o=n.axis||"xy",r=n.includeInvisible||!1;let a=n.intersect?ns(e,s,o,i,r):is(e,s,o,!1,i,r);if(a.length>0){const l=a[0].datasetIndex,c=e.getDatasetMeta(l).data;a=[];for(let u=0;u<c.length;++u)a.push({element:c[u],datasetIndex:l,index:u})}return a},point(e,t,n,i){const s=It(t,e),o=n.axis||"xy",r=n.includeInvisible||!1;return ns(e,s,o,i,r)},nearest(e,t,n,i){const s=It(t,e),o=n.axis||"xy",r=n.includeInvisible||!1;return is(e,s,o,n.intersect,i,r)},x(e,t,n,i){const s=It(t,e);return kr(e,s,"x",n.intersect,i)},y(e,t,n,i){const s=It(t,e);return kr(e,s,"y",n.intersect,i)}}};const Ll=["left","top","right","bottom"];function gn(e,t){return e.filter(n=>n.pos===t)}function Tr(e,t){return e.filter(n=>Ll.indexOf(n.pos)===-1&&n.box.axis===t)}function mn(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 Kd(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 Zd(e){const t={};for(const n of e){const{stack:i,pos:s,stackWeight:o}=n;if(!i||!Ll.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 Qd(e,t){const n=Zd(e),{vBoxMaxWidth:i,hBoxMaxHeight:s}=t;let o,r,a;for(o=0,r=e.length;o<r;++o){a=e[o];const{fullSize:l}=a.box,c=n[a.stack],u=c&&a.stackWeight/c.weight;a.horizontal?(a.width=u?u*i:l&&t.availableWidth,a.height=s):(a.width=i,a.height=u?u*s:l&&t.availableHeight)}return n}function Jd(e){const t=Kd(e),n=mn(t.filter(c=>c.box.fullSize),!0),i=mn(gn(t,"left"),!0),s=mn(gn(t,"right")),o=mn(gn(t,"top"),!0),r=mn(gn(t,"bottom")),a=Tr(t,"x"),l=Tr(t,"y");return{fullSize:n,leftAndTop:i.concat(o),rightAndBottom:s.concat(l).concat(r).concat(a),chartArea:gn(t,"chartArea"),vertical:i.concat(s).concat(l),horizontal:o.concat(r).concat(a)}}function Mr(e,t,n,i){return Math.max(e[n],t[n])+Math.max(e[i],t[i])}function Rl(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 tp(e,t,n,i){const{pos:s,box:o}=n,r=e.maxPadding;if(!B(s)){n.size&&(e[s]-=n.size);const f=i[n.stack]||{size:0,count:1};f.size=Math.max(f.size,n.horizontal?o.height:o.width),n.size=f.size/f.count,e[s]+=n.size}o.getPadding&&Rl(r,o.getPadding());const a=Math.max(0,t.outerWidth-Mr(r,e,"left","right")),l=Math.max(0,t.outerHeight-Mr(r,e,"top","bottom")),c=a!==e.w,u=l!==e.h;return e.w=a,e.h=l,n.horizontal?{same:c,other:u}:{same:u,other:c}}function ep(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 np(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 wn(e,t,n,i){const s=[];let o,r,a,l,c,u;for(o=0,r=e.length,c=0;o<r;++o){a=e[o],l=a.box,l.update(a.width||t.w,a.height||t.h,np(a.horizontal,t));const{same:f,other:p}=tp(t,n,a,i);c|=f&&s.length,u=u||p,l.fullSize||s.push(a)}return c&&wn(s,t,n,i)||u}function ii(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 Er(e,t,n,i){const s=n.padding;let{x:o,y:r}=t;for(const a of e){const l=a.box,c=i[a.stack]||{placed:0,weight:1},u=a.stackWeight/c.weight||1;if(a.horizontal){const f=t.w*u,p=c.size||l.height;Si(c.start)&&(r=c.start),l.fullSize?ii(l,s.left,r,n.outerWidth-s.right-s.left,p):ii(l,t.left+c.placed,r,f,p),c.start=r,c.placed+=f,r=l.bottom}else{const f=t.h*u,p=c.size||l.width;Si(c.start)&&(o=c.start),l.fullSize?ii(l,o,s.top,p,n.outerHeight-s.bottom-s.top):ii(l,o,t.top+c.placed,p,f),c.start=o,c.placed+=f,o=l.right}}t.x=o,t.y=r}var ee={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=Mt(e.options.layout.padding),o=Math.max(t-s.width,0),r=Math.max(n-s.height,0),a=Jd(e.boxes),l=a.vertical,c=a.horizontal;z(e.boxes,y=>{typeof y.beforeLayout=="function"&&y.beforeLayout()});const u=l.reduce((y,v)=>v.box.options&&v.box.options.display===!1?y:y+1,0)||1,f=Object.freeze({outerWidth:t,outerHeight:n,padding:s,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/u,hBoxMaxHeight:r/2}),p=Object.assign({},s);Rl(p,Mt(i));const g=Object.assign({maxPadding:p,w:o,h:r,x:s.left,y:s.top},s),x=Qd(l.concat(c),f);wn(a.fullSize,g,f,x),wn(l,g,f,x),wn(c,g,f,x)&&wn(l,g,f,x),ep(g),Er(a.leftAndTop,g,f,x),g.x+=g.w,g.y+=g.h,Er(a.rightAndBottom,g,f,x),e.chartArea={left:g.left,top:g.top,right:g.left+g.w,bottom:g.top+g.h,height:g.h,width:g.w},z(a.chartArea,y=>{const v=y.box;Object.assign(v,e.chartArea),v.update(g.w,g.h,{left:0,top:0,right:0,bottom:0})})}};class Nl{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 ip extends Nl{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const fi="$chartjs",sp={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Cr=e=>e===null||e==="";function op(e,t){const n=e.style,i=e.getAttribute("height"),s=e.getAttribute("width");if(e[fi]={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",Cr(s)){const o=pr(e,"width");o!==void 0&&(e.width=o)}if(Cr(i))if(e.style.height==="")e.height=e.width/(t||2);else{const o=pr(e,"height");o!==void 0&&(e.height=o)}return e}const zl=pd?{passive:!0}:!1;function rp(e,t,n){e&&e.addEventListener(t,n,zl)}function ap(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,zl)}function lp(e,t){const n=sp[e.type]||e.type,{x:i,y:s}=It(e,t);return{type:n,chart:t,native:e,x:i!==void 0?i:null,y:s!==void 0?s:null}}function Ei(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function cp(e,t,n){const i=e.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||Ei(a.addedNodes,i),r=r&&!Ei(a.removedNodes,i);r&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}function up(e,t,n){const i=e.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||Ei(a.removedNodes,i),r=r&&!Ei(a.addedNodes,i);r&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}const Ln=new Map;let Or=0;function Fl(){const e=window.devicePixelRatio;e!==Or&&(Or=e,Ln.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function hp(e,t){Ln.size||window.addEventListener("resize",Fl),Ln.set(e,t)}function fp(e){Ln.delete(e),Ln.size||window.removeEventListener("resize",Fl)}function dp(e,t,n){const i=e.canvas,s=i&&mo(i);if(!s)return;const o=bl((a,l)=>{const c=s.clientWidth;n(a,l),c<s.clientWidth&&n()},window),r=new ResizeObserver(a=>{const l=a[0],c=l.contentRect.width,u=l.contentRect.height;c===0&&u===0||o(c,u)});return r.observe(s),hp(e,o),r}function ss(e,t,n){n&&n.disconnect(),t==="resize"&&fp(e)}function pp(e,t,n){const i=e.canvas,s=bl(o=>{e.ctx!==null&&n(lp(o,e))},e);return rp(i,t,s),s}class gp extends Nl{acquireContext(t,n){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(op(t,n),i):null}releaseContext(t){const n=t.canvas;if(!n[fi])return!1;const i=n[fi].initial;["height","width"].forEach(o=>{const r=i[o];V(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[fi],!0}addEventListener(t,n,i){this.removeEventListener(t,n);const s=t.$proxies||(t.$proxies={}),r={attach:cp,detach:up,resize:dp}[n]||pp;s[n]=r(t,n,i)}removeEventListener(t,n){const i=t.$proxies||(t.$proxies={}),s=i[n];if(!s)return;({attach:ss,detach:ss,resize:ss}[n]||ap)(t,n,s),i[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,i,s){return dd(t,n,i,s)}isAttached(t){const n=t&&mo(t);return!!(n&&n.isConnected)}}function mp(e){return!go()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?ip:gp}class sn{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 In(this.x)&&In(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 bp(e,t){const n=e.options.ticks,i=yp(e),s=Math.min(n.maxTicksLimit||i,i),o=n.major.enabled?vp(t):[],r=o.length,a=o[0],l=o[r-1],c=[];if(r>s)return _p(t,c,o,r/s),c;const u=xp(o,t,s);if(r>0){let f,p;const g=r>1?Math.round((l-a)/(r-1)):null;for(si(t,c,u,V(g)?0:a-g,a),f=0,p=r-1;f<p;f++)si(t,c,u,o[f],o[f+1]);return si(t,c,u,l,V(g)?t.length:l+g),c}return si(t,c,u),c}function yp(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 xp(e,t,n){const i=wp(e),s=t.length/n;if(!i)return Math.max(s,1);const o=cf(i);for(let r=0,a=o.length-1;r<a;r++){const l=o[r];if(l>s)return l}return Math.max(s,1)}function vp(e){const t=[];let n,i;for(n=0,i=e.length;n<i;n++)e[n].major&&t.push(n);return t}function _p(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 si(e,t,n,i,s){const o=R(i,0),r=Math.min(R(s,e.length),e.length);let a=0,l,c,u;for(n=Math.ceil(n),s&&(l=s-i,n=l/Math.floor(l/n)),u=o;u<0;)a++,u=Math.round(o+a*n);for(c=Math.max(o,0);c<r;c++)c===u&&(t.push(e[c]),a++,u=Math.round(o+a*n))}function wp(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 Sp=e=>e==="left"?"right":e==="right"?"left":e,Pr=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,Dr=(e,t)=>Math.min(t||e,e);function Ar(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 kp(e,t,n){const i=e.ticks.length,s=Math.min(t,i-1),o=e._startPixel,r=e._endPixel,a=1e-6;let l=e.getPixelForTick(s),c;if(!(n&&(i===1?c=Math.max(l-o,r-l):t===0?c=(e.getPixelForTick(1)-l)/2:c=(l-e.getPixelForTick(s-1))/2,l+=s<t?c:-c,l<o-a||l>r+a)))return l}function Tp(e,t){z(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 bn(e){return e.drawTicks?e.tickLength:0}function Ir(e,t){if(!e.display)return 0;const n=ct(e.font,t),i=Mt(e.padding);return(Q(e.text)?e.text.length:1)*n.lineHeight+i.height}function Mp(e,t){return Le(e,{scale:t,type:"scale"})}function Ep(e,t,n){return Le(e,{tick:n,index:t,type:"tick"})}function Cp(e,t,n){let i=yl(e);return(n&&t!=="right"||!n&&t==="right")&&(i=Sp(i)),i}function Op(e,t,n,i){const{top:s,left:o,bottom:r,right:a,chart:l}=e,{chartArea:c,scales:u}=l;let f=0,p,g,x;const y=r-s,v=a-o;if(e.isHorizontal()){if(g=ft(i,o,a),B(n)){const w=Object.keys(n)[0],k=n[w];x=u[w].getPixelForValue(k)+y-t}else n==="center"?x=(c.bottom+c.top)/2+y-t:x=Pr(e,n,t);p=a-o}else{if(B(n)){const w=Object.keys(n)[0],k=n[w];g=u[w].getPixelForValue(k)-v+t}else n==="center"?g=(c.left+c.right)/2-v+t:g=Pr(e,n,t);x=ft(i,r,s),f=n==="left"?-wt:wt}return{titleX:g,titleY:x,maxWidth:p,rotation:f}}class on extends sn{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=Pt(t,Number.POSITIVE_INFINITY),n=Pt(n,Number.NEGATIVE_INFINITY),i=Pt(i,Number.POSITIVE_INFINITY),s=Pt(s,Number.NEGATIVE_INFINITY),{min:Pt(t,i),max:Pt(n,s),minDefined:xt(t),maxDefined:xt(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 l=0,c=a.length;l<c;++l)r=a[l].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:Pt(n,Pt(i,n)),max:Pt(i,Pt(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(){I(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=$f(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a<this.ticks.length;this._convertTicksToLabels(l?Ar(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),r.display&&(r.autoSkip||r.source==="auto")&&(this.ticks=bp(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&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(){I(this.options.afterUpdate,[this])}beforeSetDimensions(){I(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(){I(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),I(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){I(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=I(n.callback,[o.value,i,t],this)}afterTickToLabelConversion(){I(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){I(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,n=t.ticks,i=Dr(this.ticks.length,t.ticks.maxTicksLimit),s=n.minRotation||0,o=n.maxRotation;let r=s,a,l,c;if(!this._isVisible()||!n.display||s>=o||i<=1||!this.isHorizontal()){this.labelRotation=s;return}const u=this._getLabelSizes(),f=u.widest.width,p=u.highest.height,g=yt(this.chart.width-f,0,this.maxWidth);a=t.offset?this.maxWidth/i:g/(i-1),f+6>a&&(a=g/(i-(t.offset?.5:1)),l=this.maxHeight-bn(t.grid)-n.padding-Ir(t.title,this.chart.options.font),c=Math.sqrt(f*f+p*p),r=df(Math.min(Math.asin(yt((u.highest.height+6)/a,-1,1)),Math.asin(yt(l/c,-1,1))-Math.asin(yt(p/c,-1,1)))),r=Math.max(s,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){I(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){I(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 l=Ir(s,n.options.font);if(a?(t.width=this.maxWidth,t.height=bn(o)+l):(t.height=this.maxHeight,t.width=bn(o)+l),i.display&&this.ticks.length){const{first:c,last:u,widest:f,highest:p}=this._getLabelSizes(),g=i.padding*2,x=Me(this.labelRotation),y=Math.cos(x),v=Math.sin(x);if(a){const w=i.mirror?0:v*f.width+y*p.height;t.height=Math.min(this.maxHeight,t.height+w+g)}else{const w=i.mirror?0:y*f.width+v*p.height;t.width=Math.min(this.maxWidth,t.width+w+g)}this._calculatePadding(c,u,v,y)}}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,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const u=this.getPixelForTick(0)-this.left,f=this.right-this.getPixelForTick(this.ticks.length-1);let p=0,g=0;l?c?(p=s*t.width,g=i*n.height):(p=i*t.height,g=s*n.width):o==="start"?g=n.width:o==="end"?p=t.width:o!=="inner"&&(p=t.width/2,g=n.width/2),this.paddingLeft=Math.max((p-u+r)*this.width/(this.width-u),0),this.paddingRight=Math.max((g-f+r)*this.width/(this.width-f),0)}else{let u=n.height/2,f=t.height/2;o==="start"?(u=0,f=t.height):o==="end"&&(u=n.height,f=0),this.paddingTop=u+r,this.paddingBottom=f+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(){I(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++)V(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=Ar(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=[],l=Math.floor(n/Dr(n,i));let c=0,u=0,f,p,g,x,y,v,w,k,C,O,T;for(f=0;f<n;f+=l){if(x=t[f].label,y=this._resolveTickFontOptions(f),s.font=v=y.string,w=o[v]=o[v]||{data:{},gc:[]},k=y.lineHeight,C=O=0,!V(x)&&!Q(x))C=cr(s,w.data,w.gc,C,x),O=k;else if(Q(x))for(p=0,g=x.length;p<g;++p)T=x[p],!V(T)&&!Q(T)&&(C=cr(s,w.data,w.gc,C,T),O+=k);r.push(C),a.push(O),c=Math.max(C,c),u=Math.max(O,u)}Tp(o,n);const D=r.indexOf(c),P=a.indexOf(u),E=A=>({width:r[A]||0,height:a[A]||0});return{first:E(0),last:E(n-1),widest:E(D),highest:E(P),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 mf(this._alignToPixels?_e(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=Ep(this.getContext(),t,i))}return this.$context||(this.$context=Mp(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,n=Me(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,l=o?o.highest.height+r:0;return this.isHorizontal()?l*i>a*s?a/i:l/s:l*s<a*i?l/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,l=o.offset,c=this.isHorizontal(),f=this.ticks.length+(l?1:0),p=bn(o),g=[],x=a.setContext(this.getContext()),y=x.display?x.width:0,v=y/2,w=function(q){return _e(i,q,y)};let k,C,O,T,D,P,E,A,F,L,H,K;if(r==="top")k=w(this.bottom),P=this.bottom-p,A=k-v,L=w(t.top)+v,K=t.bottom;else if(r==="bottom")k=w(this.top),L=t.top,K=w(t.bottom)-v,P=k+v,A=this.top+p;else if(r==="left")k=w(this.right),D=this.right-p,E=k-v,F=w(t.left)+v,H=t.right;else if(r==="right")k=w(this.left),F=t.left,H=w(t.right)-v,D=k+v,E=this.left+p;else if(n==="x"){if(r==="center")k=w((t.top+t.bottom)/2+.5);else if(B(r)){const q=Object.keys(r)[0],nt=r[q];k=w(this.chart.scales[q].getPixelForValue(nt))}L=t.top,K=t.bottom,P=k+v,A=P+p}else if(n==="y"){if(r==="center")k=w((t.left+t.right)/2);else if(B(r)){const q=Object.keys(r)[0],nt=r[q];k=w(this.chart.scales[q].getPixelForValue(nt))}D=k-v,E=D-p,F=t.left,H=t.right}const et=R(s.ticks.maxTicksLimit,f),j=Math.max(1,Math.ceil(f/et));for(C=0;C<f;C+=j){const q=this.getContext(C),nt=o.setContext(q),Ne=a.setContext(q),pe=nt.lineWidth,qt=nt.color,ze=Ne.dash||[],dt=Ne.dashOffset,ge=nt.tickWidth,vt=nt.tickColor,me=nt.tickBorderDash||[],Ht=nt.tickBorderDashOffset;O=kp(this,C,l),O!==void 0&&(T=_e(i,O,pe),c?D=E=F=H=T:P=A=L=K=T,g.push({tx1:D,ty1:P,tx2:E,ty2:A,x1:F,y1:L,x2:H,y2:K,width:pe,color:qt,borderDash:ze,borderDashOffset:dt,tickWidth:ge,tickColor:vt,tickBorderDash:me,tickBorderDashOffset:Ht}))}return this._ticksLength=f,this._borderValue=k,g}_computeLabelItems(t){const n=this.axis,i=this.options,{position:s,ticks:o}=i,r=this.isHorizontal(),a=this.ticks,{align:l,crossAlign:c,padding:u,mirror:f}=o,p=bn(i.grid),g=p+u,x=f?-u:g,y=-Me(this.labelRotation),v=[];let w,k,C,O,T,D,P,E,A,F,L,H,K="middle";if(s==="top")D=this.bottom-x,P=this._getXAxisLabelAlignment();else if(s==="bottom")D=this.top+x,P=this._getXAxisLabelAlignment();else if(s==="left"){const j=this._getYAxisLabelAlignment(p);P=j.textAlign,T=j.x}else if(s==="right"){const j=this._getYAxisLabelAlignment(p);P=j.textAlign,T=j.x}else if(n==="x"){if(s==="center")D=(t.top+t.bottom)/2+g;else if(B(s)){const j=Object.keys(s)[0],q=s[j];D=this.chart.scales[j].getPixelForValue(q)+g}P=this._getXAxisLabelAlignment()}else if(n==="y"){if(s==="center")T=(t.left+t.right)/2-g;else if(B(s)){const j=Object.keys(s)[0],q=s[j];T=this.chart.scales[j].getPixelForValue(q)}P=this._getYAxisLabelAlignment(p).textAlign}n==="y"&&(l==="start"?K="top":l==="end"&&(K="bottom"));const et=this._getLabelSizes();for(w=0,k=a.length;w<k;++w){C=a[w],O=C.label;const j=o.setContext(this.getContext(w));E=this.getPixelForTick(w)+o.labelOffset,A=this._resolveTickFontOptions(w),F=A.lineHeight,L=Q(O)?O.length:1;const q=L/2,nt=j.color,Ne=j.textStrokeColor,pe=j.textStrokeWidth;let qt=P;r?(T=E,P==="inner"&&(w===k-1?qt=this.options.reverse?"left":"right":w===0?qt=this.options.reverse?"right":"left":qt="center"),s==="top"?c==="near"||y!==0?H=-L*F+F/2:c==="center"?H=-et.highest.height/2-q*F+F:H=-et.highest.height+F/2:c==="near"||y!==0?H=F/2:c==="center"?H=et.highest.height/2-q*F:H=et.highest.height-L*F,f&&(H*=-1),y!==0&&!j.showLabelBackdrop&&(T+=F/2*Math.sin(y))):(D=E,H=(1-L)*F/2);let ze;if(j.showLabelBackdrop){const dt=Mt(j.backdropPadding),ge=et.heights[w],vt=et.widths[w];let me=H-dt.top,Ht=0-dt.left;switch(K){case"middle":me-=ge/2;break;case"bottom":me-=ge;break}switch(P){case"center":Ht-=vt/2;break;case"right":Ht-=vt;break;case"inner":w===k-1?Ht-=vt:w>0&&(Ht-=vt/2);break}ze={left:Ht,top:me,width:vt+dt.width,height:ge+dt.height,color:j.backdropColor}}v.push({label:O,font:A,textOffset:H,options:{rotation:y,color:nt,strokeColor:Ne,strokeWidth:pe,textAlign:qt,textBaseline:K,translation:[T,D],backdrop:ze}})}return v}_getXAxisLabelAlignment(){const{position:t,ticks:n}=this.options;if(-Me(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,l=r.widest.width;let c,u;return n==="left"?s?(u=this.right+o,i==="near"?c="left":i==="center"?(c="center",u+=l/2):(c="right",u+=l)):(u=this.right-a,i==="near"?c="right":i==="center"?(c="center",u-=l/2):(c="left",u=this.left)):n==="right"?s?(u=this.left+o,i==="near"?c="right":i==="center"?(c="center",u-=l/2):(c="left",u-=l)):(u=this.left+a,i==="near"?c="left":i==="center"?(c="center",u+=l/2):(c="right",u=this.right)):c="right",{textAlign:c,x:u}}_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=(l,c,u)=>{!u.width||!u.color||(i.save(),i.lineWidth=u.width,i.strokeStyle=u.color,i.setLineDash(u.borderDash||[]),i.lineDashOffset=u.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(n.display)for(o=0,r=s.length;o<r;++o){const l=s[o];n.drawOnChartArea&&a({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),n.drawTicks&&a({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.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,l=this._borderValue;let c,u,f,p;this.isHorizontal()?(c=_e(t,this.left,r)-r/2,u=_e(t,this.right,a)+a/2,f=p=l):(f=_e(t,this.top,r)-r/2,p=_e(t,this.bottom,a)+a/2,c=u=l),n.save(),n.lineWidth=o.width,n.strokeStyle=o.color,n.beginPath(),n.moveTo(c,f),n.lineTo(u,p),n.stroke(),n.restore()}drawLabels(t){if(!this.options.ticks.display)return;const i=this.ctx,s=this._computeLabelArea();s&&co(i,s);const o=this.getLabelItems(t);for(const r of o){const a=r.options,l=r.font,c=r.label,u=r.textOffset;Ti(i,c,0,u,l,a)}s&&uo(i)}drawTitle(){const{ctx:t,options:{position:n,title:i,reverse:s}}=this;if(!i.display)return;const o=ct(i.font),r=Mt(i.padding),a=i.align;let l=o.lineHeight/2;n==="bottom"||n==="center"||B(n)?(l+=r.bottom,Q(i.text)&&(l+=o.lineHeight*(i.text.length-1))):l+=r.top;const{titleX:c,titleY:u,maxWidth:f,rotation:p}=Op(this,l,n,a);Ti(t,i.text,0,0,o,{color:i.color,maxWidth:f,rotation:p,textAlign:Cp(a,n,s),textBaseline:"middle",translation:[c,u]})}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=R(t.grid&&t.grid.z,-1),s=R(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==on.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 ct(n.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class oi{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;Ap(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,Pp(t,r,i),this.override&&Y.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 Y[s]&&(delete Y[s][i],this.override&&delete Ae[i])}}function Pp(e,t,n){const i=An(Object.create(null),[n?Y.get(n):{},Y.get(t),e.defaults]);Y.set(t,i),e.defaultRoutes&&Dp(t,e.defaultRoutes),e.descriptors&&Y.describe(t,e.descriptors)}function Dp(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(),l=r.join(".");Y.route(o,s,l,a)})}function Ap(e){return"id"in e&&"defaults"in e}class Ip{constructor(){this.controllers=new oi(Il,"datasets",!0),this.elements=new oi(sn,"elements"),this.plugins=new oi(Object,"plugins"),this.scales=new oi(on,"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):z(s,r=>{const a=i||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,n,i){const s=ro(t);I(i["before"+s],[],i),n[t](i),I(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 At=new Ip;class Lp{constructor(){this._init=[]}notify(t,n,i,s){n==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const o=s?this._descriptors(t).filter(s):this._descriptors(t),r=this._notify(o,t,n,i);return n==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall")),r}_notify(t,n,i,s){s=s||{};for(const o of t){const r=o.plugin,a=r[i],l=[n,s,o.options];if(I(a,l,r)===!1&&s.cancelable)return!1}return!0}invalidate(){V(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=R(i.options&&i.options.plugins,{}),o=Rp(i);return s===!1&&!n?[]:zp(t,o,s,n)}_notifyStateChanges(t){const n=this._oldCache||[],i=this._cache,s=(o,r)=>o.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(s(n,i),t,"stop"),this._notify(s(i,n),t,"start")}}function Rp(e){const t={},n=[],i=Object.keys(At.plugins.items);for(let o=0;o<i.length;o++)n.push(At.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 Np(e,t){return!t&&e===!1?null:e===!0?{}:e}function zp(e,{plugins:t,localIds:n},i,s){const o=[],r=e.getContext();for(const a of t){const l=a.id,c=Np(i[l],s);c!==null&&o.push({plugin:a,options:Fp(e.config,{plugin:a,local:n[l]},c,r)})}return o}function Fp(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 Rs(e,t){const n=Y.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||"x"}function Hp(e,t){let n=e;return e==="_index_"?n=t:e==="_value_"&&(n=t==="x"?"y":"x"),n}function Bp(e,t){return e===t?"_index_":"_value_"}function Lr(e){if(e==="x"||e==="y"||e==="r")return e}function Vp(e){if(e==="top"||e==="bottom")return"x";if(e==="left"||e==="right")return"y"}function Ns(e,...t){if(Lr(e))return e;for(const n of t){const i=n.axis||Vp(n.position)||e.length>1&&Lr(e[0].toLowerCase());if(i)return i}throw new Error(\`Cannot determine type of '\${e}' axis. Please provide 'axis' or 'position' option.\`)}function Rr(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function Wp(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 Rr(e,"x",n[0])||Rr(e,"y",n[0])}return{}}function jp(e,t){const n=Ae[e.type]||{scales:{}},i=t.scales||{},s=Rs(e.type,t),o=Object.create(null);return Object.keys(i).forEach(r=>{const a=i[r];if(!B(a))return console.error(\`Invalid scale configuration for scale: \${r}\`);if(a._proxy)return console.warn(\`Ignoring resolver passed as options for scale: \${r}\`);const l=Ns(r,a,Wp(r,e),Y.scales[a.type]),c=Bp(l,s),u=n.scales||{};o[r]=kn(Object.create(null),[{axis:l},a,u[l],u[c]])}),e.data.datasets.forEach(r=>{const a=r.type||e.type,l=r.indexAxis||Rs(a,t),u=(Ae[a]||{}).scales||{};Object.keys(u).forEach(f=>{const p=Hp(f,l),g=r[p+"AxisID"]||p;o[g]=o[g]||Object.create(null),kn(o[g],[{axis:p},i[g],u[f]])})}),Object.keys(o).forEach(r=>{const a=o[r];kn(a,[Y.scales[a.type],Y.scale])}),o}function Hl(e){const t=e.options||(e.options={});t.plugins=R(t.plugins,{}),t.scales=jp(e,t)}function Bl(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function Up(e){return e=e||{},e.data=Bl(e.data),Hl(e),e}const Nr=new Map,Vl=new Set;function ri(e,t){let n=Nr.get(e);return n||(n=t(),Nr.set(e,n),Vl.add(n)),n}const yn=(e,t,n)=>{const i=wi(t,n);i!==void 0&&e.add(i)};class $p{constructor(t){this._config=Up(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=Bl(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(),Hl(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return ri(t,()=>[[\`datasets.\${t}\`,""]])}datasetAnimationScopeKeys(t,n){return ri(\`\${t}.transition.\${n}\`,()=>[[\`datasets.\${t}.transitions.\${n}\`,\`transitions.\${n}\`],[\`datasets.\${t}\`,""]])}datasetElementScopeKeys(t,n){return ri(\`\${t}-\${n}\`,()=>[[\`datasets.\${t}.elements.\${n}\`,\`datasets.\${t}\`,\`elements.\${n}\`,""]])}pluginScopeKeys(t){const n=t.id,i=this.type;return ri(\`\${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 l=new Set;n.forEach(u=>{t&&(l.add(t),u.forEach(f=>yn(l,t,f))),u.forEach(f=>yn(l,s,f)),u.forEach(f=>yn(l,Ae[o]||{},f)),u.forEach(f=>yn(l,Y,f)),u.forEach(f=>yn(l,As,f))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Vl.has(n)&&r.set(n,c),c}chartOptionScopes(){const{options:t,type:n}=this;return[t,Ae[n]||{},Y.datasets[n]||{},{type:n},Y,As]}resolveNamedOptions(t,n,i,s=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=zr(this._resolverCache,t,s);let l=r;if(Xp(r,n)){o.$shared=!1,i=le(i)?i():i;const c=this.createResolver(t,i,a);l=tn(r,i,c)}for(const c of n)o[c]=l[c];return o}createResolver(t,n,i=[""],s){const{resolver:o}=zr(this._resolverCache,t,i);return B(n)?tn(o,n,void 0,s):o}}function zr(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:ho(t,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},i.set(s,o)),o}const Yp=e=>B(e)&&Object.getOwnPropertyNames(e).some(t=>le(e[t]));function Xp(e,t){const{isScriptable:n,isIndexable:i}=Sl(e);for(const s of t){const o=n(s),r=i(s),a=(r||o)&&e[s];if(o&&(le(a)||Yp(a))||r&&Q(a))return!0}return!1}var qp="4.5.0";const Gp=["top","bottom","left","right","chartArea"];function Fr(e,t){return e==="top"||e==="bottom"||Gp.indexOf(e)===-1&&t==="x"}function Hr(e,t){return function(n,i){return n[e]===i[e]?n[t]-i[t]:n[e]-i[e]}}function Br(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),I(n&&n.onComplete,[e],t)}function Kp(e){const t=e.chart,n=t.options.animation;I(n&&n.onProgress,[e],t)}function Wl(e){return go()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const di={},Vr=e=>{const t=Wl(e);return Object.values(di).filter(n=>n.canvas===t).pop()};function Zp(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 Qp(e,t,n,i){return!n||e.type==="mouseout"?null:i?t:e}class zs{static defaults=Y;static instances=di;static overrides=Ae;static registry=At;static version=qp;static getChart=Vr;static register(...t){At.add(...t),Wr()}static unregister(...t){At.remove(...t),Wr()}constructor(t,n){const i=this.config=new $p(n),s=Wl(t),o=Vr(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||mp(s)),this.platform.updateConfig(i);const a=this.platform.acquireContext(s,r.aspectRatio),l=a&&a.canvas,c=l&&l.height,u=l&&l.width;if(this.id=Jh(),this.ctx=a,this.canvas=l,this.width=u,this.height=c,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Lp,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=_f(f=>this.update(f),r.resizeDelay||0),this._dataChanges=[],di[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}jt.listen(this,"complete",Br),jt.listen(this,"progress",Kp),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:i,height:s,_aspectRatio:o}=this;return V(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 At}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():dr(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return ur(this.canvas,this.ctx),this}stop(){return jt.stop(this),this}resize(t,n){jt.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(),l=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,dr(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),I(i.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};z(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],l=Ns(r,a),c=l==="r",u=l==="x";return{options:a,dposition:c?"chartArea":u?"bottom":"left",dtype:c?"radialLinear":u?"category":"linear"}}))),z(o,r=>{const a=r.options,l=a.id,c=Ns(l,a),u=R(a.type,r.dtype);(a.position===void 0||Fr(a.position,c)!==Fr(r.dposition))&&(a.position=r.dposition),s[l]=!0;let f=null;if(l in i&&i[l].type===u)f=i[l];else{const p=At.getScale(u);f=new p({id:l,type:u,ctx:this.ctx,chart:this}),i[f.id]=f}f.init(a,t)}),z(s,(r,a)=>{r||delete i[a]}),z(i,r=>{ee.configure(this,r,r.options),ee.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(Hr("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||Rs(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 l=At.getController(a),{datasetElementType:c,dataElementType:u}=Y.datasets[a];Object.assign(l,{dataElementType:At.getElement(u),datasetElementType:c&&At.getElement(c)}),r.controller=new l(this,i),t.push(r.controller)}}return this._updateMetasets(),t}_resetElements(){z(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 c=0,u=this.data.datasets.length;c<u;c++){const{controller:f}=this.getDatasetMeta(c),p=!s&&o.indexOf(f)===-1;f.buildOrUpdateElements(p),r=Math.max(+f.getMaxOverflow(),r)}r=this._minPadding=i.layout.autoPadding?r:0,this._updateLayout(r),s||z(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Hr("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){z(this.scales,t=>{ee.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!tr(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;Zp(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(!tr(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;ee.update(this,this.width,this.height,t);const n=this.chartArea,i=n.width<=0||n.height<=0;this._layers=[],z(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,le(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&&(jt.has(this)?this.attached&&!jt.running(this)&&jt.start(this):(this.draw(),Br({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=Cd(this,t);this.notifyPlugins("beforeDatasetDraw",i)!==!1&&(s&&co(n,s),t.controller.draw(),s&&uo(n),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(t){return Je(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,i,s){const o=Gd.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=Le(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);Si(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(),jt.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(),ur(t,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete di[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)};z(this.options.events,o=>i(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,n=this.platform,i=(l,c)=>{n.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(n.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let r;const a=()=>{s("attach",a),this.attached=!0,this.resize(),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(){z(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},z(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,l;for(n==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=t.length;a<l;++a){r=t[a];const c=r&&this.getDatasetMeta(r.datasetIndex).controller;c&&c[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}});!vi(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=(l,c)=>l.filter(u=>!c.some(f=>u.datasetIndex===f.datasetIndex&&u.index===f.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),l=rf(t),c=Qp(t,this._lastEvent,i,l);i&&(this._lastEvent=null,I(o.onHover,[t,a,this],this),l&&I(o.onClick,[t,a,this],this));const u=!vi(a,s);return(u||n)&&(this._active=a,this._updateHoverStyles(a,s,n)),this._lastEvent=c,u}_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 Wr(){return z(zs.instances,e=>e._plugins.invalidate())}function jl(e,t,n=t){e.lineCap=R(n.borderCapStyle,t.borderCapStyle),e.setLineDash(R(n.borderDash,t.borderDash)),e.lineDashOffset=R(n.borderDashOffset,t.borderDashOffset),e.lineJoin=R(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=R(n.borderWidth,t.borderWidth),e.strokeStyle=R(n.borderColor,t.borderColor)}function Jp(e,t,n){e.lineTo(n.x,n.y)}function tg(e){return e.stepped?Rf:e.tension||e.cubicInterpolationMode==="monotone"?Nf:Jp}function Ul(e,t,n={}){const i=e.length,{start:s=0,end:o=i-1}=n,{start:r,end:a}=t,l=Math.max(s,r),c=Math.min(o,a),u=s<r&&o<r||s>a&&o>a;return{count:i,start:l,loop:t.loop,ilen:c<l&&!u?i+c-l:c-l}}function eg(e,t,n,i){const{points:s,options:o}=t,{count:r,start:a,loop:l,ilen:c}=Ul(s,n,i),u=tg(o);let{move:f=!0,reverse:p}=i||{},g,x,y;for(g=0;g<=c;++g)x=s[(a+(p?c-g:g))%r],!x.skip&&(f?(e.moveTo(x.x,x.y),f=!1):u(e,y,x,p,o.stepped),y=x);return l&&(x=s[(a+(p?c:0))%r],u(e,y,x,p,o.stepped)),!!l}function ng(e,t,n,i){const s=t.points,{count:o,start:r,ilen:a}=Ul(s,n,i),{move:l=!0,reverse:c}=i||{};let u=0,f=0,p,g,x,y,v,w;const k=O=>(r+(c?a-O:O))%o,C=()=>{y!==v&&(e.lineTo(u,v),e.lineTo(u,y),e.lineTo(u,w))};for(l&&(g=s[k(0)],e.moveTo(g.x,g.y)),p=0;p<=a;++p){if(g=s[k(p)],g.skip)continue;const O=g.x,T=g.y,D=O|0;D===x?(T<y?y=T:T>v&&(v=T),u=(f*u+O)/++f):(C(),e.lineTo(O,T),x=D,f=0,y=v=T),w=T}C()}function Fs(e){const t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!n?ng:eg}function ig(e){return e.stepped?gd:e.tension||e.cubicInterpolationMode==="monotone"?md:Se}function sg(e,t,n,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,n,i)&&s.closePath()),jl(e,t.options),e.stroke(s)}function og(e,t,n,i){const{segments:s,options:o}=t,r=Fs(t);for(const a of s)jl(e,o,a.style),e.beginPath(),r(e,t,a,{start:n,end:n+i-1})&&e.closePath(),e.stroke()}const rg=typeof Path2D=="function";function ag(e,t,n,i){rg&&!t.options.segment?sg(e,t,n,i):og(e,t,n,i)}class lg extends sn{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;ad(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=kd(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=_d(this,{property:n,start:s,end:s});if(!r.length)return;const a=[],l=ig(i);let c,u;for(c=0,u=r.length;c<u;++c){const{start:f,end:p}=r[c],g=o[f],x=o[p];if(g===x){a.push(g);continue}const y=Math.abs((s-g[n])/(x[n]-g[n])),v=l(g,x,y,i.stepped);v[n]=t[n],a.push(v)}return a.length===1?a[0]:a}pathSegment(t,n,i){return Fs(this)(t,this,n,i)}path(t,n,i){const s=this.segments,o=Fs(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(),ag(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function jr(e,t,n,i){const s=e.options,{[n]:o}=e.getProps([n],i);return Math.abs(t-o)<s.radius+s.hitRadius}class cg extends sn{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 jr(this,t,"x",n)}inYRange(t,n){return jr(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||!Je(this,n,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,Is(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}const Ur=(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)}},ug=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class $r extends sn{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=I(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=ct(i.font),o=s.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=Ur(i,o);let c,u;n.font=s.string,this.isHorizontal()?(c=this.maxWidth,u=this._fitRows(r,o,a,l)+10):(u=this.maxHeight,c=this._fitCols(r,s,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(u,t.maxHeight||this.maxHeight)}_fitRows(t,n,i,s){const{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],u=s+a;let f=t;o.textAlign="left",o.textBaseline="middle";let p=-1,g=-u;return this.legendItems.forEach((x,y)=>{const v=i+n/2+o.measureText(x.text).width;(y===0||c[c.length-1]+v+2*a>r)&&(f+=u,c[c.length-(y>0?0:1)]=0,g+=u,p++),l[y]={left:0,top:g,row:p,width:v,height:s},c[c.length-1]+=v+a}),f}_fitCols(t,n,i,s){const{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],u=r-t;let f=a,p=0,g=0,x=0,y=0;return this.legendItems.forEach((v,w)=>{const{itemWidth:k,itemHeight:C}=hg(i,n,o,v,s);w>0&&g+C+2*a>u&&(f+=p+a,c.push({width:p,height:g}),x+=p+a,y++,p=g=0),l[w]={left:x,top:g,col:y,width:k,height:C},p=Math.max(p,k),g+=C+a}),f+=p,c.push({width:p,height:g}),f}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:i,labels:{padding:s},rtl:o}}=this,r=Ue(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=ft(i,this.left+s,this.right-this.lineWidths[a]);for(const c of n)a!==c.row&&(a=c.row,l=ft(i,this.left+s,this.right-this.lineWidths[a])),c.top+=this.top+t+s,c.left=r.leftForLtr(r.x(l),c.width),l+=c.width+s}else{let a=0,l=ft(i,this.top+t+s,this.bottom-this.columnSizes[a].height);for(const c of n)c.col!==a&&(a=c.col,l=ft(i,this.top+t+s,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+s,c.left=r.leftForLtr(r.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;co(t,this),this._draw(),uo(t)}}_draw(){const{options:t,columnSizes:n,lineWidths:i,ctx:s}=this,{align:o,labels:r}=t,a=Y.color,l=Ue(t.rtl,this.left,this.width),c=ct(r.font),{padding:u}=r,f=c.size,p=f/2;let g;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:x,boxHeight:y,itemHeight:v}=Ur(r,f),w=function(D,P,E){if(isNaN(x)||x<=0||isNaN(y)||y<0)return;s.save();const A=R(E.lineWidth,1);if(s.fillStyle=R(E.fillStyle,a),s.lineCap=R(E.lineCap,"butt"),s.lineDashOffset=R(E.lineDashOffset,0),s.lineJoin=R(E.lineJoin,"miter"),s.lineWidth=A,s.strokeStyle=R(E.strokeStyle,a),s.setLineDash(R(E.lineDash,[])),r.usePointStyle){const F={radius:y*Math.SQRT2/2,pointStyle:E.pointStyle,rotation:E.rotation,borderWidth:A},L=l.xPlus(D,x/2),H=P+p;_l(s,F,L,H,r.pointStyleWidth&&x)}else{const F=P+Math.max((f-y)/2,0),L=l.leftForLtr(D,x),H=En(E.borderRadius);s.beginPath(),Object.values(H).some(K=>K!==0)?Ls(s,{x:L,y:F,w:x,h:y,radius:H}):s.rect(L,F,x,y),s.fill(),A!==0&&s.stroke()}s.restore()},k=function(D,P,E){Ti(s,E.text,D,P+v/2,c,{strikethrough:E.hidden,textAlign:l.textAlign(E.textAlign)})},C=this.isHorizontal(),O=this._computeTitleHeight();C?g={x:ft(o,this.left+u,this.right-i[0]),y:this.top+u+O,line:0}:g={x:this.left+u,y:ft(o,this.top+O+u,this.bottom-n[0].height),line:0},Cl(this.ctx,t.textDirection);const T=v+u;this.legendItems.forEach((D,P)=>{s.strokeStyle=D.fontColor,s.fillStyle=D.fontColor;const E=s.measureText(D.text).width,A=l.textAlign(D.textAlign||(D.textAlign=r.textAlign)),F=x+p+E;let L=g.x,H=g.y;l.setWidth(this.width),C?P>0&&L+F+u>this.right&&(H=g.y+=T,g.line++,L=g.x=ft(o,this.left+u,this.right-i[g.line])):P>0&&H+T>this.bottom&&(L=g.x=L+n[g.line].width+u,g.line++,H=g.y=ft(o,this.top+O+u,this.bottom-n[g.line].height));const K=l.x(L);if(w(K,H,D),L=wf(A,L+x+p,C?L+F:this.right,t.rtl),k(l.x(L),H,D),C)g.x+=F+u;else if(typeof D.text!="string"){const et=c.lineHeight;g.y+=$l(D,et)+u}else g.y+=T}),Ol(this.ctx,t.textDirection)}drawTitle(){const t=this.options,n=t.title,i=ct(n.font),s=Mt(n.padding);if(!n.display)return;const o=Ue(t.rtl,this.left,this.width),r=this.ctx,a=n.position,l=i.size/2,c=s.top+l;let u,f=this.left,p=this.width;if(this.isHorizontal())p=Math.max(...this.lineWidths),u=this.top+c,f=ft(t.align,f,this.right-p);else{const x=this.columnSizes.reduce((y,v)=>Math.max(y,v.height),0);u=c+ft(t.align,this.top,this.bottom-x-t.labels.padding-this._computeTitleHeight())}const g=ft(a,f,f+p);r.textAlign=o.textAlign(yl(a)),r.textBaseline="middle",r.strokeStyle=n.color,r.fillStyle=n.color,r.font=i.string,Ti(r,n.text,g,u,i)}_computeTitleHeight(){const t=this.options.title,n=ct(t.font),i=Mt(t.padding);return t.display?n.lineHeight+i.height:0}_getLegendItemAt(t,n){let i,s,o;if(_n(t,this.left,this.right)&&_n(n,this.top,this.bottom)){for(o=this.legendHitBoxes,i=0;i<o.length;++i)if(s=o[i],_n(t,s.left,s.left+s.width)&&_n(n,s.top,s.top+s.height))return this.legendItems[i]}return null}handleEvent(t){const n=this.options;if(!pg(t.type,n))return;const i=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const s=this._hoveredItem,o=ug(s,i);s&&!o&&I(n.onLeave,[t,s,this],this),this._hoveredItem=i,i&&!o&&I(n.onHover,[t,i,this],this)}else i&&I(n.onClick,[t,i,this],this)}}function hg(e,t,n,i,s){const o=fg(i,e,t,n),r=dg(s,i,t.lineHeight);return{itemWidth:o,itemHeight:r}}function fg(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 dg(e,t,n){let i=e;return typeof t.text!="string"&&(i=$l(t,n)),i}function $l(e,t){const n=e.text?e.text.length:0;return t*n}function pg(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var gg={id:"legend",_element:$r,start(e,t,n){const i=e.legend=new $r({ctx:e.ctx,options:n,chart:e});ee.configure(e,i,n),ee.addBox(e,i)},stop(e){ee.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const i=e.legend;ee.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(l=>{const c=l.controller.getStyle(n?0:void 0),u=Mt(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(u.width+u.height)/4,strokeStyle:c.borderColor,pointStyle:i||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:r&&(a||c.borderRadius),datasetIndex:l.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)}}};const Sn={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 l=a.tooltipPosition();i.add(l.x),s+=l.y,++o}}return o===0||i.size===0?!1:{x:[...i].reduce((a,l)=>a+l)/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 l=e[o].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),u=Ds(t,c);u<s&&(s=u,a=l)}}if(a){const l=a.tooltipPosition();n=l.x,i=l.y}return{x:n,y:i}}};function Dt(e,t){return t&&(Q(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function Ut(e){return(typeof e=="string"||e instanceof String)&&e.indexOf(\`
|
|
2425
|
+
*/class Od{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=ml.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,l;for(;r>=0;--r)l=o[r],l._active?(l._total>i.duration&&(i.duration=l._total),l.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 jt=new Od;const yr="transparent",Pd={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const i=ar(e||yr),s=i.valid&&ar(t||yr);return s&&s.valid?s.mix(i,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class Dd{constructor(t,n,i,s){const o=n[i];s=Jn([t.to,s,o,t.from]);const r=Jn([t.from,o,s]);this._active=!0,this._fn=t.fn||Pd[t.type||typeof r],this._easing=Tn[t.easing]||Tn.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=Jn([t.to,n,s,t.from]),this._from=Jn([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 l;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}l=n/i%2,l=r&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((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 Dl{constructor(t,n){this._chart=t,this._properties=new Map,this.configure(n)}configure(t){if(!V(t))return;const n=Object.keys(Y.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{const o=t[s];if(!V(o))return;const r={};for(const a of n)r[a]=o[a];(Q(o.properties)&&o.properties||[s]).forEach(a=>{(a===s||!i.has(a))&&i.set(a,r)})})}_animateOptions(t,n){const i=n.options,s=Id(t,i);if(!s)return[];const o=this._createAnimations(s,i);return i.$shared&&Ad(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 l;for(l=r.length-1;l>=0;--l){const c=r[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,n));continue}const u=n[c];let f=o[c];const p=i.get(c);if(f)if(p&&f.active()){f.update(p,u,a);continue}else f.cancel();if(!p||!p.duration){t[c]=u;continue}o[c]=f=new Dd(p,t,c,u),s.push(f)}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 jt.add(this._chart,i),!0}}function Ad(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 Id(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 xr(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 Ld(e,t,n){if(n===!1)return!1;const i=xr(e,n),s=xr(t,n);return{top:s.end,right:i.end,bottom:s.start,left:i.start}}function Rd(e){let t,n,i,s;return V(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 Al(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 vr(e,t,n,i={}){const s=e.keys,o=i.mode==="single";let r,a,l,c;if(t===null)return;let u=!1;for(r=0,a=s.length;r<a;++r){if(l=+s[r],l===n){if(u=!0,i.all)continue;break}c=e.values[l],xt(c)&&(o||t===0||ce(t)===ce(c))&&(t+=c)}return!u&&!i.all?0:t}function Nd(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 l,c,u;for(l=0,c=r.length;l<c;++l)u=r[l],a[l]={[s]:u,[o]:e[u]};return a}function Ji(e,t){const n=e&&e.options.stacked;return n||n===void 0&&t.stack!==void 0}function zd(e,t,n){return\`\${e.id}.\${t.id}.\${n.stack||n.type}\`}function Fd(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 Hd(e,t,n){const i=e[t]||(e[t]={});return i[n]||(i[n]={})}function _r(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 wr(e,t){const{chart:n,_cachedMeta:i}=e,s=n._stacks||(n._stacks={}),{iScale:o,vScale:r,index:a}=i,l=o.axis,c=r.axis,u=zd(o,r,i),f=t.length;let p;for(let g=0;g<f;++g){const x=t[g],{[l]:y,[c]:v}=x,w=x._stacks||(x._stacks={});p=w[c]=Hd(s,u,y),p[a]=v,p._top=_r(p,r,!0,i.type),p._bottom=_r(p,r,!1,i.type);const k=p._visualValues||(p._visualValues={});k[a]=v}}function ts(e,t){const n=e.scales;return Object.keys(n).filter(i=>n[i].axis===t).shift()}function Vd(e,t){return Ie(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Bd(e,t,n){return Ie(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function pn(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 es=e=>e==="reset"||e==="none",Sr=(e,t)=>t?e:Object.assign({},e),Wd=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:Al(n,!0),values:null};class Il{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=Ji(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&&pn(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,n=this._cachedMeta,i=this.getDataset(),s=(f,p,g,x)=>f==="x"?p:f==="r"?x:g,o=n.xAxisID=R(i.xAxisID,ts(t,"x")),r=n.yAxisID=R(i.yAxisID,ts(t,"y")),a=n.rAxisID=R(i.rAxisID,ts(t,"r")),l=n.indexAxis,c=n.iAxisID=s(l,o,r,a),u=n.vAxisID=s(l,r,o,a);n.xScale=this.getScaleForId(o),n.yScale=this.getScaleForId(r),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(c),n.vScale=this.getScaleForId(u)}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&&sr(this._data,this),t._stacked&&pn(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),i=this._data;if(V(n)){const s=this._cachedMeta;this._data=Nd(n,s)}else if(i!==n){if(i){sr(i,this);const s=this._cachedMeta;pn(s),s._parsed=[]}n&&Object.isExtensible(n)&&xf(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=Ji(n.vScale,n),n.stack!==i.stack&&(s=!0,pn(n),n.stack=i.stack),this._resyncElements(t),(s||o!==n._stacked)&&(wr(this,n._parsed),n._stacked=Ji(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 l=t===0&&n===s.length?!0:i._sorted,c=t>0&&i._parsed[t-1],u,f,p;if(this._parsing===!1)i._parsed=s,i._sorted=!0,p=s;else{Q(s[t])?p=this.parseArrayData(i,s,t,n):V(s[t])?p=this.parseObjectData(i,s,t,n):p=this.parsePrimitiveData(i,s,t,n);const g=()=>f[a]===null||c&&f[a]<c[a];for(u=0;u<n;++u)i._parsed[u+t]=f=p[u],l&&(g()&&(l=!1),c=f);i._sorted=l}r&&wr(this,p)}parsePrimitiveData(t,n,i,s){const{iScale:o,vScale:r}=t,a=o.axis,l=r.axis,c=o.getLabels(),u=o===r,f=new Array(s);let p,g,x;for(p=0,g=s;p<g;++p)x=p+i,f[p]={[a]:u||o.parse(c[x],x),[l]:r.parse(n[x],x)};return f}parseArrayData(t,n,i,s){const{xScale:o,yScale:r}=t,a=new Array(s);let l,c,u,f;for(l=0,c=s;l<c;++l)u=l+i,f=n[u],a[l]={x:o.parse(f[0],u),y:r.parse(f[1],u)};return a}parseObjectData(t,n,i,s){const{xScale:o,yScale:r}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=new Array(s);let u,f,p,g;for(u=0,f=s;u<f;++u)p=u+i,g=n[p],c[u]={x:o.parse(wi(g,a),p),y:r.parse(wi(g,l),p)};return c}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:Al(s,!0),values:n._stacks[t.axis]._visualValues};return vr(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=vr(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),l=Wd(n,i,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:f}=Fd(a);let p,g;function x(){g=s[p];const y=g[a.axis];return!xt(g[t.axis])||u>y||f<y}for(p=0;p<r&&!(!x()&&(this.updateRangeFromParsed(c,t,g,l),o));++p);if(o){for(p=r-1;p>=0;--p)if(!x()){this.updateRangeFromParsed(c,t,g,l);break}}return c}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],xt(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=Rd(R(this.options.clip,Ld(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,l=this._drawCount||s.length-a,c=this.options.drawActiveElementsOnTop;let u;for(i.dataset&&i.dataset.draw(t,o,a,l),u=a;u<a+l;++u){const f=s[u];f.hidden||(f.active&&c?r.push(f):f.draw(t,o))}for(u=0;u<r.length;++u)r[u].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=Bd(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=Vd(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],l=this.enableOptionSharing&&Si(i);if(a)return Sr(a,l);const c=this.chart.config,u=c.datasetElementScopeKeys(this._type,t),f=s?[\`\${t}Hover\`,"hover",t,""]:[t,""],p=c.getOptionScopes(this.getDataset(),u),g=Object.keys(Y.elements[t]),x=()=>this.getContext(i,s,n),y=c.resolveNamedOptions(p,g,x,f);return y.$shared&&(y.$shared=l,o[r]=Object.freeze(Sr(y,l))),y}_resolveAnimations(t,n,i){const s=this.chart,o=this._cachedDataOpts,r=\`animation-\${n}\`,a=o[r];if(a)return a;let l;if(s.options.animation!==!1){const u=this.chart.config,f=u.datasetAnimationScopeKeys(this._type,n),p=u.getOptionScopes(this.getDataset(),f);l=u.createResolver(p,this.getContext(t,i,n))}const c=new Dl(s,l&&l.animations);return l&&l._cacheable&&(o[r]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||es(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){es(s)?Object.assign(t,i):this._resolveAnimations(n,s).update(t,i)}updateSharedOptions(t,n,i){t&&!es(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,l,c]of this._syncList)this[a](l,c);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 l=c=>{for(c.length+=n,a=c.length-1;a>=r;a--)c[a]=c[a-n]};for(l(o),a=t;a<r;++a)o[a]=new this.dataElementType;this._parsing&&l(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&&pn(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])}}class jd extends Il{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:l}=Sf(n,s,r);this._drawStart=a,this._drawCount=l,kf(n)&&(a=0,l=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=s;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(i,void 0,{animated:!r,options:c},t),this.updateElements(s,a,l,t)}updateElements(t,n,i,s){const o=s==="reset",{iScale:r,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:u,includeOptions:f}=this._getSharedOptions(n,s),p=r.axis,g=a.axis,{spanGaps:x,segment:y}=this.options,v=In(x)?x:Number.POSITIVE_INFINITY,w=this.chart._animationsDisabled||o||s==="none",k=n+i,C=t.length;let O=n>0&&this.getParsed(n-1);for(let T=0;T<C;++T){const D=t[T],P=w?D:{};if(T<n||T>=k){P.skip=!0;continue}const E=this.getParsed(T),A=B(E[g]),F=P[p]=r.getPixelForValue(E[p],T),L=P[g]=o||A?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,E,l):E[g],T);P.skip=isNaN(F)||isNaN(L)||A,P.stop=T>0&&Math.abs(E[p]-O[p])>v,y&&(P.parsed=E,P.raw=c.data[T]),f&&(P.options=u||this.resolveDataElementOptions(T,D.active?"active":s)),w||this.updateElement(D,T,P,s),O=E}}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()}}function we(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class bo{static override(t){Object.assign(bo.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return we()}parse(){return we()}format(){return we()}add(){return we()}diff(){return we()}startOf(){return we()}endOf(){return we()}}var Ud={_date:bo};function $d(e,t,n,i){const{controller:s,data:o,_sorted:r}=e,a=s._cachedMeta.iScale,l=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(a&&t===a.axis&&t!=="r"&&r&&o.length){const c=a._reversePixels?bf:Ee;if(i){if(s._sharedOptions){const u=o[0],f=typeof u.getRange=="function"&&u.getRange(t);if(f){const p=c(o,t,n-f),g=c(o,t,n+f);return{lo:p.lo,hi:g.hi}}}}else{const u=c(o,t,n);if(l){const{vScale:f}=s._cachedMeta,{_parsed:p}=e,g=p.slice(0,u.lo+1).reverse().findIndex(y=>!B(y[f.axis]));u.lo-=Math.max(0,g);const x=p.slice(u.hi).findIndex(y=>!B(y[f.axis]));u.hi+=Math.max(0,x)}return u}}return{lo:0,hi:o.length-1}}function Ni(e,t,n,i,s){const o=e.getSortedVisibleDatasetMetas(),r=n[t];for(let a=0,l=o.length;a<l;++a){const{index:c,data:u}=o[a],{lo:f,hi:p}=$d(o[a],t,r,s);for(let g=f;g<=p;++g){const x=u[g];x.skip||i(x,c,g)}}}function Yd(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 ns(e,t,n,i,s){const o=[];return!s&&!e.isPointInArea(t)||Ni(e,n,t,function(a,l,c){!s&&!Je(a,e.chartArea,0)||a.inRange(t.x,t.y,i)&&o.push({element:a,datasetIndex:l,index:c})},!0),o}function Xd(e,t,n,i){let s=[];function o(r,a,l){const{startAngle:c,endAngle:u}=r.getProps(["startAngle","endAngle"],i),{angle:f}=pf(r,{x:t.x,y:t.y});pl(f,c,u)&&s.push({element:r,datasetIndex:a,index:l})}return Ni(e,n,t,o),s}function qd(e,t,n,i,s,o){let r=[];const a=Yd(n);let l=Number.POSITIVE_INFINITY;function c(u,f,p){const g=u.inRange(t.x,t.y,s);if(i&&!g)return;const x=u.getCenterPoint(s);if(!(!!o||e.isPointInArea(x))&&!g)return;const v=a(t,x);v<l?(r=[{element:u,datasetIndex:f,index:p}],l=v):v===l&&r.push({element:u,datasetIndex:f,index:p})}return Ni(e,n,t,c),r}function is(e,t,n,i,s,o){return!o&&!e.isPointInArea(t)?[]:n==="r"&&!i?Xd(e,t,n,s):qd(e,t,n,i,s,o)}function kr(e,t,n,i,s){const o=[],r=n==="x"?"inXRange":"inYRange";let a=!1;return Ni(e,n,t,(l,c,u)=>{l[r]&&l[r](t[n],s)&&(o.push({element:l,datasetIndex:c,index:u}),a=a||l.inRange(t.x,t.y,s))}),i&&!a?[]:o}var Gd={modes:{index(e,t,n,i){const s=It(t,e),o=n.axis||"x",r=n.includeInvisible||!1,a=n.intersect?ns(e,s,o,i,r):is(e,s,o,!1,i,r),l=[];return a.length?(e.getSortedVisibleDatasetMetas().forEach(c=>{const u=a[0].index,f=c.data[u];f&&!f.skip&&l.push({element:f,datasetIndex:c.index,index:u})}),l):[]},dataset(e,t,n,i){const s=It(t,e),o=n.axis||"xy",r=n.includeInvisible||!1;let a=n.intersect?ns(e,s,o,i,r):is(e,s,o,!1,i,r);if(a.length>0){const l=a[0].datasetIndex,c=e.getDatasetMeta(l).data;a=[];for(let u=0;u<c.length;++u)a.push({element:c[u],datasetIndex:l,index:u})}return a},point(e,t,n,i){const s=It(t,e),o=n.axis||"xy",r=n.includeInvisible||!1;return ns(e,s,o,i,r)},nearest(e,t,n,i){const s=It(t,e),o=n.axis||"xy",r=n.includeInvisible||!1;return is(e,s,o,n.intersect,i,r)},x(e,t,n,i){const s=It(t,e);return kr(e,s,"x",n.intersect,i)},y(e,t,n,i){const s=It(t,e);return kr(e,s,"y",n.intersect,i)}}};const Ll=["left","top","right","bottom"];function gn(e,t){return e.filter(n=>n.pos===t)}function Tr(e,t){return e.filter(n=>Ll.indexOf(n.pos)===-1&&n.box.axis===t)}function mn(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 Kd(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 Zd(e){const t={};for(const n of e){const{stack:i,pos:s,stackWeight:o}=n;if(!i||!Ll.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 Qd(e,t){const n=Zd(e),{vBoxMaxWidth:i,hBoxMaxHeight:s}=t;let o,r,a;for(o=0,r=e.length;o<r;++o){a=e[o];const{fullSize:l}=a.box,c=n[a.stack],u=c&&a.stackWeight/c.weight;a.horizontal?(a.width=u?u*i:l&&t.availableWidth,a.height=s):(a.width=i,a.height=u?u*s:l&&t.availableHeight)}return n}function Jd(e){const t=Kd(e),n=mn(t.filter(c=>c.box.fullSize),!0),i=mn(gn(t,"left"),!0),s=mn(gn(t,"right")),o=mn(gn(t,"top"),!0),r=mn(gn(t,"bottom")),a=Tr(t,"x"),l=Tr(t,"y");return{fullSize:n,leftAndTop:i.concat(o),rightAndBottom:s.concat(l).concat(r).concat(a),chartArea:gn(t,"chartArea"),vertical:i.concat(s).concat(l),horizontal:o.concat(r).concat(a)}}function Mr(e,t,n,i){return Math.max(e[n],t[n])+Math.max(e[i],t[i])}function Rl(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 tp(e,t,n,i){const{pos:s,box:o}=n,r=e.maxPadding;if(!V(s)){n.size&&(e[s]-=n.size);const f=i[n.stack]||{size:0,count:1};f.size=Math.max(f.size,n.horizontal?o.height:o.width),n.size=f.size/f.count,e[s]+=n.size}o.getPadding&&Rl(r,o.getPadding());const a=Math.max(0,t.outerWidth-Mr(r,e,"left","right")),l=Math.max(0,t.outerHeight-Mr(r,e,"top","bottom")),c=a!==e.w,u=l!==e.h;return e.w=a,e.h=l,n.horizontal?{same:c,other:u}:{same:u,other:c}}function ep(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 np(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 wn(e,t,n,i){const s=[];let o,r,a,l,c,u;for(o=0,r=e.length,c=0;o<r;++o){a=e[o],l=a.box,l.update(a.width||t.w,a.height||t.h,np(a.horizontal,t));const{same:f,other:p}=tp(t,n,a,i);c|=f&&s.length,u=u||p,l.fullSize||s.push(a)}return c&&wn(s,t,n,i)||u}function ii(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 Er(e,t,n,i){const s=n.padding;let{x:o,y:r}=t;for(const a of e){const l=a.box,c=i[a.stack]||{placed:0,weight:1},u=a.stackWeight/c.weight||1;if(a.horizontal){const f=t.w*u,p=c.size||l.height;Si(c.start)&&(r=c.start),l.fullSize?ii(l,s.left,r,n.outerWidth-s.right-s.left,p):ii(l,t.left+c.placed,r,f,p),c.start=r,c.placed+=f,r=l.bottom}else{const f=t.h*u,p=c.size||l.width;Si(c.start)&&(o=c.start),l.fullSize?ii(l,o,s.top,p,n.outerHeight-s.bottom-s.top):ii(l,o,t.top+c.placed,p,f),c.start=o,c.placed+=f,o=l.right}}t.x=o,t.y=r}var ee={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=Mt(e.options.layout.padding),o=Math.max(t-s.width,0),r=Math.max(n-s.height,0),a=Jd(e.boxes),l=a.vertical,c=a.horizontal;z(e.boxes,y=>{typeof y.beforeLayout=="function"&&y.beforeLayout()});const u=l.reduce((y,v)=>v.box.options&&v.box.options.display===!1?y:y+1,0)||1,f=Object.freeze({outerWidth:t,outerHeight:n,padding:s,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/u,hBoxMaxHeight:r/2}),p=Object.assign({},s);Rl(p,Mt(i));const g=Object.assign({maxPadding:p,w:o,h:r,x:s.left,y:s.top},s),x=Qd(l.concat(c),f);wn(a.fullSize,g,f,x),wn(l,g,f,x),wn(c,g,f,x)&&wn(l,g,f,x),ep(g),Er(a.leftAndTop,g,f,x),g.x+=g.w,g.y+=g.h,Er(a.rightAndBottom,g,f,x),e.chartArea={left:g.left,top:g.top,right:g.left+g.w,bottom:g.top+g.h,height:g.h,width:g.w},z(a.chartArea,y=>{const v=y.box;Object.assign(v,e.chartArea),v.update(g.w,g.h,{left:0,top:0,right:0,bottom:0})})}};class Nl{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 ip extends Nl{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const fi="$chartjs",sp={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Cr=e=>e===null||e==="";function op(e,t){const n=e.style,i=e.getAttribute("height"),s=e.getAttribute("width");if(e[fi]={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",Cr(s)){const o=pr(e,"width");o!==void 0&&(e.width=o)}if(Cr(i))if(e.style.height==="")e.height=e.width/(t||2);else{const o=pr(e,"height");o!==void 0&&(e.height=o)}return e}const zl=pd?{passive:!0}:!1;function rp(e,t,n){e&&e.addEventListener(t,n,zl)}function ap(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,zl)}function lp(e,t){const n=sp[e.type]||e.type,{x:i,y:s}=It(e,t);return{type:n,chart:t,native:e,x:i!==void 0?i:null,y:s!==void 0?s:null}}function Ei(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function cp(e,t,n){const i=e.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||Ei(a.addedNodes,i),r=r&&!Ei(a.removedNodes,i);r&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}function up(e,t,n){const i=e.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||Ei(a.removedNodes,i),r=r&&!Ei(a.addedNodes,i);r&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}const Ln=new Map;let Or=0;function Fl(){const e=window.devicePixelRatio;e!==Or&&(Or=e,Ln.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function hp(e,t){Ln.size||window.addEventListener("resize",Fl),Ln.set(e,t)}function fp(e){Ln.delete(e),Ln.size||window.removeEventListener("resize",Fl)}function dp(e,t,n){const i=e.canvas,s=i&&mo(i);if(!s)return;const o=bl((a,l)=>{const c=s.clientWidth;n(a,l),c<s.clientWidth&&n()},window),r=new ResizeObserver(a=>{const l=a[0],c=l.contentRect.width,u=l.contentRect.height;c===0&&u===0||o(c,u)});return r.observe(s),hp(e,o),r}function ss(e,t,n){n&&n.disconnect(),t==="resize"&&fp(e)}function pp(e,t,n){const i=e.canvas,s=bl(o=>{e.ctx!==null&&n(lp(o,e))},e);return rp(i,t,s),s}class gp extends Nl{acquireContext(t,n){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(op(t,n),i):null}releaseContext(t){const n=t.canvas;if(!n[fi])return!1;const i=n[fi].initial;["height","width"].forEach(o=>{const r=i[o];B(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[fi],!0}addEventListener(t,n,i){this.removeEventListener(t,n);const s=t.$proxies||(t.$proxies={}),r={attach:cp,detach:up,resize:dp}[n]||pp;s[n]=r(t,n,i)}removeEventListener(t,n){const i=t.$proxies||(t.$proxies={}),s=i[n];if(!s)return;({attach:ss,detach:ss,resize:ss}[n]||ap)(t,n,s),i[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,i,s){return dd(t,n,i,s)}isAttached(t){const n=t&&mo(t);return!!(n&&n.isConnected)}}function mp(e){return!go()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?ip:gp}class sn{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 In(this.x)&&In(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 bp(e,t){const n=e.options.ticks,i=yp(e),s=Math.min(n.maxTicksLimit||i,i),o=n.major.enabled?vp(t):[],r=o.length,a=o[0],l=o[r-1],c=[];if(r>s)return _p(t,c,o,r/s),c;const u=xp(o,t,s);if(r>0){let f,p;const g=r>1?Math.round((l-a)/(r-1)):null;for(si(t,c,u,B(g)?0:a-g,a),f=0,p=r-1;f<p;f++)si(t,c,u,o[f],o[f+1]);return si(t,c,u,l,B(g)?t.length:l+g),c}return si(t,c,u),c}function yp(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 xp(e,t,n){const i=wp(e),s=t.length/n;if(!i)return Math.max(s,1);const o=cf(i);for(let r=0,a=o.length-1;r<a;r++){const l=o[r];if(l>s)return l}return Math.max(s,1)}function vp(e){const t=[];let n,i;for(n=0,i=e.length;n<i;n++)e[n].major&&t.push(n);return t}function _p(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 si(e,t,n,i,s){const o=R(i,0),r=Math.min(R(s,e.length),e.length);let a=0,l,c,u;for(n=Math.ceil(n),s&&(l=s-i,n=l/Math.floor(l/n)),u=o;u<0;)a++,u=Math.round(o+a*n);for(c=Math.max(o,0);c<r;c++)c===u&&(t.push(e[c]),a++,u=Math.round(o+a*n))}function wp(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 Sp=e=>e==="left"?"right":e==="right"?"left":e,Pr=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,Dr=(e,t)=>Math.min(t||e,e);function Ar(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 kp(e,t,n){const i=e.ticks.length,s=Math.min(t,i-1),o=e._startPixel,r=e._endPixel,a=1e-6;let l=e.getPixelForTick(s),c;if(!(n&&(i===1?c=Math.max(l-o,r-l):t===0?c=(e.getPixelForTick(1)-l)/2:c=(l-e.getPixelForTick(s-1))/2,l+=s<t?c:-c,l<o-a||l>r+a)))return l}function Tp(e,t){z(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 bn(e){return e.drawTicks?e.tickLength:0}function Ir(e,t){if(!e.display)return 0;const n=ct(e.font,t),i=Mt(e.padding);return(Q(e.text)?e.text.length:1)*n.lineHeight+i.height}function Mp(e,t){return Ie(e,{scale:t,type:"scale"})}function Ep(e,t,n){return Ie(e,{tick:n,index:t,type:"tick"})}function Cp(e,t,n){let i=yl(e);return(n&&t!=="right"||!n&&t==="right")&&(i=Sp(i)),i}function Op(e,t,n,i){const{top:s,left:o,bottom:r,right:a,chart:l}=e,{chartArea:c,scales:u}=l;let f=0,p,g,x;const y=r-s,v=a-o;if(e.isHorizontal()){if(g=ft(i,o,a),V(n)){const w=Object.keys(n)[0],k=n[w];x=u[w].getPixelForValue(k)+y-t}else n==="center"?x=(c.bottom+c.top)/2+y-t:x=Pr(e,n,t);p=a-o}else{if(V(n)){const w=Object.keys(n)[0],k=n[w];g=u[w].getPixelForValue(k)-v+t}else n==="center"?g=(c.left+c.right)/2-v+t:g=Pr(e,n,t);x=ft(i,r,s),f=n==="left"?-wt:wt}return{titleX:g,titleY:x,maxWidth:p,rotation:f}}class on extends sn{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=Pt(t,Number.POSITIVE_INFINITY),n=Pt(n,Number.NEGATIVE_INFINITY),i=Pt(i,Number.POSITIVE_INFINITY),s=Pt(s,Number.NEGATIVE_INFINITY),{min:Pt(t,i),max:Pt(n,s),minDefined:xt(t),maxDefined:xt(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 l=0,c=a.length;l<c;++l)r=a[l].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:Pt(n,Pt(i,n)),max:Pt(i,Pt(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(){I(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=$f(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a<this.ticks.length;this._convertTicksToLabels(l?Ar(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),r.display&&(r.autoSkip||r.source==="auto")&&(this.ticks=bp(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&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(){I(this.options.afterUpdate,[this])}beforeSetDimensions(){I(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(){I(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),I(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){I(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=I(n.callback,[o.value,i,t],this)}afterTickToLabelConversion(){I(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){I(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,n=t.ticks,i=Dr(this.ticks.length,t.ticks.maxTicksLimit),s=n.minRotation||0,o=n.maxRotation;let r=s,a,l,c;if(!this._isVisible()||!n.display||s>=o||i<=1||!this.isHorizontal()){this.labelRotation=s;return}const u=this._getLabelSizes(),f=u.widest.width,p=u.highest.height,g=yt(this.chart.width-f,0,this.maxWidth);a=t.offset?this.maxWidth/i:g/(i-1),f+6>a&&(a=g/(i-(t.offset?.5:1)),l=this.maxHeight-bn(t.grid)-n.padding-Ir(t.title,this.chart.options.font),c=Math.sqrt(f*f+p*p),r=df(Math.min(Math.asin(yt((u.highest.height+6)/a,-1,1)),Math.asin(yt(l/c,-1,1))-Math.asin(yt(p/c,-1,1)))),r=Math.max(s,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){I(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){I(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 l=Ir(s,n.options.font);if(a?(t.width=this.maxWidth,t.height=bn(o)+l):(t.height=this.maxHeight,t.width=bn(o)+l),i.display&&this.ticks.length){const{first:c,last:u,widest:f,highest:p}=this._getLabelSizes(),g=i.padding*2,x=Me(this.labelRotation),y=Math.cos(x),v=Math.sin(x);if(a){const w=i.mirror?0:v*f.width+y*p.height;t.height=Math.min(this.maxHeight,t.height+w+g)}else{const w=i.mirror?0:y*f.width+v*p.height;t.width=Math.min(this.maxWidth,t.width+w+g)}this._calculatePadding(c,u,v,y)}}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,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const u=this.getPixelForTick(0)-this.left,f=this.right-this.getPixelForTick(this.ticks.length-1);let p=0,g=0;l?c?(p=s*t.width,g=i*n.height):(p=i*t.height,g=s*n.width):o==="start"?g=n.width:o==="end"?p=t.width:o!=="inner"&&(p=t.width/2,g=n.width/2),this.paddingLeft=Math.max((p-u+r)*this.width/(this.width-u),0),this.paddingRight=Math.max((g-f+r)*this.width/(this.width-f),0)}else{let u=n.height/2,f=t.height/2;o==="start"?(u=0,f=t.height):o==="end"&&(u=n.height,f=0),this.paddingTop=u+r,this.paddingBottom=f+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(){I(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++)B(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=Ar(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=[],l=Math.floor(n/Dr(n,i));let c=0,u=0,f,p,g,x,y,v,w,k,C,O,T;for(f=0;f<n;f+=l){if(x=t[f].label,y=this._resolveTickFontOptions(f),s.font=v=y.string,w=o[v]=o[v]||{data:{},gc:[]},k=y.lineHeight,C=O=0,!B(x)&&!Q(x))C=cr(s,w.data,w.gc,C,x),O=k;else if(Q(x))for(p=0,g=x.length;p<g;++p)T=x[p],!B(T)&&!Q(T)&&(C=cr(s,w.data,w.gc,C,T),O+=k);r.push(C),a.push(O),c=Math.max(C,c),u=Math.max(O,u)}Tp(o,n);const D=r.indexOf(c),P=a.indexOf(u),E=A=>({width:r[A]||0,height:a[A]||0});return{first:E(0),last:E(n-1),widest:E(D),highest:E(P),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 mf(this._alignToPixels?_e(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=Ep(this.getContext(),t,i))}return this.$context||(this.$context=Mp(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,n=Me(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,l=o?o.highest.height+r:0;return this.isHorizontal()?l*i>a*s?a/i:l/s:l*s<a*i?l/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,l=o.offset,c=this.isHorizontal(),f=this.ticks.length+(l?1:0),p=bn(o),g=[],x=a.setContext(this.getContext()),y=x.display?x.width:0,v=y/2,w=function(q){return _e(i,q,y)};let k,C,O,T,D,P,E,A,F,L,H,K;if(r==="top")k=w(this.bottom),P=this.bottom-p,A=k-v,L=w(t.top)+v,K=t.bottom;else if(r==="bottom")k=w(this.top),L=t.top,K=w(t.bottom)-v,P=k+v,A=this.top+p;else if(r==="left")k=w(this.right),D=this.right-p,E=k-v,F=w(t.left)+v,H=t.right;else if(r==="right")k=w(this.left),F=t.left,H=w(t.right)-v,D=k+v,E=this.left+p;else if(n==="x"){if(r==="center")k=w((t.top+t.bottom)/2+.5);else if(V(r)){const q=Object.keys(r)[0],nt=r[q];k=w(this.chart.scales[q].getPixelForValue(nt))}L=t.top,K=t.bottom,P=k+v,A=P+p}else if(n==="y"){if(r==="center")k=w((t.left+t.right)/2);else if(V(r)){const q=Object.keys(r)[0],nt=r[q];k=w(this.chart.scales[q].getPixelForValue(nt))}D=k-v,E=D-p,F=t.left,H=t.right}const et=R(s.ticks.maxTicksLimit,f),j=Math.max(1,Math.ceil(f/et));for(C=0;C<f;C+=j){const q=this.getContext(C),nt=o.setContext(q),Re=a.setContext(q),pe=nt.lineWidth,qt=nt.color,Ne=Re.dash||[],dt=Re.dashOffset,ge=nt.tickWidth,vt=nt.tickColor,me=nt.tickBorderDash||[],Ht=nt.tickBorderDashOffset;O=kp(this,C,l),O!==void 0&&(T=_e(i,O,pe),c?D=E=F=H=T:P=A=L=K=T,g.push({tx1:D,ty1:P,tx2:E,ty2:A,x1:F,y1:L,x2:H,y2:K,width:pe,color:qt,borderDash:Ne,borderDashOffset:dt,tickWidth:ge,tickColor:vt,tickBorderDash:me,tickBorderDashOffset:Ht}))}return this._ticksLength=f,this._borderValue=k,g}_computeLabelItems(t){const n=this.axis,i=this.options,{position:s,ticks:o}=i,r=this.isHorizontal(),a=this.ticks,{align:l,crossAlign:c,padding:u,mirror:f}=o,p=bn(i.grid),g=p+u,x=f?-u:g,y=-Me(this.labelRotation),v=[];let w,k,C,O,T,D,P,E,A,F,L,H,K="middle";if(s==="top")D=this.bottom-x,P=this._getXAxisLabelAlignment();else if(s==="bottom")D=this.top+x,P=this._getXAxisLabelAlignment();else if(s==="left"){const j=this._getYAxisLabelAlignment(p);P=j.textAlign,T=j.x}else if(s==="right"){const j=this._getYAxisLabelAlignment(p);P=j.textAlign,T=j.x}else if(n==="x"){if(s==="center")D=(t.top+t.bottom)/2+g;else if(V(s)){const j=Object.keys(s)[0],q=s[j];D=this.chart.scales[j].getPixelForValue(q)+g}P=this._getXAxisLabelAlignment()}else if(n==="y"){if(s==="center")T=(t.left+t.right)/2-g;else if(V(s)){const j=Object.keys(s)[0],q=s[j];T=this.chart.scales[j].getPixelForValue(q)}P=this._getYAxisLabelAlignment(p).textAlign}n==="y"&&(l==="start"?K="top":l==="end"&&(K="bottom"));const et=this._getLabelSizes();for(w=0,k=a.length;w<k;++w){C=a[w],O=C.label;const j=o.setContext(this.getContext(w));E=this.getPixelForTick(w)+o.labelOffset,A=this._resolveTickFontOptions(w),F=A.lineHeight,L=Q(O)?O.length:1;const q=L/2,nt=j.color,Re=j.textStrokeColor,pe=j.textStrokeWidth;let qt=P;r?(T=E,P==="inner"&&(w===k-1?qt=this.options.reverse?"left":"right":w===0?qt=this.options.reverse?"right":"left":qt="center"),s==="top"?c==="near"||y!==0?H=-L*F+F/2:c==="center"?H=-et.highest.height/2-q*F+F:H=-et.highest.height+F/2:c==="near"||y!==0?H=F/2:c==="center"?H=et.highest.height/2-q*F:H=et.highest.height-L*F,f&&(H*=-1),y!==0&&!j.showLabelBackdrop&&(T+=F/2*Math.sin(y))):(D=E,H=(1-L)*F/2);let Ne;if(j.showLabelBackdrop){const dt=Mt(j.backdropPadding),ge=et.heights[w],vt=et.widths[w];let me=H-dt.top,Ht=0-dt.left;switch(K){case"middle":me-=ge/2;break;case"bottom":me-=ge;break}switch(P){case"center":Ht-=vt/2;break;case"right":Ht-=vt;break;case"inner":w===k-1?Ht-=vt:w>0&&(Ht-=vt/2);break}Ne={left:Ht,top:me,width:vt+dt.width,height:ge+dt.height,color:j.backdropColor}}v.push({label:O,font:A,textOffset:H,options:{rotation:y,color:nt,strokeColor:Re,strokeWidth:pe,textAlign:qt,textBaseline:K,translation:[T,D],backdrop:Ne}})}return v}_getXAxisLabelAlignment(){const{position:t,ticks:n}=this.options;if(-Me(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,l=r.widest.width;let c,u;return n==="left"?s?(u=this.right+o,i==="near"?c="left":i==="center"?(c="center",u+=l/2):(c="right",u+=l)):(u=this.right-a,i==="near"?c="right":i==="center"?(c="center",u-=l/2):(c="left",u=this.left)):n==="right"?s?(u=this.left+o,i==="near"?c="right":i==="center"?(c="center",u-=l/2):(c="left",u-=l)):(u=this.left+a,i==="near"?c="left":i==="center"?(c="center",u+=l/2):(c="right",u=this.right)):c="right",{textAlign:c,x:u}}_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=(l,c,u)=>{!u.width||!u.color||(i.save(),i.lineWidth=u.width,i.strokeStyle=u.color,i.setLineDash(u.borderDash||[]),i.lineDashOffset=u.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(n.display)for(o=0,r=s.length;o<r;++o){const l=s[o];n.drawOnChartArea&&a({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),n.drawTicks&&a({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.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,l=this._borderValue;let c,u,f,p;this.isHorizontal()?(c=_e(t,this.left,r)-r/2,u=_e(t,this.right,a)+a/2,f=p=l):(f=_e(t,this.top,r)-r/2,p=_e(t,this.bottom,a)+a/2,c=u=l),n.save(),n.lineWidth=o.width,n.strokeStyle=o.color,n.beginPath(),n.moveTo(c,f),n.lineTo(u,p),n.stroke(),n.restore()}drawLabels(t){if(!this.options.ticks.display)return;const i=this.ctx,s=this._computeLabelArea();s&&co(i,s);const o=this.getLabelItems(t);for(const r of o){const a=r.options,l=r.font,c=r.label,u=r.textOffset;Ti(i,c,0,u,l,a)}s&&uo(i)}drawTitle(){const{ctx:t,options:{position:n,title:i,reverse:s}}=this;if(!i.display)return;const o=ct(i.font),r=Mt(i.padding),a=i.align;let l=o.lineHeight/2;n==="bottom"||n==="center"||V(n)?(l+=r.bottom,Q(i.text)&&(l+=o.lineHeight*(i.text.length-1))):l+=r.top;const{titleX:c,titleY:u,maxWidth:f,rotation:p}=Op(this,l,n,a);Ti(t,i.text,0,0,o,{color:i.color,maxWidth:f,rotation:p,textAlign:Cp(a,n,s),textBaseline:"middle",translation:[c,u]})}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=R(t.grid&&t.grid.z,-1),s=R(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==on.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 ct(n.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class oi{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;Ap(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,Pp(t,r,i),this.override&&Y.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 Y[s]&&(delete Y[s][i],this.override&&delete De[i])}}function Pp(e,t,n){const i=An(Object.create(null),[n?Y.get(n):{},Y.get(t),e.defaults]);Y.set(t,i),e.defaultRoutes&&Dp(t,e.defaultRoutes),e.descriptors&&Y.describe(t,e.descriptors)}function Dp(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(),l=r.join(".");Y.route(o,s,l,a)})}function Ap(e){return"id"in e&&"defaults"in e}class Ip{constructor(){this.controllers=new oi(Il,"datasets",!0),this.elements=new oi(sn,"elements"),this.plugins=new oi(Object,"plugins"),this.scales=new oi(on,"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):z(s,r=>{const a=i||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,n,i){const s=ro(t);I(i["before"+s],[],i),n[t](i),I(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 At=new Ip;class Lp{constructor(){this._init=[]}notify(t,n,i,s){n==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const o=s?this._descriptors(t).filter(s):this._descriptors(t),r=this._notify(o,t,n,i);return n==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall")),r}_notify(t,n,i,s){s=s||{};for(const o of t){const r=o.plugin,a=r[i],l=[n,s,o.options];if(I(a,l,r)===!1&&s.cancelable)return!1}return!0}invalidate(){B(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=R(i.options&&i.options.plugins,{}),o=Rp(i);return s===!1&&!n?[]:zp(t,o,s,n)}_notifyStateChanges(t){const n=this._oldCache||[],i=this._cache,s=(o,r)=>o.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(s(n,i),t,"stop"),this._notify(s(i,n),t,"start")}}function Rp(e){const t={},n=[],i=Object.keys(At.plugins.items);for(let o=0;o<i.length;o++)n.push(At.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 Np(e,t){return!t&&e===!1?null:e===!0?{}:e}function zp(e,{plugins:t,localIds:n},i,s){const o=[],r=e.getContext();for(const a of t){const l=a.id,c=Np(i[l],s);c!==null&&o.push({plugin:a,options:Fp(e.config,{plugin:a,local:n[l]},c,r)})}return o}function Fp(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 Rs(e,t){const n=Y.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||"x"}function Hp(e,t){let n=e;return e==="_index_"?n=t:e==="_value_"&&(n=t==="x"?"y":"x"),n}function Vp(e,t){return e===t?"_index_":"_value_"}function Lr(e){if(e==="x"||e==="y"||e==="r")return e}function Bp(e){if(e==="top"||e==="bottom")return"x";if(e==="left"||e==="right")return"y"}function Ns(e,...t){if(Lr(e))return e;for(const n of t){const i=n.axis||Bp(n.position)||e.length>1&&Lr(e[0].toLowerCase());if(i)return i}throw new Error(\`Cannot determine type of '\${e}' axis. Please provide 'axis' or 'position' option.\`)}function Rr(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function Wp(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 Rr(e,"x",n[0])||Rr(e,"y",n[0])}return{}}function jp(e,t){const n=De[e.type]||{scales:{}},i=t.scales||{},s=Rs(e.type,t),o=Object.create(null);return Object.keys(i).forEach(r=>{const a=i[r];if(!V(a))return console.error(\`Invalid scale configuration for scale: \${r}\`);if(a._proxy)return console.warn(\`Ignoring resolver passed as options for scale: \${r}\`);const l=Ns(r,a,Wp(r,e),Y.scales[a.type]),c=Vp(l,s),u=n.scales||{};o[r]=kn(Object.create(null),[{axis:l},a,u[l],u[c]])}),e.data.datasets.forEach(r=>{const a=r.type||e.type,l=r.indexAxis||Rs(a,t),u=(De[a]||{}).scales||{};Object.keys(u).forEach(f=>{const p=Hp(f,l),g=r[p+"AxisID"]||p;o[g]=o[g]||Object.create(null),kn(o[g],[{axis:p},i[g],u[f]])})}),Object.keys(o).forEach(r=>{const a=o[r];kn(a,[Y.scales[a.type],Y.scale])}),o}function Hl(e){const t=e.options||(e.options={});t.plugins=R(t.plugins,{}),t.scales=jp(e,t)}function Vl(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function Up(e){return e=e||{},e.data=Vl(e.data),Hl(e),e}const Nr=new Map,Bl=new Set;function ri(e,t){let n=Nr.get(e);return n||(n=t(),Nr.set(e,n),Bl.add(n)),n}const yn=(e,t,n)=>{const i=wi(t,n);i!==void 0&&e.add(i)};class $p{constructor(t){this._config=Up(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=Vl(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(),Hl(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return ri(t,()=>[[\`datasets.\${t}\`,""]])}datasetAnimationScopeKeys(t,n){return ri(\`\${t}.transition.\${n}\`,()=>[[\`datasets.\${t}.transitions.\${n}\`,\`transitions.\${n}\`],[\`datasets.\${t}\`,""]])}datasetElementScopeKeys(t,n){return ri(\`\${t}-\${n}\`,()=>[[\`datasets.\${t}.elements.\${n}\`,\`datasets.\${t}\`,\`elements.\${n}\`,""]])}pluginScopeKeys(t){const n=t.id,i=this.type;return ri(\`\${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 l=new Set;n.forEach(u=>{t&&(l.add(t),u.forEach(f=>yn(l,t,f))),u.forEach(f=>yn(l,s,f)),u.forEach(f=>yn(l,De[o]||{},f)),u.forEach(f=>yn(l,Y,f)),u.forEach(f=>yn(l,As,f))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Bl.has(n)&&r.set(n,c),c}chartOptionScopes(){const{options:t,type:n}=this;return[t,De[n]||{},Y.datasets[n]||{},{type:n},Y,As]}resolveNamedOptions(t,n,i,s=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=zr(this._resolverCache,t,s);let l=r;if(Xp(r,n)){o.$shared=!1,i=le(i)?i():i;const c=this.createResolver(t,i,a);l=tn(r,i,c)}for(const c of n)o[c]=l[c];return o}createResolver(t,n,i=[""],s){const{resolver:o}=zr(this._resolverCache,t,i);return V(n)?tn(o,n,void 0,s):o}}function zr(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:ho(t,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},i.set(s,o)),o}const Yp=e=>V(e)&&Object.getOwnPropertyNames(e).some(t=>le(e[t]));function Xp(e,t){const{isScriptable:n,isIndexable:i}=Sl(e);for(const s of t){const o=n(s),r=i(s),a=(r||o)&&e[s];if(o&&(le(a)||Yp(a))||r&&Q(a))return!0}return!1}var qp="4.5.0";const Gp=["top","bottom","left","right","chartArea"];function Fr(e,t){return e==="top"||e==="bottom"||Gp.indexOf(e)===-1&&t==="x"}function Hr(e,t){return function(n,i){return n[e]===i[e]?n[t]-i[t]:n[e]-i[e]}}function Vr(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),I(n&&n.onComplete,[e],t)}function Kp(e){const t=e.chart,n=t.options.animation;I(n&&n.onProgress,[e],t)}function Wl(e){return go()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const di={},Br=e=>{const t=Wl(e);return Object.values(di).filter(n=>n.canvas===t).pop()};function Zp(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 Qp(e,t,n,i){return!n||e.type==="mouseout"?null:i?t:e}class zs{static defaults=Y;static instances=di;static overrides=De;static registry=At;static version=qp;static getChart=Br;static register(...t){At.add(...t),Wr()}static unregister(...t){At.remove(...t),Wr()}constructor(t,n){const i=this.config=new $p(n),s=Wl(t),o=Br(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||mp(s)),this.platform.updateConfig(i);const a=this.platform.acquireContext(s,r.aspectRatio),l=a&&a.canvas,c=l&&l.height,u=l&&l.width;if(this.id=Jh(),this.ctx=a,this.canvas=l,this.width=u,this.height=c,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Lp,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=_f(f=>this.update(f),r.resizeDelay||0),this._dataChanges=[],di[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}jt.listen(this,"complete",Vr),jt.listen(this,"progress",Kp),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:i,height:s,_aspectRatio:o}=this;return B(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 At}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():dr(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return ur(this.canvas,this.ctx),this}stop(){return jt.stop(this),this}resize(t,n){jt.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(),l=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,dr(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),I(i.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};z(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],l=Ns(r,a),c=l==="r",u=l==="x";return{options:a,dposition:c?"chartArea":u?"bottom":"left",dtype:c?"radialLinear":u?"category":"linear"}}))),z(o,r=>{const a=r.options,l=a.id,c=Ns(l,a),u=R(a.type,r.dtype);(a.position===void 0||Fr(a.position,c)!==Fr(r.dposition))&&(a.position=r.dposition),s[l]=!0;let f=null;if(l in i&&i[l].type===u)f=i[l];else{const p=At.getScale(u);f=new p({id:l,type:u,ctx:this.ctx,chart:this}),i[f.id]=f}f.init(a,t)}),z(s,(r,a)=>{r||delete i[a]}),z(i,r=>{ee.configure(this,r,r.options),ee.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(Hr("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||Rs(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 l=At.getController(a),{datasetElementType:c,dataElementType:u}=Y.datasets[a];Object.assign(l,{dataElementType:At.getElement(u),datasetElementType:c&&At.getElement(c)}),r.controller=new l(this,i),t.push(r.controller)}}return this._updateMetasets(),t}_resetElements(){z(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 c=0,u=this.data.datasets.length;c<u;c++){const{controller:f}=this.getDatasetMeta(c),p=!s&&o.indexOf(f)===-1;f.buildOrUpdateElements(p),r=Math.max(+f.getMaxOverflow(),r)}r=this._minPadding=i.layout.autoPadding?r:0,this._updateLayout(r),s||z(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Hr("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){z(this.scales,t=>{ee.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!tr(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;Zp(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(!tr(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;ee.update(this,this.width,this.height,t);const n=this.chartArea,i=n.width<=0||n.height<=0;this._layers=[],z(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,le(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&&(jt.has(this)?this.attached&&!jt.running(this)&&jt.start(this):(this.draw(),Vr({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=Cd(this,t);this.notifyPlugins("beforeDatasetDraw",i)!==!1&&(s&&co(n,s),t.controller.draw(),s&&uo(n),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(t){return Je(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,i,s){const o=Gd.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=Ie(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);Si(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(),jt.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(),ur(t,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete di[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)};z(this.options.events,o=>i(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,n=this.platform,i=(l,c)=>{n.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(n.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let r;const a=()=>{s("attach",a),this.attached=!0,this.resize(),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(){z(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},z(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,l;for(n==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=t.length;a<l;++a){r=t[a];const c=r&&this.getDatasetMeta(r.datasetIndex).controller;c&&c[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}});!vi(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=(l,c)=>l.filter(u=>!c.some(f=>u.datasetIndex===f.datasetIndex&&u.index===f.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),l=rf(t),c=Qp(t,this._lastEvent,i,l);i&&(this._lastEvent=null,I(o.onHover,[t,a,this],this),l&&I(o.onClick,[t,a,this],this));const u=!vi(a,s);return(u||n)&&(this._active=a,this._updateHoverStyles(a,s,n)),this._lastEvent=c,u}_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 Wr(){return z(zs.instances,e=>e._plugins.invalidate())}function jl(e,t,n=t){e.lineCap=R(n.borderCapStyle,t.borderCapStyle),e.setLineDash(R(n.borderDash,t.borderDash)),e.lineDashOffset=R(n.borderDashOffset,t.borderDashOffset),e.lineJoin=R(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=R(n.borderWidth,t.borderWidth),e.strokeStyle=R(n.borderColor,t.borderColor)}function Jp(e,t,n){e.lineTo(n.x,n.y)}function tg(e){return e.stepped?Rf:e.tension||e.cubicInterpolationMode==="monotone"?Nf:Jp}function Ul(e,t,n={}){const i=e.length,{start:s=0,end:o=i-1}=n,{start:r,end:a}=t,l=Math.max(s,r),c=Math.min(o,a),u=s<r&&o<r||s>a&&o>a;return{count:i,start:l,loop:t.loop,ilen:c<l&&!u?i+c-l:c-l}}function eg(e,t,n,i){const{points:s,options:o}=t,{count:r,start:a,loop:l,ilen:c}=Ul(s,n,i),u=tg(o);let{move:f=!0,reverse:p}=i||{},g,x,y;for(g=0;g<=c;++g)x=s[(a+(p?c-g:g))%r],!x.skip&&(f?(e.moveTo(x.x,x.y),f=!1):u(e,y,x,p,o.stepped),y=x);return l&&(x=s[(a+(p?c:0))%r],u(e,y,x,p,o.stepped)),!!l}function ng(e,t,n,i){const s=t.points,{count:o,start:r,ilen:a}=Ul(s,n,i),{move:l=!0,reverse:c}=i||{};let u=0,f=0,p,g,x,y,v,w;const k=O=>(r+(c?a-O:O))%o,C=()=>{y!==v&&(e.lineTo(u,v),e.lineTo(u,y),e.lineTo(u,w))};for(l&&(g=s[k(0)],e.moveTo(g.x,g.y)),p=0;p<=a;++p){if(g=s[k(p)],g.skip)continue;const O=g.x,T=g.y,D=O|0;D===x?(T<y?y=T:T>v&&(v=T),u=(f*u+O)/++f):(C(),e.lineTo(O,T),x=D,f=0,y=v=T),w=T}C()}function Fs(e){const t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!n?ng:eg}function ig(e){return e.stepped?gd:e.tension||e.cubicInterpolationMode==="monotone"?md:Se}function sg(e,t,n,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,n,i)&&s.closePath()),jl(e,t.options),e.stroke(s)}function og(e,t,n,i){const{segments:s,options:o}=t,r=Fs(t);for(const a of s)jl(e,o,a.style),e.beginPath(),r(e,t,a,{start:n,end:n+i-1})&&e.closePath(),e.stroke()}const rg=typeof Path2D=="function";function ag(e,t,n,i){rg&&!t.options.segment?sg(e,t,n,i):og(e,t,n,i)}class lg extends sn{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;ad(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=kd(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=_d(this,{property:n,start:s,end:s});if(!r.length)return;const a=[],l=ig(i);let c,u;for(c=0,u=r.length;c<u;++c){const{start:f,end:p}=r[c],g=o[f],x=o[p];if(g===x){a.push(g);continue}const y=Math.abs((s-g[n])/(x[n]-g[n])),v=l(g,x,y,i.stepped);v[n]=t[n],a.push(v)}return a.length===1?a[0]:a}pathSegment(t,n,i){return Fs(this)(t,this,n,i)}path(t,n,i){const s=this.segments,o=Fs(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(),ag(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function jr(e,t,n,i){const s=e.options,{[n]:o}=e.getProps([n],i);return Math.abs(t-o)<s.radius+s.hitRadius}class cg extends sn{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 jr(this,t,"x",n)}inYRange(t,n){return jr(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||!Je(this,n,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,Is(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}const Ur=(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)}},ug=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class $r extends sn{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=I(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=ct(i.font),o=s.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=Ur(i,o);let c,u;n.font=s.string,this.isHorizontal()?(c=this.maxWidth,u=this._fitRows(r,o,a,l)+10):(u=this.maxHeight,c=this._fitCols(r,s,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(u,t.maxHeight||this.maxHeight)}_fitRows(t,n,i,s){const{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],u=s+a;let f=t;o.textAlign="left",o.textBaseline="middle";let p=-1,g=-u;return this.legendItems.forEach((x,y)=>{const v=i+n/2+o.measureText(x.text).width;(y===0||c[c.length-1]+v+2*a>r)&&(f+=u,c[c.length-(y>0?0:1)]=0,g+=u,p++),l[y]={left:0,top:g,row:p,width:v,height:s},c[c.length-1]+=v+a}),f}_fitCols(t,n,i,s){const{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],u=r-t;let f=a,p=0,g=0,x=0,y=0;return this.legendItems.forEach((v,w)=>{const{itemWidth:k,itemHeight:C}=hg(i,n,o,v,s);w>0&&g+C+2*a>u&&(f+=p+a,c.push({width:p,height:g}),x+=p+a,y++,p=g=0),l[w]={left:x,top:g,col:y,width:k,height:C},p=Math.max(p,k),g+=C+a}),f+=p,c.push({width:p,height:g}),f}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:i,labels:{padding:s},rtl:o}}=this,r=je(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=ft(i,this.left+s,this.right-this.lineWidths[a]);for(const c of n)a!==c.row&&(a=c.row,l=ft(i,this.left+s,this.right-this.lineWidths[a])),c.top+=this.top+t+s,c.left=r.leftForLtr(r.x(l),c.width),l+=c.width+s}else{let a=0,l=ft(i,this.top+t+s,this.bottom-this.columnSizes[a].height);for(const c of n)c.col!==a&&(a=c.col,l=ft(i,this.top+t+s,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+s,c.left=r.leftForLtr(r.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;co(t,this),this._draw(),uo(t)}}_draw(){const{options:t,columnSizes:n,lineWidths:i,ctx:s}=this,{align:o,labels:r}=t,a=Y.color,l=je(t.rtl,this.left,this.width),c=ct(r.font),{padding:u}=r,f=c.size,p=f/2;let g;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:x,boxHeight:y,itemHeight:v}=Ur(r,f),w=function(D,P,E){if(isNaN(x)||x<=0||isNaN(y)||y<0)return;s.save();const A=R(E.lineWidth,1);if(s.fillStyle=R(E.fillStyle,a),s.lineCap=R(E.lineCap,"butt"),s.lineDashOffset=R(E.lineDashOffset,0),s.lineJoin=R(E.lineJoin,"miter"),s.lineWidth=A,s.strokeStyle=R(E.strokeStyle,a),s.setLineDash(R(E.lineDash,[])),r.usePointStyle){const F={radius:y*Math.SQRT2/2,pointStyle:E.pointStyle,rotation:E.rotation,borderWidth:A},L=l.xPlus(D,x/2),H=P+p;_l(s,F,L,H,r.pointStyleWidth&&x)}else{const F=P+Math.max((f-y)/2,0),L=l.leftForLtr(D,x),H=En(E.borderRadius);s.beginPath(),Object.values(H).some(K=>K!==0)?Ls(s,{x:L,y:F,w:x,h:y,radius:H}):s.rect(L,F,x,y),s.fill(),A!==0&&s.stroke()}s.restore()},k=function(D,P,E){Ti(s,E.text,D,P+v/2,c,{strikethrough:E.hidden,textAlign:l.textAlign(E.textAlign)})},C=this.isHorizontal(),O=this._computeTitleHeight();C?g={x:ft(o,this.left+u,this.right-i[0]),y:this.top+u+O,line:0}:g={x:this.left+u,y:ft(o,this.top+O+u,this.bottom-n[0].height),line:0},Cl(this.ctx,t.textDirection);const T=v+u;this.legendItems.forEach((D,P)=>{s.strokeStyle=D.fontColor,s.fillStyle=D.fontColor;const E=s.measureText(D.text).width,A=l.textAlign(D.textAlign||(D.textAlign=r.textAlign)),F=x+p+E;let L=g.x,H=g.y;l.setWidth(this.width),C?P>0&&L+F+u>this.right&&(H=g.y+=T,g.line++,L=g.x=ft(o,this.left+u,this.right-i[g.line])):P>0&&H+T>this.bottom&&(L=g.x=L+n[g.line].width+u,g.line++,H=g.y=ft(o,this.top+O+u,this.bottom-n[g.line].height));const K=l.x(L);if(w(K,H,D),L=wf(A,L+x+p,C?L+F:this.right,t.rtl),k(l.x(L),H,D),C)g.x+=F+u;else if(typeof D.text!="string"){const et=c.lineHeight;g.y+=$l(D,et)+u}else g.y+=T}),Ol(this.ctx,t.textDirection)}drawTitle(){const t=this.options,n=t.title,i=ct(n.font),s=Mt(n.padding);if(!n.display)return;const o=je(t.rtl,this.left,this.width),r=this.ctx,a=n.position,l=i.size/2,c=s.top+l;let u,f=this.left,p=this.width;if(this.isHorizontal())p=Math.max(...this.lineWidths),u=this.top+c,f=ft(t.align,f,this.right-p);else{const x=this.columnSizes.reduce((y,v)=>Math.max(y,v.height),0);u=c+ft(t.align,this.top,this.bottom-x-t.labels.padding-this._computeTitleHeight())}const g=ft(a,f,f+p);r.textAlign=o.textAlign(yl(a)),r.textBaseline="middle",r.strokeStyle=n.color,r.fillStyle=n.color,r.font=i.string,Ti(r,n.text,g,u,i)}_computeTitleHeight(){const t=this.options.title,n=ct(t.font),i=Mt(t.padding);return t.display?n.lineHeight+i.height:0}_getLegendItemAt(t,n){let i,s,o;if(_n(t,this.left,this.right)&&_n(n,this.top,this.bottom)){for(o=this.legendHitBoxes,i=0;i<o.length;++i)if(s=o[i],_n(t,s.left,s.left+s.width)&&_n(n,s.top,s.top+s.height))return this.legendItems[i]}return null}handleEvent(t){const n=this.options;if(!pg(t.type,n))return;const i=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const s=this._hoveredItem,o=ug(s,i);s&&!o&&I(n.onLeave,[t,s,this],this),this._hoveredItem=i,i&&!o&&I(n.onHover,[t,i,this],this)}else i&&I(n.onClick,[t,i,this],this)}}function hg(e,t,n,i,s){const o=fg(i,e,t,n),r=dg(s,i,t.lineHeight);return{itemWidth:o,itemHeight:r}}function fg(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 dg(e,t,n){let i=e;return typeof t.text!="string"&&(i=$l(t,n)),i}function $l(e,t){const n=e.text?e.text.length:0;return t*n}function pg(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var gg={id:"legend",_element:$r,start(e,t,n){const i=e.legend=new $r({ctx:e.ctx,options:n,chart:e});ee.configure(e,i,n),ee.addBox(e,i)},stop(e){ee.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const i=e.legend;ee.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(l=>{const c=l.controller.getStyle(n?0:void 0),u=Mt(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(u.width+u.height)/4,strokeStyle:c.borderColor,pointStyle:i||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:r&&(a||c.borderRadius),datasetIndex:l.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)}}};const Sn={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 l=a.tooltipPosition();i.add(l.x),s+=l.y,++o}}return o===0||i.size===0?!1:{x:[...i].reduce((a,l)=>a+l)/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 l=e[o].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),u=Ds(t,c);u<s&&(s=u,a=l)}}if(a){const l=a.tooltipPosition();n=l.x,i=l.y}return{x:n,y:i}}};function Dt(e,t){return t&&(Q(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function Ut(e){return(typeof e=="string"||e instanceof String)&&e.indexOf(\`
|
|
2413
2426
|
\`)>-1?e.split(\`
|
|
2414
|
-
\`):e}function mg(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 Yr(e,t){const n=e.chart.ctx,{body:i,footer:s,title:o}=e,{boxWidth:r,boxHeight:a}=t,l=ct(t.bodyFont),c=ct(t.titleFont),u=ct(t.footerFont),f=o.length,p=s.length,g=i.length,x=Mt(t.padding);let y=x.height,v=0,w=i.reduce((O,T)=>O+T.before.length+T.lines.length+T.after.length,0);if(w+=e.beforeBody.length+e.afterBody.length,f&&(y+=f*c.lineHeight+(f-1)*t.titleSpacing+t.titleMarginBottom),w){const O=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;y+=g*O+(w-g)*l.lineHeight+(w-1)*t.bodySpacing}p&&(y+=t.footerMarginTop+p*u.lineHeight+(p-1)*t.footerSpacing);let k=0;const C=function(O){v=Math.max(v,n.measureText(O).width+k)};return n.save(),n.font=c.string,z(e.title,C),n.font=l.string,z(e.beforeBody.concat(e.afterBody),C),k=t.displayColors?r+2+t.boxPadding:0,z(i,O=>{z(O.before,C),z(O.lines,C),z(O.after,C)}),k=0,n.font=u.string,z(e.footer,C),n.restore(),v+=x.width,{width:v,height:y}}function bg(e,t){const{y:n,height:i}=t;return n<i/2?"top":n>e.height-i/2?"bottom":"center"}function yg(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 xg(e,t,n,i){const{x:s,width:o}=n,{width:r,chartArea:{left:a,right:l}}=e;let c="center";return i==="center"?c=s<=(a+l)/2?"left":"right":s<=o/2?c="left":s>=r-o/2&&(c="right"),yg(c,e,t,n)&&(c="center"),c}function Xr(e,t,n){const i=n.yAlign||t.yAlign||bg(e,n);return{xAlign:n.xAlign||t.xAlign||xg(e,t,n,i),yAlign:i}}function vg(e,t){let{x:n,width:i}=e;return t==="right"?n-=i:t==="center"&&(n-=i/2),n}function _g(e,t,n){let{y:i,height:s}=e;return t==="top"?i+=n:t==="bottom"?i-=s+n:i-=s/2,i}function qr(e,t,n,i){const{caretSize:s,caretPadding:o,cornerRadius:r}=e,{xAlign:a,yAlign:l}=n,c=s+o,{topLeft:u,topRight:f,bottomLeft:p,bottomRight:g}=En(r);let x=vg(t,a);const y=_g(t,l,c);return l==="center"?a==="left"?x+=c:a==="right"&&(x-=c):a==="left"?x-=Math.max(u,p)+s:a==="right"&&(x+=Math.max(f,g)+s),{x:yt(x,0,i.width-t.width),y:yt(y,0,i.height-t.height)}}function ai(e,t,n){const i=Mt(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-i.right:e.x+i.left}function Gr(e){return Dt([],Ut(e))}function wg(e,t,n){return Le(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function Kr(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const Yl={beforeTitle:Wt,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:Wt,beforeBody:Wt,beforeLabel:Wt,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 V(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:Wt,afterBody:Wt,beforeFooter:Wt,footer:Wt,afterFooter:Wt};function rt(e,t,n,i){const s=e[t].call(n,i);return typeof s>"u"?Yl[t].call(n,i):s}class Zr extends sn{static positioners=Sn;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 Dl(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=wg(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:i}=n,s=rt(i,"beforeTitle",this,t),o=rt(i,"title",this,t),r=rt(i,"afterTitle",this,t);let a=[];return a=Dt(a,Ut(s)),a=Dt(a,Ut(o)),a=Dt(a,Ut(r)),a}getBeforeBody(t,n){return Gr(rt(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:i}=n,s=[];return z(t,o=>{const r={before:[],lines:[],after:[]},a=Kr(i,o);Dt(r.before,Ut(rt(a,"beforeLabel",this,o))),Dt(r.lines,rt(a,"label",this,o)),Dt(r.after,Ut(rt(a,"afterLabel",this,o))),s.push(r)}),s}getAfterBody(t,n){return Gr(rt(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:i}=n,s=rt(i,"beforeFooter",this,t),o=rt(i,"footer",this,t),r=rt(i,"afterFooter",this,t);let a=[];return a=Dt(a,Ut(s)),a=Dt(a,Ut(o)),a=Dt(a,Ut(r)),a}_createItems(t){const n=this._active,i=this.chart.data,s=[],o=[],r=[];let a=[],l,c;for(l=0,c=n.length;l<c;++l)a.push(mg(this.chart,n[l]));return t.filter&&(a=a.filter((u,f,p)=>t.filter(u,f,p,i))),t.itemSort&&(a=a.sort((u,f)=>t.itemSort(u,f,i))),z(a,u=>{const f=Kr(t.callbacks,u);s.push(rt(f,"labelColor",this,u)),o.push(rt(f,"labelPointStyle",this,u)),r.push(rt(f,"labelTextColor",this,u))}),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=Sn[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 l=this._size=Yr(this,i),c=Object.assign({},a,l),u=Xr(this.chart,i,c),f=qr(i,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,o={opacity:1,x:f.x,y:f.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&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:l,topRight:c,bottomLeft:u,bottomRight:f}=En(a),{x:p,y:g}=t,{width:x,height:y}=n;let v,w,k,C,O,T;return o==="center"?(O=g+y/2,s==="left"?(v=p,w=v-r,C=O+r,T=O-r):(v=p+x,w=v+r,C=O-r,T=O+r),k=v):(s==="left"?w=p+Math.max(l,u)+r:s==="right"?w=p+x-Math.max(c,f)-r:w=this.caretX,o==="top"?(C=g,O=C-r,v=w-r,k=w+r):(C=g+y,O=C+r,v=w+r,k=w-r),T=C),{x1:v,x2:w,x3:k,y1:C,y2:O,y3:T}}drawTitle(t,n,i){const s=this.title,o=s.length;let r,a,l;if(o){const c=Ue(i.rtl,this.x,this.width);for(t.x=ai(this,i.titleAlign,i),n.textAlign=c.textAlign(i.titleAlign),n.textBaseline="middle",r=ct(i.titleFont),a=i.titleSpacing,n.fillStyle=i.titleColor,n.font=r.string,l=0;l<o;++l)n.fillText(s[l],c.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+a,l+1===o&&(t.y+=i.titleMarginBottom-a)}}_drawColorBox(t,n,i,s,o){const r=this.labelColors[i],a=this.labelPointStyles[i],{boxHeight:l,boxWidth:c}=o,u=ct(o.bodyFont),f=ai(this,"left",o),p=s.x(f),g=l<u.lineHeight?(u.lineHeight-l)/2:0,x=n.y+g;if(o.usePointStyle){const y={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},v=s.leftForLtr(p,c)+c/2,w=x+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,Is(t,y,v,w),t.strokeStyle=r.borderColor,t.fillStyle=r.backgroundColor,Is(t,y,v,w)}else{t.lineWidth=B(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 y=s.leftForLtr(p,c),v=s.leftForLtr(s.xPlus(p,1),c-2),w=En(r.borderRadius);Object.values(w).some(k=>k!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Ls(t,{x:y,y:x,w:c,h:l,radius:w}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),Ls(t,{x:v,y:x+1,w:c-2,h:l-2,radius:w}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(y,x,c,l),t.strokeRect(y,x,c,l),t.fillStyle=r.backgroundColor,t.fillRect(v,x+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,n,i){const{body:s}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:u}=i,f=ct(i.bodyFont);let p=f.lineHeight,g=0;const x=Ue(i.rtl,this.x,this.width),y=function(E){n.fillText(E,x.x(t.x+g),t.y+p/2),t.y+=p+o},v=x.textAlign(r);let w,k,C,O,T,D,P;for(n.textAlign=r,n.textBaseline="middle",n.font=f.string,t.x=ai(this,v,i),n.fillStyle=i.bodyColor,z(this.beforeBody,y),g=a&&v!=="right"?r==="center"?c/2+u:c+2+u:0,O=0,D=s.length;O<D;++O){for(w=s[O],k=this.labelTextColors[O],n.fillStyle=k,z(w.before,y),C=w.lines,a&&C.length&&(this._drawColorBox(n,t,O,x,i),p=Math.max(f.lineHeight,l)),T=0,P=C.length;T<P;++T)y(C[T]),p=f.lineHeight;z(w.after,y)}g=0,p=f.lineHeight,z(this.afterBody,y),t.y-=o}drawFooter(t,n,i){const s=this.footer,o=s.length;let r,a;if(o){const l=Ue(i.rtl,this.x,this.width);for(t.x=ai(this,i.footerAlign,i),t.y+=i.footerMarginTop,n.textAlign=l.textAlign(i.footerAlign),n.textBaseline="middle",r=ct(i.footerFont),n.fillStyle=i.footerColor,n.font=r.string,a=0;a<o;++a)n.fillText(s[a],l.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:l}=t,{width:c,height:u}=i,{topLeft:f,topRight:p,bottomLeft:g,bottomRight:x}=En(s.cornerRadius);n.fillStyle=s.backgroundColor,n.strokeStyle=s.borderColor,n.lineWidth=s.borderWidth,n.beginPath(),n.moveTo(a+f,l),r==="top"&&this.drawCaret(t,n,i,s),n.lineTo(a+c-p,l),n.quadraticCurveTo(a+c,l,a+c,l+p),r==="center"&&o==="right"&&this.drawCaret(t,n,i,s),n.lineTo(a+c,l+u-x),n.quadraticCurveTo(a+c,l+u,a+c-x,l+u),r==="bottom"&&this.drawCaret(t,n,i,s),n.lineTo(a+g,l+u),n.quadraticCurveTo(a,l+u,a,l+u-g),r==="center"&&o==="left"&&this.drawCaret(t,n,i,s),n.lineTo(a,l+f),n.quadraticCurveTo(a,l,a+f,l),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=Sn[t.position].call(this,this._active,this._eventPosition);if(!r)return;const a=this._size=Yr(this,t),l=Object.assign({},r,this._size),c=Xr(n,t,l),u=qr(t,l,c,n);(s._to!==u.x||o._to!==u.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,u))}}_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=Mt(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),Cl(t,n.textDirection),o.y+=r.top,this.drawTitle(o,t,n),this.drawBody(o,t,n),this.drawFooter(o,t,n),Ol(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const i=this._active,s=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!vi(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),l=n||!vi(r,o)||a;return l&&(this._active=r,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),l}_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=Sn[o.position].call(this,t,n);return r!==!1&&(i!==r.x||s!==r.y)}}var Sg={id:"tooltip",_element:Zr,positioners:Sn,afterInit(e,t,n){n&&(e.tooltip=new Zr({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:Yl},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"]};const kg=(e,t,n,i)=>(typeof t=="string"?(n=e.push(t)-1,i.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function Tg(e,t,n,i){const s=e.indexOf(t);if(s===-1)return kg(e,t,n,i);const o=e.lastIndexOf(t);return s!==o?n:s}const Mg=(e,t)=>e===null?null:yt(Math.round(e),0,t);function Qr(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class Eg extends on{static id="category";static defaults={ticks:{callback:Qr}};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(V(t))return null;const i=this.getLabels();return n=isFinite(n)&&i[n]===t?n:Tg(i,t,R(n,t),this._addedLabels),Mg(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 Qr.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 Cg(e,t){const n=[],{bounds:s,step:o,min:r,max:a,precision:l,count:c,maxTicks:u,maxDigits:f,includeBounds:p}=e,g=o||1,x=u-1,{min:y,max:v}=t,w=!V(r),k=!V(a),C=!V(c),O=(v-y)/(f+1);let T=nr((v-y)/x/g)*g,D,P,E,A;if(T<1e-14&&!w&&!k)return[{value:y},{value:v}];A=Math.ceil(v/T)-Math.floor(y/T),A>x&&(T=nr(A*T/x/g)*g),V(l)||(D=Math.pow(10,l),T=Math.ceil(T*D)/D),s==="ticks"?(P=Math.floor(y/T)*T,E=Math.ceil(v/T)*T):(P=y,E=v),w&&k&&o&&hf((a-r)/o,T/1e3)?(A=Math.round(Math.min((a-r)/T,u)),T=(a-r)/A,P=r,E=a):C?(P=w?r:P,E=k?a:E,A=c-1,T=(E-P)/A):(A=(E-P)/T,Oe(A,Math.round(A),T/1e3)?A=Math.round(A):A=Math.ceil(A));const F=Math.max(ir(T),ir(P));D=Math.pow(10,V(l)?F:l),P=Math.round(P*D)/D,E=Math.round(E*D)/D;let L=0;for(w&&(p&&P!==r?(n.push({value:r}),P<r&&L++,Oe(Math.round((P+L*T)*D)/D,r,Jr(r,O,e))&&L++):P<r&&L++);L<A;++L){const H=Math.round((P+L*T)*D)/D;if(k&&H>a)break;n.push({value:H})}return k&&p&&E!==a?n.length&&Oe(n[n.length-1].value,a,Jr(a,O,e))?n[n.length-1].value=a:n.push({value:a}):(!k||E===a)&&n.push({value:E}),n}function Jr(e,t,{horizontal:n,minRotation:i}){const s=Me(i),o=(n?Math.sin(s):Math.cos(s))||.001,r=.75*t*(""+e).length;return Math.min(t/o,r)}class Og extends on{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 V(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=l=>s=n?s:l,a=l=>o=i?o:l;if(t){const l=ce(s),c=ce(o);l<0&&c<0?a(0):l>0&&c>0&&r(0)}if(s===o){let l=o===0?1:Math.abs(o*.05);a(o+l),t||r(s-l)}this.min=s,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit: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=Cg(s,o);return t.bounds==="ticks"&&ff(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 xl(t,this.chart.options.locale,this.options.ticks.format)}}class Pg extends Og{static id="linear";static defaults={ticks:{callback:vl.formatters.numeric}};determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=xt(t)?t:0,this.max=xt(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,i=Me(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 zi={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}},lt=Object.keys(zi);function ta(e,t){return e-t}function ea(e,t){if(V(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)),xt(r)||(r=typeof i=="string"?n.parse(r,i):n.parse(r)),r===null?null:(s&&(r=s==="week"&&(In(o)||o===!0)?n.startOf(r,"isoWeek",o):n.startOf(r,s)),+r)}function na(e,t,n,i){const s=lt.length;for(let o=lt.indexOf(e);o<s-1;++o){const r=zi[lt[o]],a=r.steps?r.steps:Number.MAX_SAFE_INTEGER;if(r.common&&Math.ceil((n-t)/(a*r.size))<=i)return lt[o]}return lt[s-1]}function Dg(e,t,n,i,s){for(let o=lt.length-1;o>=lt.indexOf(n);o--){const r=lt[o];if(zi[r].common&&e._adapter.diff(s,i,r)>=t-1)return r}return lt[n?lt.indexOf(n):0]}function Ag(e){for(let t=lt.indexOf(e)+1,n=lt.length;t<n;++t)if(zi[lt[t]].common)return lt[t]}function ia(e,t,n){if(!n)e[t]=!0;else if(n.length){const{lo:i,hi:s}=ao(n,t),o=n[i]>=t?n[i]:n[s];e[o]=!0}}function Ig(e,t,n,i){const s=e._adapter,o=+s.startOf(t[0].value,i),r=t[t.length-1].value;let a,l;for(a=o;a<=r;a=+s.add(a,1,i))l=n[a],l>=0&&(t[l].major=!0);return t}function sa(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:Ig(e,i,s,n)}class oa extends on{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 Ud._date(t.adapters.date);s.init(n),kn(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:ea(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 l(c){!r&&!isNaN(c.min)&&(s=Math.min(s,c.min)),!a&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!r||!a)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),s=xt(s)&&!isNaN(s)?s:+n.startOf(Date.now(),i),o=xt(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=yf(s,o,r);return this._unit=n.unit||(i.autoSkip?na(n.minUnit,this.min,this.max,this._getLabelCapacity(o)):Dg(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:Ag(this._unit),this.initOffsets(s),t.reverse&&a.reverse(),sa(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=yt(n,0,r),i=yt(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||na(o.minUnit,n,i,this._getLabelCapacity(n)),a=R(s.ticks.stepSize,1),l=r==="week"?o.isoWeekday:!1,c=In(l)||l===!0,u={};let f=n,p,g;if(c&&(f=+t.startOf(f,"isoWeek",l)),f=+t.startOf(f,c?"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 x=s.ticks.source==="data"&&this.getDataTimestamps();for(p=f,g=0;p<i;p=+t.add(p,a,r),g++)ia(u,p,x);return(p===i||s.bounds==="ticks"||g===1)&&ia(u,p,x),Object.keys(u).sort(ta).map(y=>+y)}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 I(r,[t,n,i],this);const a=o.time.displayFormats,l=this._unit,c=this._majorUnit,u=l&&a[l],f=c&&a[c],p=i[n],g=c&&f&&p&&p.major;return this._adapter.format(t,s||(g?f:u))}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=Me(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,sa(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(ea(this,s[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return vf(t.sort(ta))}}function li(e,t,n){let i=0,s=e.length-1,o,r,a,l;n?(t>=e[i].pos&&t<=e[s].pos&&({lo:i,hi:s}=Ee(e,"pos",t)),{pos:o,time:a}=e[i],{pos:r,time:l}=e[s]):(t>=e[i].time&&t<=e[s].time&&({lo:i,hi:s}=Ee(e,"time",t)),{time:o,pos:a}=e[i],{time:r,pos:l}=e[s]);const c=r-o;return c?a+(l-a)*(t-o)/c:a}class Nm extends oa{static id="timeseries";static defaults=oa.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=li(n,this.min),this._tableRange=li(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:i}=this,s=[],o=[];let r,a,l,c,u;for(r=0,a=t.length;r<a;++r)c=t[r],c>=n&&c<=i&&s.push(c);if(s.length<2)return[{time:n,pos:0},{time:i,pos:1}];for(r=0,a=s.length;r<a;++r)u=s[r+1],l=s[r-1],c=s[r],Math.round((u+l)/2)!==c&&o.push({time:c,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(li(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,i=this.getDecimalForPixel(t)/n.factor-n.end;return li(this._table,i*this._tableRange+this._minPos,!0)}}function Lg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var os={exports:{}};/*! Hammer.JS - v2.0.7 - 2016-04-22
|
|
2427
|
+
\`):e}function mg(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 Yr(e,t){const n=e.chart.ctx,{body:i,footer:s,title:o}=e,{boxWidth:r,boxHeight:a}=t,l=ct(t.bodyFont),c=ct(t.titleFont),u=ct(t.footerFont),f=o.length,p=s.length,g=i.length,x=Mt(t.padding);let y=x.height,v=0,w=i.reduce((O,T)=>O+T.before.length+T.lines.length+T.after.length,0);if(w+=e.beforeBody.length+e.afterBody.length,f&&(y+=f*c.lineHeight+(f-1)*t.titleSpacing+t.titleMarginBottom),w){const O=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;y+=g*O+(w-g)*l.lineHeight+(w-1)*t.bodySpacing}p&&(y+=t.footerMarginTop+p*u.lineHeight+(p-1)*t.footerSpacing);let k=0;const C=function(O){v=Math.max(v,n.measureText(O).width+k)};return n.save(),n.font=c.string,z(e.title,C),n.font=l.string,z(e.beforeBody.concat(e.afterBody),C),k=t.displayColors?r+2+t.boxPadding:0,z(i,O=>{z(O.before,C),z(O.lines,C),z(O.after,C)}),k=0,n.font=u.string,z(e.footer,C),n.restore(),v+=x.width,{width:v,height:y}}function bg(e,t){const{y:n,height:i}=t;return n<i/2?"top":n>e.height-i/2?"bottom":"center"}function yg(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 xg(e,t,n,i){const{x:s,width:o}=n,{width:r,chartArea:{left:a,right:l}}=e;let c="center";return i==="center"?c=s<=(a+l)/2?"left":"right":s<=o/2?c="left":s>=r-o/2&&(c="right"),yg(c,e,t,n)&&(c="center"),c}function Xr(e,t,n){const i=n.yAlign||t.yAlign||bg(e,n);return{xAlign:n.xAlign||t.xAlign||xg(e,t,n,i),yAlign:i}}function vg(e,t){let{x:n,width:i}=e;return t==="right"?n-=i:t==="center"&&(n-=i/2),n}function _g(e,t,n){let{y:i,height:s}=e;return t==="top"?i+=n:t==="bottom"?i-=s+n:i-=s/2,i}function qr(e,t,n,i){const{caretSize:s,caretPadding:o,cornerRadius:r}=e,{xAlign:a,yAlign:l}=n,c=s+o,{topLeft:u,topRight:f,bottomLeft:p,bottomRight:g}=En(r);let x=vg(t,a);const y=_g(t,l,c);return l==="center"?a==="left"?x+=c:a==="right"&&(x-=c):a==="left"?x-=Math.max(u,p)+s:a==="right"&&(x+=Math.max(f,g)+s),{x:yt(x,0,i.width-t.width),y:yt(y,0,i.height-t.height)}}function ai(e,t,n){const i=Mt(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-i.right:e.x+i.left}function Gr(e){return Dt([],Ut(e))}function wg(e,t,n){return Ie(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function Kr(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const Yl={beforeTitle:Wt,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:Wt,beforeBody:Wt,beforeLabel:Wt,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 B(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:Wt,afterBody:Wt,beforeFooter:Wt,footer:Wt,afterFooter:Wt};function rt(e,t,n,i){const s=e[t].call(n,i);return typeof s>"u"?Yl[t].call(n,i):s}class Zr extends sn{static positioners=Sn;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 Dl(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=wg(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:i}=n,s=rt(i,"beforeTitle",this,t),o=rt(i,"title",this,t),r=rt(i,"afterTitle",this,t);let a=[];return a=Dt(a,Ut(s)),a=Dt(a,Ut(o)),a=Dt(a,Ut(r)),a}getBeforeBody(t,n){return Gr(rt(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:i}=n,s=[];return z(t,o=>{const r={before:[],lines:[],after:[]},a=Kr(i,o);Dt(r.before,Ut(rt(a,"beforeLabel",this,o))),Dt(r.lines,rt(a,"label",this,o)),Dt(r.after,Ut(rt(a,"afterLabel",this,o))),s.push(r)}),s}getAfterBody(t,n){return Gr(rt(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:i}=n,s=rt(i,"beforeFooter",this,t),o=rt(i,"footer",this,t),r=rt(i,"afterFooter",this,t);let a=[];return a=Dt(a,Ut(s)),a=Dt(a,Ut(o)),a=Dt(a,Ut(r)),a}_createItems(t){const n=this._active,i=this.chart.data,s=[],o=[],r=[];let a=[],l,c;for(l=0,c=n.length;l<c;++l)a.push(mg(this.chart,n[l]));return t.filter&&(a=a.filter((u,f,p)=>t.filter(u,f,p,i))),t.itemSort&&(a=a.sort((u,f)=>t.itemSort(u,f,i))),z(a,u=>{const f=Kr(t.callbacks,u);s.push(rt(f,"labelColor",this,u)),o.push(rt(f,"labelPointStyle",this,u)),r.push(rt(f,"labelTextColor",this,u))}),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=Sn[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 l=this._size=Yr(this,i),c=Object.assign({},a,l),u=Xr(this.chart,i,c),f=qr(i,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,o={opacity:1,x:f.x,y:f.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&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:l,topRight:c,bottomLeft:u,bottomRight:f}=En(a),{x:p,y:g}=t,{width:x,height:y}=n;let v,w,k,C,O,T;return o==="center"?(O=g+y/2,s==="left"?(v=p,w=v-r,C=O+r,T=O-r):(v=p+x,w=v+r,C=O-r,T=O+r),k=v):(s==="left"?w=p+Math.max(l,u)+r:s==="right"?w=p+x-Math.max(c,f)-r:w=this.caretX,o==="top"?(C=g,O=C-r,v=w-r,k=w+r):(C=g+y,O=C+r,v=w+r,k=w-r),T=C),{x1:v,x2:w,x3:k,y1:C,y2:O,y3:T}}drawTitle(t,n,i){const s=this.title,o=s.length;let r,a,l;if(o){const c=je(i.rtl,this.x,this.width);for(t.x=ai(this,i.titleAlign,i),n.textAlign=c.textAlign(i.titleAlign),n.textBaseline="middle",r=ct(i.titleFont),a=i.titleSpacing,n.fillStyle=i.titleColor,n.font=r.string,l=0;l<o;++l)n.fillText(s[l],c.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+a,l+1===o&&(t.y+=i.titleMarginBottom-a)}}_drawColorBox(t,n,i,s,o){const r=this.labelColors[i],a=this.labelPointStyles[i],{boxHeight:l,boxWidth:c}=o,u=ct(o.bodyFont),f=ai(this,"left",o),p=s.x(f),g=l<u.lineHeight?(u.lineHeight-l)/2:0,x=n.y+g;if(o.usePointStyle){const y={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},v=s.leftForLtr(p,c)+c/2,w=x+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,Is(t,y,v,w),t.strokeStyle=r.borderColor,t.fillStyle=r.backgroundColor,Is(t,y,v,w)}else{t.lineWidth=V(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 y=s.leftForLtr(p,c),v=s.leftForLtr(s.xPlus(p,1),c-2),w=En(r.borderRadius);Object.values(w).some(k=>k!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Ls(t,{x:y,y:x,w:c,h:l,radius:w}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),Ls(t,{x:v,y:x+1,w:c-2,h:l-2,radius:w}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(y,x,c,l),t.strokeRect(y,x,c,l),t.fillStyle=r.backgroundColor,t.fillRect(v,x+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,n,i){const{body:s}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:u}=i,f=ct(i.bodyFont);let p=f.lineHeight,g=0;const x=je(i.rtl,this.x,this.width),y=function(E){n.fillText(E,x.x(t.x+g),t.y+p/2),t.y+=p+o},v=x.textAlign(r);let w,k,C,O,T,D,P;for(n.textAlign=r,n.textBaseline="middle",n.font=f.string,t.x=ai(this,v,i),n.fillStyle=i.bodyColor,z(this.beforeBody,y),g=a&&v!=="right"?r==="center"?c/2+u:c+2+u:0,O=0,D=s.length;O<D;++O){for(w=s[O],k=this.labelTextColors[O],n.fillStyle=k,z(w.before,y),C=w.lines,a&&C.length&&(this._drawColorBox(n,t,O,x,i),p=Math.max(f.lineHeight,l)),T=0,P=C.length;T<P;++T)y(C[T]),p=f.lineHeight;z(w.after,y)}g=0,p=f.lineHeight,z(this.afterBody,y),t.y-=o}drawFooter(t,n,i){const s=this.footer,o=s.length;let r,a;if(o){const l=je(i.rtl,this.x,this.width);for(t.x=ai(this,i.footerAlign,i),t.y+=i.footerMarginTop,n.textAlign=l.textAlign(i.footerAlign),n.textBaseline="middle",r=ct(i.footerFont),n.fillStyle=i.footerColor,n.font=r.string,a=0;a<o;++a)n.fillText(s[a],l.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:l}=t,{width:c,height:u}=i,{topLeft:f,topRight:p,bottomLeft:g,bottomRight:x}=En(s.cornerRadius);n.fillStyle=s.backgroundColor,n.strokeStyle=s.borderColor,n.lineWidth=s.borderWidth,n.beginPath(),n.moveTo(a+f,l),r==="top"&&this.drawCaret(t,n,i,s),n.lineTo(a+c-p,l),n.quadraticCurveTo(a+c,l,a+c,l+p),r==="center"&&o==="right"&&this.drawCaret(t,n,i,s),n.lineTo(a+c,l+u-x),n.quadraticCurveTo(a+c,l+u,a+c-x,l+u),r==="bottom"&&this.drawCaret(t,n,i,s),n.lineTo(a+g,l+u),n.quadraticCurveTo(a,l+u,a,l+u-g),r==="center"&&o==="left"&&this.drawCaret(t,n,i,s),n.lineTo(a,l+f),n.quadraticCurveTo(a,l,a+f,l),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=Sn[t.position].call(this,this._active,this._eventPosition);if(!r)return;const a=this._size=Yr(this,t),l=Object.assign({},r,this._size),c=Xr(n,t,l),u=qr(t,l,c,n);(s._to!==u.x||o._to!==u.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,u))}}_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=Mt(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),Cl(t,n.textDirection),o.y+=r.top,this.drawTitle(o,t,n),this.drawBody(o,t,n),this.drawFooter(o,t,n),Ol(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const i=this._active,s=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!vi(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),l=n||!vi(r,o)||a;return l&&(this._active=r,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),l}_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=Sn[o.position].call(this,t,n);return r!==!1&&(i!==r.x||s!==r.y)}}var Sg={id:"tooltip",_element:Zr,positioners:Sn,afterInit(e,t,n){n&&(e.tooltip=new Zr({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:Yl},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"]};const kg=(e,t,n,i)=>(typeof t=="string"?(n=e.push(t)-1,i.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function Tg(e,t,n,i){const s=e.indexOf(t);if(s===-1)return kg(e,t,n,i);const o=e.lastIndexOf(t);return s!==o?n:s}const Mg=(e,t)=>e===null?null:yt(Math.round(e),0,t);function Qr(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class Eg extends on{static id="category";static defaults={ticks:{callback:Qr}};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(B(t))return null;const i=this.getLabels();return n=isFinite(n)&&i[n]===t?n:Tg(i,t,R(n,t),this._addedLabels),Mg(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 Qr.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 Cg(e,t){const n=[],{bounds:s,step:o,min:r,max:a,precision:l,count:c,maxTicks:u,maxDigits:f,includeBounds:p}=e,g=o||1,x=u-1,{min:y,max:v}=t,w=!B(r),k=!B(a),C=!B(c),O=(v-y)/(f+1);let T=nr((v-y)/x/g)*g,D,P,E,A;if(T<1e-14&&!w&&!k)return[{value:y},{value:v}];A=Math.ceil(v/T)-Math.floor(y/T),A>x&&(T=nr(A*T/x/g)*g),B(l)||(D=Math.pow(10,l),T=Math.ceil(T*D)/D),s==="ticks"?(P=Math.floor(y/T)*T,E=Math.ceil(v/T)*T):(P=y,E=v),w&&k&&o&&hf((a-r)/o,T/1e3)?(A=Math.round(Math.min((a-r)/T,u)),T=(a-r)/A,P=r,E=a):C?(P=w?r:P,E=k?a:E,A=c-1,T=(E-P)/A):(A=(E-P)/T,Oe(A,Math.round(A),T/1e3)?A=Math.round(A):A=Math.ceil(A));const F=Math.max(ir(T),ir(P));D=Math.pow(10,B(l)?F:l),P=Math.round(P*D)/D,E=Math.round(E*D)/D;let L=0;for(w&&(p&&P!==r?(n.push({value:r}),P<r&&L++,Oe(Math.round((P+L*T)*D)/D,r,Jr(r,O,e))&&L++):P<r&&L++);L<A;++L){const H=Math.round((P+L*T)*D)/D;if(k&&H>a)break;n.push({value:H})}return k&&p&&E!==a?n.length&&Oe(n[n.length-1].value,a,Jr(a,O,e))?n[n.length-1].value=a:n.push({value:a}):(!k||E===a)&&n.push({value:E}),n}function Jr(e,t,{horizontal:n,minRotation:i}){const s=Me(i),o=(n?Math.sin(s):Math.cos(s))||.001,r=.75*t*(""+e).length;return Math.min(t/o,r)}class Og extends on{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 B(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=l=>s=n?s:l,a=l=>o=i?o:l;if(t){const l=ce(s),c=ce(o);l<0&&c<0?a(0):l>0&&c>0&&r(0)}if(s===o){let l=o===0?1:Math.abs(o*.05);a(o+l),t||r(s-l)}this.min=s,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit: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=Cg(s,o);return t.bounds==="ticks"&&ff(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 xl(t,this.chart.options.locale,this.options.ticks.format)}}class Pg extends Og{static id="linear";static defaults={ticks:{callback:vl.formatters.numeric}};determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=xt(t)?t:0,this.max=xt(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,i=Me(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 zi={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}},lt=Object.keys(zi);function ta(e,t){return e-t}function ea(e,t){if(B(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)),xt(r)||(r=typeof i=="string"?n.parse(r,i):n.parse(r)),r===null?null:(s&&(r=s==="week"&&(In(o)||o===!0)?n.startOf(r,"isoWeek",o):n.startOf(r,s)),+r)}function na(e,t,n,i){const s=lt.length;for(let o=lt.indexOf(e);o<s-1;++o){const r=zi[lt[o]],a=r.steps?r.steps:Number.MAX_SAFE_INTEGER;if(r.common&&Math.ceil((n-t)/(a*r.size))<=i)return lt[o]}return lt[s-1]}function Dg(e,t,n,i,s){for(let o=lt.length-1;o>=lt.indexOf(n);o--){const r=lt[o];if(zi[r].common&&e._adapter.diff(s,i,r)>=t-1)return r}return lt[n?lt.indexOf(n):0]}function Ag(e){for(let t=lt.indexOf(e)+1,n=lt.length;t<n;++t)if(zi[lt[t]].common)return lt[t]}function ia(e,t,n){if(!n)e[t]=!0;else if(n.length){const{lo:i,hi:s}=ao(n,t),o=n[i]>=t?n[i]:n[s];e[o]=!0}}function Ig(e,t,n,i){const s=e._adapter,o=+s.startOf(t[0].value,i),r=t[t.length-1].value;let a,l;for(a=o;a<=r;a=+s.add(a,1,i))l=n[a],l>=0&&(t[l].major=!0);return t}function sa(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:Ig(e,i,s,n)}class oa extends on{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 Ud._date(t.adapters.date);s.init(n),kn(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:ea(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 l(c){!r&&!isNaN(c.min)&&(s=Math.min(s,c.min)),!a&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!r||!a)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),s=xt(s)&&!isNaN(s)?s:+n.startOf(Date.now(),i),o=xt(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=yf(s,o,r);return this._unit=n.unit||(i.autoSkip?na(n.minUnit,this.min,this.max,this._getLabelCapacity(o)):Dg(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:Ag(this._unit),this.initOffsets(s),t.reverse&&a.reverse(),sa(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=yt(n,0,r),i=yt(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||na(o.minUnit,n,i,this._getLabelCapacity(n)),a=R(s.ticks.stepSize,1),l=r==="week"?o.isoWeekday:!1,c=In(l)||l===!0,u={};let f=n,p,g;if(c&&(f=+t.startOf(f,"isoWeek",l)),f=+t.startOf(f,c?"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 x=s.ticks.source==="data"&&this.getDataTimestamps();for(p=f,g=0;p<i;p=+t.add(p,a,r),g++)ia(u,p,x);return(p===i||s.bounds==="ticks"||g===1)&&ia(u,p,x),Object.keys(u).sort(ta).map(y=>+y)}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 I(r,[t,n,i],this);const a=o.time.displayFormats,l=this._unit,c=this._majorUnit,u=l&&a[l],f=c&&a[c],p=i[n],g=c&&f&&p&&p.major;return this._adapter.format(t,s||(g?f:u))}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=Me(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,sa(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(ea(this,s[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return vf(t.sort(ta))}}function li(e,t,n){let i=0,s=e.length-1,o,r,a,l;n?(t>=e[i].pos&&t<=e[s].pos&&({lo:i,hi:s}=Ee(e,"pos",t)),{pos:o,time:a}=e[i],{pos:r,time:l}=e[s]):(t>=e[i].time&&t<=e[s].time&&({lo:i,hi:s}=Ee(e,"time",t)),{time:o,pos:a}=e[i],{time:r,pos:l}=e[s]);const c=r-o;return c?a+(l-a)*(t-o)/c:a}class Nm extends oa{static id="timeseries";static defaults=oa.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=li(n,this.min),this._tableRange=li(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:i}=this,s=[],o=[];let r,a,l,c,u;for(r=0,a=t.length;r<a;++r)c=t[r],c>=n&&c<=i&&s.push(c);if(s.length<2)return[{time:n,pos:0},{time:i,pos:1}];for(r=0,a=s.length;r<a;++r)u=s[r+1],l=s[r-1],c=s[r],Math.round((u+l)/2)!==c&&o.push({time:c,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(li(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,i=this.getDecimalForPixel(t)/n.factor-n.end;return li(this._table,i*this._tableRange+this._minPos,!0)}}function Lg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var os={exports:{}};/*! Hammer.JS - v2.0.7 - 2016-04-22
|
|
2415
2428
|
* http://hammerjs.github.io/
|
|
2416
2429
|
*
|
|
2417
2430
|
* Copyright (c) 2016 Jorik Tangelder;
|
|
2418
2431
|
* Licensed under the MIT license */var ra;function Rg(){return ra||(ra=1,(function(e){(function(t,n,i,s){var o=["","webkit","Moz","MS","ms","o"],r=n.createElement("div"),a="function",l=Math.round,c=Math.abs,u=Date.now;function f(h,d,b){return setTimeout(C(h,b),d)}function p(h,d,b){return Array.isArray(h)?(g(h,b[d],b),!0):!1}function g(h,d,b){var _;if(h)if(h.forEach)h.forEach(d,b);else if(h.length!==s)for(_=0;_<h.length;)d.call(b,h[_],_,h),_++;else for(_ in h)h.hasOwnProperty(_)&&d.call(b,h[_],_,h)}function x(h,d,b){var _="DEPRECATED METHOD: "+d+\`
|
|
2419
2432
|
\`+b+\` AT
|
|
2420
|
-
\`;return function(){var S=new Error("get-stack-trace"),M=S&&S.stack?S.stack.replace(/^[^\\(]+?[\\n$]/gm,"").replace(/^\\s+at\\s+/gm,"").replace(/^Object.<anonymous>\\s*\\(/gm,"{anonymous}()@"):"Unknown Stack Trace",N=t.console&&(t.console.warn||t.console.log);return N&&N.call(t.console,_,M),h.apply(this,arguments)}}var y;typeof Object.assign!="function"?y=function(d){if(d===s||d===null)throw new TypeError("Cannot convert undefined or null to object");for(var b=Object(d),_=1;_<arguments.length;_++){var S=arguments[_];if(S!==s&&S!==null)for(var M in S)S.hasOwnProperty(M)&&(b[M]=S[M])}return b}:y=Object.assign;var v=x(function(d,b,_){for(var S=Object.keys(b),M=0;M<S.length;)(!_||_&&d[S[M]]===s)&&(d[S[M]]=b[S[M]]),M++;return d},"extend","Use \`assign\`."),w=x(function(d,b){return v(d,b,!0)},"merge","Use \`assign\`.");function k(h,d,b){var _=d.prototype,S;S=h.prototype=Object.create(_),S.constructor=h,S._super=_,b&&y(S,b)}function C(h,d){return function(){return h.apply(d,arguments)}}function O(h,d){return typeof h==a?h.apply(d&&d[0]||s,d):h}function T(h,d){return h===s?d:h}function D(h,d,b){g(F(d),function(_){h.addEventListener(_,b,!1)})}function P(h,d,b){g(F(d),function(_){h.removeEventListener(_,b,!1)})}function E(h,d){for(;h;){if(h==d)return!0;h=h.parentNode}return!1}function A(h,d){return h.indexOf(d)>-1}function F(h){return h.trim().split(/\\s+/g)}function L(h,d,b){if(h.indexOf&&!b)return h.indexOf(d);for(var _=0;_<h.length;){if(b&&h[_][b]==d||!b&&h[_]===d)return _;_++}return-1}function H(h){return Array.prototype.slice.call(h,0)}function K(h,d,b){for(var _=[],S=[],M=0;M<h.length;){var N=h[M][d];L(S,N)<0&&_.push(h[M]),S[M]=N,M++}return _=_.sort(function(Z,st){return Z[d]>st[d]}),_}function et(h,d){for(var b,_,S=d[0].toUpperCase()+d.slice(1),M=0;M<o.length;){if(b=o[M],_=b?b+S:d,_ in h)return _;M++}return s}var j=1;function q(){return j++}function nt(h){var d=h.ownerDocument||h;return d.defaultView||d.parentWindow||t}var Ne=/mobile|tablet|ip(ad|hone|od)|android/i,pe="ontouchstart"in t,qt=et(t,"PointerEvent")!==s,ze=pe&&Ne.test(navigator.userAgent),dt="touch",ge="pen",vt="mouse",me="kinect",Ht=25,it=1,be=2,X=4,ot=8,zn=1,an=2,ln=4,cn=8,un=16,Et=an|ln,ye=cn|un,vo=Et|ye,_o=["x","y"],Fn=["clientX","clientY"];function pt(h,d){var b=this;this.manager=h,this.callback=d,this.element=h.element,this.target=h.options.inputTarget,this.domHandler=function(_){O(h.options.enable,[h])&&b.handler(_)},this.init()}pt.prototype={handler:function(){},init:function(){this.evEl&&D(this.element,this.evEl,this.domHandler),this.evTarget&&D(this.target,this.evTarget,this.domHandler),this.evWin&&D(nt(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&P(this.element,this.evEl,this.domHandler),this.evTarget&&P(this.target,this.evTarget,this.domHandler),this.evWin&&P(nt(this.element),this.evWin,this.domHandler)}};function ac(h){var d,b=h.options.inputClass;return b?d=b:qt?d=Hi:ze?d=Vn:pe?d=Bi:d=Bn,new d(h,lc)}function lc(h,d,b){var _=b.pointers.length,S=b.changedPointers.length,M=d&it&&_-S===0,N=d&(X|ot)&&_-S===0;b.isFirst=!!M,b.isFinal=!!N,M&&(h.session={}),b.eventType=d,cc(h,b),h.emit("hammer.input",b),h.recognize(b),h.session.prevInput=b}function cc(h,d){var b=h.session,_=d.pointers,S=_.length;b.firstInput||(b.firstInput=wo(d)),S>1&&!b.firstMultiple?b.firstMultiple=wo(d):S===1&&(b.firstMultiple=!1);var M=b.firstInput,N=b.firstMultiple,G=N?N.center:M.center,Z=d.center=So(_);d.timeStamp=u(),d.deltaTime=d.timeStamp-M.timeStamp,d.angle=Fi(G,Z),d.distance=Hn(G,Z),uc(b,d),d.offsetDirection=To(d.deltaX,d.deltaY);var st=ko(d.deltaTime,d.deltaX,d.deltaY);d.overallVelocityX=st.x,d.overallVelocityY=st.y,d.overallVelocity=c(st.x)>c(st.y)?st.x:st.y,d.scale=N?dc(N.pointers,_):1,d.rotation=N?fc(N.pointers,_):0,d.maxPointers=b.prevInput?d.pointers.length>b.prevInput.maxPointers?d.pointers.length:b.prevInput.maxPointers:d.pointers.length,hc(b,d);var Ot=h.element;E(d.srcEvent.target,Ot)&&(Ot=d.srcEvent.target),d.target=Ot}function uc(h,d){var b=d.center,_=h.offsetDelta||{},S=h.prevDelta||{},M=h.prevInput||{};(d.eventType===it||M.eventType===X)&&(S=h.prevDelta={x:M.deltaX||0,y:M.deltaY||0},_=h.offsetDelta={x:b.x,y:b.y}),d.deltaX=S.x+(b.x-_.x),d.deltaY=S.y+(b.y-_.y)}function hc(h,d){var b=h.lastInterval||d,_=d.timeStamp-b.timeStamp,S,M,N,G;if(d.eventType!=ot&&(_>Ht||b.velocity===s)){var Z=d.deltaX-b.deltaX,st=d.deltaY-b.deltaY,Ot=ko(_,Z,st);M=Ot.x,N=Ot.y,S=c(Ot.x)>c(Ot.y)?Ot.x:Ot.y,G=To(Z,st),h.lastInterval=d}else S=b.velocity,M=b.velocityX,N=b.velocityY,G=b.direction;d.velocity=S,d.velocityX=M,d.velocityY=N,d.direction=G}function wo(h){for(var d=[],b=0;b<h.pointers.length;)d[b]={clientX:l(h.pointers[b].clientX),clientY:l(h.pointers[b].clientY)},b++;return{timeStamp:u(),pointers:d,center:So(d),deltaX:h.deltaX,deltaY:h.deltaY}}function So(h){var d=h.length;if(d===1)return{x:l(h[0].clientX),y:l(h[0].clientY)};for(var b=0,_=0,S=0;S<d;)b+=h[S].clientX,_+=h[S].clientY,S++;return{x:l(b/d),y:l(_/d)}}function ko(h,d,b){return{x:d/h||0,y:b/h||0}}function To(h,d){return h===d?zn:c(h)>=c(d)?h<0?an:ln:d<0?cn:un}function Hn(h,d,b){b||(b=_o);var _=d[b[0]]-h[b[0]],S=d[b[1]]-h[b[1]];return Math.sqrt(_*_+S*S)}function Fi(h,d,b){b||(b=_o);var _=d[b[0]]-h[b[0]],S=d[b[1]]-h[b[1]];return Math.atan2(S,_)*180/Math.PI}function fc(h,d){return Fi(d[1],d[0],Fn)+Fi(h[1],h[0],Fn)}function dc(h,d){return Hn(d[0],d[1],Fn)/Hn(h[0],h[1],Fn)}var pc={mousedown:it,mousemove:be,mouseup:X},gc="mousedown",mc="mousemove mouseup";function Bn(){this.evEl=gc,this.evWin=mc,this.pressed=!1,pt.apply(this,arguments)}k(Bn,pt,{handler:function(d){var b=pc[d.type];b&it&&d.button===0&&(this.pressed=!0),b&be&&d.which!==1&&(b=X),this.pressed&&(b&X&&(this.pressed=!1),this.callback(this.manager,b,{pointers:[d],changedPointers:[d],pointerType:vt,srcEvent:d}))}});var bc={pointerdown:it,pointermove:be,pointerup:X,pointercancel:ot,pointerout:ot},yc={2:dt,3:ge,4:vt,5:me},Mo="pointerdown",Eo="pointermove pointerup pointercancel";t.MSPointerEvent&&!t.PointerEvent&&(Mo="MSPointerDown",Eo="MSPointerMove MSPointerUp MSPointerCancel");function Hi(){this.evEl=Mo,this.evWin=Eo,pt.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}k(Hi,pt,{handler:function(d){var b=this.store,_=!1,S=d.type.toLowerCase().replace("ms",""),M=bc[S],N=yc[d.pointerType]||d.pointerType,G=N==dt,Z=L(b,d.pointerId,"pointerId");M&it&&(d.button===0||G)?Z<0&&(b.push(d),Z=b.length-1):M&(X|ot)&&(_=!0),!(Z<0)&&(b[Z]=d,this.callback(this.manager,M,{pointers:b,changedPointers:[d],pointerType:N,srcEvent:d}),_&&b.splice(Z,1))}});var xc={touchstart:it,touchmove:be,touchend:X,touchcancel:ot},vc="touchstart",_c="touchstart touchmove touchend touchcancel";function Co(){this.evTarget=vc,this.evWin=_c,this.started=!1,pt.apply(this,arguments)}k(Co,pt,{handler:function(d){var b=xc[d.type];if(b===it&&(this.started=!0),!!this.started){var _=wc.call(this,d,b);b&(X|ot)&&_[0].length-_[1].length===0&&(this.started=!1),this.callback(this.manager,b,{pointers:_[0],changedPointers:_[1],pointerType:dt,srcEvent:d})}}});function wc(h,d){var b=H(h.touches),_=H(h.changedTouches);return d&(X|ot)&&(b=K(b.concat(_),"identifier")),[b,_]}var Sc={touchstart:it,touchmove:be,touchend:X,touchcancel:ot},kc="touchstart touchmove touchend touchcancel";function Vn(){this.evTarget=kc,this.targetIds={},pt.apply(this,arguments)}k(Vn,pt,{handler:function(d){var b=Sc[d.type],_=Tc.call(this,d,b);_&&this.callback(this.manager,b,{pointers:_[0],changedPointers:_[1],pointerType:dt,srcEvent:d})}});function Tc(h,d){var b=H(h.touches),_=this.targetIds;if(d&(it|be)&&b.length===1)return _[b[0].identifier]=!0,[b,b];var S,M,N=H(h.changedTouches),G=[],Z=this.target;if(M=b.filter(function(st){return E(st.target,Z)}),d===it)for(S=0;S<M.length;)_[M[S].identifier]=!0,S++;for(S=0;S<N.length;)_[N[S].identifier]&&G.push(N[S]),d&(X|ot)&&delete _[N[S].identifier],S++;if(G.length)return[K(M.concat(G),"identifier"),G]}var Mc=2500,Oo=25;function Bi(){pt.apply(this,arguments);var h=C(this.handler,this);this.touch=new Vn(this.manager,h),this.mouse=new Bn(this.manager,h),this.primaryTouch=null,this.lastTouches=[]}k(Bi,pt,{handler:function(d,b,_){var S=_.pointerType==dt,M=_.pointerType==vt;if(!(M&&_.sourceCapabilities&&_.sourceCapabilities.firesTouchEvents)){if(S)Ec.call(this,b,_);else if(M&&Cc.call(this,_))return;this.callback(d,b,_)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function Ec(h,d){h&it?(this.primaryTouch=d.changedPointers[0].identifier,Po.call(this,d)):h&(X|ot)&&Po.call(this,d)}function Po(h){var d=h.changedPointers[0];if(d.identifier===this.primaryTouch){var b={x:d.clientX,y:d.clientY};this.lastTouches.push(b);var _=this.lastTouches,S=function(){var M=_.indexOf(b);M>-1&&_.splice(M,1)};setTimeout(S,Mc)}}function Cc(h){for(var d=h.srcEvent.clientX,b=h.srcEvent.clientY,_=0;_<this.lastTouches.length;_++){var S=this.lastTouches[_],M=Math.abs(d-S.x),N=Math.abs(b-S.y);if(M<=Oo&&N<=Oo)return!0}return!1}var Do=et(r.style,"touchAction"),Ao=Do!==s,Io="compute",Lo="auto",Vi="manipulation",xe="none",hn="pan-x",fn="pan-y",Wn=Pc();function Wi(h,d){this.manager=h,this.set(d)}Wi.prototype={set:function(h){h==Io&&(h=this.compute()),Ao&&this.manager.element.style&&Wn[h]&&(this.manager.element.style[Do]=h),this.actions=h.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var h=[];return g(this.manager.recognizers,function(d){O(d.options.enable,[d])&&(h=h.concat(d.getTouchAction()))}),Oc(h.join(" "))},preventDefaults:function(h){var d=h.srcEvent,b=h.offsetDirection;if(this.manager.session.prevented){d.preventDefault();return}var _=this.actions,S=A(_,xe)&&!Wn[xe],M=A(_,fn)&&!Wn[fn],N=A(_,hn)&&!Wn[hn];if(S){var G=h.pointers.length===1,Z=h.distance<2,st=h.deltaTime<250;if(G&&Z&&st)return}if(!(N&&M)&&(S||M&&b&Et||N&&b&ye))return this.preventSrc(d)},preventSrc:function(h){this.manager.session.prevented=!0,h.preventDefault()}};function Oc(h){if(A(h,xe))return xe;var d=A(h,hn),b=A(h,fn);return d&&b?xe:d||b?d?hn:fn:A(h,Vi)?Vi:Lo}function Pc(){if(!Ao)return!1;var h={},d=t.CSS&&t.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(b){h[b]=d?t.CSS.supports("touch-action",b):!0}),h}var jn=1,gt=2,Fe=4,Gt=8,Bt=Gt,dn=16,Ct=32;function Vt(h){this.options=y({},this.defaults,h||{}),this.id=q(),this.manager=null,this.options.enable=T(this.options.enable,!0),this.state=jn,this.simultaneous={},this.requireFail=[]}Vt.prototype={defaults:{},set:function(h){return y(this.options,h),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(h){if(p(h,"recognizeWith",this))return this;var d=this.simultaneous;return h=Un(h,this),d[h.id]||(d[h.id]=h,h.recognizeWith(this)),this},dropRecognizeWith:function(h){return p(h,"dropRecognizeWith",this)?this:(h=Un(h,this),delete this.simultaneous[h.id],this)},requireFailure:function(h){if(p(h,"requireFailure",this))return this;var d=this.requireFail;return h=Un(h,this),L(d,h)===-1&&(d.push(h),h.requireFailure(this)),this},dropRequireFailure:function(h){if(p(h,"dropRequireFailure",this))return this;h=Un(h,this);var d=L(this.requireFail,h);return d>-1&&this.requireFail.splice(d,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(h){return!!this.simultaneous[h.id]},emit:function(h){var d=this,b=this.state;function _(S){d.manager.emit(S,h)}b<Gt&&_(d.options.event+Ro(b)),_(d.options.event),h.additionalEvent&&_(h.additionalEvent),b>=Gt&&_(d.options.event+Ro(b))},tryEmit:function(h){if(this.canEmit())return this.emit(h);this.state=Ct},canEmit:function(){for(var h=0;h<this.requireFail.length;){if(!(this.requireFail[h].state&(Ct|jn)))return!1;h++}return!0},recognize:function(h){var d=y({},h);if(!O(this.options.enable,[this,d])){this.reset(),this.state=Ct;return}this.state&(Bt|dn|Ct)&&(this.state=jn),this.state=this.process(d),this.state&(gt|Fe|Gt|dn)&&this.tryEmit(d)},process:function(h){},getTouchAction:function(){},reset:function(){}};function Ro(h){return h&dn?"cancel":h&Gt?"end":h&Fe?"move":h>?"start":""}function No(h){return h==un?"down":h==cn?"up":h==an?"left":h==ln?"right":""}function Un(h,d){var b=d.manager;return b?b.get(h):h}function _t(){Vt.apply(this,arguments)}k(_t,Vt,{defaults:{pointers:1},attrTest:function(h){var d=this.options.pointers;return d===0||h.pointers.length===d},process:function(h){var d=this.state,b=h.eventType,_=d&(gt|Fe),S=this.attrTest(h);return _&&(b&ot||!S)?d|dn:_||S?b&X?d|Gt:d>?d|Fe:gt:Ct}});function $n(){_t.apply(this,arguments),this.pX=null,this.pY=null}k($n,_t,{defaults:{event:"pan",threshold:10,pointers:1,direction:vo},getTouchAction:function(){var h=this.options.direction,d=[];return h&Et&&d.push(fn),h&ye&&d.push(hn),d},directionTest:function(h){var d=this.options,b=!0,_=h.distance,S=h.direction,M=h.deltaX,N=h.deltaY;return S&d.direction||(d.direction&Et?(S=M===0?zn:M<0?an:ln,b=M!=this.pX,_=Math.abs(h.deltaX)):(S=N===0?zn:N<0?cn:un,b=N!=this.pY,_=Math.abs(h.deltaY))),h.direction=S,b&&_>d.threshold&&S&d.direction},attrTest:function(h){return _t.prototype.attrTest.call(this,h)&&(this.state>||!(this.state>)&&this.directionTest(h))},emit:function(h){this.pX=h.deltaX,this.pY=h.deltaY;var d=No(h.direction);d&&(h.additionalEvent=this.options.event+d),this._super.emit.call(this,h)}});function ji(){_t.apply(this,arguments)}k(ji,_t,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[xe]},attrTest:function(h){return this._super.attrTest.call(this,h)&&(Math.abs(h.scale-1)>this.options.threshold||this.state>)},emit:function(h){if(h.scale!==1){var d=h.scale<1?"in":"out";h.additionalEvent=this.options.event+d}this._super.emit.call(this,h)}});function Ui(){Vt.apply(this,arguments),this._timer=null,this._input=null}k(Ui,Vt,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Lo]},process:function(h){var d=this.options,b=h.pointers.length===d.pointers,_=h.distance<d.threshold,S=h.deltaTime>d.time;if(this._input=h,!_||!b||h.eventType&(X|ot)&&!S)this.reset();else if(h.eventType&it)this.reset(),this._timer=f(function(){this.state=Bt,this.tryEmit()},d.time,this);else if(h.eventType&X)return Bt;return Ct},reset:function(){clearTimeout(this._timer)},emit:function(h){this.state===Bt&&(h&&h.eventType&X?this.manager.emit(this.options.event+"up",h):(this._input.timeStamp=u(),this.manager.emit(this.options.event,this._input)))}});function $i(){_t.apply(this,arguments)}k($i,_t,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[xe]},attrTest:function(h){return this._super.attrTest.call(this,h)&&(Math.abs(h.rotation)>this.options.threshold||this.state>)}});function Yi(){_t.apply(this,arguments)}k(Yi,_t,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Et|ye,pointers:1},getTouchAction:function(){return $n.prototype.getTouchAction.call(this)},attrTest:function(h){var d=this.options.direction,b;return d&(Et|ye)?b=h.overallVelocity:d&Et?b=h.overallVelocityX:d&ye&&(b=h.overallVelocityY),this._super.attrTest.call(this,h)&&d&h.offsetDirection&&h.distance>this.options.threshold&&h.maxPointers==this.options.pointers&&c(b)>this.options.velocity&&h.eventType&X},emit:function(h){var d=No(h.offsetDirection);d&&this.manager.emit(this.options.event+d,h),this.manager.emit(this.options.event,h)}});function Yn(){Vt.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}k(Yn,Vt,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Vi]},process:function(h){var d=this.options,b=h.pointers.length===d.pointers,_=h.distance<d.threshold,S=h.deltaTime<d.time;if(this.reset(),h.eventType&it&&this.count===0)return this.failTimeout();if(_&&S&&b){if(h.eventType!=X)return this.failTimeout();var M=this.pTime?h.timeStamp-this.pTime<d.interval:!0,N=!this.pCenter||Hn(this.pCenter,h.center)<d.posThreshold;this.pTime=h.timeStamp,this.pCenter=h.center,!N||!M?this.count=1:this.count+=1,this._input=h;var G=this.count%d.taps;if(G===0)return this.hasRequireFailures()?(this._timer=f(function(){this.state=Bt,this.tryEmit()},d.interval,this),gt):Bt}return Ct},failTimeout:function(){return this._timer=f(function(){this.state=Ct},this.options.interval,this),Ct},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==Bt&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function Kt(h,d){return d=d||{},d.recognizers=T(d.recognizers,Kt.defaults.preset),new Xi(h,d)}Kt.VERSION="2.0.7",Kt.defaults={domEvents:!1,touchAction:Io,enable:!0,inputTarget:null,inputClass:null,preset:[[$i,{enable:!1}],[ji,{enable:!1},["rotate"]],[Yi,{direction:Et}],[$n,{direction:Et},["swipe"]],[Yn],[Yn,{event:"doubletap",taps:2},["tap"]],[Ui]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var Dc=1,zo=2;function Xi(h,d){this.options=y({},Kt.defaults,d||{}),this.options.inputTarget=this.options.inputTarget||h,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=h,this.input=ac(this),this.touchAction=new Wi(this,this.options.touchAction),Fo(this,!0),g(this.options.recognizers,function(b){var _=this.add(new b[0](b[1]));b[2]&&_.recognizeWith(b[2]),b[3]&&_.requireFailure(b[3])},this)}Xi.prototype={set:function(h){return y(this.options,h),h.touchAction&&this.touchAction.update(),h.inputTarget&&(this.input.destroy(),this.input.target=h.inputTarget,this.input.init()),this},stop:function(h){this.session.stopped=h?zo:Dc},recognize:function(h){var d=this.session;if(!d.stopped){this.touchAction.preventDefaults(h);var b,_=this.recognizers,S=d.curRecognizer;(!S||S&&S.state&Bt)&&(S=d.curRecognizer=null);for(var M=0;M<_.length;)b=_[M],d.stopped!==zo&&(!S||b==S||b.canRecognizeWith(S))?b.recognize(h):b.reset(),!S&&b.state&(gt|Fe|Gt)&&(S=d.curRecognizer=b),M++}},get:function(h){if(h instanceof Vt)return h;for(var d=this.recognizers,b=0;b<d.length;b++)if(d[b].options.event==h)return d[b];return null},add:function(h){if(p(h,"add",this))return this;var d=this.get(h.options.event);return d&&this.remove(d),this.recognizers.push(h),h.manager=this,this.touchAction.update(),h},remove:function(h){if(p(h,"remove",this))return this;if(h=this.get(h),h){var d=this.recognizers,b=L(d,h);b!==-1&&(d.splice(b,1),this.touchAction.update())}return this},on:function(h,d){if(h!==s&&d!==s){var b=this.handlers;return g(F(h),function(_){b[_]=b[_]||[],b[_].push(d)}),this}},off:function(h,d){if(h!==s){var b=this.handlers;return g(F(h),function(_){d?b[_]&&b[_].splice(L(b[_],d),1):delete b[_]}),this}},emit:function(h,d){this.options.domEvents&&Ac(h,d);var b=this.handlers[h]&&this.handlers[h].slice();if(!(!b||!b.length)){d.type=h,d.preventDefault=function(){d.srcEvent.preventDefault()};for(var _=0;_<b.length;)b[_](d),_++}},destroy:function(){this.element&&Fo(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function Fo(h,d){var b=h.element;if(b.style){var _;g(h.options.cssProps,function(S,M){_=et(b.style,M),d?(h.oldCssProps[_]=b.style[_],b.style[_]=S):b.style[_]=h.oldCssProps[_]||""}),d||(h.oldCssProps={})}}function Ac(h,d){var b=n.createEvent("Event");b.initEvent(h,!0,!0),b.gesture=d,d.target.dispatchEvent(b)}y(Kt,{INPUT_START:it,INPUT_MOVE:be,INPUT_END:X,INPUT_CANCEL:ot,STATE_POSSIBLE:jn,STATE_BEGAN:gt,STATE_CHANGED:Fe,STATE_ENDED:Gt,STATE_RECOGNIZED:Bt,STATE_CANCELLED:dn,STATE_FAILED:Ct,DIRECTION_NONE:zn,DIRECTION_LEFT:an,DIRECTION_RIGHT:ln,DIRECTION_UP:cn,DIRECTION_DOWN:un,DIRECTION_HORIZONTAL:Et,DIRECTION_VERTICAL:ye,DIRECTION_ALL:vo,Manager:Xi,Input:pt,TouchAction:Wi,TouchInput:Vn,MouseInput:Bn,PointerEventInput:Hi,TouchMouseInput:Bi,SingleTouchInput:Co,Recognizer:Vt,AttrRecognizer:_t,Tap:Yn,Pan:$n,Swipe:Yi,Pinch:ji,Rotate:$i,Press:Ui,on:D,off:P,each:g,merge:w,extend:v,assign:y,inherit:k,bindFn:C,prefixed:et});var Ic=typeof t<"u"?t:typeof self<"u"?self:{};Ic.Hammer=Kt,e.exports?e.exports=Kt:t[i]=Kt})(window,document,"Hammer")})(os)),os.exports}var Ng=Rg();const Cn=Lg(Ng);/*!
|
|
2433
|
+
\`;return function(){var S=new Error("get-stack-trace"),M=S&&S.stack?S.stack.replace(/^[^\\(]+?[\\n$]/gm,"").replace(/^\\s+at\\s+/gm,"").replace(/^Object.<anonymous>\\s*\\(/gm,"{anonymous}()@"):"Unknown Stack Trace",N=t.console&&(t.console.warn||t.console.log);return N&&N.call(t.console,_,M),h.apply(this,arguments)}}var y;typeof Object.assign!="function"?y=function(d){if(d===s||d===null)throw new TypeError("Cannot convert undefined or null to object");for(var b=Object(d),_=1;_<arguments.length;_++){var S=arguments[_];if(S!==s&&S!==null)for(var M in S)S.hasOwnProperty(M)&&(b[M]=S[M])}return b}:y=Object.assign;var v=x(function(d,b,_){for(var S=Object.keys(b),M=0;M<S.length;)(!_||_&&d[S[M]]===s)&&(d[S[M]]=b[S[M]]),M++;return d},"extend","Use \`assign\`."),w=x(function(d,b){return v(d,b,!0)},"merge","Use \`assign\`.");function k(h,d,b){var _=d.prototype,S;S=h.prototype=Object.create(_),S.constructor=h,S._super=_,b&&y(S,b)}function C(h,d){return function(){return h.apply(d,arguments)}}function O(h,d){return typeof h==a?h.apply(d&&d[0]||s,d):h}function T(h,d){return h===s?d:h}function D(h,d,b){g(F(d),function(_){h.addEventListener(_,b,!1)})}function P(h,d,b){g(F(d),function(_){h.removeEventListener(_,b,!1)})}function E(h,d){for(;h;){if(h==d)return!0;h=h.parentNode}return!1}function A(h,d){return h.indexOf(d)>-1}function F(h){return h.trim().split(/\\s+/g)}function L(h,d,b){if(h.indexOf&&!b)return h.indexOf(d);for(var _=0;_<h.length;){if(b&&h[_][b]==d||!b&&h[_]===d)return _;_++}return-1}function H(h){return Array.prototype.slice.call(h,0)}function K(h,d,b){for(var _=[],S=[],M=0;M<h.length;){var N=h[M][d];L(S,N)<0&&_.push(h[M]),S[M]=N,M++}return _=_.sort(function(Z,st){return Z[d]>st[d]}),_}function et(h,d){for(var b,_,S=d[0].toUpperCase()+d.slice(1),M=0;M<o.length;){if(b=o[M],_=b?b+S:d,_ in h)return _;M++}return s}var j=1;function q(){return j++}function nt(h){var d=h.ownerDocument||h;return d.defaultView||d.parentWindow||t}var Re=/mobile|tablet|ip(ad|hone|od)|android/i,pe="ontouchstart"in t,qt=et(t,"PointerEvent")!==s,Ne=pe&&Re.test(navigator.userAgent),dt="touch",ge="pen",vt="mouse",me="kinect",Ht=25,it=1,be=2,X=4,ot=8,zn=1,an=2,ln=4,cn=8,un=16,Et=an|ln,ye=cn|un,vo=Et|ye,_o=["x","y"],Fn=["clientX","clientY"];function pt(h,d){var b=this;this.manager=h,this.callback=d,this.element=h.element,this.target=h.options.inputTarget,this.domHandler=function(_){O(h.options.enable,[h])&&b.handler(_)},this.init()}pt.prototype={handler:function(){},init:function(){this.evEl&&D(this.element,this.evEl,this.domHandler),this.evTarget&&D(this.target,this.evTarget,this.domHandler),this.evWin&&D(nt(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&P(this.element,this.evEl,this.domHandler),this.evTarget&&P(this.target,this.evTarget,this.domHandler),this.evWin&&P(nt(this.element),this.evWin,this.domHandler)}};function ac(h){var d,b=h.options.inputClass;return b?d=b:qt?d=Hi:Ne?d=Bn:pe?d=Vi:d=Vn,new d(h,lc)}function lc(h,d,b){var _=b.pointers.length,S=b.changedPointers.length,M=d&it&&_-S===0,N=d&(X|ot)&&_-S===0;b.isFirst=!!M,b.isFinal=!!N,M&&(h.session={}),b.eventType=d,cc(h,b),h.emit("hammer.input",b),h.recognize(b),h.session.prevInput=b}function cc(h,d){var b=h.session,_=d.pointers,S=_.length;b.firstInput||(b.firstInput=wo(d)),S>1&&!b.firstMultiple?b.firstMultiple=wo(d):S===1&&(b.firstMultiple=!1);var M=b.firstInput,N=b.firstMultiple,G=N?N.center:M.center,Z=d.center=So(_);d.timeStamp=u(),d.deltaTime=d.timeStamp-M.timeStamp,d.angle=Fi(G,Z),d.distance=Hn(G,Z),uc(b,d),d.offsetDirection=To(d.deltaX,d.deltaY);var st=ko(d.deltaTime,d.deltaX,d.deltaY);d.overallVelocityX=st.x,d.overallVelocityY=st.y,d.overallVelocity=c(st.x)>c(st.y)?st.x:st.y,d.scale=N?dc(N.pointers,_):1,d.rotation=N?fc(N.pointers,_):0,d.maxPointers=b.prevInput?d.pointers.length>b.prevInput.maxPointers?d.pointers.length:b.prevInput.maxPointers:d.pointers.length,hc(b,d);var Ot=h.element;E(d.srcEvent.target,Ot)&&(Ot=d.srcEvent.target),d.target=Ot}function uc(h,d){var b=d.center,_=h.offsetDelta||{},S=h.prevDelta||{},M=h.prevInput||{};(d.eventType===it||M.eventType===X)&&(S=h.prevDelta={x:M.deltaX||0,y:M.deltaY||0},_=h.offsetDelta={x:b.x,y:b.y}),d.deltaX=S.x+(b.x-_.x),d.deltaY=S.y+(b.y-_.y)}function hc(h,d){var b=h.lastInterval||d,_=d.timeStamp-b.timeStamp,S,M,N,G;if(d.eventType!=ot&&(_>Ht||b.velocity===s)){var Z=d.deltaX-b.deltaX,st=d.deltaY-b.deltaY,Ot=ko(_,Z,st);M=Ot.x,N=Ot.y,S=c(Ot.x)>c(Ot.y)?Ot.x:Ot.y,G=To(Z,st),h.lastInterval=d}else S=b.velocity,M=b.velocityX,N=b.velocityY,G=b.direction;d.velocity=S,d.velocityX=M,d.velocityY=N,d.direction=G}function wo(h){for(var d=[],b=0;b<h.pointers.length;)d[b]={clientX:l(h.pointers[b].clientX),clientY:l(h.pointers[b].clientY)},b++;return{timeStamp:u(),pointers:d,center:So(d),deltaX:h.deltaX,deltaY:h.deltaY}}function So(h){var d=h.length;if(d===1)return{x:l(h[0].clientX),y:l(h[0].clientY)};for(var b=0,_=0,S=0;S<d;)b+=h[S].clientX,_+=h[S].clientY,S++;return{x:l(b/d),y:l(_/d)}}function ko(h,d,b){return{x:d/h||0,y:b/h||0}}function To(h,d){return h===d?zn:c(h)>=c(d)?h<0?an:ln:d<0?cn:un}function Hn(h,d,b){b||(b=_o);var _=d[b[0]]-h[b[0]],S=d[b[1]]-h[b[1]];return Math.sqrt(_*_+S*S)}function Fi(h,d,b){b||(b=_o);var _=d[b[0]]-h[b[0]],S=d[b[1]]-h[b[1]];return Math.atan2(S,_)*180/Math.PI}function fc(h,d){return Fi(d[1],d[0],Fn)+Fi(h[1],h[0],Fn)}function dc(h,d){return Hn(d[0],d[1],Fn)/Hn(h[0],h[1],Fn)}var pc={mousedown:it,mousemove:be,mouseup:X},gc="mousedown",mc="mousemove mouseup";function Vn(){this.evEl=gc,this.evWin=mc,this.pressed=!1,pt.apply(this,arguments)}k(Vn,pt,{handler:function(d){var b=pc[d.type];b&it&&d.button===0&&(this.pressed=!0),b&be&&d.which!==1&&(b=X),this.pressed&&(b&X&&(this.pressed=!1),this.callback(this.manager,b,{pointers:[d],changedPointers:[d],pointerType:vt,srcEvent:d}))}});var bc={pointerdown:it,pointermove:be,pointerup:X,pointercancel:ot,pointerout:ot},yc={2:dt,3:ge,4:vt,5:me},Mo="pointerdown",Eo="pointermove pointerup pointercancel";t.MSPointerEvent&&!t.PointerEvent&&(Mo="MSPointerDown",Eo="MSPointerMove MSPointerUp MSPointerCancel");function Hi(){this.evEl=Mo,this.evWin=Eo,pt.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}k(Hi,pt,{handler:function(d){var b=this.store,_=!1,S=d.type.toLowerCase().replace("ms",""),M=bc[S],N=yc[d.pointerType]||d.pointerType,G=N==dt,Z=L(b,d.pointerId,"pointerId");M&it&&(d.button===0||G)?Z<0&&(b.push(d),Z=b.length-1):M&(X|ot)&&(_=!0),!(Z<0)&&(b[Z]=d,this.callback(this.manager,M,{pointers:b,changedPointers:[d],pointerType:N,srcEvent:d}),_&&b.splice(Z,1))}});var xc={touchstart:it,touchmove:be,touchend:X,touchcancel:ot},vc="touchstart",_c="touchstart touchmove touchend touchcancel";function Co(){this.evTarget=vc,this.evWin=_c,this.started=!1,pt.apply(this,arguments)}k(Co,pt,{handler:function(d){var b=xc[d.type];if(b===it&&(this.started=!0),!!this.started){var _=wc.call(this,d,b);b&(X|ot)&&_[0].length-_[1].length===0&&(this.started=!1),this.callback(this.manager,b,{pointers:_[0],changedPointers:_[1],pointerType:dt,srcEvent:d})}}});function wc(h,d){var b=H(h.touches),_=H(h.changedTouches);return d&(X|ot)&&(b=K(b.concat(_),"identifier")),[b,_]}var Sc={touchstart:it,touchmove:be,touchend:X,touchcancel:ot},kc="touchstart touchmove touchend touchcancel";function Bn(){this.evTarget=kc,this.targetIds={},pt.apply(this,arguments)}k(Bn,pt,{handler:function(d){var b=Sc[d.type],_=Tc.call(this,d,b);_&&this.callback(this.manager,b,{pointers:_[0],changedPointers:_[1],pointerType:dt,srcEvent:d})}});function Tc(h,d){var b=H(h.touches),_=this.targetIds;if(d&(it|be)&&b.length===1)return _[b[0].identifier]=!0,[b,b];var S,M,N=H(h.changedTouches),G=[],Z=this.target;if(M=b.filter(function(st){return E(st.target,Z)}),d===it)for(S=0;S<M.length;)_[M[S].identifier]=!0,S++;for(S=0;S<N.length;)_[N[S].identifier]&&G.push(N[S]),d&(X|ot)&&delete _[N[S].identifier],S++;if(G.length)return[K(M.concat(G),"identifier"),G]}var Mc=2500,Oo=25;function Vi(){pt.apply(this,arguments);var h=C(this.handler,this);this.touch=new Bn(this.manager,h),this.mouse=new Vn(this.manager,h),this.primaryTouch=null,this.lastTouches=[]}k(Vi,pt,{handler:function(d,b,_){var S=_.pointerType==dt,M=_.pointerType==vt;if(!(M&&_.sourceCapabilities&&_.sourceCapabilities.firesTouchEvents)){if(S)Ec.call(this,b,_);else if(M&&Cc.call(this,_))return;this.callback(d,b,_)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function Ec(h,d){h&it?(this.primaryTouch=d.changedPointers[0].identifier,Po.call(this,d)):h&(X|ot)&&Po.call(this,d)}function Po(h){var d=h.changedPointers[0];if(d.identifier===this.primaryTouch){var b={x:d.clientX,y:d.clientY};this.lastTouches.push(b);var _=this.lastTouches,S=function(){var M=_.indexOf(b);M>-1&&_.splice(M,1)};setTimeout(S,Mc)}}function Cc(h){for(var d=h.srcEvent.clientX,b=h.srcEvent.clientY,_=0;_<this.lastTouches.length;_++){var S=this.lastTouches[_],M=Math.abs(d-S.x),N=Math.abs(b-S.y);if(M<=Oo&&N<=Oo)return!0}return!1}var Do=et(r.style,"touchAction"),Ao=Do!==s,Io="compute",Lo="auto",Bi="manipulation",xe="none",hn="pan-x",fn="pan-y",Wn=Pc();function Wi(h,d){this.manager=h,this.set(d)}Wi.prototype={set:function(h){h==Io&&(h=this.compute()),Ao&&this.manager.element.style&&Wn[h]&&(this.manager.element.style[Do]=h),this.actions=h.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var h=[];return g(this.manager.recognizers,function(d){O(d.options.enable,[d])&&(h=h.concat(d.getTouchAction()))}),Oc(h.join(" "))},preventDefaults:function(h){var d=h.srcEvent,b=h.offsetDirection;if(this.manager.session.prevented){d.preventDefault();return}var _=this.actions,S=A(_,xe)&&!Wn[xe],M=A(_,fn)&&!Wn[fn],N=A(_,hn)&&!Wn[hn];if(S){var G=h.pointers.length===1,Z=h.distance<2,st=h.deltaTime<250;if(G&&Z&&st)return}if(!(N&&M)&&(S||M&&b&Et||N&&b&ye))return this.preventSrc(d)},preventSrc:function(h){this.manager.session.prevented=!0,h.preventDefault()}};function Oc(h){if(A(h,xe))return xe;var d=A(h,hn),b=A(h,fn);return d&&b?xe:d||b?d?hn:fn:A(h,Bi)?Bi:Lo}function Pc(){if(!Ao)return!1;var h={},d=t.CSS&&t.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(b){h[b]=d?t.CSS.supports("touch-action",b):!0}),h}var jn=1,gt=2,ze=4,Gt=8,Vt=Gt,dn=16,Ct=32;function Bt(h){this.options=y({},this.defaults,h||{}),this.id=q(),this.manager=null,this.options.enable=T(this.options.enable,!0),this.state=jn,this.simultaneous={},this.requireFail=[]}Bt.prototype={defaults:{},set:function(h){return y(this.options,h),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(h){if(p(h,"recognizeWith",this))return this;var d=this.simultaneous;return h=Un(h,this),d[h.id]||(d[h.id]=h,h.recognizeWith(this)),this},dropRecognizeWith:function(h){return p(h,"dropRecognizeWith",this)?this:(h=Un(h,this),delete this.simultaneous[h.id],this)},requireFailure:function(h){if(p(h,"requireFailure",this))return this;var d=this.requireFail;return h=Un(h,this),L(d,h)===-1&&(d.push(h),h.requireFailure(this)),this},dropRequireFailure:function(h){if(p(h,"dropRequireFailure",this))return this;h=Un(h,this);var d=L(this.requireFail,h);return d>-1&&this.requireFail.splice(d,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(h){return!!this.simultaneous[h.id]},emit:function(h){var d=this,b=this.state;function _(S){d.manager.emit(S,h)}b<Gt&&_(d.options.event+Ro(b)),_(d.options.event),h.additionalEvent&&_(h.additionalEvent),b>=Gt&&_(d.options.event+Ro(b))},tryEmit:function(h){if(this.canEmit())return this.emit(h);this.state=Ct},canEmit:function(){for(var h=0;h<this.requireFail.length;){if(!(this.requireFail[h].state&(Ct|jn)))return!1;h++}return!0},recognize:function(h){var d=y({},h);if(!O(this.options.enable,[this,d])){this.reset(),this.state=Ct;return}this.state&(Vt|dn|Ct)&&(this.state=jn),this.state=this.process(d),this.state&(gt|ze|Gt|dn)&&this.tryEmit(d)},process:function(h){},getTouchAction:function(){},reset:function(){}};function Ro(h){return h&dn?"cancel":h&Gt?"end":h&ze?"move":h>?"start":""}function No(h){return h==un?"down":h==cn?"up":h==an?"left":h==ln?"right":""}function Un(h,d){var b=d.manager;return b?b.get(h):h}function _t(){Bt.apply(this,arguments)}k(_t,Bt,{defaults:{pointers:1},attrTest:function(h){var d=this.options.pointers;return d===0||h.pointers.length===d},process:function(h){var d=this.state,b=h.eventType,_=d&(gt|ze),S=this.attrTest(h);return _&&(b&ot||!S)?d|dn:_||S?b&X?d|Gt:d>?d|ze:gt:Ct}});function $n(){_t.apply(this,arguments),this.pX=null,this.pY=null}k($n,_t,{defaults:{event:"pan",threshold:10,pointers:1,direction:vo},getTouchAction:function(){var h=this.options.direction,d=[];return h&Et&&d.push(fn),h&ye&&d.push(hn),d},directionTest:function(h){var d=this.options,b=!0,_=h.distance,S=h.direction,M=h.deltaX,N=h.deltaY;return S&d.direction||(d.direction&Et?(S=M===0?zn:M<0?an:ln,b=M!=this.pX,_=Math.abs(h.deltaX)):(S=N===0?zn:N<0?cn:un,b=N!=this.pY,_=Math.abs(h.deltaY))),h.direction=S,b&&_>d.threshold&&S&d.direction},attrTest:function(h){return _t.prototype.attrTest.call(this,h)&&(this.state>||!(this.state>)&&this.directionTest(h))},emit:function(h){this.pX=h.deltaX,this.pY=h.deltaY;var d=No(h.direction);d&&(h.additionalEvent=this.options.event+d),this._super.emit.call(this,h)}});function ji(){_t.apply(this,arguments)}k(ji,_t,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[xe]},attrTest:function(h){return this._super.attrTest.call(this,h)&&(Math.abs(h.scale-1)>this.options.threshold||this.state>)},emit:function(h){if(h.scale!==1){var d=h.scale<1?"in":"out";h.additionalEvent=this.options.event+d}this._super.emit.call(this,h)}});function Ui(){Bt.apply(this,arguments),this._timer=null,this._input=null}k(Ui,Bt,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Lo]},process:function(h){var d=this.options,b=h.pointers.length===d.pointers,_=h.distance<d.threshold,S=h.deltaTime>d.time;if(this._input=h,!_||!b||h.eventType&(X|ot)&&!S)this.reset();else if(h.eventType&it)this.reset(),this._timer=f(function(){this.state=Vt,this.tryEmit()},d.time,this);else if(h.eventType&X)return Vt;return Ct},reset:function(){clearTimeout(this._timer)},emit:function(h){this.state===Vt&&(h&&h.eventType&X?this.manager.emit(this.options.event+"up",h):(this._input.timeStamp=u(),this.manager.emit(this.options.event,this._input)))}});function $i(){_t.apply(this,arguments)}k($i,_t,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[xe]},attrTest:function(h){return this._super.attrTest.call(this,h)&&(Math.abs(h.rotation)>this.options.threshold||this.state>)}});function Yi(){_t.apply(this,arguments)}k(Yi,_t,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Et|ye,pointers:1},getTouchAction:function(){return $n.prototype.getTouchAction.call(this)},attrTest:function(h){var d=this.options.direction,b;return d&(Et|ye)?b=h.overallVelocity:d&Et?b=h.overallVelocityX:d&ye&&(b=h.overallVelocityY),this._super.attrTest.call(this,h)&&d&h.offsetDirection&&h.distance>this.options.threshold&&h.maxPointers==this.options.pointers&&c(b)>this.options.velocity&&h.eventType&X},emit:function(h){var d=No(h.offsetDirection);d&&this.manager.emit(this.options.event+d,h),this.manager.emit(this.options.event,h)}});function Yn(){Bt.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}k(Yn,Bt,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Bi]},process:function(h){var d=this.options,b=h.pointers.length===d.pointers,_=h.distance<d.threshold,S=h.deltaTime<d.time;if(this.reset(),h.eventType&it&&this.count===0)return this.failTimeout();if(_&&S&&b){if(h.eventType!=X)return this.failTimeout();var M=this.pTime?h.timeStamp-this.pTime<d.interval:!0,N=!this.pCenter||Hn(this.pCenter,h.center)<d.posThreshold;this.pTime=h.timeStamp,this.pCenter=h.center,!N||!M?this.count=1:this.count+=1,this._input=h;var G=this.count%d.taps;if(G===0)return this.hasRequireFailures()?(this._timer=f(function(){this.state=Vt,this.tryEmit()},d.interval,this),gt):Vt}return Ct},failTimeout:function(){return this._timer=f(function(){this.state=Ct},this.options.interval,this),Ct},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==Vt&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function Kt(h,d){return d=d||{},d.recognizers=T(d.recognizers,Kt.defaults.preset),new Xi(h,d)}Kt.VERSION="2.0.7",Kt.defaults={domEvents:!1,touchAction:Io,enable:!0,inputTarget:null,inputClass:null,preset:[[$i,{enable:!1}],[ji,{enable:!1},["rotate"]],[Yi,{direction:Et}],[$n,{direction:Et},["swipe"]],[Yn],[Yn,{event:"doubletap",taps:2},["tap"]],[Ui]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var Dc=1,zo=2;function Xi(h,d){this.options=y({},Kt.defaults,d||{}),this.options.inputTarget=this.options.inputTarget||h,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=h,this.input=ac(this),this.touchAction=new Wi(this,this.options.touchAction),Fo(this,!0),g(this.options.recognizers,function(b){var _=this.add(new b[0](b[1]));b[2]&&_.recognizeWith(b[2]),b[3]&&_.requireFailure(b[3])},this)}Xi.prototype={set:function(h){return y(this.options,h),h.touchAction&&this.touchAction.update(),h.inputTarget&&(this.input.destroy(),this.input.target=h.inputTarget,this.input.init()),this},stop:function(h){this.session.stopped=h?zo:Dc},recognize:function(h){var d=this.session;if(!d.stopped){this.touchAction.preventDefaults(h);var b,_=this.recognizers,S=d.curRecognizer;(!S||S&&S.state&Vt)&&(S=d.curRecognizer=null);for(var M=0;M<_.length;)b=_[M],d.stopped!==zo&&(!S||b==S||b.canRecognizeWith(S))?b.recognize(h):b.reset(),!S&&b.state&(gt|ze|Gt)&&(S=d.curRecognizer=b),M++}},get:function(h){if(h instanceof Bt)return h;for(var d=this.recognizers,b=0;b<d.length;b++)if(d[b].options.event==h)return d[b];return null},add:function(h){if(p(h,"add",this))return this;var d=this.get(h.options.event);return d&&this.remove(d),this.recognizers.push(h),h.manager=this,this.touchAction.update(),h},remove:function(h){if(p(h,"remove",this))return this;if(h=this.get(h),h){var d=this.recognizers,b=L(d,h);b!==-1&&(d.splice(b,1),this.touchAction.update())}return this},on:function(h,d){if(h!==s&&d!==s){var b=this.handlers;return g(F(h),function(_){b[_]=b[_]||[],b[_].push(d)}),this}},off:function(h,d){if(h!==s){var b=this.handlers;return g(F(h),function(_){d?b[_]&&b[_].splice(L(b[_],d),1):delete b[_]}),this}},emit:function(h,d){this.options.domEvents&&Ac(h,d);var b=this.handlers[h]&&this.handlers[h].slice();if(!(!b||!b.length)){d.type=h,d.preventDefault=function(){d.srcEvent.preventDefault()};for(var _=0;_<b.length;)b[_](d),_++}},destroy:function(){this.element&&Fo(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function Fo(h,d){var b=h.element;if(b.style){var _;g(h.options.cssProps,function(S,M){_=et(b.style,M),d?(h.oldCssProps[_]=b.style[_],b.style[_]=S):b.style[_]=h.oldCssProps[_]||""}),d||(h.oldCssProps={})}}function Ac(h,d){var b=n.createEvent("Event");b.initEvent(h,!0,!0),b.gesture=d,d.target.dispatchEvent(b)}y(Kt,{INPUT_START:it,INPUT_MOVE:be,INPUT_END:X,INPUT_CANCEL:ot,STATE_POSSIBLE:jn,STATE_BEGAN:gt,STATE_CHANGED:ze,STATE_ENDED:Gt,STATE_RECOGNIZED:Vt,STATE_CANCELLED:dn,STATE_FAILED:Ct,DIRECTION_NONE:zn,DIRECTION_LEFT:an,DIRECTION_RIGHT:ln,DIRECTION_UP:cn,DIRECTION_DOWN:un,DIRECTION_HORIZONTAL:Et,DIRECTION_VERTICAL:ye,DIRECTION_ALL:vo,Manager:Xi,Input:pt,TouchAction:Wi,TouchInput:Bn,MouseInput:Vn,PointerEventInput:Hi,TouchMouseInput:Vi,SingleTouchInput:Co,Recognizer:Bt,AttrRecognizer:_t,Tap:Yn,Pan:$n,Swipe:Yi,Pinch:ji,Rotate:$i,Press:Ui,on:D,off:P,each:g,merge:w,extend:v,assign:y,inherit:k,bindFn:C,prefixed:et});var Ic=typeof t<"u"?t:typeof self<"u"?self:{};Ic.Hammer=Kt,e.exports?e.exports=Kt:t[i]=Kt})(window,document,"Hammer")})(os)),os.exports}var Ng=Rg();const Cn=Lg(Ng);/*!
|
|
2421
2434
|
* chartjs-plugin-zoom v2.2.0
|
|
2422
2435
|
* https://www.chartjs.org/chartjs-plugin-zoom/2.2.0/
|
|
2423
2436
|
* (c) 2016-2024 chartjs-plugin-zoom Contributors
|
|
2424
2437
|
* Released under the MIT License
|
|
2425
|
-
*/const Rn=e=>e&&e.enabled&&e.modifierKey,Xl=(e,t)=>e&&t[e+"Key"],yo=(e,t)=>e&&!t[e+"Key"];function ue(e,t,n){return e===void 0?!0:typeof e=="string"?e.indexOf(t)!==-1:typeof e=="function"?e({chart:n}).indexOf(t)!==-1:!1}function rs(e,t){return typeof e=="function"&&(e=e({chart:t})),typeof e=="string"?{x:e.indexOf("x")!==-1,y:e.indexOf("y")!==-1}:{x:!1,y:!1}}function zg(e,t){let n;return function(){return clearTimeout(n),n=setTimeout(e,t),t}}function Fg({x:e,y:t},n){const i=n.scales,s=Object.keys(i);for(let o=0;o<s.length;o++){const r=i[s[o]];if(t>=r.top&&t<=r.bottom&&e>=r.left&&e<=r.right)return r}return null}function ql(e,t,n){const{mode:i="xy",scaleMode:s,overScaleMode:o}=e||{},r=Fg(t,n),a=rs(i,n),l=rs(s,n);if(o){const u=rs(o,n);for(const f of["x","y"])u[f]&&(l[f]=a[f],a[f]=!1)}if(r&&l[r.axis])return[r];const c=[];return z(n.scales,function(u){a[u.axis]&&c.push(u)}),c}const Hs=new WeakMap;function U(e){let t=Hs.get(e);return t||(t={originalScaleLimits:{},updatedScaleLimits:{},handlers:{},panDelta:{},dragging:!1,panning:!1},Hs.set(e,t)),t}function Hg(e){Hs.delete(e)}function Gl(e,t,n,i){const s=Math.max(0,Math.min(1,(e-t)/n||0)),o=1-s;return{min:i*s,max:i*o}}function Kl(e,t){const n=e.isHorizontal()?t.x:t.y;return e.getValueForPixel(n)}function Zl(e,t,n){const i=e.max-e.min,s=i*(t-1),o=Kl(e,n);return Gl(o,e.min,i,s)}function Bg(e,t,n){const i=Kl(e,n);if(i===void 0)return{min:e.min,max:e.max};const s=Math.log10(e.min),o=Math.log10(e.max),r=Math.log10(i),a=o-s,l=a*(t-1),c=Gl(r,s,a,l);return{min:Math.pow(10,s+c.min),max:Math.pow(10,o-c.max)}}function Vg(e,t){return t&&(t[e.id]||t[e.axis])||{}}function aa(e,t,n,i,s){let o=n[i];if(o==="original"){const r=e.originalScaleLimits[t.id][i];o=R(r.options,r.scale)}return R(o,s)}function Wg(e,t,n){const i=e.getValueForPixel(t),s=e.getValueForPixel(n);return{min:Math.min(i,s),max:Math.max(i,s)}}function jg(e,{min:t,max:n,minLimit:i,maxLimit:s},o){const r=(e-n+t)/2;t-=r,n+=r;const a=o.min.options??o.min.scale,l=o.max.options??o.max.scale,c=e/1e6;return Oe(t,a,c)&&(t=a),Oe(n,l,c)&&(n=l),t<i?(t=i,n=Math.min(i+e,s)):n>s&&(n=s,t=Math.max(s-e,i)),{min:t,max:n}}function Re(e,{min:t,max:n},i,s=!1){const o=U(e.chart),{options:r}=e,a=Vg(e,i),{minRange:l=0}=a,c=aa(o,e,a,"min",-1/0),u=aa(o,e,a,"max",1/0);if(s==="pan"&&(t<c||n>u))return!0;const f=e.max-e.min,p=s?Math.max(n-t,l):f;if(s&&p===l&&f<=l)return!0;const g=jg(p,{min:t,max:n,minLimit:c,maxLimit:u},o.originalScaleLimits[e.id]);return r.min=g.min,r.max=g.max,o.updatedScaleLimits[e.id]=g,e.parse(g.min)!==e.min||e.parse(g.max)!==e.max}function Ug(e,t,n,i){const s=Zl(e,t,n),o={min:e.min+s.min,max:e.max-s.max};return Re(e,o,i,!0)}function $g(e,t,n,i){const s=Bg(e,t,n);return Re(e,s,i,!0)}function Yg(e,t,n,i){Re(e,Wg(e,t,n),i,!0)}const la=e=>e===0||isNaN(e)?0:e<0?Math.min(Math.round(e),-1):Math.max(Math.round(e),1);function Xg(e){const n=e.getLabels().length-1;e.min>0&&(e.min-=1),e.max<n&&(e.max+=1)}function qg(e,t,n,i){const s=Zl(e,t,n);e.min===e.max&&t<1&&Xg(e);const o={min:e.min+la(s.min),max:e.max-la(s.max)};return Re(e,o,i,!0)}function Gg(e){return e.isHorizontal()?e.width:e.height}function Kg(e,t,n){const s=e.getLabels().length-1;let{min:o,max:r}=e;const a=Math.max(r-o,1),l=Math.round(Gg(e)/Math.max(a,10)),c=Math.round(Math.abs(t/l));let u;return t<-l?(r=Math.min(r+c,s),o=a===1?r:r-a,u=r===s):t>l&&(o=Math.max(0,o-c),r=a===1?o:o+a,u=o===0),Re(e,{min:o,max:r},n)||u}const Zg={second:500,minute:30*1e3,hour:1800*1e3,day:720*60*1e3,week:3.5*24*60*60*1e3,month:360*60*60*1e3,quarter:1440*60*60*1e3,year:4368*60*60*1e3};function Ql(e,t,n,i=!1){const{min:s,max:o,options:r}=e,a=r.time&&r.time.round,l=Zg[a]||0,c=e.getValueForPixel(e.getPixelForValue(s+l)-t),u=e.getValueForPixel(e.getPixelForValue(o+l)-t);return isNaN(c)||isNaN(u)?!0:Re(e,{min:c,max:u},n,i?"pan":!1)}function ca(e,t,n){return Ql(e,t,n,!0)}const Bs={category:qg,default:Ug,logarithmic:$g},Vs={default:Yg},Ws={category:Kg,default:Ql,logarithmic:ca,timeseries:ca};function Qg(e,t,n){const{id:i,options:{min:s,max:o}}=e;if(!t[i]||!n[i])return!0;const r=n[i];return r.min!==s||r.max!==o}function ua(e,t){z(e,(n,i)=>{t[i]||delete e[i]})}function rn(e,t){const{scales:n}=e,{originalScaleLimits:i,updatedScaleLimits:s}=t;return z(n,function(o){Qg(o,i,s)&&(i[o.id]={min:{scale:o.min,options:o.options.min},max:{scale:o.max,options:o.options.max}})}),ua(i,n),ua(s,n),i}function ha(e,t,n,i){const s=Bs[e.type]||Bs.default;I(s,[e,t,n,i])}function fa(e,t,n,i){const s=Vs[e.type]||Vs.default;I(s,[e,t,n,i])}function Jg(e){const t=e.chartArea;return{x:(t.left+t.right)/2,y:(t.top+t.bottom)/2}}function xo(e,t,n="none",i="api"){const{x:s=1,y:o=1,focalPoint:r=Jg(e)}=typeof t=="number"?{x:t,y:t}:t,a=U(e),{options:{limits:l,zoom:c}}=a;rn(e,a);const u=s!==1,f=o!==1,p=ql(c,r,e);z(p||e.scales,function(g){g.isHorizontal()&&u?ha(g,s,r,l):!g.isHorizontal()&&f&&ha(g,o,r,l)}),e.update(n),I(c.onZoom,[{chart:e,trigger:i}])}function Jl(e,t,n,i="none",s="api"){const o=U(e),{options:{limits:r,zoom:a}}=o,{mode:l="xy"}=a;rn(e,o);const c=ue(l,"x",e),u=ue(l,"y",e);z(e.scales,function(f){f.isHorizontal()&&c?fa(f,t.x,n.x,r):!f.isHorizontal()&&u&&fa(f,t.y,n.y,r)}),e.update(i),I(a.onZoom,[{chart:e,trigger:s}])}function tm(e,t,n,i="none",s="api"){const o=U(e);rn(e,o);const r=e.scales[t];Re(r,n,void 0,!0),e.update(i),I(o.options.zoom?.onZoom,[{chart:e,trigger:s}])}function em(e,t="default"){const n=U(e),i=rn(e,n);z(e.scales,function(s){const o=s.options;i[s.id]?(o.min=i[s.id].min.options,o.max=i[s.id].max.options):(delete o.min,delete o.max),delete n.updatedScaleLimits[s.id]}),e.update(t),I(n.options.zoom.onZoomComplete,[{chart:e}])}function nm(e,t){const n=e.originalScaleLimits[t];if(!n)return;const{min:i,max:s}=n;return R(s.options,s.scale)-R(i.options,i.scale)}function im(e){const t=U(e);let n=1,i=1;return z(e.scales,function(s){const o=nm(t,s.id);if(o){const r=Math.round(o/(s.max-s.min)*100)/100;n=Math.min(n,r),i=Math.max(i,r)}}),n<1?n:i}function da(e,t,n,i){const{panDelta:s}=i,o=s[e.id]||0;ce(o)===ce(t)&&(t+=o);const r=Ws[e.type]||Ws.default;I(r,[e,t,n])?s[e.id]=0:s[e.id]=t}function tc(e,t,n,i="none"){const{x:s=0,y:o=0}=typeof t=="number"?{x:t,y:t}:t,r=U(e),{options:{pan:a,limits:l}}=r,{onPan:c}=a||{};rn(e,r);const u=s!==0,f=o!==0;z(n||e.scales,function(p){p.isHorizontal()&&u?da(p,s,l,r):!p.isHorizontal()&&f&&da(p,o,l,r)}),e.update(i),I(c,[{chart:e}])}function ec(e){const t=U(e);rn(e,t);const n={};for(const i of Object.keys(e.scales)){const{min:s,max:o}=t.originalScaleLimits[i]||{min:{},max:{}};n[i]={min:s.scale,max:o.scale}}return n}function sm(e){const t=U(e),n={};for(const i of Object.keys(e.scales))n[i]=t.updatedScaleLimits[i];return n}function om(e){const t=ec(e);for(const n of Object.keys(e.scales)){const{min:i,max:s}=t[n];if(i!==void 0&&e.scales[n].min!==i||s!==void 0&&e.scales[n].max!==s)return!0}return!1}function pa(e){const t=U(e);return t.panning||t.dragging}const ga=(e,t,n)=>Math.min(n,Math.max(t,e));function at(e,t){const{handlers:n}=U(e),i=n[t];i&&i.target&&(i.target.removeEventListener(t,i),delete n[t])}function On(e,t,n,i){const{handlers:s,options:o}=U(e),r=s[n];if(r&&r.target===t)return;at(e,n),s[n]=l=>i(e,l,o),s[n].target=t;const a=n==="wheel"?!1:void 0;t.addEventListener(n,s[n],{passive:a})}function rm(e,t){const n=U(e);n.dragStart&&(n.dragging=!0,n.dragEnd=t,e.update("none"))}function am(e,t){const n=U(e);!n.dragStart||t.key!=="Escape"||(at(e,"keydown"),n.dragging=!1,n.dragStart=n.dragEnd=null,e.update("none"))}function js(e,t){if(e.target!==t.canvas){const n=t.canvas.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}}return It(e,t)}function nc(e,t,n){const{onZoomStart:i,onZoomRejected:s}=n;if(i){const o=js(t,e);if(I(i,[{chart:e,event:t,point:o}])===!1)return I(s,[{chart:e,event:t}]),!1}}function lm(e,t){if(e.legend){const o=It(t,e);if(Je(o,e.legend))return}const n=U(e),{pan:i,zoom:s={}}=n.options;if(t.button!==0||Xl(Rn(i),t)||yo(Rn(s.drag),t))return I(s.onZoomRejected,[{chart:e,event:t}]);nc(e,t,s)!==!1&&(n.dragStart=t,On(e,e.canvas.ownerDocument,"mousemove",rm),On(e,window.document,"keydown",am))}function cm({begin:e,end:t},n){let i=t.x-e.x,s=t.y-e.y;const o=Math.abs(i/s);o>n?i=Math.sign(i)*Math.abs(s*n):o<n&&(s=Math.sign(s)*Math.abs(i/n)),t.x=e.x+i,t.y=e.y+s}function ma(e,t,n,{min:i,max:s,prop:o}){e[i]=ga(Math.min(n.begin[o],n.end[o]),t[i],t[s]),e[s]=ga(Math.max(n.begin[o],n.end[o]),t[i],t[s])}function um(e,t,n){const i={begin:js(t.dragStart,e),end:js(t.dragEnd,e)};if(n){const s=e.chartArea.width/e.chartArea.height;cm(i,s)}return i}function ic(e,t,n,i){const s=ue(t,"x",e),o=ue(t,"y",e),{top:r,left:a,right:l,bottom:c,width:u,height:f}=e.chartArea,p={top:r,left:a,right:l,bottom:c},g=um(e,n,i&&s&&o);s&&ma(p,e.chartArea,g,{min:"left",max:"right",prop:"x"}),o&&ma(p,e.chartArea,g,{min:"top",max:"bottom",prop:"y"});const x=p.right-p.left,y=p.bottom-p.top;return{...p,width:x,height:y,zoomX:s&&x?1+(u-x)/u:1,zoomY:o&&y?1+(f-y)/f:1}}function hm(e,t){const n=U(e);if(!n.dragStart)return;at(e,"mousemove");const{mode:i,onZoomComplete:s,drag:{threshold:o=0,maintainAspectRatio:r}}=n.options.zoom,a=ic(e,i,{dragStart:n.dragStart,dragEnd:t},r),l=ue(i,"x",e)?a.width:0,c=ue(i,"y",e)?a.height:0,u=Math.sqrt(l*l+c*c);if(n.dragStart=n.dragEnd=null,u<=o){n.dragging=!1,e.update("none");return}Jl(e,{x:a.left,y:a.top},{x:a.right,y:a.bottom},"zoom","drag"),n.dragging=!1,n.filterNextClick=!0,I(s,[{chart:e}])}function fm(e,t,n){if(yo(Rn(n.wheel),t)){I(n.onZoomRejected,[{chart:e,event:t}]);return}if(nc(e,t,n)!==!1&&(t.cancelable&&t.preventDefault(),t.deltaY!==void 0))return!0}function dm(e,t){const{handlers:{onZoomComplete:n},options:{zoom:i}}=U(e);if(!fm(e,t,i))return;const s=t.target.getBoundingClientRect(),o=i.wheel.speed,r=t.deltaY>=0?2-1/(1-o):1+o,a={x:r,y:r,focalPoint:{x:t.clientX-s.left,y:t.clientY-s.top}};xo(e,a,"zoom","wheel"),I(n,[{chart:e}])}function pm(e,t,n,i){n&&(U(e).handlers[t]=zg(()=>I(n,[{chart:e}]),i))}function gm(e,t){const n=e.canvas,{wheel:i,drag:s,onZoomComplete:o}=t.zoom;i.enabled?(On(e,n,"wheel",dm),pm(e,"onZoomComplete",o,250)):at(e,"wheel"),s.enabled?(On(e,n,"mousedown",lm),On(e,n.ownerDocument,"mouseup",hm)):(at(e,"mousedown"),at(e,"mousemove"),at(e,"mouseup"),at(e,"keydown"))}function mm(e){at(e,"mousedown"),at(e,"mousemove"),at(e,"mouseup"),at(e,"wheel"),at(e,"click"),at(e,"keydown")}function bm(e,t){return function(n,i){const{pan:s,zoom:o={}}=t.options;if(!s||!s.enabled)return!1;const r=i&&i.srcEvent;return r&&!t.panning&&i.pointerType==="mouse"&&(yo(Rn(s),r)||Xl(Rn(o.drag),r))?(I(s.onPanRejected,[{chart:e,event:i}]),!1):!0}}function ym(e,t){const n=Math.abs(e.clientX-t.clientX),i=Math.abs(e.clientY-t.clientY),s=n/i;let o,r;return s>.3&&s<1.7?o=r=!0:n>i?o=!0:r=!0,{x:o,y:r}}function sc(e,t,n){if(t.scale){const{center:i,pointers:s}=n,o=1/t.scale*n.scale,r=n.target.getBoundingClientRect(),a=ym(s[0],s[1]),l=t.options.zoom.mode,c={x:a.x&&ue(l,"x",e)?o:1,y:a.y&&ue(l,"y",e)?o:1,focalPoint:{x:i.x-r.left,y:i.y-r.top}};xo(e,c,"zoom","pinch"),t.scale=n.scale}}function xm(e,t,n){if(t.options.zoom.pinch.enabled){const i=It(n,e);I(t.options.zoom.onZoomStart,[{chart:e,event:n,point:i}])===!1?(t.scale=null,I(t.options.zoom.onZoomRejected,[{chart:e,event:n}])):t.scale=1}}function vm(e,t,n){t.scale&&(sc(e,t,n),t.scale=null,I(t.options.zoom.onZoomComplete,[{chart:e}]))}function oc(e,t,n){const i=t.delta;i&&(t.panning=!0,tc(e,{x:n.deltaX-i.x,y:n.deltaY-i.y},t.panScales),t.delta={x:n.deltaX,y:n.deltaY})}function _m(e,t,n){const{enabled:i,onPanStart:s,onPanRejected:o}=t.options.pan;if(!i)return;const r=n.target.getBoundingClientRect(),a={x:n.center.x-r.left,y:n.center.y-r.top};if(I(s,[{chart:e,event:n,point:a}])===!1)return I(o,[{chart:e,event:n}]);t.panScales=ql(t.options.pan,a,e),t.delta={x:0,y:0},oc(e,t,n)}function wm(e,t){t.delta=null,t.panning&&(t.panning=!1,t.filterNextClick=!0,I(t.options.pan.onPanComplete,[{chart:e}]))}const Us=new WeakMap;function ba(e,t){const n=U(e),i=e.canvas,{pan:s,zoom:o}=t,r=new Cn.Manager(i);o&&o.pinch.enabled&&(r.add(new Cn.Pinch),r.on("pinchstart",a=>xm(e,n,a)),r.on("pinch",a=>sc(e,n,a)),r.on("pinchend",a=>vm(e,n,a))),s&&s.enabled&&(r.add(new Cn.Pan({threshold:s.threshold,enable:bm(e,n)})),r.on("panstart",a=>_m(e,n,a)),r.on("panmove",a=>oc(e,n,a)),r.on("panend",()=>wm(e,n))),Us.set(e,r)}function ya(e){const t=Us.get(e);t&&(t.remove("pinchstart"),t.remove("pinch"),t.remove("pinchend"),t.remove("panstart"),t.remove("pan"),t.remove("panend"),t.destroy(),Us.delete(e))}function Sm(e,t){const{pan:n,zoom:i}=e,{pan:s,zoom:o}=t;return i?.zoom?.pinch?.enabled!==o?.zoom?.pinch?.enabled||n?.enabled!==s?.enabled||n?.threshold!==s?.threshold}var km="2.2.0";function ci(e,t,n){const i=n.zoom.drag,{dragStart:s,dragEnd:o}=U(e);if(i.drawTime!==t||!o)return;const{left:r,top:a,width:l,height:c}=ic(e,n.zoom.mode,{dragStart:s,dragEnd:o},i.maintainAspectRatio),u=e.ctx;u.save(),u.beginPath(),u.fillStyle=i.backgroundColor||"rgba(225,225,225,0.3)",u.fillRect(r,a,l,c),i.borderWidth>0&&(u.lineWidth=i.borderWidth,u.strokeStyle=i.borderColor||"rgba(225,225,225)",u.strokeRect(r,a,l,c)),u.restore()}var Tm={id:"zoom",version:km,defaults:{pan:{enabled:!1,mode:"xy",threshold:10,modifierKey:null},zoom:{wheel:{enabled:!1,speed:.1,modifierKey:null},drag:{enabled:!1,drawTime:"beforeDatasetsDraw",modifierKey:null},pinch:{enabled:!1},mode:"xy"}},start:function(e,t,n){const i=U(e);i.options=n,Object.prototype.hasOwnProperty.call(n.zoom,"enabled")&&console.warn("The option \`zoom.enabled\` is no longer supported. Please use \`zoom.wheel.enabled\`, \`zoom.drag.enabled\`, or \`zoom.pinch.enabled\`."),(Object.prototype.hasOwnProperty.call(n.zoom,"overScaleMode")||Object.prototype.hasOwnProperty.call(n.pan,"overScaleMode"))&&console.warn("The option \`overScaleMode\` is deprecated. Please use \`scaleMode\` instead (and update \`mode\` as desired)."),Cn&&ba(e,n),e.pan=(s,o,r)=>tc(e,s,o,r),e.zoom=(s,o)=>xo(e,s,o),e.zoomRect=(s,o,r)=>Jl(e,s,o,r),e.zoomScale=(s,o,r)=>tm(e,s,o,r),e.resetZoom=s=>em(e,s),e.getZoomLevel=()=>im(e),e.getInitialScaleBounds=()=>ec(e),e.getZoomedScaleBounds=()=>sm(e),e.isZoomedOrPanned=()=>om(e),e.isZoomingOrPanning=()=>pa(e)},beforeEvent(e,{event:t}){if(pa(e))return!1;if(t.type==="click"||t.type==="mouseup"){const n=U(e);if(n.filterNextClick)return n.filterNextClick=!1,!1}},beforeUpdate:function(e,t,n){const i=U(e),s=i.options;i.options=n,Sm(s,n)&&(ya(e),ba(e,n)),gm(e,n)},beforeDatasetsDraw(e,t,n){ci(e,"beforeDatasetsDraw",n)},afterDatasetsDraw(e,t,n){ci(e,"afterDatasetsDraw",n)},beforeDraw(e,t,n){ci(e,"beforeDraw",n)},afterDraw(e,t,n){ci(e,"afterDraw",n)},stop:function(e){mm(e),Cn&&ya(e),Hg(e)},panFunctions:Ws,zoomFunctions:Bs,zoomRectFunctions:Vs};function Mm({data:e,...t}){const n=Ze(null),i=Ze(null);return ut(()=>{zs.register(Tm,Pg,jd,Eg,cg,lg,gg,Sg);const s=i.current,o=n.current=new zs(s,{type:"line",data:e.peek(),options:{scales:{y:{min:0}},animation:!1,responsive:!0,plugins:{zoom:{pan:{enabled:!0,mode:"x"},zoom:{wheel:{enabled:!0},mode:"x"}},legend:{position:"top"},title:{display:!1}}}}),r=e.subscribe(a=>{o.data=a,o.update()});return()=>{o.destroy(),r()}},[]),m("canvas",{ref:i,...t})}function Em(){const e=fe();ut(()=>{const n=i=>{Pn(i)||e()};return $?.on("mount",n),$?.on("unmount",n),()=>{$?.off("mount",n),$?.off("unmount",n)}},[]);const t=$?.profilingContext;return m("div",{className:"flex flex-col gap-2"},Za(t.appStats).filter(([n])=>!Pn(n)).map(([n])=>m(Cm,{key:n.id,app:n})))}const xa=100,va=e=>Object.entries(e).map(([t,{values:n,color:i}])=>({label:t,data:n,fill:!1,borderColor:i,tension:.1}));function Cm({app:e}){const t=fe(),n=Ze({update:{values:[0],color:"#ad981f"},updateDirtied:{values:[0],color:"#b21f3a"},createNode:{values:[0],color:"#198019"},removeNode:{values:[0],color:"#5F3691"},updateNode:{values:[0],color:"#2f2f9d"},signalAttrUpdate:{values:[0],color:"#28888f"},signalTextUpdate:{values:[0],color:"#9b3b98"}}),i=J({labels:[(performance.now()/1e3).toFixed(2)],datasets:va(n.current)}),s=J(!1),o=$?.profilingContext;return ut(()=>{const r=a=>{a.id===e.id&&t()};return $?.on("update",r),()=>$?.off("update",r)},[]),ut(()=>{const r=[];Object.entries(n.current).forEach(([l,{values:c}])=>{const u=p=>{p.id===e.id&&s.peek()!==!0&&c[c.length-1]++},f=l;o.addEventListener(f,u),r.push(()=>o.removeEventListener(f,u))});const a=setInterval(()=>{if(s.peek()===!0)return;const l=[...i.value.labels];Object.values(n.current).forEach(c=>{c.values.push(0),c.values.length>xa&&c.values.shift()}),l.push((performance.now()/1e3).toFixed(2)),l.length>xa&&l.shift(),i.value={labels:l,datasets:va(n.current)}},100);return()=>{r.forEach(l=>l()),clearInterval(a)}},[]),m("div",{className:"flex flex-col gap-2 border border-white border-opacity-10 rounded bg-neutral-400 bg-opacity-5 text-neutral-400 p-2"},m("div",{className:"grid items-start gap-2",style:"grid-template-columns: 1fr max-content;"},m("div",{className:"flex flex-col gap-2"},m("span",null,e.name),m(Mm,{data:i,className:"w-full max-w-full min-h-20 bg-black bg-opacity-30",onmouseenter:()=>s.value=!0,onmouseleave:()=>s.value=!1})),m("div",{className:"text-xs grid grid-cols-2 gap-x-4",style:"grid-template-columns: auto auto;"},m("span",{className:"text-right"},"Mount duration:"),o.mountDuration(e).toFixed(2)," ms",m("span",{className:"text-right"},"Total updates:"),m("span",null,o.totalTicks(e).toLocaleString()),m("span",{className:"text-right"},"Avg. update duration:"),o.averageTickDuration(e).toFixed(2)," ms",m("span",{className:"text-right"},"Latest update:"),m("span",null,o.lastTickDuration(e).toFixed(2)," ms"))))}const xn=ht([]),rc=ht(""),Om=Ga(()=>rc.value.toLowerCase().split(" ").filter(e=>e.length>0));function Pm(e){return Om.value.every(t=>e.toLowerCase().includes(t))}function Dm(){const e=fe();ut(()=>{const n=i=>{Pn(i)||e()};return $?.on("update",n),()=>$?.off("update",n)},[]);const t=$?.SWRGlobalCache??new Map;return t.size===0?m("div",{className:"flex flex-col items-center justify-center h-full text-neutral-400"},m(Qa,null),m("h2",{className:"text-lg italic"},"No SWR detected")):m("div",{className:"flex flex-col gap-2 items-start"},m(ol,{value:rc,className:"sticky top-0"}),m("div",{className:"flex flex-col gap-2 w-full"},Za(t).filter(([n])=>Pm(n)).map(([n,i])=>m(Am,{key:n,entry:i}))))}function Am({key:e,entry:t}){const n=xn.value.includes(e),i=fe();ut(()=>{const{resource:o,isValidating:r,isMutating:a}=t,l=[o.subscribe(i),r.subscribe(i),a.subscribe(i)];return()=>l.forEach(c=>c())},[]);const s=We(()=>{n?xn.value=xn.value.filter(o=>o!==e):xn.value=[...xn.value,e]},[n]);return m("div",{className:"flex flex-col"},m("button",{onclick:s,className:"flex items-center gap-2 justify-between p-2 border border-white border-opacity-10 cursor-pointer"+(n?" bg-white bg-opacity-5 text-neutral-100 rounded-t":" hover:bg-white hover:bg-opacity-10 text-neutral-400 rounded")},e,m(ae,{className:"transition-all"+(n?" rotate-90":"")})),n&&m("div",{className:"flex flex-col gap-2 p-2 border border-white border-opacity-10"},m(Ie,{data:{resource:t.resource.peek(),isMutating:t.isMutating.peek(),isValidating:t.isValidating.peek()},mutable:!1,objectRefAcc:[],keys:[],onChange:()=>{}})))}const Im=e=>m("main",{className:"flex flex-col flex-1 max-h-[calc(100vh-1rem)] overflow-y-auto",style:e.active?{}:{display:"none"}},e.children),$s={Apps:{Icon:$u,View:kh},Stores:{Icon:Zu,View:Eh},SWR:{Icon:Gu,View:Dm},Profiling:{Icon:qu,View:Em},Settings:{Icon:Yu,View:Ju}},Ci=ht("Apps");let _a=se.peek();se.subscribe(e=>{e!==_a&&e!==null&&(Ci.value="Apps"),_a=e});function Lm(){return m(Qu,null,m("nav",{className:"flex flex-col gap-2 justify-between p-2 bg-neutral-400 bg-opacity-5 border border-white border-opacity-10 rounded"},m("div",{className:"flex flex-col gap-2"},Object.keys($s).map(e=>m(Rm,{key:e,title:e})))),Object.entries($s).map(([e,{View:t}])=>m(Im,{key:e,active:Ci.value===e},m(t,null))))}function Rm({title:e}){const{Icon:t}=$s[e];return m("button",{key:e,onclick:()=>{Ci.value=e},className:"flex items-center px-2 py-1 gap-2 rounded border text-xs border-white border-opacity-10"+(Ci.value===e?" bg-white bg-opacity-5 text-neutral-100":" hover:bg-white hover:bg-opacity-10 text-neutral-400"),title:e},m(t,{className:"text-primary"}),m("span",{className:"hidden sm:inline"},e))}Bu(m(Lm,null),document.getElementById("app"));Qe.send({type:"ready"});setInterval(()=>{window.opener||window.close()},250);</script>
|
|
2438
|
+
*/const Rn=e=>e&&e.enabled&&e.modifierKey,Xl=(e,t)=>e&&t[e+"Key"],yo=(e,t)=>e&&!t[e+"Key"];function ue(e,t,n){return e===void 0?!0:typeof e=="string"?e.indexOf(t)!==-1:typeof e=="function"?e({chart:n}).indexOf(t)!==-1:!1}function rs(e,t){return typeof e=="function"&&(e=e({chart:t})),typeof e=="string"?{x:e.indexOf("x")!==-1,y:e.indexOf("y")!==-1}:{x:!1,y:!1}}function zg(e,t){let n;return function(){return clearTimeout(n),n=setTimeout(e,t),t}}function Fg({x:e,y:t},n){const i=n.scales,s=Object.keys(i);for(let o=0;o<s.length;o++){const r=i[s[o]];if(t>=r.top&&t<=r.bottom&&e>=r.left&&e<=r.right)return r}return null}function ql(e,t,n){const{mode:i="xy",scaleMode:s,overScaleMode:o}=e||{},r=Fg(t,n),a=rs(i,n),l=rs(s,n);if(o){const u=rs(o,n);for(const f of["x","y"])u[f]&&(l[f]=a[f],a[f]=!1)}if(r&&l[r.axis])return[r];const c=[];return z(n.scales,function(u){a[u.axis]&&c.push(u)}),c}const Hs=new WeakMap;function U(e){let t=Hs.get(e);return t||(t={originalScaleLimits:{},updatedScaleLimits:{},handlers:{},panDelta:{},dragging:!1,panning:!1},Hs.set(e,t)),t}function Hg(e){Hs.delete(e)}function Gl(e,t,n,i){const s=Math.max(0,Math.min(1,(e-t)/n||0)),o=1-s;return{min:i*s,max:i*o}}function Kl(e,t){const n=e.isHorizontal()?t.x:t.y;return e.getValueForPixel(n)}function Zl(e,t,n){const i=e.max-e.min,s=i*(t-1),o=Kl(e,n);return Gl(o,e.min,i,s)}function Vg(e,t,n){const i=Kl(e,n);if(i===void 0)return{min:e.min,max:e.max};const s=Math.log10(e.min),o=Math.log10(e.max),r=Math.log10(i),a=o-s,l=a*(t-1),c=Gl(r,s,a,l);return{min:Math.pow(10,s+c.min),max:Math.pow(10,o-c.max)}}function Bg(e,t){return t&&(t[e.id]||t[e.axis])||{}}function aa(e,t,n,i,s){let o=n[i];if(o==="original"){const r=e.originalScaleLimits[t.id][i];o=R(r.options,r.scale)}return R(o,s)}function Wg(e,t,n){const i=e.getValueForPixel(t),s=e.getValueForPixel(n);return{min:Math.min(i,s),max:Math.max(i,s)}}function jg(e,{min:t,max:n,minLimit:i,maxLimit:s},o){const r=(e-n+t)/2;t-=r,n+=r;const a=o.min.options??o.min.scale,l=o.max.options??o.max.scale,c=e/1e6;return Oe(t,a,c)&&(t=a),Oe(n,l,c)&&(n=l),t<i?(t=i,n=Math.min(i+e,s)):n>s&&(n=s,t=Math.max(s-e,i)),{min:t,max:n}}function Le(e,{min:t,max:n},i,s=!1){const o=U(e.chart),{options:r}=e,a=Bg(e,i),{minRange:l=0}=a,c=aa(o,e,a,"min",-1/0),u=aa(o,e,a,"max",1/0);if(s==="pan"&&(t<c||n>u))return!0;const f=e.max-e.min,p=s?Math.max(n-t,l):f;if(s&&p===l&&f<=l)return!0;const g=jg(p,{min:t,max:n,minLimit:c,maxLimit:u},o.originalScaleLimits[e.id]);return r.min=g.min,r.max=g.max,o.updatedScaleLimits[e.id]=g,e.parse(g.min)!==e.min||e.parse(g.max)!==e.max}function Ug(e,t,n,i){const s=Zl(e,t,n),o={min:e.min+s.min,max:e.max-s.max};return Le(e,o,i,!0)}function $g(e,t,n,i){const s=Vg(e,t,n);return Le(e,s,i,!0)}function Yg(e,t,n,i){Le(e,Wg(e,t,n),i,!0)}const la=e=>e===0||isNaN(e)?0:e<0?Math.min(Math.round(e),-1):Math.max(Math.round(e),1);function Xg(e){const n=e.getLabels().length-1;e.min>0&&(e.min-=1),e.max<n&&(e.max+=1)}function qg(e,t,n,i){const s=Zl(e,t,n);e.min===e.max&&t<1&&Xg(e);const o={min:e.min+la(s.min),max:e.max-la(s.max)};return Le(e,o,i,!0)}function Gg(e){return e.isHorizontal()?e.width:e.height}function Kg(e,t,n){const s=e.getLabels().length-1;let{min:o,max:r}=e;const a=Math.max(r-o,1),l=Math.round(Gg(e)/Math.max(a,10)),c=Math.round(Math.abs(t/l));let u;return t<-l?(r=Math.min(r+c,s),o=a===1?r:r-a,u=r===s):t>l&&(o=Math.max(0,o-c),r=a===1?o:o+a,u=o===0),Le(e,{min:o,max:r},n)||u}const Zg={second:500,minute:30*1e3,hour:1800*1e3,day:720*60*1e3,week:3.5*24*60*60*1e3,month:360*60*60*1e3,quarter:1440*60*60*1e3,year:4368*60*60*1e3};function Ql(e,t,n,i=!1){const{min:s,max:o,options:r}=e,a=r.time&&r.time.round,l=Zg[a]||0,c=e.getValueForPixel(e.getPixelForValue(s+l)-t),u=e.getValueForPixel(e.getPixelForValue(o+l)-t);return isNaN(c)||isNaN(u)?!0:Le(e,{min:c,max:u},n,i?"pan":!1)}function ca(e,t,n){return Ql(e,t,n,!0)}const Vs={category:qg,default:Ug,logarithmic:$g},Bs={default:Yg},Ws={category:Kg,default:Ql,logarithmic:ca,timeseries:ca};function Qg(e,t,n){const{id:i,options:{min:s,max:o}}=e;if(!t[i]||!n[i])return!0;const r=n[i];return r.min!==s||r.max!==o}function ua(e,t){z(e,(n,i)=>{t[i]||delete e[i]})}function rn(e,t){const{scales:n}=e,{originalScaleLimits:i,updatedScaleLimits:s}=t;return z(n,function(o){Qg(o,i,s)&&(i[o.id]={min:{scale:o.min,options:o.options.min},max:{scale:o.max,options:o.options.max}})}),ua(i,n),ua(s,n),i}function ha(e,t,n,i){const s=Vs[e.type]||Vs.default;I(s,[e,t,n,i])}function fa(e,t,n,i){const s=Bs[e.type]||Bs.default;I(s,[e,t,n,i])}function Jg(e){const t=e.chartArea;return{x:(t.left+t.right)/2,y:(t.top+t.bottom)/2}}function xo(e,t,n="none",i="api"){const{x:s=1,y:o=1,focalPoint:r=Jg(e)}=typeof t=="number"?{x:t,y:t}:t,a=U(e),{options:{limits:l,zoom:c}}=a;rn(e,a);const u=s!==1,f=o!==1,p=ql(c,r,e);z(p||e.scales,function(g){g.isHorizontal()&&u?ha(g,s,r,l):!g.isHorizontal()&&f&&ha(g,o,r,l)}),e.update(n),I(c.onZoom,[{chart:e,trigger:i}])}function Jl(e,t,n,i="none",s="api"){const o=U(e),{options:{limits:r,zoom:a}}=o,{mode:l="xy"}=a;rn(e,o);const c=ue(l,"x",e),u=ue(l,"y",e);z(e.scales,function(f){f.isHorizontal()&&c?fa(f,t.x,n.x,r):!f.isHorizontal()&&u&&fa(f,t.y,n.y,r)}),e.update(i),I(a.onZoom,[{chart:e,trigger:s}])}function tm(e,t,n,i="none",s="api"){const o=U(e);rn(e,o);const r=e.scales[t];Le(r,n,void 0,!0),e.update(i),I(o.options.zoom?.onZoom,[{chart:e,trigger:s}])}function em(e,t="default"){const n=U(e),i=rn(e,n);z(e.scales,function(s){const o=s.options;i[s.id]?(o.min=i[s.id].min.options,o.max=i[s.id].max.options):(delete o.min,delete o.max),delete n.updatedScaleLimits[s.id]}),e.update(t),I(n.options.zoom.onZoomComplete,[{chart:e}])}function nm(e,t){const n=e.originalScaleLimits[t];if(!n)return;const{min:i,max:s}=n;return R(s.options,s.scale)-R(i.options,i.scale)}function im(e){const t=U(e);let n=1,i=1;return z(e.scales,function(s){const o=nm(t,s.id);if(o){const r=Math.round(o/(s.max-s.min)*100)/100;n=Math.min(n,r),i=Math.max(i,r)}}),n<1?n:i}function da(e,t,n,i){const{panDelta:s}=i,o=s[e.id]||0;ce(o)===ce(t)&&(t+=o);const r=Ws[e.type]||Ws.default;I(r,[e,t,n])?s[e.id]=0:s[e.id]=t}function tc(e,t,n,i="none"){const{x:s=0,y:o=0}=typeof t=="number"?{x:t,y:t}:t,r=U(e),{options:{pan:a,limits:l}}=r,{onPan:c}=a||{};rn(e,r);const u=s!==0,f=o!==0;z(n||e.scales,function(p){p.isHorizontal()&&u?da(p,s,l,r):!p.isHorizontal()&&f&&da(p,o,l,r)}),e.update(i),I(c,[{chart:e}])}function ec(e){const t=U(e);rn(e,t);const n={};for(const i of Object.keys(e.scales)){const{min:s,max:o}=t.originalScaleLimits[i]||{min:{},max:{}};n[i]={min:s.scale,max:o.scale}}return n}function sm(e){const t=U(e),n={};for(const i of Object.keys(e.scales))n[i]=t.updatedScaleLimits[i];return n}function om(e){const t=ec(e);for(const n of Object.keys(e.scales)){const{min:i,max:s}=t[n];if(i!==void 0&&e.scales[n].min!==i||s!==void 0&&e.scales[n].max!==s)return!0}return!1}function pa(e){const t=U(e);return t.panning||t.dragging}const ga=(e,t,n)=>Math.min(n,Math.max(t,e));function at(e,t){const{handlers:n}=U(e),i=n[t];i&&i.target&&(i.target.removeEventListener(t,i),delete n[t])}function On(e,t,n,i){const{handlers:s,options:o}=U(e),r=s[n];if(r&&r.target===t)return;at(e,n),s[n]=l=>i(e,l,o),s[n].target=t;const a=n==="wheel"?!1:void 0;t.addEventListener(n,s[n],{passive:a})}function rm(e,t){const n=U(e);n.dragStart&&(n.dragging=!0,n.dragEnd=t,e.update("none"))}function am(e,t){const n=U(e);!n.dragStart||t.key!=="Escape"||(at(e,"keydown"),n.dragging=!1,n.dragStart=n.dragEnd=null,e.update("none"))}function js(e,t){if(e.target!==t.canvas){const n=t.canvas.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}}return It(e,t)}function nc(e,t,n){const{onZoomStart:i,onZoomRejected:s}=n;if(i){const o=js(t,e);if(I(i,[{chart:e,event:t,point:o}])===!1)return I(s,[{chart:e,event:t}]),!1}}function lm(e,t){if(e.legend){const o=It(t,e);if(Je(o,e.legend))return}const n=U(e),{pan:i,zoom:s={}}=n.options;if(t.button!==0||Xl(Rn(i),t)||yo(Rn(s.drag),t))return I(s.onZoomRejected,[{chart:e,event:t}]);nc(e,t,s)!==!1&&(n.dragStart=t,On(e,e.canvas.ownerDocument,"mousemove",rm),On(e,window.document,"keydown",am))}function cm({begin:e,end:t},n){let i=t.x-e.x,s=t.y-e.y;const o=Math.abs(i/s);o>n?i=Math.sign(i)*Math.abs(s*n):o<n&&(s=Math.sign(s)*Math.abs(i/n)),t.x=e.x+i,t.y=e.y+s}function ma(e,t,n,{min:i,max:s,prop:o}){e[i]=ga(Math.min(n.begin[o],n.end[o]),t[i],t[s]),e[s]=ga(Math.max(n.begin[o],n.end[o]),t[i],t[s])}function um(e,t,n){const i={begin:js(t.dragStart,e),end:js(t.dragEnd,e)};if(n){const s=e.chartArea.width/e.chartArea.height;cm(i,s)}return i}function ic(e,t,n,i){const s=ue(t,"x",e),o=ue(t,"y",e),{top:r,left:a,right:l,bottom:c,width:u,height:f}=e.chartArea,p={top:r,left:a,right:l,bottom:c},g=um(e,n,i&&s&&o);s&&ma(p,e.chartArea,g,{min:"left",max:"right",prop:"x"}),o&&ma(p,e.chartArea,g,{min:"top",max:"bottom",prop:"y"});const x=p.right-p.left,y=p.bottom-p.top;return{...p,width:x,height:y,zoomX:s&&x?1+(u-x)/u:1,zoomY:o&&y?1+(f-y)/f:1}}function hm(e,t){const n=U(e);if(!n.dragStart)return;at(e,"mousemove");const{mode:i,onZoomComplete:s,drag:{threshold:o=0,maintainAspectRatio:r}}=n.options.zoom,a=ic(e,i,{dragStart:n.dragStart,dragEnd:t},r),l=ue(i,"x",e)?a.width:0,c=ue(i,"y",e)?a.height:0,u=Math.sqrt(l*l+c*c);if(n.dragStart=n.dragEnd=null,u<=o){n.dragging=!1,e.update("none");return}Jl(e,{x:a.left,y:a.top},{x:a.right,y:a.bottom},"zoom","drag"),n.dragging=!1,n.filterNextClick=!0,I(s,[{chart:e}])}function fm(e,t,n){if(yo(Rn(n.wheel),t)){I(n.onZoomRejected,[{chart:e,event:t}]);return}if(nc(e,t,n)!==!1&&(t.cancelable&&t.preventDefault(),t.deltaY!==void 0))return!0}function dm(e,t){const{handlers:{onZoomComplete:n},options:{zoom:i}}=U(e);if(!fm(e,t,i))return;const s=t.target.getBoundingClientRect(),o=i.wheel.speed,r=t.deltaY>=0?2-1/(1-o):1+o,a={x:r,y:r,focalPoint:{x:t.clientX-s.left,y:t.clientY-s.top}};xo(e,a,"zoom","wheel"),I(n,[{chart:e}])}function pm(e,t,n,i){n&&(U(e).handlers[t]=zg(()=>I(n,[{chart:e}]),i))}function gm(e,t){const n=e.canvas,{wheel:i,drag:s,onZoomComplete:o}=t.zoom;i.enabled?(On(e,n,"wheel",dm),pm(e,"onZoomComplete",o,250)):at(e,"wheel"),s.enabled?(On(e,n,"mousedown",lm),On(e,n.ownerDocument,"mouseup",hm)):(at(e,"mousedown"),at(e,"mousemove"),at(e,"mouseup"),at(e,"keydown"))}function mm(e){at(e,"mousedown"),at(e,"mousemove"),at(e,"mouseup"),at(e,"wheel"),at(e,"click"),at(e,"keydown")}function bm(e,t){return function(n,i){const{pan:s,zoom:o={}}=t.options;if(!s||!s.enabled)return!1;const r=i&&i.srcEvent;return r&&!t.panning&&i.pointerType==="mouse"&&(yo(Rn(s),r)||Xl(Rn(o.drag),r))?(I(s.onPanRejected,[{chart:e,event:i}]),!1):!0}}function ym(e,t){const n=Math.abs(e.clientX-t.clientX),i=Math.abs(e.clientY-t.clientY),s=n/i;let o,r;return s>.3&&s<1.7?o=r=!0:n>i?o=!0:r=!0,{x:o,y:r}}function sc(e,t,n){if(t.scale){const{center:i,pointers:s}=n,o=1/t.scale*n.scale,r=n.target.getBoundingClientRect(),a=ym(s[0],s[1]),l=t.options.zoom.mode,c={x:a.x&&ue(l,"x",e)?o:1,y:a.y&&ue(l,"y",e)?o:1,focalPoint:{x:i.x-r.left,y:i.y-r.top}};xo(e,c,"zoom","pinch"),t.scale=n.scale}}function xm(e,t,n){if(t.options.zoom.pinch.enabled){const i=It(n,e);I(t.options.zoom.onZoomStart,[{chart:e,event:n,point:i}])===!1?(t.scale=null,I(t.options.zoom.onZoomRejected,[{chart:e,event:n}])):t.scale=1}}function vm(e,t,n){t.scale&&(sc(e,t,n),t.scale=null,I(t.options.zoom.onZoomComplete,[{chart:e}]))}function oc(e,t,n){const i=t.delta;i&&(t.panning=!0,tc(e,{x:n.deltaX-i.x,y:n.deltaY-i.y},t.panScales),t.delta={x:n.deltaX,y:n.deltaY})}function _m(e,t,n){const{enabled:i,onPanStart:s,onPanRejected:o}=t.options.pan;if(!i)return;const r=n.target.getBoundingClientRect(),a={x:n.center.x-r.left,y:n.center.y-r.top};if(I(s,[{chart:e,event:n,point:a}])===!1)return I(o,[{chart:e,event:n}]);t.panScales=ql(t.options.pan,a,e),t.delta={x:0,y:0},oc(e,t,n)}function wm(e,t){t.delta=null,t.panning&&(t.panning=!1,t.filterNextClick=!0,I(t.options.pan.onPanComplete,[{chart:e}]))}const Us=new WeakMap;function ba(e,t){const n=U(e),i=e.canvas,{pan:s,zoom:o}=t,r=new Cn.Manager(i);o&&o.pinch.enabled&&(r.add(new Cn.Pinch),r.on("pinchstart",a=>xm(e,n,a)),r.on("pinch",a=>sc(e,n,a)),r.on("pinchend",a=>vm(e,n,a))),s&&s.enabled&&(r.add(new Cn.Pan({threshold:s.threshold,enable:bm(e,n)})),r.on("panstart",a=>_m(e,n,a)),r.on("panmove",a=>oc(e,n,a)),r.on("panend",()=>wm(e,n))),Us.set(e,r)}function ya(e){const t=Us.get(e);t&&(t.remove("pinchstart"),t.remove("pinch"),t.remove("pinchend"),t.remove("panstart"),t.remove("pan"),t.remove("panend"),t.destroy(),Us.delete(e))}function Sm(e,t){const{pan:n,zoom:i}=e,{pan:s,zoom:o}=t;return i?.zoom?.pinch?.enabled!==o?.zoom?.pinch?.enabled||n?.enabled!==s?.enabled||n?.threshold!==s?.threshold}var km="2.2.0";function ci(e,t,n){const i=n.zoom.drag,{dragStart:s,dragEnd:o}=U(e);if(i.drawTime!==t||!o)return;const{left:r,top:a,width:l,height:c}=ic(e,n.zoom.mode,{dragStart:s,dragEnd:o},i.maintainAspectRatio),u=e.ctx;u.save(),u.beginPath(),u.fillStyle=i.backgroundColor||"rgba(225,225,225,0.3)",u.fillRect(r,a,l,c),i.borderWidth>0&&(u.lineWidth=i.borderWidth,u.strokeStyle=i.borderColor||"rgba(225,225,225)",u.strokeRect(r,a,l,c)),u.restore()}var Tm={id:"zoom",version:km,defaults:{pan:{enabled:!1,mode:"xy",threshold:10,modifierKey:null},zoom:{wheel:{enabled:!1,speed:.1,modifierKey:null},drag:{enabled:!1,drawTime:"beforeDatasetsDraw",modifierKey:null},pinch:{enabled:!1},mode:"xy"}},start:function(e,t,n){const i=U(e);i.options=n,Object.prototype.hasOwnProperty.call(n.zoom,"enabled")&&console.warn("The option \`zoom.enabled\` is no longer supported. Please use \`zoom.wheel.enabled\`, \`zoom.drag.enabled\`, or \`zoom.pinch.enabled\`."),(Object.prototype.hasOwnProperty.call(n.zoom,"overScaleMode")||Object.prototype.hasOwnProperty.call(n.pan,"overScaleMode"))&&console.warn("The option \`overScaleMode\` is deprecated. Please use \`scaleMode\` instead (and update \`mode\` as desired)."),Cn&&ba(e,n),e.pan=(s,o,r)=>tc(e,s,o,r),e.zoom=(s,o)=>xo(e,s,o),e.zoomRect=(s,o,r)=>Jl(e,s,o,r),e.zoomScale=(s,o,r)=>tm(e,s,o,r),e.resetZoom=s=>em(e,s),e.getZoomLevel=()=>im(e),e.getInitialScaleBounds=()=>ec(e),e.getZoomedScaleBounds=()=>sm(e),e.isZoomedOrPanned=()=>om(e),e.isZoomingOrPanning=()=>pa(e)},beforeEvent(e,{event:t}){if(pa(e))return!1;if(t.type==="click"||t.type==="mouseup"){const n=U(e);if(n.filterNextClick)return n.filterNextClick=!1,!1}},beforeUpdate:function(e,t,n){const i=U(e),s=i.options;i.options=n,Sm(s,n)&&(ya(e),ba(e,n)),gm(e,n)},beforeDatasetsDraw(e,t,n){ci(e,"beforeDatasetsDraw",n)},afterDatasetsDraw(e,t,n){ci(e,"afterDatasetsDraw",n)},beforeDraw(e,t,n){ci(e,"beforeDraw",n)},afterDraw(e,t,n){ci(e,"afterDraw",n)},stop:function(e){mm(e),Cn&&ya(e),Hg(e)},panFunctions:Ws,zoomFunctions:Vs,zoomRectFunctions:Bs};function Mm({data:e,...t}){const n=Ze(null),i=Ze(null);return ut(()=>{zs.register(Tm,Pg,jd,Eg,cg,lg,gg,Sg);const s=i.current,o=n.current=new zs(s,{type:"line",data:e.peek(),options:{scales:{y:{min:0}},animation:!1,responsive:!0,plugins:{zoom:{pan:{enabled:!0,mode:"x"},zoom:{wheel:{enabled:!0},mode:"x"}},legend:{position:"top"},title:{display:!1}}}}),r=e.subscribe(a=>{o.data=a,o.update()});return()=>{o.destroy(),r()}},[]),m("canvas",{ref:i,...t})}function Em(){const e=fe();ut(()=>{const n=i=>{Pn(i)||e()};return $?.on("mount",n),$?.on("unmount",n),()=>{$?.off("mount",n),$?.off("unmount",n)}},[]);const t=$?.profilingContext;return m("div",{className:"flex flex-col gap-2"},Za(t.appStats).filter(([n])=>!Pn(n)).map(([n])=>m(Cm,{key:n.id,app:n})))}const xa=100,va=e=>Object.entries(e).map(([t,{values:n,color:i}])=>({label:t,data:n,fill:!1,borderColor:i,tension:.1}));function Cm({app:e}){const t=fe(),n=Ze({update:{values:[0],color:"#ad981f"},updateDirtied:{values:[0],color:"#b21f3a"},createNode:{values:[0],color:"#198019"},removeNode:{values:[0],color:"#5F3691"},updateNode:{values:[0],color:"#2f2f9d"},signalAttrUpdate:{values:[0],color:"#28888f"},signalTextUpdate:{values:[0],color:"#9b3b98"}}),i=J({labels:[(performance.now()/1e3).toFixed(2)],datasets:va(n.current)}),s=J(!1),o=$?.profilingContext;return ut(()=>{const r=a=>{a.id===e.id&&t()};return $?.on("update",r),()=>$?.off("update",r)},[]),ut(()=>{const r=[];Object.entries(n.current).forEach(([l,{values:c}])=>{const u=p=>{p.id===e.id&&s.peek()!==!0&&c[c.length-1]++},f=l;o.addEventListener(f,u),r.push(()=>o.removeEventListener(f,u))});const a=setInterval(()=>{if(s.peek()===!0)return;const l=[...i.value.labels];Object.values(n.current).forEach(c=>{c.values.push(0),c.values.length>xa&&c.values.shift()}),l.push((performance.now()/1e3).toFixed(2)),l.length>xa&&l.shift(),i.value={labels:l,datasets:va(n.current)}},100);return()=>{r.forEach(l=>l()),clearInterval(a)}},[]),m("div",{className:"flex flex-col gap-2 border border-white border-opacity-10 rounded bg-neutral-400 bg-opacity-5 text-neutral-400 p-2"},m("div",{className:"grid items-start gap-2",style:"grid-template-columns: 1fr max-content;"},m("div",{className:"flex flex-col gap-2"},m("span",null,e.name),m(Mm,{data:i,className:"w-full max-w-full min-h-20 bg-black bg-opacity-30",onmouseenter:()=>s.value=!0,onmouseleave:()=>s.value=!1})),m("div",{className:"text-xs grid grid-cols-2 gap-x-4",style:"grid-template-columns: auto auto;"},m("span",{className:"text-right"},"Mount duration:"),o.mountDuration(e).toFixed(2)," ms",m("span",{className:"text-right"},"Total updates:"),m("span",null,o.totalTicks(e).toLocaleString()),m("span",{className:"text-right"},"Avg. update duration:"),o.averageTickDuration(e).toFixed(2)," ms",m("span",{className:"text-right"},"Latest update:"),m("span",null,o.lastTickDuration(e).toFixed(2)," ms"))))}const xn=ht([]),rc=ht(""),Om=Ga(()=>rc.value.toLowerCase().split(" ").filter(e=>e.length>0));function Pm(e){return Om.value.every(t=>e.toLowerCase().includes(t))}function Dm(){const e=fe();ut(()=>{const n=i=>{Pn(i)||e()};return $?.on("update",n),()=>$?.off("update",n)},[]);const t=$?.SWRGlobalCache??new Map;return t.size===0?m("div",{className:"flex flex-col items-center justify-center h-full text-neutral-400"},m(Qa,null),m("h2",{className:"text-lg italic"},"No SWR detected")):m("div",{className:"flex flex-col gap-2 items-start"},m(ol,{value:rc,className:"sticky top-0"}),m("div",{className:"flex flex-col gap-2 w-full"},Za(t).filter(([n])=>Pm(n)).map(([n,i])=>m(Am,{key:n,entry:i}))))}function Am({key:e,entry:t}){const n=xn.value.includes(e),i=fe();ut(()=>{const{resource:o,isValidating:r,isMutating:a}=t,l=[o.subscribe(i),r.subscribe(i),a.subscribe(i)];return()=>l.forEach(c=>c())},[]);const s=Be(()=>{n?xn.value=xn.value.filter(o=>o!==e):xn.value=[...xn.value,e]},[n]);return m("div",{className:"flex flex-col"},m("button",{onclick:s,className:"flex items-center gap-2 justify-between p-2 border border-white border-opacity-10 cursor-pointer"+(n?" bg-white bg-opacity-5 text-neutral-100 rounded-t":" hover:bg-white hover:bg-opacity-10 text-neutral-400 rounded")},e,m(ae,{className:"transition-all"+(n?" rotate-90":"")})),n&&m("div",{className:"flex flex-col gap-2 p-2 border border-white border-opacity-10"},m(Ae,{data:{resource:t.resource.peek(),isMutating:t.isMutating.peek(),isValidating:t.isValidating.peek()},mutable:!1,objectRefAcc:[],keys:[],onChange:()=>{}})))}const Im=e=>m("main",{className:"flex flex-col flex-1 max-h-[calc(100vh-1rem)] overflow-y-auto",style:e.active?{}:{display:"none"}},e.children),$s={Apps:{Icon:$u,View:kh},Stores:{Icon:Zu,View:Eh},SWR:{Icon:Gu,View:Dm},Profiling:{Icon:qu,View:Em},Settings:{Icon:Yu,View:Ju}},Ci=ht("Apps");let _a=se.peek();se.subscribe(e=>{e!==_a&&e!==null&&(Ci.value="Apps"),_a=e});function Lm(){return m(Qu,null,m("nav",{className:"flex flex-col gap-2 justify-between p-2 bg-neutral-400 bg-opacity-5 border border-white border-opacity-10 rounded"},m("div",{className:"flex flex-col gap-2"},Object.keys($s).map(e=>m(Rm,{key:e,title:e})))),Object.entries($s).map(([e,{View:t}])=>m(Im,{key:e,active:Ci.value===e},m(t,null))))}function Rm({title:e}){const{Icon:t}=$s[e];return m("button",{key:e,onclick:()=>{Ci.value=e},className:"flex items-center px-2 py-1 gap-2 rounded border text-xs border-white border-opacity-10"+(Ci.value===e?" bg-white bg-opacity-5 text-neutral-100":" hover:bg-white hover:bg-opacity-10 text-neutral-400"),title:e},m(t,{className:"text-primary"}),m("span",{className:"hidden sm:inline"},e))}Vu(m(Lm,null),document.getElementById("app"));Qe.send({type:"ready"});setInterval(()=>{window.opener||window.close()},250);</script>
|
|
2426
2439
|
<style rel="stylesheet" crossorigin>*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.top-0{top:0}.z-10{z-index:10}.z-\\[9999\\]{z-index:9999}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.ml-6{margin-left:1.5rem}.flex{display:flex}.grid{display:grid}.hidden{display:none}.h-5{height:1.25rem}.h-full{height:100%}.max-h-\\[calc\\(100vh-1rem\\)\\]{max-height:calc(100vh - 1rem)}.min-h-20{min-height:5rem}.min-h-screen{min-height:100vh}.w-5{width:1.25rem}.w-8{width:2rem}.w-\\[5px\\]{width:5px}.w-full{width:100%}.max-w-full{max-width:100%}.flex-1{flex:1 1 0%}.flex-grow{flex-grow:1}.-translate-x-1\\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-col-resize{cursor:col-resize}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.resize{resize:both}.scroll-m-12{scroll-margin:3rem}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-4{gap:1rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rounded{border-radius:.25rem}.rounded-b{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-\\[\\#fff1\\]{border-color:#fff1}.border-neutral-700{--tw-border-opacity: 1;border-color:rgb(64 64 64 / var(--tw-border-opacity, 1))}.border-neutral-800{--tw-border-opacity: 1;border-color:rgb(38 38 38 / var(--tw-border-opacity, 1))}.border-white{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.border-opacity-10{--tw-border-opacity: .1}.bg-\\[\\#171616\\]{--tw-bg-opacity: 1;background-color:rgb(23 22 22 / var(--tw-bg-opacity, 1))}.bg-\\[\\#1a1a1a\\]{--tw-bg-opacity: 1;background-color:rgb(26 26 26 / var(--tw-bg-opacity, 1))}.bg-\\[\\#1d1d1d\\]{--tw-bg-opacity: 1;background-color:rgb(29 29 29 / var(--tw-bg-opacity, 1))}.bg-\\[\\#212121\\]{--tw-bg-opacity: 1;background-color:rgb(33 33 33 / var(--tw-bg-opacity, 1))}.bg-\\[\\#ffffff04\\]{background-color:#ffffff04}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-neutral-400{--tw-bg-opacity: 1;background-color:rgb(163 163 163 / var(--tw-bg-opacity, 1))}.bg-neutral-800{--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity, 1))}.bg-neutral-900{--tw-bg-opacity: 1;background-color:rgb(23 23 23 / var(--tw-bg-opacity, 1))}.bg-primary{--tw-bg-opacity: 1;background-color:rgb(220 20 60 / var(--tw-bg-opacity, 1))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-opacity-30{--tw-bg-opacity: .3}.bg-opacity-5{--tw-bg-opacity: .05}.p-1{padding:.25rem}.p-2{padding:.5rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.pb-2{padding-bottom:.5rem}.pl-2{padding-left:.5rem}.pl-4{padding-left:1rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pr-1{padding-right:.25rem}.text-right{text-align:right}.text-\\[10px\\]{font-size:10px}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.italic{font-style:italic}.text-neutral-100{--tw-text-opacity: 1;color:rgb(245 245 245 / var(--tw-text-opacity, 1))}.text-neutral-300{--tw-text-opacity: 1;color:rgb(212 212 212 / var(--tw-text-opacity, 1))}.text-neutral-400{--tw-text-opacity: 1;color:rgb(163 163 163 / var(--tw-text-opacity, 1))}.text-primary{--tw-text-opacity: 1;color:rgb(220 20 60 / var(--tw-text-opacity, 1))}.accent-red-500{accent-color:#ef4444}.opacity-50{opacity:.5}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}:root{color-scheme:dark}#app{min-width:-moz-fit-content;min-width:fit-content;background-image:linear-gradient(#171616,#0e0e0e);color:#fff;min-height:100vh;width:100%;display:flex;flex-direction:row;padding:.5rem;gap:.5rem}select{background:url("data:image/svg+xml,<svg height='10px' width='10px' viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'><path d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/></svg>") no-repeat;background-position:calc(100% - .75rem) center!important;-moz-appearance:none!important;-webkit-appearance:none!important;appearance:none!important;padding-right:2rem!important}select:not([disabled]){cursor:pointer}.last\\:border-b-0:last-child{border-bottom-width:0px}.hover\\:bg-neutral-700:hover{--tw-bg-opacity: 1;background-color:rgb(64 64 64 / var(--tw-bg-opacity, 1))}.hover\\:bg-white:hover{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.hover\\:bg-opacity-10:hover{--tw-bg-opacity: .1}.hover\\:opacity-100:hover{opacity:1}.focus\\:outline:focus{outline-style:solid}.focus\\:outline-primary:focus{outline-color:#dc143c}@media (min-width: 640px){.sm\\:inline{display:inline}}</style>
|
|
2427
2440
|
</head>
|
|
2428
2441
|
<body class="w-full min-h-screen">
|
|
@@ -2433,11 +2446,11 @@ var dist_default = `<!DOCTYPE html>
|
|
|
2433
2446
|
`;
|
|
2434
2447
|
|
|
2435
2448
|
// ../devtools-host/dist/index.js
|
|
2436
|
-
var dist_default2 = `var Ke="production";if(Ke!=="development"&&Ke!=="production")throw new Error("NODE_ENV must either be set to development or production.");var l=Ke==="development";var Ue=Symbol.for("kiru.signal"),Ct=Symbol.for("kiru.context"),ie=Symbol.for("kiru.contextProvider"),G=Symbol.for("kiru.fragment"),We=Symbol.for("kiru.error"),L=Symbol.for("kiru.hmrAccept"),ke=Symbol.for("kiru.memo"),se=Symbol.for("kiru.errorBoundary"),Tt=Symbol.for("kiru.suspenseThrow"),Be=50;var P=2,T=4,fe=8,V=16,_e=32,me=64,ae=128,At=/^on:?/;var qe=new Set(["animateTransform","circle","clipPath","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","path","polygon","polyline","radialGradient","rect","stop","svg","switch","symbol","text","textPath","title","tspan","use"]),Ge=new Set(["allowfullscreen","autofocus","autoplay","async","checked","compact","controls","contenteditable","declare","default","defer","disabled","download","hidden","inert","ismap","multiple","nohref","noresize","noshade","novalidate","nowrap","open","popover","readonly","required","sandbox","scoped","selected","sortable","spellcheck","translate","wrap"]),Mt=new Map([["acceptCharset","accept-charset"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["httpEquiv","http-equiv"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]);function Xe(e){return typeof e=="string"||typeof e=="number"||typeof e=="bigint"||typeof e=="boolean"||e===void 0||e===null}var
|
|
2449
|
+
var dist_default2 = `var Ke="production";if(Ke!=="development"&&Ke!=="production")throw new Error("NODE_ENV must either be set to development or production.");var l=Ke==="development";var Ue=Symbol.for("kiru.signal"),Ct=Symbol.for("kiru.context"),ie=Symbol.for("kiru.contextProvider"),G=Symbol.for("kiru.fragment"),We=Symbol.for("kiru.error"),L=Symbol.for("kiru.hmrAccept"),ke=Symbol.for("kiru.memo"),se=Symbol.for("kiru.errorBoundary"),Tt=Symbol.for("kiru.suspenseThrow"),Be=50;var P=2,T=4,fe=8,V=16,_e=32,me=64,ae=128,At=/^on:?/;var qe=new Set(["animateTransform","circle","clipPath","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","path","polygon","polyline","radialGradient","rect","stop","svg","switch","symbol","text","textPath","title","tspan","use"]),Ge=new Set(["allowfullscreen","autofocus","autoplay","async","checked","compact","controls","contenteditable","declare","default","defer","disabled","download","hidden","inert","ismap","multiple","nohref","noresize","noshade","novalidate","nowrap","open","popover","readonly","required","sandbox","scoped","selected","sortable","spellcheck","translate","wrap"]),Mt=new Map([["acceptCharset","accept-charset"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["httpEquiv","http-equiv"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]);function Xe(e){return typeof e=="string"||typeof e=="number"||typeof e=="bigint"||typeof e=="boolean"||e===void 0||e===null}var S={current:null},X={current:0},k={current:"window"in globalThis?"dom":"string"};var Rt,E=class extends Error{constructor(t){let r=typeof t=="string"?t:t.message;super(r),this[Rt]=!0,typeof t!="string"&&(l&&t?.vNode&&(this.customNodeStack=jr(t.vNode)),this.fatal=t?.fatal)}static isKiruError(t){return t instanceof Error&&t[We]===!0}};Rt=We;function jr(e){let t=e,r=[];for(;t&&t.parent;)typeof t.type=="function"?r.push(Kr(t.type)):typeof t.type=="string"&&r.push(t.type),t=t.parent;let n=typeof e.type=="function"?e:Ye(e,o=>typeof o.type=="function");return\`The above error occurred in the <\${Ot(n?.type||j)}> component:
|
|
2437
2450
|
|
|
2438
2451
|
\${r.map(o=>\` at \${o}\`).join(\`
|
|
2439
2452
|
\`)}
|
|
2440
|
-
\`}function Kr(e){let t=Ot(e);if(l){let r=Ur(e);r&&(t=\`\${t} (\${r})\`)}return t}function Ot(e){return e.displayName??(e.name||"Anonymous Function")}function Ur(e){return e.toString().match(/\\/\\/ \\[kiru_devtools\\]:(.*)/)?.[1]??null}var te={parentStack:[],childIdxStack:[],eventDeferrals:new Map,parent:function(){return this.parentStack[this.parentStack.length-1]},clear:function(){this.parentStack.length=0,this.childIdxStack.length=0},pop:function(){this.parentStack.pop(),this.childIdxStack.pop()},push:function(e){this.parentStack.push(e),this.childIdxStack.push(0)},currentChild:function(){return this.parentStack[this.parentStack.length-1].childNodes[this.childIdxStack[this.childIdxStack.length-1]]},nextChild:function(){return this.parentStack[this.parentStack.length-1].childNodes[this.childIdxStack[this.childIdxStack.length-1]++]},bumpChildIndex:function(){this.childIdxStack[this.childIdxStack.length-1]++},captureEvents:function(e){Pt(e,!0),this.eventDeferrals.set(e,[])},resetEvents:function(e){this.eventDeferrals.delete(e)},releaseEvents:function(e){Pt(e,!1);let t=this.eventDeferrals.get(e);for(;t?.length;)t.shift()()}},Wr=e=>{let t=e.target;!e.isTrusted||!t||te.eventDeferrals.get(t)?.push(()=>t.dispatchEvent(e))},Pt=(e,t)=>{for(let r in e)if(r.startsWith("on")){let n=r.substring(2);e[t?"addEventListener":"removeEventListener"](n,Wr,{passive:!0})}};var rt=!1,Je=!1,Dt=e=>{e.preventDefault(),e.stopPropagation(),Je=!0},le=null;function Lt(){rt=!0,le=document.activeElement,le&&le!==document.body&&le.addEventListener("blur",Dt)}function Vt(){Je&&(le.removeEventListener("blur",Dt),le.isConnected&&le.focus(),Je=!1),rt=!1}function Ze(e,t){if(typeof e=="function"){e(t);return}if(w.isSignal(e)){e.sneak(t),e.notify({filter:r=>typeof r=="function"});return}e.current=t}function $t(e){let t=e.type;return t=="#text"?Ht(e):qe.has(t)?document.createElementNS("http://www.w3.org/2000/svg",t):document.createElement(t)}function Ht(e){let{nodeValue:t}=e.props;if(!w.isSignal(t))return document.createTextNode(t);let r=t.peek()??"",n=document.createTextNode(r);return et(e,n,t),n}function Br(e,t,r){let n=Qe.get(e)??{},o=n[t]=s=>{if(rt){s.preventDefault(),s.stopPropagation();return}r(s)};return Qe.set(e,n),o}var Qe=new WeakMap;function Ft(e){let t=e.dom,r=e.prev?.props??{},n=e.props??{},o=new Set([...Object.keys(r),...Object.keys(n)]),s=S.current==="hydrate";o.forEach(i=>{let a=r[i],u=n[i];if(ge.internalProps.includes(i)&&i!=="innerHTML"){i==="ref"&&a!==u&&(a&&Ze(a,null),u&&Ze(u,t));return}if(ge.isEvent(i)){if(a!==u||S.current==="hydrate"){let c=i.replace(At,""),p=c==="focus"||c==="blur";i in r&&t.removeEventListener(c,p?Qe.get(e)?.[c]:a),i in n&&t.addEventListener(c,p?Br(e,c,u):u)}return}if(!(t instanceof Text)){if(a===u||s&&t.getAttribute(i)===u)return;if(w.isSignal(a)&&e.cleanups){let c=e.cleanups[i];c&&(c(),delete e.cleanups[i])}if(w.isSignal(u))return Yr(e,t,i,u,a);Ce(t,i,u,a);return}w.isSignal(u)||t.nodeValue!==u&&(t.nodeValue=u)})}function qr(e){return e.multiple?Array.from(e.selectedOptions).map(t=>t.value):e.value}function Nt(e,t){if(!e.multiple||t===void 0||t===null||t===""){e.value=t;return}Array.from(e.options).forEach(r=>{r.selected=t.indexOf(r.value)>-1})}var Gr={value:"input",checked:"change",open:"toggle",volume:"volumechange",playbackRate:"ratechange",currentTime:"timeupdate"},Xr=["progress","meter","number","range"];function Yr(e,t,r,n,o){let s=e.cleanups??(e.cleanups={}),[i,a]=r.split(":");if(i!=="bind")return s[r]=n.subscribe((b,C)=>{Ce(t,r,b,C),l&&window.__kiru.profilingContext?.emit("signalAttrUpdate",J(e))}),Ce(t,r,n.peek(),Y(o));let u=Gr[a];if(!u){l&&console.error(\`[kiru]: \${a} is not a valid element binding attribute.\`);return}let c=t instanceof HTMLSelectElement,p=c?b=>Nt(t,b):b=>t[a]=b,v=b=>{p(b),l&&window.__kiru.profilingContext?.emit("signalAttrUpdate",J(e))},M=b=>{n.sneak(b),n.notify({filter:C=>C!==v})},h;if(a==="value"){let b=Xr.indexOf(t.type)!==-1;h=()=>{let C=t.value;c?C=qr(t):typeof n.peek()=="number"&&b&&(C=t.valueAsNumber),M(C)}}else h=b=>{let C=b.target[a];a==="currentTime"&&n.peek()===C||M(C)};t.addEventListener(u,h);let x=n.subscribe(v);return s[r]=()=>{t.removeEventListener(u,h),x()},Ce(t,a,n.peek(),Y(o))}function et(e,t,r){(e.cleanups??(e.cleanups={})).nodeValue=r.subscribe((n,o)=>{n!==o&&(t.nodeValue=n,l&&window.__kiru.profilingContext?.emit("signalTextUpdate",J(e)))})}function Jr(e){if(e.type!=="#text"||!w.isSignal(e.props.nodeValue))return;let t=Y(e.props.nodeValue);if(!Xe(t)){l&&console.error(\`[kiru]: Hydration mismatch - expected primitive child but received \${t}\`);return}let r=Ht(e),n=te.parent();return n&&n.appendChild(r),r}function It(e){let t=te.nextChild()??Jr(e);if(!t)throw new E({message:"Hydration mismatch - no node found",vNode:e});let r=t.nodeName;if(qe.has(r)||(r=r.toLowerCase()),e.type!==r)throw new E({message:\`Hydration mismatch - expected node of type \${e.type.toString()} but received \${r}\`,vNode:e});if(e.dom=t,e.type!=="#text"&&!(e.flags&V)){Ft(e);return}w.isSignal(e.props.nodeValue)&&et(e,t,e.props.nodeValue);let n=e,o=e.sibling;for(;o&&o.type==="#text";){let s=o;te.bumpChildIndex();let i=String(Y(n.props.nodeValue)??""),a=n.dom.splitText(i.length);s.dom=a,w.isSignal(s.props.nodeValue)&&et(s,a,s.props.nodeValue),n=o,o=o.sibling}}function zt(e,t,r,n=!1){if(r===null)return e.removeAttribute(t),!0;switch(typeof r){case"undefined":case"function":case"symbol":return e.removeAttribute(t),!0;case"boolean":if(n&&!r)return e.removeAttribute(t),!0}return!1}function Zr(e,t,r){let n=Ge.has(t);zt(e,t,r,n)||e.setAttribute(t,n&&typeof r=="boolean"?"":String(r))}var Qr=["INPUT","TEXTAREA"],en=e=>Qr.indexOf(e.nodeName)>-1;function Ce(e,t,r,n){if(r!==n)switch(t){case"style":return nn(e,r,n);case"className":return rn(e,r);case"innerHTML":return tn(e,r);case"muted":e.muted=!!r;return;case"value":if(e.nodeName==="SELECT")return Nt(e,r);let o=r==null?"":String(r);if(en(e)){e.value=o;return}e.setAttribute("value",o);return;case"checked":if(e.nodeName==="INPUT"){e.checked=!!r;return}e.setAttribute("checked",String(r));return;default:return Zr(e,qt(t),r)}}function tn(e,t){if(t==null||typeof t=="boolean"){e.innerHTML="";return}e.innerHTML=String(t)}function rn(e,t){let r=Y(t);if(!r)return e.removeAttribute("class");e.setAttribute("class",r)}function nn(e,t,r){if(zt(e,"style",t))return;if(typeof t=="string"){e.setAttribute("style",t);return}let n={};typeof r=="string"?e.setAttribute("style",""):typeof r=="object"&&r&&(n=r);let o=t;new Set([...Object.keys(n),...Object.keys(o)]).forEach(i=>{let a=n[i],u=o[i];if(a!==u){if(u===void 0){e.style[i]="";return}e.style[i]=u}})}function on(e){let t=e.parent,r=t?.dom;for(;t&&!r;)t=t.parent,r=t?.dom;if(!r||!t){if(!e.parent&&e.dom)return e;throw new E({message:"No DOM parent found while attempting to place node.",vNode:e})}return t}function sn(e,t){let{node:r,lastChild:n}=t,o=e.dom;if(n){n.after(o);return}let s=jt(e,r);if(s){r.dom.insertBefore(o,s);return}r.dom.appendChild(o)}function jt(e,t){let r=e;for(;r;){let n=r.sibling;for(;n;){if(!(n.flags&(T|V))){let o=an(n);if(o?.isConnected)return o}n=n.sibling}if(r=r.parent,!r||r.flags&V||r===t)return}}function an(e){let t=e;for(;t;){if(t.dom)return t.dom;if(t.flags&V)return;t=t.child}}function Kt(e){if(S.current==="hydrate")return Z(e,he);let t={node:e.dom?e:on(e)};tt(e,t,(e.flags&T)>0),e.dom&&!(e.flags&V)&&Ut(e,t,!1),he(e)}function tt(e,t,r){let n=e.child;for(;n;){if(n.flags&me){n.flags&T&&ln(n,t),he(n),n=n.sibling;continue}n.dom?(tt(n,{node:n},!1),n.flags&V||Ut(n,t,r)):tt(n,t,(n.flags&T)>0||r),he(n),n=n.sibling}}function Ut(e,t,r){(r||!e.dom.isConnected||e.flags&T)&&sn(e,t),(!e.prev||e.flags&P)&&Ft(e),t.lastChild=e.dom}function Wt(e){e===e.parent?.child&&(e.parent.child=e.sibling);let t;l&&(t=J(e)),Z(e,r=>{let{hooks:n,subs:o,cleanups:s,dom:i,props:{ref:a}}=r;for(o?.forEach(u=>u()),s&&Object.values(s).forEach(u=>u());n?.length;)n.pop().cleanup?.();l&&(window.__kiru.profilingContext?.emit("removeNode",t),i instanceof Element&&delete i.__kiruNode),i&&(a&&Ze(a,null),i.isConnected&&!(r.flags&V)&&i.remove(),delete r.dom)}),e.parent=null}function ln(e,t){if(!e.child)return;let r=[];if(Bt(e.child,r),r.length===0)return;let{node:n,lastChild:o}=t;if(o)o.after(...r);else{let s=jt(e,n),i=n.dom;s?s.before(...r):i.append(...r)}t.lastChild=r[r.length-1]}function Bt(e,t){let r=e;for(;r;)r.dom?t.push(r.dom):r.child&&Bt(r.child,t),r=r.sibling}function Gt(e){return typeof e=="function"&&typeof e[ke]?.arePropsEqual=="function"}function f(e,t=null,...r){if(e===Q)return Q({children:r,...t});let n={type:e,flags:0,index:0,depth:0,props:{},parent:null,sibling:null,child:null,prev:null,deletions:null};if(Gt(e)&&(n.flags|=_e,n.arePropsEqual=e[ke].arePropsEqual),t!==null){let{key:s,ref:i,...a}=t;Xt(s)&&(n.props.key=s.toString()),Yt(i)&&(n.props.ref=i),Object.assign(n.props,a)}let o=r.length===1?r[0]:r.length>1?r:null;return o!==null&&(n.props.children=o),n}function Q({children:e,key:t}){return f(G,t?{key:t}:null,e)}var it;function Me(e,t){return l&&(it=J(e)),Array.isArray(t)?(l&&(nr in t&&dn(e,t),pn(e,t)),cn(e,t)):un(e,t)}function un(e,t){let r=e.child;if(r===null)return er(e,t);let n=r.sibling,o=Zt(e,r,t);if(o!==null)return r&&r!==o&&!o.prev?ot(e,r):n&&ot(e,n),o;{let s=or(r),i=tr(s,e,0,t);if(i!==null){let a=i.prev;if(a!==null){let u=a.props.key;s.delete(u===void 0?a.index:u)}Te(i,0,0)}return s.forEach(a=>Ae(e,a)),i}}function cn(e,t){let r=null,n=null,o=e.child,s=null,i=0,a=0;for(;o!==null&&a<t.length;a++){o.index>a?(s=o,o=null):s=o.sibling;let c=Zt(e,o,t[a]);if(c===null){o===null&&(o=s);break}o&&!c.prev&&Ae(e,o),i=Te(c,i,a),n===null?r=c:n.sibling=c,n=c,o=s}if(a===t.length)return ot(e,o),r;if(o===null){for(;a<t.length;a++){let c=er(e,t[a]);c!==null&&(i=Te(c,i,a),n===null?r=c:n.sibling=c,n=c)}return r}let u=or(o);for(;a<t.length;a++){let c=tr(u,e,a,t[a]);if(c!==null){let p=c.prev;if(p!==null){let v=p.props.key;u.delete(v===void 0?p.index:v)}i=Te(c,i,a),n===null?r=c:n.sibling=c,n=c}}return u.forEach(c=>Ae(e,c)),r}function Zt(e,t,r){let n=t?.props.key;return Re(r)?n!==void 0||t?.type==="#text"&&w.isSignal(t.props.nodeValue)?null:Jt(e,t,""+r):w.isSignal(r)?t&&t.props.nodeValue!==r?null:Jt(e,t,r):ue(r)?r.props.key!==n?null:fn(e,t,r):Array.isArray(r)?n!==void 0?null:(l&&st(r),Qt(e,t,r)):null}function Jt(e,t,r){if(t===null||t.type!=="#text"){l&&U();let o=f("#text",{nodeValue:r});return K(o,e),o}return l&&we(),t.props.nodeValue!==r&&(t.props.nodeValue=r,t.flags|=P),t.sibling=null,t}function fn(e,t,r){let{type:n,props:o}=r;if(l&&typeof n=="function"&&(n=_(n)),n===G)return Qt(e,t,o.children||[],o);if(t?.type===n)return l&&we(),t.index=0,t.sibling=null,typeof n=="string"?rr(t.props,o)&&(t.flags|=P):t.flags|=P,t.props=o,t.memoizedProps=r.memoizedProps,t;l&&U();let s=f(n,o);return K(s,e),s}function Qt(e,t,r,n={}){if(t===null||t.type!==G){l&&U();let o=f(G,{children:r,...n});return K(o,e),o}return l&&we(),t.props={...t.props,...n,children:r},t.flags|=P,t.sibling=null,t}function er(e,t){if(Re(t)){l&&U();let r=f("#text",{nodeValue:""+t});return K(r,e),r}if(w.isSignal(t)){l&&U();let r=f("#text",{nodeValue:t});return K(r,e),r}if(ue(t)){l&&U();let r=f(t.type,t.props);return K(r,e),r.flags|=T,r}if(Array.isArray(t)){l&&(U(),st(t));let r=Q({children:t});return K(r,e),r}return null}function Te(e,t,r){e.index=r;let n=e.prev;if(n!==null){let o=n.index;return o<t?(e.flags|=T,t):o}else return e.flags|=T,t}function tr(e,t,r,n){if(w.isSignal(n)||Re(n)){let s=e.get(r);if(s){if(s.props.nodeValue===n)return s;s.type==="#text"&&w.isSignal(s.props.nodeValue)&&s.cleanups?.nodeValue?.()}l&&U();let i=f("#text",{nodeValue:n});return K(i,t),i.flags|=T,i.index=r,i}if(ue(n)){let{type:s,props:i}=n,a=i.key,u=e.get(a===void 0?r:a);if(u?.type===s)return l&&we(),typeof s=="string"?rr(u.props,i)&&(u.flags|=P):u.flags|=P,u.props=i,u.sibling=null,u.index=r,u;l&&U();let c=f(n.type,n.props);return K(c,t),c.flags|=T,c.index=r,c}if(Array.isArray(n)){let s=e.get(r);if(l&&st(n),s)return l&&we(),s.flags|=P,s.props.children=n,s;l&&U();let i=Q({children:n});return K(i,t),i.flags|=T,i.index=r,i}return null}function rr(e,t){let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!0;for(let o of r)if(!(o==="children"||o==="key")&&e[o]!==t[o])return!0;return!1}function K(e,t){e.parent=t,e.depth=t.depth+1}function we(){"window"in globalThis&&window.__kiru.profilingContext?.emit("updateNode",it)}function U(){"window"in globalThis&&window.__kiru.profilingContext?.emit("createNode",it)}var nr=Symbol("kiru:marked-list-child");function st(e){Object.assign(e,{[nr]:!0})}function or(e){let t=new Map;for(;e;){let r=e.props.key;t.set(r===void 0?e.index:r,e),e=e.sibling}return t}function Ae(e,t){e.deletions===null?e.deletions=[t]:e.deletions.push(t)}function ot(e,t){for(;t;)Ae(e,t),t=t.sibling}function pn(e,t){let r=new Set,n=!1;for(let o of t){if(!ue(o))continue;let s=o.props.key;if(typeof s=="string"){if(!n&&r.has(s)){let i=sr(e);ir(\`\${i} component produced a child in a list with a duplicate key prop: "\${s}". Keys should be unique so that components maintain their identity across updates\`),n=!0}r.add(s)}}}function dn(e,t){let r=!1,n=!1;for(let o of t){if(!ue(o))continue;typeof o.props.key=="string"?r=!0:n=!0}if(n&&r){let o=sr(e);ir(\`\${o} component produced a child in a list without a valid key prop\`)}}function ir(e){let t=\`[kiru]: \${e}. See https://kirujs.dev/keys-warning for more information.\`;console.error(t)}var nt=new WeakMap;function sr(e){if(nt.has(e))return nt.get(e);let t=e.parent,r;for(;!r&&t;)typeof t.type=="function"&&(r=t.type),t=t.parent;let n=\`<\${r?.displayName||r?.name||"Anonymous Function"} />\`;return nt.set(e,n),n}var W,B=[],pe=!1,lt=[],Oe=[],ut=!1,ct=!1,ft=!1,pt=0,ar=[],dt=[],lr=-1;function gt(e){if(pe){lt.push(e);return}e()}function Pe(){pe&&(window.cancelAnimationFrame(lr),ur())}function ht(e){e.flags|=ae,B.push(e),pe=!0,Pe()}function R(e){if(S.current==="hydrate")return gt(()=>mt(e));mt(e)}function mn(){pe||(pe=!0,lr=window.requestAnimationFrame(ur))}function gn(){for(pe=!1;lt.length;)lt.shift()()}function mt(e){if(ut&&(ct=!0),k.current===e){l&&window.__kiru.profilingContext?.emit("updateDirtied",W),ft=!0;return}if(!(e.flags&(ae|fe))){if(e.flags|=ae,!B.length)return B.push(e),mn();B.push(e)}}function hn(e){Z(e,t=>t.flags|=fe),Oe.push(e)}var wn=(e,t)=>t.depth-e.depth,re=null;function ur(){if(l){let t=Oe[0]??B[0];t?(W=J(t),window.__kiru.profilingContext?.beginTick(W)):W=null}let e=1;for(Lt();B.length;){B.length>e&&B.sort(wn),re=B.shift(),e=B.length;let t=re.flags;if(!(t&fe)&&t&ae){let r=re;for(;r=bn(r););for(;Oe.length;)Wt(Oe.pop());Kt(re),re.flags&=~ae}}if(Vt(),ut=!0,at(ar),ut=!1,ct)return En(),at(dt),ct=!1,pt++,l&&(window.__kiru.profilingContext?.endTick(W),window.__kiru.profilingContext?.emit("updateDirtied",W)),Pe();pt=0,gn(),at(dt),l&&(window.__kiru.emit("update",W),window.__kiru.profilingContext?.emit("update",W),window.__kiru.profilingContext?.endTick(W))}function bn(e){let t=!0;try{typeof e.type=="string"?xn(e):wt(e.type)?yn(e):t=vn(e)}catch(n){l&&window.__kiru.emit("error",W,n instanceof Error?n:new Error(String(n)));let o=cr(e);if(o){let s=o.error=n instanceof Error?n:new Error(String(n));return o.props.onError?.(s),o.depth<re.depth&&(re=o),o}if(E.isKiruError(n)){if(n.customNodeStack&&setTimeout(()=>{throw new Error(n.customNodeStack)}),n.fatal)throw n;console.error(n);return}setTimeout(()=>{throw n})}if(e.deletions!==null&&(e.deletions.forEach(hn),e.deletions=null),t&&e.child)return e.child;let r=e;for(;r;){if(r.immediateEffects&&(ar.push(...r.immediateEffects),r.immediateEffects=void 0),r.effects&&(dt.push(...r.effects),r.effects=void 0),r===re)return;if(r.sibling)return r.sibling;r=r.parent,S.current==="hydrate"&&r?.dom&&te.pop()}}function yn(e){let{props:t,type:r}=e,n=t.children;if(r===ie){let{props:{dependents:o,value:s},prev:i}=e;o.size&&i&&i.props.value!==s&&o.forEach(mt)}else if(r===se){let o=e,{error:s}=o;s&&(n=typeof t.fallback=="function"?t.fallback(s):t.fallback,delete o.error)}e.child=Me(e,n)}function vn(e){let{type:t,props:r,subs:n,prev:o,flags:s}=e;if(s&_e){if(e.memoizedProps=r,o?.memoizedProps&&e.arePropsEqual(o.memoizedProps,r)&&!e.hmrUpdated)return e.flags|=me,!1;e.flags&=~me}try{k.current=e;let i,a=0;do{if(e.flags&=~ae,ft=!1,X.current=0,n&&(n.forEach(u=>u()),n.clear()),l){if(i=_(t)(r),e.hmrUpdated&&e.hooks&&e.hookSig){let u=e.hooks.length;if(X.current<u){for(let c=X.current;c<u;c++)e.hooks[c].cleanup?.();e.hooks.length=X.current,e.hookSig.length=X.current}}if(delete e.hmrUpdated,++a>Be)throw new E({message:"Too many re-renders. Kiru limits the number of renders to prevent an infinite loop.",fatal:!0,vNode:e});continue}i=t(r)}while(ft);return e.child=Me(e,i),!0}finally{k.current=null}}function xn(e){let{props:t,type:r}=e;l&&bt(e),e.dom||(S.current==="hydrate"?It(e):e.dom=$t(e),l&&e.dom instanceof Element&&(e.dom.__kiruNode=e)),r!=="#text"&&(e.child=Me(e,t.children),e.child&&S.current==="hydrate"&&te.push(e.dom))}function En(){if(pt>Be)throw new E("Maximum update depth exceeded. This can happen when a component repeatedly calls setState during render or in useLayoutEffect. Kiru limits the number of nested updates to prevent infinite loops.")}function at(e){for(let t=0;t<e.length;t++)e[t]();e.length=0}var fr;(function(e){e.Start="start",e.End="end"})(fr||(fr={}));var de=null,pr=new Set;function d(e,t,r){let n=k.current;if(n||Sn(e),l&&de!==null&&!pr.has(e+de))throw pr.add(e+de),new E({message:\`Nested primitive "useHook" calls are not supported. "\${e}" was called inside "\${de}". Strange will most certainly happen.\`,vNode:n});let o=(a,u)=>{if(u?.immediate){(n.immediateEffects??(n.immediateEffects=[])).push(a);return}(n.effects??(n.effects=[])).push(a)},s=X.current++,i=n.hooks?.at(s);if(l){de=e,n.hooks??(n.hooks=[]),n.hookSig??(n.hookSig=[]),n.hookSig[s]?n.hookSig[s]!==e&&(console.warn(\`[kiru]: hooks must be called in the same order. Hook "\${e}" was called in place of "\${n.hookSig[s]}". Strange things may happen.\`),i?.cleanup?.(),n.hooks.length=s,n.hookSig.length=s,i=void 0):n.hookSig[s]=e;let a;i?a=i:(a=typeof t=="function"?t():{...t},a.name=e),n.hooks[s]=a;try{return r({hook:a,isInit:!i,isHMR:n.hmrUpdated,update:()=>R(n),queueEffect:o,vNode:n,index:s})}catch(u){throw u}finally{de=null}}try{let a=i??(typeof t=="function"?t():{...t});return n.hooks??(n.hooks=[]),n.hooks[s]=a,r({hook:a,isInit:!i,update:()=>R(n),queueEffect:o,vNode:n,index:s})}catch(a){throw a}}function Sn(e){throw new E(\`Hook "\${e}" must be used at the top level of a component or inside another composite hook.\`)}function $(e){e.cleanup&&(e.cleanup(),e.cleanup=void 0)}function A(e,t){return e===void 0||t===void 0||e.length!==t.length||e.length>0&&t.some((r,n)=>!Object.is(r,e[n]))}var be={stack:new Array,current:function(){return this.stack[this.stack.length-1]}},H=new Map,F=new Map;var dr,w=class e{constructor(t,r){this[dr]=!0,this.$id=Le(),this.$value=t,r&&(this.displayName=r),l?(F.set(this.$id,new Set),this.$initialValue=yt(t),this[L]={provide:()=>this,inject:n=>{F.get(this.$id)?.clear?.(),F.delete(this.$id),this.$id=n.$id,n.__next=this,this.$initialValue===n.$initialValue?this.$value=n.$value:this.notify()},destroy:()=>{}}):this.$subs=new Set}get value(){if(this.onBeforeRead?.(),l){let t=_(this);return e.entangle(t),t.$value}return e.entangle(this),this.$value}set value(t){if(l){let r=_(this);if(Object.is(r.$value,t))return;r.$prevValue=r.$value,r.$value=t,r.notify();return}Object.is(this.$value,t)||(this.$prevValue=this.$value,this.$value=t,this.notify())}peek(){return this.onBeforeRead?.(),l?_(this).$value:this.$value}sneak(t){if(l){let r=_(this);r.$prevValue=r.$value,r.$value=t;return}this.$prevValue=this.$value,this.$value=t}toString(){if(this.onBeforeRead?.(),l){let t=_(this);return e.entangle(t),\`\${t.$value}\`}return e.entangle(this),\`\${this.$value}\`}subscribe(t){return l?(F.get(this.$id).add(t),()=>F.get(this.$id)?.delete(t)):(this.$subs.add(t),()=>this.$subs.delete(t))}notify(t){if(l)return F.get(this.$id)?.forEach(r=>{if(t?.filter&&!t.filter(r))return;let{$value:n,$prevValue:o}=_(this);return r(n,o)});this.$subs.forEach(r=>{if(!(t?.filter&&!t.filter(r)))return r(this.$value,this.$prevValue)})}static isSignal(t){return typeof t=="object"&&!!t&&Ue in t}static subscribers(t){return l?F.get(t.$id):t.$subs}static makeReadonly(t){let r=Object.getOwnPropertyDescriptor(t,"value");return r&&!r.writable?t:Object.defineProperty(t,"value",{get:function(){return e.entangle(this),this.$value},configurable:!0})}static makeWritable(t){let r=Object.getOwnPropertyDescriptor(t,"value");return r&&r.writable?t:Object.defineProperty(t,"value",{get:function(){return e.entangle(this),this.$value},set:function(n){this.$value=n,this.notify()},configurable:!0})}static entangle(t){let r=k.current,n=be.current();if(n){(!r||r&&m())&&n.set(t.$id,t);return}if(!r||!m())return;let o=t.subscribe(()=>R(r));(r.subs??(r.subs=new Set)).add(o)}static configure(t,r){t.onBeforeRead=r}static dispose(t){if(t.$isDisposed=!0,l){F.delete(t.$id);return}t.$subs.clear()}};dr=Ue;var De=(e,t)=>new w(e,t),y=(e,t)=>d("useSignal",{signal:null},({hook:r,isInit:n,isHMR:o})=>{if(l&&(n&&(r.dev={devtools:{get:()=>({displayName:r.signal.displayName,value:r.signal.peek()}),set:({value:s})=>{r.signal.value=s}},initialArgs:[e,t]}),o)){let[s,i]=r.dev.initialArgs;(s!==e||i!==t)&&(r.cleanup?.(),n=!0,r.dev.initialArgs=[e,t])}return n&&(r.cleanup=()=>w.dispose(r.signal),r.signal=new w(e,t)),r.signal});function Y(e,t=!1){return w.isSignal(e)?t?e.value:e.peek():e}var vt=()=>{H.forEach(e=>e()),H.clear()};var ge={internalProps:["children","ref","key","innerHTML"],isEvent:e=>e.startsWith("on"),isProperty:e=>!ge.internalProps.includes(e)&&!ge.isEvent(e)};function qt(e){switch(e){case"className":return"class";case"htmlFor":return"for";case"tabIndex":case"formAction":case"formMethod":case"formEncType":case"contentEditable":case"spellCheck":case"allowFullScreen":case"autoPlay":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"noModule":case"noValidate":case"popoverTarget":case"popoverTargetAction":case"playsInline":case"readOnly":case"itemscope":case"rowSpan":case"crossOrigin":return e.toLowerCase();default:return e.indexOf("-")>-1?e:e.startsWith("aria")?"aria-"+e.substring(4).toLowerCase():Mt.get(e)||e}}function yt(e,t={functions:!0}){let r=new WeakSet;return JSON.stringify(e,(n,o)=>{if(typeof o=="object"&&o!==null){if(r.has(o))return"[CIRCULAR]";r.add(o)}return typeof o=="function"?t.functions?o.toString():\`[FUNCTION (\${o.name||"anonymous"})]\`:o})}function _(e){let t=e;if(l)for(;"__next"in t;)t=t.__next;return t}function m(){return S.current==="dom"||S.current==="hydrate"}function ue(e){return typeof e=="object"&&e!==null&&"type"in e}function Re(e){return typeof e=="string"&&e!==""||typeof e=="number"||typeof e=="bigint"}function wt(e){return e===G||e===ie||e===se}function mr(e){return e.type===G}function J(e){let t=e;for(;t;){if(t.app)return e.app=t.app;t=t.parent}return null}function he(e){let{props:{children:t,...r},memoizedProps:n,index:o}=e;e.prev={props:r,memoizedProps:n,index:o},e.flags&=~(P|T|fe)}function gr(e,t){if(t.depth<e.depth)return!1;if(e===t)return!0;let r=!1,n=[e];for(;n.length;){let o=n.pop();if(o===t)return!0;o.child&&n.push(o.child),r&&o.sibling&&n.push(o.sibling),r=!0}return!1}function Z(e,t){t(e);let r=e.child;for(;r;)t(r),r.child&&Z(r,t),r=r.sibling}function Ye(e,t){let r=e.parent;for(;r;){if(t(r))return r;r=r.parent}return null}function cr(e){return Ye(e,t=>t.type===se)}function bt(e){if("children"in e.props&&e.props.innerHTML)throw new E({message:"Cannot use both children and innerHTML on an element",vNode:e});for(let t in e.props)if("bind:"+t in e.props)throw new E({message:\`Cannot use both bind:\${t} and \${t} on an element\`,vNode:e})}function Xt(e){return typeof e=="string"||typeof e=="number"}function Yt(e){return typeof e=="function"||typeof e=="object"&&!!e&&"current"in e||w.isSignal(e)}var kn="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz-";function Le(e=10,t=kn){let r="";for(let n=0;n<e;n++)r+=t[Math.random()*t.length|0];return r}var j=Object.freeze(()=>{});function Ve(e){let{id:t,subs:r,fn:n,deps:o=[],onDepChanged:s}=e,i;H.delete(t);let a=!!k.current&&!m();a||(i=new Map,be.stack.push(i));let u=n(...o.map(c=>c.value));if(!a){for(let[p,v]of r)i.has(p)||(v(),r.delete(p));let c=()=>{H.size||queueMicrotask(vt),H.set(t,s)};for(let[p,v]of i){if(r.has(p))continue;let M=v.subscribe(c);r.set(p,M)}be.stack.pop()}return u}var ye=class e extends w{constructor(t,r){if(super(void 0,r),this.$getter=t,this.$unsubs=new Map,this.$isDirty=!0,l){let n=this[L].inject;this[L]={provide:()=>this,inject:o=>{n(o),e.stop(o),this.$isDirty=o.$isDirty},destroy:()=>{}}}w.configure(this,()=>{this.$isDirty&&(l&&this.$isDisposed||e.run(this))})}get value(){return super.value}set value(t){}subscribe(t){return this.$isDirty&&e.run(this),super.subscribe(t)}static dispose(t){e.stop(t),w.dispose(t)}static stop(t){let{$id:r,$unsubs:n}=_(t);H.delete(r),n.forEach(o=>o()),n.clear(),t.$isDirty=!0}static run(t){let r=_(t),{$id:n,$getter:o,$unsubs:s}=r,i=Ve({id:n,subs:s,fn:()=>o(r.$value),onDepChanged:()=>{if(r.$isDirty=!0,l){if(!F?.get(n)?.size)return}else if(!t.$subs.size)return;e.run(r),!Object.is(r.$value,r.$prevValue)&&r.notify()}});r.sneak(i),r.$isDirty=!1}},hr=(e,t)=>new ye(e,t),xt=(e,t)=>d("useComputedSignal",{signal:null},({hook:r,isInit:n,isHMR:o})=>(l&&(r.dev={devtools:{get:()=>({displayName:r.signal.displayName,value:r.signal.peek()})}},o&&(r.cleanup?.(),n=!0)),n&&(r.cleanup=()=>ye.dispose(r.signal),r.signal=hr(e,t)),r.signal));var ve=class e{constructor(t,r){if(this.id=Le(),this.getter=t,this.deps=r,this.unsubs=new Map,this.isRunning=!1,this.cleanup=null,l&&(this[L]={provide:()=>this,inject:n=>{n.isRunning||this.stop()},destroy:()=>{this.stop()}},"window"in globalThis)){let n=window.__kiru.HMRContext.signals;n.isWaitingForNextWatchCall()&&n.pushWatch(this)}this.start()}start(){if(!this.isRunning){if(this.isRunning=!0,l&&"window"in globalThis&&window.__kiru.HMRContext?.isReplacement())return queueMicrotask(()=>{this.isRunning&&e.run(this)});e.run(this)}}stop(){H.delete(this.id),this.unsubs.forEach(t=>t()),this.unsubs.clear(),this.cleanup?.(),this.cleanup=null,this.isRunning=!1}static run(t){let r=_(t),{id:n,getter:o,unsubs:s,deps:i}=r;r.cleanup=Ve({id:n,subs:s,fn:o,deps:i,onDepChanged:()=>{r.cleanup?.(),e.run(r)}})??null}};function wr(e,t){if(typeof e=="function")return new ve(e);let r=e,n=t;return new ve(n,r)}function xe(e,t){if(m())return d("useWatch",{watcher:null},({hook:r,isInit:n,isHMR:o})=>{if(l&&o&&(r.cleanup?.(),n=!0),n){let s=r.watcher=wr(e,t);r.cleanup=()=>s.stop()}return r.watcher})}var _n=0;function br(e,t,r){if(l&&t.__kiruNode)throw new Error("[kiru]: container in use - call unmount on the previous app first.");let n=f(t.nodeName.toLowerCase(),{});l&&(t.__kiruNode=n),n.dom=t,n.flags|=V;let o=_n++,s=r?.name??\`App-\${o}\`,i={id:o,name:s,rootNode:n,render:a,unmount:u};function a(c){n.props.children=c,ht(n)}function u(){n.props.children=null,ht(n),l&&(delete t.__kiruNode,delete n.app),window.__kiru.emit("unmount",i)}return l&&(n.app=i),a(e),window.__kiru.emit("mount",i),l&&queueMicrotask(()=>{window.dispatchEvent(new Event("kiru:ready"))}),i}function ce(e){return m()?d("useState",{state:void 0,dispatch:j},({hook:t,isInit:r,update:n,isHMR:o})=>{if(l&&(r&&(t.dev={devtools:{get:()=>({value:t.state}),set:({value:s})=>t.state=s},initialArgs:[e]}),o)){let[s]=t.dev.initialArgs;s!==e&&(r=!0,t.dev.initialArgs=[e])}return r&&(t.state=typeof e=="function"?e():e,t.dispatch=s=>{let i=typeof s=="function"?s(t.state):s;Object.is(t.state,i)||(t.state=i,n())}),[t.state,t.dispatch]}):[typeof e=="function"?e():e,j]}function yr(e){let t={[Ct]:!0,Provider:({value:r,children:n})=>{let[o]=ce(()=>new Set);return f(ie,{value:r,ctx:t,dependents:o},typeof n=="function"?n(r):n)},default:()=>e,set displayName(r){this.Provider.displayName=r},get displayName(){return this.Provider.displayName||"Anonymous Context"}};if(l){let r=t;r[L]={inject:n=>{let o=t.Provider;window.__kiru.apps.forEach(s=>{Z(s.rootNode,i=>{i.type===n.Provider&&(i.type=o,i.hmrUpdated=!0,R(i))})})},destroy:()=>{},provide:()=>t}}return t}function ee(e,t){return m()?d("useCallback",{callback:e,deps:t},({hook:r,isHMR:n})=>(l&&(r.dev={devtools:{get:()=>({callback:r.callback,dependencies:r.deps})}},n&&(r.deps=[])),A(t,r.deps)&&(r.deps=t,r.callback=e),r.callback)):e}function N(e,t){if(m())return d("useEffect",{deps:t},({hook:r,isInit:n,isHMR:o,queueEffect:s})=>{l&&(r.dev={devtools:{get:()=>({callback:e,dependencies:r.deps})}},o&&(n=!0)),(n||A(t,r.deps))&&(r.deps=t,$(r),s(()=>{let i=e();typeof i=="function"&&(r.cleanup=i)}))})}function ne(e,t){if(m())return d("useLayoutEffect",{deps:t},({hook:r,isInit:n,isHMR:o,queueEffect:s})=>{l&&(r.dev={devtools:{get:()=>({callback:e,dependencies:r.deps})}},o&&(n=!0)),(n||A(t,r.deps))&&(r.deps=t,$(r),s(()=>{let i=e();typeof i=="function"&&(r.cleanup=i)},{immediate:!0}))})}function Ee(e,t){return m()?d("useMemo",{deps:t,value:void 0},({hook:r,isInit:n,isHMR:o})=>(l&&(r.dev={devtools:{get:()=>({value:r.value,dependencies:r.deps})}},o&&(n=!0)),(n||A(t,r.deps))&&(r.deps=t,r.value=e()),r.value)):e()}function I(e){return m()?d("useRef",{ref:{current:e}},({hook:t,isInit:r,isHMR:n})=>{if(l&&(r&&(t.dev={devtools:{get:()=>({value:t.ref.current}),set:({value:o})=>t.ref.current=o},initialArgs:[t.ref.current]}),n)){let[o]=t.dev.initialArgs;o!==e&&(t.ref={current:e},t.dev.initialArgs=[e])}return t.ref}):{current:e}}var Ka="window"in globalThis?window.__KIRU_LAZY_CACHE??(window.__KIRU_LAZY_CACHE=new Map):new Map;function Er(e){let[t,r]=ce(e.initialState||"exited"),n=I(null);ne(()=>{e.in&&t!=="entered"&&t!=="entering"?(o("entering"),s("entered")):!e.in&&t!=="exited"&&t!=="exiting"&&(o("exiting"),s("exited"))},[e.in,t]),N(()=>()=>xr(n.current),[]);let o=ee(i=>{xr(n.current),r(i),(i==="entered"||i==="exited")&&e.onTransitionEnd&&e.onTransitionEnd(i)},[]),s=ee(i=>{n.current=window.setTimeout(()=>o(i),Tn(i,e.duration))},[e.duration]);return e.element(t)}var vr=150;function Tn(e,t){if(typeof t=="number")return t;switch(e){case"entered":return t?.in??vr;case"exited":return t?.out??vr}}function xr(e){e!=null&&window.clearTimeout(e)}"window"in globalThis;var Sr=()=>f("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},f("path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"}));var $e="kiru.devtools.anchorPosition",kr={x:-16,y:-16};var Et=(e,t,r)=>{if(!t.current)return{...kr};let n=window.innerWidth/e.width,o=window.innerHeight/e.height,s=null,i=null;return e.snapSide==="left"?s=(t.current.offsetWidth-r.width.value)*-1+16:e.snapSide==="right"?s=-16:e.snapSide==="bottom"?i=-16:e.snapSide==="top"&&(i=(window.innerHeight-r.height.value)*-1+16),{x:s??e.x*n,y:i??e.y*o}},_r=e=>{if(e==null)return null;let t=null,r=e?.__kiruNode?.parent;for(;r;){if(typeof r.type=="function"&&!mr(r)){t=r;break}r=r.parent}return t},Cr=(e,t)=>{let r=[],n=[t.__kiruNode];for(;n.length;){let s=n.pop();if(s===e)break;s?.dom&&r.push(s),s?.parent&&n.push(s.parent)}if(r.length===0)return;let o=r[r.length-1].dom;return o instanceof Element?o:void 0};var Ar={arrayChunkSize:10,objectKeysChunkSize:100};function Mr(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;let r=new Set([...Object.keys(e),...Object.keys(t)]);for(let n in r)if(typeof t[n]!=typeof e[n]||typeof e[n]=="object"&&!Mr(e[n],t[n]))return!1;return!0}var Rn={...Ar},Tr=localStorage.getItem("kiru.devtools.userSettings");if(Tr)try{let e=JSON.parse(Tr);Mr(Ar,e)&&(Rn=e)}catch(e){console.error("kiru.devtools.userSettings error",e)}var Pu=yr({userSettings:null,saveUserSettings:()=>{}});var Nu=Object.freeze(()=>{});var Ln="kiru-devtools";"window"in globalThis&&(window.__devtoolsSelection??(window.__devtoolsSelection=null));var St=class extends BroadcastChannel{send(t){super.postMessage(t)}removeEventListener(t){return super.removeEventListener("message",t)}addEventListener(t){return super.addEventListener("message",t)}},O=new St(Ln);var lc=Symbol.for("devtools.hookGroup");var D=(e,t,r={})=>{N(()=>{let n=window,o=r?.ref?.();return o?n=o:r.ref&&console.warn("useEventListener ref failed, using window"),n.addEventListener(e,t,r),()=>{n.removeEventListener(e,t,r)}},[t])};var He=()=>{let e=y({x:0,y:0}),t=y({x:0,y:0}),r=y({x:0,y:0});return D("mousemove",n=>{e.value={x:n.x,y:n.y},t.value={x:n.movementX,y:n.movementY},r.value={x:n.clientX,y:n.clientY}}),{mouse:e,delta:t,client:r}};var Fe="window"in globalThis&&"ResizeObserver"in globalThis.window,Rr=(e,t,r=void 0)=>m()?Fe?d("useResizeObserver",{resizeObserver:null,deps:[e.current]},({isInit:n,hook:o,queueEffect:s})=>(n&&(o.resizeObserver=new ResizeObserver(t),o.cleanup=()=>{o.resizeObserver?.disconnect?.(),o.resizeObserver=null}),s(()=>{A([e.current],o.deps)&&(o.deps=[e.current],o.resizeObserver?.disconnect?.(),e.current&&o.resizeObserver?.observe(e.current,r))}),{isSupported:Fe,start:()=>{o.resizeObserver==null&&(o.resizeObserver=new ResizeObserver(t),e.current&&o.resizeObserver.observe(e.current,r),o.cleanup=()=>{o.resizeObserver?.disconnect?.(),o.resizeObserver=null})},stop:()=>{$(o)}})):{isSupported:Fe,start:()=>{},stop:()=>{}}:{isSupported:Fe,start:()=>{},stop:()=>{}};var Ne="window"in globalThis&&"MutationObserver"in globalThis.window,Or=(e,t,r=void 0)=>m()?Ne?d("useMutationObserver",{mutationObserver:null,deps:[e.current]},({isInit:n,hook:o,queueEffect:s})=>(n?(s(()=>{o.deps=[e.current],o.mutationObserver=new MutationObserver(t),e.current&&o.mutationObserver.observe(e.current,r)}),o.cleanup=()=>{o.mutationObserver?.disconnect?.(),o.mutationObserver=null}):A([e.current],o.deps)&&(o.deps=[e.current],o.mutationObserver?.disconnect?.(),e.current&&o.mutationObserver?.observe(e.current,r)),{isSupported:Ne,start:()=>{o.mutationObserver==null&&(o.mutationObserver=new MutationObserver(t),e.current&&o.mutationObserver.observe(e.current,r),o.cleanup=()=>{o.mutationObserver?.disconnect?.(),o.mutationObserver=null})},stop:()=>{$(o)}})):{isSupported:Ne,start:()=>{},stop:()=>{}}:{isSupported:Ne,start:()=>{},stop:()=>{}};var Ie=(e,t={windowScroll:!0,windowResize:!0})=>{let r=t?.windowScroll??!0,n=t?.windowResize??!0,o=t.immediate??!0,s=y(0),i=y(0),a=y(0),u=y(0),c=y(0),p=y(0),v=y(0),M=y(0),h=()=>{let x=e.current;if(!x){s.value=0,i.value=0,a.value=0,u.value=0,c.value=0,p.value=0,v.value=0,M.value=0;return}let b=x.getBoundingClientRect();s.value=b.width,i.value=b.height,a.value=b.top,u.value=b.right,c.value=b.bottom,p.value=b.left,v.value=b.x,M.value=b.y};return Rr(e,h),Or(e,h,{attributeFilter:["style","class"]}),D("scroll",()=>{r&&h()},{capture:!0,passive:!0}),D("resize",()=>{n&&h()},{passive:!0}),ne(()=>{o&&h()},[]),{width:s,height:i,top:a,right:u,bottom:c,left:p,x:v,y:M,update:h}};var Pr=(e,t)=>{if(!m())return{isActive:t?.immediate??!1,start:()=>null,stop:()=>null};let r=t?.fpsLimit?1e3/t.fpsLimit:null;return d("useRafFn",()=>({callback:e,refId:null,previousFrameTimestamp:0,isActive:t?.immediate??!1,rafLoop:()=>{}}),({isInit:n,hook:o,update:s})=>(o.callback=e,n&&(o.rafLoop=i=>{if(o.isActive===!1)return;o.previousFrameTimestamp||(o.previousFrameTimestamp=i);let a=i-o.previousFrameTimestamp;if(r&&a<r){o.refId=window.requestAnimationFrame(o.rafLoop);return}o.previousFrameTimestamp=i,o.callback({delta:a,timestamp:i}),o.refId=window.requestAnimationFrame(o.rafLoop)}),n&&t?.immediate&&(o.isActive=!0,o.refId=window.requestAnimationFrame(o.rafLoop),o.cleanup=()=>{o.refId!=null&&window.cancelAnimationFrame(o.refId),o.isActive=!1},s()),{isActive:o.isActive,start:()=>{o.isActive!==!0&&(o.isActive=!0,o.refId=window.requestAnimationFrame(o.rafLoop),o.cleanup=()=>{o.refId!=null&&window.cancelAnimationFrame(o.refId),o.isActive=!1},s())},stop:()=>{$(o),s()}}))};var Dr=e=>{let{x:t,y:r,multiple:n,immediate:o=!0}=e,s=y(null),a=Pr(()=>{s.value=n?document.elementsFromPoint(t,r)??[]:document.elementFromPoint(t,r)??null},{immediate:o});return{element:s,...a}};var Lr=()=>{let{mouse:e}=He(),t=y(null),r=I(null),n=I(null),o=Ie(r),s=y({x:-16,y:-16}),i=y({x:-16,y:-16}),a=y({width:window.innerWidth,height:window.innerHeight}),u=y("bottom"),c=I(null);ne(()=>{let h=localStorage.getItem($e);if(h==null)return;let x=JSON.parse(h);a.value.width=window.innerWidth,a.value.height=window.innerHeight,u.value=x.snapSide,i.value=Et(x,n,o)},[Math.round(o.width.value),Math.round(o.height.value)]);let p=xt(()=>{let{x:h,y:x}=e.value;if(t.value===null)return null;let{x:b,y:C}=t.value;return{x:h-b,y:x-C}});D("dragstart",h=>{h.preventDefault(),t.value={x:h.x,y:h.y},s.value=i.value},{ref:()=>r.current}),D("mouseup",()=>{c.current&&(clearTimeout(c.current),c.current=null),t.peek()&&(t.value=null,localStorage.setItem($e,JSON.stringify({...i.value,...a.value,snapSide:u.value})))});let v=ee(()=>{if(n.current==null)return;let h=n.current.offsetWidth;if(u.value==="right"){let x=Math.min(-16,i.value.y);i.value={x:-16,y:Math.max(x,(window.innerHeight-o.height.value)*-1+16)}}else if(u.value==="left"){let x=Math.min(0,i.value.y);i.value={x:(h-o.width.value)*-1+16,y:Math.max(x,(window.innerHeight-o.height.value)*-1+16)}}else if(u.value==="top"){let x=Math.min(-16,i.value.x);i.value={x:Math.max(x,(h-o.width.value)*-1+16),y:(window.innerHeight-o.height.value)*-1+16};return}else{let x=Math.min(-16,i.value.x);i.value={x:Math.max(x,(h-o.width.value)*-1+16),y:-16}}},[]);xe([p,e],(h,x)=>{if(h===null||!n.current)return;let{x:b,y:C}=x,je=n.current.offsetWidth,Ir=C>=window.innerHeight-100,_t=C<=100;if(!_t&&!Ir){let oe=b>window.innerWidth/2;u.value=oe?"right":"left"}else u.value=_t?"top":"bottom";if(u.value==="right"){let oe=Math.min(-16,s.value.y+h.y);i.value={x:-16,y:Math.max(oe,(window.innerHeight-o.height.value)*-1+16)};return}else if(u.value==="left"){let oe=Math.min(0,s.value.y+h.y);i.value={x:(je-o.width.value)*-1+16,y:Math.max(oe,(window.innerHeight-o.height.value)*-1+16)};return}else if(u.value==="top"){let oe=Math.min(-16,s.value.x+h.x);i.value={x:Math.max(oe,(je-o.width.value)*-1+16),y:(window.innerHeight-o.height.value)*-1+16};return}let zr=Math.min(-16,s.value.x+h.x);i.value={y:-16,x:Math.max(zr,(je-o.width.value)*-1+16)}});let M=ee(()=>{n.current!==null&&(i.value=Et({width:a.value.width,height:a.value.height,x:i.value.x,y:i.value.y,snapSide:u.value},n,o),a.value.width=window.innerWidth,a.value.height=window.innerHeight,localStorage.setItem($e,JSON.stringify({...i.value,...a.value,snapSide:u.value})))},[Math.round(o.width.value),Math.round(o.height.value)]);return D("resize",M),{anchorRef:r,anchorCoords:i,viewPortRef:n,startMouse:t,elementBound:o,snapSide:u,updateAnchorPos:v}};var z=De(!1);"window"in globalThis&&O.addEventListener(e=>{e.data.type==="set-inspect-enabled"&&(z.value=e.data.value)});var q=De(null);var Vr="kiru-devtools-popup-size",ze=()=>{let e=q.value;return ee(()=>new Promise((r,n)=>{if(e)if(e.closed)q.value=null;else return e.focus(),r(e);let o=sessionStorage.getItem(Vr),s=o?JSON.parse(o):{width:Math.floor(Math.min(1920,window.screen.width)/2),height:Math.floor(Math.min(1080,window.screen.height)/2)},i=\`popup,width=\${s.width},height=\${s.height};\`,a=window.open(window.__KIRU_DEVTOOLS_PATHNAME__,"_blank",i);if(!a)return console.error("[kiru]: Unable to open devtools window"),n();let u=c=>{c.data.type==="ready"&&(O.removeEventListener(u),console.debug("[kiru]: devtools window opened"),r(a),q.value=a,a.onbeforeunload=()=>{console.debug("[kiru]: devtools window closed"),q.value=null})};O.addEventListener(u),a.onresize=()=>{sessionStorage.setItem(Vr,JSON.stringify({width:a.innerWidth,height:a.innerHeight}))}}),[e])};var $r=()=>{let e=ze(),{mouse:t}=He(),r=Dr({x:t.value.x,y:t.value.y,immediate:!1}),n=r.element.value,o=z.value?n:null,s=Ee(()=>{if(o&&window.__kiru){let c=window.__kiru.apps.find(p=>p.rootNode==null||o.__kiruNode==null?!1:gr(p.rootNode,o.__kiruNode));return c?.rootNode==null?null:c}return null},[o]),i=Ee(()=>o?_r(o):null,[o]),a=I(null),u=Ie(a);return N(()=>z.subscribe(p=>{r[p?"start":"stop"]()}),[]),N(()=>{i&&o?a.current=Cr(i,o)??null:a.current=null},[i,o]),D("click",c=>{if(z.value===!0&&i&&s){c.preventDefault();let p=v=>{v.__devtoolsSelection={node:i,app:s},O.send({type:"select-node"}),O.send({type:"set-inspect-enabled",value:!1}),z.value=!1,a.current=null,v.focus()};q.value?p(q.value):e().then(v=>p(v))}}),i&&f("div",{className:"bg-[crimson]/80 fixed grid place-content-center pointer-events-none z-10 top-0 left-0",style:{width:\`\${u?.width}px\`,height:\`\${u?.height}px\`,transform:\`translate(\${u.x}px, \${u.y}px)\`}},f("p",null,i.type.name))};function Hr(e){return f("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 -960 960 960",fill:"currentColor",...e},f("path",{d:"M710-150q-63 0-106.5-43.5T560-300q0-63 43.5-106.5T710-450q63 0 106.5 43.5T860-300q0 63-43.5 106.5T710-150Zm0-80q29 0 49.5-20.5T780-300q0-29-20.5-49.5T710-370q-29 0-49.5 20.5T640-300q0 29 20.5 49.5T710-230Zm-270-30H200q-17 0-28.5-11.5T160-300q0-17 11.5-28.5T200-340h240q17 0 28.5 11.5T480-300q0 17-11.5 28.5T440-260ZM250-510q-63 0-106.5-43.5T100-660q0-63 43.5-106.5T250-810q63 0 106.5 43.5T400-660q0 63-43.5 106.5T250-510Zm0-80q29 0 49.5-20.5T320-660q0-29-20.5-49.5T250-730q-29 0-49.5 20.5T180-660q0 29 20.5 49.5T250-590Zm510-30H520q-17 0-28.5-11.5T480-660q0-17 11.5-28.5T520-700h240q17 0 28.5 11.5T800-660q0 17-11.5 28.5T760-620Zm-50 320ZM250-660Z"}))}function Fr(e){return f("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-square-mouse-pointer",...e},f("path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z"}),f("path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"}))}var Vn=()=>{z.value=!z.value,O.send({type:"set-inspect-enabled",value:z.value})};function $n(e,t){let{damping:r}=t,n=y(e),o=I(e);return N(()=>{let s=null,i=()=>{if(Math.sqrt(Math.pow(o.current.x-n.value.x,2)+Math.pow(o.current.y-n.value.y,2))<5)return;let u=n.value.x+(o.current.x-n.value.x)*r,c=n.value.y+(o.current.y-n.value.y)*r;n.value={x:u,y:c},s=window.requestAnimationFrame(i)};return s=window.requestAnimationFrame(i),()=>{s!=null&&window.cancelAnimationFrame(s)}},[e.x,e.y]),Object.assign(n,{set:(s,i)=>{o.current=s,i?.hard&&(n.value=s)}})}function kt(){let e=y(!1),t=ze(),{anchorCoords:r,anchorRef:n,viewPortRef:o,startMouse:s,snapSide:i}=Lr(),a=i.value==="left"||i.value==="right",u=I(!1),c=$n(r.value,{damping:.4});return xe([r],c.set),ne(()=>{u.current===!1&&c.set(r.value,{hard:!0}),u.current=!0},[]),f(Q,null,f("div",{ref:o,className:"w-full h-0 fixed top-0 left-0 z-[-9999] overflow-scroll pointer-events-none"}),f("div",{ref:n,draggable:!0,className:\`flex \${a?"flex-col":""} \${e.value?"rounded-3xl":"rounded-full"} p-1 gap-1 items-center will-change-transform bg-crimson\`,style:{transform:\`translate3d(\${Math.round(c.value.x)}px, \${Math.round(c.value.y)}px, 0)\`}},f(Er,{in:e.value,duration:{in:40,out:150},element:p=>{if(p==="exited")return null;let v=p==="entered"?"1":"0.5",M=p==="entered"?"1":"0";return f(Q,null,f("button",{title:"Open Devtools",onclick:t,style:{transform:\`scale(\${v})\`,opacity:M},className:"transition text-white rounded-full p-1 hover:bg-[#0003]"},f(Hr,{width:16,height:16})),f("button",{title:"Toggle Component Inspection",onclick:Vn,style:{transform:\`scale(\${v})\`,opacity:M},className:\`transition text-white rounded-full p-1 hover:bg-[#0003] \${z.value?"bg-[#0003]":""}\`},f(Fr,{width:16,height:16})))}}),f("button",{className:"bg-crimson rounded-full p-1"+(s.value?" pointer-events-none":""),onclick:()=>e.value=!e.value,tabIndex:-1},f(Sr,null))),f($r,null))}var Nr=\`*, ::before, ::after {
|
|
2453
|
+
\`}function Kr(e){let t=Ot(e);if(l){let r=Ur(e);r&&(t=\`\${t} (\${r})\`)}return t}function Ot(e){return e.displayName??(e.name||"Anonymous Function")}function Ur(e){return e.toString().match(/\\/\\/ \\[kiru_devtools\\]:(.*)/)?.[1]??null}var te={parentStack:[],childIdxStack:[],eventDeferrals:new Map,parent:function(){return this.parentStack[this.parentStack.length-1]},clear:function(){this.parentStack.length=0,this.childIdxStack.length=0},pop:function(){this.parentStack.pop(),this.childIdxStack.pop()},push:function(e){this.parentStack.push(e),this.childIdxStack.push(0)},currentChild:function(){return this.parentStack[this.parentStack.length-1].childNodes[this.childIdxStack[this.childIdxStack.length-1]]},nextChild:function(){return this.parentStack[this.parentStack.length-1].childNodes[this.childIdxStack[this.childIdxStack.length-1]++]},bumpChildIndex:function(){this.childIdxStack[this.childIdxStack.length-1]++},captureEvents:function(e){Pt(e,!0),this.eventDeferrals.set(e,[])},resetEvents:function(e){this.eventDeferrals.delete(e)},releaseEvents:function(e){Pt(e,!1);let t=this.eventDeferrals.get(e);for(;t?.length;)t.shift()()}},Wr=e=>{let t=e.target;!e.isTrusted||!t||te.eventDeferrals.get(t)?.push(()=>t.dispatchEvent(e))},Pt=(e,t)=>{for(let r in e)if(r.startsWith("on")){let n=r.substring(2);e[t?"addEventListener":"removeEventListener"](n,Wr,{passive:!0})}};var rt=!1,Je=!1,Dt=e=>{e.preventDefault(),e.stopPropagation(),Je=!0},le=null;function Lt(){rt=!0,le=document.activeElement,le&&le!==document.body&&le.addEventListener("blur",Dt)}function Vt(){Je&&(le.removeEventListener("blur",Dt),le.isConnected&&le.focus(),Je=!1),rt=!1}function Ze(e,t){if(typeof e=="function"){e(t);return}if(w.isSignal(e)){e.sneak(t),e.notify({filter:r=>typeof r=="function"});return}e.current=t}function $t(e){let t=e.type;return t=="#text"?Ht(e):qe.has(t)?document.createElementNS("http://www.w3.org/2000/svg",t):document.createElement(t)}function Ht(e){let{nodeValue:t}=e.props;if(!w.isSignal(t))return document.createTextNode(t);let r=t.peek()??"",n=document.createTextNode(r);return et(e,n,t),n}function Br(e,t,r){let n=Qe.get(e)??{},o=n[t]=s=>{if(rt){s.preventDefault(),s.stopPropagation();return}r(s)};return Qe.set(e,n),o}var Qe=new WeakMap;function Ft(e){let t=e.dom,r=e.prev?.props??{},n=e.props??{},o=new Set([...Object.keys(r),...Object.keys(n)]),s=k.current==="hydrate";o.forEach(i=>{let a=r[i],u=n[i];if(ge.internalProps.includes(i)&&i!=="innerHTML"){i==="ref"&&a!==u&&(a&&Ze(a,null),u&&Ze(u,t));return}if(ge.isEvent(i)){if(a!==u||k.current==="hydrate"){let c=i.replace(At,""),p=c==="focus"||c==="blur";i in r&&t.removeEventListener(c,p?Qe.get(e)?.[c]:a),i in n&&t.addEventListener(c,p?Br(e,c,u):u)}return}if(!(t instanceof Text)){if(a===u||s&&t.getAttribute(i)===u)return;if(w.isSignal(a)&&e.cleanups){let c=e.cleanups[i];c&&(c(),delete e.cleanups[i])}if(w.isSignal(u))return Yr(e,t,i,u,a);Ce(t,i,u,a);return}w.isSignal(u)||t.nodeValue!==u&&(t.nodeValue=u)})}function qr(e){return e.multiple?Array.from(e.selectedOptions).map(t=>t.value):e.value}function Nt(e,t){if(!e.multiple||t===void 0||t===null||t===""){e.value=t;return}Array.from(e.options).forEach(r=>{r.selected=t.indexOf(r.value)>-1})}var Gr={value:"input",checked:"change",open:"toggle",volume:"volumechange",playbackRate:"ratechange",currentTime:"timeupdate"},Xr=["progress","meter","number","range"];function Yr(e,t,r,n,o){let s=e.cleanups??(e.cleanups={}),[i,a]=r.split(":");if(i!=="bind")return s[r]=n.subscribe((b,C)=>{Ce(t,r,b,C),l&&window.__kiru.profilingContext?.emit("signalAttrUpdate",J(e))}),Ce(t,r,n.peek(),Y(o));let u=Gr[a];if(!u){l&&console.error(\`[kiru]: \${a} is not a valid element binding attribute.\`);return}let c=t instanceof HTMLSelectElement,p=c?b=>Nt(t,b):b=>t[a]=b,v=b=>{p(b),l&&window.__kiru.profilingContext?.emit("signalAttrUpdate",J(e))},M=b=>{n.sneak(b),n.notify({filter:C=>C!==v})},h;if(a==="value"){let b=Xr.indexOf(t.type)!==-1;h=()=>{let C=t.value;c?C=qr(t):typeof n.peek()=="number"&&b&&(C=t.valueAsNumber),M(C)}}else h=b=>{let C=b.target[a];a==="currentTime"&&n.peek()===C||M(C)};t.addEventListener(u,h);let x=n.subscribe(v);return s[r]=()=>{t.removeEventListener(u,h),x()},Ce(t,a,n.peek(),Y(o))}function et(e,t,r){(e.cleanups??(e.cleanups={})).nodeValue=r.subscribe((n,o)=>{n!==o&&(t.nodeValue=n,l&&window.__kiru.profilingContext?.emit("signalTextUpdate",J(e)))})}function Jr(e){if(e.type!=="#text"||!w.isSignal(e.props.nodeValue))return;let t=Y(e.props.nodeValue);if(!Xe(t)){l&&console.error(\`[kiru]: Hydration mismatch - expected primitive child but received \${t}\`);return}let r=Ht(e),n=te.parent();return n&&n.appendChild(r),r}function It(e){let t=te.nextChild()??Jr(e);if(!t)throw new E({message:"Hydration mismatch - no node found",vNode:e});let r=t.nodeName;if(qe.has(r)||(r=r.toLowerCase()),e.type!==r)throw new E({message:\`Hydration mismatch - expected node of type \${e.type.toString()} but received \${r}\`,vNode:e});if(e.dom=t,e.type!=="#text"&&!(e.flags&V)){Ft(e);return}w.isSignal(e.props.nodeValue)&&et(e,t,e.props.nodeValue);let n=e,o=e.sibling;for(;o&&o.type==="#text";){let s=o;te.bumpChildIndex();let i=String(Y(n.props.nodeValue)??""),a=n.dom.splitText(i.length);s.dom=a,w.isSignal(s.props.nodeValue)&&et(s,a,s.props.nodeValue),n=o,o=o.sibling}}function zt(e,t,r,n=!1){if(r===null)return e.removeAttribute(t),!0;switch(typeof r){case"undefined":case"function":case"symbol":return e.removeAttribute(t),!0;case"boolean":if(n&&!r)return e.removeAttribute(t),!0}return!1}function Zr(e,t,r){let n=Ge.has(t);zt(e,t,r,n)||e.setAttribute(t,n&&typeof r=="boolean"?"":String(r))}var Qr=["INPUT","TEXTAREA"],en=e=>Qr.indexOf(e.nodeName)>-1;function Ce(e,t,r,n){if(r!==n)switch(t){case"style":return nn(e,r,n);case"className":return rn(e,r);case"innerHTML":return tn(e,r);case"muted":e.muted=!!r;return;case"value":if(e.nodeName==="SELECT")return Nt(e,r);let o=r==null?"":String(r);if(en(e)){e.value=o;return}e.setAttribute("value",o);return;case"checked":if(e.nodeName==="INPUT"){e.checked=!!r;return}e.setAttribute("checked",String(r));return;default:return Zr(e,qt(t),r)}}function tn(e,t){if(t==null||typeof t=="boolean"){e.innerHTML="";return}e.innerHTML=String(t)}function rn(e,t){let r=Y(t);if(!r)return e.removeAttribute("class");e.setAttribute("class",r)}function nn(e,t,r){if(zt(e,"style",t))return;if(typeof t=="string"){e.setAttribute("style",t);return}let n={};typeof r=="string"?e.setAttribute("style",""):typeof r=="object"&&r&&(n=r);let o=t;new Set([...Object.keys(n),...Object.keys(o)]).forEach(i=>{let a=n[i],u=o[i];if(a!==u){if(u===void 0){e.style[i]="";return}e.style[i]=u}})}function on(e){let t=e.parent,r=t?.dom;for(;t&&!r;)t=t.parent,r=t?.dom;if(!r||!t){if(!e.parent&&e.dom)return e;throw new E({message:"No DOM parent found while attempting to place node.",vNode:e})}return t}function sn(e,t){let{node:r,lastChild:n}=t,o=e.dom;if(n){n.after(o);return}let s=jt(e,r);if(s){r.dom.insertBefore(o,s);return}r.dom.appendChild(o)}function jt(e,t){let r=e;for(;r;){let n=r.sibling;for(;n;){if(!(n.flags&(T|V))){let o=an(n);if(o?.isConnected)return o}n=n.sibling}if(r=r.parent,!r||r.flags&V||r===t)return}}function an(e){let t=e;for(;t;){if(t.dom)return t.dom;if(t.flags&V)return;t=t.child}}function Kt(e){if(k.current==="hydrate")return Z(e,he);let t={node:e.dom?e:on(e)};tt(e,t,(e.flags&T)>0),e.dom&&!(e.flags&V)&&Ut(e,t,!1),he(e)}function tt(e,t,r){let n=e.child;for(;n;){if(n.flags&me){n.flags&T&&ln(n,t),he(n),n=n.sibling;continue}n.dom?(tt(n,{node:n},!1),n.flags&V||Ut(n,t,r)):tt(n,t,(n.flags&T)>0||r),he(n),n=n.sibling}}function Ut(e,t,r){(r||!e.dom.isConnected||e.flags&T)&&sn(e,t),(!e.prev||e.flags&P)&&Ft(e),t.lastChild=e.dom}function Wt(e){e===e.parent?.child&&(e.parent.child=e.sibling);let t;l&&(t=J(e)),Z(e,r=>{let{hooks:n,subs:o,cleanups:s,dom:i,props:{ref:a}}=r;for(o?.forEach(u=>u()),s&&Object.values(s).forEach(u=>u());n?.length;)n.pop().cleanup?.();l&&(window.__kiru.profilingContext?.emit("removeNode",t),i instanceof Element&&delete i.__kiruNode),i&&(a&&Ze(a,null),i.isConnected&&!(r.flags&V)&&i.remove(),delete r.dom)}),e.parent=null}function ln(e,t){if(!e.child)return;let r=[];if(Bt(e.child,r),r.length===0)return;let{node:n,lastChild:o}=t;if(o)o.after(...r);else{let s=jt(e,n),i=n.dom;s?s.before(...r):i.append(...r)}t.lastChild=r[r.length-1]}function Bt(e,t){let r=e;for(;r;)r.dom?t.push(r.dom):r.child&&Bt(r.child,t),r=r.sibling}function Gt(e){return typeof e=="function"&&typeof e[ke]?.arePropsEqual=="function"}function f(e,t=null,...r){if(e===Q)return Q({children:r,...t});let n={type:e,flags:0,index:0,depth:0,props:{},parent:null,sibling:null,child:null,prev:null,deletions:null};if(Gt(e)&&(n.flags|=_e,n.arePropsEqual=e[ke].arePropsEqual),t!==null){let{key:s,ref:i,...a}=t;Xt(s)&&(n.props.key=s.toString()),Yt(i)&&(n.props.ref=i),Object.assign(n.props,a)}let o=r.length===1?r[0]:r.length>1?r:null;return o!==null&&(n.props.children=o),n}function Q({children:e,key:t}){return f(G,t?{key:t}:null,e)}var it;function Me(e,t){return l&&(it=J(e)),Array.isArray(t)?(l&&(nr in t&&dn(e,t),pn(e,t)),cn(e,t)):un(e,t)}function un(e,t){let r=e.child;if(r===null)return er(e,t);let n=r.sibling,o=Zt(e,r,t);if(o!==null)return r&&r!==o&&!o.prev?ot(e,r):n&&ot(e,n),o;{let s=or(r),i=tr(s,e,0,t);if(i!==null){let a=i.prev;if(a!==null){let u=a.props.key;s.delete(u===void 0?a.index:u)}Te(i,0,0)}return s.forEach(a=>Ae(e,a)),i}}function cn(e,t){let r=null,n=null,o=e.child,s=null,i=0,a=0;for(;o!==null&&a<t.length;a++){o.index>a?(s=o,o=null):s=o.sibling;let c=Zt(e,o,t[a]);if(c===null){o===null&&(o=s);break}o&&!c.prev&&Ae(e,o),i=Te(c,i,a),n===null?r=c:n.sibling=c,n=c,o=s}if(a===t.length)return ot(e,o),r;if(o===null){for(;a<t.length;a++){let c=er(e,t[a]);c!==null&&(i=Te(c,i,a),n===null?r=c:n.sibling=c,n=c)}return r}let u=or(o);for(;a<t.length;a++){let c=tr(u,e,a,t[a]);if(c!==null){let p=c.prev;if(p!==null){let v=p.props.key;u.delete(v===void 0?p.index:v)}i=Te(c,i,a),n===null?r=c:n.sibling=c,n=c}}return u.forEach(c=>Ae(e,c)),r}function Zt(e,t,r){let n=t?.props.key;return Re(r)?n!==void 0||t?.type==="#text"&&w.isSignal(t.props.nodeValue)?null:Jt(e,t,""+r):w.isSignal(r)?t&&t.props.nodeValue!==r?null:Jt(e,t,r):ue(r)?r.props.key!==n?null:fn(e,t,r):Array.isArray(r)?n!==void 0?null:(l&&st(r),Qt(e,t,r)):null}function Jt(e,t,r){if(t===null||t.type!=="#text"){l&&U();let o=f("#text",{nodeValue:r});return K(o,e),o}return l&&we(),t.props.nodeValue!==r&&(t.props.nodeValue=r,t.flags|=P),t.sibling=null,t}function fn(e,t,r){let{type:n,props:o}=r;if(l&&typeof n=="function"&&(n=_(n)),n===G)return Qt(e,t,o.children||[],o);if(t?.type===n)return l&&we(),t.index=0,t.sibling=null,typeof n=="string"?rr(t.props,o)&&(t.flags|=P):t.flags|=P,t.props=o,t.memoizedProps=r.memoizedProps,t;l&&U();let s=f(n,o);return K(s,e),s}function Qt(e,t,r,n={}){if(t===null||t.type!==G){l&&U();let o=f(G,{children:r,...n});return K(o,e),o}return l&&we(),t.props={...t.props,...n,children:r},t.flags|=P,t.sibling=null,t}function er(e,t){if(Re(t)){l&&U();let r=f("#text",{nodeValue:""+t});return K(r,e),r}if(w.isSignal(t)){l&&U();let r=f("#text",{nodeValue:t});return K(r,e),r}if(ue(t)){l&&U();let r=f(t.type,t.props);return K(r,e),r.flags|=T,r}if(Array.isArray(t)){l&&(U(),st(t));let r=Q({children:t});return K(r,e),r}return null}function Te(e,t,r){e.index=r;let n=e.prev;if(n!==null){let o=n.index;return o<t?(e.flags|=T,t):o}else return e.flags|=T,t}function tr(e,t,r,n){if(w.isSignal(n)||Re(n)){let s=e.get(r);if(s){if(s.props.nodeValue===n)return s;s.type==="#text"&&w.isSignal(s.props.nodeValue)&&s.cleanups?.nodeValue?.()}l&&U();let i=f("#text",{nodeValue:n});return K(i,t),i.flags|=T,i.index=r,i}if(ue(n)){let{type:s,props:i}=n,a=i.key,u=e.get(a===void 0?r:a);if(u?.type===s)return l&&we(),typeof s=="string"?rr(u.props,i)&&(u.flags|=P):u.flags|=P,u.props=i,u.sibling=null,u.index=r,u;l&&U();let c=f(n.type,n.props);return K(c,t),c.flags|=T,c.index=r,c}if(Array.isArray(n)){let s=e.get(r);if(l&&st(n),s)return l&&we(),s.flags|=P,s.props.children=n,s;l&&U();let i=Q({children:n});return K(i,t),i.flags|=T,i.index=r,i}return null}function rr(e,t){let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!0;for(let o of r)if(!(o==="children"||o==="key")&&e[o]!==t[o])return!0;return!1}function K(e,t){e.parent=t,e.depth=t.depth+1}function we(){"window"in globalThis&&window.__kiru.profilingContext?.emit("updateNode",it)}function U(){"window"in globalThis&&window.__kiru.profilingContext?.emit("createNode",it)}var nr=Symbol("kiru:marked-list-child");function st(e){Object.assign(e,{[nr]:!0})}function or(e){let t=new Map;for(;e;){let r=e.props.key;t.set(r===void 0?e.index:r,e),e=e.sibling}return t}function Ae(e,t){e.deletions===null?e.deletions=[t]:e.deletions.push(t)}function ot(e,t){for(;t;)Ae(e,t),t=t.sibling}function pn(e,t){let r=new Set,n=!1;for(let o of t){if(!ue(o))continue;let s=o.props.key;if(typeof s=="string"){if(!n&&r.has(s)){let i=sr(e);ir(\`\${i} component produced a child in a list with a duplicate key prop: "\${s}". Keys should be unique so that components maintain their identity across updates\`),n=!0}r.add(s)}}}function dn(e,t){let r=!1,n=!1;for(let o of t){if(!ue(o))continue;typeof o.props.key=="string"?r=!0:n=!0}if(n&&r){let o=sr(e);ir(\`\${o} component produced a child in a list without a valid key prop\`)}}function ir(e){let t=\`[kiru]: \${e}. See https://kirujs.dev/keys-warning for more information.\`;console.error(t)}var nt=new WeakMap;function sr(e){if(nt.has(e))return nt.get(e);let t=e.parent,r;for(;!r&&t;)typeof t.type=="function"&&(r=t.type),t=t.parent;let n=\`<\${r?.displayName||r?.name||"Anonymous Function"} />\`;return nt.set(e,n),n}var W,B=[],pe=!1,lt=[],Oe=[],ut=!1,ct=!1,ft=!1,pt=0,ar=[],dt=[],lr=-1;function gt(e){if(pe){lt.push(e);return}e()}function Pe(){pe&&(window.cancelAnimationFrame(lr),ur())}function ht(e){e.flags|=ae,B.push(e),pe=!0,Pe()}function R(e){if(k.current==="hydrate")return gt(()=>mt(e));mt(e)}function mn(){pe||(pe=!0,lr=window.requestAnimationFrame(ur))}function gn(){for(pe=!1;lt.length;)lt.shift()()}function mt(e){if(ut&&(ct=!0),S.current===e){l&&window.__kiru.profilingContext?.emit("updateDirtied",W),ft=!0;return}if(!(e.flags&(ae|fe))){if(e.flags|=ae,!B.length)return B.push(e),mn();B.push(e)}}function hn(e){Z(e,t=>t.flags|=fe),Oe.push(e)}var wn=(e,t)=>t.depth-e.depth,re=null;function ur(){if(l){let t=Oe[0]??B[0];t?(W=J(t),window.__kiru.profilingContext?.beginTick(W)):W=null}let e=1;for(Lt();B.length;){B.length>e&&B.sort(wn),re=B.shift(),e=B.length;let t=re.flags;if(!(t&fe)&&t&ae){let r=re;for(;r=bn(r););for(;Oe.length;)Wt(Oe.pop());Kt(re),re.flags&=~ae}}if(Vt(),ut=!0,at(ar),ut=!1,ct)return En(),at(dt),ct=!1,pt++,l&&(window.__kiru.profilingContext?.endTick(W),window.__kiru.profilingContext?.emit("updateDirtied",W)),Pe();pt=0,gn(),at(dt),l&&(window.__kiru.emit("update",W),window.__kiru.profilingContext?.emit("update",W),window.__kiru.profilingContext?.endTick(W))}function bn(e){let t=!0;try{typeof e.type=="string"?xn(e):wt(e.type)?yn(e):t=vn(e)}catch(n){l&&window.__kiru.emit("error",W,n instanceof Error?n:new Error(String(n)));let o=cr(e);if(o){let s=o.error=n instanceof Error?n:new Error(String(n));return o.props.onError?.(s),o.depth<re.depth&&(re=o),o}if(E.isKiruError(n)){if(n.customNodeStack&&setTimeout(()=>{throw new Error(n.customNodeStack)}),n.fatal)throw n;console.error(n);return}setTimeout(()=>{throw n})}if(e.deletions!==null&&(e.deletions.forEach(hn),e.deletions=null),t&&e.child)return e.child;let r=e;for(;r;){if(r.immediateEffects&&(ar.push(...r.immediateEffects),r.immediateEffects=void 0),r.effects&&(dt.push(...r.effects),r.effects=void 0),r===re)return;if(r.sibling)return r.sibling;r=r.parent,k.current==="hydrate"&&r?.dom&&te.pop()}}function yn(e){let{props:t,type:r}=e,n=t.children;if(r===ie){let{props:{dependents:o,value:s},prev:i}=e;o.size&&i&&i.props.value!==s&&o.forEach(mt)}else if(r===se){let o=e,{error:s}=o;s&&(n=typeof t.fallback=="function"?t.fallback(s):t.fallback,delete o.error)}e.child=Me(e,n)}function vn(e){let{type:t,props:r,subs:n,prev:o,flags:s}=e;if(s&_e){if(e.memoizedProps=r,o?.memoizedProps&&e.arePropsEqual(o.memoizedProps,r)&&!e.hmrUpdated)return e.flags|=me,!1;e.flags&=~me}try{S.current=e;let i,a=0;do{if(e.flags&=~ae,ft=!1,X.current=0,n&&(n.forEach(u=>u()),n.clear()),l){if(i=_(t)(r),e.hmrUpdated&&e.hooks&&e.hookSig){let u=e.hooks.length;if(X.current<u){for(let c=X.current;c<u;c++)e.hooks[c].cleanup?.();e.hooks.length=X.current,e.hookSig.length=X.current}}if(delete e.hmrUpdated,++a>Be)throw new E({message:"Too many re-renders. Kiru limits the number of renders to prevent an infinite loop.",fatal:!0,vNode:e});continue}i=t(r)}while(ft);return e.child=Me(e,i),!0}finally{S.current=null}}function xn(e){let{props:t,type:r}=e;l&&bt(e),e.dom||(k.current==="hydrate"?It(e):e.dom=$t(e),l&&e.dom instanceof Element&&(e.dom.__kiruNode=e)),r!=="#text"&&(e.child=Me(e,t.children),e.child&&k.current==="hydrate"&&te.push(e.dom))}function En(){if(pt>Be)throw new E("Maximum update depth exceeded. This can happen when a component repeatedly calls setState during render or in useLayoutEffect. Kiru limits the number of nested updates to prevent infinite loops.")}function at(e){for(let t=0;t<e.length;t++)e[t]();e.length=0}var fr;(function(e){e.Start="start",e.End="end"})(fr||(fr={}));var de=null,pr=new Set;function d(e,t,r){let n=Sn(e);if(l&&de!==null&&!pr.has(e+de))throw pr.add(e+de),new E({message:\`Nested primitive "useHook" calls are not supported. "\${e}" was called inside "\${de}". Strange will most certainly happen.\`,vNode:n});let o=(a,u)=>{if(u?.immediate){(n.immediateEffects??(n.immediateEffects=[])).push(a);return}(n.effects??(n.effects=[])).push(a)},s=X.current++,i=n.hooks?.at(s);if(l){de=e,n.hooks??(n.hooks=[]),n.hookSig??(n.hookSig=[]),n.hookSig[s]?n.hookSig[s]!==e&&(console.warn(\`[kiru]: hooks must be called in the same order. Hook "\${e}" was called in place of "\${n.hookSig[s]}". Strange things may happen.\`),i?.cleanup?.(),n.hooks.length=s,n.hookSig.length=s,i=void 0):n.hookSig[s]=e;let a;i?a=i:(a=typeof t=="function"?t():{...t},a.name=e),n.hooks[s]=a;try{return r({hook:a,isInit:!i,isHMR:n.hmrUpdated,update:()=>R(n),queueEffect:o,vNode:n,index:s})}catch(u){throw u}finally{de=null}}try{let a=i??(typeof t=="function"?t():{...t});return n.hooks??(n.hooks=[]),n.hooks[s]=a,r({hook:a,isInit:!i,update:()=>R(n),queueEffect:o,vNode:n,index:s})}catch(a){throw a}}function Sn(e){let t=S.current;if(!t)throw new E(\`Hook "\${e}" must be used at the top level of a component or inside another composite hook.\`);return t}function $(e){e.cleanup&&(e.cleanup(),e.cleanup=void 0)}function A(e,t){return e===void 0||t===void 0||e.length!==t.length||e.length>0&&t.some((r,n)=>!Object.is(r,e[n]))}var be={stack:new Array,current:function(){return this.stack[this.stack.length-1]}},H=new Map,F=new Map;var dr,w=class e{constructor(t,r){this[dr]=!0,this.$id=Le(),this.$value=t,r&&(this.displayName=r),l?(F.set(this.$id,new Set),this.$initialValue=yt(t),this[L]={provide:()=>this,inject:n=>{F.get(this.$id)?.clear?.(),F.delete(this.$id),this.$id=n.$id,n.__next=this,this.$initialValue===n.$initialValue?this.$value=n.$value:this.notify()},destroy:()=>{}}):this.$subs=new Set}get value(){if(this.onBeforeRead?.(),l){let t=_(this);return e.entangle(t),t.$value}return e.entangle(this),this.$value}set value(t){if(l){let r=_(this);if(Object.is(r.$value,t))return;r.$prevValue=r.$value,r.$value=t,r.notify();return}Object.is(this.$value,t)||(this.$prevValue=this.$value,this.$value=t,this.notify())}peek(){return this.onBeforeRead?.(),l?_(this).$value:this.$value}sneak(t){if(l){let r=_(this);r.$prevValue=r.$value,r.$value=t;return}this.$prevValue=this.$value,this.$value=t}toString(){if(this.onBeforeRead?.(),l){let t=_(this);return e.entangle(t),\`\${t.$value}\`}return e.entangle(this),\`\${this.$value}\`}subscribe(t){return l?(F.get(this.$id).add(t),()=>F.get(this.$id)?.delete(t)):(this.$subs.add(t),()=>this.$subs.delete(t))}notify(t){if(l)return F.get(this.$id)?.forEach(r=>{if(t?.filter&&!t.filter(r))return;let{$value:n,$prevValue:o}=_(this);return r(n,o)});this.$subs.forEach(r=>{if(!(t?.filter&&!t.filter(r)))return r(this.$value,this.$prevValue)})}static isSignal(t){return typeof t=="object"&&!!t&&Ue in t}static subscribers(t){return l?F.get(t.$id):t.$subs}static makeReadonly(t){let r=Object.getOwnPropertyDescriptor(t,"value");return r&&!r.writable?t:Object.defineProperty(t,"value",{get:function(){return e.entangle(this),this.$value},configurable:!0})}static makeWritable(t){let r=Object.getOwnPropertyDescriptor(t,"value");return r&&r.writable?t:Object.defineProperty(t,"value",{get:function(){return e.entangle(this),this.$value},set:function(n){this.$value=n,this.notify()},configurable:!0})}static entangle(t){let r=S.current,n=be.current();if(n){(!r||r&&m())&&n.set(t.$id,t);return}if(!r||!m())return;let o=t.subscribe(()=>R(r));(r.subs??(r.subs=new Set)).add(o)}static configure(t,r){t.onBeforeRead=r}static dispose(t){if(t.$isDisposed=!0,l){F.delete(t.$id);return}t.$subs.clear()}};dr=Ue;var De=(e,t)=>new w(e,t),y=(e,t)=>d("useSignal",{signal:null},({hook:r,isInit:n,isHMR:o})=>{if(l&&(n&&(r.dev={devtools:{get:()=>({displayName:r.signal.displayName,value:r.signal.peek()}),set:({value:s})=>{r.signal.value=s}},initialArgs:[e,t]}),o)){let[s,i]=r.dev.initialArgs;(s!==e||i!==t)&&(r.cleanup?.(),n=!0,r.dev.initialArgs=[e,t])}return n&&(r.cleanup=()=>w.dispose(r.signal),r.signal=new w(e,t)),r.signal});function Y(e,t=!1){return w.isSignal(e)?t?e.value:e.peek():e}var vt=()=>{H.forEach(e=>e()),H.clear()};var ge={internalProps:["children","ref","key","innerHTML"],isEvent:e=>e.startsWith("on"),isProperty:e=>!ge.internalProps.includes(e)&&!ge.isEvent(e)};function qt(e){switch(e){case"className":return"class";case"htmlFor":return"for";case"tabIndex":case"formAction":case"formMethod":case"formEncType":case"contentEditable":case"spellCheck":case"allowFullScreen":case"autoPlay":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"noModule":case"noValidate":case"popoverTarget":case"popoverTargetAction":case"playsInline":case"readOnly":case"itemscope":case"rowSpan":case"crossOrigin":return e.toLowerCase();default:return e.indexOf("-")>-1?e:e.startsWith("aria")?"aria-"+e.substring(4).toLowerCase():Mt.get(e)||e}}function yt(e,t={functions:!0}){let r=new WeakSet;return JSON.stringify(e,(n,o)=>{if(typeof o=="object"&&o!==null){if(r.has(o))return"[CIRCULAR]";r.add(o)}return typeof o=="function"?t.functions?o.toString():\`[FUNCTION (\${o.name||"anonymous"})]\`:o})}function _(e){let t=e;if(l)for(;"__next"in t;)t=t.__next;return t}function m(){return k.current==="dom"||k.current==="hydrate"}function ue(e){return typeof e=="object"&&e!==null&&"type"in e}function Re(e){return typeof e=="string"&&e!==""||typeof e=="number"||typeof e=="bigint"}function wt(e){return e===G||e===ie||e===se}function mr(e){return e.type===G}function J(e){let t=e;for(;t;){if(t.app)return e.app=t.app;t=t.parent}return null}function he(e){let{props:{children:t,...r},memoizedProps:n,index:o}=e;e.prev={props:r,memoizedProps:n,index:o},e.flags&=~(P|T|fe)}function gr(e,t){if(t.depth<e.depth)return!1;if(e===t)return!0;let r=!1,n=[e];for(;n.length;){let o=n.pop();if(o===t)return!0;o.child&&n.push(o.child),r&&o.sibling&&n.push(o.sibling),r=!0}return!1}function Z(e,t){t(e);let r=e.child;for(;r;)t(r),r.child&&Z(r,t),r=r.sibling}function Ye(e,t){let r=e.parent;for(;r;){if(t(r))return r;r=r.parent}return null}function cr(e){return Ye(e,t=>t.type===se)}function bt(e){if("children"in e.props&&e.props.innerHTML)throw new E({message:"Cannot use both children and innerHTML on an element",vNode:e});for(let t in e.props)if("bind:"+t in e.props)throw new E({message:\`Cannot use both bind:\${t} and \${t} on an element\`,vNode:e})}function Xt(e){return typeof e=="string"||typeof e=="number"}function Yt(e){return typeof e=="function"||typeof e=="object"&&!!e&&"current"in e||w.isSignal(e)}var kn="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz-";function Le(e=10,t=kn){let r="";for(let n=0;n<e;n++)r+=t[Math.random()*t.length|0];return r}var j=Object.freeze(()=>{});function Ve(e){let{id:t,subs:r,fn:n,deps:o=[],onDepChanged:s}=e,i;H.delete(t);let a=!!S.current&&!m();a||(i=new Map,be.stack.push(i));let u=n(...o.map(c=>c.value));if(!a){for(let[p,v]of r)i.has(p)||(v(),r.delete(p));let c=()=>{H.size||queueMicrotask(vt),H.set(t,s)};for(let[p,v]of i){if(r.has(p))continue;let M=v.subscribe(c);r.set(p,M)}be.stack.pop()}return u}var ye=class e extends w{constructor(t,r){if(super(void 0,r),this.$getter=t,this.$unsubs=new Map,this.$isDirty=!0,l){let n=this[L].inject;this[L]={provide:()=>this,inject:o=>{n(o),e.stop(o),this.$isDirty=o.$isDirty},destroy:()=>{}}}w.configure(this,()=>{this.$isDirty&&(l&&this.$isDisposed||e.run(this))})}get value(){return super.value}set value(t){}subscribe(t){return this.$isDirty&&e.run(this),super.subscribe(t)}static dispose(t){e.stop(t),w.dispose(t)}static stop(t){let{$id:r,$unsubs:n}=_(t);H.delete(r),n.forEach(o=>o()),n.clear(),t.$isDirty=!0}static run(t){let r=_(t),{$id:n,$getter:o,$unsubs:s}=r,i=Ve({id:n,subs:s,fn:()=>o(r.$value),onDepChanged:()=>{if(r.$isDirty=!0,l){if(!F?.get(n)?.size)return}else if(!t.$subs.size)return;e.run(r),!Object.is(r.$value,r.$prevValue)&&r.notify()}});r.sneak(i),r.$isDirty=!1}},hr=(e,t)=>new ye(e,t),xt=(e,t)=>d("useComputedSignal",{signal:null},({hook:r,isInit:n,isHMR:o})=>(l&&(r.dev={devtools:{get:()=>({displayName:r.signal.displayName,value:r.signal.peek()})}},o&&(r.cleanup?.(),n=!0)),n&&(r.cleanup=()=>ye.dispose(r.signal),r.signal=hr(e,t)),r.signal));var ve=class e{constructor(t,r){if(this.id=Le(),this.getter=t,this.deps=r,this.unsubs=new Map,this.isRunning=!1,this.cleanup=null,l&&(this[L]={provide:()=>this,inject:n=>{n.isRunning||this.stop()},destroy:()=>{this.stop()}},"window"in globalThis)){let n=window.__kiru.HMRContext.signals;n.isWaitingForNextWatchCall()&&n.pushWatch(this)}this.start()}start(){if(!this.isRunning){if(this.isRunning=!0,l&&"window"in globalThis&&window.__kiru.HMRContext?.isReplacement())return queueMicrotask(()=>{this.isRunning&&e.run(this)});e.run(this)}}stop(){H.delete(this.id),this.unsubs.forEach(t=>t()),this.unsubs.clear(),this.cleanup?.(),this.cleanup=null,this.isRunning=!1}static run(t){let r=_(t),{id:n,getter:o,unsubs:s,deps:i}=r;r.cleanup=Ve({id:n,subs:s,fn:o,deps:i,onDepChanged:()=>{r.cleanup?.(),e.run(r)}})??null}};function wr(e,t){if(typeof e=="function")return new ve(e);let r=e,n=t;return new ve(n,r)}function xe(e,t){if(m())return d("useWatch",{watcher:null},({hook:r,isInit:n,isHMR:o})=>{if(l&&o&&(r.cleanup?.(),n=!0),n){let s=r.watcher=wr(e,t);r.cleanup=()=>s.stop()}return r.watcher})}var _n=0;function br(e,t,r){if(l&&t.__kiruNode)throw new Error("[kiru]: container in use - call unmount on the previous app first.");let n=f(t.nodeName.toLowerCase(),{});l&&(t.__kiruNode=n),n.dom=t,n.flags|=V;let o=_n++,s=r?.name??\`App-\${o}\`,i={id:o,name:s,rootNode:n,render:a,unmount:u};function a(c){n.props.children=c,ht(n)}function u(){n.props.children=null,ht(n),l&&(delete t.__kiruNode,delete n.app),window.__kiru.emit("unmount",i)}return l&&(n.app=i),a(e),window.__kiru.emit("mount",i),l&&queueMicrotask(()=>{window.dispatchEvent(new Event("kiru:ready"))}),i}function ce(e){return m()?d("useState",{state:void 0,dispatch:j},({hook:t,isInit:r,update:n,isHMR:o})=>{if(l&&(r&&(t.dev={devtools:{get:()=>({value:t.state}),set:({value:s})=>t.state=s},initialArgs:[e]}),o)){let[s]=t.dev.initialArgs;s!==e&&(r=!0,t.dev.initialArgs=[e])}return r&&(t.state=typeof e=="function"?e():e,t.dispatch=s=>{let i=typeof s=="function"?s(t.state):s;Object.is(t.state,i)||(t.state=i,n())}),[t.state,t.dispatch]}):[typeof e=="function"?e():e,j]}function yr(e){let t={[Ct]:!0,Provider:({value:r,children:n})=>{let[o]=ce(()=>new Set);return f(ie,{value:r,ctx:t,dependents:o},typeof n=="function"?n(r):n)},default:()=>e,set displayName(r){this.Provider.displayName=r},get displayName(){return this.Provider.displayName||"Anonymous Context"}};if(l){let r=t;r[L]={inject:n=>{let o=t.Provider;window.__kiru.apps.forEach(s=>{Z(s.rootNode,i=>{i.type===n.Provider&&(i.type=o,i.hmrUpdated=!0,R(i))})})},destroy:()=>{},provide:()=>t}}return t}function ee(e,t){return m()?d("useCallback",{callback:e,deps:t},({hook:r,isHMR:n})=>(l&&(r.dev={devtools:{get:()=>({callback:r.callback,dependencies:r.deps})}},n&&(r.deps=[])),A(t,r.deps)&&(r.deps=t,r.callback=e),r.callback)):e}function N(e,t){if(m())return d("useEffect",{deps:t},({hook:r,isInit:n,isHMR:o,queueEffect:s})=>{l&&(r.dev={devtools:{get:()=>({callback:e,dependencies:r.deps})}},o&&(n=!0)),(n||A(t,r.deps))&&(r.deps=t,$(r),s(()=>{let i=e();typeof i=="function"&&(r.cleanup=i)}))})}function ne(e,t){if(m())return d("useLayoutEffect",{deps:t},({hook:r,isInit:n,isHMR:o,queueEffect:s})=>{l&&(r.dev={devtools:{get:()=>({callback:e,dependencies:r.deps})}},o&&(n=!0)),(n||A(t,r.deps))&&(r.deps=t,$(r),s(()=>{let i=e();typeof i=="function"&&(r.cleanup=i)},{immediate:!0}))})}function Ee(e,t){return m()?d("useMemo",{deps:t,value:void 0},({hook:r,isInit:n,isHMR:o})=>(l&&(r.dev={devtools:{get:()=>({value:r.value,dependencies:r.deps})}},o&&(n=!0)),(n||A(t,r.deps))&&(r.deps=t,r.value=e()),r.value)):e()}function I(e){return m()?d("useRef",{ref:{current:e}},({hook:t,isInit:r,isHMR:n})=>{if(l&&(r&&(t.dev={devtools:{get:()=>({value:t.ref.current}),set:({value:o})=>t.ref.current=o},initialArgs:[t.ref.current]}),n)){let[o]=t.dev.initialArgs;o!==e&&(t.ref={current:e},t.dev.initialArgs=[e])}return t.ref}):{current:e}}var Ka="window"in globalThis?window.__KIRU_LAZY_CACHE??(window.__KIRU_LAZY_CACHE=new Map):new Map;function Er(e){let[t,r]=ce(e.initialState||"exited"),n=I(null);ne(()=>{e.in&&t!=="entered"&&t!=="entering"?(o("entering"),s("entered")):!e.in&&t!=="exited"&&t!=="exiting"&&(o("exiting"),s("exited"))},[e.in,t]),N(()=>()=>xr(n.current),[]);let o=ee(i=>{xr(n.current),r(i),(i==="entered"||i==="exited")&&e.onTransitionEnd&&e.onTransitionEnd(i)},[]),s=ee(i=>{n.current=window.setTimeout(()=>o(i),Tn(i,e.duration))},[e.duration]);return e.element(t)}var vr=150;function Tn(e,t){if(typeof t=="number")return t;switch(e){case"entered":return t?.in??vr;case"exited":return t?.out??vr}}function xr(e){e!=null&&window.clearTimeout(e)}"window"in globalThis;var Sr=()=>f("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},f("path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"}));var $e="kiru.devtools.anchorPosition",kr={x:-16,y:-16};var Et=(e,t,r)=>{if(!t.current)return{...kr};let n=window.innerWidth/e.width,o=window.innerHeight/e.height,s=null,i=null;return e.snapSide==="left"?s=(t.current.offsetWidth-r.width.value)*-1+16:e.snapSide==="right"?s=-16:e.snapSide==="bottom"?i=-16:e.snapSide==="top"&&(i=(window.innerHeight-r.height.value)*-1+16),{x:s??e.x*n,y:i??e.y*o}},_r=e=>{if(e==null)return null;let t=null,r=e?.__kiruNode?.parent;for(;r;){if(typeof r.type=="function"&&!mr(r)){t=r;break}r=r.parent}return t},Cr=(e,t)=>{let r=[],n=[t.__kiruNode];for(;n.length;){let s=n.pop();if(s===e)break;s?.dom&&r.push(s),s?.parent&&n.push(s.parent)}if(r.length===0)return;let o=r[r.length-1].dom;return o instanceof Element?o:void 0};var Ar={arrayChunkSize:10,objectKeysChunkSize:100};function Mr(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;let r=new Set([...Object.keys(e),...Object.keys(t)]);for(let n in r)if(typeof t[n]!=typeof e[n]||typeof e[n]=="object"&&!Mr(e[n],t[n]))return!1;return!0}var Rn={...Ar},Tr=localStorage.getItem("kiru.devtools.userSettings");if(Tr)try{let e=JSON.parse(Tr);Mr(Ar,e)&&(Rn=e)}catch(e){console.error("kiru.devtools.userSettings error",e)}var Pu=yr({userSettings:null,saveUserSettings:()=>{}});var Nu=Object.freeze(()=>{});var Ln="kiru-devtools";"window"in globalThis&&(window.__devtoolsSelection??(window.__devtoolsSelection=null));var St=class extends BroadcastChannel{send(t){super.postMessage(t)}removeEventListener(t){return super.removeEventListener("message",t)}addEventListener(t){return super.addEventListener("message",t)}},O=new St(Ln);var lc=Symbol.for("devtools.hookGroup");var D=(e,t,r={})=>{N(()=>{let n=window,o=r?.ref?.();return o?n=o:r.ref&&console.warn("useEventListener ref failed, using window"),n.addEventListener(e,t,r),()=>{n.removeEventListener(e,t,r)}},[t])};var He=()=>{let e=y({x:0,y:0}),t=y({x:0,y:0}),r=y({x:0,y:0});return D("mousemove",n=>{e.value={x:n.x,y:n.y},t.value={x:n.movementX,y:n.movementY},r.value={x:n.clientX,y:n.clientY}}),{mouse:e,delta:t,client:r}};var Fe="window"in globalThis&&"ResizeObserver"in globalThis.window,Rr=(e,t,r=void 0)=>m()?Fe?d("useResizeObserver",{resizeObserver:null,deps:[e.current]},({isInit:n,hook:o,queueEffect:s})=>(n&&(o.resizeObserver=new ResizeObserver(t),o.cleanup=()=>{o.resizeObserver?.disconnect?.(),o.resizeObserver=null}),s(()=>{A([e.current],o.deps)&&(o.deps=[e.current],o.resizeObserver?.disconnect?.(),e.current&&o.resizeObserver?.observe(e.current,r))}),{isSupported:Fe,start:()=>{o.resizeObserver==null&&(o.resizeObserver=new ResizeObserver(t),e.current&&o.resizeObserver.observe(e.current,r),o.cleanup=()=>{o.resizeObserver?.disconnect?.(),o.resizeObserver=null})},stop:()=>{$(o)}})):{isSupported:Fe,start:()=>{},stop:()=>{}}:{isSupported:Fe,start:()=>{},stop:()=>{}};var Ne="window"in globalThis&&"MutationObserver"in globalThis.window,Or=(e,t,r=void 0)=>m()?Ne?d("useMutationObserver",{mutationObserver:null,deps:[e.current]},({isInit:n,hook:o,queueEffect:s})=>(n?(s(()=>{o.deps=[e.current],o.mutationObserver=new MutationObserver(t),e.current&&o.mutationObserver.observe(e.current,r)}),o.cleanup=()=>{o.mutationObserver?.disconnect?.(),o.mutationObserver=null}):A([e.current],o.deps)&&(o.deps=[e.current],o.mutationObserver?.disconnect?.(),e.current&&o.mutationObserver?.observe(e.current,r)),{isSupported:Ne,start:()=>{o.mutationObserver==null&&(o.mutationObserver=new MutationObserver(t),e.current&&o.mutationObserver.observe(e.current,r),o.cleanup=()=>{o.mutationObserver?.disconnect?.(),o.mutationObserver=null})},stop:()=>{$(o)}})):{isSupported:Ne,start:()=>{},stop:()=>{}}:{isSupported:Ne,start:()=>{},stop:()=>{}};var Ie=(e,t={windowScroll:!0,windowResize:!0})=>{let r=t?.windowScroll??!0,n=t?.windowResize??!0,o=t.immediate??!0,s=y(0),i=y(0),a=y(0),u=y(0),c=y(0),p=y(0),v=y(0),M=y(0),h=()=>{let x=e.current;if(!x){s.value=0,i.value=0,a.value=0,u.value=0,c.value=0,p.value=0,v.value=0,M.value=0;return}let b=x.getBoundingClientRect();s.value=b.width,i.value=b.height,a.value=b.top,u.value=b.right,c.value=b.bottom,p.value=b.left,v.value=b.x,M.value=b.y};return Rr(e,h),Or(e,h,{attributeFilter:["style","class"]}),D("scroll",()=>{r&&h()},{capture:!0,passive:!0}),D("resize",()=>{n&&h()},{passive:!0}),ne(()=>{o&&h()},[]),{width:s,height:i,top:a,right:u,bottom:c,left:p,x:v,y:M,update:h}};var Pr=(e,t)=>{if(!m())return{isActive:t?.immediate??!1,start:()=>null,stop:()=>null};let r=t?.fpsLimit?1e3/t.fpsLimit:null;return d("useRafFn",()=>({callback:e,refId:null,previousFrameTimestamp:0,isActive:t?.immediate??!1,rafLoop:()=>{}}),({isInit:n,hook:o,update:s})=>(o.callback=e,n&&(o.rafLoop=i=>{if(o.isActive===!1)return;o.previousFrameTimestamp||(o.previousFrameTimestamp=i);let a=i-o.previousFrameTimestamp;if(r&&a<r){o.refId=window.requestAnimationFrame(o.rafLoop);return}o.previousFrameTimestamp=i,o.callback({delta:a,timestamp:i}),o.refId=window.requestAnimationFrame(o.rafLoop)}),n&&t?.immediate&&(o.isActive=!0,o.refId=window.requestAnimationFrame(o.rafLoop),o.cleanup=()=>{o.refId!=null&&window.cancelAnimationFrame(o.refId),o.isActive=!1},s()),{isActive:o.isActive,start:()=>{o.isActive!==!0&&(o.isActive=!0,o.refId=window.requestAnimationFrame(o.rafLoop),o.cleanup=()=>{o.refId!=null&&window.cancelAnimationFrame(o.refId),o.isActive=!1},s())},stop:()=>{$(o),s()}}))};var Dr=e=>{let{x:t,y:r,multiple:n,immediate:o=!0}=e,s=y(null),a=Pr(()=>{s.value=n?document.elementsFromPoint(t,r)??[]:document.elementFromPoint(t,r)??null},{immediate:o});return{element:s,...a}};var Lr=()=>{let{mouse:e}=He(),t=y(null),r=I(null),n=I(null),o=Ie(r),s=y({x:-16,y:-16}),i=y({x:-16,y:-16}),a=y({width:window.innerWidth,height:window.innerHeight}),u=y("bottom"),c=I(null);ne(()=>{let h=localStorage.getItem($e);if(h==null)return;let x=JSON.parse(h);a.value.width=window.innerWidth,a.value.height=window.innerHeight,u.value=x.snapSide,i.value=Et(x,n,o)},[Math.round(o.width.value),Math.round(o.height.value)]);let p=xt(()=>{let{x:h,y:x}=e.value;if(t.value===null)return null;let{x:b,y:C}=t.value;return{x:h-b,y:x-C}});D("dragstart",h=>{h.preventDefault(),t.value={x:h.x,y:h.y},s.value=i.value},{ref:()=>r.current}),D("mouseup",()=>{c.current&&(clearTimeout(c.current),c.current=null),t.peek()&&(t.value=null,localStorage.setItem($e,JSON.stringify({...i.value,...a.value,snapSide:u.value})))});let v=ee(()=>{if(n.current==null)return;let h=n.current.offsetWidth;if(u.value==="right"){let x=Math.min(-16,i.value.y);i.value={x:-16,y:Math.max(x,(window.innerHeight-o.height.value)*-1+16)}}else if(u.value==="left"){let x=Math.min(0,i.value.y);i.value={x:(h-o.width.value)*-1+16,y:Math.max(x,(window.innerHeight-o.height.value)*-1+16)}}else if(u.value==="top"){let x=Math.min(-16,i.value.x);i.value={x:Math.max(x,(h-o.width.value)*-1+16),y:(window.innerHeight-o.height.value)*-1+16};return}else{let x=Math.min(-16,i.value.x);i.value={x:Math.max(x,(h-o.width.value)*-1+16),y:-16}}},[]);xe([p,e],(h,x)=>{if(h===null||!n.current)return;let{x:b,y:C}=x,je=n.current.offsetWidth,Ir=C>=window.innerHeight-100,_t=C<=100;if(!_t&&!Ir){let oe=b>window.innerWidth/2;u.value=oe?"right":"left"}else u.value=_t?"top":"bottom";if(u.value==="right"){let oe=Math.min(-16,s.value.y+h.y);i.value={x:-16,y:Math.max(oe,(window.innerHeight-o.height.value)*-1+16)};return}else if(u.value==="left"){let oe=Math.min(0,s.value.y+h.y);i.value={x:(je-o.width.value)*-1+16,y:Math.max(oe,(window.innerHeight-o.height.value)*-1+16)};return}else if(u.value==="top"){let oe=Math.min(-16,s.value.x+h.x);i.value={x:Math.max(oe,(je-o.width.value)*-1+16),y:(window.innerHeight-o.height.value)*-1+16};return}let zr=Math.min(-16,s.value.x+h.x);i.value={y:-16,x:Math.max(zr,(je-o.width.value)*-1+16)}});let M=ee(()=>{n.current!==null&&(i.value=Et({width:a.value.width,height:a.value.height,x:i.value.x,y:i.value.y,snapSide:u.value},n,o),a.value.width=window.innerWidth,a.value.height=window.innerHeight,localStorage.setItem($e,JSON.stringify({...i.value,...a.value,snapSide:u.value})))},[Math.round(o.width.value),Math.round(o.height.value)]);return D("resize",M),{anchorRef:r,anchorCoords:i,viewPortRef:n,startMouse:t,elementBound:o,snapSide:u,updateAnchorPos:v}};var z=De(!1);"window"in globalThis&&O.addEventListener(e=>{e.data.type==="set-inspect-enabled"&&(z.value=e.data.value)});var q=De(null);var Vr="kiru-devtools-popup-size",ze=()=>{let e=q.value;return ee(()=>new Promise((r,n)=>{if(e)if(e.closed)q.value=null;else return e.focus(),r(e);let o=sessionStorage.getItem(Vr),s=o?JSON.parse(o):{width:Math.floor(Math.min(1920,window.screen.width)/2),height:Math.floor(Math.min(1080,window.screen.height)/2)},i=\`popup,width=\${s.width},height=\${s.height};\`,a=window.open(window.__KIRU_DEVTOOLS_PATHNAME__,"_blank",i);if(!a)return console.error("[kiru]: Unable to open devtools window"),n();let u=c=>{c.data.type==="ready"&&(O.removeEventListener(u),console.debug("[kiru]: devtools window opened"),r(a),q.value=a,a.onbeforeunload=()=>{console.debug("[kiru]: devtools window closed"),q.value=null})};O.addEventListener(u),a.onresize=()=>{sessionStorage.setItem(Vr,JSON.stringify({width:a.innerWidth,height:a.innerHeight}))}}),[e])};var $r=()=>{let e=ze(),{mouse:t}=He(),r=Dr({x:t.value.x,y:t.value.y,immediate:!1}),n=r.element.value,o=z.value?n:null,s=Ee(()=>{if(o&&window.__kiru){let c=window.__kiru.apps.find(p=>p.rootNode==null||o.__kiruNode==null?!1:gr(p.rootNode,o.__kiruNode));return c?.rootNode==null?null:c}return null},[o]),i=Ee(()=>o?_r(o):null,[o]),a=I(null),u=Ie(a);return N(()=>z.subscribe(p=>{r[p?"start":"stop"]()}),[]),N(()=>{i&&o?a.current=Cr(i,o)??null:a.current=null},[i,o]),D("click",c=>{if(z.value===!0&&i&&s){c.preventDefault();let p=v=>{v.__devtoolsSelection={node:i,app:s},O.send({type:"select-node"}),O.send({type:"set-inspect-enabled",value:!1}),z.value=!1,a.current=null,v.focus()};q.value?p(q.value):e().then(v=>p(v))}}),i&&f("div",{className:"bg-[crimson]/80 fixed grid place-content-center pointer-events-none z-10 top-0 left-0",style:{width:\`\${u?.width}px\`,height:\`\${u?.height}px\`,transform:\`translate(\${u.x}px, \${u.y}px)\`}},f("p",null,i.type.name))};function Hr(e){return f("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 -960 960 960",fill:"currentColor",...e},f("path",{d:"M710-150q-63 0-106.5-43.5T560-300q0-63 43.5-106.5T710-450q63 0 106.5 43.5T860-300q0 63-43.5 106.5T710-150Zm0-80q29 0 49.5-20.5T780-300q0-29-20.5-49.5T710-370q-29 0-49.5 20.5T640-300q0 29 20.5 49.5T710-230Zm-270-30H200q-17 0-28.5-11.5T160-300q0-17 11.5-28.5T200-340h240q17 0 28.5 11.5T480-300q0 17-11.5 28.5T440-260ZM250-510q-63 0-106.5-43.5T100-660q0-63 43.5-106.5T250-810q63 0 106.5 43.5T400-660q0 63-43.5 106.5T250-510Zm0-80q29 0 49.5-20.5T320-660q0-29-20.5-49.5T250-730q-29 0-49.5 20.5T180-660q0 29 20.5 49.5T250-590Zm510-30H520q-17 0-28.5-11.5T480-660q0-17 11.5-28.5T520-700h240q17 0 28.5 11.5T800-660q0 17-11.5 28.5T760-620Zm-50 320ZM250-660Z"}))}function Fr(e){return f("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-square-mouse-pointer",...e},f("path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z"}),f("path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"}))}var Vn=()=>{z.value=!z.value,O.send({type:"set-inspect-enabled",value:z.value})};function $n(e,t){let{damping:r}=t,n=y(e),o=I(e);return N(()=>{let s=null,i=()=>{if(Math.sqrt(Math.pow(o.current.x-n.value.x,2)+Math.pow(o.current.y-n.value.y,2))<5)return;let u=n.value.x+(o.current.x-n.value.x)*r,c=n.value.y+(o.current.y-n.value.y)*r;n.value={x:u,y:c},s=window.requestAnimationFrame(i)};return s=window.requestAnimationFrame(i),()=>{s!=null&&window.cancelAnimationFrame(s)}},[e.x,e.y]),Object.assign(n,{set:(s,i)=>{o.current=s,i?.hard&&(n.value=s)}})}function kt(){let e=y(!1),t=ze(),{anchorCoords:r,anchorRef:n,viewPortRef:o,startMouse:s,snapSide:i}=Lr(),a=i.value==="left"||i.value==="right",u=I(!1),c=$n(r.value,{damping:.4});return xe([r],c.set),ne(()=>{u.current===!1&&c.set(r.value,{hard:!0}),u.current=!0},[]),f(Q,null,f("div",{ref:o,className:"w-full h-0 fixed top-0 left-0 z-[-9999] overflow-scroll pointer-events-none"}),f("div",{ref:n,draggable:!0,className:\`flex \${a?"flex-col":""} \${e.value?"rounded-3xl":"rounded-full"} p-1 gap-1 items-center will-change-transform bg-crimson\`,style:{transform:\`translate3d(\${Math.round(c.value.x)}px, \${Math.round(c.value.y)}px, 0)\`}},f(Er,{in:e.value,duration:{in:40,out:150},element:p=>{if(p==="exited")return null;let v=p==="entered"?"1":"0.5",M=p==="entered"?"1":"0";return f(Q,null,f("button",{title:"Open Devtools",onclick:t,style:{transform:\`scale(\${v})\`,opacity:M},className:"transition text-white rounded-full p-1 hover:bg-[#0003]"},f(Hr,{width:16,height:16})),f("button",{title:"Toggle Component Inspection",onclick:Vn,style:{transform:\`scale(\${v})\`,opacity:M},className:\`transition text-white rounded-full p-1 hover:bg-[#0003] \${z.value?"bg-[#0003]":""}\`},f(Fr,{width:16,height:16})))}}),f("button",{className:"bg-crimson rounded-full p-1"+(s.value?" pointer-events-none":""),onclick:()=>e.value=!e.value,tabIndex:-1},f(Sr,null))),f($r,null))}var Nr=\`*, ::before, ::after {
|
|
2441
2454
|
--tw-border-spacing-x: 0;
|
|
2442
2455
|
--tw-border-spacing-y: 0;
|
|
2443
2456
|
--tw-translate-x: 0;
|
|
@@ -4559,10 +4572,15 @@ async function generateStaticSite(state, outputOptions, bundle, log) {
|
|
|
4559
4572
|
const mod = await import(pathToFileURL(ssrEntryAbs).href);
|
|
4560
4573
|
const paths = await mod.generateStaticPaths();
|
|
4561
4574
|
const clientOutDirAbs = path5.resolve(projectRoot, `${baseOutDir}/client`);
|
|
4562
|
-
const { clientEntry
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
)
|
|
4575
|
+
const { clientEntry } = await getClientAssets(clientOutDirAbs, manifestPath);
|
|
4576
|
+
let manifest = null;
|
|
4577
|
+
const clientManifestPath = path5.resolve(clientOutDirAbs, manifestPath);
|
|
4578
|
+
if (fs4.existsSync(clientManifestPath)) {
|
|
4579
|
+
try {
|
|
4580
|
+
manifest = JSON.parse(fs4.readFileSync(clientManifestPath, "utf-8"));
|
|
4581
|
+
} catch {
|
|
4582
|
+
}
|
|
4583
|
+
}
|
|
4566
4584
|
const routes = Object.keys(paths);
|
|
4567
4585
|
log(ANSI.cyan("[SSG]"), `discovered ${routes.length} routes:`, routes);
|
|
4568
4586
|
const renderingChunks = [];
|
|
@@ -4585,7 +4603,8 @@ async function generateStaticSite(state, outputOptions, bundle, log) {
|
|
|
4585
4603
|
route,
|
|
4586
4604
|
srcFilePath,
|
|
4587
4605
|
clientEntry,
|
|
4588
|
-
|
|
4606
|
+
manifest,
|
|
4607
|
+
log
|
|
4589
4608
|
);
|
|
4590
4609
|
const filePath = getOutputPath(clientOutDirAbs, route);
|
|
4591
4610
|
log(ANSI.cyan("[SSG]"), "write:", ANSI.black(filePath));
|
|
@@ -4598,7 +4617,6 @@ async function generateStaticSite(state, outputOptions, bundle, log) {
|
|
|
4598
4617
|
}
|
|
4599
4618
|
async function getClientAssets(clientOutDirAbs, manifestPath) {
|
|
4600
4619
|
let clientEntry = null;
|
|
4601
|
-
let cssLinks = "";
|
|
4602
4620
|
try {
|
|
4603
4621
|
const clientManifestPath = path5.resolve(clientOutDirAbs, manifestPath);
|
|
4604
4622
|
if (fs4.existsSync(clientManifestPath)) {
|
|
@@ -4607,30 +4625,118 @@ async function getClientAssets(clientOutDirAbs, manifestPath) {
|
|
|
4607
4625
|
if (manifest[clientEntryKey]?.file) {
|
|
4608
4626
|
clientEntry = manifest[clientEntryKey].file;
|
|
4609
4627
|
}
|
|
4610
|
-
const entryKey = clientEntry ? Object.keys(manifest).find((k) => manifest[k]?.file === clientEntry) : null;
|
|
4611
|
-
if (entryKey) {
|
|
4612
|
-
const seen = /* @__PURE__ */ new Set();
|
|
4613
|
-
const cssFiles = /* @__PURE__ */ new Set();
|
|
4614
|
-
const collectCss = (key) => {
|
|
4615
|
-
if (seen.has(key)) return;
|
|
4616
|
-
seen.add(key);
|
|
4617
|
-
const it = manifest[key];
|
|
4618
|
-
if (!it) return;
|
|
4619
|
-
(it.css || []).forEach((c) => cssFiles.add(c));
|
|
4620
|
-
(it.imports || []).forEach((imp) => collectCss(imp));
|
|
4621
|
-
};
|
|
4622
|
-
collectCss(entryKey);
|
|
4623
|
-
if (cssFiles.size) {
|
|
4624
|
-
cssLinks = Array.from(cssFiles).map((f) => `<link rel="stylesheet" type="text/css" href="/${f}">`).join("");
|
|
4625
|
-
}
|
|
4626
|
-
}
|
|
4627
4628
|
}
|
|
4628
4629
|
} catch {
|
|
4629
4630
|
}
|
|
4630
4631
|
if (!clientEntry) {
|
|
4631
4632
|
clientEntry = findClientEntry(clientOutDirAbs);
|
|
4632
4633
|
}
|
|
4633
|
-
return { clientEntry
|
|
4634
|
+
return { clientEntry };
|
|
4635
|
+
}
|
|
4636
|
+
function collectCssForModules(manifest, moduleIds, projectRoot, log) {
|
|
4637
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4638
|
+
const cssFiles = /* @__PURE__ */ new Set();
|
|
4639
|
+
if (log) {
|
|
4640
|
+
log(
|
|
4641
|
+
ANSI.yellow("[SSG CSS]"),
|
|
4642
|
+
`Collecting CSS for ${moduleIds.length} modules:`
|
|
4643
|
+
);
|
|
4644
|
+
moduleIds.forEach((id) => log(ANSI.yellow("[SSG CSS]"), ` - ${id}`));
|
|
4645
|
+
}
|
|
4646
|
+
const collectCss = (key) => {
|
|
4647
|
+
if (seen.has(key)) return;
|
|
4648
|
+
seen.add(key);
|
|
4649
|
+
const it = manifest[key];
|
|
4650
|
+
if (!it) {
|
|
4651
|
+
if (log)
|
|
4652
|
+
log(ANSI.yellow("[SSG CSS]"), ` Key not found in manifest: ${key}`);
|
|
4653
|
+
return;
|
|
4654
|
+
}
|
|
4655
|
+
if (log) {
|
|
4656
|
+
log(ANSI.yellow("[SSG CSS]"), ` Processing manifest key: ${key}`);
|
|
4657
|
+
if (it.css && it.css.length > 0) {
|
|
4658
|
+
log(ANSI.yellow("[SSG CSS]"), ` Found CSS: ${it.css.join(", ")}`);
|
|
4659
|
+
}
|
|
4660
|
+
if (it.imports && it.imports.length > 0) {
|
|
4661
|
+
log(
|
|
4662
|
+
ANSI.yellow("[SSG CSS]"),
|
|
4663
|
+
` Found imports: ${it.imports.length} imports`
|
|
4664
|
+
);
|
|
4665
|
+
}
|
|
4666
|
+
}
|
|
4667
|
+
;
|
|
4668
|
+
(it.css || []).forEach((c) => cssFiles.add(c));
|
|
4669
|
+
(it.imports || []).forEach((imp) => collectCss(imp));
|
|
4670
|
+
};
|
|
4671
|
+
const entryClientKey = "virtual:kiru:entry-client";
|
|
4672
|
+
if (manifest[entryClientKey] && !seen.has(entryClientKey)) {
|
|
4673
|
+
if (log) log(ANSI.yellow("[SSG CSS]"), `Including entry client CSS`);
|
|
4674
|
+
collectCss(entryClientKey);
|
|
4675
|
+
}
|
|
4676
|
+
for (const moduleId of moduleIds) {
|
|
4677
|
+
let normalizedId = moduleId.replace(/\\/g, "/");
|
|
4678
|
+
if (normalizedId.startsWith(projectRoot)) {
|
|
4679
|
+
normalizedId = normalizedId.substring(projectRoot.length);
|
|
4680
|
+
}
|
|
4681
|
+
if (normalizedId.startsWith("/")) {
|
|
4682
|
+
normalizedId = normalizedId.substring(1);
|
|
4683
|
+
}
|
|
4684
|
+
if (log) {
|
|
4685
|
+
log(ANSI.yellow("[SSG CSS]"), `Looking for module: ${moduleId}`);
|
|
4686
|
+
log(ANSI.yellow("[SSG CSS]"), ` Normalized: ${normalizedId}`);
|
|
4687
|
+
}
|
|
4688
|
+
let found = false;
|
|
4689
|
+
if (manifest[normalizedId]) {
|
|
4690
|
+
if (log) log(ANSI.green("[SSG CSS]"), ` \u2713 Found as: ${normalizedId}`);
|
|
4691
|
+
collectCss(normalizedId);
|
|
4692
|
+
found = true;
|
|
4693
|
+
continue;
|
|
4694
|
+
}
|
|
4695
|
+
if (manifest["/" + normalizedId]) {
|
|
4696
|
+
if (log) log(ANSI.green("[SSG CSS]"), ` \u2713 Found as: /${normalizedId}`);
|
|
4697
|
+
collectCss("/" + normalizedId);
|
|
4698
|
+
found = true;
|
|
4699
|
+
continue;
|
|
4700
|
+
}
|
|
4701
|
+
if (manifest[moduleId]) {
|
|
4702
|
+
if (log) log(ANSI.green("[SSG CSS]"), ` \u2713 Found as: ${moduleId}`);
|
|
4703
|
+
collectCss(moduleId);
|
|
4704
|
+
found = true;
|
|
4705
|
+
continue;
|
|
4706
|
+
}
|
|
4707
|
+
for (const key in manifest) {
|
|
4708
|
+
const keyNormalized = key.replace(/\\/g, "/");
|
|
4709
|
+
const moduleBaseName = path5.basename(normalizedId);
|
|
4710
|
+
const keyBaseName = path5.basename(keyNormalized);
|
|
4711
|
+
if ((keyNormalized.endsWith(normalizedId) || normalizedId.endsWith(keyNormalized)) && moduleBaseName === keyBaseName) {
|
|
4712
|
+
if (log)
|
|
4713
|
+
log(ANSI.green("[SSG CSS]"), ` \u2713 Found by basename match: ${key}`);
|
|
4714
|
+
collectCss(key);
|
|
4715
|
+
found = true;
|
|
4716
|
+
break;
|
|
4717
|
+
}
|
|
4718
|
+
}
|
|
4719
|
+
if (!found && log) {
|
|
4720
|
+
log(
|
|
4721
|
+
ANSI.red("[SSG CSS]"),
|
|
4722
|
+
` \u2717 Module not found in manifest: ${moduleId}`
|
|
4723
|
+
);
|
|
4724
|
+
}
|
|
4725
|
+
}
|
|
4726
|
+
if (cssFiles.size) {
|
|
4727
|
+
const links = Array.from(cssFiles).map((f) => `<link rel="stylesheet" type="text/css" href="/${f}">`).join("");
|
|
4728
|
+
if (log) {
|
|
4729
|
+
log(ANSI.green("[SSG CSS]"), `Collected ${cssFiles.size} CSS file(s):`);
|
|
4730
|
+
Array.from(cssFiles).forEach(
|
|
4731
|
+
(f) => log(ANSI.green("[SSG CSS]"), ` - ${f}`)
|
|
4732
|
+
);
|
|
4733
|
+
}
|
|
4734
|
+
return links;
|
|
4735
|
+
}
|
|
4736
|
+
if (log) {
|
|
4737
|
+
log(ANSI.yellow("[SSG CSS]"), "No CSS files collected");
|
|
4738
|
+
}
|
|
4739
|
+
return "";
|
|
4634
4740
|
}
|
|
4635
4741
|
function findClientEntry(dir) {
|
|
4636
4742
|
if (!fs4.existsSync(dir)) return null;
|
|
@@ -4644,9 +4750,26 @@ function findClientEntry(dir) {
|
|
|
4644
4750
|
}
|
|
4645
4751
|
return null;
|
|
4646
4752
|
}
|
|
4647
|
-
async function renderRoute(state, mod, route, srcFilePath, clientEntry,
|
|
4753
|
+
async function renderRoute(state, mod, route, srcFilePath, clientEntry, manifest, log) {
|
|
4754
|
+
const moduleIds = [];
|
|
4755
|
+
const { projectRoot, ssgOptions } = state;
|
|
4756
|
+
const documentPath = path5.resolve(
|
|
4757
|
+
projectRoot,
|
|
4758
|
+
ssgOptions.dir,
|
|
4759
|
+
ssgOptions.document
|
|
4760
|
+
);
|
|
4761
|
+
const documentModuleId = documentPath.replace(/\\/g, "/");
|
|
4762
|
+
moduleIds.push(documentModuleId);
|
|
4763
|
+
if (state.loggingEnabled) {
|
|
4764
|
+
log(ANSI.cyan("[SSG]"), `Rendering route: ${route}`);
|
|
4765
|
+
log(ANSI.cyan("[SSG]"), ` Document module: ${documentModuleId}`);
|
|
4766
|
+
}
|
|
4648
4767
|
const ctx = {
|
|
4649
|
-
registerModule: () => {
|
|
4768
|
+
registerModule: (moduleId) => {
|
|
4769
|
+
moduleIds.push(moduleId);
|
|
4770
|
+
if (state.loggingEnabled) {
|
|
4771
|
+
log(ANSI.cyan("[SSG]"), ` Registered module: ${moduleId}`);
|
|
4772
|
+
}
|
|
4650
4773
|
},
|
|
4651
4774
|
registerPreloadedPageProps: (props) => {
|
|
4652
4775
|
;
|
|
@@ -4655,6 +4778,18 @@ async function renderRoute(state, mod, route, srcFilePath, clientEntry, cssLinks
|
|
|
4655
4778
|
};
|
|
4656
4779
|
const result = await mod.render(route, ctx);
|
|
4657
4780
|
let html = result.body;
|
|
4781
|
+
if (state.loggingEnabled) {
|
|
4782
|
+
log(ANSI.cyan("[SSG]"), ` Total modules tracked: ${moduleIds.length}`);
|
|
4783
|
+
}
|
|
4784
|
+
let cssLinks = "";
|
|
4785
|
+
if (manifest) {
|
|
4786
|
+
cssLinks = collectCssForModules(
|
|
4787
|
+
manifest,
|
|
4788
|
+
moduleIds,
|
|
4789
|
+
projectRoot,
|
|
4790
|
+
state.loggingEnabled ? log : void 0
|
|
4791
|
+
);
|
|
4792
|
+
}
|
|
4658
4793
|
if (clientEntry) {
|
|
4659
4794
|
const scriptTag = `<script type="module" src="/${clientEntry}"></script>`;
|
|
4660
4795
|
const headInjected = cssLinks ? html.replace("<head>", "<head>" + cssLinks) : html;
|