diff --git a/DESCRIPTION b/DESCRIPTION index bd46b21..08a8018 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -22,6 +22,7 @@ Roxygen: list(markdown = TRUE) RoxygenNote: 7.3.2 Imports: htmlwidgets, + jsonlite, magrittr Depends: R (>= 2.10) diff --git a/NAMESPACE b/NAMESPACE index 02a5728..e52d52d 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -12,5 +12,6 @@ importFrom(htmlwidgets,createWidget) importFrom(htmlwidgets,shinyRenderWidget) importFrom(htmlwidgets,shinyWidgetOutput) importFrom(htmlwidgets,sizingPolicy) +importFrom(jsonlite,as_gzjson_b64) importFrom(magrittr,"%>%") importFrom(utils,modifyList) diff --git a/NEWS.md b/NEWS.md index dc9b952..43a39a6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,3 @@ -# uPlot (development version) +# uPlot v0.0.0.9300 * Updated uplot to 1.6.30. diff --git a/R/uPlot.R b/R/uPlot.R index 307d78b..0d5fe1b 100644 --- a/R/uPlot.R +++ b/R/uPlot.R @@ -6,6 +6,7 @@ #' a `data.frame` where first column is the x-axis and the others the series to plot. #' @param options Options to generate the plot. #' @param ... Additional arguments. +#' @param use_gzipped_json Use [jsonlite::as_gzjson_b64()] to compress JSON data. #' @param width,height A numeric input in pixels. #' @param elementId Use an explicit element ID for the widget. #' @@ -13,6 +14,7 @@ #' #' @importFrom htmlwidgets createWidget sizingPolicy #' @importFrom grDevices palette +#' @importFrom jsonlite as_gzjson_b64 #' #' @export #' @@ -30,7 +32,13 @@ #' ) #' ) #' ) -uPlot <- function(data, options = list(), ..., width = NULL, height = NULL, elementId = NULL) { +uPlot <- function(data, + options = list(), + ..., + use_gzipped_json = FALSE, + width = NULL, + height = NULL, + elementId = NULL) { options <- as.list(options) series_nms <- names(data) @@ -48,10 +56,11 @@ uPlot <- function(data, options = list(), ..., width = NULL, height = NULL, elem x <- list( config = list( - data = data, + data = if (use_gzipped_json) as_gzjson_b64(data) else data, options = options, ... ), + use_gzipped_json = use_gzipped_json, series_nms = series_nms ) diff --git a/inst/htmlwidgets/uPlot.js b/inst/htmlwidgets/uPlot.js index c83fb6b..31622bc 100644 --- a/inst/htmlwidgets/uPlot.js +++ b/inst/htmlwidgets/uPlot.js @@ -1 +1 @@ -(()=>{"use strict";var e={350:(e,t,l)=>{l.d(t,{Z:()=>r});var n=l(81),o=l.n(n),i=l(645),s=l.n(i)()(o());s.push([e.id,'.uplot, .uplot *, .uplot *::before, .uplot *::after {box-sizing: border-box;}.uplot {font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";line-height: 1.5;width: min-content;}.u-title {text-align: center;font-size: 18px;font-weight: bold;}.u-wrap {position: relative;user-select: none;}.u-over, .u-under {position: absolute;}.u-under {overflow: hidden;}.uplot canvas {display: block;position: relative;width: 100%;height: 100%;}.u-axis {position: absolute;}.u-legend {font-size: 14px;margin: auto;text-align: center;}.u-inline {display: block;}.u-inline * {display: inline-block;}.u-inline tr {margin-right: 16px;}.u-legend th {font-weight: 600;}.u-legend th > * {vertical-align: middle;display: inline-block;}.u-legend .u-marker {width: 1em;height: 1em;margin-right: 4px;background-clip: padding-box !important;}.u-inline.u-live th::after {content: ":";vertical-align: middle;}.u-inline:not(.u-live) .u-value {display: none;}.u-series > * {padding: 4px;}.u-series th {cursor: pointer;}.u-legend .u-off > * {opacity: 0.3;}.u-select {background: rgba(0,0,0,0.07);position: absolute;pointer-events: none;}.u-cursor-x, .u-cursor-y {position: absolute;left: 0;top: 0;pointer-events: none;will-change: transform;}.u-hz .u-cursor-x, .u-vt .u-cursor-y {height: 100%;border-right: 1px dashed #607D8B;}.u-hz .u-cursor-y, .u-vt .u-cursor-x {width: 100%;border-bottom: 1px dashed #607D8B;}.u-cursor-pt {position: absolute;top: 0;left: 0;border-radius: 50%;border: 0 solid;pointer-events: none;will-change: transform;/*this has to be !important since we set inline "background" shorthand */background-clip: padding-box !important;}.u-axis.u-off, .u-select.u-off, .u-cursor-x.u-off, .u-cursor-y.u-off, .u-cursor-pt.u-off {display: none;}',""]);const r=s},645:e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var l="",n=void 0!==t[5];return t[4]&&(l+="@supports (".concat(t[4],") {")),t[2]&&(l+="@media ".concat(t[2]," {")),n&&(l+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),l+=e(t),n&&(l+="}"),t[2]&&(l+="}"),t[4]&&(l+="}"),l})).join("")},t.i=function(e,l,n,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var s={};if(n)for(var r=0;r0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=i),l&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=l):c[2]=l),o&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=o):c[4]="".concat(o)),t.push(c))}},t}},81:e=>{e.exports=function(e){return e[1]}},379:e=>{var t=[];function l(e){for(var l=-1,n=0;n{var t={};e.exports=function(e,l){var n=function(e){if(void 0===t[e]){var l=document.querySelector(e);if(window.HTMLIFrameElement&&l instanceof window.HTMLIFrameElement)try{l=l.contentDocument.head}catch(e){l=null}t[e]=l}return t[e]}(e);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(l)}},216:e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},565:(e,t,l)=>{e.exports=function(e){var t=l.nc;t&&e.setAttribute("nonce",t)}},795:e=>{e.exports=function(e){var t=e.insertStyleElement(e);return{update:function(l){!function(e,t,l){var n="";l.supports&&(n+="@supports (".concat(l.supports,") {")),l.media&&(n+="@media ".concat(l.media," {"));var o=void 0!==l.layer;o&&(n+="@layer".concat(l.layer.length>0?" ".concat(l.layer):""," {")),n+=l.css,o&&(n+="}"),l.media&&(n+="}"),l.supports&&(n+="}");var i=l.sourceMap;i&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(n,e,t.options)}(t,e,l)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},589:e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}}},t={};function l(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={id:n,exports:{}};return e[n](i,i.exports,l),i.exports}l.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return l.d(t,{a:t}),t},l.d=(e,t)=>{for(var n in t)l.o(t,n)&&!l.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.nc=void 0;var n={};(()=>{l.r(n),l.d(n,{drawPoints:()=>pn,uPlot:()=>Jl}),window.HTMLWidgets;const e="u-off",t="u-label",o="width",i="height",s="top",r="bottom",u="left",a="right",c="#000",f="#0000",d="mousemove",h="mousedown",p="mouseup",m="mouseenter",g="mouseleave",x="dblclick",w="change",v="dppxchange",b="--",y="undefined"!=typeof window,k=y?document:null,_=y?window:null,M=y?navigator:null;let S,E;function T(e,t){if(null!=t){let l=e.classList;!l.contains(t)&&l.add(t)}}function z(e,t){let l=e.classList;l.contains(t)&&l.remove(t)}function P(e,t,l){e.style[t]=l+"px"}function D(e,t,l,n){let o=k.createElement(e);return null!=t&&T(o,t),null!=l&&l.insertBefore(o,n),o}function A(e,t){return D("div",e,t)}const C=new WeakMap;function W(t,l,n,o,i){let s="translate("+l+"px,"+n+"px)";s!=C.get(t)&&(t.style.transform=s,C.set(t,s),l<0||n<0||l>o||n>i?T(t,e):z(t,e))}const I=new WeakMap;function H(e,t,l){let n=t+l;n!=I.get(e)&&(I.set(e,n),e.style.background=t,e.style.borderColor=l)}const Y=new WeakMap;function R(e,t,l,n){let o=t+""+l;o!=Y.get(e)&&(Y.set(e,o),e.style.height=l+"px",e.style.width=t+"px",e.style.marginLeft=n?-t/2+"px":0,e.style.marginTop=n?-l/2+"px":0)}const O={passive:!0},j={...O,capture:!0};function L(e,t,l,n){t.addEventListener(e,l,n?j:O)}function F(e,t,l,n){t.removeEventListener(e,l,n?j:O)}function N(e,t,l,n){let o;l=l||0;let i=(n=n||t.length-1)<=2147483647;for(;n-l>1;)o=i?l+n>>1:ne((l+n)/2),t[o]=t&&o<=l;o+=n)if(null!=e[o])return o;return-1}function U(e,t,l,n){let o=ae(e),i=ae(t);e==t&&(-1==o?(e*=l,t/=l):(e/=l,t*=l));let s=10==l?ce:fe,r=1==i?ie:ne,u=(1==o?ne:ie)(s(le(e))),a=r(s(le(t))),c=ue(l,u),f=ue(l,a);return 10==l&&(u<0&&(c=Ee(c,-u)),a<0&&(f=Ee(f,-a))),n||2==l?(e=c*o,t=f*i):(e=Se(e,c),t=Me(t,f)),[e,t]}function B(e,t,l,n){let o=U(e,t,l,n);return 0==e&&(o[0]=0),0==t&&(o[1]=0),o}y&&function e(){let t=devicePixelRatio;S!=t&&(S=t,E&&F(w,E,e),E=matchMedia(`(min-resolution: ${S-.001}dppx) and (max-resolution: ${S+.001}dppx)`),L(w,E,e),_.dispatchEvent(new CustomEvent(v)))}();const V={mode:3,pad:.1},Z={pad:0,soft:null,mode:0},q={min:Z,max:Z};function J(e,t,l,n){return Ye(l)?X(e,t,l):(Z.pad=l,Z.soft=n?0:null,Z.mode=n?3:0,X(e,t,q))}function K(e,t){return null==e?t:e}function X(e,t,l){let n=l.min,o=l.max,i=K(n.pad,0),s=K(o.pad,0),r=K(n.hard,-he),u=K(o.hard,he),a=K(n.soft,he),c=K(o.soft,-he),f=K(n.mode,0),d=K(o.mode,0),h=t-e,p=ce(h),m=re(le(e),le(t)),g=ce(m),x=le(g-p);(h<1e-9||x>10)&&(h=0,0!=e&&0!=t||(h=1e-9,2==f&&a!=he&&(i=0),2==d&&c!=-he&&(s=0)));let w=h||m||1e3,v=ce(w),b=ue(10,ne(v)),y=Ee(Se(e-w*(0==h?0==e?.1:1:i),b/10),9),k=e>=a&&(1==f||3==f&&y<=a||2==f&&y>=a)?a:he,_=re(r,y=k?k:se(k,y)),M=Ee(Me(t+w*(0==h?0==t?.1:1:s),b/10),9),S=t<=c&&(1==d||3==d&&M>=c||2==d&&M<=c)?c:-he,E=se(u,M>S&&t<=S?S:re(S,M));return _==E&&0==_&&(E=100),[_,E]}const $=new Intl.NumberFormat(y?M.language:"en-US"),Q=e=>$.format(e),ee=Math,te=ee.PI,le=ee.abs,ne=ee.floor,oe=ee.round,ie=ee.ceil,se=ee.min,re=ee.max,ue=ee.pow,ae=ee.sign,ce=ee.log10,fe=ee.log2,de=(e,t=1)=>ee.asinh(e/t),he=1/0;function pe(e){return 1+(0|ce((e^e>>31)-(e>>31)))}function me(e,t,l){return se(re(e,t),l)}function ge(e){return"function"==typeof e?e:()=>e}const xe=e=>e,we=(e,t)=>t,ve=e=>null,be=e=>!0,ye=(e,t)=>e==t,ke=e=>Ee(e,14);function _e(e,t){return ke(Ee(ke(e/t))*t)}function Me(e,t){return ke(ie(ke(e/t))*t)}function Se(e,t){return ke(ne(ke(e/t))*t)}function Ee(e,t=0){if(Ie(e))return e;let l=10**t,n=e*l*(1+Number.EPSILON);return oe(n)/l}const Te=new Map;function ze(e){return((""+e).split(".")[1]||"").length}function Pe(e,t,l,n){let o=[],i=n.map(ze);for(let s=t;s=0&&s>=0?0:t)+(s>=i[e]?0:i[e]),a=Ee(r,u);o.push(a),Te.set(a,u)}}return o}const De={},Ae=[],Ce=[null,null],We=Array.isArray,Ie=Number.isInteger;function He(e){return"string"==typeof e}function Ye(e){let t=!1;if(null!=e){let l=e.constructor;t=null==l||l==Object}return t}function Re(e){return null!=e&&"object"==typeof e}const Oe=Object.getPrototypeOf(Uint8Array);function je(e,t=Ye){let l;if(We(e)){let n=e.find((e=>null!=e));if(We(n)||t(n)){l=Array(e.length);for(let n=0;ni){for(n=s-1;n>=0&&null==e[n];)e[n--]=null;for(n=s+1;nPromise.resolve().then(e):queueMicrotask,Ge=["January","February","March","April","May","June","July","August","September","October","November","December"],Ue=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function Be(e){return e.slice(0,3)}const Ve=Ue.map(Be),Ze=Ge.map(Be),qe={MMMM:Ge,MMM:Ze,WWWW:Ue,WWW:Ve};function Je(e){return(e<10?"0":"")+e}const Ke={YYYY:e=>e.getFullYear(),YY:e=>(e.getFullYear()+"").slice(2),MMMM:(e,t)=>t.MMMM[e.getMonth()],MMM:(e,t)=>t.MMM[e.getMonth()],MM:e=>Je(e.getMonth()+1),M:e=>e.getMonth()+1,DD:e=>Je(e.getDate()),D:e=>e.getDate(),WWWW:(e,t)=>t.WWWW[e.getDay()],WWW:(e,t)=>t.WWW[e.getDay()],HH:e=>Je(e.getHours()),H:e=>e.getHours(),h:e=>{let t=e.getHours();return 0==t?12:t>12?t-12:t},AA:e=>e.getHours()>=12?"PM":"AM",aa:e=>e.getHours()>=12?"pm":"am",a:e=>e.getHours()>=12?"p":"a",mm:e=>Je(e.getMinutes()),m:e=>e.getMinutes(),ss:e=>Je(e.getSeconds()),s:e=>e.getSeconds(),fff:e=>{return((t=e.getMilliseconds())<10?"00":t<100?"0":"")+t;var t}};function Xe(e,t){t=t||qe;let l,n=[],o=/\{([a-z]+)\}|[^{]+/gi;for(;l=o.exec(e);)n.push("{"==l[0][0]?Ke[l[1]]:l[0]);return e=>{let l="";for(let o=0;oe%1==0,et=[1,2,2.5,5],tt=Pe(10,-16,0,et),lt=Pe(10,0,16,et),nt=lt.filter(Qe),ot=tt.concat(lt),it="{YYYY}",st="\n"+it,rt="{M}/{D}",ut="\n"+rt,at=ut+"/{YY}",ct="{aa}",ft="{h}:{mm}"+ct,dt="\n"+ft,ht=":{ss}",pt=null;function mt(e){let t=1e3*e,l=60*t,n=60*l,o=24*n,i=30*o,s=365*o;return[(1==e?Pe(10,0,3,et).filter(Qe):Pe(10,-3,0,et)).concat([t,5*t,10*t,15*t,30*t,l,5*l,10*l,15*l,30*l,n,2*n,3*n,4*n,6*n,8*n,12*n,o,2*o,3*o,4*o,5*o,6*o,7*o,8*o,9*o,10*o,15*o,i,2*i,3*i,4*i,6*i,s,2*s,5*s,10*s,25*s,50*s,100*s]),[[s,it,pt,pt,pt,pt,pt,pt,1],[28*o,"{MMM}",st,pt,pt,pt,pt,pt,1],[o,rt,st,pt,pt,pt,pt,pt,1],[n,"{h}"+ct,at,pt,ut,pt,pt,pt,1],[l,ft,at,pt,ut,pt,pt,pt,1],[t,ht,at+" "+ft,pt,ut+" "+ft,pt,dt,pt,1],[e,ht+".{fff}",at+" "+ft,pt,ut+" "+ft,pt,dt,pt,1]],function(t){return(r,u,a,c,f,d)=>{let h=[],p=f>=s,m=f>=i&&f=o?o:f,s=v+(ne(a)-ne(x))+Me(x-v,i);h.push(s);let p=t(s),m=p.getHours()+p.getMinutes()/l+p.getSeconds()/n,g=f/n,w=d/r.axes[u]._space;for(;s=Ee(s+f,1==e?0:3),!(s>c);)if(g>1){let e=ne(Ee(m+g,6))%24,l=t(s).getHours()-e;l>1&&(l=-1),s-=l*n,m=(m+g)%24,Ee((s-h[h.length-1])/f,3)*w>=.7&&h.push(s)}else h.push(s)}return h}}]}const[gt,xt,wt]=mt(1),[vt,bt,yt]=mt(.001);function kt(e,t){return e.map((e=>e.map(((l,n)=>0==n||8==n||null==l?l:t(1==n||0==e[8]?l:e[1]+l)))))}function _t(e,t){return(l,n,o,i,s)=>{let r,u,a,c,f,d,h=t.find((e=>s>=e[0]))||t[t.length-1];return n.map((t=>{let l=e(t),n=l.getFullYear(),o=l.getMonth(),i=l.getDate(),s=l.getHours(),p=l.getMinutes(),m=l.getSeconds(),g=n!=r&&h[2]||o!=u&&h[3]||i!=a&&h[4]||s!=c&&h[5]||p!=f&&h[6]||m!=d&&h[7]||h[1];return r=n,u=o,a=i,c=s,f=p,d=m,g(l)}))}}function Mt(e,t,l){return new Date(e,t,l)}function St(e,t){return t(e)}function Et(e,t){return(l,n,o,i)=>null==i?b:t(e(n))}Pe(2,-53,53,[1]);const Tt={show:!0,live:!0,isolate:!1,mount:()=>{},markers:{show:!0,width:2,stroke:function(e,t){let l=e.series[t];return l.width?l.stroke(e,t):l.points.width?l.points.stroke(e,t):null},fill:function(e,t){return e.series[t].fill(e,t)},dash:"solid"},idx:null,idxs:null,values:[]},zt=[0,0];function Pt(e,t,l,n=!0){return e=>{0==e.button&&(!n||e.target==t)&&l(e)}}function Dt(e,t,l,n=!0){return e=>{(!n||e.target==t)&&l(e)}}const At={show:!0,x:!0,y:!0,lock:!1,move:function(e,t,l){return zt[0]=t,zt[1]=l,zt},points:{show:function(e,t){let l=e.cursor.points,n=A(),s=l.size(e,t);P(n,o,s),P(n,i,s);let r=s/-2;P(n,"marginLeft",r),P(n,"marginTop",r);let u=l.width(e,t,s);return u&&P(n,"borderWidth",u),n},size:function(e,t){return e.series[t].points.size},width:0,stroke:function(e,t){let l=e.series[t].points;return l._stroke||l._fill},fill:function(e,t){let l=e.series[t].points;return l._fill||l._stroke}},bind:{mousedown:Pt,mouseup:Pt,click:Pt,dblclick:Pt,mousemove:Dt,mouseleave:Dt,mouseenter:Dt},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(e,t)=>{t.stopPropagation(),t.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(e,t,l,n,o)=>n-o,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},Ct={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},Wt=Le({},Ct,{filter:we}),It=Le({},Wt,{size:10}),Ht=Le({},Ct,{show:!1}),Yt='12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',Rt="bold "+Yt,Ot={show:!0,scale:"x",stroke:c,space:50,gap:5,size:50,labelGap:0,labelSize:30,labelFont:Rt,side:2,grid:Wt,ticks:It,border:Ht,font:Yt,lineGap:1.5,rotate:0},jt={show:!0,scale:"x",auto:!1,sorted:1,min:he,max:-he,idxs:[]};function Lt(e,t,l,n,o){return t.map((e=>null==e?"":Q(e)))}function Ft(e,t,l,n,o,i,s){let r=[],u=Te.get(o)||0;for(let e=l=s?l:Ee(Me(l,o),u);e<=n;e=Ee(e+o,u))r.push(Object.is(e,-0)?0:e);return r}function Nt(e,t,l,n,o,i,s){const r=[],u=e.scales[e.axes[t].scale].log,a=ne((10==u?ce:fe)(l));o=ue(u,a),10==u&&a<0&&(o=Ee(o,-a));let c=l;do{r.push(c),c+=o,10==u&&(c=Ee(c,Te.get(o))),c>=o*u&&(o=c)}while(c<=n);return r}function Gt(e,t,l,n,o,i,s){let r=e.scales[e.axes[t].scale].asinh,u=n>r?Nt(e,t,re(r,l),n,o):[r],a=n>=0&&l<=0?[0]:[];return(l<-r?Nt(e,t,re(r,-n),-l,o):[r]).reverse().map((e=>-e)).concat(a,u)}const Ut=/./,Bt=/[12357]/,Vt=/[125]/,Zt=/1/,qt=(e,t,l,n)=>e.map(((e,o)=>4==t&&0==e||o%n==0&&l.test(e.toExponential()[e<0?1:0])?e:null));function Jt(e,t,l,n,o){let i=e.axes[l],s=i.scale,r=e.scales[s],u=e.valToPos,a=i._space,c=u(10,s),f=u(9,s)-c>=a?Ut:u(7,s)-c>=a?Bt:u(5,s)-c>=a?Vt:Zt;if(f==Zt){let e=le(u(1,s)-c);if(eo,tl={show:!0,auto:!0,sorted:0,gaps:el,alpha:1,facets:[Le({},Qt,{scale:"x"}),Le({},Qt,{scale:"y"})]},ll={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:el,alpha:1,points:{show:function(e,t){let{scale:l,idxs:n}=e.series[0],o=e._data[0],i=e.valToPos(o[n[0]],l,!0),s=e.valToPos(o[n[1]],l,!0),r=le(s-i)/(e.series[t].points.space*S);return n[1]-n[0]<=r},filter:null},values:null,min:he,max:-he,idxs:[],path:null,clip:null};function nl(e,t,l,n,o){return l/10}const ol={time:!0,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},il=Le({},ol,{time:!1,ori:1}),sl={};function rl(e,t){let l=sl[e];return l||(l={key:e,plots:[],sub(e){l.plots.push(e)},unsub(e){l.plots=l.plots.filter((t=>t!=e))},pub(e,t,n,o,i,s,r){for(let u=0;u{let m=e.pxRound;const g=r.dir*(0==r.ori?1:-1),x=0==r.ori?wl:vl;let w,v;1==g?(w=l,v=n):(w=n,v=l);let b=m(a(t[w],r,h,f)),y=m(c(s[w],u,p,d)),k=m(a(t[v],r,h,f)),_=m(c(1==i?u.max:u.min,u,p,d)),M=new Path2D(o);return x(M,k,_),x(M,b,_),x(M,b,y),M}))}function dl(e,t,l,n,o,i){let s=null;if(e.length>0){s=new Path2D;const r=0==t?bl:yl;let u=l;for(let t=0;tl[0]){let e=l[0]-u;e>0&&r(s,u,n,e,n+i),u=l[1]}}let a=l+o-u,c=10;a>0&&r(s,u,n-c/2,a,n+i+c)}return s}function hl(e,t,l,n,o,i,s){let r=[],u=e.length;for(let a=1==o?l:n;a>=l&&a<=n;a+=o)if(null===t[a]){let c=a,f=a;if(1==o)for(;++a<=n&&null===t[a];)f=a;else for(;--a>=l&&null===t[a];)f=a;let d=i(e[c]),h=f==c?d:i(e[f]),p=c-o;d=s<=0&&p>=0&&p=0&&m>=0&&m=d&&r.push([d,h])}return r}function pl(e){return 0==e?xe:1==e?oe:t=>_e(t,e)}function ml(e){let t=0==e?gl:xl,l=0==e?(e,t,l,n,o,i)=>{e.arcTo(t,l,n,o,i)}:(e,t,l,n,o,i)=>{e.arcTo(l,t,o,n,i)},n=0==e?(e,t,l,n,o)=>{e.rect(t,l,n,o)}:(e,t,l,n,o)=>{e.rect(l,t,o,n)};return(e,o,i,s,r,u=0,a=0)=>{0==u&&0==a?n(e,o,i,s,r):(u=se(u,s/2,r/2),a=se(a,s/2,r/2),t(e,o+u,i),l(e,o+s,i,o+s,i+r,u),l(e,o+s,i+r,o,i+r,a),l(e,o,i+r,o,i,a),l(e,o,i,o+s,i,u),e.closePath())}}const gl=(e,t,l)=>{e.moveTo(t,l)},xl=(e,t,l)=>{e.moveTo(l,t)},wl=(e,t,l)=>{e.lineTo(t,l)},vl=(e,t,l)=>{e.lineTo(l,t)},bl=ml(0),yl=ml(1),kl=(e,t,l,n,o,i)=>{e.arc(t,l,n,o,i)},_l=(e,t,l,n,o,i)=>{e.arc(l,t,n,o,i)},Ml=(e,t,l,n,o,i,s)=>{e.bezierCurveTo(t,l,n,o,i,s)},Sl=(e,t,l,n,o,i,s)=>{e.bezierCurveTo(l,t,o,n,s,i)};function El(e){return(e,t,l,n,o)=>ul(e,t,((t,i,s,r,u,a,c,f,d,h,p)=>{let m,g,{pxRound:x,points:w}=t;0==r.ori?(m=gl,g=kl):(m=xl,g=_l);const v=Ee(w.width*S,3);let b=(w.size-w.width)/2*S,y=Ee(2*b,3),k=new Path2D,_=new Path2D,{left:M,top:E,width:T,height:z}=e.bbox;bl(_,M-y,E-y,T+2*y,z+2*y);const P=e=>{if(null!=s[e]){let t=x(a(i[e],r,h,f)),l=x(c(s[e],u,p,d));m(k,t+b,l),g(k,t,l,b,0,2*te)}};if(o)o.forEach(P);else for(let e=l;e<=n;e++)P(e);return{stroke:v>0?k:null,fill:k,clip:_,flags:3}}))}function Tl(e){return(t,l,n,o,i,s)=>{n!=o&&(i!=n&&s!=n&&e(t,l,n),i!=o&&s!=o&&e(t,l,o),e(t,l,s))}}const zl=Tl(wl),Pl=Tl(vl);function Dl(e){const t=K(e?.alignGaps,0);return(e,l,n,o)=>ul(e,l,((i,s,r,u,a,c,f,d,h,p,m)=>{let g,x,w=i.pxRound,v=e=>w(c(e,u,p,d)),b=e=>w(f(e,a,m,h));0==u.ori?(g=wl,x=zl):(g=vl,x=Pl);const y=u.dir*(0==u.ori?1:-1),k={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:1},_=k.stroke;let M,S,E,T=he,z=-he,P=v(s[1==y?n:o]),D=G(r,n,o,1*y),A=G(r,n,o,-1*y),C=v(s[D]),W=v(s[A]),I=!1;for(let e=1==y?n:o;e>=n&&e<=o;e+=y){let t=v(s[e]),l=r[e];t==P?null!=l?(S=b(l),T==he&&(g(_,t,S),M=S),T=se(S,T),z=re(S,z)):null===l&&(I=!0):(T!=he&&(x(_,P,T,z,M,S),E=P),null!=l?(S=b(l),g(_,t,S),T=z=M=S):(T=he,z=-he,null===l&&(I=!0)),P=t)}T!=he&&T!=z&&E!=P&&x(_,P,T,z,M,S);let[H,Y]=al(e,l);if(null!=i.fill||0!=H){let t=k.fill=new Path2D(_),n=b(i.fillTo(e,l,i.min,i.max,H));g(t,W,n),g(t,C,n)}if(!i.spanGaps){let a=[];I&&a.push(...hl(s,r,n,o,y,v,t)),k.gaps=a=i.gaps(e,l,n,o,a),k.clip=dl(a,u.ori,d,h,p,m)}return 0!=Y&&(k.band=2==Y?[fl(e,l,n,o,_,-1),fl(e,l,n,o,_,1)]:fl(e,l,n,o,_,Y)),k}))}function Al(e,t,l,n,o,i,s=he){if(e.length>1){let r=null;for(let u=0,a=1/0;u0!=n[e]>0?l[e]=0:(l[e]=3*(u[e-1]+u[e])/((2*u[e]+u[e-1])/n[e-1]+(u[e]+2*u[e-1])/n[e]),isFinite(l[e])||(l[e]=0));l[s-1]=n[s-2];for(let n=0;n{Jl.pxRatio=S})));const Hl=Dl(),Yl=El();function Rl(e,t,l,n){return(n?[e[0],e[1]].concat(e.slice(2)):[e[0]].concat(e.slice(1))).map(((e,n)=>Ol(e,n,t,l)))}function Ol(e,t,l,n){return Le({},0==t?l:n,e)}function jl(e,t,l){return null==t?Ce:[t,l]}const Ll=jl;function Fl(e,t,l){return null==t?Ce:J(t,l,.1,!0)}function Nl(e,t,l,n){return null==t?Ce:U(t,l,e.scales[n].log,!1)}const Gl=Nl;function Ul(e,t,l,n){return null==t?Ce:B(t,l,e.scales[n].log,!1)}const Bl=Ul;function Vl(e,t,l,n,o){let i=re(pe(e),pe(t)),s=t-e,r=N(o/n*s,l);do{let e=l[r],t=n*e/s;if(t>=o&&i+(e<5?Te.get(e):0)<=17)return[e,t]}while(++r(t=oe((l=+n)*S))+"px")),t,l]}function ql(e){e.show&&[e.font,e.labelFont].forEach((e=>{let t=Ee(e[2]*S,1);e[0]=e[0].replace(/[0-9.]+px/,t+"px"),e[1]=t}))}function Jl(l,n,c){const w={mode:K(l.mode,1)},y=w.mode;function M(e,t){return((3==t.distr?ce(e>0?e:t.clamp(w,e,t.min,t.max,t.key)):4==t.distr?de(e,t.asinh):e)-t._min)/(t._max-t._min)}function E(e,t,l,n){let o=M(e,t);return n+l*(-1==t.dir?1-o:o)}function C(e,t,l,n){let o=M(e,t);return n+l*(-1==t.dir?o:1-o)}function I(e,t,l,n){return 0==t.ori?E(e,t,l,n):C(e,t,l,n)}w.valToPosH=E,w.valToPosV=C;let Y=!1;w.status=0;const O=w.root=A("uplot");null!=l.id&&(O.id=l.id),T(O,l.class),l.title&&(A("u-title",O).textContent=l.title);const j=D("canvas"),G=w.ctx=j.getContext("2d"),Z=A("u-wrap",O);L("click",Z,(e=>{e.target===X&&(In!=Dn||Hn!=An)&&Un.click(w,e)}),!0);const q=w.under=A("u-under",Z);Z.appendChild(j);const X=w.over=A("u-over",Z),$=+K((l=je(l)).pxAlign,1),Q=pl($);(l.plugins||[]).forEach((e=>{e.opts&&(l=e.opts(w,l)||l)}));const ne=l.ms||.001,ae=w.series=1==y?Rl(l.series||[],jt,ll,!1):(fe=l.series||[null],pe=tl,fe.map(((e,t)=>0==t?null:Le({},pe,e))));var fe,pe;const xe=w.axes=Rl(l.axes||[],Ot,$t,!0),ke=w.scales={},Se=w.bands=l.bands||[];Se.forEach((e=>{e.fill=ge(e.fill||null),e.dir=K(e.dir,-1)}));const Pe=2==y?ae[1].facets[0].scale:ae[0].scale,Ie={axes:function(){for(let e=0;ern[e])):v,y=2==p.distr?rn[v[1]]-rn[v[0]]:d,k=t.ticks,_=t.border,M=k.show?oe(k.size*S):0,E=t._rotate*-te/180,T=Q(t._pos*S),z=T+(M+x)*f;n=0==i?z:0,l=1==i?z:0,dn(t.font[0],c,1==t.align?u:2==t.align?a:E>0?u:E<0?a:0==i?"center":3==o?a:u,E||1==i?"middle":2==o?s:r);let P=t.font[1]*t.lineGap,D=v.map((e=>Q(I(e,p,m,g)))),A=t._values;for(let e=0;e0&&(ae.forEach(((e,t)=>{if(t>0&&e.show&&(mn(t,!1),mn(t,!0),null==e._paths)){sn!=e.alpha&&(G.globalAlpha=sn=e.alpha);let l=2==y?[0,n[t][0].length-1]:function(e){let t=me(Cl-1,0,Al-1),l=me(Il+1,0,Al-1);for(;null==e[t]&&t>0;)t--;for(;null==e[l]&&l{if(t>0&&e.show){sn!=e.alpha&&(G.globalAlpha=sn=e.alpha),null!=e._paths&&gn(t,!1);{let l=null!=e._paths?e._paths.gaps:null,n=e.points.show(w,t,Cl,Il,l),o=e.points.filter(w,t,n,l);(n||o)&&(e.points._paths=e.points.paths(w,t,Cl,Il,o),gn(t,!0))}1!=sn&&(G.globalAlpha=sn=1),To("drawSeries",t)}})))}},Oe=(l.drawOrder||["axes","series"]).map((e=>Ie[e]));function Fe(e){let t=ke[e];if(null==t){let n=(l.scales||De)[e]||De;if(null!=n.from)Fe(n.from),ke[e]=Le({},ke[n.from],n,{key:e});else{t=ke[e]=Le({},e==Pe?ol:il,n),t.key=e;let l=t.time,o=t.range,i=We(o);if((e!=Pe||2==y&&!l)&&(!i||null!=o[0]&&null!=o[1]||(o={min:null==o[0]?V:{mode:1,hard:o[0],soft:o[0]},max:null==o[1]?V:{mode:1,hard:o[1],soft:o[1]}},i=!1),!i&&Ye(o))){let e=o;o=(t,l,n)=>null==l?Ce:J(l,n,e)}t.range=ge(o||(l?Ll:e==Pe?3==t.distr?Gl:4==t.distr?Bl:jl:3==t.distr?Nl:4==t.distr?Ul:Fl)),t.auto=ge(!i&&t.auto),t.clamp=ge(t.clamp||nl),t._min=t._max=null}}}Fe("x"),Fe("y"),1==y&&ae.forEach((e=>{Fe(e.scale)})),xe.forEach((e=>{Fe(e.scale)}));for(let e in l.scales)Fe(e);const Ge=ke[Pe],Ue=Ge.distr;let Be,Ve;0==Ge.ori?(T(O,"u-hz"),Be=E,Ve=C):(T(O,"u-vt"),Be=C,Ve=E);const Ze={};for(let e in ke){let t=ke[e];null==t.min&&null==t.max||(Ze[e]={min:t.min,max:t.max},t.min=t.max=null)}const qe=l.tzDate||(e=>new Date(oe(e/ne))),Je=l.fmtDate||Xe,Ke=1==ne?wt(qe):yt(qe),$e=_t(qe,kt(1==ne?xt:bt,Je)),Qe=Et(qe,St("{YYYY}-{MM}-{DD} {h}:{mm}{aa}",Je)),et=[],tt=w.legend=Le({},Tt,l.legend),lt=tt.show,it=tt.markers;let st,rt,ut;tt.idxs=et,it.width=ge(it.width),it.dash=ge(it.dash),it.stroke=ge(it.stroke),it.fill=ge(it.fill);let at,ct=[],ft=[],dt=!1,ht={};if(tt.live){const e=ae[1]?ae[1].values:null;dt=null!=e,at=dt?e(w,1,0):{_:0};for(let e in at)ht[e]=b}if(lt)if(st=D("table","u-legend",O),ut=D("tbody",null,st),tt.mount(w,st),dt){rt=D("thead",null,st,ut);let e=D("tr",null,rt);for(var pt in D("th",null,e),at)D("th",t,e).textContent=pt}else T(st,"u-inline"),tt.live&&T(st,"u-live");const mt={show:!0},Mt={show:!1},zt=new Map;function Pt(e,t,l,n=!0){const o=zt.get(t)||{},i=wl.bind[e](w,t,l,n);i&&(L(e,t,o[e]=i),zt.set(t,o))}function Dt(e,t,l){const n=zt.get(t)||{};for(let l in n)null!=e&&l!=e||(F(l,t,n[l]),delete n[l]);null==e&&zt.delete(t)}let Ct=0,Wt=0,It=0,Ht=0,Yt=0,Rt=0,Ut=Yt,Bt=Rt,Vt=It,Zt=Ht,qt=0,Qt=0,el=0,sl=0;w.bbox={};let ul=!1,al=!1,fl=!1,dl=!1,hl=!1,ml=!1;function gl(e,t,l){(l||e!=w.width||t!=w.height)&&xl(e,t),_n(!1),fl=!0,al=!0,Ln()}function xl(e,t){w.width=Ct=It=e,w.height=Wt=Ht=t,Yt=Rt=0,function(){let e=!1,t=!1,l=!1,n=!1;xe.forEach(((o,i)=>{if(o.show&&o._show){let{side:i,_size:s}=o,r=i%2,u=s+(null!=o.label?o.labelSize:0);u>0&&(r?(It-=u,3==i?(Yt+=u,n=!0):l=!0):(Ht-=u,0==i?(Rt+=u,e=!0):t=!0))}})),Tl[0]=e,Tl[1]=l,Tl[2]=t,Tl[3]=n,It-=Dl[1]+Dl[3],Yt+=Dl[3],Ht-=Dl[2]+Dl[0],Rt+=Dl[0]}(),function(){let e=Yt+It,t=Rt+Ht,l=Yt,n=Rt;function o(o,i){switch(o){case 1:return e+=i,e-i;case 2:return t+=i,t-i;case 3:return l-=i,l+i;case 0:return n-=i,n+i}}xe.forEach(((e,t)=>{if(e.show&&e._show){let t=e.side;e._pos=o(t,e._size),null!=e.label&&(e._lpos=o(t,e.labelSize))}}))}();let l=w.bbox;qt=l.left=_e(Yt*S,.5),Qt=l.top=_e(Rt*S,.5),el=l.width=_e(It*S,.5),sl=l.height=_e(Ht*S,.5)}w.setSize=function({width:e,height:t}){gl(e,t)};const wl=w.cursor=Le({},At,{drag:{y:2==y}},l.cursor);if(null==wl.dataIdx){let e=wl.hover,t=e.skip=new Set(e.skip??[]);t.add(void 0);let l=e.prox=ge(e.prox),o=e.bias??=0;wl.dataIdx=(e,i,s,r)=>{if(0==i)return s;let u=s,a=l(e,i,s,r)??he,c=a>=0&&a0;)t.has(p[e])||(l=e);if(0==o||1==o)for(e=s;null==n&&e++a&&(u=null);return u}}const vl=e=>{wl.event=e};wl.idxs=et,wl._lock=!1;let bl=wl.points;bl.show=ge(bl.show),bl.size=ge(bl.size),bl.stroke=ge(bl.stroke),bl.width=ge(bl.width),bl.fill=ge(bl.fill);const yl=w.focus=Le({},l.focus||{alpha:.3},wl.focus),kl=yl.prox>=0;let _l=[null],Ml=[null],Sl=[null];function El(l,n){if(1==y||n>0){let e=1==y&&ke[l.scale].time,t=l.value;l.value=e?He(t)?Et(qe,St(t,Je)):t||Qe:t||Xt,l.label=l.label||(e?"Time":"Value")}if(n>0){l.width=null==l.width?1:l.width,l.paths=l.paths||Hl||ve,l.fillTo=ge(l.fillTo||cl),l.pxAlign=+K(l.pxAlign,$),l.pxRound=pl(l.pxAlign),l.stroke=ge(l.stroke||null),l.fill=ge(l.fill||null),l._stroke=l._fill=l._paths=l._focus=null;let e=Ee(1*(3+2*(re(1,l.width)||1)),3),t=l.points=Le({},{size:e,width:re(1,.2*e),stroke:l.stroke,space:2*e,paths:Yl,_stroke:null,_fill:null},l.points);t.show=ge(t.show),t.filter=ge(t.filter),t.fill=ge(t.fill),t.stroke=ge(t.stroke),t.paths=ge(t.paths),t.pxAlign=l.pxAlign}if(lt){let o=function(l,n){if(0==n&&(dt||!tt.live||2==y))return Ce;let o=[],i=D("tr","u-series",ut,ut.childNodes[n]);T(i,l.class),l.show||T(i,e);let s=D("th",null,i);if(it.show){let e=A("u-marker",s);if(n>0){let t=it.width(w,n);t&&(e.style.border=t+"px "+it.dash(w,n)+" "+it.stroke(w,n)),e.style.background=it.fill(w,n)}}let r=A(t,s);for(var u in r.textContent=l.label,n>0&&(it.show||(r.style.color=l.width>0?it.stroke(w,n):it.fill(w,n)),Pt("click",s,(e=>{if(wl._lock)return;vl(e);let t=ae.indexOf(l);if((e.ctrlKey||e.metaKey)!=tt.isolate){let e=ae.some(((e,l)=>l>0&&l!=t&&e.show));ae.forEach(((l,n)=>{n>0&&Xn(n,e?n==t?mt:Mt:mt,!0,Po.setSeries)}))}else Xn(t,{show:!l.show},!0,Po.setSeries)}),!1),kl&&Pt(m,s,(e=>{wl._lock||(vl(e),Xn(ae.indexOf(l),to,!0,Po.setSeries))}),!1)),at){let e=D("td","u-value",i);e.textContent="--",o.push(e)}return[i,o]}(l,n);ct.splice(n,0,o[0]),ft.splice(n,0,o[1]),tt.values.push(null)}if(wl.show){et.splice(n,0,null);let e=function(e,t){if(t>0){let l=wl.points.show(w,t);if(l)return T(l,"u-cursor-pt"),T(l,e.class),W(l,-10,-10,It,Ht),X.insertBefore(l,_l[t]),l}}(l,n);null!=e&&(_l.splice(n,0,e),Ml.splice(n,0,0),Sl.splice(n,0,0))}To("addSeries",n)}w.addSeries=function(e,t){t=null==t?ae.length:t,e=1==y?Ol(e,t,jt,ll):Ol(e,t,null,tl),ae.splice(t,0,e),El(ae[t],t)},w.delSeries=function(e){if(ae.splice(e,1),lt){tt.values.splice(e,1),ft.splice(e,1);let t=ct.splice(e,1)[0];Dt(null,t.firstChild),t.remove()}wl.show&&(et.splice(e,1),_l.length>1&&(_l.splice(e,1)[0].remove(),Ml.splice(e,1),Sl.splice(e,1))),To("delSeries",e)};const Tl=[!1,!1,!1,!1];function zl(e,t,l,n){let[o,i,s,r]=l,u=t%2,a=0;return 0==u&&(r||i)&&(a=0==t&&!o||2==t&&!s?oe(Ot.size/3):0),1==u&&(o||s)&&(a=1==t&&!i||3==t&&!r?oe($t.size/2):0),a}const Pl=w.padding=(l.padding||[zl,zl,zl,zl]).map((e=>ge(K(e,zl)))),Dl=w._padding=Pl.map(((e,t)=>e(w,t,Tl,0)));let Al,Cl=null,Il=null;const Jl=1==y?ae[0].idxs:null;let Kl,Xl,$l,Ql,en,tn,ln,nn,on,sn,rn=null,un=!1;function an(e,t){if(n=null==e?[]:e,w.data=w._data=n,2==y){Al=0;for(let e=1;e=0,ml=!0,Ln()}}function cn(){let e,t;un=!0,1==y&&(Al>0?(Cl=Jl[0]=0,Il=Jl[1]=Al-1,e=n[0][Cl],t=n[0][Il],2==Ue?(e=Cl,t=Il):e==t&&(3==Ue?[e,t]=U(e,e,Ge.log,!1):4==Ue?[e,t]=B(e,e,Ge.log,!1):Ge.time?t=e+oe(86400/ne):[e,t]=J(e,t,.1,!0))):(Cl=Jl[0]=e=null,Il=Jl[1]=t=null)),Kn(Pe,e,t)}function fn(e,t,l,n,o,i){e??=f,l??=Ae,n??="butt",o??=f,i??="round",e!=Kl&&(G.strokeStyle=Kl=e),o!=Xl&&(G.fillStyle=Xl=o),t!=$l&&(G.lineWidth=$l=t),i!=en&&(G.lineJoin=en=i),n!=tn&&(G.lineCap=tn=n),l!=Ql&&G.setLineDash(Ql=l)}function dn(e,t,l,n){t!=Xl&&(G.fillStyle=Xl=t),e!=ln&&(G.font=ln=e),l!=nn&&(G.textAlign=nn=l),n!=on&&(G.textBaseline=on=n)}function hn(e,t,l,n,o=0){if(n.length>0&&e.auto(w,un)&&(null==t||null==t.min)){let t=K(Cl,0),i=K(Il,n.length-1),s=null==l.min?3==e.distr?function(e,t,l){let n=he,o=-he;for(let i=t;i<=l;i++){let t=e[i];null!=t&&t>0&&(to&&(o=t))}return[n,o]}(n,t,i):function(e,t,l,n){let o=he,i=-he;if(1==n)o=e[t],i=e[l];else if(-1==n)o=e[l],i=e[t];else for(let n=t;n<=l;n++){let t=e[n];null!=t&&(ti&&(i=t))}return[o,i]}(n,t,i,o):[l.min,l.max];e.min=se(e.min,l.min=s[0]),e.max=re(e.max,l.max=s[1])}}w.setData=an;const pn={min:null,max:null};function mn(e,t){let l=t?ae[e].points:ae[e];l._stroke=l.stroke(w,e),l._fill=l.fill(w,e)}function gn(e,t){let l=t?ae[e].points:ae[e],{stroke:o,fill:i,clip:s,flags:r,_stroke:u=l._stroke,_fill:a=l._fill,_width:c=l.width}=l._paths;c=Ee(c*S,3);let f=null,d=c%2/2;t&&null==a&&(a=c>0?"#fff":u);let h=1==l.pxAlign&&d>0;if(h&&G.translate(d,d),!t){let e=qt-c/2,t=Qt-c/2,l=el+c,n=sl+c;f=new Path2D,f.rect(e,t,l,n)}t?xn(u,c,l.dash,l.cap,a,o,i,r,s):function(e,t,l,o,i,s,r,u,a,c,f){let d=!1;0!=a&&Se.forEach(((h,p)=>{if(h.series[0]==e){let e,m=ae[h.series[1]],g=n[h.series[1]],x=(m._paths||De).band;We(x)&&(x=1==h.dir?x[0]:x[1]);let v=null;m.show&&x&&function(e,t,l){for(t=K(t,0),l=K(l,e.length-1);t<=l;){if(null!=e[t])return!0;t++}return!1}(g,Cl,Il)?(v=h.fill(w,p)||s,e=m._paths.clip):x=null,xn(t,l,o,i,v,r,u,a,c,f,e,x),d=!0}})),d||xn(t,l,o,i,s,r,u,a,c,f)}(e,u,c,l.dash,l.cap,a,o,i,r,f,s),h&&G.translate(-d,-d)}function xn(e,t,l,n,o,i,s,r,u,a,c,f){fn(e,t,l,n,o),(u||a||f)&&(G.save(),u&&G.clip(u),a&&G.clip(a)),f?3==(3&r)?(G.clip(f),c&&G.clip(c),vn(o,s),wn(e,i,t)):2&r?(vn(o,s),G.clip(f),wn(e,i,t)):1&r&&(G.save(),G.clip(f),c&&G.clip(c),vn(o,s),G.restore(),wn(e,i,t)):(vn(o,s),wn(e,i,t)),(u||a||f)&&G.restore()}function wn(e,t,l){l>0&&(t instanceof Map?t.forEach(((e,t)=>{G.strokeStyle=Kl=t,G.stroke(e)})):null!=t&&e&&G.stroke(t))}function vn(e,t){t instanceof Map?t.forEach(((e,t)=>{G.fillStyle=Xl=t,G.fill(e)})):null!=t&&e&&G.fill(t)}function bn(e,t,l,n,o,i,s,r,u,a){let c=s%2/2;1==$&&G.translate(c,c),fn(r,s,u,a,r),G.beginPath();let f,d,h,p,m=o+(0==n||3==n?-i:i);0==l?(d=o,p=m):(f=o,h=m);for(let n=0;n{if(!l.show)return;let o=ke[l.scale];if(null==o.min)return void(l._show&&(t=!1,l._show=!1,_n(!1)));l._show||(t=!1,l._show=!0,_n(!1));let i=l.side,s=i%2,{min:r,max:u}=o,[a,c]=function(e,t,l,n){let o,i=xe[e];if(n<=0)o=[0,0];else{let s=i._space=i.space(w,e,t,l,n);o=Vl(t,l,i._incrs=i.incrs(w,e,t,l,n,s),n,s)}return i._found=o}(n,r,u,0==s?It:Ht);if(0==c)return;let f=2==o.distr,d=l._splits=l.splits(w,n,r,u,a,c,f),h=2==o.distr?d.map((e=>rn[e])):d,p=2==o.distr?rn[d[1]]-rn[d[0]]:a,m=l._values=l.values(w,l.filter(w,h,n,c,p),n,c,p);l._rotate=2==i?l.rotate(w,m,n,c):0;let g=l._size;l._size=ie(l.size(w,m,n,e)),null!=g&&l._size!=g&&(t=!1)})),t}function kn(e){let t=!0;return Pl.forEach(((l,n)=>{let o=l(w,n,Tl,e);o!=Dl[n]&&(t=!1),Dl[n]=o})),t}function _n(e){ae.forEach(((t,l)=>{l>0&&(t._paths=null,e&&(1==y?(t.min=null,t.max=null):t.facets.forEach((e=>{e.min=null,e.max=null}))))}))}let Mn,Sn,En,Tn,zn,Pn,Dn,An,Cn,Wn,In,Hn,Yn=!1,Rn=!1,On=[];function jn(){Rn=!1;for(let e=0;e0){ae.forEach(((t,l)=>{if(1==y){let o=t.scale,i=Ze[o];if(null==i)return;let s=e[o];if(0==l){let e=s.range(w,s.min,s.max,o);s.min=e[0],s.max=e[1],Cl=N(s.min,n[0]),Il=N(s.max,n[0]),Il-Cl>1&&(n[0][Cl]s.max&&Il--),t.min=rn[Cl],t.max=rn[Il]}else t.show&&t.auto&&hn(s,i,t,n[l],t.sorted);t.idxs[0]=Cl,t.idxs[1]=Il}else if(l>0&&t.show&&t.auto){let[o,i]=t.facets,s=o.scale,r=i.scale,[u,a]=n[l],c=e[s],f=e[r];null!=c&&hn(c,Ze[s],o,u,o.sorted),null!=f&&hn(f,Ze[r],i,a,i.sorted),t.min=i.min,t.max=i.max}}));for(let t in e){let l=e[t],n=Ze[t];if(null==l.from&&(null==n||null==n.min)){let e=l.range(w,l.min==he?null:l.min,l.max==-he?null:l.max,t);l.min=e[0],l.max=e[1]}}}for(let t in e){let l=e[t];if(null!=l.from){let n=e[l.from];if(null==n.min)l.min=l.max=null;else{let e=l.range(w,n.min,n.max,t);l.min=e[0],l.max=e[1]}}}let t={},l=!1;for(let n in e){let o=e[n],i=ke[n];if(i.min!=o.min||i.max!=o.max){i.min=o.min,i.max=o.max;let e=i.distr;i._min=3==e?ce(i.min):4==e?de(i.min,i.asinh):i.min,i._max=3==e?ce(i.max):4==e?de(i.max,i.asinh):i.max,t[n]=l=!0}}if(l){ae.forEach(((e,l)=>{2==y?l>0&&t.y&&(e._paths=null):t[e.scale]&&(e._paths=null)}));for(let e in t)fl=!0,To("setScale",e);wl.show&&wl.left>=0&&(dl=ml=!0)}for(let e in Ze)Ze[e]=null}(),ul=!1),fl&&(function(){let e=!1,t=0;for(;!e;){t++;let l=yn(t),n=kn(t);e=3==t||l&&n,e||(xl(w.width,w.height),al=!0)}}(),fl=!1),al){if(P(q,u,Yt),P(q,s,Rt),P(q,o,It),P(q,i,Ht),P(X,u,Yt),P(X,s,Rt),P(X,o,It),P(X,i,Ht),P(Z,o,Ct),P(Z,i,Wt),j.width=oe(Ct*S),j.height=oe(Wt*S),xe.forEach((({_el:t,_show:l,_size:n,_pos:o,side:i})=>{if(null!=t)if(l){let l=i%2==1;P(t,l?"left":"top",o-(3===i||0===i?n:0)),P(t,l?"width":"height",n),P(t,l?"top":"left",l?Rt:Yt),P(t,l?"height":"width",l?Ht:It),z(t,e)}else T(t,e)})),Kl=Xl=$l=en=tn=ln=nn=on=Ql=null,sn=1,fo(!0),Yt!=Ut||Rt!=Bt||It!=Vt||Ht!=Zt){_n(!1);let e=It/Vt,t=Ht/Zt;if(wl.show&&!dl&&wl.left>=0){wl.left*=e,wl.top*=t,En&&W(En,oe(wl.left),0,It,Ht),Tn&&W(Tn,0,oe(wl.top),It,Ht);for(let l=1;l<_l.length;l++)Ml[l]*=e,Sl[l]*=t,W(_l[l],Me(Ml[l],1),Me(Sl[l],1),It,Ht)}if(Zn.show&&!hl&&Zn.left>=0&&Zn.width>0){Zn.left*=e,Zn.width*=e,Zn.top*=t,Zn.height*=t;for(let e in mo)P(qn,e,Zn[e])}Ut=Yt,Bt=Rt,Vt=It,Zt=Ht}To("setSize"),al=!1}Ct>0&&Wt>0&&(G.clearRect(0,0,j.width,j.height),To("drawClear"),Oe.forEach((e=>e())),To("draw")),Zn.show&&hl&&(Jn(Zn),hl=!1),wl.show&&dl&&(ao(null,!0,!1),dl=!1),tt.show&&tt.live&&ml&&(ro(),ml=!1),Y||(Y=!0,w.status=1,To("ready")),un=!1,Yn=!1}function Nn(e,t){let l=ke[e];if(null==l.from){if(0==Al){let n=l.range(w,t.min,t.max,e);t.min=n[0],t.max=n[1]}if(t.min>t.max){let e=t.min;t.min=t.max,t.max=e}if(Al>1&&null!=t.min&&null!=t.max&&t.max-t.min<1e-16)return;e==Pe&&2==l.distr&&Al>0&&(t.min=N(t.min,n[0]),t.max=N(t.max,n[0]),t.min==t.max&&t.max++),Ze[e]=t,ul=!0,Ln()}}w.batch=function(e,t=!1){Yn=!0,Rn=t,e(w),Fn(),t&&On.length>0&&queueMicrotask(jn)},w.redraw=(e,t)=>{fl=t||!1,!1!==e?Kn(Pe,Ge.min,Ge.max):Ln()},w.setScale=Nn;let Gn=!1;const Un=wl.drag;let Bn=Un.x,Vn=Un.y;wl.show&&(wl.x&&(Mn=A("u-cursor-x",X)),wl.y&&(Sn=A("u-cursor-y",X)),0==Ge.ori?(En=Mn,Tn=Sn):(En=Sn,Tn=Mn),In=wl.left,Hn=wl.top);const Zn=w.select=Le({show:!0,over:!0,left:0,width:0,top:0,height:0},l.select),qn=Zn.show?A("u-select",Zn.over?X:q):null;function Jn(e,t){if(Zn.show){for(let t in e)Zn[t]=e[t],t in mo&&P(qn,t,e[t]);!1!==t&&To("setSelect")}}function Kn(e,t,l){Nn(e,{min:t,max:l})}function Xn(t,l,n,o){null!=l.focus&&function(e){if(e!=eo){let t=null==e,l=1!=yl.alpha;ae.forEach(((n,o)=>{if(1==y||o>0){let i=t||0==o||o==e;n._focus=t?null:i,l&&function(e,t){ae[e].alpha=t,wl.show&&_l[e]&&(_l[e].style.opacity=t),lt&&ct[e]&&(ct[e].style.opacity=t)}(o,i?1:yl.alpha)}})),eo=e,l&&Ln()}}(t),null!=l.show&&ae.forEach(((n,o)=>{o>0&&(t==o||null==t)&&(n.show=l.show,function(t,l){let n=ae[t],o=lt?ct[t]:null;n.show?o&&z(o,e):(o&&T(o,e),_l.length>1&&W(_l[t],-10,-10,It,Ht))}(o,l.show),2==y?(Kn(n.facets[0].scale,null,null),Kn(n.facets[1].scale,null,null)):Kn(n.scale,null,null),Ln())})),!1!==n&&To("setSeries",t,l),o&&Co("setSeries",w,t,l)}let $n,Qn,eo;w.setSelect=Jn,w.setSeries=Xn,w.addBand=function(e,t){e.fill=ge(e.fill||null),e.dir=K(e.dir,-1),t=null==t?Se.length:t,Se.splice(t,0,e)},w.setBand=function(e,t){Le(Se[e],t)},w.delBand=function(e){null==e?Se.length=0:Se.splice(e,1)};const to={focus:!0};function lo(e,t,l){let n=ke[t];l&&(e=e/S-(1==n.ori?Rt:Yt));let o=It;1==n.ori&&(o=Ht,e=o-e),-1==n.dir&&(e=o-e);let i=n._min,s=i+(n._max-i)*(e/o),r=n.distr;return 3==r?ue(10,s):4==r?((e,t=1)=>ee.sinh(e)*t)(s,n.asinh):s}function no(e,t){P(qn,u,Zn.left=e),P(qn,o,Zn.width=t)}function oo(e,t){P(qn,s,Zn.top=e),P(qn,i,Zn.height=t)}lt&&kl&&Pt(g,st,(e=>{wl._lock||(vl(e),null!=eo&&Xn(null,to,!0,Po.setSeries))})),w.valToIdx=e=>N(e,n[0]),w.posToIdx=function(e,t){return N(lo(e,Pe,t),n[0],Cl,Il)},w.posToVal=lo,w.valToPos=(e,t,l)=>0==ke[t].ori?E(e,ke[t],l?el:It,l?qt:0):C(e,ke[t],l?sl:Ht,l?Qt:0),w.setCursor=(e,t,l)=>{In=e.left,Hn=e.top,ao(null,t,l)};let io=0==Ge.ori?no:oo,so=1==Ge.ori?no:oo;function ro(e,t){null!=e&&(e.idxs?e.idxs.forEach(((e,t)=>{et[t]=e})):void 0!==e.idx&&et.fill(e.idx),tt.idx=et[0]);for(let e=0;e0||1==y&&!dt)&&uo(e,et[e]);lt&&tt.live&&function(){if(lt&&tt.live)for(let e=2==y?1:0;eIl;$n=he;let s=0==Ge.ori?It:Ht,r=1==Ge.ori?It:Ht;if(In<0||0==Al||i){o=wl.idx=null;for(let e=0;e0&&_l.length>1&&W(_l[e],-10,-10,It,Ht);kl&&Xn(null,to,!0,null==e&&Po.setSeries),tt.live&&(et.fill(o),ml=!0)}else{let e,t,l;1==y&&(e=0==Ge.ori?In:Hn,t=lo(e,Pe),o=wl.idx=N(t,n[0],Cl,Il),l=Be(n[0][o],Ge,s,0));for(let e=2==y?1:0;e0&&i.show){let t,l,n=null==f?-10:Ve(f,1==y?ke[i.scale]:ke[i.facets[1].scale],r,0);if(kl&&null!=f){let t=1==Ge.ori?In:Hn,l=le(yl.dist(w,e,c,n,t));if(l<$n){let n=yl.bias;if(0!=n){let o=lo(t,i.scale),s=o>=0?1:-1;s==(f>=0?1:-1)&&(1==s?1==n?f>=o:f<=o:1==n?f<=o:f>=o)&&($n=l,Qn=e)}else $n=l,Qn=e}}if(0==Ge.ori?(t=d,l=n):(t=n,l=d),ml&&_l.length>1){H(_l[e],wl.points.fill(w,e),wl.points.stroke(w,e));let n,o,i,s,r=!0,u=wl.points.bbox;if(null!=u){r=!1;let t=u(w,e);i=t.left,s=t.top,n=t.width,o=t.height}else i=t,s=l,n=o=wl.points.size(w,e);R(_l[e],n,o,r),Ml[e]=i,Sl[e]=s,W(_l[e],Me(i,1),Me(s,1),It,Ht)}}}}if(Zn.show&&Gn)if(null!=e){let[t,l]=Po.scales,[n,o]=Po.match,[i,u]=e.cursor.sync.scales,a=e.cursor.drag;if(Bn=a._x,Vn=a._y,Bn||Vn){let a,c,f,d,h,{left:p,top:m,width:g,height:x}=e.select,w=e.scales[t].ori,v=e.posToVal,b=null!=t&&n(t,i),y=null!=l&&o(l,u);b&&Bn?(0==w?(a=p,c=g):(a=m,c=x),f=ke[t],d=Be(v(a,i),f,s,0),h=Be(v(a+c,i),f,s,0),io(se(d,h),le(h-d))):io(0,s),y&&Vn?(1==w?(a=p,c=g):(a=m,c=x),f=ke[l],d=Ve(v(a,u),f,r,0),h=Ve(v(a+c,u),f,r,0),so(se(d,h),le(h-d))):so(0,r)}else go()}else{let e=le(Cn-zn),t=le(Wn-Pn);if(1==Ge.ori){let l=e;e=t,t=l}Bn=Un.x&&e>=Un.dist,Vn=Un.y&&t>=Un.dist;let l,n,o=Un.uni;null!=o?Bn&&Vn&&(Bn=e>=o,Vn=t>=o,Bn||Vn||(t>e?Vn=!0:Bn=!0)):Un.x&&Un.y&&(Bn||Vn)&&(Bn=Vn=!0),Bn&&(0==Ge.ori?(l=Dn,n=In):(l=An,n=Hn),io(se(l,n),le(n-l)),Vn||so(0,r)),Vn&&(1==Ge.ori?(l=Dn,n=In):(l=An,n=Hn),so(se(l,n),le(n-l)),Bn||io(0,s)),Bn||Vn||(io(0,0),so(0,0))}if(Un._x=Bn,Un._y=Vn,null==e){if(l){if(null!=Do){let[e,t]=Po.scales;Po.values[0]=null!=e?lo(0==Ge.ori?In:Hn,e):null,Po.values[1]=null!=t?lo(1==Ge.ori?In:Hn,t):null}Co(d,w,In,Hn,It,Ht,o)}if(kl){let e=l&&Po.setSeries,t=yl.prox;null==eo?$n<=t&&Xn(Qn,to,!0,e):$n>t?Xn(null,to,!0,e):Qn!=eo&&Xn(Qn,to,!0,e)}}ml&&(tt.idx=o,ro()),!1!==t&&To("setCursor")}w.setLegend=ro;let co=null;function fo(e=!1){e?co=null:(co=X.getBoundingClientRect(),To("syncRect",co))}function ho(e,t,l,n,o,i,s){wl._lock||Gn&&null!=e&&0==e.movementX&&0==e.movementY||(po(e,t,l,n,o,i,0,!1,null!=e),null!=e?ao(null,!0,!0):ao(t,!0,!1))}function po(e,t,l,n,o,i,s,r,u){if(null==co&&fo(!1),vl(e),null!=e)l=e.clientX-co.left,n=e.clientY-co.top;else{if(l<0||n<0)return In=-10,void(Hn=-10);let[e,s]=Po.scales,r=t.cursor.sync,[u,a]=r.values,[c,f]=r.scales,[d,h]=Po.match,p=t.axes[0].side%2==1,m=0==Ge.ori?It:Ht,g=1==Ge.ori?It:Ht,x=p?i:o,w=p?o:i,v=p?n:l,b=p?l:n;if(l=null!=c?d(e,c)?I(u,ke[e],m,0):-10:m*(v/x),n=null!=f?h(s,f)?I(a,ke[s],g,0):-10:g*(b/w),1==Ge.ori){let e=l;l=n,n=e}}u&&((l<=1||l>=It-1)&&(l=_e(l,It)),(n<=1||n>=Ht-1)&&(n=_e(n,Ht))),r?(zn=l,Pn=n,[Dn,An]=wl.move(w,l,n)):(In=l,Hn=n)}Object.defineProperty(w,"rect",{get:()=>(null==co&&fo(!1),co)});const mo={width:0,height:0,left:0,top:0};function go(){Jn(mo,!1)}let xo,wo,vo,bo;function yo(e,t,l,n,o,i,s){Gn=!0,Bn=Vn=Un._x=Un._y=!1,po(e,t,l,n,o,i,0,!0,!1),null!=e&&(Pt(p,k,ko,!1),Co(h,w,Dn,An,It,Ht,null));let{left:r,top:u,width:a,height:c}=Zn;xo=r,wo=u,vo=a,bo=c,go()}function ko(e,t,l,n,o,i,s){Gn=Un._x=Un._y=!1,po(e,t,l,n,o,i,0,!1,!0);let{left:r,top:u,width:a,height:c}=Zn,f=a>0||c>0,d=xo!=r||wo!=u||vo!=a||bo!=c;if(f&&d&&Jn(Zn),Un.setScale&&f&&d){let e=r,t=a,l=u,n=c;if(1==Ge.ori&&(e=u,t=c,l=r,n=a),Bn&&Kn(Pe,lo(e,Pe),lo(e+t,Pe)),Vn)for(let e in ke){let t=ke[e];e!=Pe&&null==t.from&&t.min!=he&&Kn(e,lo(l+n,e),lo(l,e))}go()}else wl.lock&&(wl._lock=!wl._lock,wl._lock||ao(null,!0,!1));null!=e&&(Dt(p,k),Co(p,w,In,Hn,It,Ht,null))}function _o(e,t,l,n,o,i,s){wl._lock||(vl(e),cn(),go(),null!=e&&Co(x,w,In,Hn,It,Ht,null))}function Mo(){xe.forEach(ql),gl(w.width,w.height,!0)}L(v,_,Mo);const So={};So.mousedown=yo,So.mousemove=ho,So.mouseup=ko,So.dblclick=_o,So.setSeries=(e,t,l,n)=>{-1!=(l=(0,Po.match[2])(w,t,l))&&Xn(l,n,!0,!1)},wl.show&&(Pt(h,X,yo),Pt(d,X,ho),Pt(m,X,(e=>{vl(e),fo(!1)})),Pt(g,X,(function(e,t,l,n,o,i,s){if(wl._lock)return;vl(e);let r=Gn;if(Gn){let e,t,l=!0,n=!0,o=10;0==Ge.ori?(e=Bn,t=Vn):(e=Vn,t=Bn),e&&t&&(l=In<=o||In>=It-o,n=Hn<=o||Hn>=Ht-o),e&&l&&(In=In{e.call(null,w,t,l)}))}(l.plugins||[]).forEach((e=>{for(let t in e.hooks)Eo[t]=(Eo[t]||[]).concat(e.hooks[t])}));const zo=(e,t,l)=>l,Po=Le({key:null,setSeries:!1,filters:{pub:be,sub:be},scales:[Pe,ae[1]?ae[1].scale:null],match:[ye,ye,zo],values:[null,null]},wl.sync);2==Po.match.length&&Po.match.push(zo),wl.sync=Po;const Do=Po.key,Ao=rl(Do);function Co(e,t,l,n,o,i,s){Po.filters.pub(e,t,l,n,o,i,s)&&Ao.pub(e,t,l,n,o,i,s)}function Wo(){To("init",l,n),an(n||l.data,!1),Ze[Pe]?Nn(Pe,Ze[Pe]):cn(),hl=Zn.show&&(Zn.width>0||Zn.height>0),dl=ml=!0,gl(l.width,l.height)}return Ao.sub(w),w.pub=function(e,t,l,n,o,i,s){Po.filters.sub(e,t,l,n,o,i,s)&&So[e](null,t,l,n,o,i,s)},w.destroy=function(){Ao.unsub(w),Wl.delete(w),zt.clear(),F(v,_,Mo),O.remove(),st?.remove(),To("destroy")},ae.forEach(El),xe.forEach((function(e,t){if(e._show=e.show,e.show){let l=e.side%2,n=ke[e.scale];null==n&&(e.scale=l?ae[1].scale:Pe,n=ke[e.scale]);let o=n.time;e.size=ge(e.size),e.space=ge(e.space),e.rotate=ge(e.rotate),We(e.incrs)&&e.incrs.forEach((e=>{!Te.has(e)&&Te.set(e,ze(e))})),e.incrs=ge(e.incrs||(2==n.distr?nt:o?1==ne?gt:vt:ot)),e.splits=ge(e.splits||(o&&1==n.distr?Ke:3==n.distr?Nt:4==n.distr?Gt:Ft)),e.stroke=ge(e.stroke),e.grid.stroke=ge(e.grid.stroke),e.ticks.stroke=ge(e.ticks.stroke),e.border.stroke=ge(e.border.stroke);let i=e.values;e.values=We(i)&&!We(i[0])?ge(i):o?We(i)?_t(qe,kt(i,Je)):He(i)?function(e,t){let l=Xe(t);return(t,n,o,i,s)=>n.map((t=>l(e(t))))}(qe,i):i||$e:i||Lt,e.filter=ge(e.filter||(n.distr>=3&&10==n.log?Jt:3==n.distr&&2==n.log?Kt:we)),e.font=Zl(e.font),e.labelFont=Zl(e.labelFont),e._size=e.size(w,null,t,0),e._space=e._rotate=e._incrs=e._found=e._splits=e._values=null,e._size>0&&(Tl[t]=!0,e._el=A("u-axis",Z))}})),c?c instanceof HTMLElement?(c.appendChild(O),Wo()):c(w,Wo):Wo(),w}Jl.assign=Le,Jl.fmtNum=Q,Jl.rangeNum=J,Jl.rangeLog=U,Jl.rangeAsinh=B,Jl.orient=ul,Jl.pxRatio=S,Jl.join=function(e,t){if(function(e){let t=e[0][0],l=t.length;for(let n=1;n=n&&null==e[o];)o--;if(o<=n)return!0;const i=re(1,ne((o-n+1)/t));for(let t=e[n],l=n+i;l<=o;l+=i){const n=e[l];if(null!=n){if(n<=t)return!1;t=n}}return!0}(t[0])||(t=function(e){let t=e[0],l=t.length,n=Array(l);for(let e=0;et[e]-t[l]));let o=[];for(let t=0;te-t))],o=n[0].length,i=new Map;for(let e=0;eul(e,i,((u,a,c,f,d,h,p,m,g,x,w)=>{let v=u.pxRound,{left:b,width:y}=e.bbox,k=e=>v(h(e,f,x,m)),_=e=>v(p(e,d,w,g)),M=0==f.ori?wl:vl;const E={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:1},T=E.stroke,z=f.dir*(0==f.ori?1:-1);s=G(c,s,r,1),r=G(c,s,r,-1);let P=_(c[1==z?s:r]),D=k(a[1==z?s:r]),A=D,C=D;o&&-1==t&&(C=b,M(T,C,P)),M(T,D,P);for(let e=1==z?s:r;e>=s&&e<=r;e+=z){let l=c[e];if(null==l)continue;let n=k(a[e]),o=_(l);1==t?M(T,n,P):M(T,A,o),M(T,n,o),P=o,A=n}let W=A;o&&1==t&&(W=b+y,M(T,W,P));let[I,H]=al(e,i);if(null!=u.fill||0!=I){let t=E.fill=new Path2D(T),l=_(u.fillTo(e,i,u.min,u.max,I));M(t,W,l),M(t,C,l)}if(!u.spanGaps){let o=[];o.push(...hl(a,c,s,r,z,k,n));let d=u.width*S/2,h=l||1==t?d:-d,p=l||-1==t?-d:d;o.forEach((e=>{e[0]+=h,e[1]+=p})),E.gaps=o=u.gaps(e,i,s,r,o),E.clip=dl(o,f.ori,m,g,x,w)}return 0!=H&&(E.band=2==H?[fl(e,i,s,r,T,-1),fl(e,i,s,r,T,1)]:fl(e,i,s,r,T,H)),E}))},e.bars=function(e){const t=K((e=e||De).size,[.6,he,1]),l=e.align||0,n=e.gap||0;let o=e.radius;o=null==o?[0,0]:"number"==typeof o?[o,0]:o;const i=ge(o),s=1-t[0],r=K(t[1],he),u=K(t[2],1),a=K(e.disp,De),c=K(e.each,(e=>{})),{fill:f,stroke:d}=a;return(e,t,o,h)=>ul(e,t,((p,m,g,x,w,v,b,y,k,_,M)=>{let E,T,z=p.pxRound,P=l,D=n*S,A=r*S,C=u*S;0==x.ori?[E,T]=i(e,t):[T,E]=i(e,t);const W=x.dir*(0==x.ori?1:-1);let I,H,Y,R=0==x.ori?bl:yl,O=0==x.ori?c:(e,t,l,n,o,i,s)=>{c(e,t,l,o,n,s,i)},j=K(e.bands,Ae).find((e=>e.series[0]==t)),L=null!=j?j.dir:0,F=p.fillTo(e,t,p.min,p.max,L),N=z(b(F,w,M,k)),G=_,U=z(p.width*S),B=!1,V=null,Z=null,q=null,J=null;null==f||0!=U&&null==d||(B=!0,V=f.values(e,t,o,h),Z=new Map,new Set(V).forEach((e=>{null!=e&&Z.set(e,new Path2D)})),U>0&&(q=d.values(e,t,o,h),J=new Map,new Set(q).forEach((e=>{null!=e&&J.set(e,new Path2D)}))));let{x0:X,size:$}=a;if(null!=X&&null!=$){P=1,m=X.values(e,t,o,h),2==X.unit&&(m=m.map((t=>e.posToVal(y+t*_,x.key,!0))));let l=$.values(e,t,o,h);H=2==$.unit?l[0]*_:v(l[0],x,_,y)-v(0,x,_,y),G=Al(m,g,v,x,_,y,G),Y=G-H+D}else G=Al(m,g,v,x,_,y,G),Y=G*s+D,H=G-Y;Y<1&&(Y=0),U>=H/2&&(U=0),Y<5&&(z=xe);let Q=Y>0;H=z(me(G-Y-(Q?U:0),C,A)),I=(0==P?H/2:P==W?0:H)-P*W*((0==P?D/2:0)+(Q?U/2:0));const ee={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},te=B?null:new Path2D;let le=null;if(null!=j)le=e.data[j.series[1]];else{let{y0:l,y1:n}=a;null!=l&&null!=n&&(g=n.values(e,t,o,h),le=l.values(e,t,o,h))}let oe=E*H,ie=T*H;for(let l=1==W?o:h;l>=o&&l<=h;l+=W){let n=g[l];if(null==n)continue;if(null!=le){let e=le[l]??0;if(n-e==0)continue;N=b(e,w,M,k)}let o=v(2!=x.distr||null!=a?m[l]:l,x,_,y),i=b(K(n,F),w,M,k),s=z(o-I),r=z(re(i,N)),u=z(se(i,N)),c=r-u;if(null!=n){let o=n<0?ie:oe,i=n<0?oe:ie;B?(U>0&&null!=q[l]&&R(J.get(q[l]),s,u+ne(U/2),H,re(0,c-U),o,i),null!=V[l]&&R(Z.get(V[l]),s,u+ne(U/2),H,re(0,c-U),o,i)):R(te,s,u+ne(U/2),H,re(0,c-U),o,i),O(e,t,l,s-U/2,u,H+U,c)}}return U>0?ee.stroke=B?J:te:B||(ee._fill=0==p.width?p._fill:p._stroke??p._fill,ee.width=0),ee.fill=B?Z:te,ee}))},e.spline=function(e){return function(e,t){const l=K(t?.alignGaps,0);return(t,n,o,i)=>ul(t,n,((s,r,u,a,c,f,d,h,p,m,g)=>{let x,w,v,b=s.pxRound,y=e=>b(f(e,a,m,h)),k=e=>b(d(e,c,g,p));0==a.ori?(x=gl,v=wl,w=Ml):(x=xl,v=vl,w=Sl);const _=a.dir*(0==a.ori?1:-1);o=G(u,o,i,1),i=G(u,o,i,-1);let M=y(r[1==_?o:i]),S=M,E=[],T=[];for(let e=1==_?o:i;e>=o&&e<=i;e+=_)if(null!=u[e]){let t=y(r[e]);E.push(S=t),T.push(k(u[e]))}const z={stroke:e(E,T,x,v,w,b),fill:null,clip:null,band:null,gaps:null,flags:1},P=z.stroke;let[D,A]=al(t,n);if(null!=s.fill||0!=D){let e=z.fill=new Path2D(P),l=k(s.fillTo(t,n,s.min,s.max,D));v(e,S,l),v(e,M,l)}if(!s.spanGaps){let e=[];e.push(...hl(r,u,o,i,_,y,l)),z.gaps=e=s.gaps(t,n,o,i,e),z.clip=dl(e,a.ori,h,p,m,g)}return 0!=A&&(z.band=2==A?[fl(t,n,o,i,P,-1),fl(t,n,o,i,P,1)]:fl(t,n,o,i,P,A)),z}))}(Cl,e)}}var Kl=l(379),Xl=l.n(Kl),$l=l(795),Ql=l.n($l),en=l(569),tn=l.n(en),ln=l(565),nn=l.n(ln),on=l(216),sn=l.n(on),rn=l(589),un=l.n(rn),an=l(350),cn={};function fn(e){var t,l=HTMLWidgets.find("#"+e);return void 0!==l&&(t=l.getWidget()),t}function dn(e,t){let l=[],n=[],o=e[0].length,i=Array(o);for(let e=0;ei[t]+=+e)));for(let l=1;ln>l&&!t(n))),l]});return n=n.filter((e=>e.series[1]>-1)),{data:[e[0]].concat(l),bands:n}}cn.styleTagTransform=un(),cn.setAttributes=nn(),cn.insert=tn().bind(null,"head"),cn.domAPI=Ql(),cn.insertStyleElement=sn(),Xl()(an.Z,cn),an.Z&&an.Z.locals&&an.Z.locals;const hn=e=>(t,l)=>{new ResizeObserver((e=>{for(let l of e){let e=l.contentRect.height,n=l.contentRect.width;const o=t.root.querySelectorAll(".u-legend, .u-title");for(let t of o)e-=Math.floor(t.offsetHeight);t.setSize({width:n,height:e})}})).observe(e),e.appendChild(t.root),l()},pn=(e,t,l,n)=>{const o=5*devicePixelRatio;return Jl.orient(e,t,((l,n,i,s,r,u,a,c,f,d,h,p,m,g,x)=>{let w=e.data[t];e.ctx.fillStyle=l.stroke();let v=2*Math.PI;console.time("points");let b=new Path2D;for(let e=0;e=s.min&&t<=s.max&&l>=r.min&&l<=r.max){let e=u(t,s,d,c),n=a(l,r,h,f);b.moveTo(e+o/2,n),x(b,e,n,o/2,0,v)}}console.timeEnd("points"),e.ctx.fill(b)})),null};HTMLWidgets.widget({name:"uPlot",type:"output",factory:function(e,t,l){var n,o,i;return{renderValue:function(s){void 0!==n&&n.destroy(),(o=s.config.options).width=t,o.height=l,i=s.config.data,s.stacked?(o.hooks||(o.hooks={}),o.hooks.init=[e=>{[...e.root.querySelectorAll(".u-legend .u-series")].forEach(((t,l)=>{e.series[l]._hide&&(t.style.display="none")}))}],n=function(e,t,l,n,o,i,s,r){let{opts:u,data:a}=function(e,t,l,n){let o=function(e,t){return{scales:{x:{time:!0}},series:t}}(0,t),i=dn(n?n(l):l,(e=>!1));return o.bands=i.bands,o.cursor=o.cursor||{},o.cursor.dataIdx=(e,t,n,o)=>null===l[t][n]?null:n,o.series.forEach((e=>{e.value=(e,t,n,o)=>l[n][o],e.points=e.points||{},e.points.filter=(e,t,n,o)=>{if(n){let e=[];return l[t].forEach(((t,l)=>{null!==t&&e.push(l)})),e}}})),o.scales.y={range:(e,t,l)=>{let n=uPlot.rangeNum(t,l,.1,!0);return[n[0],n[1]]}},o.hooks={setSeries:[(e,t)=>{let n=dn(l,(t=>!e.series[t].show));e.delBand(null),n.bands.forEach((t=>e.addBand(t))),e.setData(n.data)}]},{opts:o,data:i.data}}(0,t,l,n);return u.title=e,u.width=o,u.height=i,u.hooks=Object.assign(u.hooks,s),console.log(u),new uPlot(u,a,r)}(o.title,o.series,i,null,t,l,o.hooks,hn(e))):n=new Jl(o,i,hn(e))},getWidget:function(){return n},resize:function(e,t){}}}}),HTMLWidgets.shinyMode&&(Shiny.addCustomMessageHandler("uplot-api",(function(e){var t=fn(e.id);void 0!==t&&t[e.name].apply(null,e.args)})),Shiny.addCustomMessageHandler("uplot-setData",(function(e){var t=fn(e.id);void 0!==t&&t.setData(e.data)})))})();var o=window;for(var i in n)o[i]=n[i];n.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})(); \ No newline at end of file +(()=>{"use strict";var t={350:(t,e,n)=>{n.d(e,{Z:()=>a});var l=n(81),i=n.n(l),s=n(645),r=n.n(s)()(i());r.push([t.id,'.uplot, .uplot *, .uplot *::before, .uplot *::after {box-sizing: border-box;}.uplot {font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";line-height: 1.5;width: min-content;}.u-title {text-align: center;font-size: 18px;font-weight: bold;}.u-wrap {position: relative;user-select: none;}.u-over, .u-under {position: absolute;}.u-under {overflow: hidden;}.uplot canvas {display: block;position: relative;width: 100%;height: 100%;}.u-axis {position: absolute;}.u-legend {font-size: 14px;margin: auto;text-align: center;}.u-inline {display: block;}.u-inline * {display: inline-block;}.u-inline tr {margin-right: 16px;}.u-legend th {font-weight: 600;}.u-legend th > * {vertical-align: middle;display: inline-block;}.u-legend .u-marker {width: 1em;height: 1em;margin-right: 4px;background-clip: padding-box !important;}.u-inline.u-live th::after {content: ":";vertical-align: middle;}.u-inline:not(.u-live) .u-value {display: none;}.u-series > * {padding: 4px;}.u-series th {cursor: pointer;}.u-legend .u-off > * {opacity: 0.3;}.u-select {background: rgba(0,0,0,0.07);position: absolute;pointer-events: none;}.u-cursor-x, .u-cursor-y {position: absolute;left: 0;top: 0;pointer-events: none;will-change: transform;}.u-hz .u-cursor-x, .u-vt .u-cursor-y {height: 100%;border-right: 1px dashed #607D8B;}.u-hz .u-cursor-y, .u-vt .u-cursor-x {width: 100%;border-bottom: 1px dashed #607D8B;}.u-cursor-pt {position: absolute;top: 0;left: 0;border-radius: 50%;border: 0 solid;pointer-events: none;will-change: transform;/*this has to be !important since we set inline "background" shorthand */background-clip: padding-box !important;}.u-axis.u-off, .u-select.u-off, .u-cursor-x.u-off, .u-cursor-y.u-off, .u-cursor-pt.u-off {display: none;}',""]);const a=r},645:t=>{t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",l=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),l&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),l&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,l,i,s){"string"==typeof t&&(t=[[null,t,void 0]]);var r={};if(l)for(var a=0;a0?" ".concat(h[5]):""," {").concat(h[1],"}")),h[5]=s),n&&(h[2]?(h[1]="@media ".concat(h[2]," {").concat(h[1],"}"),h[2]=n):h[2]=n),i&&(h[4]?(h[1]="@supports (".concat(h[4],") {").concat(h[1],"}"),h[4]=i):h[4]="".concat(i)),e.push(h))}},e}},81:t=>{t.exports=function(t){return t[1]}},379:t=>{var e=[];function n(t){for(var n=-1,l=0;l{var e={};t.exports=function(t,n){var l=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!l)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");l.appendChild(n)}},216:t=>{t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},565:(t,e,n)=>{t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},795:t=>{t.exports=function(t){var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var l="";n.supports&&(l+="@supports (".concat(n.supports,") {")),n.media&&(l+="@media ".concat(n.media," {"));var i=void 0!==n.layer;i&&(l+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),l+=n.css,i&&(l+="}"),n.media&&(l+="}"),n.supports&&(l+="}");var s=n.sourceMap;s&&"undefined"!=typeof btoa&&(l+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),e.styleTagTransform(l,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},589:t=>{t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}}},e={};function n(l){var i=e[l];if(void 0!==i)return i.exports;var s=e[l]={id:l,exports:{}};return t[l](s,s.exports,n),s.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var l in e)n.o(e,l)&&!n.o(t,l)&&Object.defineProperty(t,l,{enumerable:!0,get:e[l]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.nc=void 0;var l={};(()=>{n.r(l),n.d(l,{drawPoints:()=>Or,uPlot:()=>Jn}),window.HTMLWidgets;const t="u-off",e="u-label",i="width",s="height",r="top",a="bottom",o="left",u="right",h="#000",d="#0000",c="mousemove",f="mousedown",_="mouseup",p="mouseenter",m="mouseleave",g="dblclick",w="change",b="dppxchange",v="--",x="undefined"!=typeof window,k=x?document:null,y=x?window:null,z=x?navigator:null;let E,A;function S(t,e){if(null!=e){let n=t.classList;!n.contains(e)&&n.add(e)}}function M(t,e){let n=t.classList;n.contains(e)&&n.remove(e)}function T(t,e,n){t.style[e]=n+"px"}function R(t,e,n,l){let i=k.createElement(t);return null!=e&&S(i,e),null!=n&&n.insertBefore(i,l),i}function D(t,e){return R("div",t,e)}const Z=new WeakMap;function U(e,n,l,i,s){let r="translate("+n+"px,"+l+"px)";r!=Z.get(e)&&(e.style.transform=r,Z.set(e,r),n<0||l<0||n>i||l>s?S(e,t):M(e,t))}const O=new WeakMap;function C(t,e,n){let l=e+n;l!=O.get(t)&&(O.set(t,l),t.style.background=e,t.style.borderColor=n)}const L=new WeakMap;function F(t,e,n,l){let i=e+""+n;i!=L.get(t)&&(L.set(t,i),t.style.height=n+"px",t.style.width=e+"px",t.style.marginLeft=l?-e/2+"px":0,t.style.marginTop=l?-n/2+"px":0)}const I={passive:!0},P={...I,capture:!0};function N(t,e,n,l){e.addEventListener(t,n,l?P:I)}function B(t,e,n,l){e.removeEventListener(t,n,l?P:I)}function H(t,e,n,l){let i;n=n||0;let s=(l=l||e.length-1)<=2147483647;for(;l-n>1;)i=s?n+l>>1:lt((n+l)/2),e[i]=e&&i<=n;i+=l)if(null!=t[i])return i;return-1}function Y(t,e,n,l){let i=ut(t),s=ut(e);t==e&&(-1==i?(t*=n,e/=n):(t/=n,e*=n));let r=10==n?ht:dt,a=1==s?st:lt,o=(1==i?lt:st)(r(nt(t))),u=a(r(nt(e))),h=ot(n,o),d=ot(n,u);return 10==n&&(o<0&&(h=At(h,-o)),u<0&&(d=At(d,-u))),l||2==n?(t=h*i,e=d*s):(t=Et(t,h),e=zt(e,d)),[t,e]}function j(t,e,n,l){let i=Y(t,e,n,l);return 0==t&&(i[0]=0),0==e&&(i[1]=0),i}x&&function t(){let e=devicePixelRatio;E!=e&&(E=e,A&&B(w,A,t),A=matchMedia(`(min-resolution: ${E-.001}dppx) and (max-resolution: ${E+.001}dppx)`),N(w,A,t),y.dispatchEvent(new CustomEvent(b)))}();const G={mode:3,pad:.1},K={pad:0,soft:null,mode:0},V={min:K,max:K};function q(t,e,n,l){return Lt(n)?X(t,e,n):(K.pad=n,K.soft=l?0:null,K.mode=l?3:0,X(t,e,V))}function J(t,e){return null==t?e:t}function X(t,e,n){let l=n.min,i=n.max,s=J(l.pad,0),r=J(i.pad,0),a=J(l.hard,-ft),o=J(i.hard,ft),u=J(l.soft,ft),h=J(i.soft,-ft),d=J(l.mode,0),c=J(i.mode,0),f=e-t,_=ht(f),p=at(nt(t),nt(e)),m=ht(p),g=nt(m-_);(f<1e-9||g>10)&&(f=0,0!=t&&0!=e||(f=1e-9,2==d&&u!=ft&&(s=0),2==c&&h!=-ft&&(r=0)));let w=f||p||1e3,b=ht(w),v=ot(10,lt(b)),x=At(Et(t-w*(0==f?0==t?.1:1:s),v/10),9),k=t>=u&&(1==d||3==d&&x<=u||2==d&&x>=u)?u:ft,y=at(a,x=k?k:rt(k,x)),z=At(zt(e+w*(0==f?0==e?.1:1:r),v/10),9),E=e<=h&&(1==c||3==c&&z>=h||2==c&&z<=h)?h:-ft,A=rt(o,z>E&&e<=E?E:at(E,z));return y==A&&0==y&&(A=100),[y,A]}const $=new Intl.NumberFormat(x?z.language:"en-US"),Q=t=>$.format(t),tt=Math,et=tt.PI,nt=tt.abs,lt=tt.floor,it=tt.round,st=tt.ceil,rt=tt.min,at=tt.max,ot=tt.pow,ut=tt.sign,ht=tt.log10,dt=tt.log2,ct=(t,e=1)=>tt.asinh(t/e),ft=1/0;function _t(t){return 1+(0|ht((t^t>>31)-(t>>31)))}function pt(t,e,n){return rt(at(t,e),n)}function mt(t){return"function"==typeof t?t:()=>t}const gt=t=>t,wt=(t,e)=>e,bt=t=>null,vt=t=>!0,xt=(t,e)=>t==e,kt=t=>At(t,14);function yt(t,e){return kt(At(kt(t/e))*e)}function zt(t,e){return kt(st(kt(t/e))*e)}function Et(t,e){return kt(lt(kt(t/e))*e)}function At(t,e=0){if(Ot(t))return t;let n=10**e,l=t*n*(1+Number.EPSILON);return it(l)/n}const St=new Map;function Mt(t){return((""+t).split(".")[1]||"").length}function Tt(t,e,n,l){let i=[],s=l.map(Mt);for(let r=e;r=0&&r>=0?0:e)+(r>=s[t]?0:s[t]),u=At(a,o);i.push(u),St.set(u,o)}}return i}const Rt={},Dt=[],Zt=[null,null],Ut=Array.isArray,Ot=Number.isInteger;function Ct(t){return"string"==typeof t}function Lt(t){let e=!1;if(null!=t){let n=t.constructor;e=null==n||n==Object}return e}function Ft(t){return null!=t&&"object"==typeof t}const It=Object.getPrototypeOf(Uint8Array);function Pt(t,e=Lt){let n;if(Ut(t)){let l=t.find((t=>null!=t));if(Ut(l)||e(l)){n=Array(t.length);for(let l=0;ls){for(l=r-1;l>=0&&null==t[l];)t[l--]=null;for(l=r+1;lPromise.resolve().then(t):queueMicrotask,Wt=["January","February","March","April","May","June","July","August","September","October","November","December"],Yt=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function jt(t){return t.slice(0,3)}const Gt=Yt.map(jt),Kt=Wt.map(jt),Vt={MMMM:Wt,MMM:Kt,WWWW:Yt,WWW:Gt};function qt(t){return(t<10?"0":"")+t}const Jt={YYYY:t=>t.getFullYear(),YY:t=>(t.getFullYear()+"").slice(2),MMMM:(t,e)=>e.MMMM[t.getMonth()],MMM:(t,e)=>e.MMM[t.getMonth()],MM:t=>qt(t.getMonth()+1),M:t=>t.getMonth()+1,DD:t=>qt(t.getDate()),D:t=>t.getDate(),WWWW:(t,e)=>e.WWWW[t.getDay()],WWW:(t,e)=>e.WWW[t.getDay()],HH:t=>qt(t.getHours()),H:t=>t.getHours(),h:t=>{let e=t.getHours();return 0==e?12:e>12?e-12:e},AA:t=>t.getHours()>=12?"PM":"AM",aa:t=>t.getHours()>=12?"pm":"am",a:t=>t.getHours()>=12?"p":"a",mm:t=>qt(t.getMinutes()),m:t=>t.getMinutes(),ss:t=>qt(t.getSeconds()),s:t=>t.getSeconds(),fff:t=>{return((e=t.getMilliseconds())<10?"00":e<100?"0":"")+e;var e}};function Xt(t,e){e=e||Vt;let n,l=[],i=/\{([a-z]+)\}|[^{]+/gi;for(;n=i.exec(t);)l.push("{"==n[0][0]?Jt[n[1]]:n[0]);return t=>{let n="";for(let i=0;it%1==0,te=[1,2,2.5,5],ee=Tt(10,-16,0,te),ne=Tt(10,0,16,te),le=ne.filter(Qt),ie=ee.concat(ne),se="{YYYY}",re="\n"+se,ae="{M}/{D}",oe="\n"+ae,ue=oe+"/{YY}",he="{aa}",de="{h}:{mm}"+he,ce="\n"+de,fe=":{ss}",_e=null;function pe(t){let e=1e3*t,n=60*e,l=60*n,i=24*l,s=30*i,r=365*i;return[(1==t?Tt(10,0,3,te).filter(Qt):Tt(10,-3,0,te)).concat([e,5*e,10*e,15*e,30*e,n,5*n,10*n,15*n,30*n,l,2*l,3*l,4*l,6*l,8*l,12*l,i,2*i,3*i,4*i,5*i,6*i,7*i,8*i,9*i,10*i,15*i,s,2*s,3*s,4*s,6*s,r,2*r,5*r,10*r,25*r,50*r,100*r]),[[r,se,_e,_e,_e,_e,_e,_e,1],[28*i,"{MMM}",re,_e,_e,_e,_e,_e,1],[i,ae,re,_e,_e,_e,_e,_e,1],[l,"{h}"+he,ue,_e,oe,_e,_e,_e,1],[n,de,ue,_e,oe,_e,_e,_e,1],[e,fe,ue+" "+de,_e,oe+" "+de,_e,ce,_e,1],[t,fe+".{fff}",ue+" "+de,_e,oe+" "+de,_e,ce,_e,1]],function(e){return(a,o,u,h,d,c)=>{let f=[],_=d>=r,p=d>=s&&d=i?i:d,r=b+(lt(u)-lt(g))+zt(g-b,s);f.push(r);let _=e(r),p=_.getHours()+_.getMinutes()/n+_.getSeconds()/l,m=d/l,w=c/a.axes[o]._space;for(;r=At(r+d,1==t?0:3),!(r>h);)if(m>1){let t=lt(At(p+m,6))%24,n=e(r).getHours()-t;n>1&&(n=-1),r-=n*l,p=(p+m)%24,At((r-f[f.length-1])/d,3)*w>=.7&&f.push(r)}else f.push(r)}return f}}]}const[me,ge,we]=pe(1),[be,ve,xe]=pe(.001);function ke(t,e){return t.map((t=>t.map(((n,l)=>0==l||8==l||null==n?n:e(1==l||0==t[8]?n:t[1]+n)))))}function ye(t,e){return(n,l,i,s,r)=>{let a,o,u,h,d,c,f=e.find((t=>r>=t[0]))||e[e.length-1];return l.map((e=>{let n=t(e),l=n.getFullYear(),i=n.getMonth(),s=n.getDate(),r=n.getHours(),_=n.getMinutes(),p=n.getSeconds(),m=l!=a&&f[2]||i!=o&&f[3]||s!=u&&f[4]||r!=h&&f[5]||_!=d&&f[6]||p!=c&&f[7]||f[1];return a=l,o=i,u=s,h=r,d=_,c=p,m(n)}))}}function ze(t,e,n){return new Date(t,e,n)}function Ee(t,e){return e(t)}function Ae(t,e){return(n,l,i,s)=>null==s?v:e(t(l))}Tt(2,-53,53,[1]);const Se={show:!0,live:!0,isolate:!1,mount:()=>{},markers:{show:!0,width:2,stroke:function(t,e){let n=t.series[e];return n.width?n.stroke(t,e):n.points.width?n.points.stroke(t,e):null},fill:function(t,e){return t.series[e].fill(t,e)},dash:"solid"},idx:null,idxs:null,values:[]},Me=[0,0];function Te(t,e,n,l=!0){return t=>{0==t.button&&(!l||t.target==e)&&n(t)}}function Re(t,e,n,l=!0){return t=>{(!l||t.target==e)&&n(t)}}const De={show:!0,x:!0,y:!0,lock:!1,move:function(t,e,n){return Me[0]=e,Me[1]=n,Me},points:{show:function(t,e){let n=t.cursor.points,l=D(),r=n.size(t,e);T(l,i,r),T(l,s,r);let a=r/-2;T(l,"marginLeft",a),T(l,"marginTop",a);let o=n.width(t,e,r);return o&&T(l,"borderWidth",o),l},size:function(t,e){return t.series[e].points.size},width:0,stroke:function(t,e){let n=t.series[e].points;return n._stroke||n._fill},fill:function(t,e){let n=t.series[e].points;return n._fill||n._stroke}},bind:{mousedown:Te,mouseup:Te,click:Te,dblclick:Te,mousemove:Re,mouseleave:Re,mouseenter:Re},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(t,e)=>{e.stopPropagation(),e.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(t,e,n,l,i)=>l-i,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},Ze={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},Ue=Nt({},Ze,{filter:wt}),Oe=Nt({},Ue,{size:10}),Ce=Nt({},Ze,{show:!1}),Le='12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',Fe="bold "+Le,Ie={show:!0,scale:"x",stroke:h,space:50,gap:5,size:50,labelGap:0,labelSize:30,labelFont:Fe,side:2,grid:Ue,ticks:Oe,border:Ce,font:Le,lineGap:1.5,rotate:0},Pe={show:!0,scale:"x",auto:!1,sorted:1,min:ft,max:-ft,idxs:[]};function Ne(t,e,n,l,i){return e.map((t=>null==t?"":Q(t)))}function Be(t,e,n,l,i,s,r){let a=[],o=St.get(i)||0;for(let t=n=r?n:At(zt(n,i),o);t<=l;t=At(t+i,o))a.push(Object.is(t,-0)?0:t);return a}function He(t,e,n,l,i,s,r){const a=[],o=t.scales[t.axes[e].scale].log,u=lt((10==o?ht:dt)(n));i=ot(o,u),10==o&&u<0&&(i=At(i,-u));let h=n;do{a.push(h),h+=i,10==o&&(h=At(h,St.get(i))),h>=i*o&&(i=h)}while(h<=l);return a}function We(t,e,n,l,i,s,r){let a=t.scales[t.axes[e].scale].asinh,o=l>a?He(t,e,at(a,n),l,i):[a],u=l>=0&&n<=0?[0]:[];return(n<-a?He(t,e,at(a,-l),-n,i):[a]).reverse().map((t=>-t)).concat(u,o)}const Ye=/./,je=/[12357]/,Ge=/[125]/,Ke=/1/,Ve=(t,e,n,l)=>t.map(((t,i)=>4==e&&0==t||i%l==0&&n.test(t.toExponential()[t<0?1:0])?t:null));function qe(t,e,n,l,i){let s=t.axes[n],r=s.scale,a=t.scales[r],o=t.valToPos,u=s._space,h=o(10,r),d=o(9,r)-h>=u?Ye:o(7,r)-h>=u?je:o(5,r)-h>=u?Ge:Ke;if(d==Ke){let t=nt(o(1,r)-h);if(ti,en={show:!0,auto:!0,sorted:0,gaps:tn,alpha:1,facets:[Nt({},Qe,{scale:"x"}),Nt({},Qe,{scale:"y"})]},nn={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:tn,alpha:1,points:{show:function(t,e){let{scale:n,idxs:l}=t.series[0],i=t._data[0],s=t.valToPos(i[l[0]],n,!0),r=t.valToPos(i[l[1]],n,!0),a=nt(r-s)/(t.series[e].points.space*E);return l[1]-l[0]<=a},filter:null},values:null,min:ft,max:-ft,idxs:[],path:null,clip:null};function ln(t,e,n,l,i){return n/10}const sn={time:!0,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},rn=Nt({},sn,{time:!1,ori:1}),an={};function on(t,e){let n=an[t];return n||(n={key:t,plots:[],sub(t){n.plots.push(t)},unsub(t){n.plots=n.plots.filter((e=>e!=t))},pub(t,e,l,i,s,r,a){for(let o=0;o{let p=t.pxRound;const m=a.dir*(0==a.ori?1:-1),g=0==a.ori?bn:vn;let w,b;1==m?(w=n,b=l):(w=l,b=n);let v=p(u(e[w],a,f,d)),x=p(h(r[w],o,_,c)),k=p(u(e[b],a,f,d)),y=p(h(1==s?o.max:o.min,o,_,c)),z=new Path2D(i);return g(z,k,y),g(z,v,y),g(z,v,x),z}))}function fn(t,e,n,l,i,s){let r=null;if(t.length>0){r=new Path2D;const a=0==e?xn:kn;let o=n;for(let e=0;en[0]){let t=n[0]-o;t>0&&a(r,o,l,t,l+s),o=n[1]}}let u=n+i-o,h=10;u>0&&a(r,o,l-h/2,u,l+s+h)}return r}function _n(t,e,n,l,i,s,r){let a=[],o=t.length;for(let u=1==i?n:l;u>=n&&u<=l;u+=i)if(null===e[u]){let h=u,d=u;if(1==i)for(;++u<=l&&null===e[u];)d=u;else for(;--u>=n&&null===e[u];)d=u;let c=s(t[h]),f=d==h?c:s(t[d]),_=h-i;c=r<=0&&_>=0&&_=0&&p>=0&&p=c&&a.push([c,f])}return a}function pn(t){return 0==t?gt:1==t?it:e=>yt(e,t)}function mn(t){let e=0==t?gn:wn,n=0==t?(t,e,n,l,i,s)=>{t.arcTo(e,n,l,i,s)}:(t,e,n,l,i,s)=>{t.arcTo(n,e,i,l,s)},l=0==t?(t,e,n,l,i)=>{t.rect(e,n,l,i)}:(t,e,n,l,i)=>{t.rect(n,e,i,l)};return(t,i,s,r,a,o=0,u=0)=>{0==o&&0==u?l(t,i,s,r,a):(o=rt(o,r/2,a/2),u=rt(u,r/2,a/2),e(t,i+o,s),n(t,i+r,s,i+r,s+a,o),n(t,i+r,s+a,i,s+a,u),n(t,i,s+a,i,s,u),n(t,i,s,i+r,s,o),t.closePath())}}const gn=(t,e,n)=>{t.moveTo(e,n)},wn=(t,e,n)=>{t.moveTo(n,e)},bn=(t,e,n)=>{t.lineTo(e,n)},vn=(t,e,n)=>{t.lineTo(n,e)},xn=mn(0),kn=mn(1),yn=(t,e,n,l,i,s)=>{t.arc(e,n,l,i,s)},zn=(t,e,n,l,i,s)=>{t.arc(n,e,l,i,s)},En=(t,e,n,l,i,s,r)=>{t.bezierCurveTo(e,n,l,i,s,r)},An=(t,e,n,l,i,s,r)=>{t.bezierCurveTo(n,e,i,l,r,s)};function Sn(t){return(t,e,n,l,i)=>un(t,e,((e,s,r,a,o,u,h,d,c,f,_)=>{let p,m,{pxRound:g,points:w}=e;0==a.ori?(p=gn,m=yn):(p=wn,m=zn);const b=At(w.width*E,3);let v=(w.size-w.width)/2*E,x=At(2*v,3),k=new Path2D,y=new Path2D,{left:z,top:A,width:S,height:M}=t.bbox;xn(y,z-x,A-x,S+2*x,M+2*x);const T=t=>{if(null!=r[t]){let e=g(u(s[t],a,f,d)),n=g(h(r[t],o,_,c));p(k,e+v,n),m(k,e,n,v,0,2*et)}};if(i)i.forEach(T);else for(let t=n;t<=l;t++)T(t);return{stroke:b>0?k:null,fill:k,clip:y,flags:3}}))}function Mn(t){return(e,n,l,i,s,r)=>{l!=i&&(s!=l&&r!=l&&t(e,n,l),s!=i&&r!=i&&t(e,n,i),t(e,n,r))}}const Tn=Mn(bn),Rn=Mn(vn);function Dn(t){const e=J(t?.alignGaps,0);return(t,n,l,i)=>un(t,n,((s,r,a,o,u,h,d,c,f,_,p)=>{let m,g,w=s.pxRound,b=t=>w(h(t,o,_,c)),v=t=>w(d(t,u,p,f));0==o.ori?(m=bn,g=Tn):(m=vn,g=Rn);const x=o.dir*(0==o.ori?1:-1),k={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:1},y=k.stroke;let z,E,A,S=ft,M=-ft,T=b(r[1==x?l:i]),R=W(a,l,i,1*x),D=W(a,l,i,-1*x),Z=b(r[R]),U=b(r[D]),O=!1;for(let t=1==x?l:i;t>=l&&t<=i;t+=x){let e=b(r[t]),n=a[t];e==T?null!=n?(E=v(n),S==ft&&(m(y,e,E),z=E),S=rt(E,S),M=at(E,M)):null===n&&(O=!0):(S!=ft&&(g(y,T,S,M,z,E),A=T),null!=n?(E=v(n),m(y,e,E),S=M=z=E):(S=ft,M=-ft,null===n&&(O=!0)),T=e)}S!=ft&&S!=M&&A!=T&&g(y,T,S,M,z,E);let[C,L]=hn(t,n);if(null!=s.fill||0!=C){let e=k.fill=new Path2D(y),l=v(s.fillTo(t,n,s.min,s.max,C));m(e,U,l),m(e,Z,l)}if(!s.spanGaps){let u=[];O&&u.push(..._n(r,a,l,i,x,b,e)),k.gaps=u=s.gaps(t,n,l,i,u),k.clip=fn(u,o.ori,c,f,_,p)}return 0!=L&&(k.band=2==L?[cn(t,n,l,i,y,-1),cn(t,n,l,i,y,1)]:cn(t,n,l,i,y,L)),k}))}function Zn(t,e,n,l,i,s,r=ft){if(t.length>1){let a=null;for(let o=0,u=1/0;o0!=l[t]>0?n[t]=0:(n[t]=3*(o[t-1]+o[t])/((2*o[t]+o[t-1])/l[t-1]+(o[t]+2*o[t-1])/l[t]),isFinite(n[t])||(n[t]=0));n[r-1]=l[r-2];for(let l=0;l{Jn.pxRatio=E})));const Ln=Dn(),Fn=Sn();function In(t,e,n,l){return(l?[t[0],t[1]].concat(t.slice(2)):[t[0]].concat(t.slice(1))).map(((t,l)=>Pn(t,l,e,n)))}function Pn(t,e,n,l){return Nt({},0==e?n:l,t)}function Nn(t,e,n){return null==e?Zt:[e,n]}const Bn=Nn;function Hn(t,e,n){return null==e?Zt:q(e,n,.1,!0)}function Wn(t,e,n,l){return null==e?Zt:Y(e,n,t.scales[l].log,!1)}const Yn=Wn;function jn(t,e,n,l){return null==e?Zt:j(e,n,t.scales[l].log,!1)}const Gn=jn;function Kn(t,e,n,l,i){let s=at(_t(t),_t(e)),r=e-t,a=H(i/l*r,n);do{let t=n[a],e=l*t/r;if(e>=i&&s+(t<5?St.get(t):0)<=17)return[t,e]}while(++a(e=it((n=+l)*E))+"px")),e,n]}function qn(t){t.show&&[t.font,t.labelFont].forEach((t=>{let e=At(t[2]*E,1);t[0]=t[0].replace(/[0-9.]+px/,e+"px"),t[1]=e}))}function Jn(n,l,h){const w={mode:J(n.mode,1)},x=w.mode;function z(t,e){return((3==e.distr?ht(t>0?t:e.clamp(w,t,e.min,e.max,e.key)):4==e.distr?ct(t,e.asinh):t)-e._min)/(e._max-e._min)}function A(t,e,n,l){let i=z(t,e);return l+n*(-1==e.dir?1-i:i)}function Z(t,e,n,l){let i=z(t,e);return l+n*(-1==e.dir?i:1-i)}function O(t,e,n,l){return 0==e.ori?A(t,e,n,l):Z(t,e,n,l)}w.valToPosH=A,w.valToPosV=Z;let L=!1;w.status=0;const I=w.root=D("uplot");null!=n.id&&(I.id=n.id),S(I,n.class),n.title&&(D("u-title",I).textContent=n.title);const P=R("canvas"),W=w.ctx=P.getContext("2d"),K=D("u-wrap",I);N("click",K,(t=>{t.target===X&&(Ol!=Rl||Cl!=Dl)&&Yl.click(w,t)}),!0);const V=w.under=D("u-under",K);K.appendChild(P);const X=w.over=D("u-over",K),$=+J((n=Pt(n)).pxAlign,1),Q=pn($);(n.plugins||[]).forEach((t=>{t.opts&&(n=t.opts(w,n)||n)}));const lt=n.ms||.001,ut=w.series=1==x?In(n.series||[],Pe,nn,!1):(dt=n.series||[null],_t=en,dt.map(((t,e)=>0==e?null:Nt({},_t,t))));var dt,_t;const gt=w.axes=In(n.axes||[],Ie,$e,!0),kt=w.scales={},Et=w.bands=n.bands||[];Et.forEach((t=>{t.fill=mt(t.fill||null),t.dir=J(t.dir,-1)}));const Tt=2==x?ut[1].facets[0].scale:ut[0].scale,Ot={axes:function(){for(let t=0;tal[t])):b,x=2==_.distr?al[b[1]]-al[b[0]]:c,k=e.ticks,y=e.border,z=k.show?it(k.size*E):0,A=e._rotate*-et/180,S=Q(e._pos*E),M=S+(z+g)*d;l=0==s?M:0,n=1==s?M:0,cl(e.font[0],h,1==e.align?o:2==e.align?u:A>0?o:A<0?u:0==s?"center":3==i?u:o,A||1==s?"middle":2==i?r:a);let T=e.font[1]*e.lineGap,R=b.map((t=>Q(O(t,_,p,m)))),D=e._values;for(let t=0;t0&&(ut.forEach(((t,e)=>{if(e>0&&t.show&&(pl(e,!1),pl(e,!0),null==t._paths)){rl!=t.alpha&&(W.globalAlpha=rl=t.alpha);let n=2==x?[0,l[e][0].length-1]:function(t){let e=pt(Un-1,0,Zn-1),n=pt(Cn+1,0,Zn-1);for(;null==t[e]&&e>0;)e--;for(;null==t[n]&&n{if(e>0&&t.show){rl!=t.alpha&&(W.globalAlpha=rl=t.alpha),null!=t._paths&&ml(e,!1);{let n=null!=t._paths?t._paths.gaps:null,l=t.points.show(w,e,Un,Cn,n),i=t.points.filter(w,e,l,n);(l||i)&&(t.points._paths=t.points.paths(w,e,Un,Cn,i),ml(e,!0))}1!=rl&&(W.globalAlpha=rl=1),Ai("drawSeries",e)}})))}},It=(n.drawOrder||["axes","series"]).map((t=>Ot[t]));function Bt(t){let e=kt[t];if(null==e){let l=(n.scales||Rt)[t]||Rt;if(null!=l.from)Bt(l.from),kt[t]=Nt({},kt[l.from],l,{key:t});else{e=kt[t]=Nt({},t==Tt?sn:rn,l),e.key=t;let n=e.time,i=e.range,s=Ut(i);if((t!=Tt||2==x&&!n)&&(!s||null!=i[0]&&null!=i[1]||(i={min:null==i[0]?G:{mode:1,hard:i[0],soft:i[0]},max:null==i[1]?G:{mode:1,hard:i[1],soft:i[1]}},s=!1),!s&&Lt(i))){let t=i;i=(e,n,l)=>null==n?Zt:q(n,l,t)}e.range=mt(i||(n?Bn:t==Tt?3==e.distr?Yn:4==e.distr?Gn:Nn:3==e.distr?Wn:4==e.distr?jn:Hn)),e.auto=mt(!s&&e.auto),e.clamp=mt(e.clamp||ln),e._min=e._max=null}}}Bt("x"),Bt("y"),1==x&&ut.forEach((t=>{Bt(t.scale)})),gt.forEach((t=>{Bt(t.scale)}));for(let t in n.scales)Bt(t);const Wt=kt[Tt],Yt=Wt.distr;let jt,Gt;0==Wt.ori?(S(I,"u-hz"),jt=A,Gt=Z):(S(I,"u-vt"),jt=Z,Gt=A);const Kt={};for(let t in kt){let e=kt[t];null==e.min&&null==e.max||(Kt[t]={min:e.min,max:e.max},e.min=e.max=null)}const Vt=n.tzDate||(t=>new Date(it(t/lt))),qt=n.fmtDate||Xt,Jt=1==lt?we(Vt):xe(Vt),$t=ye(Vt,ke(1==lt?ge:ve,qt)),Qt=Ae(Vt,Ee("{YYYY}-{MM}-{DD} {h}:{mm}{aa}",qt)),te=[],ee=w.legend=Nt({},Se,n.legend),ne=ee.show,se=ee.markers;let re,ae,oe;ee.idxs=te,se.width=mt(se.width),se.dash=mt(se.dash),se.stroke=mt(se.stroke),se.fill=mt(se.fill);let ue,he=[],de=[],ce=!1,fe={};if(ee.live){const t=ut[1]?ut[1].values:null;ce=null!=t,ue=ce?t(w,1,0):{_:0};for(let t in ue)fe[t]=v}if(ne)if(re=R("table","u-legend",I),oe=R("tbody",null,re),ee.mount(w,re),ce){ae=R("thead",null,re,oe);let t=R("tr",null,ae);for(var _e in R("th",null,t),ue)R("th",e,t).textContent=_e}else S(re,"u-inline"),ee.live&&S(re,"u-live");const pe={show:!0},ze={show:!1},Me=new Map;function Te(t,e,n,l=!0){const i=Me.get(e)||{},s=bn.bind[t](w,e,n,l);s&&(N(t,e,i[t]=s),Me.set(e,i))}function Re(t,e,n){const l=Me.get(e)||{};for(let n in l)null!=t&&n!=t||(B(n,e,l[n]),delete l[n]);null==t&&Me.delete(e)}let Ze=0,Ue=0,Oe=0,Ce=0,Le=0,Fe=0,Ye=Le,je=Fe,Ge=Oe,Ke=Ce,Ve=0,Qe=0,tn=0,an=0;w.bbox={};let un=!1,hn=!1,cn=!1,fn=!1,_n=!1,mn=!1;function gn(t,e,n){(n||t!=w.width||e!=w.height)&&wn(t,e),yl(!1),cn=!0,hn=!0,Nl()}function wn(t,e){w.width=Ze=Oe=t,w.height=Ue=Ce=e,Le=Fe=0,function(){let t=!1,e=!1,n=!1,l=!1;gt.forEach(((i,s)=>{if(i.show&&i._show){let{side:s,_size:r}=i,a=s%2,o=r+(null!=i.label?i.labelSize:0);o>0&&(a?(Oe-=o,3==s?(Le+=o,l=!0):n=!0):(Ce-=o,0==s?(Fe+=o,t=!0):e=!0))}})),Mn[0]=t,Mn[1]=n,Mn[2]=e,Mn[3]=l,Oe-=Dn[1]+Dn[3],Le+=Dn[3],Ce-=Dn[2]+Dn[0],Fe+=Dn[0]}(),function(){let t=Le+Oe,e=Fe+Ce,n=Le,l=Fe;function i(i,s){switch(i){case 1:return t+=s,t-s;case 2:return e+=s,e-s;case 3:return n-=s,n+s;case 0:return l-=s,l+s}}gt.forEach(((t,e)=>{if(t.show&&t._show){let e=t.side;t._pos=i(e,t._size),null!=t.label&&(t._lpos=i(e,t.labelSize))}}))}();let n=w.bbox;Ve=n.left=yt(Le*E,.5),Qe=n.top=yt(Fe*E,.5),tn=n.width=yt(Oe*E,.5),an=n.height=yt(Ce*E,.5)}w.setSize=function({width:t,height:e}){gn(t,e)};const bn=w.cursor=Nt({},De,{drag:{y:2==x}},n.cursor);if(null==bn.dataIdx){let t=bn.hover,e=t.skip=new Set(t.skip??[]);e.add(void 0);let n=t.prox=mt(t.prox),i=t.bias??=0;bn.dataIdx=(t,s,r,a)=>{if(0==s)return r;let o=r,u=n(t,s,r,a)??ft,h=u>=0&&u0;)e.has(_[t])||(n=t);if(0==i||1==i)for(t=r;null==l&&t++<_.length;)e.has(_[t])||(l=t);if(null!=n||null!=l)if(h){let t=c-(null==n?-1/0:jt(f[n],Wt,d,0)),e=(null==l?1/0:jt(f[l],Wt,d,0))-c;t<=e?t<=u&&(o=n):e<=u&&(o=l)}else o=null==l?n:null==n?l:r-n<=l-r?n:l}else h&&nt(c-jt(f[r],Wt,d,0))>u&&(o=null);return o}}const vn=t=>{bn.event=t};bn.idxs=te,bn._lock=!1;let xn=bn.points;xn.show=mt(xn.show),xn.size=mt(xn.size),xn.stroke=mt(xn.stroke),xn.width=mt(xn.width),xn.fill=mt(xn.fill);const kn=w.focus=Nt({},n.focus||{alpha:.3},bn.focus),yn=kn.prox>=0;let zn=[null],En=[null],An=[null];function Sn(n,l){if(1==x||l>0){let t=1==x&&kt[n.scale].time,e=n.value;n.value=t?Ct(e)?Ae(Vt,Ee(e,qt)):e||Qt:e||Xe,n.label=n.label||(t?"Time":"Value")}if(l>0){n.width=null==n.width?1:n.width,n.paths=n.paths||Ln||bt,n.fillTo=mt(n.fillTo||dn),n.pxAlign=+J(n.pxAlign,$),n.pxRound=pn(n.pxAlign),n.stroke=mt(n.stroke||null),n.fill=mt(n.fill||null),n._stroke=n._fill=n._paths=n._focus=null;let t=At(1*(3+2*(at(1,n.width)||1)),3),e=n.points=Nt({},{size:t,width:at(1,.2*t),stroke:n.stroke,space:2*t,paths:Fn,_stroke:null,_fill:null},n.points);e.show=mt(e.show),e.filter=mt(e.filter),e.fill=mt(e.fill),e.stroke=mt(e.stroke),e.paths=mt(e.paths),e.pxAlign=n.pxAlign}if(ne){let i=function(n,l){if(0==l&&(ce||!ee.live||2==x))return Zt;let i=[],s=R("tr","u-series",oe,oe.childNodes[l]);S(s,n.class),n.show||S(s,t);let r=R("th",null,s);if(se.show){let t=D("u-marker",r);if(l>0){let e=se.width(w,l);e&&(t.style.border=e+"px "+se.dash(w,l)+" "+se.stroke(w,l)),t.style.background=se.fill(w,l)}}let a=D(e,r);for(var o in a.textContent=n.label,l>0&&(se.show||(a.style.color=n.width>0?se.stroke(w,l):se.fill(w,l)),Te("click",r,(t=>{if(bn._lock)return;vn(t);let e=ut.indexOf(n);if((t.ctrlKey||t.metaKey)!=ee.isolate){let t=ut.some(((t,n)=>n>0&&n!=e&&t.show));ut.forEach(((n,l)=>{l>0&&Xl(l,t?l==e?pe:ze:pe,!0,Mi.setSeries)}))}else Xl(e,{show:!n.show},!0,Mi.setSeries)}),!1),yn&&Te(p,r,(t=>{bn._lock||(vn(t),Xl(ut.indexOf(n),ei,!0,Mi.setSeries))}),!1)),ue){let t=R("td","u-value",s);t.textContent="--",i.push(t)}return[s,i]}(n,l);he.splice(l,0,i[0]),de.splice(l,0,i[1]),ee.values.push(null)}if(bn.show){te.splice(l,0,null);let t=function(t,e){if(e>0){let n=bn.points.show(w,e);if(n)return S(n,"u-cursor-pt"),S(n,t.class),U(n,-10,-10,Oe,Ce),X.insertBefore(n,zn[e]),n}}(n,l);null!=t&&(zn.splice(l,0,t),En.splice(l,0,0),An.splice(l,0,0))}Ai("addSeries",l)}w.addSeries=function(t,e){e=null==e?ut.length:e,t=1==x?Pn(t,e,Pe,nn):Pn(t,e,null,en),ut.splice(e,0,t),Sn(ut[e],e)},w.delSeries=function(t){if(ut.splice(t,1),ne){ee.values.splice(t,1),de.splice(t,1);let e=he.splice(t,1)[0];Re(null,e.firstChild),e.remove()}bn.show&&(te.splice(t,1),zn.length>1&&(zn.splice(t,1)[0].remove(),En.splice(t,1),An.splice(t,1))),Ai("delSeries",t)};const Mn=[!1,!1,!1,!1];function Tn(t,e,n,l){let[i,s,r,a]=n,o=e%2,u=0;return 0==o&&(a||s)&&(u=0==e&&!i||2==e&&!r?it(Ie.size/3):0),1==o&&(i||r)&&(u=1==e&&!s||3==e&&!a?it($e.size/2):0),u}const Rn=w.padding=(n.padding||[Tn,Tn,Tn,Tn]).map((t=>mt(J(t,Tn)))),Dn=w._padding=Rn.map(((t,e)=>t(w,e,Mn,0)));let Zn,Un=null,Cn=null;const Jn=1==x?ut[0].idxs:null;let Xn,$n,Qn,tl,el,nl,ll,il,sl,rl,al=null,ol=!1;function ul(t,e){if(l=null==t?[]:t,w.data=w._data=l,2==x){Zn=0;for(let t=1;t=0,mn=!0,Nl()}}function hl(){let t,e;ol=!0,1==x&&(Zn>0?(Un=Jn[0]=0,Cn=Jn[1]=Zn-1,t=l[0][Un],e=l[0][Cn],2==Yt?(t=Un,e=Cn):t==e&&(3==Yt?[t,e]=Y(t,t,Wt.log,!1):4==Yt?[t,e]=j(t,t,Wt.log,!1):Wt.time?e=t+it(86400/lt):[t,e]=q(t,e,.1,!0))):(Un=Jn[0]=t=null,Cn=Jn[1]=e=null)),Jl(Tt,t,e)}function dl(t,e,n,l,i,s){t??=d,n??=Dt,l??="butt",i??=d,s??="round",t!=Xn&&(W.strokeStyle=Xn=t),i!=$n&&(W.fillStyle=$n=i),e!=Qn&&(W.lineWidth=Qn=e),s!=el&&(W.lineJoin=el=s),l!=nl&&(W.lineCap=nl=l),n!=tl&&W.setLineDash(tl=n)}function cl(t,e,n,l){e!=$n&&(W.fillStyle=$n=e),t!=ll&&(W.font=ll=t),n!=il&&(W.textAlign=il=n),l!=sl&&(W.textBaseline=sl=l)}function fl(t,e,n,l,i=0){if(l.length>0&&t.auto(w,ol)&&(null==e||null==e.min)){let e=J(Un,0),s=J(Cn,l.length-1),r=null==n.min?3==t.distr?function(t,e,n){let l=ft,i=-ft;for(let s=e;s<=n;s++){let e=t[s];null!=e&&e>0&&(ei&&(i=e))}return[l,i]}(l,e,s):function(t,e,n,l){let i=ft,s=-ft;if(1==l)i=t[e],s=t[n];else if(-1==l)i=t[n],s=t[e];else for(let l=e;l<=n;l++){let e=t[l];null!=e&&(es&&(s=e))}return[i,s]}(l,e,s,i):[n.min,n.max];t.min=rt(t.min,n.min=r[0]),t.max=at(t.max,n.max=r[1])}}w.setData=ul;const _l={min:null,max:null};function pl(t,e){let n=e?ut[t].points:ut[t];n._stroke=n.stroke(w,t),n._fill=n.fill(w,t)}function ml(t,e){let n=e?ut[t].points:ut[t],{stroke:i,fill:s,clip:r,flags:a,_stroke:o=n._stroke,_fill:u=n._fill,_width:h=n.width}=n._paths;h=At(h*E,3);let d=null,c=h%2/2;e&&null==u&&(u=h>0?"#fff":o);let f=1==n.pxAlign&&c>0;if(f&&W.translate(c,c),!e){let t=Ve-h/2,e=Qe-h/2,n=tn+h,l=an+h;d=new Path2D,d.rect(t,e,n,l)}e?gl(o,h,n.dash,n.cap,u,i,s,a,r):function(t,e,n,i,s,r,a,o,u,h,d){let c=!1;0!=u&&Et.forEach(((f,_)=>{if(f.series[0]==t){let t,p=ut[f.series[1]],m=l[f.series[1]],g=(p._paths||Rt).band;Ut(g)&&(g=1==f.dir?g[0]:g[1]);let b=null;p.show&&g&&function(t,e,n){for(e=J(e,0),n=J(n,t.length-1);e<=n;){if(null!=t[e])return!0;e++}return!1}(m,Un,Cn)?(b=f.fill(w,_)||r,t=p._paths.clip):g=null,gl(e,n,i,s,b,a,o,u,h,d,t,g),c=!0}})),c||gl(e,n,i,s,r,a,o,u,h,d)}(t,o,h,n.dash,n.cap,u,i,s,a,d,r),f&&W.translate(-c,-c)}function gl(t,e,n,l,i,s,r,a,o,u,h,d){dl(t,e,n,l,i),(o||u||d)&&(W.save(),o&&W.clip(o),u&&W.clip(u)),d?3==(3&a)?(W.clip(d),h&&W.clip(h),bl(i,r),wl(t,s,e)):2&a?(bl(i,r),W.clip(d),wl(t,s,e)):1&a&&(W.save(),W.clip(d),h&&W.clip(h),bl(i,r),W.restore(),wl(t,s,e)):(bl(i,r),wl(t,s,e)),(o||u||d)&&W.restore()}function wl(t,e,n){n>0&&(e instanceof Map?e.forEach(((t,e)=>{W.strokeStyle=Xn=e,W.stroke(t)})):null!=e&&t&&W.stroke(e))}function bl(t,e){e instanceof Map?e.forEach(((t,e)=>{W.fillStyle=$n=e,W.fill(t)})):null!=e&&t&&W.fill(e)}function vl(t,e,n,l,i,s,r,a,o,u){let h=r%2/2;1==$&&W.translate(h,h),dl(a,r,o,u,a),W.beginPath();let d,c,f,_,p=i+(0==l||3==l?-s:s);0==n?(c=i,_=p):(d=i,f=p);for(let l=0;l{if(!n.show)return;let i=kt[n.scale];if(null==i.min)return void(n._show&&(e=!1,n._show=!1,yl(!1)));n._show||(e=!1,n._show=!0,yl(!1));let s=n.side,r=s%2,{min:a,max:o}=i,[u,h]=function(t,e,n,l){let i,s=gt[t];if(l<=0)i=[0,0];else{let r=s._space=s.space(w,t,e,n,l);i=Kn(e,n,s._incrs=s.incrs(w,t,e,n,l,r),l,r)}return s._found=i}(l,a,o,0==r?Oe:Ce);if(0==h)return;let d=2==i.distr,c=n._splits=n.splits(w,l,a,o,u,h,d),f=2==i.distr?c.map((t=>al[t])):c,_=2==i.distr?al[c[1]]-al[c[0]]:u,p=n._values=n.values(w,n.filter(w,f,l,h,_),l,h,_);n._rotate=2==s?n.rotate(w,p,l,h):0;let m=n._size;n._size=st(n.size(w,p,l,t)),null!=m&&n._size!=m&&(e=!1)})),e}function kl(t){let e=!0;return Rn.forEach(((n,l)=>{let i=n(w,l,Mn,t);i!=Dn[l]&&(e=!1),Dn[l]=i})),e}function yl(t){ut.forEach(((e,n)=>{n>0&&(e._paths=null,t&&(1==x?(e.min=null,e.max=null):e.facets.forEach((t=>{t.min=null,t.max=null}))))}))}let zl,El,Al,Sl,Ml,Tl,Rl,Dl,Zl,Ul,Ol,Cl,Ll=!1,Fl=!1,Il=[];function Pl(){Fl=!1;for(let t=0;t0){ut.forEach(((e,n)=>{if(1==x){let i=e.scale,s=Kt[i];if(null==s)return;let r=t[i];if(0==n){let t=r.range(w,r.min,r.max,i);r.min=t[0],r.max=t[1],Un=H(r.min,l[0]),Cn=H(r.max,l[0]),Cn-Un>1&&(l[0][Un]r.max&&Cn--),e.min=al[Un],e.max=al[Cn]}else e.show&&e.auto&&fl(r,s,e,l[n],e.sorted);e.idxs[0]=Un,e.idxs[1]=Cn}else if(n>0&&e.show&&e.auto){let[i,s]=e.facets,r=i.scale,a=s.scale,[o,u]=l[n],h=t[r],d=t[a];null!=h&&fl(h,Kt[r],i,o,i.sorted),null!=d&&fl(d,Kt[a],s,u,s.sorted),e.min=s.min,e.max=s.max}}));for(let e in t){let n=t[e],l=Kt[e];if(null==n.from&&(null==l||null==l.min)){let t=n.range(w,n.min==ft?null:n.min,n.max==-ft?null:n.max,e);n.min=t[0],n.max=t[1]}}}for(let e in t){let n=t[e];if(null!=n.from){let l=t[n.from];if(null==l.min)n.min=n.max=null;else{let t=n.range(w,l.min,l.max,e);n.min=t[0],n.max=t[1]}}}let e={},n=!1;for(let l in t){let i=t[l],s=kt[l];if(s.min!=i.min||s.max!=i.max){s.min=i.min,s.max=i.max;let t=s.distr;s._min=3==t?ht(s.min):4==t?ct(s.min,s.asinh):s.min,s._max=3==t?ht(s.max):4==t?ct(s.max,s.asinh):s.max,e[l]=n=!0}}if(n){ut.forEach(((t,n)=>{2==x?n>0&&e.y&&(t._paths=null):e[t.scale]&&(t._paths=null)}));for(let t in e)cn=!0,Ai("setScale",t);bn.show&&bn.left>=0&&(fn=mn=!0)}for(let t in Kt)Kt[t]=null}(),un=!1),cn&&(function(){let t=!1,e=0;for(;!t;){e++;let n=xl(e),l=kl(e);t=3==e||n&&l,t||(wn(w.width,w.height),hn=!0)}}(),cn=!1),hn){if(T(V,o,Le),T(V,r,Fe),T(V,i,Oe),T(V,s,Ce),T(X,o,Le),T(X,r,Fe),T(X,i,Oe),T(X,s,Ce),T(K,i,Ze),T(K,s,Ue),P.width=it(Ze*E),P.height=it(Ue*E),gt.forEach((({_el:e,_show:n,_size:l,_pos:i,side:s})=>{if(null!=e)if(n){let n=s%2==1;T(e,n?"left":"top",i-(3===s||0===s?l:0)),T(e,n?"width":"height",l),T(e,n?"top":"left",n?Fe:Le),T(e,n?"height":"width",n?Ce:Oe),M(e,t)}else S(e,t)})),Xn=$n=Qn=el=nl=ll=il=sl=tl=null,rl=1,di(!0),Le!=Ye||Fe!=je||Oe!=Ge||Ce!=Ke){yl(!1);let t=Oe/Ge,e=Ce/Ke;if(bn.show&&!fn&&bn.left>=0){bn.left*=t,bn.top*=e,Al&&U(Al,it(bn.left),0,Oe,Ce),Sl&&U(Sl,0,it(bn.top),Oe,Ce);for(let n=1;n=0&&Kl.width>0){Kl.left*=t,Kl.width*=t,Kl.top*=e,Kl.height*=e;for(let t in _i)T(Vl,t,Kl[t])}Ye=Le,je=Fe,Ge=Oe,Ke=Ce}Ai("setSize"),hn=!1}Ze>0&&Ue>0&&(W.clearRect(0,0,P.width,P.height),Ai("drawClear"),It.forEach((t=>t())),Ai("draw")),Kl.show&&_n&&(ql(Kl),_n=!1),bn.show&&fn&&(ui(null,!0,!1),fn=!1),ee.show&&ee.live&&mn&&(ai(),mn=!1),L||(L=!0,w.status=1,Ai("ready")),ol=!1,Ll=!1}function Hl(t,e){let n=kt[t];if(null==n.from){if(0==Zn){let l=n.range(w,e.min,e.max,t);e.min=l[0],e.max=l[1]}if(e.min>e.max){let t=e.min;e.min=e.max,e.max=t}if(Zn>1&&null!=e.min&&null!=e.max&&e.max-e.min<1e-16)return;t==Tt&&2==n.distr&&Zn>0&&(e.min=H(e.min,l[0]),e.max=H(e.max,l[0]),e.min==e.max&&e.max++),Kt[t]=e,un=!0,Nl()}}w.batch=function(t,e=!1){Ll=!0,Fl=e,t(w),Bl(),e&&Il.length>0&&queueMicrotask(Pl)},w.redraw=(t,e)=>{cn=e||!1,!1!==t?Jl(Tt,Wt.min,Wt.max):Nl()},w.setScale=Hl;let Wl=!1;const Yl=bn.drag;let jl=Yl.x,Gl=Yl.y;bn.show&&(bn.x&&(zl=D("u-cursor-x",X)),bn.y&&(El=D("u-cursor-y",X)),0==Wt.ori?(Al=zl,Sl=El):(Al=El,Sl=zl),Ol=bn.left,Cl=bn.top);const Kl=w.select=Nt({show:!0,over:!0,left:0,width:0,top:0,height:0},n.select),Vl=Kl.show?D("u-select",Kl.over?X:V):null;function ql(t,e){if(Kl.show){for(let e in t)Kl[e]=t[e],e in _i&&T(Vl,e,t[e]);!1!==e&&Ai("setSelect")}}function Jl(t,e,n){Hl(t,{min:e,max:n})}function Xl(e,n,l,i){null!=n.focus&&function(t){if(t!=ti){let e=null==t,n=1!=kn.alpha;ut.forEach(((l,i)=>{if(1==x||i>0){let s=e||0==i||i==t;l._focus=e?null:s,n&&function(t,e){ut[t].alpha=e,bn.show&&zn[t]&&(zn[t].style.opacity=e),ne&&he[t]&&(he[t].style.opacity=e)}(i,s?1:kn.alpha)}})),ti=t,n&&Nl()}}(e),null!=n.show&&ut.forEach(((l,i)=>{i>0&&(e==i||null==e)&&(l.show=n.show,function(e,n){let l=ut[e],i=ne?he[e]:null;l.show?i&&M(i,t):(i&&S(i,t),zn.length>1&&U(zn[e],-10,-10,Oe,Ce))}(i,n.show),2==x?(Jl(l.facets[0].scale,null,null),Jl(l.facets[1].scale,null,null)):Jl(l.scale,null,null),Nl())})),!1!==l&&Ai("setSeries",e,n),i&&Di("setSeries",w,e,n)}let $l,Ql,ti;w.setSelect=ql,w.setSeries=Xl,w.addBand=function(t,e){t.fill=mt(t.fill||null),t.dir=J(t.dir,-1),e=null==e?Et.length:e,Et.splice(e,0,t)},w.setBand=function(t,e){Nt(Et[t],e)},w.delBand=function(t){null==t?Et.length=0:Et.splice(t,1)};const ei={focus:!0};function ni(t,e,n){let l=kt[e];n&&(t=t/E-(1==l.ori?Fe:Le));let i=Oe;1==l.ori&&(i=Ce,t=i-t),-1==l.dir&&(t=i-t);let s=l._min,r=s+(l._max-s)*(t/i),a=l.distr;return 3==a?ot(10,r):4==a?((t,e=1)=>tt.sinh(t)*e)(r,l.asinh):r}function li(t,e){T(Vl,o,Kl.left=t),T(Vl,i,Kl.width=e)}function ii(t,e){T(Vl,r,Kl.top=t),T(Vl,s,Kl.height=e)}ne&&yn&&Te(m,re,(t=>{bn._lock||(vn(t),null!=ti&&Xl(null,ei,!0,Mi.setSeries))})),w.valToIdx=t=>H(t,l[0]),w.posToIdx=function(t,e){return H(ni(t,Tt,e),l[0],Un,Cn)},w.posToVal=ni,w.valToPos=(t,e,n)=>0==kt[e].ori?A(t,kt[e],n?tn:Oe,n?Ve:0):Z(t,kt[e],n?an:Ce,n?Qe:0),w.setCursor=(t,e,n)=>{Ol=t.left,Cl=t.top,ui(null,e,n)};let si=0==Wt.ori?li:ii,ri=1==Wt.ori?li:ii;function ai(t,e){null!=t&&(t.idxs?t.idxs.forEach(((t,e)=>{te[e]=t})):void 0!==t.idx&&te.fill(t.idx),ee.idx=te[0]);for(let t=0;t0||1==x&&!ce)&&oi(t,te[t]);ne&&ee.live&&function(){if(ne&&ee.live)for(let t=2==x?1:0;tCn;$l=ft;let r=0==Wt.ori?Oe:Ce,a=1==Wt.ori?Oe:Ce;if(Ol<0||0==Zn||s){i=bn.idx=null;for(let t=0;t0&&zn.length>1&&U(zn[t],-10,-10,Oe,Ce);yn&&Xl(null,ei,!0,null==t&&Mi.setSeries),ee.live&&(te.fill(i),mn=!0)}else{let t,e,n;1==x&&(t=0==Wt.ori?Ol:Cl,e=ni(t,Tt),i=bn.idx=H(e,l[0],Un,Cn),n=jt(l[0][i],Wt,r,0));for(let t=2==x?1:0;t0&&s.show){let e,n,l=null==d?-10:Gt(d,1==x?kt[s.scale]:kt[s.facets[1].scale],a,0);if(yn&&null!=d){let e=1==Wt.ori?Ol:Cl,n=nt(kn.dist(w,t,h,l,e));if(n<$l){let l=kn.bias;if(0!=l){let i=ni(e,s.scale),r=i>=0?1:-1;r==(d>=0?1:-1)&&(1==r?1==l?d>=i:d<=i:1==l?d<=i:d>=i)&&($l=n,Ql=t)}else $l=n,Ql=t}}if(0==Wt.ori?(e=c,n=l):(e=l,n=c),mn&&zn.length>1){C(zn[t],bn.points.fill(w,t),bn.points.stroke(w,t));let l,i,s,r,a=!0,o=bn.points.bbox;if(null!=o){a=!1;let e=o(w,t);s=e.left,r=e.top,l=e.width,i=e.height}else s=e,r=n,l=i=bn.points.size(w,t);F(zn[t],l,i,a),En[t]=s,An[t]=r,U(zn[t],zt(s,1),zt(r,1),Oe,Ce)}}}}if(Kl.show&&Wl)if(null!=t){let[e,n]=Mi.scales,[l,i]=Mi.match,[s,o]=t.cursor.sync.scales,u=t.cursor.drag;if(jl=u._x,Gl=u._y,jl||Gl){let u,h,d,c,f,{left:_,top:p,width:m,height:g}=t.select,w=t.scales[e].ori,b=t.posToVal,v=null!=e&&l(e,s),x=null!=n&&i(n,o);v&&jl?(0==w?(u=_,h=m):(u=p,h=g),d=kt[e],c=jt(b(u,s),d,r,0),f=jt(b(u+h,s),d,r,0),si(rt(c,f),nt(f-c))):si(0,r),x&&Gl?(1==w?(u=_,h=m):(u=p,h=g),d=kt[n],c=Gt(b(u,o),d,a,0),f=Gt(b(u+h,o),d,a,0),ri(rt(c,f),nt(f-c))):ri(0,a)}else pi()}else{let t=nt(Zl-Ml),e=nt(Ul-Tl);if(1==Wt.ori){let n=t;t=e,e=n}jl=Yl.x&&t>=Yl.dist,Gl=Yl.y&&e>=Yl.dist;let n,l,i=Yl.uni;null!=i?jl&&Gl&&(jl=t>=i,Gl=e>=i,jl||Gl||(e>t?Gl=!0:jl=!0)):Yl.x&&Yl.y&&(jl||Gl)&&(jl=Gl=!0),jl&&(0==Wt.ori?(n=Rl,l=Ol):(n=Dl,l=Cl),si(rt(n,l),nt(l-n)),Gl||ri(0,a)),Gl&&(1==Wt.ori?(n=Rl,l=Ol):(n=Dl,l=Cl),ri(rt(n,l),nt(l-n)),jl||si(0,r)),jl||Gl||(si(0,0),ri(0,0))}if(Yl._x=jl,Yl._y=Gl,null==t){if(n){if(null!=Ti){let[t,e]=Mi.scales;Mi.values[0]=null!=t?ni(0==Wt.ori?Ol:Cl,t):null,Mi.values[1]=null!=e?ni(1==Wt.ori?Ol:Cl,e):null}Di(c,w,Ol,Cl,Oe,Ce,i)}if(yn){let t=n&&Mi.setSeries,e=kn.prox;null==ti?$l<=e&&Xl(Ql,ei,!0,t):$l>e?Xl(null,ei,!0,t):Ql!=ti&&Xl(Ql,ei,!0,t)}}mn&&(ee.idx=i,ai()),!1!==e&&Ai("setCursor")}w.setLegend=ai;let hi=null;function di(t=!1){t?hi=null:(hi=X.getBoundingClientRect(),Ai("syncRect",hi))}function ci(t,e,n,l,i,s,r){bn._lock||Wl&&null!=t&&0==t.movementX&&0==t.movementY||(fi(t,e,n,l,i,s,0,!1,null!=t),null!=t?ui(null,!0,!0):ui(e,!0,!1))}function fi(t,e,n,l,i,s,r,a,o){if(null==hi&&di(!1),vn(t),null!=t)n=t.clientX-hi.left,l=t.clientY-hi.top;else{if(n<0||l<0)return Ol=-10,void(Cl=-10);let[t,r]=Mi.scales,a=e.cursor.sync,[o,u]=a.values,[h,d]=a.scales,[c,f]=Mi.match,_=e.axes[0].side%2==1,p=0==Wt.ori?Oe:Ce,m=1==Wt.ori?Oe:Ce,g=_?s:i,w=_?i:s,b=_?l:n,v=_?n:l;if(n=null!=h?c(t,h)?O(o,kt[t],p,0):-10:p*(b/g),l=null!=d?f(r,d)?O(u,kt[r],m,0):-10:m*(v/w),1==Wt.ori){let t=n;n=l,l=t}}o&&((n<=1||n>=Oe-1)&&(n=yt(n,Oe)),(l<=1||l>=Ce-1)&&(l=yt(l,Ce))),a?(Ml=n,Tl=l,[Rl,Dl]=bn.move(w,n,l)):(Ol=n,Cl=l)}Object.defineProperty(w,"rect",{get:()=>(null==hi&&di(!1),hi)});const _i={width:0,height:0,left:0,top:0};function pi(){ql(_i,!1)}let mi,gi,wi,bi;function vi(t,e,n,l,i,s,r){Wl=!0,jl=Gl=Yl._x=Yl._y=!1,fi(t,e,n,l,i,s,0,!0,!1),null!=t&&(Te(_,k,xi,!1),Di(f,w,Rl,Dl,Oe,Ce,null));let{left:a,top:o,width:u,height:h}=Kl;mi=a,gi=o,wi=u,bi=h,pi()}function xi(t,e,n,l,i,s,r){Wl=Yl._x=Yl._y=!1,fi(t,e,n,l,i,s,0,!1,!0);let{left:a,top:o,width:u,height:h}=Kl,d=u>0||h>0,c=mi!=a||gi!=o||wi!=u||bi!=h;if(d&&c&&ql(Kl),Yl.setScale&&d&&c){let t=a,e=u,n=o,l=h;if(1==Wt.ori&&(t=o,e=h,n=a,l=u),jl&&Jl(Tt,ni(t,Tt),ni(t+e,Tt)),Gl)for(let t in kt){let e=kt[t];t!=Tt&&null==e.from&&e.min!=ft&&Jl(t,ni(n+l,t),ni(n,t))}pi()}else bn.lock&&(bn._lock=!bn._lock,bn._lock||ui(null,!0,!1));null!=t&&(Re(_,k),Di(_,w,Ol,Cl,Oe,Ce,null))}function ki(t,e,n,l,i,s,r){bn._lock||(vn(t),hl(),pi(),null!=t&&Di(g,w,Ol,Cl,Oe,Ce,null))}function yi(){gt.forEach(qn),gn(w.width,w.height,!0)}N(b,y,yi);const zi={};zi.mousedown=vi,zi.mousemove=ci,zi.mouseup=xi,zi.dblclick=ki,zi.setSeries=(t,e,n,l)=>{-1!=(n=(0,Mi.match[2])(w,e,n))&&Xl(n,l,!0,!1)},bn.show&&(Te(f,X,vi),Te(c,X,ci),Te(p,X,(t=>{vn(t),di(!1)})),Te(m,X,(function(t,e,n,l,i,s,r){if(bn._lock)return;vn(t);let a=Wl;if(Wl){let t,e,n=!0,l=!0,i=10;0==Wt.ori?(t=jl,e=Gl):(t=Gl,e=jl),t&&e&&(n=Ol<=i||Ol>=Oe-i,l=Cl<=i||Cl>=Ce-i),t&&n&&(Ol=Ol{t.call(null,w,e,n)}))}(n.plugins||[]).forEach((t=>{for(let e in t.hooks)Ei[e]=(Ei[e]||[]).concat(t.hooks[e])}));const Si=(t,e,n)=>n,Mi=Nt({key:null,setSeries:!1,filters:{pub:vt,sub:vt},scales:[Tt,ut[1]?ut[1].scale:null],match:[xt,xt,Si],values:[null,null]},bn.sync);2==Mi.match.length&&Mi.match.push(Si),bn.sync=Mi;const Ti=Mi.key,Ri=on(Ti);function Di(t,e,n,l,i,s,r){Mi.filters.pub(t,e,n,l,i,s,r)&&Ri.pub(t,e,n,l,i,s,r)}function Zi(){Ai("init",n,l),ul(l||n.data,!1),Kt[Tt]?Hl(Tt,Kt[Tt]):hl(),_n=Kl.show&&(Kl.width>0||Kl.height>0),fn=mn=!0,gn(n.width,n.height)}return Ri.sub(w),w.pub=function(t,e,n,l,i,s,r){Mi.filters.sub(t,e,n,l,i,s,r)&&zi[t](null,e,n,l,i,s,r)},w.destroy=function(){Ri.unsub(w),On.delete(w),Me.clear(),B(b,y,yi),I.remove(),re?.remove(),Ai("destroy")},ut.forEach(Sn),gt.forEach((function(t,e){if(t._show=t.show,t.show){let n=t.side%2,l=kt[t.scale];null==l&&(t.scale=n?ut[1].scale:Tt,l=kt[t.scale]);let i=l.time;t.size=mt(t.size),t.space=mt(t.space),t.rotate=mt(t.rotate),Ut(t.incrs)&&t.incrs.forEach((t=>{!St.has(t)&&St.set(t,Mt(t))})),t.incrs=mt(t.incrs||(2==l.distr?le:i?1==lt?me:be:ie)),t.splits=mt(t.splits||(i&&1==l.distr?Jt:3==l.distr?He:4==l.distr?We:Be)),t.stroke=mt(t.stroke),t.grid.stroke=mt(t.grid.stroke),t.ticks.stroke=mt(t.ticks.stroke),t.border.stroke=mt(t.border.stroke);let s=t.values;t.values=Ut(s)&&!Ut(s[0])?mt(s):i?Ut(s)?ye(Vt,ke(s,qt)):Ct(s)?function(t,e){let n=Xt(e);return(e,l,i,s,r)=>l.map((e=>n(t(e))))}(Vt,s):s||$t:s||Ne,t.filter=mt(t.filter||(l.distr>=3&&10==l.log?qe:3==l.distr&&2==l.log?Je:wt)),t.font=Vn(t.font),t.labelFont=Vn(t.labelFont),t._size=t.size(w,null,e,0),t._space=t._rotate=t._incrs=t._found=t._splits=t._values=null,t._size>0&&(Mn[e]=!0,t._el=D("u-axis",K))}})),h?h instanceof HTMLElement?(h.appendChild(I),Zi()):h(w,Zi):Zi(),w}Jn.assign=Nt,Jn.fmtNum=Q,Jn.rangeNum=q,Jn.rangeLog=Y,Jn.rangeAsinh=j,Jn.orient=un,Jn.pxRatio=E,Jn.join=function(t,e){if(function(t){let e=t[0][0],n=e.length;for(let l=1;l=l&&null==t[i];)i--;if(i<=l)return!0;const s=at(1,lt((i-l+1)/e));for(let e=t[l],n=l+s;n<=i;n+=s){const l=t[n];if(null!=l){if(l<=e)return!1;e=l}}return!0}(e[0])||(e=function(t){let e=t[0],n=e.length,l=Array(n);for(let t=0;te[t]-e[n]));let i=[];for(let e=0;et-e))],i=l[0].length,s=new Map;for(let t=0;tun(t,s,((o,u,h,d,c,f,_,p,m,g,w)=>{let b=o.pxRound,{left:v,width:x}=t.bbox,k=t=>b(f(t,d,g,p)),y=t=>b(_(t,c,w,m)),z=0==d.ori?bn:vn;const A={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:1},S=A.stroke,M=d.dir*(0==d.ori?1:-1);r=W(h,r,a,1),a=W(h,r,a,-1);let T=y(h[1==M?r:a]),R=k(u[1==M?r:a]),D=R,Z=R;i&&-1==e&&(Z=v,z(S,Z,T)),z(S,R,T);for(let t=1==M?r:a;t>=r&&t<=a;t+=M){let n=h[t];if(null==n)continue;let l=k(u[t]),i=y(n);1==e?z(S,l,T):z(S,D,i),z(S,l,i),T=i,D=l}let U=D;i&&1==e&&(U=v+x,z(S,U,T));let[O,C]=hn(t,s);if(null!=o.fill||0!=O){let e=A.fill=new Path2D(S),n=y(o.fillTo(t,s,o.min,o.max,O));z(e,U,n),z(e,Z,n)}if(!o.spanGaps){let i=[];i.push(..._n(u,h,r,a,M,k,l));let c=o.width*E/2,f=n||1==e?c:-c,_=n||-1==e?-c:c;i.forEach((t=>{t[0]+=f,t[1]+=_})),A.gaps=i=o.gaps(t,s,r,a,i),A.clip=fn(i,d.ori,p,m,g,w)}return 0!=C&&(A.band=2==C?[cn(t,s,r,a,S,-1),cn(t,s,r,a,S,1)]:cn(t,s,r,a,S,C)),A}))},t.bars=function(t){const e=J((t=t||Rt).size,[.6,ft,1]),n=t.align||0,l=t.gap||0;let i=t.radius;i=null==i?[0,0]:"number"==typeof i?[i,0]:i;const s=mt(i),r=1-e[0],a=J(e[1],ft),o=J(e[2],1),u=J(t.disp,Rt),h=J(t.each,(t=>{})),{fill:d,stroke:c}=u;return(t,e,i,f)=>un(t,e,((_,p,m,g,w,b,v,x,k,y,z)=>{let A,S,M=_.pxRound,T=n,R=l*E,D=a*E,Z=o*E;0==g.ori?[A,S]=s(t,e):[S,A]=s(t,e);const U=g.dir*(0==g.ori?1:-1);let O,C,L,F=0==g.ori?xn:kn,I=0==g.ori?h:(t,e,n,l,i,s,r)=>{h(t,e,n,i,l,r,s)},P=J(t.bands,Dt).find((t=>t.series[0]==e)),N=null!=P?P.dir:0,B=_.fillTo(t,e,_.min,_.max,N),H=M(v(B,w,z,k)),W=y,Y=M(_.width*E),j=!1,G=null,K=null,V=null,q=null;null==d||0!=Y&&null==c||(j=!0,G=d.values(t,e,i,f),K=new Map,new Set(G).forEach((t=>{null!=t&&K.set(t,new Path2D)})),Y>0&&(V=c.values(t,e,i,f),q=new Map,new Set(V).forEach((t=>{null!=t&&q.set(t,new Path2D)}))));let{x0:X,size:$}=u;if(null!=X&&null!=$){T=1,p=X.values(t,e,i,f),2==X.unit&&(p=p.map((e=>t.posToVal(x+e*y,g.key,!0))));let n=$.values(t,e,i,f);C=2==$.unit?n[0]*y:b(n[0],g,y,x)-b(0,g,y,x),W=Zn(p,m,b,g,y,x,W),L=W-C+R}else W=Zn(p,m,b,g,y,x,W),L=W*r+R,C=W-L;L<1&&(L=0),Y>=C/2&&(Y=0),L<5&&(M=gt);let Q=L>0;C=M(pt(W-L-(Q?Y:0),Z,D)),O=(0==T?C/2:T==U?0:C)-T*U*((0==T?R/2:0)+(Q?Y/2:0));const tt={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},et=j?null:new Path2D;let nt=null;if(null!=P)nt=t.data[P.series[1]];else{let{y0:n,y1:l}=u;null!=n&&null!=l&&(m=l.values(t,e,i,f),nt=n.values(t,e,i,f))}let it=A*C,st=S*C;for(let n=1==U?i:f;n>=i&&n<=f;n+=U){let l=m[n];if(null==l)continue;if(null!=nt){let t=nt[n]??0;if(l-t==0)continue;H=v(t,w,z,k)}let i=b(2!=g.distr||null!=u?p[n]:n,g,y,x),s=v(J(l,B),w,z,k),r=M(i-O),a=M(at(s,H)),o=M(rt(s,H)),h=a-o;if(null!=l){let i=l<0?st:it,s=l<0?it:st;j?(Y>0&&null!=V[n]&&F(q.get(V[n]),r,o+lt(Y/2),C,at(0,h-Y),i,s),null!=G[n]&&F(K.get(G[n]),r,o+lt(Y/2),C,at(0,h-Y),i,s)):F(et,r,o+lt(Y/2),C,at(0,h-Y),i,s),I(t,e,n,r-Y/2,o,C+Y,h)}}return Y>0?tt.stroke=j?q:et:j||(tt._fill=0==_.width?_._fill:_._stroke??_._fill,tt.width=0),tt.fill=j?K:et,tt}))},t.spline=function(t){return function(t,e){const n=J(e?.alignGaps,0);return(e,l,i,s)=>un(e,l,((r,a,o,u,h,d,c,f,_,p,m)=>{let g,w,b,v=r.pxRound,x=t=>v(d(t,u,p,f)),k=t=>v(c(t,h,m,_));0==u.ori?(g=gn,b=bn,w=En):(g=wn,b=vn,w=An);const y=u.dir*(0==u.ori?1:-1);i=W(o,i,s,1),s=W(o,i,s,-1);let z=x(a[1==y?i:s]),E=z,A=[],S=[];for(let t=1==y?i:s;t>=i&&t<=s;t+=y)if(null!=o[t]){let e=x(a[t]);A.push(E=e),S.push(k(o[t]))}const M={stroke:t(A,S,g,b,w,v),fill:null,clip:null,band:null,gaps:null,flags:1},T=M.stroke;let[R,D]=hn(e,l);if(null!=r.fill||0!=R){let t=M.fill=new Path2D(T),n=k(r.fillTo(e,l,r.min,r.max,R));b(t,E,n),b(t,z,n)}if(!r.spanGaps){let t=[];t.push(..._n(a,o,i,s,y,x,n)),M.gaps=t=r.gaps(e,l,i,s,t),M.clip=fn(t,u.ori,f,_,p,m)}return 0!=D&&(M.band=2==D?[cn(e,l,i,s,T,-1),cn(e,l,i,s,T,1)]:cn(e,l,i,s,T,D)),M}))}(Un,t)}}var Xn=n(379),$n=n.n(Xn),Qn=n(795),tl=n.n(Qn),el=n(569),nl=n.n(el),ll=n(565),il=n.n(ll),sl=n(216),rl=n.n(sl),al=n(589),ol=n.n(al),ul=n(350),hl={};function dl(t){var e,n=HTMLWidgets.find("#"+t);return void 0!==n&&(e=n.getWidget()),e}function cl(t,e){let n=[],l=[],i=t[0].length,s=Array(i);for(let t=0;ts[e]+=+t)));for(let n=1;nl>n&&!e(l))),n]});return l=l.filter((t=>t.series[1]>-1)),{data:[t[0]].concat(n),bands:l}}function fl(t){let e=t.length;for(;--e>=0;)t[e]=0}hl.styleTagTransform=ol(),hl.setAttributes=il(),hl.insert=nl().bind(null,"head"),hl.domAPI=tl(),hl.insertStyleElement=rl(),$n()(ul.Z,hl),ul.Z&&ul.Z.locals&&ul.Z.locals;const _l=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),pl=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),ml=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),gl=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),wl=new Array(576);fl(wl);const bl=new Array(60);fl(bl);const vl=new Array(512);fl(vl);const xl=new Array(256);fl(xl);const kl=new Array(29);fl(kl);const yl=new Array(30);function zl(t,e,n,l,i){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=l,this.max_length=i,this.has_stree=t&&t.length}let El,Al,Sl;function Ml(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}fl(yl);const Tl=t=>t<256?vl[t]:vl[256+(t>>>7)],Rl=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},Dl=(t,e,n)=>{t.bi_valid>16-n?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=n-16):(t.bi_buf|=e<{Dl(t,n[2*e],n[2*e+1])},Ul=(t,e)=>{let n=0;do{n|=1&t,t>>>=1,n<<=1}while(--e>0);return n>>>1},Ol=(t,e,n)=>{const l=new Array(16);let i,s,r=0;for(i=1;i<=15;i++)r=r+n[i-1]<<1,l[i]=r;for(s=0;s<=e;s++){let e=t[2*s+1];0!==e&&(t[2*s]=Ul(l[e]++,e))}},Cl=t=>{let e;for(e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<30;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},Ll=t=>{t.bi_valid>8?Rl(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Fl=(t,e,n,l)=>{const i=2*e,s=2*n;return t[i]{const l=t.heap[n];let i=n<<1;for(;i<=t.heap_len&&(i{let l,i,s,r,a=0;if(0!==t.sym_next)do{l=255&t.pending_buf[t.sym_buf+a++],l+=(255&t.pending_buf[t.sym_buf+a++])<<8,i=t.pending_buf[t.sym_buf+a++],0===l?Zl(t,i,e):(s=xl[i],Zl(t,s+256+1,e),r=_l[s],0!==r&&(i-=kl[s],Dl(t,i,r)),l--,s=Tl(l),Zl(t,s,n),r=pl[s],0!==r&&(l-=yl[s],Dl(t,l,r)))}while(a{const n=e.dyn_tree,l=e.stat_desc.static_tree,i=e.stat_desc.has_stree,s=e.stat_desc.elems;let r,a,o,u=-1;for(t.heap_len=0,t.heap_max=573,r=0;r>1;r>=1;r--)Il(t,n,r);o=s;do{r=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Il(t,n,1),a=t.heap[1],t.heap[--t.heap_max]=r,t.heap[--t.heap_max]=a,n[2*o]=n[2*r]+n[2*a],t.depth[o]=(t.depth[r]>=t.depth[a]?t.depth[r]:t.depth[a])+1,n[2*r+1]=n[2*a+1]=o,t.heap[1]=o++,Il(t,n,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const n=e.dyn_tree,l=e.max_code,i=e.stat_desc.static_tree,s=e.stat_desc.has_stree,r=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,o=e.stat_desc.max_length;let u,h,d,c,f,_,p=0;for(c=0;c<=15;c++)t.bl_count[c]=0;for(n[2*t.heap[t.heap_max]+1]=0,u=t.heap_max+1;u<573;u++)h=t.heap[u],c=n[2*n[2*h+1]+1]+1,c>o&&(c=o,p++),n[2*h+1]=c,h>l||(t.bl_count[c]++,f=0,h>=a&&(f=r[h-a]),_=n[2*h],t.opt_len+=_*(c+f),s&&(t.static_len+=_*(i[2*h+1]+f)));if(0!==p){do{for(c=o-1;0===t.bl_count[c];)c--;t.bl_count[c]--,t.bl_count[c+1]+=2,t.bl_count[o]--,p-=2}while(p>0);for(c=o;0!==c;c--)for(h=t.bl_count[c];0!==h;)d=t.heap[--u],d>l||(n[2*d+1]!==c&&(t.opt_len+=(c-n[2*d+1])*n[2*d],n[2*d+1]=c),h--)}})(t,e),Ol(n,u,t.bl_count)},Bl=(t,e,n)=>{let l,i,s=-1,r=e[1],a=0,o=7,u=4;for(0===r&&(o=138,u=3),e[2*(n+1)+1]=65535,l=0;l<=n;l++)i=r,r=e[2*(l+1)+1],++a{let l,i,s=-1,r=e[1],a=0,o=7,u=4;for(0===r&&(o=138,u=3),l=0;l<=n;l++)if(i=r,r=e[2*(l+1)+1],!(++a{Dl(t,0+(l?1:0),3),Ll(t),Rl(t,n),Rl(t,~n),n&&t.pending_buf.set(t.window.subarray(e,e+n),t.pending),t.pending+=n};var jl={_tr_init:t=>{Wl||((()=>{let t,e,n,l,i;const s=new Array(16);for(n=0,l=0;l<28;l++)for(kl[l]=n,t=0;t<1<<_l[l];t++)xl[n++]=l;for(xl[n-1]=l,i=0,l=0;l<16;l++)for(yl[l]=i,t=0;t<1<>=7;l<30;l++)for(yl[l]=i<<7,t=0;t<1<{let i,s,r=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,n=4093624447;for(e=0;e<=31;e++,n>>>=1)if(1&n&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<256;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0})(t)),Nl(t,t.l_desc),Nl(t,t.d_desc),r=(t=>{let e;for(Bl(t,t.dyn_ltree,t.l_desc.max_code),Bl(t,t.dyn_dtree,t.d_desc.max_code),Nl(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*gl[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),i=t.opt_len+3+7>>>3,s=t.static_len+3+7>>>3,s<=i&&(i=s)):i=s=n+5,n+4<=i&&-1!==e?Yl(t,e,n,l):4===t.strategy||s===i?(Dl(t,2+(l?1:0),3),Pl(t,wl,bl)):(Dl(t,4+(l?1:0),3),((t,e,n,l)=>{let i;for(Dl(t,e-257,5),Dl(t,n-1,5),Dl(t,l-4,4),i=0;i(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=n,0===e?t.dyn_ltree[2*n]++:(t.matches++,e--,t.dyn_ltree[2*(xl[n]+256+1)]++,t.dyn_dtree[2*Tl(e)]++),t.sym_next===t.sym_end),_tr_align:t=>{Dl(t,2,3),Zl(t,256,wl),(t=>{16===t.bi_valid?(Rl(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)}},Gl=(t,e,n,l)=>{let i=65535&t|0,s=t>>>16&65535|0,r=0;for(;0!==n;){r=n>2e3?2e3:n,n-=r;do{i=i+e[l++]|0,s=s+i|0}while(--r);i%=65521,s%=65521}return i|s<<16|0};const Kl=new Uint32Array((()=>{let t,e=[];for(var n=0;n<256;n++){t=n;for(var l=0;l<8;l++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e})());var Vl=(t,e,n,l)=>{const i=Kl,s=l+n;t^=-1;for(let n=l;n>>8^i[255&(t^e[n])];return-1^t},ql={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Jl={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:Xl,_tr_stored_block:$l,_tr_flush_block:Ql,_tr_tally:ti,_tr_align:ei}=jl,{Z_NO_FLUSH:ni,Z_PARTIAL_FLUSH:li,Z_FULL_FLUSH:ii,Z_FINISH:si,Z_BLOCK:ri,Z_OK:ai,Z_STREAM_END:oi,Z_STREAM_ERROR:ui,Z_DATA_ERROR:hi,Z_BUF_ERROR:di,Z_DEFAULT_COMPRESSION:ci,Z_FILTERED:fi,Z_HUFFMAN_ONLY:_i,Z_RLE:pi,Z_FIXED:mi,Z_DEFAULT_STRATEGY:gi,Z_UNKNOWN:wi,Z_DEFLATED:bi}=Jl,vi=258,xi=262,ki=42,yi=113,zi=666,Ei=(t,e)=>(t.msg=ql[e],e),Ai=t=>2*t-(t>4?9:0),Si=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Mi=t=>{let e,n,l,i=t.w_size;e=t.hash_size,l=e;do{n=t.head[--l],t.head[l]=n>=i?n-i:0}while(--e);e=i,l=e;do{n=t.prev[--l],t.prev[l]=n>=i?n-i:0}while(--e)};let Ti=(t,e,n)=>(e<{const e=t.state;let n=e.pending;n>t.avail_out&&(n=t.avail_out),0!==n&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+n),t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,0===e.pending&&(e.pending_out=0))},Di=(t,e)=>{Ql(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Ri(t.strm)},Zi=(t,e)=>{t.pending_buf[t.pending++]=e},Ui=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},Oi=(t,e,n,l)=>{let i=t.avail_in;return i>l&&(i=l),0===i?0:(t.avail_in-=i,e.set(t.input.subarray(t.next_in,t.next_in+i),n),1===t.state.wrap?t.adler=Gl(t.adler,e,i,n):2===t.state.wrap&&(t.adler=Vl(t.adler,e,i,n)),t.next_in+=i,t.total_in+=i,i)},Ci=(t,e)=>{let n,l,i=t.max_chain_length,s=t.strstart,r=t.prev_length,a=t.nice_match;const o=t.strstart>t.w_size-xi?t.strstart-(t.w_size-xi):0,u=t.window,h=t.w_mask,d=t.prev,c=t.strstart+vi;let f=u[s+r-1],_=u[s+r];t.prev_length>=t.good_match&&(i>>=2),a>t.lookahead&&(a=t.lookahead);do{if(n=e,u[n+r]===_&&u[n+r-1]===f&&u[n]===u[s]&&u[++n]===u[s+1]){s+=2,n++;do{}while(u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&sr){if(t.match_start=e,r=l,l>=a)break;f=u[s+r-1],_=u[s+r]}}}while((e=d[e&h])>o&&0!=--i);return r<=t.lookahead?r:t.lookahead},Li=t=>{const e=t.w_size;let n,l,i;do{if(l=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-xi)&&(t.window.set(t.window.subarray(e,e+e-l),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Mi(t),l+=e),0===t.strm.avail_in)break;if(n=Oi(t.strm,t.window,t.strstart+t.lookahead,l),t.lookahead+=n,t.lookahead+t.insert>=3)for(i=t.strstart-t.insert,t.ins_h=t.window[i],t.ins_h=Ti(t,t.ins_h,t.window[i+1]);t.insert&&(t.ins_h=Ti(t,t.ins_h,t.window[i+3-1]),t.prev[i&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=i,i++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead{let n,l,i,s=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,r=0,a=t.strm.avail_in;do{if(n=65535,i=t.bi_valid+42>>3,t.strm.avail_outl+t.strm.avail_in&&(n=l+t.strm.avail_in),n>i&&(n=i),n>8,t.pending_buf[t.pending-2]=~n,t.pending_buf[t.pending-1]=~n>>8,Ri(t.strm),l&&(l>n&&(l=n),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+l),t.strm.next_out),t.strm.next_out+=l,t.strm.avail_out-=l,t.strm.total_out+=l,t.block_start+=l,n-=l),n&&(Oi(t.strm,t.strm.output,t.strm.next_out,n),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n)}while(0===r);return a-=t.strm.avail_in,a&&(a>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=a&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-a,t.strm.next_in),t.strstart),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.block_start=t.strstart),t.high_wateri&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,i+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),i>t.strm.avail_in&&(i=t.strm.avail_in),i&&(Oi(t.strm,t.window,t.strstart,i),t.strstart+=i,t.insert+=i>t.w_size-t.insert?t.w_size-t.insert:i),t.high_water>3,i=t.pending_buf_size-i>65535?65535:t.pending_buf_size-i,s=i>t.w_size?t.w_size:i,l=t.strstart-t.block_start,(l>=s||(l||e===si)&&e!==ni&&0===t.strm.avail_in&&l<=i)&&(n=l>i?i:l,r=e===si&&0===t.strm.avail_in&&n===l?1:0,$l(t,t.block_start,n,r),t.block_start+=n,Ri(t.strm)),r?3:1)},Ii=(t,e)=>{let n,l;for(;;){if(t.lookahead=3&&(t.ins_h=Ti(t,t.ins_h,t.window[t.strstart+3-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==n&&t.strstart-n<=t.w_size-xi&&(t.match_length=Ci(t,n)),t.match_length>=3)if(l=ti(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=Ti(t,t.ins_h,t.window[t.strstart+3-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=Ti(t,t.ins_h,t.window[t.strstart+1]);else l=ti(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(l&&(Di(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===si?(Di(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Di(t,!1),0===t.strm.avail_out)?1:2},Pi=(t,e)=>{let n,l,i;for(;;){if(t.lookahead=3&&(t.ins_h=Ti(t,t.ins_h,t.window[t.strstart+3-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==n&&t.prev_length4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-3,l=ti(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=i&&(t.ins_h=Ti(t,t.ins_h,t.window[t.strstart+3-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,l&&(Di(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(l=ti(t,0,t.window[t.strstart-1]),l&&Di(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(l=ti(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===si?(Di(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Di(t,!1),0===t.strm.avail_out)?1:2};function Ni(t,e,n,l,i){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=l,this.func=i}const Bi=[new Ni(0,0,0,0,Fi),new Ni(4,4,8,4,Ii),new Ni(4,5,16,8,Ii),new Ni(4,6,32,32,Ii),new Ni(4,4,16,16,Pi),new Ni(8,16,32,32,Pi),new Ni(8,16,128,128,Pi),new Ni(8,32,128,256,Pi),new Ni(32,128,258,1024,Pi),new Ni(32,258,258,4096,Pi)];function Hi(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=bi,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Si(this.dyn_ltree),Si(this.dyn_dtree),Si(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Si(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Si(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Wi=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==ki&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==yi&&e.status!==zi?1:0},Yi=t=>{if(Wi(t))return Ei(t,ui);t.total_in=t.total_out=0,t.data_type=wi;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?ki:yi,t.adler=2===e.wrap?0:1,e.last_flush=-2,Xl(e),ai},ji=t=>{const e=Yi(t);var n;return e===ai&&((n=t.state).window_size=2*n.w_size,Si(n.head),n.max_lazy_match=Bi[n.level].max_lazy,n.good_match=Bi[n.level].good_length,n.nice_match=Bi[n.level].nice_length,n.max_chain_length=Bi[n.level].max_chain,n.strstart=0,n.block_start=0,n.lookahead=0,n.insert=0,n.match_length=n.prev_length=2,n.match_available=0,n.ins_h=0),e},Gi=(t,e,n,l,i,s)=>{if(!t)return ui;let r=1;if(e===ci&&(e=6),l<0?(r=0,l=-l):l>15&&(r=2,l-=16),i<1||i>9||n!==bi||l<8||l>15||e<0||e>9||s<0||s>mi||8===l&&1!==r)return Ei(t,ui);8===l&&(l=9);const a=new Hi;return t.state=a,a.strm=t,a.status=ki,a.wrap=r,a.gzhead=null,a.w_bits=l,a.w_size=1<Wi(t)||2!==t.state.wrap?ui:(t.state.gzhead=e,ai),qi=(t,e)=>{if(Wi(t)||e>ri||e<0)return t?Ei(t,ui):ui;const n=t.state;if(!t.output||0!==t.avail_in&&!t.input||n.status===zi&&e!==si)return Ei(t,0===t.avail_out?di:ui);const l=n.last_flush;if(n.last_flush=e,0!==n.pending){if(Ri(t),0===t.avail_out)return n.last_flush=-1,ai}else if(0===t.avail_in&&Ai(e)<=Ai(l)&&e!==si)return Ei(t,di);if(n.status===zi&&0!==t.avail_in)return Ei(t,di);if(n.status===ki&&0===n.wrap&&(n.status=yi),n.status===ki){let e=bi+(n.w_bits-8<<4)<<8,l=-1;if(l=n.strategy>=_i||n.level<2?0:n.level<6?1:6===n.level?2:3,e|=l<<6,0!==n.strstart&&(e|=32),e+=31-e%31,Ui(n,e),0!==n.strstart&&(Ui(n,t.adler>>>16),Ui(n,65535&t.adler)),t.adler=1,n.status=yi,Ri(t),0!==n.pending)return n.last_flush=-1,ai}if(57===n.status)if(t.adler=0,Zi(n,31),Zi(n,139),Zi(n,8),n.gzhead)Zi(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Zi(n,255&n.gzhead.time),Zi(n,n.gzhead.time>>8&255),Zi(n,n.gzhead.time>>16&255),Zi(n,n.gzhead.time>>24&255),Zi(n,9===n.level?2:n.strategy>=_i||n.level<2?4:0),Zi(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(Zi(n,255&n.gzhead.extra.length),Zi(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=Vl(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69;else if(Zi(n,0),Zi(n,0),Zi(n,0),Zi(n,0),Zi(n,0),Zi(n,9===n.level?2:n.strategy>=_i||n.level<2?4:0),Zi(n,3),n.status=yi,Ri(t),0!==n.pending)return n.last_flush=-1,ai;if(69===n.status){if(n.gzhead.extra){let e=n.pending,l=(65535&n.gzhead.extra.length)-n.gzindex;for(;n.pending+l>n.pending_buf_size;){let i=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>e&&(t.adler=Vl(t.adler,n.pending_buf,n.pending-e,e)),n.gzindex+=i,Ri(t),0!==n.pending)return n.last_flush=-1,ai;e=0,l-=i}let i=new Uint8Array(n.gzhead.extra);n.pending_buf.set(i.subarray(n.gzindex,n.gzindex+l),n.pending),n.pending+=l,n.gzhead.hcrc&&n.pending>e&&(t.adler=Vl(t.adler,n.pending_buf,n.pending-e,e)),n.gzindex=0}n.status=73}if(73===n.status){if(n.gzhead.name){let e,l=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>l&&(t.adler=Vl(t.adler,n.pending_buf,n.pending-l,l)),Ri(t),0!==n.pending)return n.last_flush=-1,ai;l=0}e=n.gzindexl&&(t.adler=Vl(t.adler,n.pending_buf,n.pending-l,l)),n.gzindex=0}n.status=91}if(91===n.status){if(n.gzhead.comment){let e,l=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>l&&(t.adler=Vl(t.adler,n.pending_buf,n.pending-l,l)),Ri(t),0!==n.pending)return n.last_flush=-1,ai;l=0}e=n.gzindexl&&(t.adler=Vl(t.adler,n.pending_buf,n.pending-l,l))}n.status=103}if(103===n.status){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Ri(t),0!==n.pending))return n.last_flush=-1,ai;Zi(n,255&t.adler),Zi(n,t.adler>>8&255),t.adler=0}if(n.status=yi,Ri(t),0!==n.pending)return n.last_flush=-1,ai}if(0!==t.avail_in||0!==n.lookahead||e!==ni&&n.status!==zi){let l=0===n.level?Fi(n,e):n.strategy===_i?((t,e)=>{let n;for(;;){if(0===t.lookahead&&(Li(t),0===t.lookahead)){if(e===ni)return 1;break}if(t.match_length=0,n=ti(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(Di(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===si?(Di(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Di(t,!1),0===t.strm.avail_out)?1:2})(n,e):n.strategy===pi?((t,e)=>{let n,l,i,s;const r=t.window;for(;;){if(t.lookahead<=vi){if(Li(t),t.lookahead<=vi&&e===ni)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(i=t.strstart-1,l=r[i],l===r[++i]&&l===r[++i]&&l===r[++i])){s=t.strstart+vi;do{}while(l===r[++i]&&l===r[++i]&&l===r[++i]&&l===r[++i]&&l===r[++i]&&l===r[++i]&&l===r[++i]&&l===r[++i]&&it.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(n=ti(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=ti(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(Di(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===si?(Di(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Di(t,!1),0===t.strm.avail_out)?1:2})(n,e):Bi[n.level].func(n,e);if(3!==l&&4!==l||(n.status=zi),1===l||3===l)return 0===t.avail_out&&(n.last_flush=-1),ai;if(2===l&&(e===li?ei(n):e!==ri&&($l(n,0,0,!1),e===ii&&(Si(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),Ri(t),0===t.avail_out))return n.last_flush=-1,ai}return e!==si?ai:n.wrap<=0?oi:(2===n.wrap?(Zi(n,255&t.adler),Zi(n,t.adler>>8&255),Zi(n,t.adler>>16&255),Zi(n,t.adler>>24&255),Zi(n,255&t.total_in),Zi(n,t.total_in>>8&255),Zi(n,t.total_in>>16&255),Zi(n,t.total_in>>24&255)):(Ui(n,t.adler>>>16),Ui(n,65535&t.adler)),Ri(t),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?ai:oi)},Ji=t=>{if(Wi(t))return ui;const e=t.state.status;return t.state=null,e===yi?Ei(t,hi):ai},Xi=(t,e)=>{let n=e.length;if(Wi(t))return ui;const l=t.state,i=l.wrap;if(2===i||1===i&&l.status!==ki||l.lookahead)return ui;if(1===i&&(t.adler=Gl(t.adler,e,n,0)),l.wrap=0,n>=l.w_size){0===i&&(Si(l.head),l.strstart=0,l.block_start=0,l.insert=0);let t=new Uint8Array(l.w_size);t.set(e.subarray(n-l.w_size,n),0),e=t,n=l.w_size}const s=t.avail_in,r=t.next_in,a=t.input;for(t.avail_in=n,t.next_in=0,t.input=e,Li(l);l.lookahead>=3;){let t=l.strstart,e=l.lookahead-2;do{l.ins_h=Ti(l,l.ins_h,l.window[t+3-1]),l.prev[t&l.w_mask]=l.head[l.ins_h],l.head[l.ins_h]=t,t++}while(--e);l.strstart=t,l.lookahead=2,Li(l)}return l.strstart+=l.lookahead,l.block_start=l.strstart,l.insert=l.lookahead,l.lookahead=0,l.match_length=l.prev_length=2,l.match_available=0,t.next_in=r,t.input=a,t.avail_in=s,l.wrap=i,ai};const $i=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var Qi=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const n=e.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(const e in n)$i(n,e)&&(t[e]=n[e])}}return t},ts=t=>{let e=0;for(let n=0,l=t.length;n=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;ns[254]=ns[254]=1;var ls=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,n,l,i,s,r=t.length,a=0;for(i=0;i>>6,e[s++]=128|63&n):n<65536?(e[s++]=224|n>>>12,e[s++]=128|n>>>6&63,e[s++]=128|63&n):(e[s++]=240|n>>>18,e[s++]=128|n>>>12&63,e[s++]=128|n>>>6&63,e[s++]=128|63&n);return e},is=(t,e)=>{const n=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let l,i;const s=new Array(2*n);for(i=0,l=0;l4)s[i++]=65533,l+=r-1;else{for(e&=2===r?31:3===r?15:7;r>1&&l1?s[i++]=65533:e<65536?s[i++]=e:(e-=65536,s[i++]=55296|e>>10&1023,s[i++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&es)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let n="";for(let l=0;l{(e=e||t.length)>t.length&&(e=t.length);let n=e-1;for(;n>=0&&128==(192&t[n]);)n--;return n<0||0===n?e:n+ns[t[n]]>e?n:e},rs=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const as=Object.prototype.toString,{Z_NO_FLUSH:os,Z_SYNC_FLUSH:us,Z_FULL_FLUSH:hs,Z_FINISH:ds,Z_OK:cs,Z_STREAM_END:fs,Z_DEFAULT_COMPRESSION:_s,Z_DEFAULT_STRATEGY:ps,Z_DEFLATED:ms}=Jl;function gs(t){this.options=Qi({level:_s,method:ms,chunkSize:16384,windowBits:15,memLevel:8,strategy:ps},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new rs,this.strm.avail_out=0;let n=Ki(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(n!==cs)throw new Error(ql[n]);if(e.header&&Vi(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?ls(e.dictionary):"[object ArrayBuffer]"===as.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,n=Xi(this.strm,t),n!==cs)throw new Error(ql[n]);this._dict_set=!0}}function ws(t,e){const n=new gs(e);if(n.push(t,!0),n.err)throw n.msg||ql[n.err];return n.result}gs.prototype.push=function(t,e){const n=this.strm,l=this.options.chunkSize;let i,s;if(this.ended)return!1;for(s=e===~~e?e:!0===e?ds:os,"string"==typeof t?n.input=ls(t):"[object ArrayBuffer]"===as.call(t)?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;;)if(0===n.avail_out&&(n.output=new Uint8Array(l),n.next_out=0,n.avail_out=l),(s===us||s===hs)&&n.avail_out<=6)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else{if(i=qi(n,s),i===fs)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=Ji(this.strm),this.onEnd(i),this.ended=!0,i===cs;if(0!==n.avail_out){if(s>0&&n.next_out>0)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else if(0===n.avail_in)break}else this.onData(n.output)}return!0},gs.prototype.onData=function(t){this.chunks.push(t)},gs.prototype.onEnd=function(t){t===cs&&(this.result=ts(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var bs={Deflate:gs,deflate:ws,deflateRaw:function(t,e){return(e=e||{}).raw=!0,ws(t,e)},gzip:function(t,e){return(e=e||{}).gzip=!0,ws(t,e)},constants:Jl};const vs=16209;var xs=function(t,e){let n,l,i,s,r,a,o,u,h,d,c,f,_,p,m,g,w,b,v,x,k,y,z,E;const A=t.state;n=t.next_in,z=t.input,l=n+(t.avail_in-5),i=t.next_out,E=t.output,s=i-(e-t.avail_out),r=i+(t.avail_out-257),a=A.dmax,o=A.wsize,u=A.whave,h=A.wnext,d=A.window,c=A.hold,f=A.bits,_=A.lencode,p=A.distcode,m=(1<>>24,c>>>=b,f-=b,b=w>>>16&255,0===b)E[i++]=65535&w;else{if(!(16&b)){if(0==(64&b)){w=_[(65535&w)+(c&(1<>>=b,f-=b),f<15&&(c+=z[n++]<>>24,c>>>=b,f-=b,b=w>>>16&255,!(16&b)){if(0==(64&b)){w=p[(65535&w)+(c&(1<a){t.msg="invalid distance too far back",A.mode=vs;break t}if(c>>>=b,f-=b,b=i-s,x>b){if(b=x-b,b>u&&A.sane){t.msg="invalid distance too far back",A.mode=vs;break t}if(k=0,y=d,0===h){if(k+=o-b,b2;)E[i++]=y[k++],E[i++]=y[k++],E[i++]=y[k++],v-=3;v&&(E[i++]=y[k++],v>1&&(E[i++]=y[k++]))}else{k=i-x;do{E[i++]=E[k++],E[i++]=E[k++],E[i++]=E[k++],v-=3}while(v>2);v&&(E[i++]=E[k++],v>1&&(E[i++]=E[k++]))}break}}break}}while(n>3,n-=v,f-=v<<3,c&=(1<{const o=a.bits;let u,h,d,c,f,_,p=0,m=0,g=0,w=0,b=0,v=0,x=0,k=0,y=0,z=0,E=null;const A=new Uint16Array(16),S=new Uint16Array(16);let M,T,R,D=null;for(p=0;p<=15;p++)A[p]=0;for(m=0;m=1&&0===A[w];w--);if(b>w&&(b=w),0===w)return i[s++]=20971520,i[s++]=20971520,a.bits=1,0;for(g=1;g0&&(0===t||1!==w))return-1;for(S[1]=0,p=1;p<15;p++)S[p+1]=S[p]+A[p];for(m=0;m852||2===t&&y>592)return 1;for(;;){M=p-x,r[m]+1<_?(T=0,R=r[m]):r[m]>=_?(T=D[r[m]-_],R=E[r[m]-_]):(T=96,R=0),u=1<>x)+h]=M<<24|T<<16|R|0}while(0!==h);for(u=1<>=1;if(0!==u?(z&=u-1,z+=u):z=0,m++,0==--A[p]){if(p===w)break;p=e[n+r[m]]}if(p>b&&(z&c)!==d){for(0===x&&(x=b),f+=g,v=p-x,k=1<852||2===t&&y>592)return 1;d=z&c,i[d]=b<<24|v<<16|f-s|0}}return 0!==z&&(i[f+z]=p-x<<24|64<<16|0),a.bits=b,0};const{Z_FINISH:Ss,Z_BLOCK:Ms,Z_TREES:Ts,Z_OK:Rs,Z_STREAM_END:Ds,Z_NEED_DICT:Zs,Z_STREAM_ERROR:Us,Z_DATA_ERROR:Os,Z_MEM_ERROR:Cs,Z_BUF_ERROR:Ls,Z_DEFLATED:Fs}=Jl,Is=16180,Ps=16190,Ns=16191,Bs=16192,Hs=16194,Ws=16199,Ys=16200,js=16206,Gs=16209,Ks=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function Vs(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const qs=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode16211?1:0},Js=t=>{if(qs(t))return Us;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Is,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,Rs},Xs=t=>{if(qs(t))return Us;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,Js(t)},$s=(t,e)=>{let n;if(qs(t))return Us;const l=t.state;return e<0?(n=0,e=-e):(n=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Us:(null!==l.window&&l.wbits!==e&&(l.window=null),l.wrap=n,l.wbits=e,Xs(t))},Qs=(t,e)=>{if(!t)return Us;const n=new Vs;t.state=n,n.strm=t,n.window=null,n.mode=Is;const l=$s(t,e);return l!==Rs&&(t.state=null),l};let tr,er,nr=!0;const lr=t=>{if(nr){tr=new Int32Array(512),er=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(As(1,t.lens,0,288,tr,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;As(2,t.lens,0,32,er,0,t.work,{bits:5}),nr=!1}t.lencode=tr,t.lenbits=9,t.distcode=er,t.distbits=5},ir=(t,e,n,l)=>{let i;const s=t.state;return null===s.window&&(s.wsize=1<=s.wsize?(s.window.set(e.subarray(n-s.wsize,n),0),s.wnext=0,s.whave=s.wsize):(i=s.wsize-s.wnext,i>l&&(i=l),s.window.set(e.subarray(n-l,n-l+i),s.wnext),(l-=i)?(s.window.set(e.subarray(n-l,n),0),s.wnext=l,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whave{let n,l,i,s,r,a,o,u,h,d,c,f,_,p,m,g,w,b,v,x,k,y,z=0;const E=new Uint8Array(4);let A,S;const M=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(qs(t)||!t.output||!t.input&&0!==t.avail_in)return Us;n=t.state,n.mode===Ns&&(n.mode=Bs),r=t.next_out,i=t.output,o=t.avail_out,s=t.next_in,l=t.input,a=t.avail_in,u=n.hold,h=n.bits,d=a,c=o,y=Rs;t:for(;;)switch(n.mode){case Is:if(0===n.wrap){n.mode=Bs;break}for(;h<16;){if(0===a)break t;a--,u+=l[s++]<>>8&255,n.check=Vl(n.check,E,2,0),u=0,h=0,n.mode=16181;break}if(n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&u)<<8)+(u>>8))%31){t.msg="incorrect header check",n.mode=Gs;break}if((15&u)!==Fs){t.msg="unknown compression method",n.mode=Gs;break}if(u>>>=4,h-=4,k=8+(15&u),0===n.wbits&&(n.wbits=k),k>15||k>n.wbits){t.msg="invalid window size",n.mode=Gs;break}n.dmax=1<>8&1),512&n.flags&&4&n.wrap&&(E[0]=255&u,E[1]=u>>>8&255,n.check=Vl(n.check,E,2,0)),u=0,h=0,n.mode=16182;case 16182:for(;h<32;){if(0===a)break t;a--,u+=l[s++]<>>8&255,E[2]=u>>>16&255,E[3]=u>>>24&255,n.check=Vl(n.check,E,4,0)),u=0,h=0,n.mode=16183;case 16183:for(;h<16;){if(0===a)break t;a--,u+=l[s++]<>8),512&n.flags&&4&n.wrap&&(E[0]=255&u,E[1]=u>>>8&255,n.check=Vl(n.check,E,2,0)),u=0,h=0,n.mode=16184;case 16184:if(1024&n.flags){for(;h<16;){if(0===a)break t;a--,u+=l[s++]<>>8&255,n.check=Vl(n.check,E,2,0)),u=0,h=0}else n.head&&(n.head.extra=null);n.mode=16185;case 16185:if(1024&n.flags&&(f=n.length,f>a&&(f=a),f&&(n.head&&(k=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(l.subarray(s,s+f),k)),512&n.flags&&4&n.wrap&&(n.check=Vl(n.check,l,f,s)),a-=f,s+=f,n.length-=f),n.length))break t;n.length=0,n.mode=16186;case 16186:if(2048&n.flags){if(0===a)break t;f=0;do{k=l[s+f++],n.head&&k&&n.length<65536&&(n.head.name+=String.fromCharCode(k))}while(k&&f>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=Ns;break;case 16189:for(;h<32;){if(0===a)break t;a--,u+=l[s++]<>>=7&h,h-=7&h,n.mode=js;break}for(;h<3;){if(0===a)break t;a--,u+=l[s++]<>>=1,h-=1,3&u){case 0:n.mode=16193;break;case 1:if(lr(n),n.mode=Ws,e===Ts){u>>>=2,h-=2;break t}break;case 2:n.mode=16196;break;case 3:t.msg="invalid block type",n.mode=Gs}u>>>=2,h-=2;break;case 16193:for(u>>>=7&h,h-=7&h;h<32;){if(0===a)break t;a--,u+=l[s++]<>>16^65535)){t.msg="invalid stored block lengths",n.mode=Gs;break}if(n.length=65535&u,u=0,h=0,n.mode=Hs,e===Ts)break t;case Hs:n.mode=16195;case 16195:if(f=n.length,f){if(f>a&&(f=a),f>o&&(f=o),0===f)break t;i.set(l.subarray(s,s+f),r),a-=f,s+=f,o-=f,r+=f,n.length-=f;break}n.mode=Ns;break;case 16196:for(;h<14;){if(0===a)break t;a--,u+=l[s++]<>>=5,h-=5,n.ndist=1+(31&u),u>>>=5,h-=5,n.ncode=4+(15&u),u>>>=4,h-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=Gs;break}n.have=0,n.mode=16197;case 16197:for(;n.have>>=3,h-=3}for(;n.have<19;)n.lens[M[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,A={bits:n.lenbits},y=As(0,n.lens,0,19,n.lencode,0,n.work,A),n.lenbits=A.bits,y){t.msg="invalid code lengths set",n.mode=Gs;break}n.have=0,n.mode=16198;case 16198:for(;n.have>>24,g=z>>>16&255,w=65535&z,!(m<=h);){if(0===a)break t;a--,u+=l[s++]<>>=m,h-=m,n.lens[n.have++]=w;else{if(16===w){for(S=m+2;h>>=m,h-=m,0===n.have){t.msg="invalid bit length repeat",n.mode=Gs;break}k=n.lens[n.have-1],f=3+(3&u),u>>>=2,h-=2}else if(17===w){for(S=m+3;h>>=m,h-=m,k=0,f=3+(7&u),u>>>=3,h-=3}else{for(S=m+7;h>>=m,h-=m,k=0,f=11+(127&u),u>>>=7,h-=7}if(n.have+f>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=Gs;break}for(;f--;)n.lens[n.have++]=k}}if(n.mode===Gs)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=Gs;break}if(n.lenbits=9,A={bits:n.lenbits},y=As(1,n.lens,0,n.nlen,n.lencode,0,n.work,A),n.lenbits=A.bits,y){t.msg="invalid literal/lengths set",n.mode=Gs;break}if(n.distbits=6,n.distcode=n.distdyn,A={bits:n.distbits},y=As(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,A),n.distbits=A.bits,y){t.msg="invalid distances set",n.mode=Gs;break}if(n.mode=Ws,e===Ts)break t;case Ws:n.mode=Ys;case Ys:if(a>=6&&o>=258){t.next_out=r,t.avail_out=o,t.next_in=s,t.avail_in=a,n.hold=u,n.bits=h,xs(t,c),r=t.next_out,i=t.output,o=t.avail_out,s=t.next_in,l=t.input,a=t.avail_in,u=n.hold,h=n.bits,n.mode===Ns&&(n.back=-1);break}for(n.back=0;z=n.lencode[u&(1<>>24,g=z>>>16&255,w=65535&z,!(m<=h);){if(0===a)break t;a--,u+=l[s++]<>b)],m=z>>>24,g=z>>>16&255,w=65535&z,!(b+m<=h);){if(0===a)break t;a--,u+=l[s++]<>>=b,h-=b,n.back+=b}if(u>>>=m,h-=m,n.back+=m,n.length=w,0===g){n.mode=16205;break}if(32&g){n.back=-1,n.mode=Ns;break}if(64&g){t.msg="invalid literal/length code",n.mode=Gs;break}n.extra=15&g,n.mode=16201;case 16201:if(n.extra){for(S=n.extra;h>>=n.extra,h-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=16202;case 16202:for(;z=n.distcode[u&(1<>>24,g=z>>>16&255,w=65535&z,!(m<=h);){if(0===a)break t;a--,u+=l[s++]<>b)],m=z>>>24,g=z>>>16&255,w=65535&z,!(b+m<=h);){if(0===a)break t;a--,u+=l[s++]<>>=b,h-=b,n.back+=b}if(u>>>=m,h-=m,n.back+=m,64&g){t.msg="invalid distance code",n.mode=Gs;break}n.offset=w,n.extra=15&g,n.mode=16203;case 16203:if(n.extra){for(S=n.extra;h>>=n.extra,h-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=Gs;break}n.mode=16204;case 16204:if(0===o)break t;if(f=c-o,n.offset>f){if(f=n.offset-f,f>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=Gs;break}f>n.wnext?(f-=n.wnext,_=n.wsize-f):_=n.wnext-f,f>n.length&&(f=n.length),p=n.window}else p=i,_=r-n.offset,f=n.length;f>o&&(f=o),o-=f,n.length-=f;do{i[r++]=p[_++]}while(--f);0===n.length&&(n.mode=Ys);break;case 16205:if(0===o)break t;i[r++]=n.length,o--,n.mode=Ys;break;case js:if(n.wrap){for(;h<32;){if(0===a)break t;a--,u|=l[s++]<{if(qs(t))return Us;let e=t.state;return e.window&&(e.window=null),t.state=null,Rs},ur=(t,e)=>{if(qs(t))return Us;const n=t.state;return 0==(2&n.wrap)?Us:(n.head=e,e.done=!1,Rs)},hr=(t,e)=>{const n=e.length;let l,i,s;return qs(t)?Us:(l=t.state,0!==l.wrap&&l.mode!==Ps?Us:l.mode===Ps&&(i=1,i=Gl(i,e,n,0),i!==l.check)?Os:(s=ir(t,e,n,n),s?(l.mode=16210,Cs):(l.havedict=1,Rs)))},dr=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const cr=Object.prototype.toString,{Z_NO_FLUSH:fr,Z_FINISH:_r,Z_OK:pr,Z_STREAM_END:mr,Z_NEED_DICT:gr,Z_STREAM_ERROR:wr,Z_DATA_ERROR:br,Z_MEM_ERROR:vr}=Jl;function xr(t){this.options=Qi({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new rs,this.strm.avail_out=0;let n=rr(this.strm,e.windowBits);if(n!==pr)throw new Error(ql[n]);if(this.header=new dr,ur(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=ls(e.dictionary):"[object ArrayBuffer]"===cr.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(n=hr(this.strm,e.dictionary),n!==pr)))throw new Error(ql[n])}function kr(t,e){const n=new xr(e);if(n.push(t),n.err)throw n.msg||ql[n.err];return n.result}xr.prototype.push=function(t,e){const n=this.strm,l=this.options.chunkSize,i=this.options.dictionary;let s,r,a;if(this.ended)return!1;for(r=e===~~e?e:!0===e?_r:fr,"[object ArrayBuffer]"===cr.call(t)?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;;){for(0===n.avail_out&&(n.output=new Uint8Array(l),n.next_out=0,n.avail_out=l),s=ar(n,r),s===gr&&i&&(s=hr(n,i),s===pr?s=ar(n,r):s===br&&(s=gr));n.avail_in>0&&s===mr&&n.state.wrap>0&&0!==t[n.next_in];)sr(n),s=ar(n,r);switch(s){case wr:case br:case gr:case vr:return this.onEnd(s),this.ended=!0,!1}if(a=n.avail_out,n.next_out&&(0===n.avail_out||s===mr))if("string"===this.options.to){let t=ss(n.output,n.next_out),e=n.next_out-t,i=is(n.output,t);n.next_out=e,n.avail_out=l-e,e&&n.output.set(n.output.subarray(t,t+e),0),this.onData(i)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(s!==pr||0!==a){if(s===mr)return s=or(this.strm),this.onEnd(s),this.ended=!0,!0;if(0===n.avail_in)break}}return!0},xr.prototype.onData=function(t){this.chunks.push(t)},xr.prototype.onEnd=function(t){t===pr&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=ts(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var yr={Inflate:xr,inflate:kr,inflateRaw:function(t,e){return(e=e||{}).raw=!0,kr(t,e)},ungzip:kr,constants:Jl};const{Deflate:zr,deflate:Er,deflateRaw:Ar,gzip:Sr}=bs,{Inflate:Mr,inflate:Tr,inflateRaw:Rr,ungzip:Dr}=yr;var Zr=Dr;const Ur=t=>(e,n)=>{new ResizeObserver((t=>{for(let n of t){let t=n.contentRect.height,l=n.contentRect.width;const i=e.root.querySelectorAll(".u-legend, .u-title");for(let e of i)t-=Math.floor(e.offsetHeight);e.setSize({width:l,height:t})}})).observe(t),t.appendChild(e.root),n()},Or=(t,e,n,l)=>{const i=5*devicePixelRatio;return Jn.orient(t,e,((n,l,s,r,a,o,u,h,d,c,f,_,p,m,g)=>{let w=t.data[e];t.ctx.fillStyle=n.stroke();let b=2*Math.PI;console.time("points");let v=new Path2D;for(let t=0;t=r.min&&e<=r.max&&n>=a.min&&n<=a.max){let t=o(e,r,c,h),l=u(n,a,f,d);v.moveTo(t+i/2,l),g(v,t,l,i/2,0,b)}}console.timeEnd("points"),t.ctx.fill(v)})),null};HTMLWidgets.widget({name:"uPlot",type:"output",factory:function(t,e,n){var l,i,s;return{renderValue:function(r){if(void 0!==l&&l.destroy(),(i=r.config.options).width=e,i.height=n,s=r.config.data,r.use_gzipped_json){const t=atob(s),e=Uint8Array.from(t,(t=>t.charCodeAt(0))),n=Zr(e),l=(new TextDecoder).decode(n);s=JSON.parse(l)}console.log(s),r.stacked?(i.hooks||(i.hooks={}),i.hooks.init=[t=>{[...t.root.querySelectorAll(".u-legend .u-series")].forEach(((e,n)=>{t.series[n]._hide&&(e.style.display="none")}))}],l=function(t,e,n,l,i,s,r,a){let{opts:o,data:u}=function(t,e,n,l){let i=function(t,e){return{scales:{x:{time:!0}},series:e}}(0,e),s=cl(l?l(n):n,(t=>!1));return i.bands=s.bands,i.cursor=i.cursor||{},i.cursor.dataIdx=(t,e,l,i)=>null===n[e][l]?null:l,i.series.forEach((t=>{t.value=(t,e,l,i)=>n[l][i],t.points=t.points||{},t.points.filter=(t,e,l,i)=>{if(l){let t=[];return n[e].forEach(((e,n)=>{null!==e&&t.push(n)})),t}}})),i.scales.y={range:(t,e,n)=>{let l=uPlot.rangeNum(e,n,.1,!0);return[l[0],l[1]]}},i.hooks={setSeries:[(t,e)=>{let l=cl(n,(e=>!t.series[e].show));t.delBand(null),l.bands.forEach((e=>t.addBand(e))),t.setData(l.data)}]},{opts:i,data:s.data}}(0,e,n,l);return o.title=t,o.width=i,o.height=s,o.hooks=Object.assign(o.hooks,r),console.log(o),new uPlot(o,u,a)}(i.title,i.series,s,null,e,n,i.hooks,Ur(t))):l=new Jn(i,s,Ur(t))},getWidget:function(){return l},resize:function(t,e){}}}}),HTMLWidgets.shinyMode&&(Shiny.addCustomMessageHandler("uplot-api",(function(t){var e=dl(t.id);void 0!==e&&e[t.name].apply(null,t.args)})),Shiny.addCustomMessageHandler("uplot-setData",(function(t){var e=dl(t.id);void 0!==e&&e.setData(t.data)})))})();var i=window;for(var s in l)i[s]=l[s];l.__esModule&&Object.defineProperty(i,"__esModule",{value:!0})})(); \ No newline at end of file diff --git a/man/uPlot.Rd b/man/uPlot.Rd index 226fad0..a9a8b70 100644 --- a/man/uPlot.Rd +++ b/man/uPlot.Rd @@ -8,6 +8,7 @@ uPlot( data, options = list(), ..., + use_gzipped_json = FALSE, width = NULL, height = NULL, elementId = NULL @@ -21,6 +22,8 @@ a \code{data.frame} where first column is the x-axis and the others the series t \item{...}{Additional arguments.} +\item{use_gzipped_json}{Use \code{\link[jsonlite:gzjson]{jsonlite::as_gzjson_b64()}} to compress JSON data.} + \item{width, height}{A numeric input in pixels.} \item{elementId}{Use an explicit element ID for the widget.} diff --git a/package-lock.json b/package-lock.json index e730aba..809c5e2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "license": "ISC", "devDependencies": { "css-loader": "^6.7.1", + "pako": "^2.1.0", "style-loader": "^3.3.1", "uplot": "^1.6.30", "webpack": "^5.73.0", @@ -904,6 +905,12 @@ "node": ">=6" } }, + "node_modules/pako": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz", + "integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==", + "dev": true + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -2252,6 +2259,12 @@ "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true }, + "pako": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz", + "integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==", + "dev": true + }, "path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", diff --git a/package.json b/package.json index c58cacc..bbde3db 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "homepage": "https://github.com/pvictor/uPlot#readme", "devDependencies": { "css-loader": "^6.7.1", + "pako": "^2.1.0", "style-loader": "^3.3.1", "uplot": "^1.6.30", "webpack": "^5.73.0", diff --git a/srcjs/widgets/uPlot.js b/srcjs/widgets/uPlot.js index 8d135a5..b2500cb 100644 --- a/srcjs/widgets/uPlot.js +++ b/srcjs/widgets/uPlot.js @@ -3,6 +3,7 @@ import uPlot from "uplot"; import "uplot/dist/uPlot.min.css"; import * as utils from "../modules/utils"; import { stackedChart } from "../modules/stack"; +import { ungzip } from "pako"; const resizer = el => { const func = (u, init) => { @@ -118,6 +119,14 @@ HTMLWidgets.widget({ options.width = width; options.height = height; data = x.config.data; + if (x.use_gzipped_json) { + const gezipedData = atob(data); + const gzipedDataArray = Uint8Array.from(gezipedData, c => c.charCodeAt(0)); + const ungzipedData = ungzip(gzipedDataArray); + const decodedData = new TextDecoder().decode(ungzipedData); + data = JSON.parse(decodedData); + } + console.log(data); if (x.stacked) { if (!options.hooks) options.hooks = {};